Search in sources :

Example 1 with Fuseable

use of reactor.core.Fuseable in project reactor-core by reactor.

the class FluxPeekFuseableTest method syncFusionAvailable.

@Test
public void syncFusionAvailable() {
    AssertSubscriber<Integer> ts = AssertSubscriber.create();
    Flux.range(1, 2).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 2 with Fuseable

use of reactor.core.Fuseable 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 Fuseable

use of reactor.core.Fuseable in project reactor-core by reactor.

the class FluxPeekTest method syncFusionAvailable.

@Test
public void syncFusionAvailable() {
    AssertSubscriber<Integer> ts = AssertSubscriber.create();
    Flux.range(1, 2).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)

Example 4 with Fuseable

use of reactor.core.Fuseable 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

Thread.sleep (java.lang.Thread.sleep)4 ArrayList (java.util.ArrayList)4 List (java.util.List)4 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)4 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)4 AtomicLong (java.util.concurrent.atomic.AtomicLong)4 AtomicReference (java.util.concurrent.atomic.AtomicReference)4 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)4 CoreMatchers (org.hamcrest.CoreMatchers)4 Assert (org.junit.Assert)4 Test (org.junit.Test)4 Subscription (org.reactivestreams.Subscription)4 CoreSubscriber (reactor.core.CoreSubscriber)4 Exceptions (reactor.core.Exceptions)4 Fuseable (reactor.core.Fuseable)4 Scannable (reactor.core.Scannable)4 Schedulers.parallel (reactor.core.scheduler.Schedulers.parallel)4 StepVerifier (reactor.test.StepVerifier)4 AssertSubscriber (reactor.test.subscriber.AssertSubscriber)4 Queues (reactor.util.concurrent.Queues)4