Search in sources :

Example 26 with RSocketServiceTransport

use of io.scalecube.services.transport.rsocket.RSocketServiceTransport in project scalecube by scalecube.

the class ServiceRemoteTest method test_remote_serviceA_calls_serviceB_with_timeout.

@Test
public void test_remote_serviceA_calls_serviceB_with_timeout() {
    // getting proxy from any node at any given time.
    CoarseGrainedServiceImpl another = new CoarseGrainedServiceImpl();
    // Create microservices instance cluster.
    Microservices ms = Microservices.builder().discovery(ServiceRemoteTest::serviceDiscovery).transport(RSocketServiceTransport::new).services(// add service a and b
    another).startAwait();
    // Get a proxy to the service api.
    CoarseGrainedService service = gateway.call().api(CoarseGrainedService.class);
    InternalServiceException exception = assertThrows(InternalServiceException.class, () -> Mono.from(service.callGreetingTimeout("joe")).block());
    assertTrue(exception.getMessage().contains("Did not observe any item or terminal signal"));
    System.out.println("done");
    ms.shutdown().then(Mono.delay(TIMEOUT2)).block();
}
Also used : CoarseGrainedServiceImpl(io.scalecube.services.sut.CoarseGrainedServiceImpl) RSocketServiceTransport(io.scalecube.services.transport.rsocket.RSocketServiceTransport) CoarseGrainedService(io.scalecube.services.sut.CoarseGrainedService) InternalServiceException(io.scalecube.services.exceptions.InternalServiceException) Test(org.junit.jupiter.api.Test)

Aggregations

RSocketServiceTransport (io.scalecube.services.transport.rsocket.RSocketServiceTransport)26 ScalecubeServiceDiscovery (io.scalecube.services.discovery.ScalecubeServiceDiscovery)22 WebsocketTransportFactory (io.scalecube.transport.netty.websocket.WebsocketTransportFactory)22 Mono (reactor.core.publisher.Mono)18 Address (io.scalecube.net.Address)16 Microservices (io.scalecube.services.Microservices)13 Duration (java.time.Duration)12 Test (org.junit.jupiter.api.Test)11 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)9 ServiceMessage (io.scalecube.services.api.ServiceMessage)8 GreetingServiceImpl (io.scalecube.services.sut.GreetingServiceImpl)8 StepVerifier (reactor.test.StepVerifier)8 BeforeAll (org.junit.jupiter.api.BeforeAll)7 AfterAll (org.junit.jupiter.api.AfterAll)6 GreetingResponse (io.scalecube.services.sut.GreetingResponse)5 Assertions.assertThrows (org.junit.jupiter.api.Assertions.assertThrows)5 Assertions.assertTrue (org.junit.jupiter.api.Assertions.assertTrue)5 Publisher (org.reactivestreams.Publisher)5 ServiceInfo (io.scalecube.services.ServiceInfo)4 Authenticator (io.scalecube.services.auth.Authenticator)4