Search in sources :

Example 1 with TesterService

use of io.servicetalk.grpc.netty.TesterProto.Tester.TesterService in project servicetalk by apple.

the class ErrorHandlingTest method setupForServiceEmitsError.

private ServiceFactory setupForServiceEmitsError(final Throwable toThrow) {
    final TesterService service = mockTesterService();
    setupForServiceEmitsError(service, toThrow);
    return new ServiceFactory(service);
}
Also used : ServiceFactory(io.servicetalk.grpc.netty.TesterProto.Tester.ServiceFactory) TesterService(io.servicetalk.grpc.netty.TesterProto.Tester.TesterService) BlockingTesterService(io.servicetalk.grpc.netty.TesterProto.Tester.BlockingTesterService)

Example 2 with TesterService

use of io.servicetalk.grpc.netty.TesterProto.Tester.TesterService in project servicetalk by apple.

the class ClosureTest method serviceImplIsClosed.

@ParameterizedTest(name = "graceful? => {0}")
@ValueSource(booleans = { true, false })
void serviceImplIsClosed(final boolean param) throws Exception {
    setUp(param);
    CloseSignal signal = new CloseSignal(1);
    TesterService svc = setupCloseMock(mock(TesterService.class), signal);
    startServerAndClose(new ServiceFactory(svc), signal);
    verifyClosure(svc, 4);
    signal.verifyCloseAtLeastCount(closeGracefully);
}
Also used : ServiceFactory(io.servicetalk.grpc.netty.TesterProto.Tester.ServiceFactory) TesterService(io.servicetalk.grpc.netty.TesterProto.Tester.TesterService) BlockingTesterService(io.servicetalk.grpc.netty.TesterProto.Tester.BlockingTesterService) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 3 with TesterService

use of io.servicetalk.grpc.netty.TesterProto.Tester.TesterService in project servicetalk by apple.

the class ErrorHandlingTest method setupForServiceOperatorThrows.

private ServiceFactory setupForServiceOperatorThrows(final Throwable toThrow) {
    final TesterService service = mockTesterService();
    setupForServiceOperatorThrows(service, toThrow);
    return new ServiceFactory(service);
}
Also used : ServiceFactory(io.servicetalk.grpc.netty.TesterProto.Tester.ServiceFactory) TesterService(io.servicetalk.grpc.netty.TesterProto.Tester.TesterService) BlockingTesterService(io.servicetalk.grpc.netty.TesterProto.Tester.BlockingTesterService)

Example 4 with TesterService

use of io.servicetalk.grpc.netty.TesterProto.Tester.TesterService in project servicetalk by apple.

the class ErrorHandlingTest method mockTesterService.

private TesterService mockTesterService() {
    TesterService filter = mock(TesterService.class);
    when(filter.closeAsync()).thenReturn(completed());
    when(filter.closeAsyncGracefully()).thenReturn(completed());
    return filter;
}
Also used : TesterService(io.servicetalk.grpc.netty.TesterProto.Tester.TesterService) BlockingTesterService(io.servicetalk.grpc.netty.TesterProto.Tester.BlockingTesterService)

Example 5 with TesterService

use of io.servicetalk.grpc.netty.TesterProto.Tester.TesterService in project servicetalk by apple.

the class GrpcRouterConfigurationTest method testCanNotOverrideAlreadyRegisteredPathWithAnotherStrategy.

@Test
void testCanNotOverrideAlreadyRegisteredPathWithAnotherStrategy() {
    final TesterService asyncService = DEFAULT_STRATEGY_ASYNC_SERVICE;
    testCanNotOverrideAlreadyRegisteredPath(TestRpc.PATH, builder -> builder.test(asyncService).test(offloadNever(), asyncService));
    testCanNotOverrideAlreadyRegisteredPath(TestBiDiStreamRpc.PATH, builder -> builder.testBiDiStream(asyncService).testBiDiStream(offloadNever(), asyncService));
    testCanNotOverrideAlreadyRegisteredPath(TestResponseStreamRpc.PATH, builder -> builder.testResponseStream(asyncService).testResponseStream(offloadNever(), asyncService));
    testCanNotOverrideAlreadyRegisteredPath(TestRequestStreamRpc.PATH, builder -> builder.testRequestStream(asyncService).testRequestStream(offloadNever(), asyncService));
    final BlockingTesterService blockingService = DEFAULT_STRATEGY_BLOCKING_SERVICE;
    testCanNotOverrideAlreadyRegisteredPath(BlockingTestRpc.PATH, builder -> builder.testBlocking(blockingService).testBlocking(offloadNever(), blockingService));
    testCanNotOverrideAlreadyRegisteredPath(BlockingTestBiDiStreamRpc.PATH, builder -> builder.testBiDiStreamBlocking(blockingService).testBiDiStreamBlocking(offloadNever(), blockingService));
    testCanNotOverrideAlreadyRegisteredPath(BlockingTestResponseStreamRpc.PATH, builder -> builder.testResponseStreamBlocking(blockingService).testResponseStreamBlocking(offloadNever(), blockingService));
    testCanNotOverrideAlreadyRegisteredPath(BlockingTestRequestStreamRpc.PATH, builder -> builder.testRequestStreamBlocking(blockingService).testRequestStreamBlocking(offloadNever(), blockingService));
}
Also used : BlockingTesterService(io.servicetalk.grpc.netty.TesterProto.Tester.BlockingTesterService) TesterService(io.servicetalk.grpc.netty.TesterProto.Tester.TesterService) BlockingTesterService(io.servicetalk.grpc.netty.TesterProto.Tester.BlockingTesterService) Test(org.junit.jupiter.api.Test)

Aggregations

TesterService (io.servicetalk.grpc.netty.TesterProto.Tester.TesterService)14 BlockingTesterService (io.servicetalk.grpc.netty.TesterProto.Tester.BlockingTesterService)10 ServiceFactory (io.servicetalk.grpc.netty.TesterProto.Tester.ServiceFactory)6 Test (org.junit.jupiter.api.Test)4 Greeter (io.grpc.examples.helloworld.Greeter)3 GreeterClient (io.grpc.examples.helloworld.Greeter.GreeterClient)3 HelloRequest (io.grpc.examples.helloworld.HelloRequest)3 Completable.completed (io.servicetalk.concurrent.api.Completable.completed)3 Publisher (io.servicetalk.concurrent.api.Publisher)3 Publisher.from (io.servicetalk.concurrent.api.Publisher.from)3 Publisher.never (io.servicetalk.concurrent.api.Publisher.never)3 Single (io.servicetalk.concurrent.api.Single)3 DELIBERATE_EXCEPTION (io.servicetalk.concurrent.internal.DeliberateException.DELIBERATE_EXCEPTION)3 GrpcClientBuilder (io.servicetalk.grpc.api.GrpcClientBuilder)3 GRPC_STATUS (io.servicetalk.grpc.api.GrpcHeaderNames.GRPC_STATUS)3 GrpcServerBuilder (io.servicetalk.grpc.api.GrpcServerBuilder)3 GrpcStatusCode (io.servicetalk.grpc.api.GrpcStatusCode)3 UNIMPLEMENTED (io.servicetalk.grpc.api.GrpcStatusCode.UNIMPLEMENTED)3 UNKNOWN (io.servicetalk.grpc.api.GrpcStatusCode.UNKNOWN)3 GrpcStatusException (io.servicetalk.grpc.api.GrpcStatusException)3