use of io.scalecube.services.sut.CoarseGrainedServiceImpl in project scalecube by scalecube.
the class ServiceRemoteTest method test_remote_serviceA_calls_serviceB_with_dispatcher.
@Test
public void test_remote_serviceA_calls_serviceB_with_dispatcher() {
// getting proxy from any node at any given time.
CoarseGrainedServiceImpl another = new CoarseGrainedServiceImpl();
// Create microservices instance cluster.
Microservices provider = 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);
String response = service.callGreetingWithDispatcher("joe").block(Duration.ofSeconds(5));
assertEquals(response, " hello to: joe");
provider.shutdown().then(Mono.delay(TIMEOUT2)).block();
}
use of io.scalecube.services.sut.CoarseGrainedServiceImpl in project scalecube by scalecube.
the class ServiceRemoteTest method test_remote_serviceA_calls_serviceB_using_setter.
@Test
public void test_remote_serviceA_calls_serviceB_using_setter() {
// Create microservices instance cluster.
// noinspection unused
Microservices provider = Microservices.builder().discovery(ServiceRemoteTest::serviceDiscovery).transport(RSocketServiceTransport::new).services(// add service a and b
new CoarseGrainedServiceImpl()).startAwait();
// Get a proxy to the service api.
CoarseGrainedService service = gateway.call().api(CoarseGrainedService.class);
Publisher<String> future = service.callGreeting("joe");
assertEquals(" hello to: joe", Mono.from(future).block(Duration.ofSeconds(1)));
provider.shutdown().then(Mono.delay(TIMEOUT2)).block();
}
use of io.scalecube.services.sut.CoarseGrainedServiceImpl in project scalecube by scalecube.
the class ServiceRemoteTest method test_remote_serviceA_calls_serviceB.
@Test
public void test_remote_serviceA_calls_serviceB() {
// getting proxy from any node at any given time.
CoarseGrainedServiceImpl another = new CoarseGrainedServiceImpl();
// Create microservices instance cluster.
// noinspection unused
Microservices provider = Microservices.builder().discovery(ServiceRemoteTest::serviceDiscovery).transport(RSocketServiceTransport::new).services(another).startAwait();
// Get a proxy to the service api.
CoarseGrainedService service = gateway.call().api(CoarseGrainedService.class);
Publisher<String> future = service.callGreeting("joe");
assertEquals(" hello to: joe", Mono.from(future).block(Duration.ofSeconds(1)));
provider.shutdown().then(Mono.delay(TIMEOUT2)).block();
}
use of io.scalecube.services.sut.CoarseGrainedServiceImpl 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();
}
Aggregations