@Test public void testUpdateScalingPolicy() throws Exception { UpdatePolicyRequest request = UpdatePolicyRequest.newBuilder().build(); when(serviceMock.updateAutoScalingPolicy(request, JUNIT_REST_CALL_METADATA)).thenReturn(Completable.complete()); SpringMockMvcUtil.doPut(mockMvc, "/api/v3/autoscaling/scalingPolicy", request); verify(serviceMock, times(1)).updateAutoScalingPolicy(request, JUNIT_REST_CALL_METADATA); }
@ApiOperation("Update scaling policy") @PutMapping("scalingPolicy") public ResponseEntity<Void> updateScalingPolicy(@RequestBody UpdatePolicyRequest updatePolicyRequest, CallMetadataAuthentication authentication) { return Responses.fromCompletable(autoScalingService.updateAutoScalingPolicy(updatePolicyRequest, authentication.getCallMetadata()), HttpStatus.OK); }
AutoScalingSpringResource { @ApiOperation("Update scaling policy") @PutMapping("scalingPolicy") public ResponseEntity<Void> updateScalingPolicy(@RequestBody UpdatePolicyRequest updatePolicyRequest, CallMetadataAuthentication authentication) { return Responses.fromCompletable(autoScalingService.updateAutoScalingPolicy(updatePolicyRequest, authentication.getCallMetadata()), HttpStatus.OK); } }
AutoScalingSpringResource { @ApiOperation("Update scaling policy") @PutMapping("scalingPolicy") public ResponseEntity<Void> updateScalingPolicy(@RequestBody UpdatePolicyRequest updatePolicyRequest, CallMetadataAuthentication authentication) { return Responses.fromCompletable(autoScalingService.updateAutoScalingPolicy(updatePolicyRequest, authentication.getCallMetadata()), HttpStatus.OK); } @Inject  AutoScalingSpringResource(AutoScalingService autoScalingService); }
AutoScalingSpringResource { @ApiOperation("Update scaling policy") @PutMapping("scalingPolicy") public ResponseEntity<Void> updateScalingPolicy(@RequestBody UpdatePolicyRequest updatePolicyRequest, CallMetadataAuthentication authentication) { return Responses.fromCompletable(autoScalingService.updateAutoScalingPolicy(updatePolicyRequest, authentication.getCallMetadata()), HttpStatus.OK); } @Inject  AutoScalingSpringResource(AutoScalingService autoScalingService); @ApiOperation("Find scaling policies for a job") @GetMapping(path = "/scalingPolicies") GetPolicyResult getAllScalingPolicies(CallMetadataAuthentication authentication); @ApiOperation("Find scaling policies for a job") @GetMapping(path = "/scalingPolicies/{jobId}") GetPolicyResult getScalingPolicyForJob(@PathVariable("jobId") String jobId, CallMetadataAuthentication authentication); @ApiOperation("Create or Update scaling policy") @PostMapping(path = "/scalingPolicy") ScalingPolicyID setScalingPolicy(@RequestBody PutPolicyRequest putPolicyRequest, CallMetadataAuthentication authentication); @ApiOperation("Find scaling policy for a policy Id") @GetMapping(path = "scalingPolicy/{policyId}") GetPolicyResult getScalingPolicy(@PathVariable("policyId") String policyId, CallMetadataAuthentication authentication); @ApiOperation("Delete scaling policy") @DeleteMapping(path = "scalingPolicy/{policyId}") ResponseEntity<Void> removePolicy(@PathVariable("policyId") String policyId, CallMetadataAuthentication authentication); @ApiOperation("Update scaling policy") @PutMapping("scalingPolicy") ResponseEntity<Void> updateScalingPolicy(@RequestBody UpdatePolicyRequest updatePolicyRequest, CallMetadataAuthentication authentication); }
AutoScalingSpringResource { @ApiOperation("Update scaling policy") @PutMapping("scalingPolicy") public ResponseEntity<Void> updateScalingPolicy(@RequestBody UpdatePolicyRequest updatePolicyRequest, CallMetadataAuthentication authentication) { return Responses.fromCompletable(autoScalingService.updateAutoScalingPolicy(updatePolicyRequest, authentication.getCallMetadata()), HttpStatus.OK); } @Inject  AutoScalingSpringResource(AutoScalingService autoScalingService); @ApiOperation("Find scaling policies for a job") @GetMapping(path = "/scalingPolicies") GetPolicyResult getAllScalingPolicies(CallMetadataAuthentication authentication); @ApiOperation("Find scaling policies for a job") @GetMapping(path = "/scalingPolicies/{jobId}") GetPolicyResult getScalingPolicyForJob(@PathVariable("jobId") String jobId, CallMetadataAuthentication authentication); @ApiOperation("Create or Update scaling policy") @PostMapping(path = "/scalingPolicy") ScalingPolicyID setScalingPolicy(@RequestBody PutPolicyRequest putPolicyRequest, CallMetadataAuthentication authentication); @ApiOperation("Find scaling policy for a policy Id") @GetMapping(path = "scalingPolicy/{policyId}") GetPolicyResult getScalingPolicy(@PathVariable("policyId") String policyId, CallMetadataAuthentication authentication); @ApiOperation("Delete scaling policy") @DeleteMapping(path = "scalingPolicy/{policyId}") ResponseEntity<Void> removePolicy(@PathVariable("policyId") String policyId, CallMetadataAuthentication authentication); @ApiOperation("Update scaling policy") @PutMapping("scalingPolicy") ResponseEntity<Void> updateScalingPolicy(@RequestBody UpdatePolicyRequest updatePolicyRequest, CallMetadataAuthentication authentication);  }