= DataSet Test Component
:doctitle: DataSet Test
:shortname: dataset-test
:artifactid: camel-dataset
:description: Extends the mock component by pulling messages from another endpoint on startup to set the expected message bodies.
:since: 1.3
:supportlevel: Stable
:tabs-sync-option:
:component-header: Only producer is supported
:core:
//Manually maintained attributes
:camel-spring-boot-name: dataset

*Since Camel {since}*

*{component-header}*

Testing of distributed and asynchronous processing is
notoriously difficult. The xref:mock-component.adoc[Mock],
xref:dataset-component.adoc[DataSet], and xref:dataset-test-component.adoc[DataSet Test]
endpoints work great with the
Camel Testing Framework to simplify your unit and
integration testing using
xref:eips:enterprise-integration-patterns.adoc[Enterprise Integration
Patterns] and Camel's large range of Components
together with the powerful Bean Integration.

The *dataset-test* component extends the xref:mock-component.adoc[Mock] component to
support pulling messages from another endpoint on startup to set the
expected message bodies on the underlying xref:mock-component.adoc[Mock] endpoint.

That is, you use the dataset test endpoint in a route and messages arriving at
it will be implicitly compared to some expected messages extracted from
some other location.

So you can use, for example, an expected set of message bodies as files.
This will then set up a properly configured xref:mock-component.adoc[Mock]
endpoint, which is only valid if the received messages match the number
of expected messages and their message payloads are equal.

== URI format

----
dataset-test:expectedMessagesEndpointUri
----

Where *expectedMessagesEndpointUri* refers to some other
Component URI that the expected message bodies are
pulled from before starting the test.


// component-configure options: START

// component-configure options: END

// component options: START
include::partial$component-configure-options.adoc[]
include::partial$component-endpoint-options.adoc[]
// component options: END

// endpoint options: START

// endpoint options: END


== Example

For example, you could write a test case as follows:

[source,java]
----
from("seda:someEndpoint").
  to("dataset-test:file://data/expectedOutput?noop=true");
----

If your test then invokes the
https://www.javadoc.io/doc/org.apache.camel/camel-mock/current/org/apache/camel/component/mock/MockEndpoint.html#assertIsSatisfied-org.apache.camel.CamelContext-[MockEndpoint.assertIsSatisfied(camelContext)
method], your test case will perform the necessary assertions.

To see how you can set other expectations on the test endpoint, see the
xref:mock-component.adoc[Mock] component.



include::spring-boot:partial$starter.adoc[]
