camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [08/11] camel git commit: Component docs
Date Wed, 06 Jan 2016 10:36:58 GMT
Component docs


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/713dfa63
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/713dfa63
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/713dfa63

Branch: refs/heads/master
Commit: 713dfa63504798ea0db200140b89557ba7fc34af
Parents: 5ab21b2
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Wed Jan 6 10:41:16 2016 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Wed Jan 6 11:36:29 2016 +0100

----------------------------------------------------------------------
 .../camel/component/jbpm/JBPMConfiguration.java | 126 +++++++++++++++----
 .../camel/component/jbpm/JBPMEndpoint.java      |  18 +--
 .../metrics/MetricsComponentRouteTest.java      |   2 +-
 .../component/mongodb/MongoDbEndpoint.java      |   2 +-
 .../camel/component/mqtt/MQTTConfiguration.java |   4 +-
 .../component/mybatis/MyBatisConsumer.java      |  11 --
 .../component/mybatis/MyBatisEndpoint.java      |  43 ++++++-
 .../nagios/NagiosConfiguraitonRefTest.java      | 115 -----------------
 8 files changed, 156 insertions(+), 165 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/713dfa63/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMConfiguration.java
b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMConfiguration.java
index 6f26d5d..d91caf4 100644
--- a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMConfiguration.java
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMConfiguration.java
@@ -31,58 +31,64 @@ import org.kie.api.task.model.Task;
 @UriParams
 public class JBPMConfiguration {
 
-    /**
-     * Specifies the operation to perform
-     */
+    @UriPath @Metadata(required = "true")
+    private URL connectionURL;
     @UriParam(label = "producer", defaultValue = "startProcess")
     private String operation;
-    /**
-     * Specifies the value to use
-     */
+    @UriParam @Metadata(required = "true")
+    private String deploymentId;
+    @UriParam
+    private Long processInstanceId;
     @UriParam
     private Object value;
+    @UriParam
     private String processId;
-    private Map<String, Object> parameters;
-    /**
-     * Specifies the process instance to interact with
-     */
-    @UriParam @Metadata(required = "true")
-    private Long processInstanceId;
+    @UriParam
     private String eventType;
+    @UriParam
     private Object event;
+    @UriParam
     private Integer maxNumber;
+    @UriParam
     private String identifier;
+    @UriParam
     private Long workItemId;
+    @UriParam
     private Long taskId;
+    @UriParam
     private String userId;
+    @UriParam
     private String language;
+    @UriParam
     private String targetUserId;
+    @UriParam
     private Long attachmentId;
+    @UriParam
     private Long contentId;
+    @UriParam
     private Task task;
+    @UriParam
     private List<OrganizationalEntity> entities;
+    @UriParam
     private List<Status> statuses;
-
-    //connection
+    @UriParam(label = "security")
     private String userName;
+    @UriParam(label = "security")
     private String password;
-    /**
-     * Specifies the connection url to the jBPM system
-     */
-    @UriPath @Metadata(required = "true")
-    private URL connectionURL;
-    /**
-     * Specifies the deploymentId to use
-     */
-    @UriParam @Metadata(required = "true")
-    private String deploymentId;
+    @UriParam
     private Integer timeout;
+    @UriParam(label = "advanced")
+    private Map<String, Object> parameters;
+    @UriParam(label = "advanced")
     private Class[] extraJaxbClasses;
 
     public String getOperation() {
         return operation;
     }
 
+    /**
+     * The operation to perform
+     */
     public void setOperation(String operation) {
         this.operation = operation;
     }
@@ -91,6 +97,9 @@ public class JBPMConfiguration {
         return value;
     }
 
+    /**
+     * the value to assign to the global identifier
+     */
     public void setValue(Object value) {
         this.value = value;
     }
@@ -99,6 +108,9 @@ public class JBPMConfiguration {
         return processId;
     }
 
+    /**
+     * the id of the process that should be acted upon
+     */
     public void setProcessId(String processId) {
         this.processId = processId;
     }
@@ -107,6 +119,9 @@ public class JBPMConfiguration {
         return parameters;
     }
 
+    /**
+     * the variables that should be set for various operations
+     */
     public void setParameters(Map<String, Object> parameters) {
         this.parameters = parameters;
     }
@@ -115,6 +130,9 @@ public class JBPMConfiguration {
         return processInstanceId;
     }
 
+    /**
+     * the id of the process instance
+     */
     public void setProcessInstanceId(Long processInstanceId) {
         this.processInstanceId = processInstanceId;
     }
@@ -123,6 +141,9 @@ public class JBPMConfiguration {
         return eventType;
     }
 
+    /**
+     * the type of event to use when signalEvent operation is performed
+     */
     public void setEventType(String eventType) {
         this.eventType = eventType;
     }
@@ -131,6 +152,9 @@ public class JBPMConfiguration {
         return event;
     }
 
+    /**
+     * the data associated with this event when signalEvent operation is performed
+     */
     public void setEvent(Object event) {
         this.event = event;
     }
@@ -139,6 +163,9 @@ public class JBPMConfiguration {
         return maxNumber;
     }
 
+    /**
+     * the maximum number of rules that should be fired
+     */
     public void setMaxNumber(Integer maxNumber) {
         this.maxNumber = maxNumber;
     }
@@ -147,6 +174,9 @@ public class JBPMConfiguration {
         return identifier;
     }
 
+    /**
+     * identifier the global identifier
+     */
     public void setIdentifier(String identifier) {
         this.identifier = identifier;
     }
@@ -155,6 +185,9 @@ public class JBPMConfiguration {
         return workItemId;
     }
 
+    /**
+     * the id of the work item
+     */
     public void setWorkItemId(Long workItemId) {
         this.workItemId = workItemId;
     }
@@ -163,6 +196,9 @@ public class JBPMConfiguration {
         return taskId;
     }
 
+    /**
+     *the id of the task
+     */
     public void setTaskId(Long taskId) {
         this.taskId = taskId;
     }
@@ -171,6 +207,9 @@ public class JBPMConfiguration {
         return userId;
     }
 
+    /**
+     * userId to use with task operations
+     */
     public void setUserId(String userId) {
         this.userId = userId;
     }
@@ -179,6 +218,9 @@ public class JBPMConfiguration {
         return task;
     }
 
+    /**
+     * The task instance to use with task operations
+     */
     public void setTask(Task task) {
         this.task = task;
     }
@@ -187,6 +229,9 @@ public class JBPMConfiguration {
         return language;
     }
 
+    /**
+     * The language to use when filtering user tasks
+     */
     public void setLanguage(String language) {
         this.language = language;
     }
@@ -195,6 +240,9 @@ public class JBPMConfiguration {
         return targetUserId;
     }
 
+    /**
+     * The targetUserId used when delegating a task
+     */
     public void setTargetUserId(String targetUserId) {
         this.targetUserId = targetUserId;
     }
@@ -203,6 +251,9 @@ public class JBPMConfiguration {
         return attachmentId;
     }
 
+    /**
+     * attachId to use when retrieving attachments
+     */
     public void setAttachmentId(Long attachmentId) {
         this.attachmentId = attachmentId;
     }
@@ -211,6 +262,9 @@ public class JBPMConfiguration {
         return contentId;
     }
 
+    /**
+     * contentId to use when retrieving attachments
+     */
     public void setContentId(Long contentId) {
         this.contentId = contentId;
     }
@@ -219,6 +273,9 @@ public class JBPMConfiguration {
         return entities;
     }
 
+    /**
+     * The potentialOwners when nominateTask operation is performed
+     */
     public void setEntities(List<OrganizationalEntity> entities) {
         this.entities = entities;
     }
@@ -227,6 +284,9 @@ public class JBPMConfiguration {
         return statuses;
     }
 
+    /**
+     * The list of status to use when filtering tasks
+     */
     public void setStatuses(List<Status> statuses) {
         this.statuses = statuses;
     }
@@ -235,6 +295,9 @@ public class JBPMConfiguration {
         return userName;
     }
 
+    /**
+     * Username for authentication
+     */
     public void setUserName(String userName) {
         this.userName = userName;
     }
@@ -243,6 +306,9 @@ public class JBPMConfiguration {
         return password;
     }
 
+    /**
+     * Password for authentication
+     */
     public void setPassword(String password) {
         this.password = password;
     }
@@ -251,6 +317,9 @@ public class JBPMConfiguration {
         return connectionURL;
     }
 
+    /**
+     * The URL to the jBPM server.
+     */
     public void setConnectionURL(URL connectionURL) {
         this.connectionURL = connectionURL;
     }
@@ -259,6 +328,9 @@ public class JBPMConfiguration {
         return deploymentId;
     }
 
+    /**
+     * The id of the deployment
+     */
     public void setDeploymentId(String deploymentId) {
         this.deploymentId = deploymentId;
     }
@@ -267,6 +339,9 @@ public class JBPMConfiguration {
         return timeout;
     }
 
+    /**
+     * A timeout value
+     */
     public void setTimeout(Integer timeout) {
         this.timeout = timeout;
     }
@@ -275,6 +350,9 @@ public class JBPMConfiguration {
         return extraJaxbClasses;
     }
 
+    /**
+     * To load additional classes when working with XML
+     */
     public void setExtraJaxbClasses(Class[] extraJaxbClasses) {
         this.extraJaxbClasses = extraJaxbClasses;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/713dfa63/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMEndpoint.java
b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMEndpoint.java
index 5742299..044aa14 100644
--- a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMEndpoint.java
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMEndpoint.java
@@ -34,19 +34,19 @@ import org.slf4j.LoggerFactory;
 /**
  * The jbpm component provides integration with jBPM (Business Process Management).
  */
-@UriEndpoint(scheme = "jbpm", title = "JBPM", syntax = "jbpm:host", producerOnly = true,
label = "process")
+@UriEndpoint(scheme = "jbpm", title = "JBPM", syntax = "jbpm:connectionURL", producerOnly
= true, label = "process")
 public class JBPMEndpoint extends DefaultEndpoint {
     private static final transient Logger LOGGER = LoggerFactory.getLogger(JBPMEndpoint.class);
 
     @UriParam
-    private final JBPMConfiguration configuration;
-    private RuntimeEngine runtimeEngine;
+    private JBPMConfiguration configuration;
 
     public JBPMEndpoint(String uri, JBPMComponent component, JBPMConfiguration configuration)
throws URISyntaxException, MalformedURLException {
         super(uri, component);
         this.configuration = configuration;
-        LOGGER.trace("creating endpoint: [{}]", configuration);
+    }
 
+    public Producer createProducer() throws Exception {
         RemoteRestRuntimeEngineBuilder engineBuilder = RemoteRuntimeEngineFactory.newRestBuilder();
         if (configuration.getUserName() != null) {
             engineBuilder.addUserName(configuration.getUserName());
@@ -69,12 +69,8 @@ public class JBPMEndpoint extends DefaultEndpoint {
         if (configuration.getExtraJaxbClasses() != null) {
             engineBuilder.addExtraJaxbClasses(configuration.getExtraJaxbClasses());
         }
-        runtimeEngine = engineBuilder.build();
-        LOGGER.trace("created endpoint");
-
-    }
+        RuntimeEngine runtimeEngine = engineBuilder.build();
 
-    public Producer createProducer() throws Exception {
         return new JBPMProducer(this, runtimeEngine);
     }
 
@@ -86,6 +82,10 @@ public class JBPMEndpoint extends DefaultEndpoint {
         return true;
     }
 
+    public void setConfiguration(JBPMConfiguration configuration) {
+        this.configuration = configuration;
+    }
+
     public JBPMConfiguration getConfiguration() {
         return configuration;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/713dfa63/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/MetricsComponentRouteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/MetricsComponentRouteTest.java
b/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/MetricsComponentRouteTest.java
index 6f71bf6..7459a19 100644
--- a/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/MetricsComponentRouteTest.java
+++ b/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/MetricsComponentRouteTest.java
@@ -93,7 +93,7 @@ public class MetricsComponentRouteTest extends CamelTestSupport {
             public void configure() {
                 from("direct:start-1")
                         .to("metrics:timer:T?action=start")
-                        .to("metrics:A")
+                        .to("metrics:counter://A")
                         .to("metrics:counter://B")
                         .to("metrics:counter:C?increment=19291")
                         .to("metrics:counter:C?decrement=19292")

http://git-wip-us.apache.org/repos/asf/camel/blob/713dfa63/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbEndpoint.java
b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbEndpoint.java
index 5512a3e..c433c38 100644
--- a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbEndpoint.java
+++ b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbEndpoint.java
@@ -66,7 +66,7 @@ public class MongoDbEndpoint extends DefaultEndpoint {
     private MongoDbOperation operation;
     @UriParam(defaultValue = "true")
     private boolean createCollection = true;
-    @UriParam
+    @UriParam(enums = "ACKNOWLEDGED,W1,W2,W3,UNACKNOWLEDGED,JOURNALED,MAJORITY,SAFE")
     private WriteConcern writeConcern;
     private WriteConcern writeConcernRef;
     @UriParam

http://git-wip-us.apache.org/repos/asf/camel/blob/713dfa63/components/camel-mqtt/src/main/java/org/apache/camel/component/mqtt/MQTTConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-mqtt/src/main/java/org/apache/camel/component/mqtt/MQTTConfiguration.java
b/components/camel-mqtt/src/main/java/org/apache/camel/component/mqtt/MQTTConfiguration.java
index 8047b14..c417c7c 100644
--- a/components/camel-mqtt/src/main/java/org/apache/camel/component/mqtt/MQTTConfiguration.java
+++ b/components/camel-mqtt/src/main/java/org/apache/camel/component/mqtt/MQTTConfiguration.java
@@ -75,7 +75,7 @@ public class MQTTConfiguration extends MQTT {
     String willTopic;
     @UriParam
     String willMessage;
-    @UriParam(defaultValue = "AT_MOST_ONCE")
+    @UriParam(enums = "AtMostOnce,AtLeastOne,ExactlyOnce", defaultValue = "AtMostOnce")
     QoS willQos = QoS.AT_MOST_ONCE;
     @UriParam
     QoS willRetain;
@@ -110,7 +110,7 @@ public class MQTTConfiguration extends MQTT {
     private int sendWaitInSeconds = 5;
     @UriParam
     private boolean byDefaultRetain;
-    @UriParam(enums = "AT_MOST_ONCE,AT_LEAST_ONCE,EXACTLY_ONCE", defaultValue = "AT_LEAST_ONCE")
+    @UriParam(enums = "AtMostOnce,AtLeastOne,ExactlyOnce", defaultValue = "AtLeastOnce")
     private String qualityOfService = QoS.AT_LEAST_ONCE.name();
     private QoS qos = QoS.AT_LEAST_ONCE;
 

http://git-wip-us.apache.org/repos/asf/camel/blob/713dfa63/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisConsumer.java
b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisConsumer.java
index 0f2fbd9..0547e29 100644
--- a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisConsumer.java
+++ b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisConsumer.java
@@ -50,19 +50,8 @@ public class MyBatisConsumer extends ScheduledBatchPollingConsumer {
     protected volatile ShutdownRunningTask shutdownRunningTask;
     protected volatile int pendingExchanges;
 
-    /**
-     * Statement to run after data has been processed in the route
-     */
     private String onConsume;
-
-    /**
-     * Process resultset individually or as a list
-     */
     private boolean useIterator = true;
-
-    /**
-     * Whether allow empty resultset to be routed to the next hop
-     */
     private boolean routeEmptyResultSet;
 
     public MyBatisConsumer(MyBatisEndpoint endpoint, Processor processor) {

http://git-wip-us.apache.org/repos/asf/camel/blob/713dfa63/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisEndpoint.java
b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisEndpoint.java
index 976ae5e..d8ccac4 100644
--- a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisEndpoint.java
+++ b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisEndpoint.java
@@ -51,6 +51,12 @@ public class MyBatisEndpoint extends DefaultPollingEndpoint {
     private String outputHeader;
     @UriParam(label = "consumer")
     private String inputHeader;
+    @UriParam(label = "consumer", optionalPrefix = "consumer.")
+    private String onConsume;
+    @UriParam(label = "consumer", optionalPrefix = "consumer.", defaultValue = "true")
+    private boolean useIterator = true;
+    @UriParam(label = "consumer", optionalPrefix = "consumer.")
+    private boolean routeEmptyResultSet;
     @UriParam(label = "producer", defaultValue = "SIMPLE")
     private ExecutorType executorType;
 
@@ -72,6 +78,9 @@ public class MyBatisEndpoint extends DefaultPollingEndpoint {
         ObjectHelper.notNull(statement, "statement", this);
         MyBatisConsumer consumer = new MyBatisConsumer(this, processor);
         consumer.setMaxMessagesPerPoll(getMaxMessagesPerPoll());
+        consumer.setOnConsume(getOnConsume());
+        consumer.setUseIterator(isUseIterator());
+        consumer.setRouteEmptyResultSet(isRouteEmptyResultSet());
         configureConsumer(consumer);
         return consumer;
     }
@@ -196,6 +205,36 @@ public class MyBatisEndpoint extends DefaultPollingEndpoint {
         this.inputHeader = inputHeader;
     }
 
-    
-    
+    public String getOnConsume() {
+        return onConsume;
+    }
+
+    /**
+     * Statement to run after data has been processed in the route
+     */
+    public void setOnConsume(String onConsume) {
+        this.onConsume = onConsume;
+    }
+
+    public boolean isUseIterator() {
+        return useIterator;
+    }
+
+    /**
+     * Process resultset individually or as a list
+     */
+    public void setUseIterator(boolean useIterator) {
+        this.useIterator = useIterator;
+    }
+
+    public boolean isRouteEmptyResultSet() {
+        return routeEmptyResultSet;
+    }
+
+    /**
+     * Whether allow empty resultset to be routed to the next hop
+     */
+    public void setRouteEmptyResultSet(boolean routeEmptyResultSet) {
+        this.routeEmptyResultSet = routeEmptyResultSet;
+    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/713dfa63/components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosConfiguraitonRefTest.java
----------------------------------------------------------------------
diff --git a/components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosConfiguraitonRefTest.java
b/components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosConfiguraitonRefTest.java
deleted file mode 100644
index 248de4b..0000000
--- a/components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosConfiguraitonRefTest.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.nagios;
-
-import com.googlecode.jsendnsca.core.Level;
-import com.googlecode.jsendnsca.core.MessagePayload;
-import com.googlecode.jsendnsca.core.mocks.NagiosNscaStub;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.impl.JndiRegistry;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @version 
- */
-public class NagiosConfiguraitonRefTest extends CamelTestSupport {
-    protected boolean canRun;
-    private NagiosNscaStub nagios;    
-
-    @Before
-    @Override
-    public void setUp() throws Exception {
-        canRun = true;
-
-        nagios = new NagiosNscaStub(25668, "secret");
-        try {
-            nagios.start();
-        } catch (Exception e) {
-            log.warn("Error starting NagiosNscaStub. This exception is ignored.", e);
-            canRun = false;
-        }
-
-        super.setUp();
-    }
-
-    @After
-    @Override
-    public void tearDown() throws Exception {
-        super.tearDown();
-        try {
-            nagios.stop();
-        } catch (Exception e) {
-            // ignore
-            log.warn("Error stopping NagiosNscaStub. This exception is ignored.", e);
-        }
-    }
-
-    @Override
-    protected JndiRegistry createRegistry() throws Exception {
-        NagiosConfiguration config = new NagiosConfiguration();
-        config.setPassword("secret");
-        config.setHost("127.0.0.1");
-        config.setPort(25668);
-
-        JndiRegistry jndi = super.createRegistry();
-        jndi.bind("nagiosConf", config);
-        return jndi;
-    }
-
-    @Test
-    public void testSendToNagios() throws Exception {
-        if (!canRun) {
-            return;
-        }
-
-        MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedMessageCount(1);
-        mock.allMessages().body().isInstanceOf(String.class);
-
-        template.sendBody("direct:start", "Hello Nagios");
-
-        assertMockEndpointsSatisfied();
-
-        // sleep a little to let nagios stub process the payloads
-        Thread.sleep(1000);
-
-        assertEquals(1, nagios.getMessagePayloadList().size());
-
-        MessagePayload payload = nagios.getMessagePayloadList().get(0);
-        assertEquals("Hello Nagios", payload.getMessage());
-        assertEquals("localhost", payload.getHostname());
-        assertEquals(Level.OK.ordinal(), payload.getLevel());
-        assertEquals(context.getName(), payload.getServiceName());
-    }
-
-    @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
-        return new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                // START SNIPPET: e1
-                from("direct:start").to("nagios:foo?configuration=#nagiosConf").to("mock:result");
-                // END SNIPPET: e1
-            }
-        };
-    }
-
-}
\ No newline at end of file


Mime
View raw message