Search in sources :

Example 6 with ServiceCall

use of io.scalecube.services.ServiceCall in project scalecube by scalecube.

the class TestStreamingService method test_unknown_method.

@Test
public void test_unknown_method() throws InterruptedException {
    Microservices gateway = Microservices.builder().build();
    Microservices node = Microservices.builder().seeds(gateway.cluster().address()).services(new SimpleQuoteService()).build();
    ServiceCall service = gateway.dispatcher().create();
    final CountDownLatch latch1 = new CountDownLatch(1);
    Message scheduled = Messages.builder().request(QuoteService.NAME, "unknonwn").build();
    try {
        service.listen(scheduled);
    } catch (Exception ex) {
        if (ex.getMessage().contains("No reachable member with such service: unknonwn")) {
            latch1.countDown();
        }
    }
    latch1.await(2, TimeUnit.SECONDS);
    assertTrue(latch1.getCount() == 0);
    node.shutdown();
    gateway.shutdown();
}
Also used : ServiceCall(io.scalecube.services.ServiceCall) Message(io.scalecube.transport.Message) CountDownLatch(java.util.concurrent.CountDownLatch) Microservices(io.scalecube.services.Microservices) Test(org.junit.Test) BaseTest(io.scalecube.testlib.BaseTest)

Aggregations

Microservices (io.scalecube.services.Microservices)6 ServiceCall (io.scalecube.services.ServiceCall)6 BaseTest (io.scalecube.testlib.BaseTest)6 CountDownLatch (java.util.concurrent.CountDownLatch)6 Test (org.junit.Test)6 Message (io.scalecube.transport.Message)5 Subscription (rx.Subscription)4 MetricRegistry (com.codahale.metrics.MetricRegistry)3 Messages (io.scalecube.services.Messages)3 Executors (java.util.concurrent.Executors)3 TimeUnit (java.util.concurrent.TimeUnit)3 AtomicReference (java.util.concurrent.atomic.AtomicReference)3 Assert.assertTrue (org.junit.Assert.assertTrue)3 Observable (rx.Observable)3 Schedulers (rx.schedulers.Schedulers)3