use of org.apache.beam.vendor.grpc.v1p43p2.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();
}
use of org.apache.beam.vendor.grpc.v1p43p2.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();
}
use of org.apache.beam.vendor.grpc.v1p43p2.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();
}
use of org.apache.beam.vendor.grpc.v1p43p2.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();
}
use of org.apache.beam.vendor.grpc.v1p43p2.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();
}
Aggregations