ManifestManager { public JobConfig importManifestAsync(Owner owner, File archive, String uploadedFileName, ConflictOverrides overrides) throws ManifestFileServiceException { ManifestFile manifestRecordId = storeImport(archive, owner); return ImportJob.createJobConfig() .setOwner(owner) .setStoredFileId(manifestRecordId.getId()) .setUploadedFileName(uploadedFileName) .setConflictOverrides(overrides); } @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 testManifestImportAsync() throws Exception { Owner owner = TestUtil.createOwner(); File file = mock(File.class); String filename = "manifest.zip"; ConflictOverrides overrides = new ConflictOverrides(Conflict.DISTRIBUTOR_CONFLICT); UserPrincipal principal = TestUtil.createOwnerPrincipal(); when(principalProvider.get()).thenReturn(principal); ManifestFile manifest = mock(ManifestFile.class); when(fileService.store(ManifestFileType.IMPORT, file, principal.getName(), owner.getKey())).thenReturn(manifest); JobConfig job = manager.importManifestAsync(owner, file, filename, overrides); JobArguments jobArgs = job.getJobArguments(); assertEquals(ImportJob.JOB_KEY, job.getJobKey()); assertEquals(ImportJob.JOB_NAME, job.getJobName()); assertEquals(owner, job.getContextOwner()); assertEquals(manifest.getId(), jobArgs.getAsString("stored_manifest_file_id")); assertEquals(filename, jobArgs.getAsString("uploaded_file_name")); ConflictOverrides retrievedOverrides = new ConflictOverrides(jobArgs.getAs("conflict_overrides", String[].class)); assertTrue(retrievedOverrides.isForced(Conflict.DISTRIBUTOR_CONFLICT)); verify(fileService).store(eq(ManifestFileType.IMPORT), eq(file), eq(principal.getName()), eq(owner.getKey())); }