public static class TestEnvironment.ManualPublisher<T> extends java.lang.Object implements Publisher<T>
Modifier and Type | Field and Description |
---|---|
protected TestEnvironment.Latch |
cancelled |
protected TestEnvironment |
env |
protected long |
pendingDemand |
protected TestEnvironment.Receptacle<java.lang.Long> |
requests |
protected TestEnvironment.Promise<Subscriber<? super T>> |
subscriber |
Constructor and Description |
---|
ManualPublisher(TestEnvironment env) |
Modifier and Type | Method and Description |
---|---|
void |
expectCancelling() |
void |
expectCancelling(long timeoutMillis) |
void |
expectExactRequest(long expected) |
void |
expectExactRequest(long expected,
long timeoutMillis) |
void |
expectNoRequest() |
void |
expectNoRequest(long timeoutMillis) |
long |
expectRequest() |
long |
expectRequest(long timeoutMillis) |
void |
sendCompletion() |
void |
sendError(java.lang.Throwable cause) |
void |
sendNext(T element) |
void |
subscribe(Subscriber<? super T> s)
Request
Publisher to start streaming data. |
protected final TestEnvironment env
protected long pendingDemand
protected TestEnvironment.Promise<Subscriber<? super T>> subscriber
protected final TestEnvironment.Receptacle<java.lang.Long> requests
protected final TestEnvironment.Latch cancelled
public ManualPublisher(TestEnvironment env)
public void subscribe(Subscriber<? super T> s)
Publisher
Publisher
to start streaming data.
This is a "factory method" and can be called multiple times, each time starting a new Subscription
.
Each Subscription
will work for only a single Subscriber
.
A Subscriber
should only subscribe once to a single Publisher
.
If the Publisher
rejects the subscription attempt or otherwise fails it will
signal the error via Subscriber.onError(java.lang.Throwable)
.
subscribe
in interface Publisher<T>
s
- the Subscriber
that will consume signals from this Publisher
public void sendNext(T element)
public void sendCompletion()
public void sendError(java.lang.Throwable cause)
public long expectRequest() throws java.lang.InterruptedException
java.lang.InterruptedException
public long expectRequest(long timeoutMillis) throws java.lang.InterruptedException
java.lang.InterruptedException
public void expectExactRequest(long expected) throws java.lang.InterruptedException
java.lang.InterruptedException
public void expectExactRequest(long expected, long timeoutMillis) throws java.lang.InterruptedException
java.lang.InterruptedException
public void expectNoRequest() throws java.lang.InterruptedException
java.lang.InterruptedException
public void expectNoRequest(long timeoutMillis) throws java.lang.InterruptedException
java.lang.InterruptedException
public void expectCancelling() throws java.lang.InterruptedException
java.lang.InterruptedException
public void expectCancelling(long timeoutMillis) throws java.lang.InterruptedException
java.lang.InterruptedException