@Test public void testIntegirtyChecker() throws Exception { Repository repository = repositoryService.createRepository(testIdWatcher.getEntityName("testIntegirtyChecker")); RepositoryLocale repositoryLocaleFrFR = repositoryService.addRepositoryLocale(repository, "fr-FR"); Locale frFR = repositoryLocaleFrFR.getLocale(); VirtualAsset virtualAsset = new VirtualAsset(); virtualAsset.setRepositoryId(repository.getId()); virtualAsset.setPath("default"); virtualAsset = virtualAssetService.createOrUpdateVirtualAsset(virtualAsset); VirtualAssetTextUnit virtualAssetTextUnit = new VirtualAssetTextUnit(); virtualAssetTextUnit.setName("name1"); virtualAssetTextUnit.setContent("with {placeholder}"); virtualAssetService.addTextUnits(virtualAsset.getId(), Arrays.asList(virtualAssetTextUnit)).get(); AssetIntegrityChecker assetIntegrityChecker = new AssetIntegrityChecker(); assetIntegrityChecker.setAssetExtension(""); assetIntegrityChecker.setIntegrityCheckerType(IntegrityCheckerType.MESSAGE_FORMAT); repositoryService.updateAssetIntegrityCheckers(repository, Sets.newHashSet(assetIntegrityChecker)); TextUnitDTO textUnitDTO = new TextUnitDTO(); textUnitDTO.setRepositoryName(repository.getName()); textUnitDTO.setTargetLocale(frFR.getBcp47Tag()); textUnitDTO.setAssetPath(virtualAsset.getPath()); textUnitDTO.setName("name1"); textUnitDTO.setTarget("with some broken {placeholder"); PollableFuture asyncImportTextUnits = textUnitBatchImporterService.asyncImportTextUnits(Arrays.asList(textUnitDTO), false, false); pollableTaskService.waitForPollableTask(asyncImportTextUnits.getPollableTask().getId()); TextUnitSearcherParameters textUnitSearcherParameters = new TextUnitSearcherParametersForTesting(); textUnitSearcherParameters.setRepositoryNames(Arrays.asList(repository.getName())); textUnitSearcherParameters.setName("name1"); List<TextUnitDTO> textUnitDTOs = textUnitSearcher.search(textUnitSearcherParameters); assertEquals(1, textUnitDTOs.size()); assertEquals("name1", textUnitDTOs.get(0).getName()); assertEquals("with some broken {placeholder", textUnitDTOs.get(0).getTarget()); assertFalse("Should be excluded with broken placeholder", textUnitDTOs.get(0).isIncludedInLocalizedFile()); textUnitDTO.setTarget("with fixed {placeholder}"); asyncImportTextUnits = textUnitBatchImporterService.asyncImportTextUnits(Arrays.asList(textUnitDTO), false, false); pollableTaskService.waitForPollableTask(asyncImportTextUnits.getPollableTask().getId()); textUnitDTOs = textUnitSearcher.search(textUnitSearcherParameters); assertEquals(1, textUnitDTOs.size()); assertEquals("name1", textUnitDTOs.get(0).getName()); assertEquals("with fixed {placeholder}", textUnitDTOs.get(0).getTarget()); assertTrue("should be included with proper placeholder", textUnitDTOs.get(0).isIncludedInLocalizedFile()); }
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);  }