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.ComponentAware,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.HasCamelContext,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",
remote=false,
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.
-
Field Summary
Fields inherited from class org.apache.camel.component.mock.MockEndpoint
reporterFields inherited from class org.apache.camel.support.service.BaseService
BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING -
Constructor Summary
ConstructorsConstructorDescriptionDataSetEndpoint(String endpointUri, org.apache.camel.Component component, DataSet dataSet) -
Method Summary
Modifier and TypeMethodDescriptionstatic 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.Producerprotected org.apache.camel.support.processor.ThroughputLoggerprotected voiddoStart()longlongintlonglongintbooleanisRemote()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, 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, expectedVariableReceived, expectedVariableValuesReceivedInAnyOrder, expectedVariableValuesReceivedInAnyOrder, 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, whenExchangeReceivedMethods inherited from class org.apache.camel.support.DefaultEndpoint
configureConsumer, configureExchange, configurePollingConsumer, configureProperties, createAsyncProducer, createEndpointUri, createExchange, createExchange, createPollingConsumer, doInit, 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, toStringMethods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doStop, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.camel.ComponentAware
getComponent, setComponentMethods inherited from interface org.apache.camel.Endpoint
configureExchange, configureProperties, createAsyncProducer, createExchange, createExchange, createPollingConsumer, getCamelContext, getEndpointBaseUri, getEndpointKey, getEndpointUri, getExchangePattern, isSingletonProducer, setCamelContextMethods inherited from interface org.apache.camel.IsSingleton
isSingletonMethods inherited from interface org.apache.camel.Service
build, close, init, start, stopMethods inherited from interface org.apache.camel.ShutdownableService
shutdownMethods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspendingMethods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Constructor Details
-
DataSetEndpoint
-
-
Method Details
-
isRemote
public boolean isRemote()- Specified by:
isRemotein interfaceorg.apache.camel.Endpoint- Overrides:
isRemotein classorg.apache.camel.component.mock.MockEndpoint
-
assertEquals
-
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
- 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
Creates a message exchange for the given index in theDataSet- Throws:
Exception
-
waitForCompleteLatch
- Overrides:
waitForCompleteLatchin classorg.apache.camel.component.mock.MockEndpoint- Throws:
InterruptedException
-
getDataSet
-
setDataSet
-
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
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
-
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() -
doStart
- Overrides:
doStartin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-