LocalDiskFileStoreService implements FileStoreService { @Override public Set<File> fetchAll(Set<FileStoreMapper> fileMappers, String moduleName) { return fileMappers.stream().map(fileMapper -> this.fetch(fileMapper.getFileStoreId(), moduleName)) .collect(Collectors.toSet()); } @Autowired  LocalDiskFileStoreService(@Value("${filestore.base.dir}") String fileStoreBaseDir); @Override FileStoreMapper store(File sourceFile, String fileName, String mimeType, String moduleName); @Override FileStoreMapper store(InputStream sourceFileStream, String fileName, String mimeType, String moduleName); @Override FileStoreMapper store(byte[] fileBytes, String fileName, String mimeType, String moduleName); @Override FileStoreMapper store(File file, String fileName, String mimeType, String moduleName, boolean deleteFile); @Override FileStoreMapper store(InputStream fileStream, String fileName, String mimeType, String moduleName, boolean closeStream); @Override File fetch(FileStoreMapper fileMapper, String moduleName); @Override Set<File> fetchAll(Set<FileStoreMapper> fileMappers, String moduleName); @Override File fetch(String fileStoreId, String moduleName); @Override Path fetchAsPath(String fileStoreId, String moduleName); @Override void delete(String fileStoreId, String moduleName);  }
@Test public final void testFetchAll() throws IOException { Set<File> files = new HashSet<>(); for (int no = 0; no < 10; no++) { final File newFile = Files.createTempFile(tempFilePath, "xyz" + no, "txt").toFile(); FileUtils.write(newFile, "Test", UTF_8); files.add(newFile); } final Set<FileStoreMapper> maps = new HashSet<>(); for (File file : files) maps.add(diskFileService.store(file, "fileName", "text/plain", "testmodule")); final Set<File> returnfiles = diskFileService.fetchAll(maps, "testmodule"); assertNotNull(returnfiles); assertTrue(returnfiles.size() == 10); for (File file : files) { Files.deleteIfExists(file.toPath()); } }