ManifestManager { @Transactional public int cleanup(int maxAgeInMinutes) throws ManifestFileServiceException { if (maxAgeInMinutes < 0) { return 0; } return manifestFileService.deleteExpired(Util.addMinutesToDt(maxAgeInMinutes * -1)); } @Inject  ManifestManager(ManifestFileService manifestFileService, Exporter exporter, Importer importer,
        ConsumerCurator consumerCurator, ConsumerTypeCurator consumerTypeCurator,
        EntitlementCurator entitlementCurator, CdnCurator cdnCurator, PoolManager poolManager,
        PrincipalProvider principalProvider, I18n i18n, EventSink eventSink, EventFactory eventFactory); JobConfig generateManifestAsync(String consumerUuid, Owner owner, String cdnLabel,
        String webUrl, String apiUrl, Map<String, String> extensionData); File generateManifest(String consumerUuid, String cdnLabel, String webUrl, String apiUrl,
        Map<String, String> extensionData); JobConfig importManifestAsync(Owner owner, File archive, String uploadedFileName,
        ConflictOverrides overrides); ImportRecord importManifest(Owner owner, File archive, String uploadedFileName,
        ConflictOverrides overrides); void recordImportFailure(Owner owner, Throwable error, String filename); @Transactional ImportRecord importStoredManifest(Owner targetOwner, String fileId, ConflictOverrides overrides,
        String uploadedFileName); @Transactional int cleanup(int maxAgeInMinutes); @Transactional void writeStoredExportToResponse(String exportId, String exportedConsumerUuid,
        HttpServletResponse response); ExportResult generateAndStoreManifest(String consumerUuid, String cdnLabel, String webUrl,
        String apiUrl, Map<String, String> extensionData); @Transactional void deleteStoredManifest(String manifestFileId); File generateEntitlementArchive(Consumer consumer, Set<Long> serials);  }
@Test public void testManifestCleanup() throws Exception { when(fileService.deleteExpired(any(Date.class))).thenReturn(4); int cleaned = manager.cleanup(1); verify(fileService).deleteExpired(any(Date.class)); assertEquals(4, cleaned); }
@Test public void testManifestCleanupDoesNoCleaningWhenmaxAgeIsLessThanZero() throws Exception { int cleaned = manager.cleanup(-1); assertEquals(0, cleaned); verifyNoMoreInteractions(fileService); }