public class NotifyBuilder extends Object
EventNotifier
notifications
about Exchange
being routed.
This builder can be used for testing purposes where you want to know when a test is supposed to be done.
The idea is that you can build an expression that explains when the test is done. For example when Camel
have finished routing 5 messages. You can then in your test await for this condition to occur.Constructor and Description |
---|
NotifyBuilder(CamelContext context)
Creates a new builder.
|
Modifier and Type | Method and Description |
---|---|
NotifyBuilder |
and()
Prepares to append an additional expression using the and operator.
|
NotifyBuilder |
create()
Creates the expression this builder should use for matching.
|
ExpressionClauseSupport<NotifyBuilder> |
filter()
Optionally a filter to only allow matching
Exchange to be used for matching. |
NotifyBuilder |
filter(Predicate predicate)
Optionally a filter to only allow matching
Exchange to be used for matching. |
NotifyBuilder |
from(String endpointUri)
Optionally a from endpoint which means that this expression should only be based
on
Exchange which is originated from the particular endpoint(s). |
NotifyBuilder |
fromRoute(String routeId)
Optionally a from route which means that this expression should only be based
on
Exchange which is originated from the particular route(s). |
boolean |
matches()
Does all the expression match?
This operation will return immediately which means it can be used for testing at this very moment.
|
boolean |
matches(long timeout,
TimeUnit timeUnit)
Does all the expression match?
This operation will wait until the match is true or otherwise a timeout occur
which means false will be returned.
|
boolean |
matchesMockWaitTime()
Does all the expressions match?
This operation will wait until the match is true or otherwise a timeout occur
which means false will be returned.
|
NotifyBuilder |
not()
Prepares to append an additional expression using the not operator.
|
NotifyBuilder |
or()
Prepares to append an additional expression using the or operator.
|
void |
reset()
Resets the notifier.
|
String |
toString() |
NotifyBuilder |
wereSentTo(String endpointUri)
Optionally a sent to endpoint which means that this expression should only be based
on
Exchange which has been sent to the given endpoint uri. |
NotifyBuilder |
whenAllDoneMatches(Predicate predicate)
|
NotifyBuilder |
whenAllReceivedMatches(Predicate predicate)
|
NotifyBuilder |
whenAnyDoneMatches(Predicate predicate)
|
NotifyBuilder |
whenAnyReceivedMatches(Predicate predicate)
|
NotifyBuilder |
whenBodiesDone(Object... bodies)
Sets a condition that the bodies is expected to be done in the order as well.
|
NotifyBuilder |
whenBodiesReceived(Object... bodies)
Sets a condition that the bodies is expected to be received in the order as well.
|
NotifyBuilder |
whenCompleted(int number)
Sets a condition when number of
Exchange has been completed. |
NotifyBuilder |
whenDone(int number)
Sets a condition when number of
Exchange is done being processed. |
NotifyBuilder |
whenDoneByIndex(int index)
Sets a condition when tne n'th (by index)
Exchange is done being processed. |
NotifyBuilder |
whenDoneNotSatisfied(MockEndpoint mock)
Sets a condition when the provided mock is not satisfied based on
Exchange
being sent to it when they are done. |
NotifyBuilder |
whenDoneSatisfied(MockEndpoint mock)
Sets a condition when the provided mock is satisfied based on
Exchange
being sent to it when they are done. |
NotifyBuilder |
whenExactBodiesDone(Object... bodies)
Sets a condition that the bodies is expected to be done in the order as well.
|
NotifyBuilder |
whenExactBodiesReceived(Object... bodies)
Sets a condition that the bodies is expected to be received in the order as well.
|
NotifyBuilder |
whenExactlyCompleted(int number)
Sets a condition when number of
Exchange has been completed. |
NotifyBuilder |
whenExactlyDone(int number)
Sets a condition when number of
Exchange is done being processed. |
NotifyBuilder |
whenExactlyFailed(int number)
Sets a condition when number of
Exchange has failed. |
NotifyBuilder |
whenFailed(int number)
Sets a condition when number of
Exchange has failed. |
NotifyBuilder |
whenReceived(int number)
Sets a condition when number of
Exchange has been received. |
NotifyBuilder |
whenReceivedNotSatisfied(MockEndpoint mock)
Sets a condition when the provided mock is not satisfied based on
Exchange
being sent to it when they are received. |
NotifyBuilder |
whenReceivedSatisfied(MockEndpoint mock)
Sets a condition when the provided mock is satisfied based on
Exchange
being sent to it when they are received. |
public NotifyBuilder(CamelContext context)
context
- the Camel contextpublic NotifyBuilder from(String endpointUri)
Exchange
which is originated from the particular endpoint(s).endpointUri
- uri of endpoint or pattern (see the EndpointHelper javadoc)EndpointHelper.matchEndpoint(org.apache.camel.CamelContext, String, String)
public NotifyBuilder fromRoute(String routeId)
Exchange
which is originated from the particular route(s).routeId
- id of route or pattern (see the EndpointHelper javadoc)EndpointHelper.matchEndpoint(org.apache.camel.CamelContext, String, String)
public NotifyBuilder filter(Predicate predicate)
Exchange
to be used for matching.predicate
- the predicate to use for the filterpublic ExpressionClauseSupport<NotifyBuilder> filter()
Exchange
to be used for matching.public NotifyBuilder wereSentTo(String endpointUri)
Exchange
which has been sent to the given endpoint uri.
Notice the Exchange
may have been sent to other endpoints as well. This condition will match
if the Exchange
has been sent at least once to the given endpoint.endpointUri
- uri of endpoint or pattern (see the EndpointHelper javadoc)EndpointHelper.matchEndpoint(org.apache.camel.CamelContext, String, String)
public NotifyBuilder whenReceived(int number)
Exchange
has been received.
The number matching is at least based which means that if more messages received
it will match also.number
- at least number of messagespublic NotifyBuilder whenDone(int number)
Exchange
is done being processed.
The number matching is at least based which means that if more messages received
it will match also.
The difference between done and completed is that done can also include failed
messages, where as completed is only successful processed messages.number
- at least number of messagespublic NotifyBuilder whenDoneByIndex(int index)
Exchange
is done being processed.
The difference between done and completed is that done can also include failed
messages, where as completed is only successful processed messages.index
- the message by index to be donepublic NotifyBuilder whenCompleted(int number)
Exchange
has been completed.
The number matching is at least based which means that if more messages received
it will match also.
The difference between done and completed is that done can also include failed
messages, where as completed is only successful processed messages.number
- at least number of messagespublic NotifyBuilder whenFailed(int number)
Exchange
has failed.
The number matching is at least based which means that if more messages received
it will match also.number
- at least number of messagespublic NotifyBuilder whenExactlyDone(int number)
Exchange
is done being processed.
messages, where as completed is only successful processed messages.number
- exactly number of messagespublic NotifyBuilder whenExactlyCompleted(int number)
Exchange
has been completed.
The difference between done and completed is that done can also include failed
messages, where as completed is only successful processed messages.number
- exactly number of messagespublic NotifyBuilder whenExactlyFailed(int number)
Exchange
has failed.number
- exactly number of messagespublic NotifyBuilder whenAnyReceivedMatches(Predicate predicate)
predicate
- the predicatepublic NotifyBuilder whenAnyDoneMatches(Predicate predicate)
predicate
- the predicatepublic NotifyBuilder whenAllReceivedMatches(Predicate predicate)
predicate
- the predicatepublic NotifyBuilder whenAllDoneMatches(Predicate predicate)
predicate
- the predicatepublic NotifyBuilder whenDoneSatisfied(MockEndpoint mock)
Exchange
being sent to it when they are done.
The idea is that you can use Mock for setting fine grained expectations
and then use that together with this builder. The mock provided does NOT
have to already exist in the route. You can just create a new pseudo mock
and this builder will send the done Exchange
to it. So its like
adding the mock to the end of your route(s).mock
- the mockpublic NotifyBuilder whenReceivedSatisfied(MockEndpoint mock)
Exchange
being sent to it when they are received.
The idea is that you can use Mock for setting fine grained expectations
and then use that together with this builder. The mock provided does NOT
have to already exist in the route. You can just create a new pseudo mock
and this builder will send the done Exchange
to it. So its like
adding the mock to the end of your route(s).mock
- the mockpublic NotifyBuilder whenReceivedNotSatisfied(MockEndpoint mock)
Exchange
being sent to it when they are received.
The idea is that you can use Mock for setting fine grained expectations
and then use that together with this builder. The mock provided does NOT
have to already exist in the route. You can just create a new pseudo mock
and this builder will send the done Exchange
to it. So its like
adding the mock to the end of your route(s).mock
- the mockpublic NotifyBuilder whenDoneNotSatisfied(MockEndpoint mock)
Exchange
being sent to it when they are done.
The idea is that you can use Mock for setting fine grained expectations
and then use that together with this builder. The mock provided does NOT
have to already exist in the route. You can just create a new pseudo mock
and this builder will send the done Exchange
to it. So its like
adding the mock to the end of your route(s).mock
- the mockpublic NotifyBuilder whenBodiesReceived(Object... bodies)
whenExactBodiesReceived(Object...)
bodies
- the expected bodieswhenExactBodiesReceived(Object...)
public NotifyBuilder whenBodiesDone(Object... bodies)
whenExactBodiesDone(Object...)
bodies
- the expected bodieswhenExactBodiesDone(Object...)
public NotifyBuilder whenExactBodiesReceived(Object... bodies)
bodies
- the expected bodieswhenBodiesReceived(Object...)
public NotifyBuilder whenExactBodiesDone(Object... bodies)
bodies
- the expected bodieswhenExactBodiesDone(Object...)
public NotifyBuilder and()
public NotifyBuilder or()
public NotifyBuilder not()
public NotifyBuilder create()
public boolean matches()
public boolean matches(long timeout, TimeUnit timeUnit)
timeout
- the timeout valuetimeUnit
- the time unitpublic boolean matchesMockWaitTime()
public void reset()
Apache Camel