Search in sources :

Example 1 with QueueSubscription

use of reactor.core.Fuseable.QueueSubscription 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();
    assertThat(s).as("check QueueSubscription").isInstanceOf(QueueSubscription.class);
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) PeekConditionalSubscriber(reactor.core.publisher.FluxPeekFuseable.PeekConditionalSubscriber) StepVerifier(reactor.test.StepVerifier) Scannable(reactor.core.Scannable) TestLogger(reactor.test.util.TestLogger) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) AtomicReference(java.util.concurrent.atomic.AtomicReference) Nullable(reactor.util.annotation.Nullable) ArrayList(java.util.ArrayList) Queues(reactor.util.concurrent.Queues) CoreSubscriber(reactor.core.CoreSubscriber) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) QueueSubscription(reactor.core.Fuseable.QueueSubscription) Assertions.assertThatExceptionOfType(org.assertj.core.api.Assertions.assertThatExceptionOfType) Schedulers(reactor.core.scheduler.Schedulers) Thread.sleep(java.lang.Thread.sleep) MockUtils(reactor.test.MockUtils) PeekFuseableSubscriber(reactor.core.publisher.FluxPeekFuseable.PeekFuseableSubscriber) Collection(java.util.Collection) Context(reactor.util.context.Context) Schedulers.parallel(reactor.core.scheduler.Schedulers.parallel) LongConsumer(java.util.function.LongConsumer) Consumer(java.util.function.Consumer) Test(org.junit.jupiter.api.Test) AtomicLong(java.util.concurrent.atomic.AtomicLong) Mockito(org.mockito.Mockito) List(java.util.List) Fuseable(reactor.core.Fuseable) Assertions.fail(org.assertj.core.api.Assertions.fail) LoggerUtils(reactor.test.util.LoggerUtils) Subscription(org.reactivestreams.Subscription) AssertSubscriber(reactor.test.subscriber.AssertSubscriber) Queue(java.util.Queue) Exceptions(reactor.core.Exceptions) Collections(java.util.Collections) PeekFuseableConditionalSubscriber(reactor.core.publisher.FluxPeekFuseable.PeekFuseableConditionalSubscriber) QueueSubscription(reactor.core.Fuseable.QueueSubscription) Subscription(org.reactivestreams.Subscription) Test(org.junit.jupiter.api.Test)

Example 2 with QueueSubscription

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

the class FluxPeekFuseableTest method asyncFusionAvailable.

@Test
public void asyncFusionAvailable() {
    AssertSubscriber<Integer> ts = AssertSubscriber.create();
    Sinks.unsafe().many().unicast().onBackpressureBuffer(Queues.<Integer>get(2).get()).asFlux().doOnNext(v -> {
    }).subscribe(ts);
    Subscription s = ts.upstream();
    assertThat(s).as("check QueueSubscription").isInstanceOf(QueueSubscription.class);
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) PeekConditionalSubscriber(reactor.core.publisher.FluxPeekFuseable.PeekConditionalSubscriber) StepVerifier(reactor.test.StepVerifier) Scannable(reactor.core.Scannable) TestLogger(reactor.test.util.TestLogger) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) AtomicReference(java.util.concurrent.atomic.AtomicReference) Nullable(reactor.util.annotation.Nullable) ArrayList(java.util.ArrayList) Queues(reactor.util.concurrent.Queues) CoreSubscriber(reactor.core.CoreSubscriber) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) QueueSubscription(reactor.core.Fuseable.QueueSubscription) Assertions.assertThatExceptionOfType(org.assertj.core.api.Assertions.assertThatExceptionOfType) Schedulers(reactor.core.scheduler.Schedulers) Thread.sleep(java.lang.Thread.sleep) MockUtils(reactor.test.MockUtils) PeekFuseableSubscriber(reactor.core.publisher.FluxPeekFuseable.PeekFuseableSubscriber) Collection(java.util.Collection) Context(reactor.util.context.Context) Schedulers.parallel(reactor.core.scheduler.Schedulers.parallel) LongConsumer(java.util.function.LongConsumer) Consumer(java.util.function.Consumer) Test(org.junit.jupiter.api.Test) AtomicLong(java.util.concurrent.atomic.AtomicLong) Mockito(org.mockito.Mockito) List(java.util.List) Fuseable(reactor.core.Fuseable) Assertions.fail(org.assertj.core.api.Assertions.fail) LoggerUtils(reactor.test.util.LoggerUtils) Subscription(org.reactivestreams.Subscription) AssertSubscriber(reactor.test.subscriber.AssertSubscriber) Queue(java.util.Queue) Exceptions(reactor.core.Exceptions) Collections(java.util.Collections) PeekFuseableConditionalSubscriber(reactor.core.publisher.FluxPeekFuseable.PeekFuseableConditionalSubscriber) QueueSubscription(reactor.core.Fuseable.QueueSubscription) Subscription(org.reactivestreams.Subscription) Test(org.junit.jupiter.api.Test)

