...
DataSet
...
Component
Include Page | ||||
---|---|---|---|---|
|
The DataSet component provides a mechanism to easily perform load & soak testing of your system. It works by allowing you to create DataSet instances both as a source of messages and as a way to assert that the data set is received.
Camel will use the throughput logger when sending dataset's.
URI format
Code Block |
---|
{include:Testing Summary Include} The DataSet component (available since 1.3.0) provides a mechanism to easily perform load & soak testing of your system. It works by allowing you to create [DataSet instances|http://camel.apache.org/maven/camel-core/apidocs/org/apache/camel/component/dataset/DataSet.html] both as a source of messages and as a way to assert that the data set is received. Camel will use the [throughput logger|Log] when sending dataset's. h3. URI format {code} dataset:name[?options] {code} Where *name* is used to find the [DataSet instance|http://camel.apache.org/maven/camel-core/apidocs/org/apache/camel/component/dataset/DataSet.html] in the [Registry] Camel ships with a support implementation of {{ |
Where name
is used to find the DataSet instance in the Registry
Camel ships with a support implementation of org.apache.camel.component.dataset.DataSet
...
,
...
the
...
org.apache.camel.component.dataset.DataSetSupport
...
class,
...
that
...
can
...
be
...
used
...
as
...
a
...
base
...
for
...
implementing
...
your
...
own
...
DataSet
.
...
Camel
...
also
...
ships
...
with some implementations that can be used for testing:
org.apache.camel.component.dataset.SimpleDataSet
...
org.apache.camel.component.dataset.ListDataSet
org.apache.camel.component.dataset.FileDataSet
all of which extend DataSetSupport
.
Options
Div | |||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||||||||||||||||
|
You can append query options to the URI in the following format: ?option=value&option=value&...
Configuring DataSet
Camel will lookup in the Registry for a bean implementing the DataSet
interface. So you can register your own DataSet
as:
Code Block | ||||
---|---|---|---|---|
| ||||
}} h3. Configuring DataSet Camel will lookup in the [Registry] for a bean implementing the DataSet interface. So you can register your own DataSet as: {code:xml} <bean id="myDataSet" class="com.mycompany.MyDataSet"> <property name="size" value="100"/> </bean> {code} h3. Example For |
Example
For example,
...
to
...
test
...
that
...
a
...
set
...
of
...
messages
...
are
...
sent
...
to
...
a
...
queue
...
and
...
then
...
consumed
...
from
...
the
...
queue
...
without
...
losing
...
any
...
messages:
Code Block | ||
---|---|---|
| ||
{code} // sendSend the dataset to a queue from("dataset:foo") .to("activemq:SomeQueue"); // nowNow lets test that the messages are consumed correctly from("activemq:SomeQueue") .to("dataset:foo"); {code} |
The
...
above
...
would
...
look
...
in
...
the
...
...
to
...
find
...
the foo
DataSet
instance which is used to create the messages. Then you create a DataSet implementation, such as using the SimpleDataSet
as described below, configuring things like how big the data set is and what the messages look like etc.
DataSetSupport
(abstract class)
The DataSetSupport
abstract class is a nice starting point for new DataSets, and provides some useful features to derived classes.
Properties on DataSetSupport
Div | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||
|
SimpleDataSet
The SimpleDataSet
extends DataSetSupport
, and adds a default body.
Additional Properties on SimpleDataSet
Div | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
|
ListDataSet (Camel 2.17)
The ListDataSet
extends DataSetSupport
, and adds a list of default bodies.
Additional Properties on ListDataSet
Div | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||
|
FileDataSet (Camel 2.17)
The SimpleDataSet
extends ListDataSet
, and adds support for loading the bodies from a file.
Additional Properties on FileDataSet
Div | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||
|
Include Page | ||||
---|---|---|---|---|
|