Package org.reactivestreams.tck
Class TestEnvironment.ManualPublisher<T>
- java.lang.Object
-
- org.reactivestreams.tck.TestEnvironment.ManualPublisher<T>
-
- All Implemented Interfaces:
Publisher<T>
- Direct Known Subclasses:
IdentityProcessorVerification.TestSetup,SubscriberBlackboxVerification.BlackboxTestStage,SubscriberWhiteboxVerification.WhiteboxTestStage
- Enclosing class:
- TestEnvironment
public static class TestEnvironment.ManualPublisher<T> extends java.lang.Object implements Publisher<T>
-
-
Field Summary
Fields Modifier and Type Field Description protected TestEnvironment.Latchcancelledprotected TestEnvironmentenvprotected longpendingDemandprotected TestEnvironment.Receptacle<java.lang.Long>requestsprotected TestEnvironment.Promise<Subscriber<? super T>>subscriber
-
Constructor Summary
Constructors Constructor Description ManualPublisher(TestEnvironment env)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexpectCancelling()voidexpectCancelling(long timeoutMillis)voidexpectExactRequest(long expected)voidexpectExactRequest(long expected, long timeoutMillis)voidexpectNoRequest()voidexpectNoRequest(long timeoutMillis)longexpectRequest()longexpectRequest(long timeoutMillis)longexpectRequest(long timeoutMillis, java.lang.String errorMessageAddendum)booleanisCancelled()voidsendCompletion()voidsendError(java.lang.Throwable cause)voidsendNext(T element)voidsubscribe(Subscriber<? super T> s)RequestPublisherto start streaming data.
-
-
-
Field Detail
-
env
protected final TestEnvironment env
-
pendingDemand
protected long pendingDemand
-
subscriber
protected TestEnvironment.Promise<Subscriber<? super T>> subscriber
-
requests
protected final TestEnvironment.Receptacle<java.lang.Long> requests
-
cancelled
protected final TestEnvironment.Latch cancelled
-
-
Constructor Detail
-
ManualPublisher
public ManualPublisher(TestEnvironment env)
-
-
Method Detail
-
subscribe
public void subscribe(Subscriber<? super T> s)
Description copied from interface:PublisherRequestPublisherto start streaming data.This is a "factory method" and can be called multiple times, each time starting a new
Subscription.Each
Subscriptionwill work for only a singleSubscriber.A
Subscribershould only subscribe once to a singlePublisher.If the
Publisherrejects the subscription attempt or otherwise fails it will signal the error viaSubscriber.onError(Throwable).- Specified by:
subscribein interfacePublisher<T>- Parameters:
s- theSubscriberthat will consume signals from thisPublisher
-
sendNext
public void sendNext(T element)
-
sendCompletion
public void sendCompletion()
-
sendError
public void sendError(java.lang.Throwable cause)
-
expectRequest
public long expectRequest() throws java.lang.InterruptedException- Throws:
java.lang.InterruptedException
-
expectRequest
public long expectRequest(long timeoutMillis) throws java.lang.InterruptedException- Throws:
java.lang.InterruptedException
-
expectRequest
public long expectRequest(long timeoutMillis, java.lang.String errorMessageAddendum) throws java.lang.InterruptedException- Throws:
java.lang.InterruptedException
-
expectExactRequest
public void expectExactRequest(long expected) throws java.lang.InterruptedException- Throws:
java.lang.InterruptedException
-
expectExactRequest
public void expectExactRequest(long expected, long timeoutMillis) throws java.lang.InterruptedException- Throws:
java.lang.InterruptedException
-
expectNoRequest
public void expectNoRequest() throws java.lang.InterruptedException- Throws:
java.lang.InterruptedException
-
expectNoRequest
public void expectNoRequest(long timeoutMillis) throws java.lang.InterruptedException- Throws:
java.lang.InterruptedException
-
expectCancelling
public void expectCancelling() throws java.lang.InterruptedException- Throws:
java.lang.InterruptedException
-
expectCancelling
public void expectCancelling(long timeoutMillis) throws java.lang.InterruptedException- Throws:
java.lang.InterruptedException
-
isCancelled
public boolean isCancelled() throws java.lang.InterruptedException- Throws:
java.lang.InterruptedException
-
-