Class 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.
    • 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

      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 the DataSet
      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 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, 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 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 Detail

      • DataSetEndpoint

        public DataSetEndpoint​(String endpointUri,
                               org.apache.camel.Component component,
                               DataSet dataSet)
    • 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 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.DefaultEndpoint
        Throws:
        Exception