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", 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

    reporter

    Fields 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

    Constructors
    Constructor
    Description
    DataSetEndpoint(String endpointUri, org.apache.camel.Component component, DataSet dataSet)
     
  • Method Summary

    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 the DataSet
    org.apache.camel.Producer
     
    protected org.apache.camel.support.processor.ThroughputLogger
     
    protected void
     
    long
     
     
     
    long
     
    int
     
    long
     
    long
     
    int
     
    protected void
    performAssertions(org.apache.camel.Exchange actual, org.apache.camel.Exchange copy)
     
    void
     
    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
     
    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 messages
    void
    setPreloadSize(long preloadSize)
    Sets how many messages should be preloaded (sent) before the route completes its initialization
    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)
    protected void
    waitForCompleteLatch(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, 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, 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, doStop, 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.ComponentAware

    getComponent, setComponent

    Methods inherited from interface org.apache.camel.Endpoint

    configureExchange, configureProperties, createAsyncProducer, createExchange, createExchange, createPollingConsumer, getCamelContext, getEndpointBaseUri, getEndpointKey, getEndpointUri, getExchangePattern, isSingletonProducer, setCamelContext

    Methods inherited from interface org.apache.camel.IsSingleton

    isSingleton

    Methods inherited from interface org.apache.camel.Service

    build, close, init, start, stop

    Methods inherited from interface org.apache.camel.ShutdownableService

    shutdown

    Methods inherited from interface org.apache.camel.StatefulService

    getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspending

    Methods inherited from interface org.apache.camel.SuspendableService

    isSuspended, resume, suspend
  • Constructor Details

    • DataSetEndpoint

      public DataSetEndpoint(String endpointUri, org.apache.camel.Component component, DataSet dataSet)
  • Method Details

    • 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 interface org.apache.camel.Endpoint
      Overrides:
      createConsumer in class org.apache.camel.component.mock.MockEndpoint
      Throws:
      Exception
    • createProducer

      public org.apache.camel.Producer createProducer() throws Exception
      Specified by:
      createProducer in interface org.apache.camel.Endpoint
      Overrides:
      createProducer in class org.apache.camel.component.mock.MockEndpoint
      Throws:
      Exception
    • reset

      public void reset()
      Overrides:
      reset in class org.apache.camel.component.mock.MockEndpoint
    • getReceivedCounter

      public int getReceivedCounter()
      Overrides:
      getReceivedCounter in class org.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 the DataSet
      Throws:
      Exception
    • waitForCompleteLatch

      protected void waitForCompleteLatch(long timeout) throws InterruptedException
      Overrides:
      waitForCompleteLatch in class org.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:
      performAssertions in class org.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

      protected void doStart() throws Exception
      Overrides:
      doStart in class org.apache.camel.support.service.BaseService
      Throws:
      Exception