use of io.scalecube.services.sut.GreetingService in project scalecube by scalecube.
the class ServiceLocalTest method test_local_async_greeting_return_Message.
@Test
public void test_local_async_greeting_return_Message() {
// get a proxy to the service api.
GreetingService service = createProxy(microservices);
// call the service.
Mono<GreetingResponse> future = Mono.from(service.greetingRequest(new GreetingRequest("joe")));
future.doOnNext(result -> {
assertEquals(" hello to: joe", result.getResult());
// print the greeting.
System.out.println("9. local_async_greeting_return_Message :" + result);
}).doOnError(System.out::println).block(Duration.ofSeconds(1));
}
use of io.scalecube.services.sut.GreetingService in project scalecube by scalecube.
the class ServiceLocalTest method test_local_bidi_greeting_expect_IllegalArgumentException.
@Test
public void test_local_bidi_greeting_expect_IllegalArgumentException() {
// get a proxy to the service api.
GreetingService service = createProxy(microservices);
// call the service. bidiThrowingGreeting
Flux<GreetingResponse> responses = service.bidiGreetingIllegalArgumentException(Mono.just(new GreetingRequest("IllegalArgumentException")));
// call the service.
StepVerifier.create(responses).expectErrorMessage("IllegalArgumentException").verify(Duration.ofSeconds(3));
}
use of io.scalecube.services.sut.GreetingService in project scalecube by scalecube.
the class ServiceLocalTest method test_local_greeting_request_timeout_expires.
@Test
public void test_local_greeting_request_timeout_expires() {
GreetingService service = createProxy(microservices);
// call the service.
Throwable exception = assertThrows(RuntimeException.class, () -> Mono.from(service.greetingRequestTimeout(new GreetingRequest("joe", timeout))).timeout(Duration.ofSeconds(1)).block());
assertTrue(exception.getCause().getMessage().contains("Did not observe any item or terminal signal"));
}
use of io.scalecube.services.sut.GreetingService in project scalecube by scalecube.
the class ServiceLocalTest method test_local_async_greeting_return_GreetingResponse.
@Test
public void test_local_async_greeting_return_GreetingResponse() {
// get a proxy to the service api.
GreetingService service = createProxy(microservices);
// call the service.
Mono<GreetingResponse> future = Mono.from(service.greetingRequest(new GreetingRequest("joe")));
AtomicReference<GreetingResponse> result = new AtomicReference<>();
future.doOnNext(onNext -> {
result.set(onNext);
System.out.println("remote_async_greeting_return_GreetingResponse :" + onNext);
}).block(Duration.ofSeconds(1));
assertEquals(" hello to: joe", result.get().getResult());
}
use of io.scalecube.services.sut.GreetingService in project scalecube by scalecube.
the class ServiceLocalTest method test_local_async_greeting.
@Test
public void test_local_async_greeting() {
// get a proxy to the service api.
GreetingService service = createProxy(microservices);
// call the service.
Mono<String> future = Mono.from(service.greeting("joe"));
future.doOnNext(onNext -> {
assertEquals(" hello to: joe", onNext);
// print the greeting.
System.out.println("3. local_async_greeting :" + onNext);
}).block(Duration.ofSeconds(1000));
}
Aggregations