RepositoryWS { @JsonView(View.Repository.class) @RequestMapping(value = "/api/repositories", method = RequestMethod.POST) public ResponseEntity<Repository> createRepository(@RequestBody Repository repository) { logger.info("Creating repository"); ResponseEntity<Repository> result; try { Repository createdRepo = repositoryService.createRepository( repository.getName(), repository.getDescription(), repository.getSourceLocale(), repository.getCheckSLA(), repository.getAssetIntegrityCheckers(), repository.getRepositoryLocales() ); result = new ResponseEntity<>(createdRepo, HttpStatus.CREATED); } catch (RepositoryNameAlreadyUsedException e) { logger.debug("Cannot create the repository", e); result = new ResponseEntity("Repository with name [" + repository.getName() + "] already exists", HttpStatus.CONFLICT); } catch (RepositoryLocaleCreationException e) { logger.debug("Cannot create the repository", e); result = new ResponseEntity(e.getMessage(), HttpStatus.CONFLICT); } return result; }  @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);  }
@Test public void testGetRepositoryByName() throws RestClientException, RepositoryNameAlreadyUsedException { Repository expectedRepository = wsTestDataFactory.createRepository(testIdWatcher); com.box.l10n.mojito.rest.entity.Repository actualRepository = repositoryClient.getRepositoryByName(expectedRepository.getName()); assertRepositoriesAreEqual(expectedRepository, actualRepository); }