@Test public void testDeleteRepositoryById() throws RepositoryNotFoundException, RepositoryNameAlreadyUsedException { Repository expectedRepository = wsTestDataFactory.createRepository(testIdWatcher); com.box.l10n.mojito.rest.entity.Repository actualRepository = repositoryClient.getRepositoryById(expectedRepository.getId()); assertRepositoriesAreEqual(expectedRepository, actualRepository); repositoryClient.deleteRepositoryByName(expectedRepository.getName()); actualRepository = repositoryClient.getRepositoryById(expectedRepository.getId()); assertTrue(actualRepository.getDeleted()); assertTrue(actualRepository.getName().startsWith("deleted__")); }
@RequestMapping(value = "/api/repositories/{repositoryId}", method = RequestMethod.DELETE) public void deleteRepositoryById(@PathVariable Long repositoryId) throws RepositoryWithIdNotFoundException { logger.info("Deleting repository [{}]", repositoryId); Repository repository = repositoryRepository.findById(repositoryId).orElse(null); if (repository == null) { throw new RepositoryWithIdNotFoundException(repositoryId); } repositoryService.deleteRepository(repository); }
RepositoryWS { @RequestMapping(value = "/api/repositories/{repositoryId}", method = RequestMethod.DELETE) public void deleteRepositoryById(@PathVariable Long repositoryId) throws RepositoryWithIdNotFoundException { logger.info("Deleting repository [{}]", repositoryId); Repository repository = repositoryRepository.findById(repositoryId).orElse(null); if (repository == null) { throw new RepositoryWithIdNotFoundException(repositoryId); } repositoryService.deleteRepository(repository); } }
RepositoryWS { @RequestMapping(value = "/api/repositories/{repositoryId}", method = RequestMethod.DELETE) public void deleteRepositoryById(@PathVariable Long repositoryId) throws RepositoryWithIdNotFoundException { logger.info("Deleting repository [{}]", repositoryId); Repository repository = repositoryRepository.findById(repositoryId).orElse(null); if (repository == null) { throw new RepositoryWithIdNotFoundException(repositoryId); } repositoryService.deleteRepository(repository); }  }
RepositoryWS { @RequestMapping(value = "/api/repositories/{repositoryId}", method = RequestMethod.DELETE) public void deleteRepositoryById(@PathVariable Long repositoryId) throws RepositoryWithIdNotFoundException { logger.info("Deleting repository [{}]", repositoryId); Repository repository = repositoryRepository.findById(repositoryId).orElse(null); if (repository == null) { throw new RepositoryWithIdNotFoundException(repositoryId); } repositoryService.deleteRepository(repository); }  @JsonView(View.Repository.class) @RequestMapping(value = "/api/repositories/{repositoryId}", method = RequestMethod.GET) Repository getRepositoryById(@PathVariable Long repositoryId); @JsonView(View.RepositorySummary.class) @RequestMapping(value = "/api/repositories", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) List<Repository> getRepositories(); @JsonView(View.Repository.class) @RequestMapping(value = "/api/repositories", params = "name", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) List<Repository> getRepositories(@RequestParam(value = "name", required = true) String repositoryName); @JsonView(View.Repository.class) @RequestMapping(value = "/api/repositories", method = RequestMethod.POST) ResponseEntity<Repository> createRepository(@RequestBody Repository repository); @RequestMapping(value = "/api/repositories/{repositoryId}/xliffImport", method = RequestMethod.POST) ResponseEntity importRepository(
            @PathVariable Long repositoryId,
            @RequestBody ImportRepositoryBody importRepositoryBody); @RequestMapping(value = "/api/repositories/{repositoryId}", method = RequestMethod.DELETE) void deleteRepositoryById(@PathVariable Long repositoryId); @RequestMapping(value = "/api/repositories/{repositoryId}", method = RequestMethod.PATCH) ResponseEntity updateRepository(@PathVariable Long repositoryId,
                                           @RequestBody Repository repository); @JsonView(View.BranchSummary.class) @RequestMapping(value = "/api/repositories/{repositoryId}/branches", method = RequestMethod.GET) List<Branch> getBranchesOfRepository(@PathVariable Long repositoryId,
                                                @RequestParam(value = "name", required = false) String branchName,
                                                @RequestParam(value = "deleted", required = false) Boolean deleted,
                                                @RequestParam(value = "translated", required = false) Boolean translated,
                                                @RequestParam(value = "createdBefore", required = false) DateTime createdBefore); @RequestMapping(value = "/api/repositories/{repositoryId}/branches", method = RequestMethod.DELETE) PollableTask deleteBranch(@PathVariable(value = "repositoryId") Long repositoryId,
                                     @RequestParam(value = "branchId") Long branchId); }
RepositoryWS { @RequestMapping(value = "/api/repositories/{repositoryId}", method = RequestMethod.DELETE) public void deleteRepositoryById(@PathVariable Long repositoryId) throws RepositoryWithIdNotFoundException { logger.info("Deleting repository [{}]", repositoryId); Repository repository = repositoryRepository.findById(repositoryId).orElse(null); if (repository == null) { throw new RepositoryWithIdNotFoundException(repositoryId); } repositoryService.deleteRepository(repository); }  @JsonView(View.Repository.class) @RequestMapping(value = "/api/repositories/{repositoryId}", method = RequestMethod.GET) Repository getRepositoryById(@PathVariable Long repositoryId); @JsonView(View.RepositorySummary.class) @RequestMapping(value = "/api/repositories", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) List<Repository> getRepositories(); @JsonView(View.Repository.class) @RequestMapping(value = "/api/repositories", params = "name", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) List<Repository> getRepositories(@RequestParam(value = "name", required = true) String repositoryName); @JsonView(View.Repository.class) @RequestMapping(value = "/api/repositories", method = RequestMethod.POST) ResponseEntity<Repository> createRepository(@RequestBody Repository repository); @RequestMapping(value = "/api/repositories/{repositoryId}/xliffImport", method = RequestMethod.POST) ResponseEntity importRepository(
            @PathVariable Long repositoryId,
            @RequestBody ImportRepositoryBody importRepositoryBody); @RequestMapping(value = "/api/repositories/{repositoryId}", method = RequestMethod.DELETE) void deleteRepositoryById(@PathVariable Long repositoryId); @RequestMapping(value = "/api/repositories/{repositoryId}", method = RequestMethod.PATCH) ResponseEntity updateRepository(@PathVariable Long repositoryId,
                                           @RequestBody Repository repository); @JsonView(View.BranchSummary.class) @RequestMapping(value = "/api/repositories/{repositoryId}/branches", method = RequestMethod.GET) List<Branch> getBranchesOfRepository(@PathVariable Long repositoryId,
                                                @RequestParam(value = "name", required = false) String branchName,
                                                @RequestParam(value = "deleted", required = false) Boolean deleted,
                                                @RequestParam(value = "translated", required = false) Boolean translated,
                                                @RequestParam(value = "createdBefore", required = false) DateTime createdBefore); @RequestMapping(value = "/api/repositories/{repositoryId}/branches", method = RequestMethod.DELETE) PollableTask deleteBranch(@PathVariable(value = "repositoryId") Long repositoryId,
                                     @RequestParam(value = "branchId") Long branchId);  }