test endpoint

test endpoint

A Test Endpoint is a Mock Endpoint for testing but it will pull all messages from the nested endpoint and use those as expected message body assertions. @version

Name Type Description
assertPeriod long Sets a grace period after which the mock endpoint will re-assert to ensure the preliminary assertion is still valid.

This is used for example to assert that exactly a number of messages arrives. For example if {@link #expectedMessageCount(int)} was set to 5, then the assertion is satisfied when 5 or more message arrives. To ensure that exactly 5 messages arrives, then you would need to wait a little period to ensure no further message arrives. This is what you can use this {@link #setAssertPeriod(long)} method for.

By default this period is disabled. @param period grace period in millis

exchangePattern org.apache.camel.ExchangePattern Sets the default exchange pattern to use for {@link #createExchange()}. The default value is {@link ExchangePattern#InOnly}
expectedCount int
expectedMinimumCount int
resultMinimumWaitTime long
resultWaitTime long Sets the maximum amount of time (in millis) the {@link #assertIsSatisfied()} will wait on a latch until it is satisfied
retainFirst int Specifies to only retain the first n'th number of received {@link Exchange}s.

This is used when testing with big data, to reduce memory consumption by not storing copies of every {@link Exchange} this mock endpoint receives.

Important: When using this limitation, then the {@link #getReceivedCounter()} will still return the actual number of received {@link Exchange}s. For example if we have received 5000 {@link Exchange}s, and have configured to only retain the first 10 {@link Exchange}s, then the {@link #getReceivedCounter()} will still return 5000 but there is only the first 10 {@link Exchange}s in the {@link #getExchanges()} and {@link #getReceivedExchanges()} methods.

When using this method, then some of the other expectation methods is not supported, for example the {@link #expectedBodiesReceived(Object...)} sets a expectation on the first number of bodies received.

You can configure both {@link #setRetainFirst(int)} and {@link #setRetainLast(int)} methods, to limit both the first and last received. @param retainFirst to limit and only keep the first n'th received {@link Exchange}s, use 0 to not retain any messages, or -1 to retain all. @see #setRetainLast(int)

retainLast int Specifies to only retain the last n'th number of received {@link Exchange}s.

This is used when testing with big data, to reduce memory consumption by not storing copies of every {@link Exchange} this mock endpoint receives.

Important: When using this limitation, then the {@link #getReceivedCounter()} will still return the actual number of received {@link Exchange}s. For example if we have received 5000 {@link Exchange}s, and have configured to only retain the last 20 {@link Exchange}s, then the {@link #getReceivedCounter()} will still return 5000 but there is only the last 20 {@link Exchange}s in the {@link #getExchanges()} and {@link #getReceivedExchanges()} methods.

When using this method, then some of the other expectation methods is not supported, for example the {@link #expectedBodiesReceived(Object...)} sets a expectation on the first number of bodies received.

You can configure both {@link #setRetainFirst(int)} and {@link #setRetainLast(int)} methods, to limit both the first and last received. @param retainLast to limit and only keep the last n'th received {@link Exchange}s, use 0 to not retain any messages, or -1 to retain all. @see #setRetainFirst(int)

sleepForEmptyTest long Allows a sleep to be specified to wait to check that this endpoint really is empty when {@link #expectedMessageCount(int)} is called with zero @param sleepForEmptyTest the milliseconds to sleep for to determine that this endpoint really is empty
synchronous boolean Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). @param synchronous true to enforce synchronous processing
timeout long