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.ServiceProvide 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 voidassertEquals(String description, Object expected, Object actual, org.apache.camel.Exchange exchange)protected voidassertMessageExpected(long index, org.apache.camel.Exchange expected, org.apache.camel.Exchange actual)org.apache.camel.ConsumercreateConsumer(org.apache.camel.Processor processor)org.apache.camel.ExchangecreateExchange(long messageIndex)Creates a message exchange for the given index in theDataSetorg.apache.camel.ProducercreateProducer()protected org.apache.camel.support.processor.ThroughputLoggercreateReporter()protected voiddoStart()longgetConsumeDelay()DataSetgetDataSet()StringgetDataSetIndex()longgetInitialDelay()intgetMinRate()longgetPreloadSize()longgetProduceDelay()intgetReceivedCounter()protected voidperformAssertions(org.apache.camel.Exchange actual, org.apache.camel.Exchange copy)voidreset()voidsetConsumeDelay(long consumeDelay)Allows a delay to be specified which causes a delay when a message is consumed by the producer (to simulate slow processing)voidsetDataSet(DataSet dataSet)voidsetDataSetIndex(String dataSetIndex)Controls the behaviour of the CamelDataSetIndex header.voidsetInitialDelay(long initialDelay)Time period in millis to wait before starting sending messages.voidsetMinRate(int minRate)Wait until the DataSet contains at least this number of messagesvoidsetPreloadSize(long preloadSize)Sets how many messages should be preloaded (sent) before the route completes its initializationvoidsetProduceDelay(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 voidwaitForCompleteLatch(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:
createConsumerin interfaceorg.apache.camel.Endpoint- Overrides:
createConsumerin classorg.apache.camel.component.mock.MockEndpoint- Throws:
Exception
-
createProducer
public org.apache.camel.Producer createProducer() throws Exception- Specified by:
createProducerin interfaceorg.apache.camel.Endpoint- Overrides:
createProducerin classorg.apache.camel.component.mock.MockEndpoint- Throws:
Exception
-
reset
public void reset()
- Overrides:
resetin classorg.apache.camel.component.mock.MockEndpoint
-
getReceivedCounter
public int getReceivedCounter()
- Overrides:
getReceivedCounterin classorg.apache.camel.component.mock.MockEndpoint
-
createExchange
public org.apache.camel.Exchange createExchange(long messageIndex) throws ExceptionCreates a message exchange for the given index in theDataSet- Throws:
Exception
-
waitForCompleteLatch
protected void waitForCompleteLatch(long timeout) throws InterruptedException- Overrides:
waitForCompleteLatchin 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. off (consumer) the header will not be set. strict (consumer) the header will be set. lenient (consumer) the header will be set. off (producer) the header value will not be verified, and will not be set if it is not present. strict (producer) the header value must be present and will be verified. lenient (producer) 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:
performAssertionsin 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()
-
-