Search in sources :

Example 1 with BlockingTesterService

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

the class ErrorHandlingTest method setupForBlockingServiceWritesThenThrows.

private ServiceFactory setupForBlockingServiceWritesThenThrows(final Throwable toThrow) throws Exception {
    final BlockingTesterService blockingService = mock(BlockingTesterService.class);
    setupForBlockingServiceWritesThenThrows(blockingService, toThrow);
    return new ServiceFactory(blockingService);
}
Also used : BlockingTesterService(io.servicetalk.grpc.netty.TesterProto.Tester.BlockingTesterService) ServiceFactory(io.servicetalk.grpc.netty.TesterProto.Tester.ServiceFactory)

Example 2 with BlockingTesterService

use of io.servicetalk.grpc.netty.TesterProto.Tester.BlockingTesterService 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)

Example 3 with BlockingTesterService

use of io.servicetalk.grpc.netty.TesterProto.Tester.BlockingTesterService 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));
}
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)

Example 4 with BlockingTesterService

use of io.servicetalk.grpc.netty.TesterProto.Tester.BlockingTesterService 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));
}
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)

Example 5 with BlockingTesterService

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

the class ClosureTest method blockingServiceImplIsClosed.

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

Aggregations

BlockingTesterService (io.servicetalk.grpc.netty.TesterProto.Tester.BlockingTesterService)6 ServiceFactory (io.servicetalk.grpc.netty.TesterProto.Tester.ServiceFactory)3 TesterService (io.servicetalk.grpc.netty.TesterProto.Tester.TesterService)3 Test (org.junit.jupiter.api.Test)3 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1 ValueSource (org.junit.jupiter.params.provider.ValueSource)1