JobDefinitionRestController extends HerdBaseController { @RequestMapping(value = "/jobDefinitions", method = RequestMethod.POST, consumes = {"application/xml", "application/json"}) @Secured(SecurityFunctions.FN_JOB_DEFINITIONS_POST) public JobDefinition createJobDefinition(@RequestBody JobDefinitionCreateRequest request) throws Exception { return jobDefinitionService.createJobDefinition(request, true); }  @RequestMapping(value = "/jobDefinitions", method = RequestMethod.POST, consumes = {"application/xml", "application/json"}) @Secured(SecurityFunctions.FN_JOB_DEFINITIONS_POST) JobDefinition createJobDefinition(@RequestBody JobDefinitionCreateRequest request); @RequestMapping(value = "/jobDefinitions/namespaces/{namespace}/jobNames/{jobName}", method = RequestMethod.PUT, consumes = {"application/xml", "application/json"}) @Secured(SecurityFunctions.FN_JOB_DEFINITIONS_PUT) JobDefinition updateJobDefinition(@PathVariable("namespace") String namespace, @PathVariable("jobName") String jobName,
        @RequestBody JobDefinitionUpdateRequest request); @RequestMapping(value = "/jobDefinitions/namespaces/{namespace}/jobNames/{jobName}", method = RequestMethod.GET) @Secured(SecurityFunctions.FN_JOB_DEFINITIONS_GET) JobDefinition getJobDefinition(@PathVariable("namespace") String namespace, @PathVariable("jobName") String jobName);  }
@Test public void testCreateJobDefinition() throws Exception { String namespace = NAMESPACE; String jobName = JOB_NAME; String activitiJobXml = getActivitiJobXml(namespace, jobName); JobDefinitionCreateRequest request = new JobDefinitionCreateRequest(namespace, jobName, null, activitiJobXml, null, null); JobDefinition jobDefinition = getJobDefinition(NAMESPACE, JOB_NAME); when(jobDefinitionService.createJobDefinition(request, true)).thenReturn(jobDefinition); JobDefinition resultJobDefinition = jobDefinitionRestController.createJobDefinition(new JobDefinitionCreateRequest(namespace, jobName, null, activitiJobXml, null, null)); verify(jobDefinitionService).createJobDefinition(request, true); verifyNoMoreInteractions(jobDefinitionService); assertEquals(jobDefinition, resultJobDefinition); }