@Test public void testGetJobLoadBalancers() throws Exception { JobId jobIdWrapper = JobId.newBuilder().setId(JOB_ID).build(); when(serviceMock.getLoadBalancers(jobIdWrapper, JUNIT_REST_CALL_METADATA)).thenReturn(Observable.just(GET_JOB_LOAD_BALANCERS_RESULT)); GetJobLoadBalancersResult entity = SpringMockMvcUtil.doGet(mockMvc, String.format("/api/v3/loadBalancers/%s", JOB_ID), GetJobLoadBalancersResult.class); assertThat(entity).isEqualTo(GET_JOB_LOAD_BALANCERS_RESULT); verify(serviceMock, times(1)).getLoadBalancers(jobIdWrapper, JUNIT_REST_CALL_METADATA); }
@ApiOperation("Find the load balancer(s) with the specified ID") @GetMapping(path = "/{jobId}") public GetJobLoadBalancersResult getJobLoadBalancers(@PathVariable("jobId") String jobId, CallMetadataAuthentication authentication) { return Responses.fromSingleValueObservable(loadBalancerService.getLoadBalancers( JobId.newBuilder().setId(jobId).build(), authentication.getCallMetadata() )); }
LoadBalancerSpringResource { @ApiOperation("Find the load balancer(s) with the specified ID") @GetMapping(path = "/{jobId}") public GetJobLoadBalancersResult getJobLoadBalancers(@PathVariable("jobId") String jobId, CallMetadataAuthentication authentication) { return Responses.fromSingleValueObservable(loadBalancerService.getLoadBalancers( JobId.newBuilder().setId(jobId).build(), authentication.getCallMetadata() )); } }
LoadBalancerSpringResource { @ApiOperation("Find the load balancer(s) with the specified ID") @GetMapping(path = "/{jobId}") public GetJobLoadBalancersResult getJobLoadBalancers(@PathVariable("jobId") String jobId, CallMetadataAuthentication authentication) { return Responses.fromSingleValueObservable(loadBalancerService.getLoadBalancers( JobId.newBuilder().setId(jobId).build(), authentication.getCallMetadata() )); } @Inject  LoadBalancerSpringResource(LoadBalancerService loadBalancerService, SystemLogService systemLog); }
LoadBalancerSpringResource { @ApiOperation("Find the load balancer(s) with the specified ID") @GetMapping(path = "/{jobId}") public GetJobLoadBalancersResult getJobLoadBalancers(@PathVariable("jobId") String jobId, CallMetadataAuthentication authentication) { return Responses.fromSingleValueObservable(loadBalancerService.getLoadBalancers( JobId.newBuilder().setId(jobId).build(), authentication.getCallMetadata() )); } @Inject  LoadBalancerSpringResource(LoadBalancerService loadBalancerService, SystemLogService systemLog); @ApiOperation("Find the load balancer(s) with the specified ID") @GetMapping(path = "/{jobId}") GetJobLoadBalancersResult getJobLoadBalancers(@PathVariable("jobId") String jobId, CallMetadataAuthentication authentication); @ApiOperation("Get all load balancers") @GetMapping GetAllLoadBalancersResult getAllLoadBalancers(@RequestParam MultiValueMap<String, String> queryParameters,
                                                         CallMetadataAuthentication authentication); @ApiOperation("Add a load balancer") @PostMapping ResponseEntity<Void> addLoadBalancer(
            @RequestParam("jobId") String jobId,
            @RequestParam("loadBalancerId") String loadBalancerId,
            CallMetadataAuthentication authentication); @ApiOperation("Remove a load balancer") @DeleteMapping ResponseEntity<Void> removeLoadBalancer(
            @RequestParam("jobId") String jobId,
            @RequestParam("loadBalancerId") String loadBalancerId,
            CallMetadataAuthentication authentication); }
LoadBalancerSpringResource { @ApiOperation("Find the load balancer(s) with the specified ID") @GetMapping(path = "/{jobId}") public GetJobLoadBalancersResult getJobLoadBalancers(@PathVariable("jobId") String jobId, CallMetadataAuthentication authentication) { return Responses.fromSingleValueObservable(loadBalancerService.getLoadBalancers( JobId.newBuilder().setId(jobId).build(), authentication.getCallMetadata() )); } @Inject  LoadBalancerSpringResource(LoadBalancerService loadBalancerService, SystemLogService systemLog); @ApiOperation("Find the load balancer(s) with the specified ID") @GetMapping(path = "/{jobId}") GetJobLoadBalancersResult getJobLoadBalancers(@PathVariable("jobId") String jobId, CallMetadataAuthentication authentication); @ApiOperation("Get all load balancers") @GetMapping GetAllLoadBalancersResult getAllLoadBalancers(@RequestParam MultiValueMap<String, String> queryParameters,
                                                         CallMetadataAuthentication authentication); @ApiOperation("Add a load balancer") @PostMapping ResponseEntity<Void> addLoadBalancer(
            @RequestParam("jobId") String jobId,
            @RequestParam("loadBalancerId") String loadBalancerId,
            CallMetadataAuthentication authentication); @ApiOperation("Remove a load balancer") @DeleteMapping ResponseEntity<Void> removeLoadBalancer(
            @RequestParam("jobId") String jobId,
            @RequestParam("loadBalancerId") String loadBalancerId,
            CallMetadataAuthentication authentication);  }