use of io.scalecube.services.sut.GreetingResponse in project scalecube by scalecube.
the class RoutersTest method test_round_robin.
@Test
public void test_round_robin() {
ServiceCall service = gateway.call();
// call the service.
GreetingResponse result1 = Mono.from(service.requestOne(GREETING_REQUEST_REQ, GreetingResponse.class)).timeout(TIMEOUT).block().data();
GreetingResponse result2 = Mono.from(service.requestOne(GREETING_REQUEST_REQ, GreetingResponse.class)).timeout(TIMEOUT).block().data();
assertNotEquals(result1.sender(), result2.sender());
}
use of io.scalecube.services.sut.GreetingResponse in project scalecube by scalecube.
the class RoutersTest method test_tag_selection_logic.
@Test
public void test_tag_selection_logic() {
ServiceCall service = gateway.call().router((reg, msg) -> reg.listServiceReferences().stream().filter(ref -> "2".equals(ref.tags().get("SENDER"))).findFirst());
// call the service.
for (int i = 0; i < 1e3; i++) {
GreetingResponse result = Mono.from(service.requestOne(GREETING_REQUEST_REQ, GreetingResponse.class)).timeout(TIMEOUT).block().data();
assertEquals("2", result.sender());
}
}
use of io.scalecube.services.sut.GreetingResponse 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.GreetingResponse 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.GreetingResponse 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());
}
Aggregations