Search in sources :

Example 1 with ServiceResponse

use of io.grpc.reflection.v1alpha.ServiceResponse in project grpc-java by grpc.

the class ProtoReflectionServiceTest method assertServiceResponseEquals.

private void assertServiceResponseEquals(Set<ServiceResponse> goldenResponse) throws Exception {
    ServerReflectionRequest request = ServerReflectionRequest.newBuilder().setHost(TEST_HOST).setListServices("services").build();
    StreamRecorder<ServerReflectionResponse> responseObserver = StreamRecorder.create();
    StreamObserver<ServerReflectionRequest> requestObserver = stub.serverReflectionInfo(responseObserver);
    requestObserver.onNext(request);
    requestObserver.onCompleted();
    List<ServiceResponse> response = responseObserver.firstValue().get().getListServicesResponse().getServiceList();
    assertEquals(goldenResponse.size(), response.size());
    assertEquals(goldenResponse, new HashSet<ServiceResponse>(response));
}
Also used : ServiceResponse(io.grpc.reflection.v1alpha.ServiceResponse) ServerReflectionRequest(io.grpc.reflection.v1alpha.ServerReflectionRequest) ServerReflectionResponse(io.grpc.reflection.v1alpha.ServerReflectionResponse)

Aggregations

ServerReflectionRequest (io.grpc.reflection.v1alpha.ServerReflectionRequest)1 ServerReflectionResponse (io.grpc.reflection.v1alpha.ServerReflectionResponse)1 ServiceResponse (io.grpc.reflection.v1alpha.ServiceResponse)1