public class GraphQLTestSubscription
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
PAYLOAD |
| Constructor and Description |
|---|
GraphQLTestSubscription() |
| Modifier and Type | Method and Description |
|---|---|
java.util.List<GraphQLResponse> |
awaitAndGetAllResponses(java.time.Duration timeToWait)
Waits a specified amount time and returns all responses received during that time.
|
java.util.List<GraphQLResponse> |
awaitAndGetAllResponses(java.time.Duration timeToWait,
boolean stopAfter)
Waits a specified amount time and returns all responses received during that time.
|
java.util.List<GraphQLResponse> |
awaitAndGetAllResponses(int timeToWait)
Deprecated.
since 12.0.0. Use
awaitAndGetAllResponses(Duration) instead. |
java.util.List<GraphQLResponse> |
awaitAndGetAllResponses(int timeToWait,
boolean stopAfter)
Deprecated.
since 12.0.0. Use
awaitAndGetAllResponses(Duration,boolean) instead. |
GraphQLResponse |
awaitAndGetNextResponse(java.time.Duration timeout)
Awaits and returns the next response received from the subscription.
|
GraphQLResponse |
awaitAndGetNextResponse(java.time.Duration timeout,
boolean stopAfter)
Awaits and returns the next response received from the subscription.
|
GraphQLResponse |
awaitAndGetNextResponse(int timeout)
Deprecated.
since 12.0.0. Use
awaitAndGetNextResponse(Duration) instead. |
GraphQLResponse |
awaitAndGetNextResponse(int timeout,
boolean stopAfter)
Deprecated.
since 12.0.0. Use
awaitAndGetNextResponse(Duration,boolean) instead. |
java.util.List<GraphQLResponse> |
awaitAndGetNextResponses(java.time.Duration timeout,
int numExpectedResponses)
Awaits and returns the specified number of responses.
|
java.util.List<GraphQLResponse> |
awaitAndGetNextResponses(java.time.Duration timeout,
int numExpectedResponses,
boolean stopAfter)
Awaits and returns the specified number of responses.
|
java.util.List<GraphQLResponse> |
awaitAndGetNextResponses(int timeout,
int numExpectedResponses)
Deprecated.
since 12.0.0. Use
awaitAndGetNextResponses(Duration,int) instead. |
java.util.List<GraphQLResponse> |
awaitAndGetNextResponses(int timeout,
int numExpectedResponses,
boolean stopAfter)
Deprecated.
since 12.0.0. Use
awaitAndGetNextResponses(Duration,int,boolean) instead. |
java.util.List<GraphQLResponse> |
getRemainingResponses()
Returns the remaining responses that were not returned so far.
|
GraphQLTestSubscription |
init()
Sends the "connection_init" message to the GraphQL server without a payload.
|
GraphQLTestSubscription |
init(java.lang.Object payload)
Sends the "connection_init" message to the GraphQL server.
|
boolean |
isAcknowledged() |
boolean |
isCompleted() |
boolean |
isInitialized() |
boolean |
isStarted() |
boolean |
isStopped() |
void |
reset()
Stops (if needed) and resets this instance.
|
GraphQLTestSubscription |
start(@NonNull java.lang.String graphQLResource)
Sends the "start" message to the GraphQL server.
|
GraphQLTestSubscription |
start(@NonNull java.lang.String graphQLResource,
java.lang.Object variables)
Sends the "start" message to the GraphQL Subscription.
|
GraphQLTestSubscription |
stop()
Sends the "stop" message to the server.
|
GraphQLTestSubscription |
waitAndExpectNoResponse(java.time.Duration timeToWait)
Waits a specified amount of time and asserts that no responses were received during that time.
|
GraphQLTestSubscription |
waitAndExpectNoResponse(java.time.Duration timeToWait,
boolean stopAfter)
Waits a specified amount of time and asserts that no responses were received during that time.
|
GraphQLTestSubscription |
waitAndExpectNoResponse(int timeToWait)
Deprecated.
since 12.0.0. Use
waitAndExpectNoResponse(Duration) instead. |
GraphQLTestSubscription |
waitAndExpectNoResponse(int timeToWait,
boolean stopAfter)
Deprecated.
since 12.0.0. Use
waitAndExpectNoResponse(Duration,boolean) instead. |
public static final java.lang.String PAYLOAD
public boolean isInitialized()
public boolean isAcknowledged()
public boolean isStarted()
public boolean isStopped()
public boolean isCompleted()
public GraphQLTestSubscription init()
public GraphQLTestSubscription init(@Nullable java.lang.Object payload)
payload - The payload of the connection_init message. May be null, if not needed.public GraphQLTestSubscription start(@NonNull @NonNull java.lang.String graphQLResource)
graphQLResource - the GraphQL resource, which contains the query for the subscription
start payload. The start message will be sent without variables.public GraphQLTestSubscription start(@NonNull @NonNull java.lang.String graphQLResource, @Nullable java.lang.Object variables)
graphQLResource - the GraphQL resource, which contains the query for the subscription
start payload.variables - the variables needed for the query to be evaluated.public GraphQLTestSubscription stop()
public void reset()
@Deprecated public GraphQLResponse awaitAndGetNextResponse(int timeout)
awaitAndGetNextResponse(Duration) instead.timeout - timeout in milliseconds. Test will fail if no message received from the
subscription until the timeout expires.awaitAndGetNextResponse(Duration)public GraphQLResponse awaitAndGetNextResponse(java.time.Duration timeout)
timeout - Timeout duration. Test will fail if no message received from the
subscription until the timeout expires.@Deprecated public GraphQLResponse awaitAndGetNextResponse(int timeout, boolean stopAfter)
awaitAndGetNextResponse(Duration,boolean) instead.timeout - timeout in milliseconds. Test will fail if no message received from the
subscription until the timeout expires.stopAfter - if true, the subscription will be stopped after the message was received (or
timeout).awaitAndGetNextResponse(Duration,boolean)public GraphQLResponse awaitAndGetNextResponse(java.time.Duration timeout, boolean stopAfter)
timeout - Timeout duration. Test will fail if no message received from the
subscription until the timeout expires.stopAfter - if true, the subscription will be stopped after the message was received (or
timeout).@Deprecated public java.util.List<GraphQLResponse> awaitAndGetAllResponses(int timeToWait)
awaitAndGetAllResponses(Duration) instead.timeToWait - the time to wait, in millisecondsawaitAndGetAllResponses(Duration)public java.util.List<GraphQLResponse> awaitAndGetAllResponses(java.time.Duration timeToWait)
timeToWait - the time to wait.@Deprecated public java.util.List<GraphQLResponse> awaitAndGetAllResponses(int timeToWait, boolean stopAfter)
awaitAndGetAllResponses(Duration,boolean) instead.timeToWait - the time to wait, in millisecondsstopAfter - if true, the subscription will be stopped after the time elapsed.awaitAndGetAllResponses(Duration,boolean)public java.util.List<GraphQLResponse> awaitAndGetAllResponses(java.time.Duration timeToWait, boolean stopAfter)
timeToWait - the time to waitstopAfter - if true, the subscription will be stopped after the time elapsed.@Deprecated public java.util.List<GraphQLResponse> awaitAndGetNextResponses(int timeout, int numExpectedResponses)
awaitAndGetNextResponses(Duration,int) instead.timeout - timeout in milliseconds. Test will fail if the expected number of responses is
not received.numExpectedResponses - the number of expected responses. If negative, the method will wait
the timeout and return all responses received during that time. In this case, no assertion
is made regarding the number of responses, and the returned list may be empty. If zero, it
is expected that no responses are sent during the timeout period.getRemainingResponses() can be used to retrieved them.awaitAndGetNextResponses(Duration,int)public java.util.List<GraphQLResponse> awaitAndGetNextResponses(java.time.Duration timeout, int numExpectedResponses)
timeout - timeout duration. Test will fail if the expected number of responses is
not received.numExpectedResponses - the number of expected responses. If negative, the method will wait
the timeout and return all responses received during that time. In this case, no assertion
is made regarding the number of responses, and the returned list may be empty. If zero, it
is expected that no responses are sent during the timeout period.getRemainingResponses() can be used to retrieved them.@Deprecated public java.util.List<GraphQLResponse> awaitAndGetNextResponses(int timeout, int numExpectedResponses, boolean stopAfter)
awaitAndGetNextResponses(Duration,int,boolean) instead.timeout - timeout in milliseconds. Test will fail if the expected number of responses is
not received.numExpectedResponses - the number of expected responses. If negative, the method will wait
the timeout and return all responses received during that time. In this case, no assertion
is made regarding the number of responses, and the returned list may be empty. If zero, it
is expected that no responses are sent during the timeout period.stopAfter - if true, the subscription will be stopped after the messages were received (or
timeout).getRemainingResponses() can be used to retrieved them.awaitAndGetNextResponses(Duration,int,boolean)public java.util.List<GraphQLResponse> awaitAndGetNextResponses(java.time.Duration timeout, int numExpectedResponses, boolean stopAfter)
timeout - timeout duration. Test will fail if the expected number of responses is
not received.numExpectedResponses - the number of expected responses. If negative, the method will wait
the timeout and return all responses received during that time. In this case, no assertion
is made regarding the number of responses, and the returned list may be empty. If zero, it
is expected that no responses are sent during the timeout period.stopAfter - if true, the subscription will be stopped after the messages were received (or
timeout).getRemainingResponses() can be used to retrieved them.@Deprecated public GraphQLTestSubscription waitAndExpectNoResponse(int timeToWait, boolean stopAfter)
waitAndExpectNoResponse(Duration,boolean) instead.timeToWait - time to wait, in milliseconds.stopAfter - if true, the subscription will be stopped afterwards.waitAndExpectNoResponse(Duration,boolean)public GraphQLTestSubscription waitAndExpectNoResponse(java.time.Duration timeToWait, boolean stopAfter)
timeToWait - time to wait.stopAfter - if true, the subscription will be stopped afterwards.@Deprecated public GraphQLTestSubscription waitAndExpectNoResponse(int timeToWait)
waitAndExpectNoResponse(Duration) instead.timeToWait - time to wait, in milliseconds.waitAndExpectNoResponse(Duration)public GraphQLTestSubscription waitAndExpectNoResponse(java.time.Duration timeToWait)
timeToWait - time to wait.public java.util.List<GraphQLResponse> getRemainingResponses()