@Test public void testImportMulipleRepositoryAssetAndLocale() throws Exception { Repository repository1 = repositoryService.createRepository(testIdWatcher.getEntityName("testImportMulipleRepositoryAssetAndLocale1")); Repository repository2 = repositoryService.createRepository(testIdWatcher.getEntityName("testImportMulipleRepositoryAssetAndLocale2")); for (Repository repository : Arrays.asList(repository1, repository2)) { RepositoryLocale repositoryLocaleFrFR = repositoryService.addRepositoryLocale(repository, "fr-FR"); RepositoryLocale repositoryLocaleKoKR = repositoryService.addRepositoryLocale(repository, "ko-KR"); VirtualAsset virtualAsset1 = new VirtualAsset(); virtualAsset1.setRepositoryId(repository.getId()); virtualAsset1.setPath("default"); virtualAsset1 = virtualAssetService.createOrUpdateVirtualAsset(virtualAsset1); VirtualAsset virtualAsset2 = new VirtualAsset(); virtualAsset2.setRepositoryId(repository.getId()); virtualAsset2.setPath("default2"); virtualAsset2 = virtualAssetService.createOrUpdateVirtualAsset(virtualAsset2); List<VirtualAssetTextUnit> virtualAssetTextUnits = new ArrayList<>(); VirtualAssetTextUnit virtualAssetTextUnit = new VirtualAssetTextUnit(); virtualAssetTextUnit.setName("name1"); virtualAssetTextUnit.setContent("content1"); virtualAssetTextUnit.setComment("comment1"); virtualAssetTextUnits.add(virtualAssetTextUnit); virtualAssetTextUnit = new VirtualAssetTextUnit(); virtualAssetTextUnit.setName("name2"); virtualAssetTextUnit.setContent("content2"); virtualAssetTextUnit.setComment("comment2"); virtualAssetTextUnits.add(virtualAssetTextUnit); virtualAssetService.addTextUnits(virtualAsset1.getId(), virtualAssetTextUnits).get(); virtualAssetService.addTextUnits(virtualAsset2.getId(), virtualAssetTextUnits).get(); } TextUnitSearcherParameters textUnitSearcherParameters = new TextUnitSearcherParametersForTesting(); textUnitSearcherParameters.setRepositoryNames(Arrays.asList(repository1.getName(), repository2.getName())); List<TextUnitDTO> textUnitDTOsForImport = textUnitSearcher.search(textUnitSearcherParameters); for (TextUnitDTO textUnitDTO : textUnitDTOsForImport) { textUnitDTO.setTarget(textUnitDTO.getRepositoryName() + ":" + textUnitDTO.getAssetPath() + ":" + textUnitDTO.getTargetLocale() + ":" + textUnitDTO.getName()); } textUnitBatchImporterService.asyncImportTextUnits(textUnitDTOsForImport, false, false).get(); List<TextUnitDTO> textUnitDTOs = textUnitSearcher.search(textUnitSearcherParameters); assertFalse(textUnitDTOs.isEmpty()); for (TextUnitDTO textUnitDTO : textUnitDTOs) { assertEquals(textUnitDTO.getRepositoryName() + ":" + textUnitDTO.getAssetPath() + ":" + textUnitDTO.getTargetLocale() + ":" + textUnitDTO.getName(), textUnitDTO.getTarget()); } }
public PollableFuture<Void> asyncImportTextUnits(List<TextUnitDTO> textUnitDTOs, boolean integrityCheckSkipped, boolean integrityCheckKeepStatusIfFailedAndSameTarget) { ImportTextUnitJobInput importTextUnitJobInput = new ImportTextUnitJobInput(); importTextUnitJobInput.setTextUnitDTOs(textUnitDTOs); importTextUnitJobInput.setIntegrityCheckSkipped(integrityCheckSkipped); importTextUnitJobInput.setIntegrityCheckKeepStatusIfFailedAndSameTarget(integrityCheckKeepStatusIfFailedAndSameTarget); return quartzPollableTaskScheduler.scheduleJob(ImportTextUnitJob.class, importTextUnitJobInput); }
TextUnitBatchImporterService { public PollableFuture<Void> asyncImportTextUnits(List<TextUnitDTO> textUnitDTOs, boolean integrityCheckSkipped, boolean integrityCheckKeepStatusIfFailedAndSameTarget) { ImportTextUnitJobInput importTextUnitJobInput = new ImportTextUnitJobInput(); importTextUnitJobInput.setTextUnitDTOs(textUnitDTOs); importTextUnitJobInput.setIntegrityCheckSkipped(integrityCheckSkipped); importTextUnitJobInput.setIntegrityCheckKeepStatusIfFailedAndSameTarget(integrityCheckKeepStatusIfFailedAndSameTarget); return quartzPollableTaskScheduler.scheduleJob(ImportTextUnitJob.class, importTextUnitJobInput); } }
TextUnitBatchImporterService { public PollableFuture<Void> asyncImportTextUnits(List<TextUnitDTO> textUnitDTOs, boolean integrityCheckSkipped, boolean integrityCheckKeepStatusIfFailedAndSameTarget) { ImportTextUnitJobInput importTextUnitJobInput = new ImportTextUnitJobInput(); importTextUnitJobInput.setTextUnitDTOs(textUnitDTOs); importTextUnitJobInput.setIntegrityCheckSkipped(integrityCheckSkipped); importTextUnitJobInput.setIntegrityCheckKeepStatusIfFailedAndSameTarget(integrityCheckKeepStatusIfFailedAndSameTarget); return quartzPollableTaskScheduler.scheduleJob(ImportTextUnitJob.class, importTextUnitJobInput); }  }
TextUnitBatchImporterService { public PollableFuture<Void> asyncImportTextUnits(List<TextUnitDTO> textUnitDTOs, boolean integrityCheckSkipped, boolean integrityCheckKeepStatusIfFailedAndSameTarget) { ImportTextUnitJobInput importTextUnitJobInput = new ImportTextUnitJobInput(); importTextUnitJobInput.setTextUnitDTOs(textUnitDTOs); importTextUnitJobInput.setIntegrityCheckSkipped(integrityCheckSkipped); importTextUnitJobInput.setIntegrityCheckKeepStatusIfFailedAndSameTarget(integrityCheckKeepStatusIfFailedAndSameTarget); return quartzPollableTaskScheduler.scheduleJob(ImportTextUnitJob.class, importTextUnitJobInput); }  PollableFuture<Void> asyncImportTextUnits(List<TextUnitDTO> textUnitDTOs,
                                               boolean integrityCheckSkipped,
                                               boolean integrityCheckKeepStatusIfFailedAndSameTarget); PollableFuture importTextUnits(List<TextUnitDTO> textUnitDTOs,
                                          boolean integrityCheckSkipped,
                                          boolean integrityCheckKeepStatusIfFailedAndSameTarget); }
TextUnitBatchImporterService { public PollableFuture<Void> asyncImportTextUnits(List<TextUnitDTO> textUnitDTOs, boolean integrityCheckSkipped, boolean integrityCheckKeepStatusIfFailedAndSameTarget) { ImportTextUnitJobInput importTextUnitJobInput = new ImportTextUnitJobInput(); importTextUnitJobInput.setTextUnitDTOs(textUnitDTOs); importTextUnitJobInput.setIntegrityCheckSkipped(integrityCheckSkipped); importTextUnitJobInput.setIntegrityCheckKeepStatusIfFailedAndSameTarget(integrityCheckKeepStatusIfFailedAndSameTarget); return quartzPollableTaskScheduler.scheduleJob(ImportTextUnitJob.class, importTextUnitJobInput); }  PollableFuture<Void> asyncImportTextUnits(List<TextUnitDTO> textUnitDTOs,
                                               boolean integrityCheckSkipped,
                                               boolean integrityCheckKeepStatusIfFailedAndSameTarget); PollableFuture importTextUnits(List<TextUnitDTO> textUnitDTOs,
                                          boolean integrityCheckSkipped,
                                          boolean integrityCheckKeepStatusIfFailedAndSameTarget);  }