Search in sources :

Example 1 with InProcessServerBuilder

use of io.grpc.inprocess.InProcessServerBuilder in project google-cloud-java by GoogleCloudPlatform.

the class PublisherImplTest method setUp.

@Before
public void setUp() throws Exception {
    testPublisherServiceImpl = new FakePublisherServiceImpl();
    InProcessServerBuilder serverBuilder = InProcessServerBuilder.forName("test-server");
    serverBuilder.addService(testPublisherServiceImpl);
    testServer = serverBuilder.build();
    testServer.start();
    fakeExecutor = new FakeScheduledExecutorService();
}
Also used : InProcessServerBuilder(io.grpc.inprocess.InProcessServerBuilder) Before(org.junit.Before)

Example 2 with InProcessServerBuilder

use of io.grpc.inprocess.InProcessServerBuilder in project google-cloud-java by GoogleCloudPlatform.

the class SubscriberTest method setUp.

@Before
public void setUp() throws Exception {
    InProcessServerBuilder serverBuilder = InProcessServerBuilder.forName(testName.getMethodName());
    fakeSubscriberServiceImpl = new FakeSubscriberServiceImpl();
    fakeExecutor = new FakeScheduledExecutorService();
    testChannel = InProcessChannelBuilder.forName(testName.getMethodName()).build();
    serverBuilder.addService(fakeSubscriberServiceImpl);
    testServer = serverBuilder.build();
    testServer.start();
    testReceiver = new TestReceiver();
}
Also used : InProcessServerBuilder(io.grpc.inprocess.InProcessServerBuilder) Before(org.junit.Before)

Example 3 with InProcessServerBuilder

use of io.grpc.inprocess.InProcessServerBuilder in project jetcd by coreos.

the class GrpcServerExtension method beforeEach.

/**
 * Before the test has started, create the server and channel.
 */
@Override
public void beforeEach(ExtensionContext context) throws Exception {
    serverName = UUID.randomUUID().toString();
    serviceRegistry = new MutableHandlerRegistry();
    InProcessServerBuilder serverBuilder = InProcessServerBuilder.forName(serverName).fallbackHandlerRegistry(serviceRegistry);
    if (useDirectExecutor) {
        serverBuilder.directExecutor();
    }
    server = serverBuilder.build().start();
    InProcessChannelBuilder channelBuilder = InProcessChannelBuilder.forName(serverName);
    if (useDirectExecutor) {
        channelBuilder.directExecutor();
    }
    channel = channelBuilder.build();
}
Also used : InProcessChannelBuilder(io.grpc.inprocess.InProcessChannelBuilder) MutableHandlerRegistry(io.grpc.util.MutableHandlerRegistry) InProcessServerBuilder(io.grpc.inprocess.InProcessServerBuilder)

Example 4 with InProcessServerBuilder

use of io.grpc.inprocess.InProcessServerBuilder in project beam by apache.

the class InProcessServerFactory method create.

@Override
public Server create(List<BindableService> services, ApiServiceDescriptor serviceDescriptor) throws IOException {
    InProcessServerBuilder builder = InProcessServerBuilder.forName(serviceDescriptor.getUrl());
    services.stream().forEach(service -> builder.addService(ServerInterceptors.intercept(service, GrpcContextHeaderAccessorProvider.interceptor())));
    return builder.build().start();
}
Also used : InProcessServerBuilder(org.apache.beam.vendor.grpc.v1p43p2.io.grpc.inprocess.InProcessServerBuilder)

Example 5 with InProcessServerBuilder

use of io.grpc.inprocess.InProcessServerBuilder in project beam by apache.

the class InProcessServerFactory method allocateAddressAndCreate.

@Override
public Server allocateAddressAndCreate(List<BindableService> services, ApiServiceDescriptor.Builder builder) throws IOException {
    String name = String.format("InProcessServer_%s", serviceNameUniqifier.getAndIncrement());
    builder.setUrl(name);
    InProcessServerBuilder serverBuilder = InProcessServerBuilder.forName(name);
    services.stream().forEach(service -> serverBuilder.addService(ServerInterceptors.intercept(service, GrpcContextHeaderAccessorProvider.interceptor())));
    return serverBuilder.build().start();
}
Also used : InProcessServerBuilder(org.apache.beam.vendor.grpc.v1p43p2.io.grpc.inprocess.InProcessServerBuilder)

Aggregations

InProcessServerBuilder (io.grpc.inprocess.InProcessServerBuilder)5 InProcessChannelBuilder (io.grpc.inprocess.InProcessChannelBuilder)2 MutableHandlerRegistry (io.grpc.util.MutableHandlerRegistry)2 InProcessServerBuilder (org.apache.beam.vendor.grpc.v1p43p2.io.grpc.inprocess.InProcessServerBuilder)2 Before (org.junit.Before)2 InternalInProcessServerBuilder (io.grpc.inprocess.InternalInProcessServerBuilder)1