TMService { @Pollable(async = true, message = "Export asset as xliff") public PollableFuture<String> exportAssetAsXLIFFAsync( Long tmXliffId, Long assetId, String bcp47Tag, @InjectCurrentTask PollableTask currentTask) { PollableFutureTaskResult<String> pollableFutureTaskResult = new PollableFutureTaskResult<>(); String xliff = exportAssetAsXLIFF(assetId, bcp47Tag); TMXliff tmXliff = tmXliffRepository.findById(tmXliffId).orElse(null); tmXliff.setAsset(assetRepository.findById(assetId).orElse(null)); tmXliff.setLocale(localeService.findByBcp47Tag(bcp47Tag)); tmXliff.setContent(xliff); tmXliff.setPollableTask(currentTask); tmXliffRepository.save(tmXliff); pollableFutureTaskResult.setResult(xliff); return pollableFutureTaskResult; }  TMTextUnit addTMTextUnit(Long tmId, Long assetId, String name, String content, String comment); TMTextUnit addTMTextUnit(
            TM tm,
            Asset asset,
            String name,
            String content,
            String comment,
            DateTime createdDate,
            PluralForm pluralForm,
            String pluralFormOther); TMTextUnit addTMTextUnit(
            TM tm,
            Asset asset,
            String name,
            String content,
            String comment,
            User createdByUser,
            DateTime createdDate,
            PluralForm pluralForm,
            String pluralFormOther); TMTextUnitVariant addCurrentTMTextUnitVariant(Long tmTextUnitId, Long localeId, String content); TMTextUnitVariant addCurrentTMTextUnitVariant(Long tmTextUnitId, Long localeId, String content, TMTextUnitVariant.Status status, boolean includedInLocalizedFile); TMTextUnitVariant addCurrentTMTextUnitVariant(Long tmTextUnitId, Long localeId, String content, TMTextUnitVariant.Status status, boolean includedInLocalizedFile, DateTime createdDate); TMTextUnitCurrentVariant addTMTextUnitCurrentVariant(Long tmTextUnitId, Long localeId, String content, String comment); TMTextUnitCurrentVariant addTMTextUnitCurrentVariant(Long tmTextUnitId, Long localeId, String content, String comment, TMTextUnitVariant.Status status); TMTextUnitCurrentVariant addTMTextUnitCurrentVariant(
            Long tmTextUnitId,
            Long localeId,
            String content,
            String comment,
            TMTextUnitVariant.Status status,
            boolean includedInLocalizedFile); TMTextUnitCurrentVariant addTMTextUnitCurrentVariant(
            Long tmTextUnitId,
            Long localeId,
            String content,
            String comment,
            TMTextUnitVariant.Status status,
            boolean includedInLocalizedFile,
            DateTime createdDate); AddTMTextUnitCurrentVariantResult addTMTextUnitCurrentVariantWithResult(
            Long tmTextUnitId,
            Long localeId,
            String content,
            String comment,
            TMTextUnitVariant.Status status,
            boolean includedInLocalizedFile,
            DateTime createdDate); AddTMTextUnitCurrentVariantResult addTMTextUnitCurrentVariantWithResult(
            TMTextUnitCurrentVariant tmTextUnitCurrentVariant,
            Long tmId,
            Long tmTextUnitId,
            Long localeId,
            String content,
            String comment,
            TMTextUnitVariant.Status status,
            boolean includedInLocalizedFile,
            DateTime createdDate,
            User createdBy); boolean isUpdateNeededForTmTextUnitVariant(
            TMTextUnitVariant.Status currentStatus,
            String currentContentMd5,
            boolean currentIncludedInLocalizedFile,
            String currentComment,
            TMTextUnitVariant.Status newStatus,
            String newContentMd5,
            boolean newIncludedInLocalizedFile,
            String newComment); TMTextUnitVariant addTMTextUnitVariant(
            Long tmTextUnitId,
            Long localeId,
            String content,
            String comment,
            TMTextUnitVariant.Status status,
            boolean includedInLocalizedFile,
            DateTime createdDate); TMTextUnitVariant addTMTextUnitVariant(
            Long tmTextUnitId,
            Long localeId,
            String content,
            String comment,
            TMTextUnitVariant.Status status,
            boolean includedInLocalizedFile,
            DateTime createdDate,
            User createdBy); UpdateTMWithXLIFFResult updateTMWithTranslationKitXLIFF(
            String xliffContent,
            TMTextUnitVariant.Status importStatus,
            String dropImporterUsernameOverride); UpdateTMWithXLIFFResult updateTMWithXLIFFById(
            String xliffContent,
            TMTextUnitVariant.Status importStatus); UpdateTMWithXLIFFResult updateTMWithXLIFFByMd5(
            String xliffContent,
            TMTextUnitVariant.Status importStatus,
            Repository repository); @Transactional String exportAssetAsXLIFF(Long assetId, String bcp47Tag); String generateLocalized(
            Asset asset,
            String content,
            RepositoryLocale repositoryLocale,
            String outputBcp47tag,
            FilterConfigIdOverride filterConfigIdOverride,
            List<String> filterOptions,
            Status status,
            InheritanceMode inheritanceMode); String generatePseudoLocalized(
            Asset asset,
            String content,
            FilterConfigIdOverride filterConfigIdOverride); PollableFuture<Void> importLocalizedAssetAsync(
            Long assetId,
            String content,
            Long localeId,
            StatusForEqualTarget statusForEqualtarget,
            FilterConfigIdOverride filterConfigIdOverride,
            List<String> filterOptions); void importLocalizedAsset(
            Long assetId,
            String content,
            Long localeId,
            StatusForEqualTarget statusForEqualtarget,
            FilterConfigIdOverride filterConfigIdOverride,
            List<String> filterOptions); @Pollable(async = true, message = "Export asset as xliff") PollableFuture<String> exportAssetAsXLIFFAsync(
            Long tmXliffId,
            Long assetId,
            String bcp47Tag,
            @InjectCurrentTask PollableTask currentTask); TMXliff createTMXliff(Long assetId, String bcp47Tag, String content, PollableTask pollableTask);  }
@Test public void testExportAssetAsXLIFFAsync() throws Exception { createTestData(); logger.debug("Export empty TM for source (en)"); String expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<xliff version=\"1.2\" xmlns=\"urn:oasis:names:tc:xliff:document:1.2\" xmlns:okp=\"okapi-framework:xliff-extensions\">\n" + "<file original=\"test-asset-path.xliff\" source-language=\"en\" target-language=\"en\" datatype=\"x-undefined\" okp:inputEncoding=\"UTF-8\">\n" + "<body>\n" + "</body>\n" + "</file>\n" + "</xliff>\n"; TMXliff tmXliff = tmService.createTMXliff(assetId, "en", null, null); PollableFuture<String> exportResult = tmService.exportAssetAsXLIFFAsync(tmXliff.getId(), assetId, "en", PollableTask.INJECT_CURRENT_TASK); try { pollableTaskService.waitForPollableTask(exportResult.getPollableTask().getId()); } catch (PollableTaskException | InterruptedException e) { throw new RuntimeException(e); } String exportAssetAsXLIFF = exportResult.get(); assertEquals(expected, exportAssetAsXLIFF); PollableTask pollableTask = pollableTaskService.getPollableTask(exportResult.getPollableTask().getId()); tmXliff = tmXliffRepository.findByPollableTask(pollableTask); assertEquals(expected, tmXliff.getContent()); }