use of io.servicetalk.grpc.netty.TesterProto.Tester.TesterService in project servicetalk by apple.
the class GrpcRouterConfigurationTest method testCanNotOverrideAlreadyRegisteredPath.
@Test
void testCanNotOverrideAlreadyRegisteredPath() {
final TesterService asyncService = DEFAULT_STRATEGY_ASYNC_SERVICE;
final TesterService alternativeAsyncService = CLASS_NO_OFFLOADS_STRATEGY_ASYNC_SERVICE;
testCanNotOverrideAlreadyRegisteredPath(TestRpc.PATH, builder -> builder.test(asyncService).test(alternativeAsyncService));
testCanNotOverrideAlreadyRegisteredPath(TestBiDiStreamRpc.PATH, builder -> builder.testBiDiStream(asyncService).testBiDiStream(alternativeAsyncService));
testCanNotOverrideAlreadyRegisteredPath(TestResponseStreamRpc.PATH, builder -> builder.testResponseStream(asyncService).testResponseStream(alternativeAsyncService));
testCanNotOverrideAlreadyRegisteredPath(TestRequestStreamRpc.PATH, builder -> builder.testRequestStream(asyncService).testRequestStream(alternativeAsyncService));
final BlockingTesterService blockingService = DEFAULT_STRATEGY_BLOCKING_SERVICE;
final BlockingTesterService alternativeBlockingService = CLASS_NO_OFFLOADS_STRATEGY_BLOCKING_SERVICE;
testCanNotOverrideAlreadyRegisteredPath(BlockingTestRpc.PATH, builder -> builder.testBlocking(blockingService).testBlocking(alternativeBlockingService));
testCanNotOverrideAlreadyRegisteredPath(BlockingTestBiDiStreamRpc.PATH, builder -> builder.testBiDiStreamBlocking(blockingService).testBiDiStreamBlocking(alternativeBlockingService));
testCanNotOverrideAlreadyRegisteredPath(BlockingTestResponseStreamRpc.PATH, builder -> builder.testResponseStreamBlocking(blockingService).testResponseStreamBlocking(alternativeBlockingService));
testCanNotOverrideAlreadyRegisteredPath(BlockingTestRequestStreamRpc.PATH, builder -> builder.testRequestStreamBlocking(blockingService).testRequestStreamBlocking(alternativeBlockingService));
}
use of io.servicetalk.grpc.netty.TesterProto.Tester.TesterService in project servicetalk by apple.
the class GrpcRouterConfigurationTest method testCanNotOverrideAlreadyRegisteredPathWithAnotherApi.
@Test
void testCanNotOverrideAlreadyRegisteredPathWithAnotherApi() {
final TesterService asyncService = DEFAULT_STRATEGY_ASYNC_SERVICE;
final BlockingTesterService blockingService = DEFAULT_STRATEGY_BLOCKING_SERVICE;
// Test registering of async RPC then blocking RPC for the same path:
testCanNotOverrideAlreadyRegisteredPath(TestRpc.PATH, builder -> builder.test(asyncService).testBlocking(blockingService));
testCanNotOverrideAlreadyRegisteredPath(TestBiDiStreamRpc.PATH, builder -> builder.testBiDiStream(asyncService).testBiDiStreamBlocking(blockingService));
testCanNotOverrideAlreadyRegisteredPath(TestResponseStreamRpc.PATH, builder -> builder.testResponseStream(asyncService).testResponseStreamBlocking(blockingService));
testCanNotOverrideAlreadyRegisteredPath(TestRequestStreamRpc.PATH, builder -> builder.testRequestStream(asyncService).testRequestStreamBlocking(blockingService));
// Test registering of blocking RPC then async RPC for the same path:
testCanNotOverrideAlreadyRegisteredPath(BlockingTestRpc.PATH, builder -> builder.testBlocking(blockingService).test(asyncService));
testCanNotOverrideAlreadyRegisteredPath(BlockingTestBiDiStreamRpc.PATH, builder -> builder.testBiDiStreamBlocking(blockingService).testBiDiStream(asyncService));
testCanNotOverrideAlreadyRegisteredPath(BlockingTestResponseStreamRpc.PATH, builder -> builder.testResponseStreamBlocking(blockingService).testResponseStream(asyncService));
testCanNotOverrideAlreadyRegisteredPath(BlockingTestRequestStreamRpc.PATH, builder -> builder.testRequestStreamBlocking(blockingService).testRequestStream(asyncService));
}
use of io.servicetalk.grpc.netty.TesterProto.Tester.TesterService in project servicetalk by apple.
the class TrailersOnlyErrorTest method testServiceThrows.
@Test
void testServiceThrows() throws Exception {
final BlockingQueue<Throwable> asyncErrors = new LinkedBlockingDeque<>();
final TesterService service = mockTesterService();
setupServiceThrows(service);
try (ServerContext serverContext = GrpcServers.forAddress(localAddress(0)).listenAndAwait(new Tester.ServiceFactory(service))) {
final GrpcClientBuilder<HostAndPort, InetSocketAddress> clientBuilder = GrpcClients.forAddress(serverHostAndPort(serverContext)).initializeHttp(builder -> builder.appendClientFilter(__ -> true, setupResponseVerifierFilter(asyncErrors)));
try (TesterClient client = clientBuilder.build(new Tester.ClientFactory())) {
verifyException(client.test(TestRequest.newBuilder().build()).toFuture(), UNKNOWN);
assertNoAsyncErrors(asyncErrors);
verifyException(client.testRequestStream(Publisher.from(TestRequest.newBuilder().build())).toFuture(), UNKNOWN);
assertNoAsyncErrors(asyncErrors);
verifyException(client.testBiDiStream(from(TestRequest.newBuilder().build()).concat(never())).toFuture(), UNKNOWN);
assertNoAsyncErrors(asyncErrors);
verifyException(client.testBiDiStream(from(TestRequest.newBuilder().build())).toFuture(), UNKNOWN);
assertNoAsyncErrors(asyncErrors);
}
}
}
use of io.servicetalk.grpc.netty.TesterProto.Tester.TesterService in project servicetalk by apple.
the class ErrorHandlingTest method setupForServiceSecondOperatorThrows.
private ServiceFactory setupForServiceSecondOperatorThrows(final Throwable toThrow) {
final TesterService service = mockTesterService();
setupForServiceSecondOperatorThrows(service, toThrow);
return new ServiceFactory(service);
}
use of io.servicetalk.grpc.netty.TesterProto.Tester.TesterService in project servicetalk by apple.
the class ErrorHandlingTest method setupForServiceThrows.
private ServiceFactory setupForServiceThrows(final Throwable toThrow) {
final TesterService service = mockTesterService();
setupForServiceThrows(service, toThrow);
return new ServiceFactory(service);
}
Aggregations