Example 3 with QueueSubscription

use of reactor.core.Fuseable.QueueSubscription 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();
    assertThat(s).as("check QueueSubscription").isInstanceOf(QueueSubscription.class);
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Arrays(java.util.Arrays) StepVerifier(reactor.test.StepVerifier) Scannable(reactor.core.Scannable) TestLogger(reactor.test.util.TestLogger) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) FluxOperatorTest(reactor.test.publisher.FluxOperatorTest) 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) QueueSubscription(reactor.core.Fuseable.QueueSubscription) Assertions.assertThatExceptionOfType(org.assertj.core.api.Assertions.assertThatExceptionOfType) Thread.sleep(java.lang.Thread.sleep) Schedulers.parallel(reactor.core.scheduler.Schedulers.parallel) Test(org.junit.jupiter.api.Test) AtomicLong(java.util.concurrent.atomic.AtomicLong) List(java.util.List) Fuseable(reactor.core.Fuseable) Assertions.fail(org.assertj.core.api.Assertions.fail) LoggerUtils(reactor.test.util.LoggerUtils) Subscription(org.reactivestreams.Subscription) AssertSubscriber(reactor.test.subscriber.AssertSubscriber) Exceptions(reactor.core.Exceptions) QueueSubscription(reactor.core.Fuseable.QueueSubscription) Subscription(org.reactivestreams.Subscription) FluxOperatorTest(reactor.test.publisher.FluxOperatorTest) Test(org.junit.jupiter.api.Test)

Example 4 with QueueSubscription

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

the class FluxPeekTest method asyncFusionAvailable.

@Test
public void asyncFusionAvailable() {
    AssertSubscriber<Integer> ts = AssertSubscriber.create();
    Sinks.unsafe().many().unicast().onBackpressureBuffer(Queues.<Integer>get(2).get()).asFlux().doOnNext(v -> {
    }).subscribe(ts);
    Subscription s = ts.upstream();
    assertThat(s).as("check QueueSubscription").isInstanceOf(QueueSubscription.class);
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Arrays(java.util.Arrays) StepVerifier(reactor.test.StepVerifier) Scannable(reactor.core.Scannable) TestLogger(reactor.test.util.TestLogger) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) FluxOperatorTest(reactor.test.publisher.FluxOperatorTest) 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) QueueSubscription(reactor.core.Fuseable.QueueSubscription) Assertions.assertThatExceptionOfType(org.assertj.core.api.Assertions.assertThatExceptionOfType) Thread.sleep(java.lang.Thread.sleep) Schedulers.parallel(reactor.core.scheduler.Schedulers.parallel) Test(org.junit.jupiter.api.Test) AtomicLong(java.util.concurrent.atomic.AtomicLong) List(java.util.List) Fuseable(reactor.core.Fuseable) Assertions.fail(org.assertj.core.api.Assertions.fail) LoggerUtils(reactor.test.util.LoggerUtils) Subscription(org.reactivestreams.Subscription) AssertSubscriber(reactor.test.subscriber.AssertSubscriber) Exceptions(reactor.core.Exceptions) QueueSubscription(reactor.core.Fuseable.QueueSubscription) Subscription(org.reactivestreams.Subscription) FluxOperatorTest(reactor.test.publisher.FluxOperatorTest) Test(org.junit.jupiter.api.Test)

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 Assertions.assertThatExceptionOfType (org.assertj.core.api.Assertions.assertThatExceptionOfType)4 Assertions.fail (org.assertj.core.api.Assertions.fail)4 Test (org.junit.jupiter.api.Test)4 Subscription (org.reactivestreams.Subscription)4 CoreSubscriber (reactor.core.CoreSubscriber)4 Exceptions (reactor.core.Exceptions)4 Fuseable (reactor.core.Fuseable)4 QueueSubscription (reactor.core.Fuseable.QueueSubscription)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