use of com.netflix.titus.grpc.protogen.GetAllLoadBalancersRequest in project titus-control-plane by Netflix.
the class LoadBalancerSpringResourceTest method testGetAllLoadBalancers.
@Test
public void testGetAllLoadBalancers() throws Exception {
GetAllLoadBalancersRequest request = GetAllLoadBalancersRequest.newBuilder().setPage(NEXT_PAGE_OF_1).build();
GetAllLoadBalancersResult response = GetAllLoadBalancersResult.newBuilder().setPagination(SpringMockMvcUtil.paginationOf(NEXT_PAGE_OF_1)).addJobLoadBalancers(GET_JOB_LOAD_BALANCERS_RESULT).build();
when(serviceMock.getAllLoadBalancers(request, JUNIT_REST_CALL_METADATA)).thenReturn(Observable.just(response));
GetAllLoadBalancersResult entity = SpringMockMvcUtil.doPaginatedGet(mockMvc, "/api/v3/loadBalancers", GetAllLoadBalancersResult.class, NEXT_PAGE_OF_1);
assertThat(entity).isEqualTo(response);
verify(serviceMock, times(1)).getAllLoadBalancers(request, JUNIT_REST_CALL_METADATA);
}
use of com.netflix.titus.grpc.protogen.GetAllLoadBalancersRequest in project titus-control-plane by Netflix.
the class LoadBalancerTests method getAllLoadBalancers.
/**
* Common testing helper that gets all load balancers for a given page range, ensures the gRPC
* request was successful, and returns the page result.
*/
public static GetAllLoadBalancersResult getAllLoadBalancers(Supplier<Page> pageSupplier, BiConsumer<GetAllLoadBalancersRequest, TestStreamObserver<GetAllLoadBalancersResult>> getAllLoadBalancers) {
GetAllLoadBalancersRequest request = GetAllLoadBalancersRequest.newBuilder().setPage(pageSupplier.get()).build();
TestStreamObserver<GetAllLoadBalancersResult> getResponse = new TestStreamObserver<>();
getAllLoadBalancers.accept(request, getResponse);
GetAllLoadBalancersResult result = null;
try {
result = getResponse.takeNext(TIMEOUT_MS, TimeUnit.MILLISECONDS);
} catch (Exception e) {
logger.error("Exception in getAllLoadBalancers", e);
assert false;
}
assertThat(getResponse.hasError()).isFalse();
return result;
}
Aggregations