AssetWS { @RequestMapping(value = "/api/assets", method = RequestMethod.POST) public SourceAsset importSourceAsset(@RequestBody SourceAsset sourceAsset) throws Throwable { logger.debug("Importing source asset"); String normalizedContent = NormalizationUtils.normalize(sourceAsset.getContent()); PollableFuture<Asset> assetFuture = assetService.addOrUpdateAssetAndProcessIfNeeded( sourceAsset.getRepositoryId(), sourceAsset.getPath(), normalizedContent, sourceAsset.isExtractedContent(), sourceAsset.getBranch(), sourceAsset.getBranchCreatedByUsername(), sourceAsset.getFilterConfigIdOverride(), sourceAsset.getFilterOptions() ); try { sourceAsset.setAddedAssetId(assetFuture.get().getId()); } catch (ExecutionException ee) { throw ee.getCause(); } sourceAsset.setPollableTask(assetFuture.getPollableTask()); return sourceAsset; }  @JsonView(View.AssetSummary.class) @RequestMapping(value = "/api/assets", method = RequestMethod.GET) List<Asset> getAssets(@RequestParam(value = "repositoryId") Long repositoryId,
                                 @RequestParam(value = "path", required = false) String path,
                                 @RequestParam(value = "deleted", required = false) Boolean deleted,
                                 @RequestParam(value = "virtual", required = false) Boolean virtual,
                                 @RequestParam(value = "branchId", required = false) Long branchId); @RequestMapping(value = "/api/assets", method = RequestMethod.POST) SourceAsset importSourceAsset(@RequestBody SourceAsset sourceAsset); @RequestMapping(value = "/api/assets/{assetId}/localized/{localeId}", method = RequestMethod.POST) LocalizedAssetBody getLocalizedAssetForContent(
            @PathVariable("assetId") long assetId,
            @PathVariable("localeId") long localeId,
            @RequestBody LocalizedAssetBody localizedAssetBody); @RequestMapping(value = "/api/assets/{assetId}/localized", method = RequestMethod.POST) PollableTask getLocalizedAssetForContentAsync(
            @PathVariable("assetId") long assetId,
            @RequestBody LocalizedAssetBody localizedAssetBody); @RequestMapping(value = "/api/assets/{assetId}/pseudo", method = RequestMethod.POST) LocalizedAssetBody getPseudoLocalizedAssetForContent(
            @PathVariable("assetId") long assetId,
            @RequestBody LocalizedAssetBody localizedAssetBody); @RequestMapping(value = "/api/assets/{assetId}/localized/{localeId}/import", method = RequestMethod.POST) ImportLocalizedAssetBody importLocalizedAsset(
            @PathVariable("assetId") long assetId,
            @PathVariable("localeId") long localeId,
            @RequestBody ImportLocalizedAssetBody importLocalizedAssetBody); @RequestMapping(method = RequestMethod.GET, value = "/api/assets/{assetId}/xliffExport/{tmXliffId}") @ResponseStatus(HttpStatus.OK) XliffExportBody xliffExport(@PathVariable("assetId") long assetId, @PathVariable("tmXliffId") long tmXliffId); @RequestMapping(method = RequestMethod.POST, value = "/api/assets/{assetId}/xliffExport") XliffExportBody xliffExportAsync(@PathVariable("assetId") long assetId,
                                            @RequestParam("bcp47tag") String bcp47tag,
                                            @RequestBody XliffExportBody xliffExportBody); @RequestMapping(value = "/api/assets/{assetId}", method = RequestMethod.DELETE) void deleteAssetById(@PathVariable Long assetId); @RequestMapping(value = "/api/assets", method = RequestMethod.DELETE) PollableTask deleteAssetsOfBranches(@RequestParam(value = "branchId", required = false) Long branchId,
                                               @RequestBody Set<Long> ids); @RequestMapping(value = "/api/assets/ids", method = RequestMethod.GET) Set<Long> getAssetIds(@RequestParam(value = "repositoryId", required = true) Long repositoryId,
                                 @RequestParam(value = "deleted", required = false) Boolean deleted,
                                 @RequestParam(value = "virtual", required = false) Boolean virtual,
                                 @RequestParam(value = "branchId", required = false) Long branchId);  }
@Test @Category({IntegrationTest.class}) public void testImportSourceAsset() throws RepositoryNameAlreadyUsedException { Repository repository = testDataFactory.createRepository(testIdWatcher); com.box.l10n.mojito.rest.entity.SourceAsset sourceAsset = createSourceAsset(repository); com.box.l10n.mojito.rest.entity.SourceAsset sourceAssetAfterPost = assetClient.sendSourceAsset(sourceAsset); pollableTaskClient.waitForPollableTask(sourceAssetAfterPost.getPollableTask().getId(), 5000L); Asset addedAsset = assetRepository.findById(sourceAssetAfterPost.getAddedAssetId()).orElse(null); assertNotNull("The asset should have been created", addedAsset); assertEquals(sourceAsset.getRepositoryId(), addedAsset.getRepository().getId()); assertEquals(sourceAsset.getPath(), addedAsset.getPath()); assertEquals(DigestUtils.md5Hex(sourceAsset.getContent()), addedAsset.getLastSuccessfulAssetExtraction().getContentMd5()); assertNotNull("Extraction of the asset should have completed", addedAsset.getLastSuccessfulAssetExtraction()); List<AssetTextUnit> assetTextUnits = assetTextUnitRepository.findByAssetExtraction(addedAsset.getLastSuccessfulAssetExtraction()); assertEquals("There should be 3 asset text units extracted", 3, assetTextUnits.size()); assertEquals("Account_security_and_password_settings", assetTextUnits.get(2).getName()); }