@Test(expected = TitusServiceException.class) public void addLoadBalancerFailedTest() { TitusServiceException exception = TitusServiceException.jobNotFound(TEST_JOB_ID); when(loadBalancerService.addLoadBalancer(any(), any())).thenReturn(Completable.error(exception)); loadBalancerResource.addLoadBalancer(TEST_JOB_ID, TEST_LOAD_BALANCER_ID); }
@POST @ApiOperation("Add a load balancer") public Response addLoadBalancer( @QueryParam("jobId") String jobId, @QueryParam("loadBalancerId") String loadBalancerId) { return Responses.fromCompletable(loadBalancerService.addLoadBalancer( AddLoadBalancerRequest.newBuilder().setJobId(jobId).setLoadBalancerId(LoadBalancerId.newBuilder().setId(loadBalancerId).build()).build(), resolveCallMetadata()) ); }
LoadBalancerResource { @POST @ApiOperation("Add a load balancer") public Response addLoadBalancer( @QueryParam("jobId") String jobId, @QueryParam("loadBalancerId") String loadBalancerId) { return Responses.fromCompletable(loadBalancerService.addLoadBalancer( AddLoadBalancerRequest.newBuilder().setJobId(jobId).setLoadBalancerId(LoadBalancerId.newBuilder().setId(loadBalancerId).build()).build(), resolveCallMetadata()) ); } }
LoadBalancerResource { @POST @ApiOperation("Add a load balancer") public Response addLoadBalancer( @QueryParam("jobId") String jobId, @QueryParam("loadBalancerId") String loadBalancerId) { return Responses.fromCompletable(loadBalancerService.addLoadBalancer( AddLoadBalancerRequest.newBuilder().setJobId(jobId).setLoadBalancerId(LoadBalancerId.newBuilder().setId(loadBalancerId).build()).build(), resolveCallMetadata()) ); } @Inject  LoadBalancerResource(LoadBalancerService loadBalancerService,
                                SystemLogService systemLog,
                                CallMetadataResolver callMetadataResolver); }
LoadBalancerResource { @POST @ApiOperation("Add a load balancer") public Response addLoadBalancer( @QueryParam("jobId") String jobId, @QueryParam("loadBalancerId") String loadBalancerId) { return Responses.fromCompletable(loadBalancerService.addLoadBalancer( AddLoadBalancerRequest.newBuilder().setJobId(jobId).setLoadBalancerId(LoadBalancerId.newBuilder().setId(loadBalancerId).build()).build(), resolveCallMetadata()) ); } @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 { @POST @ApiOperation("Add a load balancer") public Response addLoadBalancer( @QueryParam("jobId") String jobId, @QueryParam("loadBalancerId") String loadBalancerId) { return Responses.fromCompletable(loadBalancerService.addLoadBalancer( AddLoadBalancerRequest.newBuilder().setJobId(jobId).setLoadBalancerId(LoadBalancerId.newBuilder().setId(loadBalancerId).build()).build(), resolveCallMetadata()) ); } @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);  }