AssetWS { @RequestMapping(value = "/api/assets/{assetId}", method = RequestMethod.DELETE) public void deleteAssetById(@PathVariable Long assetId) throws AssetWithIdNotFoundException { logger.debug("Deleting asset [{}]", assetId); Asset asset = assetRepository.findById(assetId).orElse(null); if (asset == null) { throw new AssetWithIdNotFoundException(assetId); } assetService.deleteAsset(asset); }  @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 public void testDeleteAssetById() throws RepositoryNotFoundException, RepositoryNameAlreadyUsedException { Repository repository = testDataFactory.createRepository(testIdWatcher); List<com.box.l10n.mojito.rest.entity.Asset> assets = assetClient.getAssetsByRepositoryId(repository.getId()); assertEquals("There should be no asset for this repository yet", 0, assets.size()); 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 asset = assetRepository.findById(sourceAssetAfterPost.getAddedAssetId()).orElse(null); Long assetId = asset.getId(); assertNotNull("The asset should have been created", asset); assertFalse("The asset should have not been deleted yet", asset.getDeleted()); assets = assetClient.getAssetsByRepositoryId(repository.getId()); assertEquals("There should be one asset for this repository", 1, assets.size()); assets = assetClient.getAssetsByRepositoryId(repository.getId(), false); assertEquals("There should be one asset that is not deleted for this repository", 1, assets.size()); assets = assetClient.getAssetsByRepositoryId(repository.getId(), true); assertEquals("There should be no deleted asset for this repository", 0, assets.size()); assetClient.deleteAssetById(assetId); asset = assetRepository.findById(sourceAssetAfterPost.getAddedAssetId()).orElse(null); assertEquals("The asset id should have not changed", assetId, asset.getId()); assertTrue("The asset should be deleted", asset.getDeleted()); assets = assetClient.getAssetsByRepositoryId(repository.getId()); assertEquals("There should be one asset for this repository", 1, assets.size()); assets = assetClient.getAssetsByRepositoryId(repository.getId(), false); assertEquals("There should be no asset that is not deleted for this repository", 0, assets.size()); assets = assetClient.getAssetsByRepositoryId(repository.getId(), true); assertEquals("There should be one deleted asset for this repository", 1, assets.size()); }