@Test(expected = InternalErrorException.class) public void testAddExistingProject() throws IOException { CreateProjectRequest request = new CreateProjectRequest(); request.setName("default"); projectController.saveProject(request); }
@RequestMapping(value = "", method = { RequestMethod.POST }) @ResponseBody @Metered(name = "saveProject") public ProjectInstance saveProject(@RequestBody CreateProjectRequest projectRequest) { if (StringUtils.isEmpty(projectRequest.getName())) { throw new InternalErrorException("A project name must be given to create a project"); } ProjectInstance createdProj = null; try { createdProj = projectService.createProject(projectRequest); } catch (Exception e) { logger.error("Failed to deal with the request.", e); throw new InternalErrorException(e.getLocalizedMessage()); } return createdProj; }
ProjectController extends BasicController { @RequestMapping(value = "", method = { RequestMethod.POST }) @ResponseBody @Metered(name = "saveProject") public ProjectInstance saveProject(@RequestBody CreateProjectRequest projectRequest) { if (StringUtils.isEmpty(projectRequest.getName())) { throw new InternalErrorException("A project name must be given to create a project"); } ProjectInstance createdProj = null; try { createdProj = projectService.createProject(projectRequest); } catch (Exception e) { logger.error("Failed to deal with the request.", e); throw new InternalErrorException(e.getLocalizedMessage()); } return createdProj; } }
ProjectController extends BasicController { @RequestMapping(value = "", method = { RequestMethod.POST }) @ResponseBody @Metered(name = "saveProject") public ProjectInstance saveProject(@RequestBody CreateProjectRequest projectRequest) { if (StringUtils.isEmpty(projectRequest.getName())) { throw new InternalErrorException("A project name must be given to create a project"); } ProjectInstance createdProj = null; try { createdProj = projectService.createProject(projectRequest); } catch (Exception e) { logger.error("Failed to deal with the request.", e); throw new InternalErrorException(e.getLocalizedMessage()); } return createdProj; }  }
ProjectController extends BasicController { @RequestMapping(value = "", method = { RequestMethod.POST }) @ResponseBody @Metered(name = "saveProject") public ProjectInstance saveProject(@RequestBody CreateProjectRequest projectRequest) { if (StringUtils.isEmpty(projectRequest.getName())) { throw new InternalErrorException("A project name must be given to create a project"); } ProjectInstance createdProj = null; try { createdProj = projectService.createProject(projectRequest); } catch (Exception e) { logger.error("Failed to deal with the request.", e); throw new InternalErrorException(e.getLocalizedMessage()); } return createdProj; }  @RequestMapping(value = "", method = { RequestMethod.GET }) @ResponseBody List<ProjectInstance> getProjects(@RequestParam(value = "limit", required = false) Integer limit, @RequestParam(value = "offset", required = false) Integer offset); @RequestMapping(value = "", method = { RequestMethod.POST }) @ResponseBody @Metered(name = "saveProject") ProjectInstance saveProject(@RequestBody CreateProjectRequest projectRequest); @RequestMapping(value = "", method = { RequestMethod.PUT }) @ResponseBody @Metered(name = "updateProject") ProjectInstance updateProject(@RequestBody UpdateProjectRequest projectRequest); @RequestMapping(value = "/{projectName}", method = { RequestMethod.DELETE }) @ResponseBody @Metered(name = "deleteProject") void deleteProject(@PathVariable String projectName); void setProjectService(ProjectService projectService); }
ProjectController extends BasicController { @RequestMapping(value = "", method = { RequestMethod.POST }) @ResponseBody @Metered(name = "saveProject") public ProjectInstance saveProject(@RequestBody CreateProjectRequest projectRequest) { if (StringUtils.isEmpty(projectRequest.getName())) { throw new InternalErrorException("A project name must be given to create a project"); } ProjectInstance createdProj = null; try { createdProj = projectService.createProject(projectRequest); } catch (Exception e) { logger.error("Failed to deal with the request.", e); throw new InternalErrorException(e.getLocalizedMessage()); } return createdProj; }  @RequestMapping(value = "", method = { RequestMethod.GET }) @ResponseBody List<ProjectInstance> getProjects(@RequestParam(value = "limit", required = false) Integer limit, @RequestParam(value = "offset", required = false) Integer offset); @RequestMapping(value = "", method = { RequestMethod.POST }) @ResponseBody @Metered(name = "saveProject") ProjectInstance saveProject(@RequestBody CreateProjectRequest projectRequest); @RequestMapping(value = "", method = { RequestMethod.PUT }) @ResponseBody @Metered(name = "updateProject") ProjectInstance updateProject(@RequestBody UpdateProjectRequest projectRequest); @RequestMapping(value = "/{projectName}", method = { RequestMethod.DELETE }) @ResponseBody @Metered(name = "deleteProject") void deleteProject(@PathVariable String projectName); void setProjectService(ProjectService projectService);  }