@Test void deleteByModificationTimeTest() throws Exception { long currentMillis = System.currentTimeMillis(); final long oldFilesTtl = 1000 * 60 * 10; Date pastMoment = new Date(currentMillis - 1000 * 60 * 15); FileEntry fileEntryToRemain1 = addFileEntry(SPACE_1); FileEntry fileEntryToRemain2 = addFileEntry(SPACE_2); FileEntry fileEntryToDelete1 = addFileEntry(SPACE_1); FileEntry fileEntryToDelete2 = addFileEntry(SPACE_2); setMofidicationDate(fileEntryToDelete1, pastMoment); setMofidicationDate(fileEntryToDelete2, pastMoment); Date deleteDate = new Date(currentMillis - oldFilesTtl); int deletedFiles = fileService.deleteModifiedBefore(deleteDate); assertNotNull(fileService.getFile(SPACE_1, fileEntryToRemain1.getId())); assertNotNull(fileService.getFile(SPACE_2, fileEntryToRemain2.getId())); assertEquals(2, deletedFiles); assertNull(fileService.getFile(SPACE_1, fileEntryToDelete1.getId())); assertNull(fileService.getFile(SPACE_2, fileEntryToDelete2.getId())); }
@Override public int deleteModifiedBefore(Date modificationTime) throws FileStorageException { return deleteFileAttributesModifiedBefore(modificationTime); }
DatabaseFileService extends FileService { @Override public int deleteModifiedBefore(Date modificationTime) throws FileStorageException { return deleteFileAttributesModifiedBefore(modificationTime); } }
DatabaseFileService extends FileService { @Override public int deleteModifiedBefore(Date modificationTime) throws FileStorageException { return deleteFileAttributesModifiedBefore(modificationTime); } DatabaseFileService(DataSourceWithDialect dataSourceWithDialect);  DatabaseFileService(String tableName, DataSourceWithDialect dataSourceWithDialect); protected  DatabaseFileService(DataSourceWithDialect dataSourceWithDialect, SqlFileQueryProvider sqlFileQueryProvider); }
DatabaseFileService extends FileService { @Override public int deleteModifiedBefore(Date modificationTime) throws FileStorageException { return deleteFileAttributesModifiedBefore(modificationTime); } DatabaseFileService(DataSourceWithDialect dataSourceWithDialect);  DatabaseFileService(String tableName, DataSourceWithDialect dataSourceWithDialect); protected  DatabaseFileService(DataSourceWithDialect dataSourceWithDialect, SqlFileQueryProvider sqlFileQueryProvider); @Override T processFileContent(String space, String id, FileContentProcessor<T> fileContentProcessor); @Override int deleteBySpaceAndNamespace(String space, String namespace); @Override int deleteBySpace(String space); @Override int deleteModifiedBefore(Date modificationTime); @Override boolean deleteFile(String space, String id); @Override int deleteFilesEntriesWithoutContent(); }
DatabaseFileService extends FileService { @Override public int deleteModifiedBefore(Date modificationTime) throws FileStorageException { return deleteFileAttributesModifiedBefore(modificationTime); } DatabaseFileService(DataSourceWithDialect dataSourceWithDialect);  DatabaseFileService(String tableName, DataSourceWithDialect dataSourceWithDialect); protected  DatabaseFileService(DataSourceWithDialect dataSourceWithDialect, SqlFileQueryProvider sqlFileQueryProvider); @Override T processFileContent(String space, String id, FileContentProcessor<T> fileContentProcessor); @Override int deleteBySpaceAndNamespace(String space, String namespace); @Override int deleteBySpace(String space); @Override int deleteModifiedBefore(Date modificationTime); @Override boolean deleteFile(String space, String id); @Override int deleteFilesEntriesWithoutContent();  }