Search in sources :

Example 1 with QuoteService

use of io.scalecube.services.sut.QuoteService in project scalecube by scalecube.

the class StreamingServiceTest method test_local_quotes_service.

@Test
public void test_local_quotes_service() {
    QuoteService service = node.call().api(QuoteService.class);
    int expected = 3;
    List<String> list = service.quotes().take(Duration.ofMillis(3500)).collectList().block();
    assertEquals(expected, list.size());
}
Also used : SimpleQuoteService(io.scalecube.services.sut.SimpleQuoteService) QuoteService(io.scalecube.services.sut.QuoteService) Test(org.junit.jupiter.api.Test)

Example 2 with QuoteService

use of io.scalecube.services.sut.QuoteService in project scalecube by scalecube.

the class StreamingServiceTest method test_quotes_batch.

@Test
public void test_quotes_batch() throws InterruptedException {
    int streamBound = 1000;
    QuoteService service = gateway.call().api(QuoteService.class);
    CountDownLatch latch1 = new CountDownLatch(streamBound);
    final Disposable sub1 = service.snapshot(streamBound).subscribe(onNext -> latch1.countDown());
    latch1.await(15, TimeUnit.SECONDS);
    System.out.println("Curr value received: " + latch1.getCount());
    assertEquals(0, latch1.getCount());
    sub1.dispose();
}
Also used : Disposable(reactor.core.Disposable) SimpleQuoteService(io.scalecube.services.sut.SimpleQuoteService) QuoteService(io.scalecube.services.sut.QuoteService) CountDownLatch(java.util.concurrent.CountDownLatch) Test(org.junit.jupiter.api.Test)

Example 3 with QuoteService

use of io.scalecube.services.sut.QuoteService in project scalecube by scalecube.

the class StreamingServiceTest method test_just_once.

@Test
public void test_just_once() {
    QuoteService service = gateway.call().api(QuoteService.class);
    assertEquals("1", service.justOne().block(Duration.ofSeconds(2)));
}
Also used : SimpleQuoteService(io.scalecube.services.sut.SimpleQuoteService) QuoteService(io.scalecube.services.sut.QuoteService) Test(org.junit.jupiter.api.Test)

Example 4 with QuoteService

use of io.scalecube.services.sut.QuoteService in project scalecube by scalecube.

the class StreamingServiceTest method test_remote_quotes_service.

@Test
public void test_remote_quotes_service() throws InterruptedException {
    CountDownLatch latch1 = new CountDownLatch(3);
    CountDownLatch latch2 = new CountDownLatch(3);
    QuoteService service = gateway.call().api(QuoteService.class);
    service.snapshot(3).subscribe(onNext -> latch1.countDown());
    service.snapshot(3).subscribe(onNext -> latch2.countDown());
    latch1.await(5, TimeUnit.SECONDS);
    latch2.await(5, TimeUnit.SECONDS);
    assertEquals(0, latch1.getCount());
    assertEquals(0, latch2.getCount());
}
Also used : SimpleQuoteService(io.scalecube.services.sut.SimpleQuoteService) QuoteService(io.scalecube.services.sut.QuoteService) CountDownLatch(java.util.concurrent.CountDownLatch) Test(org.junit.jupiter.api.Test)

Aggregations

QuoteService (io.scalecube.services.sut.QuoteService)4 SimpleQuoteService (io.scalecube.services.sut.SimpleQuoteService)4 Test (org.junit.jupiter.api.Test)4 CountDownLatch (java.util.concurrent.CountDownLatch)2 Disposable (reactor.core.Disposable)1