@Test public void copyTranslationForTmTextUnitMapping() throws InterruptedException, ExecutionException, RepositoryNameAlreadyUsedException, AssetWithIdNotFoundException, RepositoryWithIdNotFoundException { TMTestData tmTestDataSource = new TMTestData(testIdWatcher); Repository sourceRepository = tmTestDataSource.repository; logger.debug("Create the target repository"); Repository targetRepository = repositoryService.createRepository(testIdWatcher.getEntityName("targetRepository")); TM tm = targetRepository.getTm(); Asset asset = assetService.createAssetWithContent(targetRepository.getId(), "fake_for_test", "fake for test"); Long assetId = asset.getId(); TMTextUnit targetTmTextUnit1 = tmService.addTMTextUnit(tm.getId(), assetId, "zuora_error_message_verify_state_province other", "Please enter a valid state, region or province", "Comment1"); TMTextUnit targetTmTextUnit2 = tmService.addTMTextUnit(tm.getId(), assetId, "TEST2 other", "Content2", "Comment2"); TMTextUnit targetTmTextUnit3 = tmService.addTMTextUnit(tm.getId(), assetId, "TEST3 other", "Content3", "Comment3"); Map<Long, Long> sourceTotTargetTmTextUnitIds = new HashMap<>(); sourceTotTargetTmTextUnitIds.put(tmTestDataSource.addTMTextUnit1.getId(), targetTmTextUnit1.getId()); sourceTotTargetTmTextUnitIds.put(tmTestDataSource.addTMTextUnit2.getId(), targetTmTextUnit2.getId()); CopyTmConfig copyTmConfig = new CopyTmConfig(); copyTmConfig.setSourceRepositoryId(sourceRepository.getId()); copyTmConfig.setTargetRepositoryId(targetRepository.getId()); copyTmConfig.setMode(CopyTmConfig.Mode.TUIDS); copyTmConfig.setSourceToTargetTmTextUnitIds(sourceTotTargetTmTextUnitIds); leveragingService.copyTm(copyTmConfig).get(); List<TMTextUnitVariant> sourceTranslations = tmTextUnitVariantRepository.findByTmTextUnitTmRepositoriesAndLocale_Bcp47TagNotOrderByContent(sourceRepository, "en"); List<TMTextUnitVariant> targetTranslations = tmTextUnitVariantRepository.findByTmTextUnitTmRepositoriesAndLocale_Bcp47TagNotOrderByContent(targetRepository, "en"); Assert.assertEquals(5, sourceTranslations.size()); Assert.assertEquals(3, targetTranslations.size()); Assert.assertEquals("Content2 fr-CA", targetTranslations.get(0).getContent()); Assert.assertEquals(targetTmTextUnit2.getId(), targetTranslations.get(0).getTmTextUnit().getId()); Assert.assertEquals("Veuillez indiquer un état, une région ou une province valide.", targetTranslations.get(1).getContent()); Assert.assertEquals(targetTmTextUnit1.getId(), targetTranslations.get(1).getTmTextUnit().getId()); Assert.assertEquals("올바른 국가, 지역 또는 시/도를 입력하십시오.", targetTranslations.get(2).getContent()); Assert.assertEquals(targetTmTextUnit1.getId(), targetTranslations.get(2).getTmTextUnit().getId()); }
@Pollable(async = true, message = "Start copying translations between repository") public PollableFuture copyTm(CopyTmConfig copyTmConfig) throws AssetWithIdNotFoundException, RepositoryWithIdNotFoundException { if (CopyTmConfig.Mode.TUIDS.equals(copyTmConfig.getMode())) { copyTranslationBetweenTextUnits(copyTmConfig.getSourceToTargetTmTextUnitIds()); } else { copyTmBetweenRepositories(copyTmConfig); } return new PollableFutureTaskResult(); }
LeveragingService { @Pollable(async = true, message = "Start copying translations between repository") public PollableFuture copyTm(CopyTmConfig copyTmConfig) throws AssetWithIdNotFoundException, RepositoryWithIdNotFoundException { if (CopyTmConfig.Mode.TUIDS.equals(copyTmConfig.getMode())) { copyTranslationBetweenTextUnits(copyTmConfig.getSourceToTargetTmTextUnitIds()); } else { copyTmBetweenRepositories(copyTmConfig); } return new PollableFutureTaskResult(); } }
LeveragingService { @Pollable(async = true, message = "Start copying translations between repository") public PollableFuture copyTm(CopyTmConfig copyTmConfig) throws AssetWithIdNotFoundException, RepositoryWithIdNotFoundException { if (CopyTmConfig.Mode.TUIDS.equals(copyTmConfig.getMode())) { copyTranslationBetweenTextUnits(copyTmConfig.getSourceToTargetTmTextUnitIds()); } else { copyTmBetweenRepositories(copyTmConfig); } return new PollableFutureTaskResult(); }  }
LeveragingService { @Pollable(async = true, message = "Start copying translations between repository") public PollableFuture copyTm(CopyTmConfig copyTmConfig) throws AssetWithIdNotFoundException, RepositoryWithIdNotFoundException { if (CopyTmConfig.Mode.TUIDS.equals(copyTmConfig.getMode())) { copyTranslationBetweenTextUnits(copyTmConfig.getSourceToTargetTmTextUnitIds()); } else { copyTmBetweenRepositories(copyTmConfig); } return new PollableFutureTaskResult(); }  void performSourceLeveraging(List<TMTextUnit> tmTextUnits); @Pollable(async = true, message = "Start copying translations between repository") PollableFuture copyTm(CopyTmConfig copyTmConfig); }
LeveragingService { @Pollable(async = true, message = "Start copying translations between repository") public PollableFuture copyTm(CopyTmConfig copyTmConfig) throws AssetWithIdNotFoundException, RepositoryWithIdNotFoundException { if (CopyTmConfig.Mode.TUIDS.equals(copyTmConfig.getMode())) { copyTranslationBetweenTextUnits(copyTmConfig.getSourceToTargetTmTextUnitIds()); } else { copyTmBetweenRepositories(copyTmConfig); } return new PollableFutureTaskResult(); }  void performSourceLeveraging(List<TMTextUnit> tmTextUnits); @Pollable(async = true, message = "Start copying translations between repository") PollableFuture copyTm(CopyTmConfig copyTmConfig);  }