Class DataSetTestEndpoint
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.DataSetTestEndpoint
- 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-test",
title="DataSet Test",
syntax="dataset-test:name",
remote=false,
producerOnly=true,
category={CORE,TESTING},
lenientProperties=true)
public class DataSetTestEndpoint
extends org.apache.camel.component.mock.MockEndpoint
Extends the mock component by pulling messages from another endpoint on startup to set the expected message bodies.
That is, you use the test endpoint in a route and messages arriving on 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 Mock endpoint, which is only valid if the received messages
match the number of expected messages and their message payloads are equal.
-
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
ConstructorsConstructorDescriptionDataSetTestEndpoint(String endpointUri, org.apache.camel.Component component) -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoStart()protected ObjectgetInBody(org.apache.camel.Exchange exchange) This method allows us to convert or coerce the expected message body into some other typelongbooleanbooleanisRemote()booleanisSplit()voidsetAnyOrder(boolean anyOrder) Whether the expected messages should arrive in the same order or can be in any order.voidsetDelimiter(String delimiter) The split delimiter to use when split is enabled.voidsetExpectedMessageEndpoint(org.apache.camel.Endpoint expectedMessageEndpoint) voidsetSplit(boolean split) If enabled the messages loaded from the test endpoint will be split using new line delimiters so each line is an expected message.voidsetTimeout(long timeout) The timeout to use when polling for message bodies from the URIMethods 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, createConsumer, createProducer, 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, getReceivedCounter, getReceivedExchanges, getReporter, getReportGroup, getResultMinimumWaitTime, getResultWaitTime, getRetainFirst, getRetainLast, getSleepForEmptyTest, handle, isCopyOnExchange, isFailFast, isLenientProperties, isLog, message, notifyBuilderMatches, notifyBuilderOnExchange, notifyBuilderReset, onExchange, performAssertions, reset, resetMocks, resolve, returnReplyBody, returnReplyHeader, setAssertPeriod, setAssertPeriod, setCopyOnExchange, setExpectedCount, setExpectedMessageCount, setFailFast, setLog, setMinimumExpectedMessageCount, setName, setReporter, setReportGroup, setResultMinimumWaitTime, setResultWaitTime, setRetainFirst, setRetainLast, setSleepForEmptyTest, waitForCompleteLatch, 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, getInternalLock, 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
-
DataSetTestEndpoint
-
-
Method Details
-
isRemote
public boolean isRemote()- Specified by:
isRemotein interfaceorg.apache.camel.Endpoint- Overrides:
isRemotein classorg.apache.camel.component.mock.MockEndpoint
-
setExpectedMessageEndpoint
public void setExpectedMessageEndpoint(org.apache.camel.Endpoint expectedMessageEndpoint) -
doStart
- Overrides:
doStartin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
getInBody
This method allows us to convert or coerce the expected message body into some other type -
getTimeout
public long getTimeout() -
setTimeout
public void setTimeout(long timeout) The timeout to use when polling for message bodies from the URI -
isAnyOrder
public boolean isAnyOrder() -
setAnyOrder
public void setAnyOrder(boolean anyOrder) Whether the expected messages should arrive in the same order or can be in any order. -
isSplit
public boolean isSplit() -
setSplit
public void setSplit(boolean split) If enabled the messages loaded from the test endpoint will be split using new line delimiters so each line is an expected message.
For example to use a file endpoint to load a file where each line is an expected message. -
getDelimiter
-
setDelimiter
The split delimiter to use when split is enabled. By default the delimiter is new line based. The delimiter can be a regular expression.
-