Search in sources :

Example 6 with SimpleRequest

use of io.grpc.testing.protobuf.SimpleRequest in project grpc-java by grpc.

the class LoggingServerProviderTest method unaryRpc.

private static String unaryRpc(String requestMessage, SimpleServiceGrpc.SimpleServiceBlockingStub blockingStub) {
    SimpleRequest request = SimpleRequest.newBuilder().setRequestMessage(requestMessage).build();
    SimpleResponse response = blockingStub.unaryRpc(request);
    return response.getResponseMessage();
}
Also used : SimpleResponse(io.grpc.testing.protobuf.SimpleResponse) SimpleRequest(io.grpc.testing.protobuf.SimpleRequest)

Example 7 with SimpleRequest

use of io.grpc.testing.protobuf.SimpleRequest in project grpc-java by grpc.

the class FakeControlPlaneXdsIntegrationTest method pingPong.

@Test
public void pingPong() throws Exception {
    String tcpListenerName = SERVER_LISTENER_TEMPLATE_NO_REPLACEMENT;
    String serverHostName = "test-server";
    controlPlaneService.setXdsConfig(ADS_TYPE_URL_LDS, ImmutableMap.<String, Listener>of(tcpListenerName, serverListener(tcpListenerName), serverHostName, clientListener(serverHostName)));
    startServer(defaultBootstrapOverride());
    controlPlaneService.setXdsConfig(ADS_TYPE_URL_RDS, ImmutableMap.of(rdsName, rds(serverHostName)));
    controlPlaneService.setXdsConfig(ADS_TYPE_URL_CDS, ImmutableMap.<String, Message>of(clusterName, cds()));
    InetSocketAddress edsInetSocketAddress = (InetSocketAddress) server.getListenSockets().get(0);
    controlPlaneService.setXdsConfig(ADS_TYPE_URL_EDS, ImmutableMap.<String, Message>of(edsName, eds(edsInetSocketAddress.getHostName(), edsInetSocketAddress.getPort())));
    ManagedChannel channel = Grpc.newChannelBuilder(scheme + ":///" + serverHostName, InsecureChannelCredentials.create()).build();
    blockingStub = SimpleServiceGrpc.newBlockingStub(channel);
    SimpleRequest request = SimpleRequest.newBuilder().build();
    SimpleResponse goldenResponse = SimpleResponse.newBuilder().setResponseMessage("Hi, xDS!").build();
    assertEquals(goldenResponse, blockingStub.unaryRpc(request));
}
Also used : InetSocketAddress(java.net.InetSocketAddress) SimpleResponse(io.grpc.testing.protobuf.SimpleResponse) ManagedChannel(io.grpc.ManagedChannel) SimpleRequest(io.grpc.testing.protobuf.SimpleRequest) Test(org.junit.Test)

Example 8 with SimpleRequest

use of io.grpc.testing.protobuf.SimpleRequest in project grpc-java by grpc.

the class XdsSdsClientServerTest method unaryRpc.

/**
 * Say hello to server.
 */
private static String unaryRpc(String requestMessage, SimpleServiceGrpc.SimpleServiceBlockingStub blockingStub) {
    SimpleRequest request = SimpleRequest.newBuilder().setRequestMessage(requestMessage).build();
    SimpleResponse response = blockingStub.unaryRpc(request);
    return response.getResponseMessage();
}
Also used : SimpleResponse(io.grpc.testing.protobuf.SimpleResponse) SimpleRequest(io.grpc.testing.protobuf.SimpleRequest)

Aggregations

SimpleRequest (io.grpc.testing.protobuf.SimpleRequest)8 SimpleResponse (io.grpc.testing.protobuf.SimpleResponse)6 SimpleServiceGrpc (io.grpc.testing.protobuf.SimpleServiceGrpc)5 Test (org.junit.Test)4 ManagedChannel (io.grpc.ManagedChannel)3 StreamObserver (io.grpc.stub.StreamObserver)3 ServerInterceptor (io.grpc.ServerInterceptor)2 Context (io.grpc.Context)1 Metadata (io.grpc.Metadata)1 ServerStreamTracer (io.grpc.ServerStreamTracer)1 CallMetricRecorder (io.grpc.services.CallMetricRecorder)1 InternalCallMetricRecorder (io.grpc.services.InternalCallMetricRecorder)1 InetSocketAddress (java.net.InetSocketAddress)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 Before (org.junit.Before)1