@Test public void getAllJobsTest() { GetAllLoadBalancersResult expectedResult = GetAllLoadBalancersResult.newBuilder().build(); when(uriInfo.getQueryParameters()).thenReturn(getDefaultPageParameters()); when(loadBalancerService.getAllLoadBalancers(any(), any())).thenReturn(Observable.just(expectedResult)); GetAllLoadBalancersResult actualResult = loadBalancerResource.getAllLoadBalancers(uriInfo); assertEquals(expectedResult, actualResult); }
@GET @ApiOperation("Get all load balancers") public GetAllLoadBalancersResult getAllLoadBalancers(@Context UriInfo info) { Page page = RestUtil.createPage(info.getQueryParameters()); CallMetadata callMetadata = resolveCallMetadata(); logPageNumberUsage(systemLog, callMetadata, getClass().getSimpleName(), "getAllLoadBalancers", page); return Responses.fromSingleValueObservable( loadBalancerService.getAllLoadBalancers(GetAllLoadBalancersRequest.newBuilder().setPage(page).build(), callMetadata) ); }
LoadBalancerResource { @GET @ApiOperation("Get all load balancers") public GetAllLoadBalancersResult getAllLoadBalancers(@Context UriInfo info) { Page page = RestUtil.createPage(info.getQueryParameters()); CallMetadata callMetadata = resolveCallMetadata(); logPageNumberUsage(systemLog, callMetadata, getClass().getSimpleName(), "getAllLoadBalancers", page); return Responses.fromSingleValueObservable( loadBalancerService.getAllLoadBalancers(GetAllLoadBalancersRequest.newBuilder().setPage(page).build(), callMetadata) ); } }
LoadBalancerResource { @GET @ApiOperation("Get all load balancers") public GetAllLoadBalancersResult getAllLoadBalancers(@Context UriInfo info) { Page page = RestUtil.createPage(info.getQueryParameters()); CallMetadata callMetadata = resolveCallMetadata(); logPageNumberUsage(systemLog, callMetadata, getClass().getSimpleName(), "getAllLoadBalancers", page); return Responses.fromSingleValueObservable( loadBalancerService.getAllLoadBalancers(GetAllLoadBalancersRequest.newBuilder().setPage(page).build(), callMetadata) ); } @Inject  LoadBalancerResource(LoadBalancerService loadBalancerService,
                                SystemLogService systemLog,
                                CallMetadataResolver callMetadataResolver); }
LoadBalancerResource { @GET @ApiOperation("Get all load balancers") public GetAllLoadBalancersResult getAllLoadBalancers(@Context UriInfo info) { Page page = RestUtil.createPage(info.getQueryParameters()); CallMetadata callMetadata = resolveCallMetadata(); logPageNumberUsage(systemLog, callMetadata, getClass().getSimpleName(), "getAllLoadBalancers", page); return Responses.fromSingleValueObservable( loadBalancerService.getAllLoadBalancers(GetAllLoadBalancersRequest.newBuilder().setPage(page).build(), callMetadata) ); } @Inject  LoadBalancerResource(LoadBalancerService loadBalancerService,
                                SystemLogService systemLog,
                                CallMetadataResolver callMetadataResolver); @GET @ApiOperation("Find the load balancer(s) with the specified ID") @Path("/{jobId}") GetJobLoadBalancersResult getJobLoadBalancers(@PathParam("jobId") String jobId); @GET @ApiOperation("Get all load balancers") GetAllLoadBalancersResult getAllLoadBalancers(@Context UriInfo info); @POST @ApiOperation("Add a load balancer") Response addLoadBalancer(
            @QueryParam("jobId") String jobId,
            @QueryParam("loadBalancerId") String loadBalancerId); @DELETE @ApiOperation("Remove a load balancer") Response removeLoadBalancer(
            @QueryParam("jobId") String jobId,
            @QueryParam("loadBalancerId") String loadBalancerId); }
LoadBalancerResource { @GET @ApiOperation("Get all load balancers") public GetAllLoadBalancersResult getAllLoadBalancers(@Context UriInfo info) { Page page = RestUtil.createPage(info.getQueryParameters()); CallMetadata callMetadata = resolveCallMetadata(); logPageNumberUsage(systemLog, callMetadata, getClass().getSimpleName(), "getAllLoadBalancers", page); return Responses.fromSingleValueObservable( loadBalancerService.getAllLoadBalancers(GetAllLoadBalancersRequest.newBuilder().setPage(page).build(), callMetadata) ); } @Inject  LoadBalancerResource(LoadBalancerService loadBalancerService,
                                SystemLogService systemLog,
                                CallMetadataResolver callMetadataResolver); @GET @ApiOperation("Find the load balancer(s) with the specified ID") @Path("/{jobId}") GetJobLoadBalancersResult getJobLoadBalancers(@PathParam("jobId") String jobId); @GET @ApiOperation("Get all load balancers") GetAllLoadBalancersResult getAllLoadBalancers(@Context UriInfo info); @POST @ApiOperation("Add a load balancer") Response addLoadBalancer(
            @QueryParam("jobId") String jobId,
            @QueryParam("loadBalancerId") String loadBalancerId); @DELETE @ApiOperation("Remove a load balancer") Response removeLoadBalancer(
            @QueryParam("jobId") String jobId,
            @QueryParam("loadBalancerId") String loadBalancerId);  }