Test Component
Include Page |
---|
| Testing Summary Include |
---|
| Testing Summary Include |
---|
|
The test component extends the Mock component to support pulling messages from another endpoint on startup to set the expected message bodies on the underlying Mock endpoint. That is, you use the test endpoint in a route and messages arriving on it will be implicitly compared to some expected messages extracted from some other location.
...
Maven users will need to add the following dependency to their pom.xml
for this component when using Camel 2.8 or older:
Code Block |
---|
|
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring</artifactId>
<version>x.x.x</version>
<!-- use the same version as your Camel core version -->
</dependency>
|
From Camel 2.9 onwards the Test component is provided directly in the camel-core.
URI format
Code Block |
---|
test:expectedMessagesEndpointUri
|
...
Div |
---|
class | confluenceTableSmall |
---|
|
Name | Default Value | Description |
---|
timeout
| 2000
| Camel 2.12: The timeout to use when polling for message bodies from the URI. | anyOrder | false | Camel 2.17: Whether the expected messages should arrive in the same order or can be in any order. | split | false | Camel 2.17: If enabled the the messages loaded from the test endpoint will be split using \n\r delimiters (new lines) so each line is an expected message. For example to use a file endpoint to load a file where each line is an expected message. |
|
Example
For example, you could write a test case as follows:
Code Block |
---|
from("seda:someEndpoint").
to("test:file://data/expectedOutput?noop=true");
|
...
To see how you can set other expectations on the test endpoint, see the Mock component.
Include Page |
---|
| Endpoint See Also |
---|
| Endpoint See Also |
---|
|