@Test public void shouldReturnResourceForGivenPath() { FileLocation fileLocation = new FileLocation("fileStoreId", MODULE, TAG, TENANT_ID,FILENAME,FILE_SOURCE); Resource expectedResource = mock(Resource.class); when(fileRepository.read(Paths.get(FILE_STORAGE_MOUNT_PATH, FILENAME))) .thenReturn(expectedResource); Resource actualResource = diskFileStoreRepository.read(fileLocation); assertEquals(expectedResource, actualResource); }
public Resource read(FileLocation fileLocation) { Resource resource = null; if(fileLocation.getFileSource()==null || fileLocation.getFileSource().equals(diskFileStorage)) { Path path = getPath(fileLocation); resource = fileRepository.read(path); if(resource == null) resource = fileRepository.read(getPathOldVersion(fileLocation)); }else if(fileLocation.getFileSource().equals(AwsS3Source)){ resource = s3Repository.getObject(fileLocation.getFileName()); } return resource; }
DiskFileStoreRepository { public Resource read(FileLocation fileLocation) { Resource resource = null; if(fileLocation.getFileSource()==null || fileLocation.getFileSource().equals(diskFileStorage)) { Path path = getPath(fileLocation); resource = fileRepository.read(path); if(resource == null) resource = fileRepository.read(getPathOldVersion(fileLocation)); }else if(fileLocation.getFileSource().equals(AwsS3Source)){ resource = s3Repository.getObject(fileLocation.getFileName()); } return resource; } }
DiskFileStoreRepository { public Resource read(FileLocation fileLocation) { Resource resource = null; if(fileLocation.getFileSource()==null || fileLocation.getFileSource().equals(diskFileStorage)) { Path path = getPath(fileLocation); resource = fileRepository.read(path); if(resource == null) resource = fileRepository.read(getPathOldVersion(fileLocation)); }else if(fileLocation.getFileSource().equals(AwsS3Source)){ resource = s3Repository.getObject(fileLocation.getFileName()); } return resource; } DiskFileStoreRepository(FileRepository fileRepository,
                                   @Value("${file.storage.mount.path}") String fileMountPath); }
DiskFileStoreRepository { public Resource read(FileLocation fileLocation) { Resource resource = null; if(fileLocation.getFileSource()==null || fileLocation.getFileSource().equals(diskFileStorage)) { Path path = getPath(fileLocation); resource = fileRepository.read(path); if(resource == null) resource = fileRepository.read(getPathOldVersion(fileLocation)); }else if(fileLocation.getFileSource().equals(AwsS3Source)){ resource = s3Repository.getObject(fileLocation.getFileName()); } return resource; } DiskFileStoreRepository(FileRepository fileRepository,
                                   @Value("${file.storage.mount.path}") String fileMountPath); List<Artifact> write(List<org.egov.filestore.domain.model.Artifact> artifacts); Resource read(FileLocation fileLocation); }
DiskFileStoreRepository { public Resource read(FileLocation fileLocation) { Resource resource = null; if(fileLocation.getFileSource()==null || fileLocation.getFileSource().equals(diskFileStorage)) { Path path = getPath(fileLocation); resource = fileRepository.read(path); if(resource == null) resource = fileRepository.read(getPathOldVersion(fileLocation)); }else if(fileLocation.getFileSource().equals(AwsS3Source)){ resource = s3Repository.getObject(fileLocation.getFileName()); } return resource; } DiskFileStoreRepository(FileRepository fileRepository,
                                   @Value("${file.storage.mount.path}") String fileMountPath); List<Artifact> write(List<org.egov.filestore.domain.model.Artifact> artifacts); Resource read(FileLocation fileLocation);  }