JobManagementSpringResource { @ApiOperation("Move task to another job") @PostMapping(path = "/tasks/move") public ResponseEntity<Void> moveTask(@RequestBody TaskMoveRequest taskMoveRequest, CallMetadataAuthentication authentication) { return Responses.fromCompletable(jobServiceGateway.moveTask(taskMoveRequest, authentication.getCallMetadata()), HttpStatus.OK); } @Inject  JobManagementSpringResource(JobServiceGateway jobServiceGateway, SystemLogService systemLog); @ApiOperation("Create a job") @PostMapping(path = "/jobs") ResponseEntity<JobId> createJob(@RequestBody JobDescriptor jobDescriptor, CallMetadataAuthentication authentication); @ApiOperation("Update an existing job's capacity") @PutMapping(path = "/jobs/{jobId}/instances") ResponseEntity<Void> setInstances(@PathVariable("jobId") String jobId,
                                             @RequestBody Capacity capacity,
                                             CallMetadataAuthentication authentication); @ApiOperation("Update an existing job's capacity. Optional attributes min / max / desired are supported.") @PutMapping(path = "/jobs/{jobId}/capacityAttributes") ResponseEntity<Void> setCapacityWithOptionalAttributes(@PathVariable("jobId") String jobId,
                                                                  @RequestBody JobCapacityWithOptionalAttributes capacity,
                                                                  CallMetadataAuthentication authentication); @ApiOperation("Update an existing job's processes") @PutMapping(path = "/jobs/{jobId}/jobprocesses") ResponseEntity<Void> setJobProcesses(@PathVariable("jobId") String jobId,
                                                @RequestBody ServiceJobSpec.ServiceJobProcesses jobProcesses,
                                                CallMetadataAuthentication authentication); @ApiOperation("Update job's disruption budget") @PutMapping(path = "/jobs/{jobId}/disruptionBudget") ResponseEntity<Void> setJobDisruptionBudget(@PathVariable("jobId") String jobId,
                                                       @RequestBody JobDisruptionBudget jobDisruptionBudget,
                                                       CallMetadataAuthentication authentication); @ApiOperation("Update attributes of a job") @PutMapping(path = "/jobs/{jobId}/attributes") ResponseEntity<Void> updateJobAttributes(@PathVariable("jobId") String jobId,
                                                    @RequestBody JobAttributesUpdate request,
                                                    CallMetadataAuthentication authentication); @ApiOperation("Delete attributes of a job with the specified key names") @DeleteMapping(path = "/jobs/{jobId}/attributes") ResponseEntity<Void> deleteJobAttributes(@PathVariable("jobId") String jobId,
                                                    @RequestParam("keys") String delimitedKeys,
                                                    CallMetadataAuthentication authentication); @ApiOperation("Update an existing job's status") @PostMapping(path = "/jobs/{jobId}/enable") ResponseEntity<Void> enableJob(@PathVariable("jobId") String jobId, CallMetadataAuthentication authentication); @ApiOperation("Update an existing job's status") @PostMapping(path = "/jobs/{jobId}/disable") ResponseEntity<Void> disableJob(@PathVariable("jobId") String jobId, CallMetadataAuthentication authentication); @ApiOperation("Find the job with the specified ID") @GetMapping(path = "/jobs/{jobId}", produces = org.springframework.http.MediaType.APPLICATION_JSON_VALUE) Job findJob(@PathVariable("jobId") String jobId, CallMetadataAuthentication authentication); @ApiOperation("Find jobs") @GetMapping(path = "/jobs", produces = MediaType.APPLICATION_JSON_VALUE) JobQueryResult findJobs(@RequestParam MultiValueMap<String, String> queryParameters, CallMetadataAuthentication authentication); @ApiOperation("Kill a job") @DeleteMapping(path = "/jobs/{jobId}") ResponseEntity<Void> killJob(@PathVariable("jobId") String jobId, CallMetadataAuthentication authentication); @ApiOperation("Find the task with the specified ID") @GetMapping(path = "/tasks/{taskId}") Task findTask(@PathVariable("taskId") String taskId, CallMetadataAuthentication authentication); @ApiOperation("Find tasks") @GetMapping(path = "/tasks") TaskQueryResult findTasks(@RequestParam MultiValueMap<String, String> queryParameters, CallMetadataAuthentication authentication); @ApiOperation("Kill task") @DeleteMapping(path = "/tasks/{taskId}") ResponseEntity<Void> killTask(
            @PathVariable("taskId") String taskId,
            @RequestParam(name = "shrink", defaultValue = "false") boolean shrink,
            @RequestParam(name = "preventMinSizeUpdate", defaultValue = "false") boolean preventMinSizeUpdate,
            CallMetadataAuthentication authentication
    ); @ApiOperation("Update attributes of a task") @PutMapping(path = "/tasks/{taskId}/attributes") ResponseEntity<Void> updateTaskAttributes(@PathVariable("taskId") String taskId,
                                                     @RequestBody TaskAttributesUpdate request,
                                                     CallMetadataAuthentication authentication); @ApiOperation("Delete attributes of a task with the specified key names") @DeleteMapping(path = "/tasks/{taskId}/attributes") ResponseEntity<Void> deleteTaskAttributes(@PathVariable("taskId") String taskId,
                                                     @RequestParam("keys") String delimitedKeys,
                                                     CallMetadataAuthentication authentication); @ApiOperation("Move task to another job") @PostMapping(path = "/tasks/move") ResponseEntity<Void> moveTask(@RequestBody TaskMoveRequest taskMoveRequest, CallMetadataAuthentication authentication);  }
@Test public void testMoveTask() throws Exception { TaskMoveRequest request = TaskMoveRequest.newBuilder() .setSourceJobId(JOB_ID_1) .setTargetJobId(JOB_2.getId()) .setTaskId(TASK_ID_1) .build(); when(jobServiceGatewayMock.moveTask(request, JUNIT_REST_CALL_METADATA)).thenReturn(Completable.complete()); SpringMockMvcUtil.doPost(mockMvc, "/api/v3/tasks/move", request); verify(jobServiceGatewayMock, times(1)).moveTask(request, JUNIT_REST_CALL_METADATA); }