Class DataSetEndpoint
- java.lang.Object
-
- org.apache.camel.support.service.BaseService
-
- org.apache.camel.support.service.ServiceSupport
-
- org.apache.camel.support.DefaultEndpoint
-
- org.apache.camel.component.mock.MockEndpoint
-
- org.apache.camel.component.dataset.DataSetEndpoint
-
- All Implemented Interfaces:
AutoCloseable
,org.apache.camel.CamelContextAware
,org.apache.camel.Endpoint
,org.apache.camel.IsSingleton
,org.apache.camel.Service
,org.apache.camel.ShutdownableService
,org.apache.camel.spi.BrowsableEndpoint
,org.apache.camel.spi.HasId
,org.apache.camel.spi.NotifyBuilderMatcher
,org.apache.camel.StatefulService
,org.apache.camel.SuspendableService
@UriEndpoint(firstVersion="1.3.0", scheme="dataset", title="Dataset", syntax="dataset:name", category={CORE,TESTING}, lenientProperties=true, headersClass=DataSetConstants.class) public class DataSetEndpoint extends org.apache.camel.component.mock.MockEndpoint implements org.apache.camel.Service
Provide data for load and soak testing of your Camel application. 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.
-
-
Constructor Summary
Constructors Constructor Description DataSetEndpoint(String endpointUri, org.apache.camel.Component component, DataSet dataSet)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
assertEquals(String description, Object expected, Object actual, org.apache.camel.Exchange exchange)
protected void
assertMessageExpected(long index, org.apache.camel.Exchange expected, org.apache.camel.Exchange actual)
org.apache.camel.Consumer
createConsumer(org.apache.camel.Processor processor)
org.apache.camel.Exchange
createExchange(long messageIndex)
Creates a message exchange for the given index in theDataSet
org.apache.camel.Producer
createProducer()
protected org.apache.camel.support.processor.ThroughputLogger
createReporter()
protected void
doStart()
long
getConsumeDelay()
DataSet
getDataSet()
String
getDataSetIndex()
long
getInitialDelay()
int
getMinRate()
long
getPreloadSize()
long
getProduceDelay()
int
getReceivedCounter()
protected void
performAssertions(org.apache.camel.Exchange actual, org.apache.camel.Exchange copy)
void
reset()
void
setConsumeDelay(long consumeDelay)
Allows a delay to be specified which causes a delay when a message is consumed by the producer (to simulate slow processing)void
setDataSet(DataSet dataSet)
void
setDataSetIndex(String dataSetIndex)
Controls the behaviour of the CamelDataSetIndex header.void
setInitialDelay(long initialDelay)
Time period in millis to wait before starting sending messages.void
setMinRate(int minRate)
Wait until the DataSet contains at least this number of messagesvoid
setPreloadSize(long preloadSize)
Sets how many messages should be preloaded (sent) before the route completes its initializationvoid
setProduceDelay(long produceDelay)
Allows a delay to be specified which causes a delay when a message is sent by the consumer (to simulate slow processing)protected void
waitForCompleteLatch(long timeout)
-
Methods inherited from class org.apache.camel.component.mock.MockEndpoint
addReceivedExchange, allMessages, assertEquals, assertExchangeReceived, assertFalse, assertIsNotSatisfied, assertIsNotSatisfied, assertIsSatisfied, assertIsSatisfied, assertIsSatisfied, assertIsSatisfied, assertIsSatisfied, assertIsSatisfied, assertMessagesAscending, assertMessagesDescending, assertMessagesSorted, assertMessagesSorted, assertNoDuplicates, assertTrue, assertWait, await, await, doAssertIsSatisfied, expectedBodiesReceived, expectedBodiesReceived, expectedBodiesReceivedInAnyOrder, expectedBodiesReceivedInAnyOrder, expectedBodyReceived, expectedExchangePattern, expectedFileExists, expectedFileExists, expectedFileExists, expectedFileExists, expectedHeaderReceived, expectedHeaderValuesReceivedInAnyOrder, expectedHeaderValuesReceivedInAnyOrder, expectedMessageCount, expectedMessagesMatches, expectedMinimumMessageCount, expectedNoHeaderReceived, expectedPropertyReceived, expectedPropertyValuesReceivedInAnyOrder, expectedPropertyValuesReceivedInAnyOrder, expects, expectsAscending, expectsAscending, expectsDescending, expectsDescending, expectsMessageCount, expectsNoDuplicates, expectsNoDuplicates, fail, getAssertPeriod, getComponent, getExchanges, getExpectedCount, getExpectedMinimumCount, getFailures, getName, getReceivedExchanges, getReporter, getReportGroup, getResultMinimumWaitTime, getResultWaitTime, getRetainFirst, getRetainLast, getSleepForEmptyTest, handle, isCopyOnExchange, isFailFast, isLenientProperties, isLog, message, notifyBuilderMatches, notifyBuilderOnExchange, notifyBuilderReset, onExchange, resetMocks, resolve, returnReplyBody, returnReplyHeader, setAssertPeriod, setAssertPeriod, setCopyOnExchange, setExpectedCount, setExpectedMessageCount, setFailFast, setLog, setMinimumExpectedMessageCount, setName, setReporter, setReportGroup, setResultMinimumWaitTime, setResultWaitTime, setRetainFirst, setRetainLast, setSleepForEmptyTest, waitForCompleteLatch, whenAnyExchangeReceived, whenExchangeReceived
-
Methods inherited from class org.apache.camel.support.DefaultEndpoint
configureConsumer, configureExchange, configurePollingConsumer, configureProperties, createAsyncProducer, createEndpointUri, createExchange, createExchange, createPollingConsumer, doInit, doStop, equals, getCamelContext, getEndpointKey, getEndpointUri, getExceptionHandler, getExchangePattern, getId, getPollingConsumerBlockTimeout, getPollingConsumerQueueSize, hashCode, isAutowiredEnabled, isBridgeErrorHandler, isLazyStartProducer, isPollingConsumerBlockWhenFull, isPollingConsumerCopy, isSingleton, setAutowiredEnabled, setBridgeErrorHandler, setCamelContext, setComponent, setEndpointUri, setEndpointUriIfNotSpecified, setExceptionHandler, setExchangePattern, setLazyStartProducer, setPollingConsumerBlockTimeout, setPollingConsumerBlockWhenFull, setPollingConsumerCopy, setPollingConsumerQueueSize, setProperties, toString
-
Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.camel.Endpoint
configureExchange, configureProperties, createAsyncProducer, createExchange, createExchange, createPollingConsumer, getCamelContext, getEndpointBaseUri, getEndpointKey, getEndpointUri, getExchangePattern, isSingletonProducer, setCamelContext
-
-
-
-
Method Detail
-
assertEquals
public static void assertEquals(String description, Object expected, Object actual, org.apache.camel.Exchange exchange)
-
createConsumer
public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception
- Specified by:
createConsumer
in interfaceorg.apache.camel.Endpoint
- Overrides:
createConsumer
in classorg.apache.camel.component.mock.MockEndpoint
- Throws:
Exception
-
createProducer
public org.apache.camel.Producer createProducer() throws Exception
- Specified by:
createProducer
in interfaceorg.apache.camel.Endpoint
- Overrides:
createProducer
in classorg.apache.camel.component.mock.MockEndpoint
- Throws:
Exception
-
reset
public void reset()
- Overrides:
reset
in classorg.apache.camel.component.mock.MockEndpoint
-
getReceivedCounter
public int getReceivedCounter()
- Overrides:
getReceivedCounter
in classorg.apache.camel.component.mock.MockEndpoint
-
createExchange
public org.apache.camel.Exchange createExchange(long messageIndex) throws Exception
Creates a message exchange for the given index in theDataSet
- Throws:
Exception
-
waitForCompleteLatch
protected void waitForCompleteLatch(long timeout) throws InterruptedException
- Overrides:
waitForCompleteLatch
in classorg.apache.camel.component.mock.MockEndpoint
- Throws:
InterruptedException
-
getDataSet
public DataSet getDataSet()
-
setDataSet
public void setDataSet(DataSet dataSet)
-
getMinRate
public int getMinRate()
-
setMinRate
public void setMinRate(int minRate)
Wait until the DataSet contains at least this number of messages
-
getPreloadSize
public long getPreloadSize()
-
setPreloadSize
public void setPreloadSize(long preloadSize)
Sets how many messages should be preloaded (sent) before the route completes its initialization
-
getConsumeDelay
public long getConsumeDelay()
-
setConsumeDelay
public void setConsumeDelay(long consumeDelay)
Allows a delay to be specified which causes a delay when a message is consumed by the producer (to simulate slow processing)
-
getProduceDelay
public long getProduceDelay()
-
setProduceDelay
public void setProduceDelay(long produceDelay)
Allows a delay to be specified which causes a delay when a message is sent by the consumer (to simulate slow processing)
-
getInitialDelay
public long getInitialDelay()
-
setInitialDelay
public void setInitialDelay(long initialDelay)
Time period in millis to wait before starting sending messages.
-
setDataSetIndex
public void setDataSetIndex(String dataSetIndex)
Controls the behaviour of the CamelDataSetIndex header. For Consumers: - off => the header will not be set - strict/lenient => the header will be set For Producers: - off => the header value will not be verified, and will not be set if it is not present = strict => the header value must be present and will be verified = lenient => the header value will be verified if it is present, and will be set if it is not present
-
getDataSetIndex
public String getDataSetIndex()
-
performAssertions
protected void performAssertions(org.apache.camel.Exchange actual, org.apache.camel.Exchange copy) throws Exception
- Overrides:
performAssertions
in classorg.apache.camel.component.mock.MockEndpoint
- Throws:
Exception
-
assertMessageExpected
protected void assertMessageExpected(long index, org.apache.camel.Exchange expected, org.apache.camel.Exchange actual) throws Exception
- Throws:
Exception
-
createReporter
protected org.apache.camel.support.processor.ThroughputLogger createReporter()
-
-