Search in sources :

Example 1 with Queues

use of reactor.util.concurrent.Queues in project reactor-core by reactor.

the class UnicastProcessorTest method createOverrideAll.

@Test
public void createOverrideAll() {
    Disposable onTerminate = () -> {
    };
    Consumer<? super Integer> onOverflow = t -> {
    };
    Queue<Integer> queue = Queues.<Integer>get(10).get();
    UnicastProcessor<Integer> processor = UnicastProcessor.create(queue, onOverflow, onTerminate);
    assertProcessor(processor, queue, onOverflow, onTerminate);
}
Also used : Disposable(reactor.core.Disposable) Disposable(reactor.core.Disposable) StepVerifier(reactor.test.StepVerifier) PriorityQueue(java.util.PriorityQueue) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Test(org.junit.Test) LinkedBlockingQueue(java.util.concurrent.LinkedBlockingQueue) Nullable(reactor.util.annotation.Nullable) Executors(java.util.concurrent.Executors) Queues(reactor.util.concurrent.Queues) Consumer(java.util.function.Consumer) CoreSubscriber(reactor.core.CoreSubscriber) AssertSubscriber(reactor.test.subscriber.AssertSubscriber) Queue(java.util.Queue) ExecutorService(java.util.concurrent.ExecutorService) Assert.assertEquals(org.junit.Assert.assertEquals) ConcurrentLinkedQueue(java.util.concurrent.ConcurrentLinkedQueue) Test(org.junit.Test)

Example 2 with Queues

use of reactor.util.concurrent.Queues in project reactor-core by reactor.

the class FluxPeekFuseableTest method asyncFusionAvailable.

@Test
public void asyncFusionAvailable() {
    AssertSubscriber<Integer> ts = AssertSubscriber.create();
    UnicastProcessor.create(Queues.<Integer>get(2).get()).doOnNext(v -> {
    }).subscribe(ts);
    Subscription s = ts.upstream();
    Assert.assertTrue("Non-fuseable upstream" + s, s instanceof Fuseable.QueueSubscription);
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) PeekConditionalSubscriber(reactor.core.publisher.FluxPeekFuseable.PeekConditionalSubscriber) CoreMatchers(org.hamcrest.CoreMatchers) StepVerifier(reactor.test.StepVerifier) Scannable(reactor.core.Scannable) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) AtomicReference(java.util.concurrent.atomic.AtomicReference) ArrayList(java.util.ArrayList) Queues(reactor.util.concurrent.Queues) CoreSubscriber(reactor.core.CoreSubscriber) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Schedulers(reactor.core.scheduler.Schedulers) Thread.sleep(java.lang.Thread.sleep) MockUtils(reactor.test.MockUtils) Nullable(javax.annotation.Nullable) PeekFuseableSubscriber(reactor.core.publisher.FluxPeekFuseable.PeekFuseableSubscriber) Context(reactor.util.context.Context) Test(org.junit.Test) Schedulers.parallel(reactor.core.scheduler.Schedulers.parallel) LongConsumer(java.util.function.LongConsumer) Consumer(java.util.function.Consumer) AtomicLong(java.util.concurrent.atomic.AtomicLong) Mockito(org.mockito.Mockito) List(java.util.List) Fuseable(reactor.core.Fuseable) Subscription(org.reactivestreams.Subscription) AssertSubscriber(reactor.test.subscriber.AssertSubscriber) Queue(java.util.Queue) Assert(org.junit.Assert) Exceptions(reactor.core.Exceptions) Collections(java.util.Collections) PeekFuseableConditionalSubscriber(reactor.core.publisher.FluxPeekFuseable.PeekFuseableConditionalSubscriber) Subscription(org.reactivestreams.Subscription) Fuseable(reactor.core.Fuseable) Test(org.junit.Test)

Example 3 with Queues

use of reactor.util.concurrent.Queues in project reactor-core by reactor.

the class FluxPeekTest method asyncFusionAvailable.

@Test
public void asyncFusionAvailable() {
    AssertSubscriber<Integer> ts = AssertSubscriber.create();
    UnicastProcessor.create(Queues.<Integer>get(2).get()).doOnNext(v -> {
    }).subscribe(ts);
    Subscription s = ts.upstream();
    Assert.assertTrue("Non-fuseable upstream" + s, s instanceof Fuseable.QueueSubscription);
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) CoreMatchers(org.hamcrest.CoreMatchers) Arrays(java.util.Arrays) StepVerifier(reactor.test.StepVerifier) Scannable(reactor.core.Scannable) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) Test(org.junit.Test) FluxOperatorTest(reactor.test.publisher.FluxOperatorTest) Schedulers.parallel(reactor.core.scheduler.Schedulers.parallel) AtomicReference(java.util.concurrent.atomic.AtomicReference) ArrayList(java.util.ArrayList) Queues(reactor.util.concurrent.Queues) AtomicLong(java.util.concurrent.atomic.AtomicLong) List(java.util.List) CoreSubscriber(reactor.core.CoreSubscriber) Fuseable(reactor.core.Fuseable) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Subscription(org.reactivestreams.Subscription) AssertSubscriber(reactor.test.subscriber.AssertSubscriber) Thread.sleep(java.lang.Thread.sleep) Assert(org.junit.Assert) Exceptions(reactor.core.Exceptions) Subscription(org.reactivestreams.Subscription) Fuseable(reactor.core.Fuseable) Test(org.junit.Test) FluxOperatorTest(reactor.test.publisher.FluxOperatorTest)

Aggregations

Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)3 Test (org.junit.Test)3 CoreSubscriber (reactor.core.CoreSubscriber)3 StepVerifier (reactor.test.StepVerifier)3 AssertSubscriber (reactor.test.subscriber.AssertSubscriber)3 Queues (reactor.util.concurrent.Queues)3 Thread.sleep (java.lang.Thread.sleep)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Queue (java.util.Queue)2 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 AtomicLong (java.util.concurrent.atomic.AtomicLong)2 AtomicReference (java.util.concurrent.atomic.AtomicReference)2 Consumer (java.util.function.Consumer)2 CoreMatchers (org.hamcrest.CoreMatchers)2 Assert (org.junit.Assert)2 Subscription (org.reactivestreams.Subscription)2 Exceptions (reactor.core.Exceptions)2 Fuseable (reactor.core.Fuseable)2