[camel] branch sandbox/camel-3.x updated (1daf964 -> 9e39dc1)

classic Classic list List threaded Threaded
36 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[camel] branch sandbox/camel-3.x updated (1daf964 -> 9e39dc1)

acosentino
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a change to branch sandbox/camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from 1daf964  Regen
     new 9a369fa  CAMEL-12964: Initial import of jBPM CamelWIH and Command.
     new 9ecf4a9  CamelCommand splitted in a separate command for Camel DeploymentContext and GlobalContext. WorkItemHandler can now be configured with default route. WIH supports both InOut and InOnly MEPs. Added tests that use a test CamelContext and test-routes to verify behaviour on Exceptions.
     new a04dd48  Replaced hard-coded strings with constants. Changed WorkItem parameter names to be inline with other WorkItemHandlers.
     new 9024d73  Removed TODO comments.
     new b5d9201  CAMEL-12964: Fix CS
     new df880c9  Upgrade Rabbitmq client to version 5.5.1
     new bb2c087  [CAMEL-12605] Refactoring for compression support.
     new a2517d7  CAMEL-12967 - Fixed CS
     new afd2431  Upgrade PAX Exam to version 4.13.0
     new a463f55   [CAMEL-12605] Added tests and fixes for compression
     new 6d3120c  Typo
     new b423d4e1 Polished
     new b871a11  Typos
     new dee4c1d  Polished
     new c5c2223  Upgrade Flink to version 1.7.0
     new 856f83d  Upgrade Micrometer to version 1.1.1
     new de2a1d9  Upgrade Spring Boot to version 2.1.1.RELEASE
     new 9cf7ff3  Update Spring Boot to version 2.1.1.RELEASE even in dm
     new 6224342  Upgrade Vertx to version 3.6.0
     new 0dd5a65  Avoid potentially conflicting jetty port during test execution
     new 67af4a2  CAMEL-12944 - externalize configs as PR #2549 tried to avoid potentially conflicting jetty port during test execution
     new b2fae4f  Fix camel-micrometer documentation references to METRICS_REGISTRY_NAME
     new 065d68d  Upgrade Zipkin to version 2.11.9
     new 80b9b29  Upgrade Zipkin Reporter to version 2.7.12
     new 9c421bd  CAMEL-12973: Init deferred to first call when WIH uses Deployment-scoped context in combination with Singleton RuntimeStrategy. Removed redundant double slash from 'direct' URL.
     new ead7272  CAMEL-12973 - Fixed CS
     new 1e91cef  [CAMEL-12605] Added further tests and fixes for compression
     new 41f8c85  Upgrade Infinispan to version 9.4.3.Final
     new f9a1c7b0 Upgrade Zipkin to version 2.11.10
     new 176f890  Upgrade Zipkin Reporter to version 2.7.13
     new b8e1419  Upgrade Brave to version 5.5.2
     new 1447ab2  Fixed wrong default mentioned in docs. Thanks to Bjoern Ohm for spotting this.
     new 23d298e  CAMEL-12979 - support for service beans with custom lifecycle on CxfRsEndpoint, Thanks to Jens Kleine-Herzbruch
     new c2b6d7b  Regen
     new 9e39dc1  Regen docs

The 35 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 camel-core/src/main/docs/file-component.adoc       |   2 +-
 .../camel/component/file/GenericFileEndpoint.java  |   2 +-
 .../camel/component/as2/api/AS2ClientManager.java  | 122 +++++++-
 ...Structure.java => AS2CompressionAlgorithm.java} |  36 +--
 .../camel/component/as2/api/AS2MediaType.java      |   8 +-
 .../component/as2/api/AS2MessageStructure.java     |  10 +-
 .../ApplicationPkcs7MimeCompressedDataEntity.java  |   2 +-
 ...> ApplicationPkcs7MimeEnvelopedDataEntity.java} |  11 +-
 .../component/as2/api/entity/EntityParser.java     |  56 +++-
 .../CompressionUtils.java}                         |  36 +--
 .../camel/component/as2/api/AS2MessageTest.java    | 316 +++++++++++++++++++--
 .../component/as2/api/entity/EntityParserTest.java |   2 +-
 .../src/main/docs/as2-component.adoc               |   6 +-
 .../camel/component/as2/AS2Configuration.java      |  17 +-
 .../as2/AS2ClientManagerIntegrationTest.java       |   6 +-
 .../as2/AS2ServerManagerIntegrationTest.java       |   4 +-
 components/camel-corda/README.md                   |   2 +-
 .../camel-corda/src/main/docs/corda-component.adoc |   2 -
 .../camel-cxf/src/main/docs/cxfrs-component.adoc   |   3 +-
 .../camel/component/cxf/jaxrs/CxfRsEndpoint.java   |  32 +++
 .../component/cxf/jaxrs/CxfRsConsumerTest.java     |  22 +-
 .../camel-ftp/src/main/docs/ftp-component.adoc     |   2 +-
 .../camel-ftp/src/main/docs/ftps-component.adoc    |   2 +-
 .../camel-ftp/src/main/docs/sftp-component.adoc    |   2 +-
 .../src/main/docs/google-bigquery-component.adoc   |  25 +-
 .../main/docs/google-bigquery-sql-component.adoc   |  22 +-
 .../bigquery/sql/GoogleBigQuerySQLEndpoint.java    |  24 +-
 .../stream/GoogleCalendarStreamEndpoint.java       |   2 +-
 .../SheetsStreamConsumerIntegrationTest.java       |   3 +-
 components/camel-jbpm/pom.xml                      |  27 ++
 .../apache/camel/component/jbpm/JBPMConstants.java |   8 +
 .../jbpm/server/CamelKieServerExtension.java       |  32 +--
 .../jbpm/workitem/AbstractCamelCommand.java        |  81 ++++++
 .../workitem/AbstractCamelWorkItemHandler.java     | 178 ++++++++++++
 .../workitem/DeploymentContextCamelCommand.java    |  71 +++++
 .../jbpm/workitem/GlobalContextCamelCommand.java   |  56 ++++
 .../jbpm/workitem/InOnlyCamelWorkItemHandler.java  | 106 +++++++
 .../jbpm/workitem/InOutCamelWorkItemHandler.java   | 116 ++++++++
 .../jbpm/JBPMComponentIntegrationTest.java         |   1 -
 .../CamelWorkItemHandlerIntegrationTests.java      | 208 ++++++++++++++
 .../DeploymentContextCamelCommandTest.java         |  99 +++++++
 .../workitem/GlobalContextCamelCommandTest.java    |  99 +++++++
 .../workitem/InOnlyCamelWorkItemHandlerTest.java   | 101 +++++++
 .../workitem/InOutCamelWorkItemHandlerTest.java    | 231 +++++++++++++++
 .../src/main/docs/micrometer-component.adoc        |   6 +-
 .../cloud/SpringRibbonServiceCallRouteTest.java    |  16 +-
 .../cloud/SpringBeanRibbonServiceCallRouteTest.xml |  18 +-
 ...ringDslRibbonPropertiesServiceCallRouteTest.xml |  18 +-
 .../cloud/SpringDslRibbonServiceCallRouteTest.xml  |  18 +-
 ...springbeanribbonservicecallroutetest.properties |  19 ++
 ...ribbonpropertiesservicecallroutetest.properties |  19 ++
 .../springdslribbonservicecallroutetest.properties |  19 ++
 components/readme.adoc                             |   4 +-
 parent/pom.xml                                     |  20 +-
 .../as2/springboot/AS2ComponentConfiguration.java  |  14 +
 .../GoogleBigQuerySQLComponentConfiguration.java   |  11 +-
 ...GoogleCalendarStreamComponentConfiguration.java |   2 +-
 platforms/spring-boot/spring-boot-dm/pom.xml       |   2 +-
 58 files changed, 2169 insertions(+), 210 deletions(-)
 copy components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/{AS2MessageStructure.java => AS2CompressionAlgorithm.java} (56%)
 rename components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/{ApplicationPkcs7MimeEntity.java => ApplicationPkcs7MimeEnvelopedDataEntity.java} (93%)
 copy components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/{AS2MessageStructure.java => util/CompressionUtils.java} (52%)
 create mode 100644 components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelCommand.java
 create mode 100644 components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelWorkItemHandler.java
 create mode 100644 components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/DeploymentContextCamelCommand.java
 create mode 100644 components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommand.java
 create mode 100644 components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/InOnlyCamelWorkItemHandler.java
 create mode 100644 components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/InOutCamelWorkItemHandler.java
 create mode 100644 components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/CamelWorkItemHandlerIntegrationTests.java
 create mode 100644 components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/DeploymentContextCamelCommandTest.java
 create mode 100644 components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommandTest.java
 create mode 100644 components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/InOnlyCamelWorkItemHandlerTest.java
 create mode 100644 components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/InOutCamelWorkItemHandlerTest.java
 create mode 100644 components/camel-ribbon/src/test/resources/springbeanribbonservicecallroutetest.properties
 create mode 100644 components/camel-ribbon/src/test/resources/springdslribbonpropertiesservicecallroutetest.properties
 create mode 100644 components/camel-ribbon/src/test/resources/springdslribbonservicecallroutetest.properties

Reply | Threaded
Open this post in threaded view
|

[camel] 01/35: CAMEL-12964: Initial import of jBPM CamelWIH and Command.

acosentino
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch sandbox/camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 9a369fa95a3372585f6eeb7f7c0ca4914f53746b
Author: Duncan Doyle <[hidden email]>
AuthorDate: Wed Nov 28 13:50:22 2018 +0100

    CAMEL-12964: Initial import of jBPM CamelWIH and Command.
---
 components/camel-jbpm/pom.xml                      |  27 ++++
 .../component/jbpm/workitem/CamelCommand.java      | 121 ++++++++++++++++++
 .../jbpm/workitem/CamelWorkItemHandler.java        | 137 +++++++++++++++++++++
 .../component/jbpm/workitem/CamelCommandTest.java  | 134 ++++++++++++++++++++
 .../jbpm/workitem/CamelWorkItemHandlerTest.java    | 137 +++++++++++++++++++++
 5 files changed, 556 insertions(+)

diff --git a/components/camel-jbpm/pom.xml b/components/camel-jbpm/pom.xml
index 100bf63..bf0091d 100644
--- a/components/camel-jbpm/pom.xml
+++ b/components/camel-jbpm/pom.xml
@@ -92,6 +92,15 @@
             <optional>true</optional>
         </dependency>
         
+        <!-- jBPM WorkItems -->
+        <dependency>
+         <groupId>org.jbpm</groupId>
+         <artifactId>jbpm-workitems-core</artifactId>
+         <version>${jbpm-version}</version>
+         <scope>provided</scope>
+         <optional>true</optional>
+        </dependency>
+        
         <dependency>
             <groupId>org.jboss.logging</groupId>
             <artifactId>jboss-logging</artifactId>
@@ -128,6 +137,24 @@
             <artifactId>camel-test</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+         <groupId>org.mockito</groupId>
+         <artifactId>mockito-core</artifactId>
+         <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.jbpm</groupId>
+            <artifactId>jbpm-workitems-core</artifactId>
+            <version>${jbpm-version}</version>
+            <type>test-jar</type>
+            <scope>test</scope>
+            <exclusions>
+               <exclusion>
+                   <groupId>xml-apis</groupId>
+                   <artifactId>xml-apis</artifactId>
+               </exclusion>
+            </exclusions>
+        </dependency>
     </dependencies>
 
 </project>
diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/CamelCommand.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/CamelCommand.java
new file mode 100644
index 0000000..80c767e
--- /dev/null
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/CamelCommand.java
@@ -0,0 +1,121 @@
+/**
+ * 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.jbpm.workitem;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.ExchangeBuilder;
+import org.jbpm.services.api.service.ServiceRegistry;
+import org.kie.api.executor.Command;
+import org.kie.api.executor.CommandContext;
+import org.kie.api.executor.ExecutionResults;
+import org.kie.api.runtime.manager.RuntimeManager;
+import org.kie.api.runtime.process.WorkItem;
+import org.kie.internal.runtime.Cacheable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Camel jBPM {@link Command} which allows to call Camel routes with a <code>direct</code> endpoint.
+ * <p/>
+ * The command passes the {@WorkItem} retrieved from the {@link CommandContext} to the route that has a consumer on the endpoint-id
+ * that can be passed with the <code>camel-endpoint-id</code> {@link WorkItem} parameter. E.g. when a the value "myCamelEndpoint" is passed to the
+ * {link WorkItem} via the <code>camel-endpoint-id</code> parameter, this {@link Command} will send the {@link WorkItem} to
+ * the Camel URI <code>direct://myCamelEndpoint</code>.  
+ * <p/>
+ * The body of the result {@link Message} of the invocation is returned via the <code>response</code> parameter. Access to the raw response
+ * {@link Message} is provided via the <code>message</code> parameter. This gives the user access to more advanced fields like message headers
+ * and attachments.  
+ * <p/>
+ * This {@link Command} can be constructed in 2 ways. When using the default constructor, the {link Command} will try to find
+ * the global KIE {@link CamelContext} from the <code>jBPM</code> {@link ServiceRegistry}.
+ * When the {@link RuntimeManager} is passed to the constructor, the {@link Command} will retrieve and use the {@link CamelContext} bound
+ * to the {@link RuntimeManage} from the {@link ServiceRegistry}
+ *
+ */
+public class CamelCommand implements Command,
+                                          Cacheable {
+
+ private static final String GLOBAL_CAMEL_CONTEXT_SERVICE_KEY = "GlobalCamelService";
+ private static final String RUNTIME_CAMEL_CONTEXT_SERVICE_POSTFIX = "_CamelService";
+
+ private static final String CAMEL_ENDPOINT_ID_PARAM = "camel-endpoint-id";
+ private static final String RESPONSE_PARAM = "response";
+ private static final String MESSAGE_PARAM = "out-headers";
+
+
+    private static final Logger logger = LoggerFactory.getLogger(CamelCommand.class);
+
+ private final ProducerTemplate producerTemplate;
+
+
+ public CamelCommand() {
+ CamelContext globalCamelContext = (CamelContext) ServiceRegistry.get().service(GLOBAL_CAMEL_CONTEXT_SERVICE_KEY);
+ // TODO: Should we allow to set the maximumCacheSize on the producer?
+ this.producerTemplate = globalCamelContext.createProducerTemplate();
+ }
+
+ public CamelCommand(RuntimeManager runtimeManager) {
+ String runtimeCamelContextKey = runtimeManager.getIdentifier() + RUNTIME_CAMEL_CONTEXT_SERVICE_POSTFIX;
+ CamelContext runtimeCamelContext = (CamelContext) ServiceRegistry.get().service(runtimeCamelContextKey);
+ // TODO: Should we allow to set the maximumCacheSize on the producer?
+ this.producerTemplate = runtimeCamelContext.createProducerTemplate();
+ }
+
+
+
+    @Override
+    public ExecutionResults execute(CommandContext ctx) throws Exception {
+        
+     WorkItem workItem = (WorkItem) ctx.getData("workItem");
+    
+     String camelEndpointId = (String) workItem.getParameter(CAMEL_ENDPOINT_ID_PARAM);
+
+ // We only support direct. We don't need to support more, as direct simply gives us the entrypoint into the actual Camel Routes.
+ String camelUri = "direct://" + camelEndpointId;
+
+ Exchange inExchange = ExchangeBuilder.anExchange(producerTemplate.getCamelContext()).withBody(workItem).build();
+ Exchange outExchange = producerTemplate.send(camelUri, inExchange);
+ // producerTemplate.send does not throw exceptions, instead they are set on the returned Exchange.
+ if (outExchange.getException() != null) {
+ throw outExchange.getException();
+ }
+ Message outMessage = outExchange.getOut();
+
+ ExecutionResults results = new ExecutionResults();
+ Object response = outMessage.getBody();
+ results.setData(RESPONSE_PARAM, response);
+ results.setData(MESSAGE_PARAM, outMessage);
+    
+        return results;
+    }
+
+    
+ @Override
+ public void close() {
+ try {
+ this.producerTemplate.stop();
+ } catch (Exception e) {
+ logger.warn("Error encountered while closing the Camel Producer Template.", e);
+ // Not much we can do here, so swallowing exception.
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/CamelWorkItemHandler.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/CamelWorkItemHandler.java
new file mode 100644
index 0000000..7734dd9
--- /dev/null
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/CamelWorkItemHandler.java
@@ -0,0 +1,137 @@
+/**
+ * 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.jbpm.workitem;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.ExchangeBuilder;
+import org.jbpm.process.workitem.core.AbstractLogOrThrowWorkItemHandler;
+import org.jbpm.process.workitem.core.util.Wid;
+import org.jbpm.process.workitem.core.util.WidMavenDepends;
+import org.jbpm.process.workitem.core.util.WidParameter;
+import org.jbpm.process.workitem.core.util.WidResult;
+import org.jbpm.process.workitem.core.util.service.WidAction;
+import org.jbpm.process.workitem.core.util.service.WidService;
+import org.jbpm.services.api.service.ServiceRegistry;
+import org.kie.api.runtime.manager.RuntimeManager;
+import org.kie.api.runtime.process.WorkItem;
+import org.kie.api.runtime.process.WorkItemManager;
+import org.kie.internal.runtime.Cacheable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Camel jBPM {@link WorkItemHandler} which allows to call Camel routes with a <code>direct</code> endpoint.
+ * <p/>
+ * The handler passes the {@WorkItem} to the route that has a consumer on the endpoint-id that can be passed with the
+ * <code>camel-endpoint-id</code>{@link WorkItem} parameter. E.g. when a the value "myCamelEndpoint" is passed to the
+ * {link WorkItem} via the <code>camel-endpoint-id</code> parameter, this command will send the {@link WorkItem} to the Camel URI
+ * <code>direct://myCamelEndpoint</code>.
+ * <p/>
+ * The body of the result {@link Message} of the invocation is returned via the <code>response</code> parameter. Access to the raw response
+ * {@link Message} is provided via the <code>message</code> parameter. This gives the user access to more advanced fields like message
+ * headers and attachments.
+ * <p/>
+ * This handler can be constructed in 2 ways. When using the default constructor, the handler will try to find the global KIE
+ * {@link CamelContext} from the <code>jBPM</code> {@link ServiceRegistry}. When the {@link RuntimeManager} is passed to the constructor,
+ * the handler will retrieve and use the {@link CamelContext} bound to the {@link RuntimeManage} from the {@link ServiceRegistry}
+ *
+ */
+@Wid(widfile = "CamelConnector.wid", name = "CamelConnector", displayName = "CamelConnector", defaultHandler = "mvel: new org.apache.camel.component.jbpm.workitem.CamelWorkitemHandler()", documentation = "${artifactId}/index.html", parameters = {
+ @WidParameter(name = "camel-endpoint-id") }, results = { @WidResult(name = "response"),
+ @WidResult(name = "message") }, mavenDepends = {
+ @WidMavenDepends(group = "${groupId}", artifact = "${artifactId}", version = "${version}") }, serviceInfo = @WidService(category = "${name}", description = "${description}", keywords = "apache,camel,payload,route,connector", action = @WidAction(title = "Send payload to a Camel endpoint")))
+public class CamelWorkItemHandler extends AbstractLogOrThrowWorkItemHandler implements Cacheable {
+
+ private static final String GLOBAL_CAMEL_CONTEXT_SERVICE_KEY = "GlobalCamelService";
+ private static final String RUNTIME_CAMEL_CONTEXT_SERVICE_POSTFIX = "_CamelService";
+
+ private static final String CAMEL_ENDPOINT_ID_PARAM = "camel-endpoint-id";
+ private static final String RESPONSE_PARAM = "response";
+ private static final String MESSAGE_PARAM = "message";
+
+ private static Logger logger = LoggerFactory.getLogger(CamelWorkItemHandler.class);
+
+ private final ProducerTemplate producerTemplate;
+
+ /**
+ * Default Constructor. This creates a {@link ProducerTemplate} for the global {@link CamelContext}.
+ */
+ public CamelWorkItemHandler() {
+ CamelContext globalCamelContext = (CamelContext) ServiceRegistry.get().service(GLOBAL_CAMEL_CONTEXT_SERVICE_KEY);
+ // TODO: Should we allow to set the maximumCacheSize on the producer?
+ this.producerTemplate = globalCamelContext.createProducerTemplate();
+ }
+
+ /**
+ * Constructor which accepts {@link RuntimeManager}. This causes this WorkItemHanlder to create a {@link ProducerTemplate} for the
+ * runtime specific {@link CamelContext}.
+ */
+ public CamelWorkItemHandler(RuntimeManager runtimeManager) {
+ String runtimeCamelContextKey = runtimeManager.getIdentifier() + RUNTIME_CAMEL_CONTEXT_SERVICE_POSTFIX;
+ CamelContext runtimeCamelContext = (CamelContext) ServiceRegistry.get().service(runtimeCamelContextKey);
+ // TODO: Should we allow to set the maximumCacheSize on the producer?
+ this.producerTemplate = runtimeCamelContext.createProducerTemplate();
+ }
+
+ public void executeWorkItem(WorkItem workItem, final WorkItemManager manager) {
+
+ String camelEndpointId = (String) workItem.getParameter(CAMEL_ENDPOINT_ID_PARAM);
+
+ // We only support direct. We don't need to support more, as direct simply gives us the entrypoint into the actual Camel Routes.
+ String camelUri = "direct://" + camelEndpointId;
+ try {
+ Exchange inExchange = ExchangeBuilder.anExchange(producerTemplate.getCamelContext()).withBody(workItem).build();
+ Exchange outExchange = producerTemplate.send(camelUri, inExchange);
+ // producerTemplate.send does not throw exceptions, instead they are set on the returned Exchange.
+ if (outExchange.getException() != null) {
+ throw outExchange.getException();
+ }
+ Message outMessage = outExchange.getOut();
+
+ Map<String, Object> result = new HashMap<>();
+ Object response = outMessage.getBody();
+ result.put(RESPONSE_PARAM, response);
+ result.put(MESSAGE_PARAM, outMessage);
+
+ manager.completeWorkItem(workItem.getId(), result);
+ } catch (Exception e) {
+ handleException(e);
+ }
+ }
+
+ public void abortWorkItem(WorkItem workItem, WorkItemManager manager) {
+ // Do nothing, cannot be aborted
+ }
+
+ @Override
+ public void close() {
+ try {
+ this.producerTemplate.stop();
+ } catch (Exception e) {
+ logger.warn("Error encountered while closing the Camel Producer Template.", e);
+ // Not much we can do here, so swallowing exception.
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/CamelCommandTest.java b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/CamelCommandTest.java
new file mode 100644
index 0000000..543b833
--- /dev/null
+++ b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/CamelCommandTest.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2018 Red Hat, Inc. and/or its affiliates.
+ *
+ * Licensed 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.jbpm.workitem;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
+import static org.mockito.ArgumentMatchers.any;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.ProducerTemplate;
+import org.drools.core.process.instance.impl.WorkItemImpl;
+import org.jbpm.services.api.service.ServiceRegistry;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.kie.api.executor.CommandContext;
+import org.kie.api.executor.ExecutionResults;
+import org.kie.api.runtime.manager.RuntimeManager;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+
+@RunWith(MockitoJUnitRunner.class)
+public class CamelCommandTest {
+
+ @Mock
+    ProducerTemplate producerTemplate;
+
+    @Mock
+    Exchange outExchange;
+    
+    @Mock
+    Message outMessage;
+    
+    @Mock
+    CamelContext camelContext;
+    
+    @Mock
+    RuntimeManager runtimeManager;
+    
+    @Mock
+    CommandContext commandContext;
+
+    @Test
+    public void testExecuteComamnd() throws Exception {
+    
+     String camelEndpointId = "testCamelRoute";
+     String camelRouteUri = "direct://" + camelEndpointId;
+    
+     String testReponse = "testResponse";
+    
+     String runtimeManagerId = "testRuntimeManager";
+    
+     when(producerTemplate.send(eq(camelRouteUri), any(Exchange.class))).thenReturn(outExchange);
+    
+    
+     when(producerTemplate.getCamelContext()).thenReturn(camelContext);
+    
+     when(camelContext.createProducerTemplate()).thenReturn(producerTemplate);
+    
+     when(outExchange.getOut()).thenReturn(outMessage);
+     when(outMessage.getBody()).thenReturn(testReponse);
+    
+     //Register the RuntimeManager bound camelcontext.
+     ServiceRegistry.get().register("GlobalCamelService", camelContext);
+    
+        WorkItemImpl workItem = new WorkItemImpl();
+        workItem.setParameter("camel-endpoint-id", camelEndpointId);
+        workItem.setParameter("request", "someRequest");
+        
+        when(commandContext.getData(anyString())).thenReturn(workItem);
+        
+        CamelCommand command = new CamelCommand();
+        ExecutionResults results = command.execute(commandContext);
+        
+        
+        assertNotNull(results);
+        assertEquals(2, results.getData().size());
+        assertEquals(testReponse, results.getData().get("response"));
+    }
+    
+    
+    @Test
+    public void testExecuteCommandLocalCamelContext() throws Exception {
+    
+     String camelEndpointId = "testCamelRoute";
+     String camelRouteUri = "direct://" + camelEndpointId;
+    
+     String testReponse = "testResponse";
+    
+     String runtimeManagerId = "testRuntimeManager";
+    
+     when(runtimeManager.getIdentifier()).thenReturn(runtimeManagerId);
+    
+     when(producerTemplate.send(eq(camelRouteUri), any(Exchange.class))).thenReturn(outExchange);
+     //when(producerTemplate.send(argThat(not(camelRouteUri)), any(Exchange.class))).thenThrow(new IllegalArgumentException("Unexpected route id"));
+     when(producerTemplate.getCamelContext()).thenReturn(camelContext);
+    
+     when(camelContext.createProducerTemplate()).thenReturn(producerTemplate);
+    
+     when(outExchange.getOut()).thenReturn(outMessage);
+     when(outMessage.getBody()).thenReturn(testReponse);
+    
+     //Register the RuntimeManager bound camelcontext.
+     ServiceRegistry.get().register(runtimeManagerId + "_CamelService", camelContext);
+    
+        WorkItemImpl workItem = new WorkItemImpl();
+        workItem.setParameter("camel-endpoint-id", camelEndpointId);
+        workItem.setParameter("request", "someRequest");
+        
+        when(commandContext.getData(anyString())).thenReturn(workItem);
+        
+        CamelCommand command = new CamelCommand(runtimeManager);
+        ExecutionResults results = command.execute(commandContext);
+        
+        assertNotNull(results);
+        assertEquals(2, results.getData().size());
+        assertEquals(testReponse, results.getData().get("response"));
+    }
+
+}
diff --git a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/CamelWorkItemHandlerTest.java b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/CamelWorkItemHandlerTest.java
new file mode 100644
index 0000000..7872132
--- /dev/null
+++ b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/CamelWorkItemHandlerTest.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2018 Red Hat, Inc. and/or its affiliates.
+ *
+ * Licensed 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.jbpm.workitem;
+
+import static org.junit.Assert.*;
+import static org.mockito.ArgumentMatchers.*;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.*;
+
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.ProducerTemplate;
+import org.drools.core.process.instance.impl.WorkItemImpl;
+import org.jbpm.process.workitem.core.TestWorkItemManager;
+import org.jbpm.services.api.service.ServiceRegistry;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.kie.api.runtime.manager.RuntimeManager;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+
+@RunWith(MockitoJUnitRunner.class)
+public class CamelWorkItemHandlerTest {
+
+    @Mock
+    ProducerTemplate producerTemplate;
+
+    @Mock
+    Exchange outExchange;
+    
+    @Mock
+    Message outMessage;
+    
+    @Mock
+    CamelContext camelContext;
+    
+    @Mock
+    RuntimeManager runtimeManager;
+
+    @Test
+    public void testExecuteGlobalCamelContext() throws Exception {
+    
+     String camelEndpointId = "testCamelRoute";
+     String camelRouteUri = "direct://" + camelEndpointId;
+    
+     String testReponse = "testResponse";
+    
+     when(producerTemplate.send(eq(camelRouteUri), any(Exchange.class))).thenReturn(outExchange);
+     when(producerTemplate.getCamelContext()).thenReturn(camelContext);
+    
+     when(camelContext.createProducerTemplate()).thenReturn(producerTemplate);
+    
+     when(outExchange.getOut()).thenReturn(outMessage);
+     when(outMessage.getBody()).thenReturn(testReponse);
+    
+     ServiceRegistry.get().register("GlobalCamelService", camelContext);
+    
+    
+        TestWorkItemManager manager = new TestWorkItemManager();
+        WorkItemImpl workItem = new WorkItemImpl();
+        workItem.setParameter("camel-endpoint-id", camelEndpointId);
+        workItem.setParameter("request", "someRequest");
+        
+        CamelWorkItemHandler handler = new CamelWorkItemHandler();
+        
+        handler.executeWorkItem(workItem,
+                                manager);
+        assertNotNull(manager.getResults());
+        assertEquals(1,
+                     manager.getResults().size());
+        assertTrue(manager.getResults().containsKey(workItem.getId()));
+        Map<String, Object> results = manager.getResults(workItem.getId());
+        assertEquals(2, results.size());
+        assertEquals(testReponse, results.get("response"));
+    }
+    
+    @Test
+    public void testExecuteLocalCamelContext() throws Exception {
+    
+     String camelEndpointId = "testCamelRoute";
+     String camelRouteUri = "direct://" + camelEndpointId;
+    
+     String testReponse = "testResponse";
+    
+     String runtimeManagerId = "testRuntimeManager";
+    
+     when(runtimeManager.getIdentifier()).thenReturn(runtimeManagerId);
+    
+     when(producerTemplate.send(eq(camelRouteUri), any(Exchange.class))).thenReturn(outExchange);
+       when(producerTemplate.getCamelContext()).thenReturn(camelContext);
+    
+     when(camelContext.createProducerTemplate()).thenReturn(producerTemplate);
+    
+     when(outExchange.getOut()).thenReturn(outMessage);
+     when(outMessage.getBody()).thenReturn(testReponse);
+    
+     //Register the RuntimeManager bound camelcontext.
+     ServiceRegistry.get().register(runtimeManagerId + "_CamelService", camelContext);
+    
+    
+        WorkItemImpl workItem = new WorkItemImpl();
+        workItem.setParameter("camel-endpoint-id", camelEndpointId);
+        workItem.setParameter("request", "someRequest");
+        
+        CamelWorkItemHandler handler = new CamelWorkItemHandler(runtimeManager);
+        
+        TestWorkItemManager manager = new TestWorkItemManager();
+        handler.executeWorkItem(workItem,
+                                manager);
+        assertNotNull(manager.getResults());
+        assertEquals(1,
+                     manager.getResults().size());
+        assertTrue(manager.getResults().containsKey(workItem.getId()));
+        Map<String, Object> results = manager.getResults(workItem.getId());
+        assertEquals(2, results.size());
+        assertEquals(testReponse, results.get("response"));
+    }
+
+
+}

Reply | Threaded
Open this post in threaded view
|

[camel] 02/35: CamelCommand splitted in a separate command for Camel DeploymentContext and GlobalContext. WorkItemHandler can now be configured with default route. WIH supports both InOut and InOnly MEPs. Added tests that use a test CamelContext and test-routes to verify behaviour on Exceptions.

acosentino
In reply to this post by acosentino
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch sandbox/camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 9ecf4a9b89b1a0c6cd1fe5a11ce76dd5fe3610c6
Author: Duncan Doyle <[hidden email]>
AuthorDate: Thu Nov 29 15:02:15 2018 +0100

    CamelCommand splitted in a separate command for Camel DeploymentContext and GlobalContext. WorkItemHandler can now be configured with default route. WIH supports both InOut and InOnly MEPs. Added tests that use a test CamelContext and test-routes to verify behaviour on Exceptions.
---
 ...CamelCommand.java => AbstractCamelCommand.java} |  46 +----
 .../workitem/AbstractCamelWorkItemHandler.java     | 156 ++++++++++++++++
 .../jbpm/workitem/CamelWorkItemHandler.java        | 137 --------------
 .../workitem/DeploymentContextCamelCommand.java    |  73 ++++++++
 .../jbpm/workitem/GlobalContextCamelCommand.java   |  60 ++++++
 .../jbpm/workitem/InOnlyCamelWorkItemHandler.java  | 106 +++++++++++
 .../jbpm/workitem/InOutCamelWorkItemHandler.java   | 119 ++++++++++++
 .../CamelWorkItemHandlerIntegrationTests.java      | 204 +++++++++++++++++++++
 .../jbpm/workitem/CamelWorkItemHandlerTest.java    | 137 --------------
 .../DeploymentContextCamelCommandTest.java         |  95 ++++++++++
 ...est.java => GlobalContextCamelCommandTest.java} |  65 ++-----
 .../workitem/InOnlyCamelWorkItemHandlerTest.java   |  97 ++++++++++
 .../workitem/InOutCamelWorkItemHandlerTest.java    | 147 +++++++++++++++
 13 files changed, 1078 insertions(+), 364 deletions(-)

diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/CamelCommand.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelCommand.java
similarity index 68%
rename from components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/CamelCommand.java
rename to components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelCommand.java
index 80c767e..3cb1ee4 100644
--- a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/CamelCommand.java
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelCommand.java
@@ -42,48 +42,24 @@ import org.slf4j.LoggerFactory;
  * <p/>
  * The body of the result {@link Message} of the invocation is returned via the <code>response</code> parameter. Access to the raw response
  * {@link Message} is provided via the <code>message</code> parameter. This gives the user access to more advanced fields like message headers
- * and attachments.  
- * <p/>
- * This {@link Command} can be constructed in 2 ways. When using the default constructor, the {link Command} will try to find
- * the global KIE {@link CamelContext} from the <code>jBPM</code> {@link ServiceRegistry}.
- * When the {@link RuntimeManager} is passed to the constructor, the {@link Command} will retrieve and use the {@link CamelContext} bound
- * to the {@link RuntimeManage} from the {@link ServiceRegistry}
- *
+ * and attachments.
  */
-public class CamelCommand implements Command,
+public abstract class AbstractCamelCommand implements Command,
                                           Cacheable {
 
- private static final String GLOBAL_CAMEL_CONTEXT_SERVICE_KEY = "GlobalCamelService";
- private static final String RUNTIME_CAMEL_CONTEXT_SERVICE_POSTFIX = "_CamelService";
-
  private static final String CAMEL_ENDPOINT_ID_PARAM = "camel-endpoint-id";
  private static final String RESPONSE_PARAM = "response";
  private static final String MESSAGE_PARAM = "out-headers";
-
 
-    private static final Logger logger = LoggerFactory.getLogger(CamelCommand.class);
-
- private final ProducerTemplate producerTemplate;
+    private static final Logger logger = LoggerFactory.getLogger(AbstractCamelCommand.class);
 
-
- public CamelCommand() {
- CamelContext globalCamelContext = (CamelContext) ServiceRegistry.get().service(GLOBAL_CAMEL_CONTEXT_SERVICE_KEY);
- // TODO: Should we allow to set the maximumCacheSize on the producer?
- this.producerTemplate = globalCamelContext.createProducerTemplate();
- }
-
- public CamelCommand(RuntimeManager runtimeManager) {
- String runtimeCamelContextKey = runtimeManager.getIdentifier() + RUNTIME_CAMEL_CONTEXT_SERVICE_POSTFIX;
- CamelContext runtimeCamelContext = (CamelContext) ServiceRegistry.get().service(runtimeCamelContextKey);
- // TODO: Should we allow to set the maximumCacheSize on the producer?
- this.producerTemplate = runtimeCamelContext.createProducerTemplate();
+ public AbstractCamelCommand() {
  }
 
-
-
     @Override
     public ExecutionResults execute(CommandContext ctx) throws Exception {
         
+        
      WorkItem workItem = (WorkItem) ctx.getData("workItem");
     
      String camelEndpointId = (String) workItem.getParameter(CAMEL_ENDPOINT_ID_PARAM);
@@ -91,6 +67,7 @@ public class CamelCommand implements Command,
  // We only support direct. We don't need to support more, as direct simply gives us the entrypoint into the actual Camel Routes.
  String camelUri = "direct://" + camelEndpointId;
 
+ ProducerTemplate producerTemplate = getProducerTemplate(ctx);
  Exchange inExchange = ExchangeBuilder.anExchange(producerTemplate.getCamelContext()).withBody(workItem).build();
  Exchange outExchange = producerTemplate.send(camelUri, inExchange);
  // producerTemplate.send does not throw exceptions, instead they are set on the returned Exchange.
@@ -106,16 +83,7 @@ public class CamelCommand implements Command,
     
         return results;
     }
-
     
- @Override
- public void close() {
- try {
- this.producerTemplate.stop();
- } catch (Exception e) {
- logger.warn("Error encountered while closing the Camel Producer Template.", e);
- // Not much we can do here, so swallowing exception.
- }
- }
+    protected abstract ProducerTemplate getProducerTemplate(CommandContext ctx);
 
 }
\ No newline at end of file
diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelWorkItemHandler.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelWorkItemHandler.java
new file mode 100644
index 0000000..db88e70
--- /dev/null
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelWorkItemHandler.java
@@ -0,0 +1,156 @@
+/**
+ * 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.jbpm.workitem;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.ProducerTemplate;
+import org.jbpm.process.workitem.core.AbstractLogOrThrowWorkItemHandler;
+import org.jbpm.services.api.service.ServiceRegistry;
+import org.kie.api.runtime.manager.RuntimeManager;
+import org.kie.api.runtime.process.WorkItem;
+import org.kie.api.runtime.process.WorkItemHandler;
+import org.kie.api.runtime.process.WorkItemManager;
+import org.kie.internal.runtime.Cacheable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Camel jBPM {@link WorkItemHandler} which allows to call Camel routes with a <code>direct</code> endpoint.
+ * <p/>
+ * The handler passes the {@WorkItem} to the route that has a consumer on the endpoint-id that can be passed with the
+ * <code>camel-endpoint-id</code>{@link WorkItem} parameter. E.g. when a the value "myCamelEndpoint" is passed to the {link WorkItem} via
+ * the <code>camel-endpoint-id</code> parameter, this command will send the {@link WorkItem} to the Camel URI
+ * <code>direct://myCamelEndpoint</code>.
+ * <p/>
+ * The body of the result {@link Message} of the invocation is returned via the <code>response</code> parameter. Access to the raw response
+ * {@link Message} is provided via the <code>message</code> parameter. This gives the user access to more advanced fields like message
+ * headers and attachments.
+ * <p/>
+ * This handler can be constructed in multiple ways. When you don't pass a {@link RuntimeManager} to the constructor, the handler will try
+ * to find the global KIE {@link CamelContext} from the <code>jBPM</code> {@link ServiceRegistry}. When the {@link RuntimeManager} is passed
+ * to the constructor, the handler will retrieve and use the {@link CamelContext} bound to the {@link RuntimeManage} from the
+ * {@link ServiceRegistry}. When a <code>camel-endpoint-id</code> is passed to the constructor, the handler will send all requests to the
+ * Camel route that is consuming from that endpoint, unless the endpoint is overridden by passing a the <code>camel-endpoint-id</code> in
+ * the {@link WorkItem} parameters.
+ *
+ */
+public abstract class AbstractCamelWorkItemHandler extends AbstractLogOrThrowWorkItemHandler implements Cacheable {
+
+    private static final String GLOBAL_CAMEL_CONTEXT_SERVICE_KEY = "GlobalCamelService";
+    private static final String RUNTIME_CAMEL_CONTEXT_SERVICE_POSTFIX = "_CamelService";
+
+    private static final String CAMEL_ENDPOINT_ID_PARAM = "camel-endpoint-id";
+
+    private static Logger logger = LoggerFactory.getLogger(AbstractCamelWorkItemHandler.class);
+
+    private final ProducerTemplate producerTemplate;
+
+    private final String camelEndpointId;
+
+    /**
+     * Default Constructor. This creates a {@link ProducerTemplate} for the global {@link CamelContext}.
+     */
+    public AbstractCamelWorkItemHandler() {
+        this("");
+    }
+
+    public AbstractCamelWorkItemHandler(String camelEndointId) {
+        CamelContext globalCamelContext = (CamelContext) ServiceRegistry.get().service(GLOBAL_CAMEL_CONTEXT_SERVICE_KEY);
+        // TODO: Should we allow to set the maximumCacheSize on the producer?
+        this.producerTemplate = globalCamelContext.createProducerTemplate();
+        this.camelEndpointId = camelEndointId;
+    }
+
+    /**
+     * Constructor which accepts {@link RuntimeManager}. This causes this WorkItemHanlder to create a {@link ProducerTemplate} for the
+     * runtime specific {@link CamelContext}.
+     */
+    public AbstractCamelWorkItemHandler(RuntimeManager runtimeManager) {
+        this(runtimeManager, "");
+    }
+
+    public AbstractCamelWorkItemHandler(RuntimeManager runtimeManager, String camelEndpointId) {
+        String runtimeCamelContextKey = runtimeManager.getIdentifier() + RUNTIME_CAMEL_CONTEXT_SERVICE_POSTFIX;
+        CamelContext runtimeCamelContext = (CamelContext) ServiceRegistry.get().service(runtimeCamelContextKey);
+        // TODO: Should we allow to set the maximumCacheSize on the producer?
+        this.producerTemplate = runtimeCamelContext.createProducerTemplate();
+        this.camelEndpointId = camelEndpointId;
+    }
+
+    public void executeWorkItem(WorkItem workItem, final WorkItemManager manager) {
+
+        String workItemCamelEndpointId = getCamelEndpointId(workItem);
+
+        // We only support direct. We don't need to support more, as direct simply gives us the entrypoint into the actual Camel Routes.
+        String camelUri = "direct://" + workItemCamelEndpointId;
+
+        try {
+            Exchange requestExchange = buildExchange(producerTemplate, workItem);
+            logger.debug("Sending Camel Exchange to: " + camelUri);
+            Exchange responseExchange = producerTemplate.send(camelUri, requestExchange);
+            // producerTemplate.send does not throw exceptions, instead they are set on the returned Exchange.
+            if (responseExchange.getException() != null) {
+                throw responseExchange.getException();
+            }
+            handleResponse(responseExchange, workItem, manager);
+        } catch (Exception e) {
+            handleException(e);
+        }
+    }
+
+    private String getCamelEndpointId(WorkItem workItem) {
+        String workItemCamelEndpointId = (String) workItem.getParameter(CAMEL_ENDPOINT_ID_PARAM);
+
+        if (camelEndpointId != null && !camelEndpointId.isEmpty()) {
+            if (workItemCamelEndpointId != null && !workItemCamelEndpointId.isEmpty()) {
+                logger.debug(
+                        "The Camel Endpoint ID has been set on both the WorkItemHanlder and WorkItem. The camel-endpoint-id configured on the WorkItem overrides the global configuation.");
+            } else {
+                workItemCamelEndpointId = camelEndpointId;
+            }
+        }
+
+        if (workItemCamelEndpointId == null || workItemCamelEndpointId.isEmpty()) {
+            throw new IllegalArgumentException(
+                    "No Camel Endpoint ID specified. Please configure the 'camel-endpoint-id' in either the constructor of this WorkItemHandler, or pass it via the "
+                            + CAMEL_ENDPOINT_ID_PARAM + "' WorkItem parameter.");
+        }
+        return workItemCamelEndpointId;
+    }
+
+    protected abstract void handleResponse(Exchange responseExchange, WorkItem workItem, WorkItemManager manager);
+
+    protected abstract Exchange buildExchange(ProducerTemplate template, WorkItem workItem);
+
+    public void abortWorkItem(WorkItem workItem, WorkItemManager manager) {
+        // Do nothing, cannot be aborted
+    }
+
+    @Override
+    public void close() {
+        try {
+            this.producerTemplate.stop();
+        } catch (Exception e) {
+            logger.warn("Error encountered while closing the Camel Producer Template.", e);
+            // Not much we can do here, so swallowing exception.
+        }
+    }
+
+}
\ No newline at end of file
diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/CamelWorkItemHandler.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/CamelWorkItemHandler.java
deleted file mode 100644
index 7734dd9..0000000
--- a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/CamelWorkItemHandler.java
+++ /dev/null
@@ -1,137 +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.jbpm.workitem;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.Exchange;
-import org.apache.camel.Message;
-import org.apache.camel.ProducerTemplate;
-import org.apache.camel.builder.ExchangeBuilder;
-import org.jbpm.process.workitem.core.AbstractLogOrThrowWorkItemHandler;
-import org.jbpm.process.workitem.core.util.Wid;
-import org.jbpm.process.workitem.core.util.WidMavenDepends;
-import org.jbpm.process.workitem.core.util.WidParameter;
-import org.jbpm.process.workitem.core.util.WidResult;
-import org.jbpm.process.workitem.core.util.service.WidAction;
-import org.jbpm.process.workitem.core.util.service.WidService;
-import org.jbpm.services.api.service.ServiceRegistry;
-import org.kie.api.runtime.manager.RuntimeManager;
-import org.kie.api.runtime.process.WorkItem;
-import org.kie.api.runtime.process.WorkItemManager;
-import org.kie.internal.runtime.Cacheable;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Camel jBPM {@link WorkItemHandler} which allows to call Camel routes with a <code>direct</code> endpoint.
- * <p/>
- * The handler passes the {@WorkItem} to the route that has a consumer on the endpoint-id that can be passed with the
- * <code>camel-endpoint-id</code>{@link WorkItem} parameter. E.g. when a the value "myCamelEndpoint" is passed to the
- * {link WorkItem} via the <code>camel-endpoint-id</code> parameter, this command will send the {@link WorkItem} to the Camel URI
- * <code>direct://myCamelEndpoint</code>.
- * <p/>
- * The body of the result {@link Message} of the invocation is returned via the <code>response</code> parameter. Access to the raw response
- * {@link Message} is provided via the <code>message</code> parameter. This gives the user access to more advanced fields like message
- * headers and attachments.
- * <p/>
- * This handler can be constructed in 2 ways. When using the default constructor, the handler will try to find the global KIE
- * {@link CamelContext} from the <code>jBPM</code> {@link ServiceRegistry}. When the {@link RuntimeManager} is passed to the constructor,
- * the handler will retrieve and use the {@link CamelContext} bound to the {@link RuntimeManage} from the {@link ServiceRegistry}
- *
- */
-@Wid(widfile = "CamelConnector.wid", name = "CamelConnector", displayName = "CamelConnector", defaultHandler = "mvel: new org.apache.camel.component.jbpm.workitem.CamelWorkitemHandler()", documentation = "${artifactId}/index.html", parameters = {
- @WidParameter(name = "camel-endpoint-id") }, results = { @WidResult(name = "response"),
- @WidResult(name = "message") }, mavenDepends = {
- @WidMavenDepends(group = "${groupId}", artifact = "${artifactId}", version = "${version}") }, serviceInfo = @WidService(category = "${name}", description = "${description}", keywords = "apache,camel,payload,route,connector", action = @WidAction(title = "Send payload to a Camel endpoint")))
-public class CamelWorkItemHandler extends AbstractLogOrThrowWorkItemHandler implements Cacheable {
-
- private static final String GLOBAL_CAMEL_CONTEXT_SERVICE_KEY = "GlobalCamelService";
- private static final String RUNTIME_CAMEL_CONTEXT_SERVICE_POSTFIX = "_CamelService";
-
- private static final String CAMEL_ENDPOINT_ID_PARAM = "camel-endpoint-id";
- private static final String RESPONSE_PARAM = "response";
- private static final String MESSAGE_PARAM = "message";
-
- private static Logger logger = LoggerFactory.getLogger(CamelWorkItemHandler.class);
-
- private final ProducerTemplate producerTemplate;
-
- /**
- * Default Constructor. This creates a {@link ProducerTemplate} for the global {@link CamelContext}.
- */
- public CamelWorkItemHandler() {
- CamelContext globalCamelContext = (CamelContext) ServiceRegistry.get().service(GLOBAL_CAMEL_CONTEXT_SERVICE_KEY);
- // TODO: Should we allow to set the maximumCacheSize on the producer?
- this.producerTemplate = globalCamelContext.createProducerTemplate();
- }
-
- /**
- * Constructor which accepts {@link RuntimeManager}. This causes this WorkItemHanlder to create a {@link ProducerTemplate} for the
- * runtime specific {@link CamelContext}.
- */
- public CamelWorkItemHandler(RuntimeManager runtimeManager) {
- String runtimeCamelContextKey = runtimeManager.getIdentifier() + RUNTIME_CAMEL_CONTEXT_SERVICE_POSTFIX;
- CamelContext runtimeCamelContext = (CamelContext) ServiceRegistry.get().service(runtimeCamelContextKey);
- // TODO: Should we allow to set the maximumCacheSize on the producer?
- this.producerTemplate = runtimeCamelContext.createProducerTemplate();
- }
-
- public void executeWorkItem(WorkItem workItem, final WorkItemManager manager) {
-
- String camelEndpointId = (String) workItem.getParameter(CAMEL_ENDPOINT_ID_PARAM);
-
- // We only support direct. We don't need to support more, as direct simply gives us the entrypoint into the actual Camel Routes.
- String camelUri = "direct://" + camelEndpointId;
- try {
- Exchange inExchange = ExchangeBuilder.anExchange(producerTemplate.getCamelContext()).withBody(workItem).build();
- Exchange outExchange = producerTemplate.send(camelUri, inExchange);
- // producerTemplate.send does not throw exceptions, instead they are set on the returned Exchange.
- if (outExchange.getException() != null) {
- throw outExchange.getException();
- }
- Message outMessage = outExchange.getOut();
-
- Map<String, Object> result = new HashMap<>();
- Object response = outMessage.getBody();
- result.put(RESPONSE_PARAM, response);
- result.put(MESSAGE_PARAM, outMessage);
-
- manager.completeWorkItem(workItem.getId(), result);
- } catch (Exception e) {
- handleException(e);
- }
- }
-
- public void abortWorkItem(WorkItem workItem, WorkItemManager manager) {
- // Do nothing, cannot be aborted
- }
-
- @Override
- public void close() {
- try {
- this.producerTemplate.stop();
- } catch (Exception e) {
- logger.warn("Error encountered while closing the Camel Producer Template.", e);
- // Not much we can do here, so swallowing exception.
- }
- }
-
-}
\ No newline at end of file
diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/DeploymentContextCamelCommand.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/DeploymentContextCamelCommand.java
new file mode 100644
index 0000000..e3d3fd1
--- /dev/null
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/DeploymentContextCamelCommand.java
@@ -0,0 +1,73 @@
+/**
+ * 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.jbpm.workitem;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ProducerTemplate;
+import org.jbpm.services.api.service.ServiceRegistry;
+import org.kie.api.executor.CommandContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * CamelCommand that uses the {@link CamelContext} registered on the {@link ServiceRegistry} for this specific deployment.
+ */
+public class DeploymentContextCamelCommand extends AbstractCamelCommand {
+
+    private static final String RUNTIME_CAMEL_CONTEXT_SERVICE_POSTFIX = "_CamelService";
+
+    private final Map<String, ProducerTemplate> templates = new ConcurrentHashMap<>();
+
+    private static final Logger logger = LoggerFactory.getLogger(DeploymentContextCamelCommand.class);
+
+    @Override
+    protected ProducerTemplate getProducerTemplate(CommandContext ctx) {
+        String deploymentId = (String) ctx.getData("deploymentId");
+        ProducerTemplate template = templates.get(deploymentId);
+
+        if (template == null) {
+            synchronized (this) {
+                template = templates.get(deploymentId);
+                if (template == null) {
+                    CamelContext deploymentCamelContext = (CamelContext) ServiceRegistry.get()
+                            .service(deploymentId + RUNTIME_CAMEL_CONTEXT_SERVICE_POSTFIX);
+                    template = deploymentCamelContext.createProducerTemplate();
+                    templates.put(deploymentId, template);
+                }
+            }
+        }
+        return template;
+    }
+
+    @Override
+    public void close() {
+        for (ProducerTemplate nextTemplate : templates.values()) {
+            try {
+                nextTemplate.stop();
+            } catch (Exception e) {
+                logger.warn("Error encountered while closing the Camel Producer Template.", e);
+                // Not much we can do here, so swallowing exception.
+            }
+        }
+
+    }
+
+}
diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommand.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommand.java
new file mode 100644
index 0000000..974b896
--- /dev/null
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommand.java
@@ -0,0 +1,60 @@
+/**
+ * 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.jbpm.workitem;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ProducerTemplate;
+import org.jbpm.services.api.service.ServiceRegistry;
+import org.kie.api.executor.CommandContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * CamelCommand that uses the global {@link CamelContext} registered on the {@link ServiceRegistry}.
+ */
+public class GlobalContextCamelCommand extends AbstractCamelCommand {
+
+    private static final String GLOBAL_CAMEL_CONTEXT_SERVICE_KEY = "GlobalCamelService";
+    
+    private final ProducerTemplate globalContextProducerTemplate;
+    
+    private static final Logger logger = LoggerFactory.getLogger(GlobalContextCamelCommand.class);
+    
+    public GlobalContextCamelCommand() {
+        CamelContext globalCamelContext = (CamelContext) ServiceRegistry.get().service(GLOBAL_CAMEL_CONTEXT_SERVICE_KEY);
+        // TODO: Should we allow to set the maximumCacheSize on the producer?
+        this.globalContextProducerTemplate = globalCamelContext.createProducerTemplate();
+    }
+    
+    @Override
+    protected ProducerTemplate getProducerTemplate(CommandContext ctx) {
+        return globalContextProducerTemplate;
+    }
+    
+    @Override
+    public void close() {
+        try {
+            this.globalContextProducerTemplate.stop();
+        } catch (Exception e) {
+            logger.warn("Error encountered while closing the Camel Producer Template.", e);
+            // Not much we can do here, so swallowing exception.
+        }
+    }
+    
+
+}
diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/InOnlyCamelWorkItemHandler.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/InOnlyCamelWorkItemHandler.java
new file mode 100644
index 0000000..0588c02
--- /dev/null
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/InOnlyCamelWorkItemHandler.java
@@ -0,0 +1,106 @@
+/**
+ * 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.jbpm.workitem;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePattern;
+import org.apache.camel.Message;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.ExchangeBuilder;
+import org.drools.core.process.instance.impl.WorkItemImpl;
+import org.jbpm.process.workitem.core.util.Wid;
+import org.jbpm.process.workitem.core.util.WidMavenDepends;
+import org.jbpm.process.workitem.core.util.WidParameter;
+import org.jbpm.process.workitem.core.util.WidResult;
+import org.jbpm.process.workitem.core.util.service.WidAction;
+import org.jbpm.process.workitem.core.util.service.WidService;
+import org.kie.api.runtime.manager.RuntimeManager;
+import org.kie.api.runtime.process.WorkItem;
+import org.kie.api.runtime.process.WorkItemHandler;
+import org.kie.api.runtime.process.WorkItemManager;
+
+/**
+ * Camel jBPM {@link WorkItemHandler} that sends {@link Exchange Exchanges} with an <code>InOnly</code> Message Exchange Pattern.
+ * <p/>
+ * This handler does <b>NOT<b/> complete the {@link WorkItem}, and will not parse any response from the Camel route, other than possible exceptions.
+ * The use-case for this handler is asynchronous, one-way, communication, where an external party is responsible for completing the
+ * {@link WorkItem} at a later point in time.
+ * <p/>
+ * The handler creates a Camel Exchange and sets the {@link WorkItem} as the body of the {@link Message}. Furthermore, the following message
+ * headers are set:
+ * <ul>
+ * <li>deploymentId</li>
+ * <li>processInstanceId</li>
+ * <li>workItemId</li>
+ * </ul>
+ */
+@Wid(
+        widfile = "InOnlyCamelConnector.wid",
+        name = "InOnlyCamelConnector",
+        displayName = "InOnlyCamelConnector",
+        defaultHandler = "mvel: new org.apache.camel.component.jbpm.workitem.InOnlyCamelWorkitemHandler()",
+        documentation = "${artifactId}/index.html",
+        parameters = {
+                @WidParameter(name = "camel-endpoint-id")
+        },
+        results = {
+                @WidResult(name = "response"),
+                @WidResult(name = "message") },
+        mavenDepends = {
+                @WidMavenDepends(group = "${groupId}",
+                        artifact = "${artifactId}",
+                        version = "${version}")
+        },
+        serviceInfo = @WidService(category = "${name}",
+                description = "${description}",
+                keywords = "apache,camel,payload,route,connector",
+                action = @WidAction(title = "Send payload to a Camel endpoint")))
+public class InOnlyCamelWorkItemHandler extends AbstractCamelWorkItemHandler {
+
+    public InOnlyCamelWorkItemHandler() {
+        super();
+    }
+
+    public InOnlyCamelWorkItemHandler(String camelEndpointId) {
+        super(camelEndpointId);
+    }
+
+    public InOnlyCamelWorkItemHandler(RuntimeManager runtimeManager) {
+        super(runtimeManager);
+    }
+
+    public InOnlyCamelWorkItemHandler(RuntimeManager runtimeManager, String camelEndpointId) {
+        super(runtimeManager, camelEndpointId);
+    }
+
+    @Override
+    protected void handleResponse(Exchange responseExchange, WorkItem workItem, WorkItemManager manager) {
+        // no-op. There is no response for InOnly, so need to handle anything
+    }
+
+    @Override
+    protected Exchange buildExchange(ProducerTemplate template, WorkItem workItem) {
+        return ExchangeBuilder.anExchange(template.getCamelContext())
+                .withPattern(ExchangePattern.InOnly)
+                .withHeader("deploymentId", ((WorkItemImpl) workItem).getDeploymentId())
+                .withHeader("processInstanceId", workItem.getProcessInstanceId())
+                .withHeader("workItemId", workItem.getId())
+                .withBody(workItem).build();
+    }
+
+}
diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/InOutCamelWorkItemHandler.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/InOutCamelWorkItemHandler.java
new file mode 100644
index 0000000..d53c882
--- /dev/null
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/InOutCamelWorkItemHandler.java
@@ -0,0 +1,119 @@
+/**
+ * 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.jbpm.workitem;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePattern;
+import org.apache.camel.Message;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.ExchangeBuilder;
+import org.drools.core.process.instance.impl.WorkItemImpl;
+import org.jbpm.process.workitem.core.util.Wid;
+import org.jbpm.process.workitem.core.util.WidMavenDepends;
+import org.jbpm.process.workitem.core.util.WidParameter;
+import org.jbpm.process.workitem.core.util.WidResult;
+import org.jbpm.process.workitem.core.util.service.WidAction;
+import org.jbpm.process.workitem.core.util.service.WidService;
+import org.kie.api.runtime.manager.RuntimeManager;
+import org.kie.api.runtime.process.WorkItem;
+import org.kie.api.runtime.process.WorkItemHandler;
+import org.kie.api.runtime.process.WorkItemManager;
+
+/**
+ * Camel jBPM {@link WorkItemHandler} that sends {@link Exchange Exchanges} with an <code>InOut</code> Message Exchange Pattern.
+ * <p/>
+ * This handler parses the response message from the given Camel route and completes the {@link WorkItem}. The use-case for this handler is
+ * synchronous, request-response style, communication.
+ * <p/>
+ * The handler creates a Camel Exchange and sets the {@link WorkItem} as the body of the {@link Message}. Furthermore, the following message
+ * headers are set:
+ * <ul>
+ * <li>deploymentId</li>
+ * <li>processInstanceId</li>
+ * <li>workItemId</li>
+ * </ul>
+ */
+@Wid(
+        widfile = "InOutCamelConnector.wid",
+        name = "InOutCamelConnector",
+        displayName = "InOutCamelConnector",
+        defaultHandler = "mvel: new org.apache.camel.component.jbpm.workitem.InOutCamelWorkitemHandler()",
+        documentation = "${artifactId}/index.html",
+        parameters = {
+                @WidParameter(name = "camel-endpoint-id")
+        },
+        results = {
+                @WidResult(name = "response"),
+                @WidResult(name = "message") },
+        mavenDepends = {
+                @WidMavenDepends(group = "${groupId}",
+                        artifact = "${artifactId}",
+                        version = "${version}")
+        },
+        serviceInfo = @WidService(category = "${name}",
+                description = "${description}",
+                keywords = "apache,camel,payload,route,connector",
+                action = @WidAction(title = "Send payload to a Camel endpoint")))
+public class InOutCamelWorkItemHandler extends AbstractCamelWorkItemHandler {
+
+    private static final String RESPONSE_PARAM = "response";
+    private static final String MESSAGE_PARAM = "message";
+
+    public InOutCamelWorkItemHandler() {
+        super();
+    }
+
+    public InOutCamelWorkItemHandler(String camelEndpointId) {
+        super(camelEndpointId);
+    }
+
+    public InOutCamelWorkItemHandler(RuntimeManager runtimeManager) {
+        super(runtimeManager);
+    }
+
+    public InOutCamelWorkItemHandler(RuntimeManager runtimeManager, String camelEndpointId) {
+        super(runtimeManager, camelEndpointId);
+    }
+
+    @Override
+    protected void handleResponse(Exchange responseExchange, WorkItem workItem, WorkItemManager manager) {
+        Message outMessage = responseExchange.getOut();
+
+        Map<String, Object> result = new HashMap<>();
+        Object response = outMessage.getBody();
+        result.put(RESPONSE_PARAM, response);
+        result.put(MESSAGE_PARAM, outMessage);
+
+        manager.completeWorkItem(workItem.getId(), result);
+    }
+
+    @Override
+    protected Exchange buildExchange(ProducerTemplate template, WorkItem workItem) {
+        return ExchangeBuilder.anExchange(template.getCamelContext())
+                .withPattern(ExchangePattern.InOut)
+                .withHeader("deploymentId", ((WorkItemImpl) workItem).getDeploymentId())
+                .withHeader("processInstanceId", workItem.getProcessInstanceId())
+                .withHeader("workItemId", workItem.getId())
+                .withBody(workItem)
+                .build();
+    }
+
+}
diff --git a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/CamelWorkItemHandlerIntegrationTests.java b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/CamelWorkItemHandlerIntegrationTests.java
new file mode 100644
index 0000000..39fd861
--- /dev/null
+++ b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/CamelWorkItemHandlerIntegrationTests.java
@@ -0,0 +1,204 @@
+/**
+ * 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.jbpm.workitem;
+
+import static org.hamcrest.CoreMatchers.*;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.drools.core.process.instance.impl.WorkItemImpl;
+import org.jbpm.bpmn2.handler.WorkItemHandlerRuntimeException;
+import org.jbpm.process.workitem.core.TestWorkItemManager;
+import org.jbpm.services.api.service.ServiceRegistry;
+import org.junit.Test;
+import org.kie.api.runtime.process.WorkItemHandler;
+
+//http://camel.apache.org/using-getin-or-getout-methods-on-exchange.html
+//http://camel.apache.org/async.html
+public class CamelWorkItemHandlerIntegrationTests extends CamelTestSupport {
+
+    @EndpointInject(uri = "mock:result")
+    protected MockEndpoint resultEndpoint;
+
+    @Produce(uri = "direct:start")
+    protected ProducerTemplate template;
+
+    @Test
+    public void testSyncInOnly() throws Exception {
+        // Setup
+        String routeId = "testSyncInOnlyExceptionRoute";
+        RouteBuilder builder = new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:start").routeId(routeId)
+                        .setBody(simple("${body.getParameter(\"request\")}"))
+                        .to("mock:result");
+            }
+        };
+        context.addRoutes(builder);
+        try {
+            // Register the Camel Context with the jBPM ServiceRegistry.
+            ServiceRegistry.get().register("GlobalCamelService", context);
+
+            // Test
+            String expectedBody = "helloRequest";
+            resultEndpoint.expectedBodiesReceived(expectedBody);
+
+            WorkItemImpl workItem = new WorkItemImpl();
+            workItem.setParameter("camel-endpoint-id", "start");
+            workItem.setParameter("request", expectedBody);
+
+            TestWorkItemManager manager = new TestWorkItemManager();
+
+            WorkItemHandler handler = new InOnlyCamelWorkItemHandler();
+
+            handler.executeWorkItem(workItem, manager);
+
+            // Assertions
+            assertThat(manager.getResults().size(), equalTo(0));
+            resultEndpoint.assertIsSatisfied();
+        } finally {
+            // Cleanup
+            context.removeRoute(routeId);
+        }
+    }
+
+    @Test(expected = WorkItemHandlerRuntimeException.class)
+    public void testSyncInOnlyException() throws Exception {
+        // Setup
+        String routeId = "testSyncInOnlyExceptionRoute";
+        RouteBuilder builder = new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:start").routeId(routeId)
+                        .setBody(simple("${body.getParameter(\"request\")}"))
+                        .throwException(new IllegalArgumentException("Illegal contennt!"))
+                        .to("mock:result");
+            }
+        };
+        context.addRoutes(builder);
+        try {
+            // Register the Camel Context with the jBPM ServiceRegistry.
+            ServiceRegistry.get().register("GlobalCamelService", context);
+
+            // Test
+            String expectedBody = "helloRequest";
+            resultEndpoint.expectedBodiesReceived(expectedBody);
+
+            WorkItemImpl workItem = new WorkItemImpl();
+            workItem.setParameter("camel-endpoint-id", "start");
+            workItem.setParameter("request", expectedBody);
+
+            TestWorkItemManager manager = new TestWorkItemManager();
+
+            WorkItemHandler handler = new InOnlyCamelWorkItemHandler();
+
+            handler.executeWorkItem(workItem, manager);
+
+            // Assertions
+            assertThat(manager.getResults().size(), equalTo(0));
+            resultEndpoint.assertIsSatisfied();
+        } finally {
+            // Cleanup
+            context.removeRoute(routeId);
+        }
+    }
+
+    @Test
+    public void testSyncInOut() throws Exception {
+        // Setup
+        String routeId = "testSyncInOnlyExceptionRoute";
+        RouteBuilder builder = new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:start").routeId(routeId)
+                        .setBody(simple("${body.getParameter(\"request\")}"))
+                        .to("mock:result");
+            }
+        };
+        context.addRoutes(builder);
+        try {
+            // Register the Camel Context with the jBPM ServiceRegistry.
+            ServiceRegistry.get().register("GlobalCamelService", context);
+
+            // Test
+            String expectedBody = "helloRequest";
+            resultEndpoint.expectedBodiesReceived(expectedBody);
+
+            WorkItemImpl workItem = new WorkItemImpl();
+            workItem.setParameter("camel-endpoint-id", "start");
+            workItem.setParameter("request", expectedBody);
+
+            TestWorkItemManager manager = new TestWorkItemManager();
+
+            AbstractCamelWorkItemHandler handler = new InOutCamelWorkItemHandler();
+
+            handler.executeWorkItem(workItem, manager);
+
+            // Assertions
+            assertThat(manager.getResults().size(), equalTo(1));
+            resultEndpoint.assertIsSatisfied();
+        } finally {
+            // Cleanup
+            context.removeRoute(routeId);
+        }
+
+    }
+
+    @Test(expected = WorkItemHandlerRuntimeException.class)
+    public void testSyncInOutException() throws Exception {
+        // Setup
+        String routeId = "testSyncInOutExceptionRoute";
+        RouteBuilder builder = new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:start").routeId(routeId)
+                        .setBody(simple("${body.getParameter(\"request\")}"))
+                        .throwException(new IllegalArgumentException("Illegal contennt!"))
+                        .to("mock:result");
+            }
+        };
+        context.addRoutes(builder);
+        try {
+            // Register the Camel Context with the jBPM ServiceRegistry.
+            ServiceRegistry.get().register("GlobalCamelService", context);
+
+            // Test
+            String expectedBody = "helloRequest";
+            resultEndpoint.expectedBodiesReceived(expectedBody);
+
+            WorkItemImpl workItem = new WorkItemImpl();
+            workItem.setParameter("camel-endpoint-id", "start");
+            workItem.setParameter("request", expectedBody);
+
+            TestWorkItemManager manager = new TestWorkItemManager();
+
+            WorkItemHandler handler = new InOutCamelWorkItemHandler();
+
+            handler.executeWorkItem(workItem, manager);
+        } finally {
+            // Cleanup
+            context.removeRoute(routeId);
+        }
+    }
+
+}
diff --git a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/CamelWorkItemHandlerTest.java b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/CamelWorkItemHandlerTest.java
deleted file mode 100644
index 7872132..0000000
--- a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/CamelWorkItemHandlerTest.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright 2018 Red Hat, Inc. and/or its affiliates.
- *
- * Licensed 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.jbpm.workitem;
-
-import static org.junit.Assert.*;
-import static org.mockito.ArgumentMatchers.*;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.*;
-
-import java.util.Map;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.Exchange;
-import org.apache.camel.Message;
-import org.apache.camel.ProducerTemplate;
-import org.drools.core.process.instance.impl.WorkItemImpl;
-import org.jbpm.process.workitem.core.TestWorkItemManager;
-import org.jbpm.services.api.service.ServiceRegistry;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.kie.api.runtime.manager.RuntimeManager;
-import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
-
-@RunWith(MockitoJUnitRunner.class)
-public class CamelWorkItemHandlerTest {
-
-    @Mock
-    ProducerTemplate producerTemplate;
-
-    @Mock
-    Exchange outExchange;
-    
-    @Mock
-    Message outMessage;
-    
-    @Mock
-    CamelContext camelContext;
-    
-    @Mock
-    RuntimeManager runtimeManager;
-
-    @Test
-    public void testExecuteGlobalCamelContext() throws Exception {
-    
-     String camelEndpointId = "testCamelRoute";
-     String camelRouteUri = "direct://" + camelEndpointId;
-    
-     String testReponse = "testResponse";
-    
-     when(producerTemplate.send(eq(camelRouteUri), any(Exchange.class))).thenReturn(outExchange);
-     when(producerTemplate.getCamelContext()).thenReturn(camelContext);
-    
-     when(camelContext.createProducerTemplate()).thenReturn(producerTemplate);
-    
-     when(outExchange.getOut()).thenReturn(outMessage);
-     when(outMessage.getBody()).thenReturn(testReponse);
-    
-     ServiceRegistry.get().register("GlobalCamelService", camelContext);
-    
-    
-        TestWorkItemManager manager = new TestWorkItemManager();
-        WorkItemImpl workItem = new WorkItemImpl();
-        workItem.setParameter("camel-endpoint-id", camelEndpointId);
-        workItem.setParameter("request", "someRequest");
-        
-        CamelWorkItemHandler handler = new CamelWorkItemHandler();
-        
-        handler.executeWorkItem(workItem,
-                                manager);
-        assertNotNull(manager.getResults());
-        assertEquals(1,
-                     manager.getResults().size());
-        assertTrue(manager.getResults().containsKey(workItem.getId()));
-        Map<String, Object> results = manager.getResults(workItem.getId());
-        assertEquals(2, results.size());
-        assertEquals(testReponse, results.get("response"));
-    }
-    
-    @Test
-    public void testExecuteLocalCamelContext() throws Exception {
-    
-     String camelEndpointId = "testCamelRoute";
-     String camelRouteUri = "direct://" + camelEndpointId;
-    
-     String testReponse = "testResponse";
-    
-     String runtimeManagerId = "testRuntimeManager";
-    
-     when(runtimeManager.getIdentifier()).thenReturn(runtimeManagerId);
-    
-     when(producerTemplate.send(eq(camelRouteUri), any(Exchange.class))).thenReturn(outExchange);
-       when(producerTemplate.getCamelContext()).thenReturn(camelContext);
-    
-     when(camelContext.createProducerTemplate()).thenReturn(producerTemplate);
-    
-     when(outExchange.getOut()).thenReturn(outMessage);
-     when(outMessage.getBody()).thenReturn(testReponse);
-    
-     //Register the RuntimeManager bound camelcontext.
-     ServiceRegistry.get().register(runtimeManagerId + "_CamelService", camelContext);
-    
-    
-        WorkItemImpl workItem = new WorkItemImpl();
-        workItem.setParameter("camel-endpoint-id", camelEndpointId);
-        workItem.setParameter("request", "someRequest");
-        
-        CamelWorkItemHandler handler = new CamelWorkItemHandler(runtimeManager);
-        
-        TestWorkItemManager manager = new TestWorkItemManager();
-        handler.executeWorkItem(workItem,
-                                manager);
-        assertNotNull(manager.getResults());
-        assertEquals(1,
-                     manager.getResults().size());
-        assertTrue(manager.getResults().containsKey(workItem.getId()));
-        Map<String, Object> results = manager.getResults(workItem.getId());
-        assertEquals(2, results.size());
-        assertEquals(testReponse, results.get("response"));
-    }
-
-
-}
diff --git a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/DeploymentContextCamelCommandTest.java b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/DeploymentContextCamelCommandTest.java
new file mode 100644
index 0000000..b703456
--- /dev/null
+++ b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/DeploymentContextCamelCommandTest.java
@@ -0,0 +1,95 @@
+/**
+ * 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.jbpm.workitem;
+
+import static org.junit.Assert.*;
+import static org.mockito.ArgumentMatchers.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.ProducerTemplate;
+import org.drools.core.process.instance.impl.WorkItemImpl;
+import org.jbpm.services.api.service.ServiceRegistry;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.kie.api.executor.Command;
+import org.kie.api.executor.CommandContext;
+import org.kie.api.executor.ExecutionResults;
+import org.kie.api.runtime.manager.RuntimeManager;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+
+@RunWith(MockitoJUnitRunner.class)
+public class DeploymentContextCamelCommandTest {
+    
+    @Mock
+    ProducerTemplate producerTemplate;
+
+    @Mock
+    Exchange outExchange;
+    
+    @Mock
+    Message outMessage;
+    
+    @Mock
+    CamelContext camelContext;
+    
+    @Mock
+    RuntimeManager runtimeManager;
+    
+    @Mock
+    CommandContext commandContext;
+
+    @Test
+    public void testExecuteCommandDeploymentCamelContext() throws Exception {
+    
+        String camelEndpointId = "testCamelRoute";
+        String camelRouteUri = "direct://" + camelEndpointId;
+        
+        String testReponse = "testResponse";
+        
+        String deploymentId = "testDeployment";
+        
+        when(producerTemplate.send(eq(camelRouteUri), any(Exchange.class))).thenReturn(outExchange);
+        when(producerTemplate.getCamelContext()).thenReturn(camelContext);
+        
+        when(camelContext.createProducerTemplate()).thenReturn(producerTemplate);
+        
+        when(outExchange.getOut()).thenReturn(outMessage);
+        when(outMessage.getBody()).thenReturn(testReponse);
+        
+        //Register the RuntimeManager bound camelcontext.
+        ServiceRegistry.get().register(deploymentId + "_CamelService", camelContext);
+        
+        WorkItemImpl workItem = new WorkItemImpl();
+        workItem.setParameter("camel-endpoint-id", camelEndpointId);
+        workItem.setParameter("request", "someRequest");
+        
+        when(commandContext.getData("workItem")).thenReturn(workItem);
+        when(commandContext.getData("deploymentId")).thenReturn(deploymentId);
+        
+        Command command = new DeploymentContextCamelCommand();
+        ExecutionResults results = command.execute(commandContext);
+        
+        assertNotNull(results);
+        assertEquals(2, results.getData().size());
+        assertEquals(testReponse, results.getData().get("response"));
+    }
+}
diff --git a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/CamelCommandTest.java b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommandTest.java
similarity index 54%
rename from components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/CamelCommandTest.java
rename to components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommandTest.java
index 543b833..ad36879 100644
--- a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/CamelCommandTest.java
+++ b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommandTest.java
@@ -1,11 +1,12 @@
-/*
- * Copyright 2018 Red Hat, Inc. and/or its affiliates.
+/**
+ * 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
  *
- * Licensed 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
+ *      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,
@@ -13,11 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.camel.component.jbpm.workitem;
 
 import static org.junit.Assert.*;
+import static org.mockito.ArgumentMatchers.*;
 import static org.mockito.Mockito.*;
-import static org.mockito.ArgumentMatchers.any;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
@@ -27,6 +29,7 @@ import org.drools.core.process.instance.impl.WorkItemImpl;
 import org.jbpm.services.api.service.ServiceRegistry;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.kie.api.executor.Command;
 import org.kie.api.executor.CommandContext;
 import org.kie.api.executor.ExecutionResults;
 import org.kie.api.runtime.manager.RuntimeManager;
@@ -34,7 +37,7 @@ import org.mockito.Mock;
 import org.mockito.junit.MockitoJUnitRunner;
 
 @RunWith(MockitoJUnitRunner.class)
-public class CamelCommandTest {
+public class GlobalContextCamelCommandTest {
 
  @Mock
     ProducerTemplate producerTemplate;
@@ -55,7 +58,7 @@ public class CamelCommandTest {
     CommandContext commandContext;
 
     @Test
-    public void testExecuteComamnd() throws Exception {
+    public void testExecuteGlobalCommand() throws Exception {
     
      String camelEndpointId = "testCamelRoute";
      String camelRouteUri = "direct://" + camelEndpointId;
@@ -83,7 +86,7 @@ public class CamelCommandTest {
         
         when(commandContext.getData(anyString())).thenReturn(workItem);
         
-        CamelCommand command = new CamelCommand();
+        Command command = new GlobalContextCamelCommand();
         ExecutionResults results = command.execute(commandContext);
         
         
@@ -91,44 +94,4 @@ public class CamelCommandTest {
         assertEquals(2, results.getData().size());
         assertEquals(testReponse, results.getData().get("response"));
     }
-    
-    
-    @Test
-    public void testExecuteCommandLocalCamelContext() throws Exception {
-    
-     String camelEndpointId = "testCamelRoute";
-     String camelRouteUri = "direct://" + camelEndpointId;
-    
-     String testReponse = "testResponse";
-    
-     String runtimeManagerId = "testRuntimeManager";
-    
-     when(runtimeManager.getIdentifier()).thenReturn(runtimeManagerId);
-    
-     when(producerTemplate.send(eq(camelRouteUri), any(Exchange.class))).thenReturn(outExchange);
-     //when(producerTemplate.send(argThat(not(camelRouteUri)), any(Exchange.class))).thenThrow(new IllegalArgumentException("Unexpected route id"));
-     when(producerTemplate.getCamelContext()).thenReturn(camelContext);
-    
-     when(camelContext.createProducerTemplate()).thenReturn(producerTemplate);
-    
-     when(outExchange.getOut()).thenReturn(outMessage);
-     when(outMessage.getBody()).thenReturn(testReponse);
-    
-     //Register the RuntimeManager bound camelcontext.
-     ServiceRegistry.get().register(runtimeManagerId + "_CamelService", camelContext);
-    
-        WorkItemImpl workItem = new WorkItemImpl();
-        workItem.setParameter("camel-endpoint-id", camelEndpointId);
-        workItem.setParameter("request", "someRequest");
-        
-        when(commandContext.getData(anyString())).thenReturn(workItem);
-        
-        CamelCommand command = new CamelCommand(runtimeManager);
-        ExecutionResults results = command.execute(commandContext);
-        
-        assertNotNull(results);
-        assertEquals(2, results.getData().size());
-        assertEquals(testReponse, results.getData().get("response"));
-    }
-
 }
diff --git a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/InOnlyCamelWorkItemHandlerTest.java b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/InOnlyCamelWorkItemHandlerTest.java
new file mode 100644
index 0000000..1ad1bf9
--- /dev/null
+++ b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/InOnlyCamelWorkItemHandlerTest.java
@@ -0,0 +1,97 @@
+/**
+ * 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.jbpm.workitem;
+
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.*;
+import static org.mockito.ArgumentMatchers.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.impl.DefaultHeadersMapFactory;
+import org.apache.camel.spi.HeadersMapFactory;
+import org.drools.core.process.instance.impl.WorkItemImpl;
+import org.jbpm.process.workitem.core.TestWorkItemManager;
+import org.jbpm.services.api.service.ServiceRegistry;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.kie.api.runtime.manager.RuntimeManager;
+import org.mockito.ArgumentMatchers;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+
+@RunWith(MockitoJUnitRunner.class)
+public class InOnlyCamelWorkItemHandlerTest {
+
+    @Mock
+    ProducerTemplate producerTemplate;
+
+    @Mock
+    Exchange outExchange;
+
+    @Mock
+    Message outMessage;
+
+    @Mock
+    CamelContext camelContext;
+
+    @Mock
+    RuntimeManager runtimeManager;
+
+    @Test
+    public void testExecuteInOnlyLocalCamelContext() throws Exception {
+
+        String camelEndpointId = "testCamelRoute";
+        String camelRouteUri = "direct://" + camelEndpointId;
+
+        String testReponse = "testResponse";
+
+        String runtimeManagerId = "testRuntimeManager";
+
+        when(runtimeManager.getIdentifier()).thenReturn(runtimeManagerId);
+
+        when(producerTemplate.send(eq(camelRouteUri), ArgumentMatchers.any(Exchange.class))).thenReturn(outExchange);
+        when(producerTemplate.getCamelContext()).thenReturn(camelContext);
+
+        when(camelContext.createProducerTemplate()).thenReturn(producerTemplate);
+        HeadersMapFactory hmf = new DefaultHeadersMapFactory();
+        when(camelContext.getHeadersMapFactory()).thenReturn(hmf);
+
+        // Register the RuntimeManager bound camelcontext.
+        ServiceRegistry.get().register(runtimeManagerId + "_CamelService", camelContext);
+
+        WorkItemImpl workItem = new WorkItemImpl();
+        workItem.setParameter("camel-endpoint-id", camelEndpointId);
+        workItem.setParameter("request", "someRequest");
+        workItem.setDeploymentId("testDeploymentId");
+        workItem.setProcessInstanceId(1L);
+        workItem.setId(1L);
+        
+        AbstractCamelWorkItemHandler handler = new InOnlyCamelWorkItemHandler(runtimeManager);
+
+        TestWorkItemManager manager = new TestWorkItemManager();
+        handler.executeWorkItem(workItem,
+                manager);
+        assertThat(manager.getResults(), is(notNullValue()));
+        //InOnly does not complete WorkItem.
+        assertThat(manager.getResults().size(), equalTo(0));
+    }
+}
diff --git a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/InOutCamelWorkItemHandlerTest.java b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/InOutCamelWorkItemHandlerTest.java
new file mode 100644
index 0000000..e4bc6ba
--- /dev/null
+++ b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/InOutCamelWorkItemHandlerTest.java
@@ -0,0 +1,147 @@
+/**
+ * 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.jbpm.workitem;
+
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.*;
+import static org.mockito.ArgumentMatchers.*;
+import static org.mockito.Mockito.*;
+
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.impl.DefaultHeadersMapFactory;
+import org.apache.camel.spi.HeadersMapFactory;
+import org.drools.core.process.instance.impl.WorkItemImpl;
+import org.jbpm.process.workitem.core.TestWorkItemManager;
+import org.jbpm.services.api.service.ServiceRegistry;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.kie.api.runtime.manager.RuntimeManager;
+import org.mockito.ArgumentMatchers;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+
+@RunWith(MockitoJUnitRunner.class)
+public class InOutCamelWorkItemHandlerTest {
+
+    @Mock
+    ProducerTemplate producerTemplate;
+
+    @Mock
+    Exchange outExchange;
+
+    @Mock
+    Message outMessage;
+
+    @Mock
+    CamelContext camelContext;
+
+    @Mock
+    RuntimeManager runtimeManager;
+
+    @Test
+    public void testExecuteInOutGlobalCamelContext() throws Exception {
+
+        String camelEndpointId = "testCamelRoute";
+        String camelRouteUri = "direct://" + camelEndpointId;
+
+        String testReponse = "testResponse";
+
+        when(producerTemplate.send(eq(camelRouteUri), ArgumentMatchers.any(Exchange.class))).thenReturn(outExchange);
+        when(producerTemplate.getCamelContext()).thenReturn(camelContext);
+
+        when(camelContext.createProducerTemplate()).thenReturn(producerTemplate);
+        HeadersMapFactory hmf = new DefaultHeadersMapFactory();
+        when(camelContext.getHeadersMapFactory()).thenReturn(hmf);
+
+        when(outExchange.getOut()).thenReturn(outMessage);
+        when(outMessage.getBody()).thenReturn(testReponse);
+
+        ServiceRegistry.get().register("GlobalCamelService", camelContext);
+
+        TestWorkItemManager manager = new TestWorkItemManager();
+        WorkItemImpl workItem = new WorkItemImpl();
+        workItem.setParameter("camel-endpoint-id", camelEndpointId);
+        workItem.setParameter("request", "someRequest");
+        workItem.setDeploymentId("testDeploymentId");
+        workItem.setProcessInstanceId(1L);
+        workItem.setId(1L);
+
+        AbstractCamelWorkItemHandler handler = new InOutCamelWorkItemHandler();
+
+        handler.executeWorkItem(workItem,
+                manager);
+        assertThat(manager.getResults(), is(notNullValue()));
+        assertThat(manager.getResults().size(), equalTo(1));
+        assertThat(manager.getResults().containsKey(workItem.getId()), is(true));
+        Map<String, Object> results = manager.getResults(workItem.getId());
+        assertThat(results.size(), equalTo(2));
+        assertThat(results.get("response"), equalTo(testReponse));
+    }
+
+    @Test
+    public void testExecuteInOutLocalCamelContext() throws Exception {
+
+        String camelEndpointId = "testCamelRoute";
+        String camelRouteUri = "direct://" + camelEndpointId;
+
+        String testReponse = "testResponse";
+
+        String runtimeManagerId = "testRuntimeManager";
+
+        when(runtimeManager.getIdentifier()).thenReturn(runtimeManagerId);
+
+        when(producerTemplate.send(eq(camelRouteUri), ArgumentMatchers.any(Exchange.class))).thenReturn(outExchange);
+        when(producerTemplate.getCamelContext()).thenReturn(camelContext);
+
+        when(camelContext.createProducerTemplate()).thenReturn(producerTemplate);
+        HeadersMapFactory hmf = new DefaultHeadersMapFactory();
+        when(camelContext.getHeadersMapFactory()).thenReturn(hmf);
+
+        when(outExchange.getOut()).thenReturn(outMessage);
+        when(outMessage.getBody()).thenReturn(testReponse);
+
+        // Register the RuntimeManager bound camelcontext.
+        ServiceRegistry.get().register(runtimeManagerId + "_CamelService", camelContext);
+
+        WorkItemImpl workItem = new WorkItemImpl();
+        workItem.setParameter("camel-endpoint-id", camelEndpointId);
+        workItem.setParameter("request", "someRequest");
+        workItem.setDeploymentId("testDeploymentId");
+        workItem.setProcessInstanceId(1L);
+        workItem.setId(1L);
+
+        AbstractCamelWorkItemHandler handler = new InOutCamelWorkItemHandler(runtimeManager);
+
+        TestWorkItemManager manager = new TestWorkItemManager();
+        handler.executeWorkItem(workItem,
+                manager);
+        assertThat(manager.getResults(), is(notNullValue()));
+        assertThat(manager.getResults().size(), equalTo(1));
+        assertThat(manager.getResults().containsKey(workItem.getId()), is(true));
+        
+        Map<String, Object> results = manager.getResults(workItem.getId());
+        assertThat(results.size(), equalTo(2));
+        assertThat(results.get("response"), equalTo(testReponse));
+    }
+  
+}

Reply | Threaded
Open this post in threaded view
|

[camel] 03/35: Replaced hard-coded strings with constants. Changed WorkItem parameter names to be inline with other WorkItemHandlers.

acosentino
In reply to this post by acosentino
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch sandbox/camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit a04dd48755cc45fe81c1c2e190eb8cb2dfc47a6c
Author: Duncan Doyle <[hidden email]>
AuthorDate: Fri Nov 30 09:24:45 2018 +0100

    Replaced hard-coded strings with constants. Changed WorkItem parameter names to be inline with other WorkItemHandlers.
---
 .../apache/camel/component/jbpm/JBPMConstants.java |  8 +++++
 .../jbpm/server/CamelKieServerExtension.java       |  5 ++--
 .../jbpm/workitem/AbstractCamelCommand.java        | 15 ++++------
 .../workitem/AbstractCamelWorkItemHandler.java     | 35 +++++++++++-----------
 .../workitem/DeploymentContextCamelCommand.java    |  5 ++--
 .../jbpm/workitem/GlobalContextCamelCommand.java   |  5 ++--
 .../jbpm/workitem/InOnlyCamelWorkItemHandler.java  |  7 +++--
 .../jbpm/workitem/InOutCamelWorkItemHandler.java   | 14 ++++-----
 .../CamelWorkItemHandlerIntegrationTests.java      | 33 ++++++++++----------
 .../DeploymentContextCamelCommandTest.java         |  9 +++---
 .../workitem/GlobalContextCamelCommandTest.java    |  9 +++---
 .../workitem/InOnlyCamelWorkItemHandlerTest.java   |  5 ++--
 .../workitem/InOutCamelWorkItemHandlerTest.java    | 13 ++++----
 13 files changed, 85 insertions(+), 78 deletions(-)

diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMConstants.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMConstants.java
index 8341cfd..94ff0ca 100644
--- a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMConstants.java
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMConstants.java
@@ -43,4 +43,12 @@ public interface JBPMConstants {
     String JBPM_TASK_EVENT_LISTENER = "task";
     String JBPM_CASE_EVENT_LISTENER = "case";
     String JBPM_EVENT_EMITTER = "emitter";
+    
+    String GLOBAL_CAMEL_CONTEXT_SERVICE_KEY = "GlobalCamelService";
+    String DEPLOYMENT_CAMEL_CONTEXT_SERVICE_KEY_POSTFIX = "_CamelService";
+    String CAMEL_ENDPOINT_ID_WI_PARAM = "CamelEndpointId";
+    String RESPONSE_WI_PARAM = "Response";
+    String MESSAGE_WI_PARAM = "Message";
+
+    
 }
diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/server/CamelKieServerExtension.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/server/CamelKieServerExtension.java
index 0e297be..659a498 100644
--- a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/server/CamelKieServerExtension.java
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/server/CamelKieServerExtension.java
@@ -23,6 +23,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.camel.component.jbpm.JBPMConstants;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.model.FromDefinition;
 import org.apache.camel.model.RouteDefinition;
@@ -85,7 +86,7 @@ public class CamelKieServerExtension implements KieServerExtension {
             }
         }
 
-        ServiceRegistry.get().register("GlobalCamelService", this.camel);
+        ServiceRegistry.get().register(JBPMConstants.GLOBAL_CAMEL_CONTEXT_SERVICE_KEY, this.camel);
     }
 
     @Override
@@ -117,7 +118,7 @@ public class CamelKieServerExtension implements KieServerExtension {
                 context.start();
                 camelContexts.put(id, context);
 
-                ServiceRegistry.get().register(id + "_CamelService", context);
+                ServiceRegistry.get().register(id + JBPMConstants.DEPLOYMENT_CAMEL_CONTEXT_SERVICE_KEY_POSTFIX, context);
 
             }
         } catch (Exception e) {
diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelCommand.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelCommand.java
index 3cb1ee4..adfd413 100644
--- a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelCommand.java
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelCommand.java
@@ -22,6 +22,7 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.ExchangeBuilder;
+import org.apache.camel.component.jbpm.JBPMConstants;
 import org.jbpm.services.api.service.ServiceRegistry;
 import org.kie.api.executor.Command;
 import org.kie.api.executor.CommandContext;
@@ -40,17 +41,13 @@ import org.slf4j.LoggerFactory;
  * {link WorkItem} via the <code>camel-endpoint-id</code> parameter, this {@link Command} will send the {@link WorkItem} to
  * the Camel URI <code>direct://myCamelEndpoint</code>.  
  * <p/>
- * The body of the result {@link Message} of the invocation is returned via the <code>response</code> parameter. Access to the raw response
- * {@link Message} is provided via the <code>message</code> parameter. This gives the user access to more advanced fields like message headers
+ * The body of the result {@link Message} of the invocation is returned via the <code>Response</code> parameter. Access to the raw response
+ * {@link Message} is provided via the <code>Message</code> parameter. This gives the user access to more advanced fields like message headers
  * and attachments.
  */
 public abstract class AbstractCamelCommand implements Command,
                                           Cacheable {
 
- private static final String CAMEL_ENDPOINT_ID_PARAM = "camel-endpoint-id";
- private static final String RESPONSE_PARAM = "response";
- private static final String MESSAGE_PARAM = "out-headers";
-
     private static final Logger logger = LoggerFactory.getLogger(AbstractCamelCommand.class);
 
  public AbstractCamelCommand() {
@@ -62,7 +59,7 @@ public abstract class AbstractCamelCommand implements Command,
         
      WorkItem workItem = (WorkItem) ctx.getData("workItem");
     
-     String camelEndpointId = (String) workItem.getParameter(CAMEL_ENDPOINT_ID_PARAM);
+     String camelEndpointId = (String) workItem.getParameter(JBPMConstants.CAMEL_ENDPOINT_ID_WI_PARAM);
 
  // We only support direct. We don't need to support more, as direct simply gives us the entrypoint into the actual Camel Routes.
  String camelUri = "direct://" + camelEndpointId;
@@ -78,8 +75,8 @@ public abstract class AbstractCamelCommand implements Command,
 
  ExecutionResults results = new ExecutionResults();
  Object response = outMessage.getBody();
- results.setData(RESPONSE_PARAM, response);
- results.setData(MESSAGE_PARAM, outMessage);
+ results.setData(JBPMConstants.RESPONSE_WI_PARAM, response);
+ results.setData(JBPMConstants.MESSAGE_WI_PARAM, outMessage);
     
         return results;
     }
diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelWorkItemHandler.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelWorkItemHandler.java
index db88e70..743393c 100644
--- a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelWorkItemHandler.java
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelWorkItemHandler.java
@@ -21,6 +21,7 @@ import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.jbpm.JBPMConstants;
 import org.jbpm.process.workitem.core.AbstractLogOrThrowWorkItemHandler;
 import org.jbpm.services.api.service.ServiceRegistry;
 import org.kie.api.runtime.manager.RuntimeManager;
@@ -35,29 +36,24 @@ import org.slf4j.LoggerFactory;
  * Camel jBPM {@link WorkItemHandler} which allows to call Camel routes with a <code>direct</code> endpoint.
  * <p/>
  * The handler passes the {@WorkItem} to the route that has a consumer on the endpoint-id that can be passed with the
- * <code>camel-endpoint-id</code>{@link WorkItem} parameter. E.g. when a the value "myCamelEndpoint" is passed to the {link WorkItem} via
- * the <code>camel-endpoint-id</code> parameter, this command will send the {@link WorkItem} to the Camel URI
+ * <code>CamelEndpointId</code>{@link WorkItem} parameter. E.g. when a the value "myCamelEndpoint" is passed to the {link WorkItem} via
+ * the <code>CamelEndpointId</code> parameter, this command will send the {@link WorkItem} to the Camel URI
  * <code>direct://myCamelEndpoint</code>.
  * <p/>
- * The body of the result {@link Message} of the invocation is returned via the <code>response</code> parameter. Access to the raw response
- * {@link Message} is provided via the <code>message</code> parameter. This gives the user access to more advanced fields like message
+ * The body of the result {@link Message} of the invocation is returned via the <code>Response</code> parameter. Access to the raw response
+ * {@link Message} is provided via the <code>Message</code> parameter. This gives the user access to more advanced fields like message
  * headers and attachments.
  * <p/>
  * This handler can be constructed in multiple ways. When you don't pass a {@link RuntimeManager} to the constructor, the handler will try
  * to find the global KIE {@link CamelContext} from the <code>jBPM</code> {@link ServiceRegistry}. When the {@link RuntimeManager} is passed
  * to the constructor, the handler will retrieve and use the {@link CamelContext} bound to the {@link RuntimeManage} from the
- * {@link ServiceRegistry}. When a <code>camel-endpoint-id</code> is passed to the constructor, the handler will send all requests to the
- * Camel route that is consuming from that endpoint, unless the endpoint is overridden by passing a the <code>camel-endpoint-id</code> in
+ * {@link ServiceRegistry}. When a <code>CamelEndpointId</code> is passed to the constructor, the handler will send all requests to the
+ * Camel route that is consuming from that endpoint, unless the endpoint is overridden by passing a the <code>CamelEndpointId</code> in
  * the {@link WorkItem} parameters.
  *
  */
 public abstract class AbstractCamelWorkItemHandler extends AbstractLogOrThrowWorkItemHandler implements Cacheable {
 
-    private static final String GLOBAL_CAMEL_CONTEXT_SERVICE_KEY = "GlobalCamelService";
-    private static final String RUNTIME_CAMEL_CONTEXT_SERVICE_POSTFIX = "_CamelService";
-
-    private static final String CAMEL_ENDPOINT_ID_PARAM = "camel-endpoint-id";
-
     private static Logger logger = LoggerFactory.getLogger(AbstractCamelWorkItemHandler.class);
 
     private final ProducerTemplate producerTemplate;
@@ -72,7 +68,7 @@ public abstract class AbstractCamelWorkItemHandler extends AbstractLogOrThrowWor
     }
 
     public AbstractCamelWorkItemHandler(String camelEndointId) {
-        CamelContext globalCamelContext = (CamelContext) ServiceRegistry.get().service(GLOBAL_CAMEL_CONTEXT_SERVICE_KEY);
+        CamelContext globalCamelContext = (CamelContext) ServiceRegistry.get().service(JBPMConstants.GLOBAL_CAMEL_CONTEXT_SERVICE_KEY);
         // TODO: Should we allow to set the maximumCacheSize on the producer?
         this.producerTemplate = globalCamelContext.createProducerTemplate();
         this.camelEndpointId = camelEndointId;
@@ -87,7 +83,7 @@ public abstract class AbstractCamelWorkItemHandler extends AbstractLogOrThrowWor
     }
 
     public AbstractCamelWorkItemHandler(RuntimeManager runtimeManager, String camelEndpointId) {
-        String runtimeCamelContextKey = runtimeManager.getIdentifier() + RUNTIME_CAMEL_CONTEXT_SERVICE_POSTFIX;
+        String runtimeCamelContextKey = runtimeManager.getIdentifier() + JBPMConstants.DEPLOYMENT_CAMEL_CONTEXT_SERVICE_KEY_POSTFIX;
         CamelContext runtimeCamelContext = (CamelContext) ServiceRegistry.get().service(runtimeCamelContextKey);
         // TODO: Should we allow to set the maximumCacheSize on the producer?
         this.producerTemplate = runtimeCamelContext.createProducerTemplate();
@@ -115,13 +111,15 @@ public abstract class AbstractCamelWorkItemHandler extends AbstractLogOrThrowWor
         }
     }
 
-    private String getCamelEndpointId(WorkItem workItem) {
-        String workItemCamelEndpointId = (String) workItem.getParameter(CAMEL_ENDPOINT_ID_PARAM);
+    protected String getCamelEndpointId(WorkItem workItem) {
+        String workItemCamelEndpointId = (String) workItem.getParameter(JBPMConstants.CAMEL_ENDPOINT_ID_WI_PARAM);
 
         if (camelEndpointId != null && !camelEndpointId.isEmpty()) {
             if (workItemCamelEndpointId != null && !workItemCamelEndpointId.isEmpty()) {
                 logger.debug(
-                        "The Camel Endpoint ID has been set on both the WorkItemHanlder and WorkItem. The camel-endpoint-id configured on the WorkItem overrides the global configuation.");
+                        "The Camel Endpoint ID has been set on both the WorkItemHanlder and WorkItem. The '"
+                                + JBPMConstants.CAMEL_ENDPOINT_ID_WI_PARAM
+                                + "' configured on the WorkItem overrides the global configuation.");
             } else {
                 workItemCamelEndpointId = camelEndpointId;
             }
@@ -129,8 +127,9 @@ public abstract class AbstractCamelWorkItemHandler extends AbstractLogOrThrowWor
 
         if (workItemCamelEndpointId == null || workItemCamelEndpointId.isEmpty()) {
             throw new IllegalArgumentException(
-                    "No Camel Endpoint ID specified. Please configure the 'camel-endpoint-id' in either the constructor of this WorkItemHandler, or pass it via the "
-                            + CAMEL_ENDPOINT_ID_PARAM + "' WorkItem parameter.");
+                    "No Camel Endpoint ID specified. Please configure the '" + JBPMConstants.CAMEL_ENDPOINT_ID_WI_PARAM
+                            + "' in either the constructor of this WorkItemHandler, or pass it via the "
+                            + JBPMConstants.CAMEL_ENDPOINT_ID_WI_PARAM + "' WorkItem parameter.");
         }
         return workItemCamelEndpointId;
     }
diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/DeploymentContextCamelCommand.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/DeploymentContextCamelCommand.java
index e3d3fd1..009b909 100644
--- a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/DeploymentContextCamelCommand.java
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/DeploymentContextCamelCommand.java
@@ -22,6 +22,7 @@ import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.jbpm.JBPMConstants;
 import org.jbpm.services.api.service.ServiceRegistry;
 import org.kie.api.executor.CommandContext;
 import org.slf4j.Logger;
@@ -32,8 +33,6 @@ import org.slf4j.LoggerFactory;
  */
 public class DeploymentContextCamelCommand extends AbstractCamelCommand {
 
-    private static final String RUNTIME_CAMEL_CONTEXT_SERVICE_POSTFIX = "_CamelService";
-
     private final Map<String, ProducerTemplate> templates = new ConcurrentHashMap<>();
 
     private static final Logger logger = LoggerFactory.getLogger(DeploymentContextCamelCommand.class);
@@ -48,7 +47,7 @@ public class DeploymentContextCamelCommand extends AbstractCamelCommand {
                 template = templates.get(deploymentId);
                 if (template == null) {
                     CamelContext deploymentCamelContext = (CamelContext) ServiceRegistry.get()
-                            .service(deploymentId + RUNTIME_CAMEL_CONTEXT_SERVICE_POSTFIX);
+                            .service(deploymentId + JBPMConstants.DEPLOYMENT_CAMEL_CONTEXT_SERVICE_KEY_POSTFIX);
                     template = deploymentCamelContext.createProducerTemplate();
                     templates.put(deploymentId, template);
                 }
diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommand.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommand.java
index 974b896..10950b3 100644
--- a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommand.java
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommand.java
@@ -19,6 +19,7 @@ package org.apache.camel.component.jbpm.workitem;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.jbpm.JBPMConstants;
 import org.jbpm.services.api.service.ServiceRegistry;
 import org.kie.api.executor.CommandContext;
 import org.slf4j.Logger;
@@ -29,14 +30,12 @@ import org.slf4j.LoggerFactory;
  */
 public class GlobalContextCamelCommand extends AbstractCamelCommand {
 
-    private static final String GLOBAL_CAMEL_CONTEXT_SERVICE_KEY = "GlobalCamelService";
-    
     private final ProducerTemplate globalContextProducerTemplate;
     
     private static final Logger logger = LoggerFactory.getLogger(GlobalContextCamelCommand.class);
     
     public GlobalContextCamelCommand() {
-        CamelContext globalCamelContext = (CamelContext) ServiceRegistry.get().service(GLOBAL_CAMEL_CONTEXT_SERVICE_KEY);
+        CamelContext globalCamelContext = (CamelContext) ServiceRegistry.get().service(JBPMConstants.GLOBAL_CAMEL_CONTEXT_SERVICE_KEY);
         // TODO: Should we allow to set the maximumCacheSize on the producer?
         this.globalContextProducerTemplate = globalCamelContext.createProducerTemplate();
     }
diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/InOnlyCamelWorkItemHandler.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/InOnlyCamelWorkItemHandler.java
index 0588c02..b97b0ad 100644
--- a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/InOnlyCamelWorkItemHandler.java
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/InOnlyCamelWorkItemHandler.java
@@ -22,6 +22,7 @@ import org.apache.camel.ExchangePattern;
 import org.apache.camel.Message;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.ExchangeBuilder;
+import org.apache.camel.component.jbpm.JBPMConstants;
 import org.drools.core.process.instance.impl.WorkItemImpl;
 import org.jbpm.process.workitem.core.util.Wid;
 import org.jbpm.process.workitem.core.util.WidMavenDepends;
@@ -56,11 +57,11 @@ import org.kie.api.runtime.process.WorkItemManager;
         defaultHandler = "mvel: new org.apache.camel.component.jbpm.workitem.InOnlyCamelWorkitemHandler()",
         documentation = "${artifactId}/index.html",
         parameters = {
-                @WidParameter(name = "camel-endpoint-id")
+                @WidParameter(name = JBPMConstants.CAMEL_ENDPOINT_ID_WI_PARAM)
         },
         results = {
-                @WidResult(name = "response"),
-                @WidResult(name = "message") },
+                @WidResult(name = JBPMConstants.RESPONSE_WI_PARAM),
+                @WidResult(name = JBPMConstants.MESSAGE_WI_PARAM) },
         mavenDepends = {
                 @WidMavenDepends(group = "${groupId}",
                         artifact = "${artifactId}",
diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/InOutCamelWorkItemHandler.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/InOutCamelWorkItemHandler.java
index d53c882..a8482dd 100644
--- a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/InOutCamelWorkItemHandler.java
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/InOutCamelWorkItemHandler.java
@@ -25,6 +25,7 @@ import org.apache.camel.ExchangePattern;
 import org.apache.camel.Message;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.ExchangeBuilder;
+import org.apache.camel.component.jbpm.JBPMConstants;
 import org.drools.core.process.instance.impl.WorkItemImpl;
 import org.jbpm.process.workitem.core.util.Wid;
 import org.jbpm.process.workitem.core.util.WidMavenDepends;
@@ -58,11 +59,11 @@ import org.kie.api.runtime.process.WorkItemManager;
         defaultHandler = "mvel: new org.apache.camel.component.jbpm.workitem.InOutCamelWorkitemHandler()",
         documentation = "${artifactId}/index.html",
         parameters = {
-                @WidParameter(name = "camel-endpoint-id")
+                @WidParameter(name = JBPMConstants.CAMEL_ENDPOINT_ID_WI_PARAM)
         },
         results = {
-                @WidResult(name = "response"),
-                @WidResult(name = "message") },
+                @WidResult(name = JBPMConstants.RESPONSE_WI_PARAM),
+                @WidResult(name = JBPMConstants.MESSAGE_WI_PARAM) },
         mavenDepends = {
                 @WidMavenDepends(group = "${groupId}",
                         artifact = "${artifactId}",
@@ -74,9 +75,6 @@ import org.kie.api.runtime.process.WorkItemManager;
                 action = @WidAction(title = "Send payload to a Camel endpoint")))
 public class InOutCamelWorkItemHandler extends AbstractCamelWorkItemHandler {
 
-    private static final String RESPONSE_PARAM = "response";
-    private static final String MESSAGE_PARAM = "message";
-
     public InOutCamelWorkItemHandler() {
         super();
     }
@@ -99,8 +97,8 @@ public class InOutCamelWorkItemHandler extends AbstractCamelWorkItemHandler {
 
         Map<String, Object> result = new HashMap<>();
         Object response = outMessage.getBody();
-        result.put(RESPONSE_PARAM, response);
-        result.put(MESSAGE_PARAM, outMessage);
+        result.put(JBPMConstants.RESPONSE_WI_PARAM, response);
+        result.put(JBPMConstants.MESSAGE_WI_PARAM, outMessage);
 
         manager.completeWorkItem(workItem.getId(), result);
     }
diff --git a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/CamelWorkItemHandlerIntegrationTests.java b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/CamelWorkItemHandlerIntegrationTests.java
index 39fd861..4e594dd 100644
--- a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/CamelWorkItemHandlerIntegrationTests.java
+++ b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/CamelWorkItemHandlerIntegrationTests.java
@@ -23,6 +23,7 @@ import org.apache.camel.EndpointInject;
 import org.apache.camel.Produce;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jbpm.JBPMConstants;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.drools.core.process.instance.impl.WorkItemImpl;
@@ -50,22 +51,22 @@ public class CamelWorkItemHandlerIntegrationTests extends CamelTestSupport {
             @Override
             public void configure() throws Exception {
                 from("direct:start").routeId(routeId)
-                        .setBody(simple("${body.getParameter(\"request\")}"))
+                        .setBody(simple("${body.getParameter(\"Request\")}"))
                         .to("mock:result");
             }
         };
         context.addRoutes(builder);
         try {
             // Register the Camel Context with the jBPM ServiceRegistry.
-            ServiceRegistry.get().register("GlobalCamelService", context);
+            ServiceRegistry.get().register(JBPMConstants.GLOBAL_CAMEL_CONTEXT_SERVICE_KEY, context);
 
             // Test
             String expectedBody = "helloRequest";
             resultEndpoint.expectedBodiesReceived(expectedBody);
 
             WorkItemImpl workItem = new WorkItemImpl();
-            workItem.setParameter("camel-endpoint-id", "start");
-            workItem.setParameter("request", expectedBody);
+            workItem.setParameter(JBPMConstants.CAMEL_ENDPOINT_ID_WI_PARAM, "start");
+            workItem.setParameter("Request", expectedBody);
 
             TestWorkItemManager manager = new TestWorkItemManager();
 
@@ -90,7 +91,7 @@ public class CamelWorkItemHandlerIntegrationTests extends CamelTestSupport {
             @Override
             public void configure() throws Exception {
                 from("direct:start").routeId(routeId)
-                        .setBody(simple("${body.getParameter(\"request\")}"))
+                        .setBody(simple("${body.getParameter(\"Request\")}"))
                         .throwException(new IllegalArgumentException("Illegal contennt!"))
                         .to("mock:result");
             }
@@ -98,15 +99,15 @@ public class CamelWorkItemHandlerIntegrationTests extends CamelTestSupport {
         context.addRoutes(builder);
         try {
             // Register the Camel Context with the jBPM ServiceRegistry.
-            ServiceRegistry.get().register("GlobalCamelService", context);
+            ServiceRegistry.get().register(JBPMConstants.GLOBAL_CAMEL_CONTEXT_SERVICE_KEY, context);
 
             // Test
             String expectedBody = "helloRequest";
             resultEndpoint.expectedBodiesReceived(expectedBody);
 
             WorkItemImpl workItem = new WorkItemImpl();
-            workItem.setParameter("camel-endpoint-id", "start");
-            workItem.setParameter("request", expectedBody);
+            workItem.setParameter(JBPMConstants.CAMEL_ENDPOINT_ID_WI_PARAM, "start");
+            workItem.setParameter("Request", expectedBody);
 
             TestWorkItemManager manager = new TestWorkItemManager();
 
@@ -131,22 +132,22 @@ public class CamelWorkItemHandlerIntegrationTests extends CamelTestSupport {
             @Override
             public void configure() throws Exception {
                 from("direct:start").routeId(routeId)
-                        .setBody(simple("${body.getParameter(\"request\")}"))
+                        .setBody(simple("${body.getParameter(\"Request\")}"))
                         .to("mock:result");
             }
         };
         context.addRoutes(builder);
         try {
             // Register the Camel Context with the jBPM ServiceRegistry.
-            ServiceRegistry.get().register("GlobalCamelService", context);
+            ServiceRegistry.get().register(JBPMConstants.GLOBAL_CAMEL_CONTEXT_SERVICE_KEY, context);
 
             // Test
             String expectedBody = "helloRequest";
             resultEndpoint.expectedBodiesReceived(expectedBody);
 
             WorkItemImpl workItem = new WorkItemImpl();
-            workItem.setParameter("camel-endpoint-id", "start");
-            workItem.setParameter("request", expectedBody);
+            workItem.setParameter(JBPMConstants.CAMEL_ENDPOINT_ID_WI_PARAM, "start");
+            workItem.setParameter("Request", expectedBody);
 
             TestWorkItemManager manager = new TestWorkItemManager();
 
@@ -172,7 +173,7 @@ public class CamelWorkItemHandlerIntegrationTests extends CamelTestSupport {
             @Override
             public void configure() throws Exception {
                 from("direct:start").routeId(routeId)
-                        .setBody(simple("${body.getParameter(\"request\")}"))
+                        .setBody(simple("${body.getParameter(\"Request\")}"))
                         .throwException(new IllegalArgumentException("Illegal contennt!"))
                         .to("mock:result");
             }
@@ -180,15 +181,15 @@ public class CamelWorkItemHandlerIntegrationTests extends CamelTestSupport {
         context.addRoutes(builder);
         try {
             // Register the Camel Context with the jBPM ServiceRegistry.
-            ServiceRegistry.get().register("GlobalCamelService", context);
+            ServiceRegistry.get().register(JBPMConstants.GLOBAL_CAMEL_CONTEXT_SERVICE_KEY, context);
 
             // Test
             String expectedBody = "helloRequest";
             resultEndpoint.expectedBodiesReceived(expectedBody);
 
             WorkItemImpl workItem = new WorkItemImpl();
-            workItem.setParameter("camel-endpoint-id", "start");
-            workItem.setParameter("request", expectedBody);
+            workItem.setParameter(JBPMConstants.CAMEL_ENDPOINT_ID_WI_PARAM, "start");
+            workItem.setParameter("Request", expectedBody);
 
             TestWorkItemManager manager = new TestWorkItemManager();
 
diff --git a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/DeploymentContextCamelCommandTest.java b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/DeploymentContextCamelCommandTest.java
index b703456..e1aef21 100644
--- a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/DeploymentContextCamelCommandTest.java
+++ b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/DeploymentContextCamelCommandTest.java
@@ -25,6 +25,7 @@ import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.jbpm.JBPMConstants;
 import org.drools.core.process.instance.impl.WorkItemImpl;
 import org.jbpm.services.api.service.ServiceRegistry;
 import org.junit.Test;
@@ -76,11 +77,11 @@ public class DeploymentContextCamelCommandTest {
         when(outMessage.getBody()).thenReturn(testReponse);
         
         //Register the RuntimeManager bound camelcontext.
-        ServiceRegistry.get().register(deploymentId + "_CamelService", camelContext);
+        ServiceRegistry.get().register(deploymentId + JBPMConstants.DEPLOYMENT_CAMEL_CONTEXT_SERVICE_KEY_POSTFIX, camelContext);
         
         WorkItemImpl workItem = new WorkItemImpl();
-        workItem.setParameter("camel-endpoint-id", camelEndpointId);
-        workItem.setParameter("request", "someRequest");
+        workItem.setParameter(JBPMConstants.CAMEL_ENDPOINT_ID_WI_PARAM, camelEndpointId);
+        workItem.setParameter("Request", "someRequest");
         
         when(commandContext.getData("workItem")).thenReturn(workItem);
         when(commandContext.getData("deploymentId")).thenReturn(deploymentId);
@@ -90,6 +91,6 @@ public class DeploymentContextCamelCommandTest {
         
         assertNotNull(results);
         assertEquals(2, results.getData().size());
-        assertEquals(testReponse, results.getData().get("response"));
+        assertEquals(testReponse, results.getData().get(JBPMConstants.RESPONSE_WI_PARAM));
     }
 }
diff --git a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommandTest.java b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommandTest.java
index ad36879..048ec72 100644
--- a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommandTest.java
+++ b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommandTest.java
@@ -25,6 +25,7 @@ import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.jbpm.JBPMConstants;
 import org.drools.core.process.instance.impl.WorkItemImpl;
 import org.jbpm.services.api.service.ServiceRegistry;
 import org.junit.Test;
@@ -78,11 +79,11 @@ public class GlobalContextCamelCommandTest {
      when(outMessage.getBody()).thenReturn(testReponse);
     
      //Register the RuntimeManager bound camelcontext.
-     ServiceRegistry.get().register("GlobalCamelService", camelContext);
+     ServiceRegistry.get().register(JBPMConstants.GLOBAL_CAMEL_CONTEXT_SERVICE_KEY, camelContext);
     
         WorkItemImpl workItem = new WorkItemImpl();
-        workItem.setParameter("camel-endpoint-id", camelEndpointId);
-        workItem.setParameter("request", "someRequest");
+        workItem.setParameter(JBPMConstants.CAMEL_ENDPOINT_ID_WI_PARAM, camelEndpointId);
+        workItem.setParameter("Request", "someRequest");
         
         when(commandContext.getData(anyString())).thenReturn(workItem);
         
@@ -92,6 +93,6 @@ public class GlobalContextCamelCommandTest {
         
         assertNotNull(results);
         assertEquals(2, results.getData().size());
-        assertEquals(testReponse, results.getData().get("response"));
+        assertEquals(testReponse, results.getData().get(JBPMConstants.RESPONSE_WI_PARAM));
     }
 }
diff --git a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/InOnlyCamelWorkItemHandlerTest.java b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/InOnlyCamelWorkItemHandlerTest.java
index 1ad1bf9..a862f22 100644
--- a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/InOnlyCamelWorkItemHandlerTest.java
+++ b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/InOnlyCamelWorkItemHandlerTest.java
@@ -26,6 +26,7 @@ import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.jbpm.JBPMConstants;
 import org.apache.camel.impl.DefaultHeadersMapFactory;
 import org.apache.camel.spi.HeadersMapFactory;
 import org.drools.core.process.instance.impl.WorkItemImpl;
@@ -79,8 +80,8 @@ public class InOnlyCamelWorkItemHandlerTest {
         ServiceRegistry.get().register(runtimeManagerId + "_CamelService", camelContext);
 
         WorkItemImpl workItem = new WorkItemImpl();
-        workItem.setParameter("camel-endpoint-id", camelEndpointId);
-        workItem.setParameter("request", "someRequest");
+        workItem.setParameter(JBPMConstants.CAMEL_ENDPOINT_ID_WI_PARAM, camelEndpointId);
+        workItem.setParameter("Request", "someRequest");
         workItem.setDeploymentId("testDeploymentId");
         workItem.setProcessInstanceId(1L);
         workItem.setId(1L);
diff --git a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/InOutCamelWorkItemHandlerTest.java b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/InOutCamelWorkItemHandlerTest.java
index e4bc6ba..1277f04 100644
--- a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/InOutCamelWorkItemHandlerTest.java
+++ b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/InOutCamelWorkItemHandlerTest.java
@@ -28,6 +28,7 @@ import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.jbpm.JBPMConstants;
 import org.apache.camel.impl.DefaultHeadersMapFactory;
 import org.apache.camel.spi.HeadersMapFactory;
 import org.drools.core.process.instance.impl.WorkItemImpl;
@@ -80,8 +81,8 @@ public class InOutCamelWorkItemHandlerTest {
 
         TestWorkItemManager manager = new TestWorkItemManager();
         WorkItemImpl workItem = new WorkItemImpl();
-        workItem.setParameter("camel-endpoint-id", camelEndpointId);
-        workItem.setParameter("request", "someRequest");
+        workItem.setParameter("CamelEndpointId", camelEndpointId);
+        workItem.setParameter("Request", "someRequest");
         workItem.setDeploymentId("testDeploymentId");
         workItem.setProcessInstanceId(1L);
         workItem.setId(1L);
@@ -95,7 +96,7 @@ public class InOutCamelWorkItemHandlerTest {
         assertThat(manager.getResults().containsKey(workItem.getId()), is(true));
         Map<String, Object> results = manager.getResults(workItem.getId());
         assertThat(results.size(), equalTo(2));
-        assertThat(results.get("response"), equalTo(testReponse));
+        assertThat(results.get("Response"), equalTo(testReponse));
     }
 
     @Test
@@ -124,8 +125,8 @@ public class InOutCamelWorkItemHandlerTest {
         ServiceRegistry.get().register(runtimeManagerId + "_CamelService", camelContext);
 
         WorkItemImpl workItem = new WorkItemImpl();
-        workItem.setParameter("camel-endpoint-id", camelEndpointId);
-        workItem.setParameter("request", "someRequest");
+        workItem.setParameter(JBPMConstants.CAMEL_ENDPOINT_ID_WI_PARAM, camelEndpointId);
+        workItem.setParameter("Request", "someRequest");
         workItem.setDeploymentId("testDeploymentId");
         workItem.setProcessInstanceId(1L);
         workItem.setId(1L);
@@ -141,7 +142,7 @@ public class InOutCamelWorkItemHandlerTest {
         
         Map<String, Object> results = manager.getResults(workItem.getId());
         assertThat(results.size(), equalTo(2));
-        assertThat(results.get("response"), equalTo(testReponse));
+        assertThat(results.get(JBPMConstants.RESPONSE_WI_PARAM), equalTo(testReponse));
     }
   
 }

Reply | Threaded
Open this post in threaded view
|

[camel] 04/35: Removed TODO comments.

acosentino
In reply to this post by acosentino
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch sandbox/camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 9024d73eaa365eea161e64160f54e638754164d4
Author: Duncan Doyle <[hidden email]>
AuthorDate: Fri Nov 30 09:34:22 2018 +0100

    Removed TODO comments.
---
 .../org/apache/camel/component/jbpm/workitem/AbstractCamelCommand.java | 3 +--
 .../camel/component/jbpm/workitem/AbstractCamelWorkItemHandler.java    | 2 --
 .../camel/component/jbpm/workitem/GlobalContextCamelCommand.java       | 1 -
 3 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelCommand.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelCommand.java
index adfd413..a26aa32 100644
--- a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelCommand.java
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelCommand.java
@@ -56,8 +56,7 @@ public abstract class AbstractCamelCommand implements Command,
     @Override
     public ExecutionResults execute(CommandContext ctx) throws Exception {
         
-        
-     WorkItem workItem = (WorkItem) ctx.getData("workItem");
+        WorkItem workItem = (WorkItem) ctx.getData("workItem");
     
      String camelEndpointId = (String) workItem.getParameter(JBPMConstants.CAMEL_ENDPOINT_ID_WI_PARAM);
 
diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelWorkItemHandler.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelWorkItemHandler.java
index 743393c..23d7a35 100644
--- a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelWorkItemHandler.java
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelWorkItemHandler.java
@@ -69,7 +69,6 @@ public abstract class AbstractCamelWorkItemHandler extends AbstractLogOrThrowWor
 
     public AbstractCamelWorkItemHandler(String camelEndointId) {
         CamelContext globalCamelContext = (CamelContext) ServiceRegistry.get().service(JBPMConstants.GLOBAL_CAMEL_CONTEXT_SERVICE_KEY);
-        // TODO: Should we allow to set the maximumCacheSize on the producer?
         this.producerTemplate = globalCamelContext.createProducerTemplate();
         this.camelEndpointId = camelEndointId;
     }
@@ -85,7 +84,6 @@ public abstract class AbstractCamelWorkItemHandler extends AbstractLogOrThrowWor
     public AbstractCamelWorkItemHandler(RuntimeManager runtimeManager, String camelEndpointId) {
         String runtimeCamelContextKey = runtimeManager.getIdentifier() + JBPMConstants.DEPLOYMENT_CAMEL_CONTEXT_SERVICE_KEY_POSTFIX;
         CamelContext runtimeCamelContext = (CamelContext) ServiceRegistry.get().service(runtimeCamelContextKey);
-        // TODO: Should we allow to set the maximumCacheSize on the producer?
         this.producerTemplate = runtimeCamelContext.createProducerTemplate();
         this.camelEndpointId = camelEndpointId;
     }
diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommand.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommand.java
index 10950b3..e129a12 100644
--- a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommand.java
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommand.java
@@ -36,7 +36,6 @@ public class GlobalContextCamelCommand extends AbstractCamelCommand {
     
     public GlobalContextCamelCommand() {
         CamelContext globalCamelContext = (CamelContext) ServiceRegistry.get().service(JBPMConstants.GLOBAL_CAMEL_CONTEXT_SERVICE_KEY);
-        // TODO: Should we allow to set the maximumCacheSize on the producer?
         this.globalContextProducerTemplate = globalCamelContext.createProducerTemplate();
     }
     

Reply | Threaded
Open this post in threaded view
|

[camel] 05/35: CAMEL-12964: Fix CS

acosentino
In reply to this post by acosentino
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch sandbox/camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit b5d9201fd24f22253b08b8fb6e170abfed910712
Author: Dmitry Volodin <[hidden email]>
AuthorDate: Fri Nov 30 13:18:23 2018 +0300

    CAMEL-12964: Fix CS
---
 .../jbpm/server/CamelKieServerExtension.java       | 29 +++++------
 .../jbpm/workitem/AbstractCamelCommand.java        | 60 ++++++++++------------
 .../workitem/AbstractCamelWorkItemHandler.java     |  1 -
 .../workitem/DeploymentContextCamelCommand.java    |  5 +-
 .../jbpm/workitem/GlobalContextCamelCommand.java   |  8 ++-
 .../jbpm/workitem/InOnlyCamelWorkItemHandler.java  |  1 -
 .../jbpm/workitem/InOutCamelWorkItemHandler.java   |  1 -
 .../jbpm/JBPMComponentIntegrationTest.java         |  1 -
 .../CamelWorkItemHandlerIntegrationTests.java      |  5 +-
 .../DeploymentContextCamelCommandTest.java         |  9 ++--
 .../workitem/GlobalContextCamelCommandTest.java    | 59 ++++++++++-----------
 .../workitem/InOnlyCamelWorkItemHandlerTest.java   | 11 ++--
 .../workitem/InOutCamelWorkItemHandlerTest.java    | 12 ++---
 13 files changed, 92 insertions(+), 110 deletions(-)

diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/server/CamelKieServerExtension.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/server/CamelKieServerExtension.java
index 659a498..1783b04 100644
--- a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/server/CamelKieServerExtension.java
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/server/CamelKieServerExtension.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.jbpm.server;
 
 import java.io.InputStream;
@@ -44,7 +43,7 @@ public class CamelKieServerExtension implements KieServerExtension {
 
     private static final Boolean DISABLED = Boolean.parseBoolean(System.getProperty("org.camel.server.ext.disabled", "false"));
 
-    protected DefaultCamelContext camel;
+    protected DefaultCamelContext camelContext;
 
     protected boolean managedCamel;
 
@@ -54,14 +53,14 @@ public class CamelKieServerExtension implements KieServerExtension {
         this.managedCamel = true;
     }
 
-    public CamelKieServerExtension(DefaultCamelContext camel) {
-        this.camel = camel;
+    public CamelKieServerExtension(DefaultCamelContext camelContext) {
+        this.camelContext = camelContext;
         this.managedCamel = false;
     }
 
     @Override
     public boolean isInitialized() {
-        return camel != null;
+        return camelContext != null;
     }
 
     @Override
@@ -71,31 +70,31 @@ public class CamelKieServerExtension implements KieServerExtension {
 
     @Override
     public void init(KieServerImpl kieServer, KieServerRegistry registry) {
-        if (this.managedCamel && this.camel == null) {
-            this.camel = new DefaultCamelContext();
-            this.camel.setName("KIE Server Camel context");
+        if (this.managedCamel && this.camelContext == null) {
+            this.camelContext = new DefaultCamelContext();
+            this.camelContext.setName("KIE Server Camel context");
 
             try (InputStream is = this.getClass().getResourceAsStream("/global-camel-routes.xml")) {
                 if (is != null) {
 
-                    RoutesDefinition routes = camel.loadRoutesDefinition(is);
-                    camel.addRouteDefinitions(routes.getRoutes());
+                    RoutesDefinition routes = camelContext.loadRoutesDefinition(is);
+                    camelContext.addRouteDefinitions(routes.getRoutes());
                 }
             } catch (Exception e) {
                 LOGGER.error("Error while adding Camel context for KIE Server", e);
             }
         }
 
-        ServiceRegistry.get().register(JBPMConstants.GLOBAL_CAMEL_CONTEXT_SERVICE_KEY, this.camel);
+        ServiceRegistry.get().register(JBPMConstants.GLOBAL_CAMEL_CONTEXT_SERVICE_KEY, this.camelContext);
     }
 
     @Override
     public void destroy(KieServerImpl kieServer, KieServerRegistry registry) {
         ServiceRegistry.get().remove("GlobalCamelService");
 
-        if (this.managedCamel && this.camel != null) {
+        if (this.managedCamel && this.camelContext != null) {
             try {
-                this.camel.stop();
+                this.camelContext.stop();
             } catch (Exception e) {
                 LOGGER.error("Failed at stopping KIE Server extension {}", EXTENSION_NAME);
             }
@@ -184,9 +183,9 @@ public class CamelKieServerExtension implements KieServerExtension {
 
     @Override
     public void serverStarted() {
-        if (this.managedCamel && this.camel != null && !this.camel.isStarted()) {
+        if (this.managedCamel && this.camelContext != null && !this.camelContext.isStarted()) {
             try {
-                this.camel.start();
+                this.camelContext.start();
             } catch (Exception e) {
                 LOGGER.error("Failed at start Camel context", e);
             }
diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelCommand.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelCommand.java
index a26aa32..1900960 100644
--- a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelCommand.java
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelCommand.java
@@ -14,20 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.jbpm.workitem;
 
-import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.ExchangeBuilder;
 import org.apache.camel.component.jbpm.JBPMConstants;
-import org.jbpm.services.api.service.ServiceRegistry;
 import org.kie.api.executor.Command;
 import org.kie.api.executor.CommandContext;
 import org.kie.api.executor.ExecutionResults;
-import org.kie.api.runtime.manager.RuntimeManager;
 import org.kie.api.runtime.process.WorkItem;
 import org.kie.internal.runtime.Cacheable;
 import org.slf4j.Logger;
@@ -45,41 +41,41 @@ import org.slf4j.LoggerFactory;
  * {@link Message} is provided via the <code>Message</code> parameter. This gives the user access to more advanced fields like message headers
  * and attachments.
  */
-public abstract class AbstractCamelCommand implements Command,
-                                          Cacheable {
-
-    private static final Logger logger = LoggerFactory.getLogger(AbstractCamelCommand.class);
+public abstract class AbstractCamelCommand implements Command, Cacheable {
+    private static final Logger LOGGER = LoggerFactory.getLogger(AbstractCamelCommand.class);
 
- public AbstractCamelCommand() {
- }
-
+    public AbstractCamelCommand() {
+    }
+    
     @Override
     public ExecutionResults execute(CommandContext ctx) throws Exception {
         
         WorkItem workItem = (WorkItem) ctx.getData("workItem");
-    
-     String camelEndpointId = (String) workItem.getParameter(JBPMConstants.CAMEL_ENDPOINT_ID_WI_PARAM);
-
- // We only support direct. We don't need to support more, as direct simply gives us the entrypoint into the actual Camel Routes.
- String camelUri = "direct://" + camelEndpointId;
-
- ProducerTemplate producerTemplate = getProducerTemplate(ctx);
- Exchange inExchange = ExchangeBuilder.anExchange(producerTemplate.getCamelContext()).withBody(workItem).build();
- Exchange outExchange = producerTemplate.send(camelUri, inExchange);
- // producerTemplate.send does not throw exceptions, instead they are set on the returned Exchange.
- if (outExchange.getException() != null) {
- throw outExchange.getException();
- }
- Message outMessage = outExchange.getOut();
-
- ExecutionResults results = new ExecutionResults();
- Object response = outMessage.getBody();
- results.setData(JBPMConstants.RESPONSE_WI_PARAM, response);
- results.setData(JBPMConstants.MESSAGE_WI_PARAM, outMessage);
-    
+      
+        String camelEndpointId = (String) workItem.getParameter(JBPMConstants.CAMEL_ENDPOINT_ID_WI_PARAM);
+
+        // We only support direct. We don't need to support more, as direct simply gives us the entrypoint into the actual Camel Routes.
+        String camelUri = "direct://" + camelEndpointId;
+        
+        ProducerTemplate producerTemplate = getProducerTemplate(ctx);
+        Exchange inExchange = ExchangeBuilder.anExchange(producerTemplate.getCamelContext()).withBody(workItem).build();
+        Exchange outExchange = producerTemplate.send(camelUri, inExchange);
+
+        // producerTemplate.send does not throw exceptions, instead they are set on the returned Exchange.
+        if (outExchange.getException() != null) {
+            throw outExchange.getException();
+        }
+
+        Message outMessage = outExchange.getOut();
+
+        ExecutionResults results = new ExecutionResults();
+        Object response = outMessage.getBody();
+        results.setData(JBPMConstants.RESPONSE_WI_PARAM, response);
+        results.setData(JBPMConstants.MESSAGE_WI_PARAM, outMessage);
+
         return results;
     }
-    
+
     protected abstract ProducerTemplate getProducerTemplate(CommandContext ctx);
 
 }
\ No newline at end of file
diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelWorkItemHandler.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelWorkItemHandler.java
index 23d7a35..d5ea7df 100644
--- a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelWorkItemHandler.java
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/AbstractCamelWorkItemHandler.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.jbpm.workitem;
 
 import org.apache.camel.CamelContext;
diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/DeploymentContextCamelCommand.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/DeploymentContextCamelCommand.java
index 009b909..69c74ad 100644
--- a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/DeploymentContextCamelCommand.java
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/DeploymentContextCamelCommand.java
@@ -32,11 +32,10 @@ import org.slf4j.LoggerFactory;
  * CamelCommand that uses the {@link CamelContext} registered on the {@link ServiceRegistry} for this specific deployment.
  */
 public class DeploymentContextCamelCommand extends AbstractCamelCommand {
+    private static final Logger LOGGER = LoggerFactory.getLogger(DeploymentContextCamelCommand.class);
 
     private final Map<String, ProducerTemplate> templates = new ConcurrentHashMap<>();
 
-    private static final Logger logger = LoggerFactory.getLogger(DeploymentContextCamelCommand.class);
-
     @Override
     protected ProducerTemplate getProducerTemplate(CommandContext ctx) {
         String deploymentId = (String) ctx.getData("deploymentId");
@@ -62,7 +61,7 @@ public class DeploymentContextCamelCommand extends AbstractCamelCommand {
             try {
                 nextTemplate.stop();
             } catch (Exception e) {
-                logger.warn("Error encountered while closing the Camel Producer Template.", e);
+                LOGGER.warn("Error encountered while closing the Camel Producer Template.", e);
                 // Not much we can do here, so swallowing exception.
             }
         }
diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommand.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommand.java
index e129a12..aa46014 100644
--- a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommand.java
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommand.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.jbpm.workitem;
 
 import org.apache.camel.CamelContext;
@@ -29,10 +28,9 @@ import org.slf4j.LoggerFactory;
  * CamelCommand that uses the global {@link CamelContext} registered on the {@link ServiceRegistry}.
  */
 public class GlobalContextCamelCommand extends AbstractCamelCommand {
-
-    private final ProducerTemplate globalContextProducerTemplate;
+    private static final Logger LOGGER = LoggerFactory.getLogger(GlobalContextCamelCommand.class);
     
-    private static final Logger logger = LoggerFactory.getLogger(GlobalContextCamelCommand.class);
+    private final ProducerTemplate globalContextProducerTemplate;
     
     public GlobalContextCamelCommand() {
         CamelContext globalCamelContext = (CamelContext) ServiceRegistry.get().service(JBPMConstants.GLOBAL_CAMEL_CONTEXT_SERVICE_KEY);
@@ -49,7 +47,7 @@ public class GlobalContextCamelCommand extends AbstractCamelCommand {
         try {
             this.globalContextProducerTemplate.stop();
         } catch (Exception e) {
-            logger.warn("Error encountered while closing the Camel Producer Template.", e);
+            LOGGER.warn("Error encountered while closing the Camel Producer Template.", e);
             // Not much we can do here, so swallowing exception.
         }
     }
diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/InOnlyCamelWorkItemHandler.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/InOnlyCamelWorkItemHandler.java
index b97b0ad..b20bcda 100644
--- a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/InOnlyCamelWorkItemHandler.java
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/InOnlyCamelWorkItemHandler.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.jbpm.workitem;
 
 import org.apache.camel.Exchange;
diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/InOutCamelWorkItemHandler.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/InOutCamelWorkItemHandler.java
index a8482dd..6b6ef5f 100644
--- a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/InOutCamelWorkItemHandler.java
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/InOutCamelWorkItemHandler.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.jbpm.workitem;
 
 import java.util.HashMap;
diff --git a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/JBPMComponentIntegrationTest.java b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/JBPMComponentIntegrationTest.java
index fbab216..046b118 100644
--- a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/JBPMComponentIntegrationTest.java
+++ b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/JBPMComponentIntegrationTest.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.jbpm;
 
 import java.util.HashMap;
diff --git a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/CamelWorkItemHandlerIntegrationTests.java b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/CamelWorkItemHandlerIntegrationTests.java
index 4e594dd..67d54fb 100644
--- a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/CamelWorkItemHandlerIntegrationTests.java
+++ b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/CamelWorkItemHandlerIntegrationTests.java
@@ -14,11 +14,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.jbpm.workitem;
 
-import static org.hamcrest.CoreMatchers.*;
-
 import org.apache.camel.EndpointInject;
 import org.apache.camel.Produce;
 import org.apache.camel.ProducerTemplate;
@@ -33,6 +30,8 @@ import org.jbpm.services.api.service.ServiceRegistry;
 import org.junit.Test;
 import org.kie.api.runtime.process.WorkItemHandler;
 
+import static org.hamcrest.CoreMatchers.*;
+
 //http://camel.apache.org/using-getin-or-getout-methods-on-exchange.html
 //http://camel.apache.org/async.html
 public class CamelWorkItemHandlerIntegrationTests extends CamelTestSupport {
diff --git a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/DeploymentContextCamelCommandTest.java b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/DeploymentContextCamelCommandTest.java
index e1aef21..b0086b9 100644
--- a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/DeploymentContextCamelCommandTest.java
+++ b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/DeploymentContextCamelCommandTest.java
@@ -14,13 +14,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.jbpm.workitem;
 
-import static org.junit.Assert.*;
-import static org.mockito.ArgumentMatchers.*;
-import static org.mockito.Mockito.*;
-
 import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
@@ -37,6 +32,10 @@ import org.kie.api.runtime.manager.RuntimeManager;
 import org.mockito.Mock;
 import org.mockito.junit.MockitoJUnitRunner;
 
+import static org.junit.Assert.*;
+import static org.mockito.ArgumentMatchers.*;
+import static org.mockito.Mockito.*;
+
 @RunWith(MockitoJUnitRunner.class)
 public class DeploymentContextCamelCommandTest {
     
diff --git a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommandTest.java b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommandTest.java
index 048ec72..031bc69 100644
--- a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommandTest.java
+++ b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/GlobalContextCamelCommandTest.java
@@ -14,13 +14,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.jbpm.workitem;
 
-import static org.junit.Assert.*;
-import static org.mockito.ArgumentMatchers.*;
-import static org.mockito.Mockito.*;
-
 import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
@@ -37,10 +32,14 @@ import org.kie.api.runtime.manager.RuntimeManager;
 import org.mockito.Mock;
 import org.mockito.junit.MockitoJUnitRunner;
 
+import static org.junit.Assert.*;
+import static org.mockito.ArgumentMatchers.*;
+import static org.mockito.Mockito.*;
+
 @RunWith(MockitoJUnitRunner.class)
 public class GlobalContextCamelCommandTest {
 
- @Mock
+    @Mock
     ProducerTemplate producerTemplate;
 
     @Mock
@@ -61,38 +60,36 @@ public class GlobalContextCamelCommandTest {
     @Test
     public void testExecuteGlobalCommand() throws Exception {
     
-     String camelEndpointId = "testCamelRoute";
-     String camelRouteUri = "direct://" + camelEndpointId;
-    
-     String testReponse = "testResponse";
-    
-     String runtimeManagerId = "testRuntimeManager";
-    
-     when(producerTemplate.send(eq(camelRouteUri), any(Exchange.class))).thenReturn(outExchange);
-    
-    
-     when(producerTemplate.getCamelContext()).thenReturn(camelContext);
-    
-     when(camelContext.createProducerTemplate()).thenReturn(producerTemplate);
-    
-     when(outExchange.getOut()).thenReturn(outMessage);
-     when(outMessage.getBody()).thenReturn(testReponse);
-    
-     //Register the RuntimeManager bound camelcontext.
-     ServiceRegistry.get().register(JBPMConstants.GLOBAL_CAMEL_CONTEXT_SERVICE_KEY, camelContext);
-    
+        String camelEndpointId = "testCamelRoute";
+        String camelRouteUri = "direct://" + camelEndpointId;
+
+        String testReponse = "testResponse";
+
+        String runtimeManagerId = "testRuntimeManager";
+
+        when(producerTemplate.send(eq(camelRouteUri), any(Exchange.class))).thenReturn(outExchange);
+
+        when(producerTemplate.getCamelContext()).thenReturn(camelContext);
+
+        when(camelContext.createProducerTemplate()).thenReturn(producerTemplate);
+
+        when(outExchange.getOut()).thenReturn(outMessage);
+        when(outMessage.getBody()).thenReturn(testReponse);
+
+        //Register the RuntimeManager bound camelContext.
+        ServiceRegistry.get().register(JBPMConstants.GLOBAL_CAMEL_CONTEXT_SERVICE_KEY, camelContext);
+
         WorkItemImpl workItem = new WorkItemImpl();
         workItem.setParameter(JBPMConstants.CAMEL_ENDPOINT_ID_WI_PARAM, camelEndpointId);
         workItem.setParameter("Request", "someRequest");
-        
+
         when(commandContext.getData(anyString())).thenReturn(workItem);
-        
+
         Command command = new GlobalContextCamelCommand();
         ExecutionResults results = command.execute(commandContext);
-        
-        
+
         assertNotNull(results);
         assertEquals(2, results.getData().size());
         assertEquals(testReponse, results.getData().get(JBPMConstants.RESPONSE_WI_PARAM));
     }
-}
+}
\ No newline at end of file
diff --git a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/InOnlyCamelWorkItemHandlerTest.java b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/InOnlyCamelWorkItemHandlerTest.java
index a862f22..b97822e 100644
--- a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/InOnlyCamelWorkItemHandlerTest.java
+++ b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/InOnlyCamelWorkItemHandlerTest.java
@@ -14,14 +14,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.jbpm.workitem;
 
-import static org.hamcrest.CoreMatchers.*;
-import static org.junit.Assert.*;
-import static org.mockito.ArgumentMatchers.*;
-import static org.mockito.Mockito.*;
-
 import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
@@ -39,6 +33,11 @@ import org.mockito.ArgumentMatchers;
 import org.mockito.Mock;
 import org.mockito.junit.MockitoJUnitRunner;
 
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.*;
+import static org.mockito.ArgumentMatchers.*;
+import static org.mockito.Mockito.*;
+
 @RunWith(MockitoJUnitRunner.class)
 public class InOnlyCamelWorkItemHandlerTest {
 
diff --git a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/InOutCamelWorkItemHandlerTest.java b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/InOutCamelWorkItemHandlerTest.java
index 1277f04..578de78 100644
--- a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/InOutCamelWorkItemHandlerTest.java
+++ b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/workitem/InOutCamelWorkItemHandlerTest.java
@@ -14,14 +14,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.jbpm.workitem;
 
-import static org.hamcrest.CoreMatchers.*;
-import static org.junit.Assert.*;
-import static org.mockito.ArgumentMatchers.*;
-import static org.mockito.Mockito.*;
-
 import java.util.Map;
 
 import org.apache.camel.CamelContext;
@@ -41,6 +35,12 @@ import org.mockito.ArgumentMatchers;
 import org.mockito.Mock;
 import org.mockito.junit.MockitoJUnitRunner;
 
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.*;
+import static org.mockito.ArgumentMatchers.*;
+import static org.mockito.Mockito.*;
+
+
 @RunWith(MockitoJUnitRunner.class)
 public class InOutCamelWorkItemHandlerTest {
 

Reply | Threaded
Open this post in threaded view
|

[camel] 06/35: Upgrade Rabbitmq client to version 5.5.1

acosentino
In reply to this post by acosentino
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch sandbox/camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit df880c95cc2f4ac09fe85d616e88dc9e1b26d308
Author: Andrea Cosentino <[hidden email]>
AuthorDate: Fri Nov 30 11:20:28 2018 +0100

    Upgrade Rabbitmq client to version 5.5.1
---
 parent/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/parent/pom.xml b/parent/pom.xml
index d7f12a0..953d347 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -578,7 +578,7 @@
     <quartz-version-range>[1.8,2)</quartz-version-range>
     <quartz2-version>2.3.0</quartz2-version>
     <quickfixj-version>2.1.0</quickfixj-version>
-    <rabbitmq-amqp-client-version>5.5.0</rabbitmq-amqp-client-version>
+    <rabbitmq-amqp-client-version>5.5.1</rabbitmq-amqp-client-version>
     <reactive-streams-version>1.0.2</reactive-streams-version>
     <reactor-version>3.2.3.RELEASE</reactor-version>
     <reflections-version>0.9.11</reflections-version>

Reply | Threaded
Open this post in threaded view
|

[camel] 07/35: [CAMEL-12605] Refactoring for compression support.

acosentino
In reply to this post by acosentino
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch sandbox/camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit bb2c087e256371ab927b0a2436dee8ef3138394b
Author: William Collins <[hidden email]>
AuthorDate: Wed Nov 28 11:30:54 2018 -0500

    [CAMEL-12605] Refactoring for compression support.
---
 .../camel/component/as2/api/AS2ClientManager.java  | 122 +++++++++++++++++++--
 ...Structure.java => AS2CompressionAlgorithm.java} |  36 +++---
 .../component/as2/api/AS2MessageStructure.java     |  10 +-
 ...> ApplicationPkcs7MimeEnvelopedDataEntity.java} |   9 +-
 .../component/as2/api/entity/EntityParser.java     |   4 +-
 .../CompressionUtils.java}                         |  36 +++---
 .../camel/component/as2/api/AS2MessageTest.java    |  41 +++----
 .../component/as2/api/entity/EntityParserTest.java |   2 +-
 .../src/main/docs/as2-component.adoc               |   3 +-
 .../camel/component/as2/AS2Configuration.java      |  17 ++-
 .../as2/AS2ClientManagerIntegrationTest.java       |   6 +-
 .../as2/AS2ServerManagerIntegrationTest.java       |   4 +-
 .../as2/springboot/AS2ComponentConfiguration.java  |  14 +++
 13 files changed, 216 insertions(+), 88 deletions(-)

diff --git a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2ClientManager.java b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2ClientManager.java
index ecd1f7a..8e1905c 100644
--- a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2ClientManager.java
+++ b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2ClientManager.java
@@ -21,9 +21,11 @@ import java.security.PrivateKey;
 import java.security.cert.Certificate;
 
 import org.apache.camel.component.as2.api.entity.ApplicationEDIEntity;
-import org.apache.camel.component.as2.api.entity.ApplicationPkcs7MimeEntity;
+import org.apache.camel.component.as2.api.entity.ApplicationPkcs7MimeCompressedDataEntity;
+import org.apache.camel.component.as2.api.entity.ApplicationPkcs7MimeEnvelopedDataEntity;
 import org.apache.camel.component.as2.api.entity.EntityParser;
 import org.apache.camel.component.as2.api.entity.MultipartSignedEntity;
+import org.apache.camel.component.as2.api.util.CompressionUtils;
 import org.apache.camel.component.as2.api.util.EncryptingUtils;
 import org.apache.camel.component.as2.api.util.EntityUtils;
 import org.apache.camel.component.as2.api.util.SigningUtils;
@@ -33,7 +35,9 @@ import org.apache.http.entity.ContentType;
 import org.apache.http.message.BasicHttpEntityEnclosingRequest;
 import org.apache.http.protocol.HttpCoreContext;
 import org.apache.http.util.Args;
+import org.bouncycastle.cms.CMSCompressedDataGenerator;
 import org.bouncycastle.cms.CMSEnvelopedDataGenerator;
+import org.bouncycastle.operator.OutputCompressor;
 import org.bouncycastle.operator.OutputEncryptor;
 
 /**
@@ -157,6 +161,12 @@ public class AS2ClientManager {
     public static final String ENCRYPTING_PRIVATE_KEY = CAMEL_AS2_CLIENT_PREFIX + "encrypting-private-key";
 
     /**
+     * The HTTP Context Attribute containing the algorithm used to compress EDI
+     * message
+     */
+    public static final String COMPRESSION_ALGORITHM = CAMEL_AS2_CLIENT_PREFIX + "compression-algorithm-name";
+
+    /**
      * The HTTP Context Attribute containing the internet e-mail address of
      * sending system requesting a message disposition notification.
      */
@@ -213,6 +223,7 @@ public class AS2ClientManager {
                                 AS2SignatureAlgorithm signingAlgorithm,
                                 Certificate[] signingCertificateChain,
                                 PrivateKey signingPrivateKey,
+                                AS2CompressionAlgorithm compressionAlgorithm,
                                 String dispositionNotificationTo,
                                 String[] signedReceiptMicAlgorithms,
                                 AS2EncryptionAlgorithm encryptingAlgorithm,
@@ -238,6 +249,7 @@ public class AS2ClientManager {
         httpContext.setAttribute(AS2ClientManager.SIGNING_ALGORITHM, signingAlgorithm);
         httpContext.setAttribute(AS2ClientManager.SIGNING_CERTIFICATE_CHAIN, signingCertificateChain);
         httpContext.setAttribute(AS2ClientManager.SIGNING_PRIVATE_KEY, signingPrivateKey);
+        httpContext.setAttribute(AS2ClientManager.COMPRESSION_ALGORITHM, compressionAlgorithm);
         httpContext.setAttribute(AS2ClientManager.DISPOSITION_NOTIFICATION_TO, dispositionNotificationTo);
         httpContext.setAttribute(AS2ClientManager.SIGNED_RECEIPT_MIC_ALGORITHMS, signedReceiptMicAlgorithms);
         httpContext.setAttribute(AS2ClientManager.ENCRYPTING_ALGORITHM, encryptingAlgorithm);
@@ -256,35 +268,112 @@ public class AS2ClientManager {
         }
         switch (as2MessageStructure) {
         case PLAIN: {
+            // Add EDI Entity to main body of request.
             applicationEDIEntity.setMainBody(true);
             EntityUtils.setMessageEntity(request, applicationEDIEntity);
             break;
         }
         case SIGNED: {
-            AS2SignedDataGenerator gen = createSigningGenerator(httpContext);
-            // Create Multipart Signed Entity
-            MultipartSignedEntity multipartSignedEntity = new MultipartSignedEntity(applicationEDIEntity, gen,
+            // Create Multipart Signed Entity containing EDI Entity
+            AS2SignedDataGenerator signingGenrator = createSigningGenerator(httpContext);
+            MultipartSignedEntity multipartSignedEntity = new MultipartSignedEntity(applicationEDIEntity, signingGenrator,
                     AS2Charset.US_ASCII, AS2TransferEncoding.BASE64, true, null);
-            multipartSignedEntity.setMainBody(true);
+            
+            // Add Multipart Signed Entity to main body of request.
             EntityUtils.setMessageEntity(request, multipartSignedEntity);
             break;
         }
         case ENCRYPTED: {
+            // Create Enveloped Entity containing EDI Entity
             CMSEnvelopedDataGenerator envelopedDataGenerator = createEncryptingGenerator(httpContext);
             OutputEncryptor encryptor = createEncryptor(httpContext);
-            ApplicationPkcs7MimeEntity pkcs7MimeEntity = new ApplicationPkcs7MimeEntity(applicationEDIEntity, envelopedDataGenerator, encryptor, AS2TransferEncoding.BASE64, true);
-            EntityUtils.setMessageEntity(request, pkcs7MimeEntity);
+            ApplicationPkcs7MimeEnvelopedDataEntity pkcs7MimeEnvelopedDataEntity = new ApplicationPkcs7MimeEnvelopedDataEntity(
+                    applicationEDIEntity, envelopedDataGenerator, encryptor, AS2TransferEncoding.BASE64, true);
+
+            // Add Multipart Enveloped Entity to main body of request.
+            EntityUtils.setMessageEntity(request, pkcs7MimeEnvelopedDataEntity);
             break;
         }
-        case ENCRYPTED_SIGNED: {
+        case SIGNED_ENCRYPTED: {
+            // Create Multipart Signed Entity containing EDI Entity
             AS2SignedDataGenerator signingGenrator = createSigningGenerator(httpContext);
             MultipartSignedEntity multipartSignedEntity = new MultipartSignedEntity(applicationEDIEntity,
                     signingGenrator, AS2Charset.US_ASCII, AS2TransferEncoding.BASE64, false, null);
             
+            // Create Enveloped Entity containing Multipart Signed Entity
+            CMSEnvelopedDataGenerator envelopedDataGenerator = createEncryptingGenerator(httpContext);
+            OutputEncryptor encryptor = createEncryptor(httpContext);
+            ApplicationPkcs7MimeEnvelopedDataEntity pkcs7MimeEnvelopedDataEntity = new ApplicationPkcs7MimeEnvelopedDataEntity(
+                    multipartSignedEntity, envelopedDataGenerator, encryptor, AS2TransferEncoding.BASE64, true);
+
+            // Add Multipart Enveloped Entity to main body of request.
+            EntityUtils.setMessageEntity(request, pkcs7MimeEnvelopedDataEntity);
+            break;
+        }
+        case PLAIN_COMPRESSED: {
+            // Create Compressed Entity containing EDI Entity
+            CMSCompressedDataGenerator compressedDataGenerator = createCompressorGenerator(httpContext);
+            OutputCompressor compressor = createCompressor(httpContext);
+            ApplicationPkcs7MimeCompressedDataEntity pkcs7MimeCompressedDataEntity = new ApplicationPkcs7MimeCompressedDataEntity(
+                    applicationEDIEntity, compressedDataGenerator, compressor, AS2TransferEncoding.BASE64, false);
+
+            // Add Compressed Entity to main body of request.
+            EntityUtils.setMessageEntity(request, pkcs7MimeCompressedDataEntity);
+            break;
+        }
+        case SIGNED_COMPRESSED: {
+            // Create Multipart Signed Entity containing EDI Entity
+            AS2SignedDataGenerator signingGenrator = createSigningGenerator(httpContext);
+            MultipartSignedEntity multipartSignedEntity = new MultipartSignedEntity(applicationEDIEntity,
+                    signingGenrator, AS2Charset.US_ASCII, AS2TransferEncoding.BASE64, false, null);
+            
+            // Create Compressed Entity containing Multipart Signed Entity
+            CMSCompressedDataGenerator compressedDataGenerator = createCompressorGenerator(httpContext);
+            OutputCompressor compressor = createCompressor(httpContext);
+            ApplicationPkcs7MimeCompressedDataEntity pkcs7MimeCompressedDataEntity = new ApplicationPkcs7MimeCompressedDataEntity(
+                    multipartSignedEntity, compressedDataGenerator, compressor, AS2TransferEncoding.BASE64, false);
+
+            // Add Compressed Entity to main body of request.
+            EntityUtils.setMessageEntity(request, pkcs7MimeCompressedDataEntity);
+            break;
+        }
+        case ENCRYPTED_COMPRESSED: {
+            // Create Compressed Entity containing EDI Entity
+            CMSCompressedDataGenerator compressedDataGenerator = createCompressorGenerator(httpContext);
+            OutputCompressor compressor = createCompressor(httpContext);
+            ApplicationPkcs7MimeCompressedDataEntity pkcs7MimeCompressedDataEntity = new ApplicationPkcs7MimeCompressedDataEntity(
+                    applicationEDIEntity, compressedDataGenerator, compressor, AS2TransferEncoding.BASE64, false);
+            
+            // Create Enveloped Entity containing Compressed Entity
             CMSEnvelopedDataGenerator envelopedDataGenerator = createEncryptingGenerator(httpContext);
             OutputEncryptor encryptor = createEncryptor(httpContext);
-            ApplicationPkcs7MimeEntity pkcs7MimeEntity = new ApplicationPkcs7MimeEntity(multipartSignedEntity, envelopedDataGenerator, encryptor, AS2TransferEncoding.BASE64, true);
-            EntityUtils.setMessageEntity(request, pkcs7MimeEntity);
+            ApplicationPkcs7MimeEnvelopedDataEntity pkcs7MimeEnvelopedDataEntity = new ApplicationPkcs7MimeEnvelopedDataEntity(
+                    pkcs7MimeCompressedDataEntity, envelopedDataGenerator, encryptor, AS2TransferEncoding.BASE64, true);
+            
+            // Add Enveloped Entity to main body of request
+            EntityUtils.setMessageEntity(request, pkcs7MimeEnvelopedDataEntity);
+            break;
+        }
+        case SIGNED_ENCRYPTED_COMPRESSED: {
+            // Create Multipart Signed Entity containing EDI Entity
+            AS2SignedDataGenerator signingGenrator = createSigningGenerator(httpContext);
+            MultipartSignedEntity multipartSignedEntity = new MultipartSignedEntity(applicationEDIEntity, signingGenrator,
+                    AS2Charset.US_ASCII, AS2TransferEncoding.BASE64, true, null);
+            
+            // Create Compressed Entity containing Multipart Signed Entity
+            CMSCompressedDataGenerator compressedDataGenerator = createCompressorGenerator(httpContext);
+            OutputCompressor compressor = createCompressor(httpContext);
+            ApplicationPkcs7MimeCompressedDataEntity pkcs7MimeCompressedDataEntity = new ApplicationPkcs7MimeCompressedDataEntity(
+                    multipartSignedEntity, compressedDataGenerator, compressor, AS2TransferEncoding.BASE64, false);
+
+            // Create Enveloped Entity containing Compressed Entity
+            CMSEnvelopedDataGenerator envelopedDataGenerator = createEncryptingGenerator(httpContext);
+            OutputEncryptor encryptor = createEncryptor(httpContext);
+            ApplicationPkcs7MimeEnvelopedDataEntity pkcs7MimeEnvelopedDataEntity = new ApplicationPkcs7MimeEnvelopedDataEntity(
+                    pkcs7MimeCompressedDataEntity, envelopedDataGenerator, encryptor, AS2TransferEncoding.BASE64, true);
+            
+            // Add Enveloped Entity to main body of request
+            EntityUtils.setMessageEntity(request, pkcs7MimeEnvelopedDataEntity);
             break;
         }
         default:
@@ -335,6 +424,10 @@ public class AS2ClientManager {
 
     }
     
+    public CMSCompressedDataGenerator createCompressorGenerator(HttpCoreContext httpContext) {
+        return CompressionUtils.createCompressedDataGenerator();
+    }
+    
     public OutputEncryptor createEncryptor(HttpCoreContext httpContext) throws HttpException {
         
         AS2EncryptionAlgorithm encryptionAlgorithm = httpContext.getAttribute(ENCRYPTING_ALGORITHM, AS2EncryptionAlgorithm.class);
@@ -344,5 +437,14 @@ public class AS2ClientManager {
 
         return EncryptingUtils.createEncryptor(encryptionAlgorithm);
     }
+    
+    public OutputCompressor createCompressor(HttpCoreContext httpContext) throws HttpException {
+        AS2CompressionAlgorithm compressionAlgorithm = httpContext.getAttribute(COMPRESSION_ALGORITHM, AS2CompressionAlgorithm.class);
+        if (compressionAlgorithm == null) {
+            throw new HttpException("Compression algorithm missing");
+        }
+        
+        return CompressionUtils.createCompressor(compressionAlgorithm);
+    }
 
 }
diff --git a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2MessageStructure.java b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2CompressionAlgorithm.java
similarity index 56%
copy from components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2MessageStructure.java
copy to components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2CompressionAlgorithm.java
index 3c8210a..b08b5ca 100644
--- a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2MessageStructure.java
+++ b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2CompressionAlgorithm.java
@@ -16,29 +16,29 @@
  */
 package org.apache.camel.component.as2.api;
 
-public enum AS2MessageStructure {
-    PLAIN(false, false, false),
-    SIGNED(false, false, false),
-    ENCRYPTED(false, false, false),
-    ENCRYPTED_SIGNED(false, false, false);
+import org.bouncycastle.asn1.ASN1ObjectIdentifier;
+import org.bouncycastle.cms.jcajce.ZlibCompressor;
+import org.bouncycastle.operator.OutputCompressor;
 
-    private final boolean isSigned;
-    private final boolean isEncrypted;
-    private final boolean isCompressed;
+public enum AS2CompressionAlgorithm {
+    ZLIB(new ZlibCompressor());
+    
+    private OutputCompressor outputCompressor;
 
-    private AS2MessageStructure(boolean isSigned, boolean isEncrypted, boolean isCompressed) {
-        this.isSigned = isSigned;
-        this.isEncrypted = isEncrypted;
-        this.isCompressed = isCompressed;
+    private AS2CompressionAlgorithm(OutputCompressor outputCompressor) {
+        this.outputCompressor = outputCompressor;
     }
 
-    public boolean isSigned() {
-        return isSigned;
+    public String getAlgorithmName() {
+        return this.name();
     }
-    public boolean isEncrypted() {
-        return isEncrypted;
+    
+    public ASN1ObjectIdentifier getAlgorithmOID() {
+        return outputCompressor.getAlgorithmIdentifier().getAlgorithm();
     }
-    public boolean isCompressed() {
-        return isCompressed;
+
+    public OutputCompressor getOutputCompressor() {
+        return outputCompressor;
     }
+
 }
diff --git a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2MessageStructure.java b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2MessageStructure.java
index 3c8210a..760d9f0 100644
--- a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2MessageStructure.java
+++ b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2MessageStructure.java
@@ -18,9 +18,13 @@ package org.apache.camel.component.as2.api;
 
 public enum AS2MessageStructure {
     PLAIN(false, false, false),
-    SIGNED(false, false, false),
-    ENCRYPTED(false, false, false),
-    ENCRYPTED_SIGNED(false, false, false);
+    SIGNED(true, false, false),
+    ENCRYPTED(false, true, false),
+    SIGNED_ENCRYPTED(true, true, false),
+    PLAIN_COMPRESSED(false, false, true),
+    SIGNED_COMPRESSED(true, false, true),
+    ENCRYPTED_COMPRESSED(false, true, true),
+    SIGNED_ENCRYPTED_COMPRESSED(true, true, true);
 
     private final boolean isSigned;
     private final boolean isEncrypted;
diff --git a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/ApplicationPkcs7MimeEntity.java b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/ApplicationPkcs7MimeEnvelopedDataEntity.java
similarity index 94%
rename from components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/ApplicationPkcs7MimeEntity.java
rename to components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/ApplicationPkcs7MimeEnvelopedDataEntity.java
index 5487055..4bb9866 100644
--- a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/ApplicationPkcs7MimeEntity.java
+++ b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/ApplicationPkcs7MimeEnvelopedDataEntity.java
@@ -37,13 +37,13 @@ import org.bouncycastle.cms.CMSProcessableByteArray;
 import org.bouncycastle.cms.CMSTypedData;
 import org.bouncycastle.operator.OutputEncryptor;
 
-public class ApplicationPkcs7MimeEntity extends MimeEntity {
+public class ApplicationPkcs7MimeEnvelopedDataEntity extends MimeEntity {
     
     private static final String CONTENT_DISPOSITION = "attachment; filename=\"smime.p7m\"";
     
     private byte[] encryptedData;
     
-    public ApplicationPkcs7MimeEntity(MimeEntity entity2Encrypt,
+    public ApplicationPkcs7MimeEnvelopedDataEntity(MimeEntity entity2Encrypt,
                                 CMSEnvelopedDataGenerator dataGenerator,
                                 OutputEncryptor encryptor,
                                 String encryptedContentTransferEncoding,
@@ -61,7 +61,7 @@ public class ApplicationPkcs7MimeEntity extends MimeEntity {
         }
     }
     
-    public ApplicationPkcs7MimeEntity(byte[] encryptedData, String encryptedContentTransferEncoding, boolean isMainBody) {
+    public ApplicationPkcs7MimeEnvelopedDataEntity(byte[] encryptedData, String encryptedContentTransferEncoding, boolean isMainBody) {
         this.encryptedData = Args.notNull(encryptedData, "encryptedData");
         
         setContentType(ContentType.create("application/pkcs7-mime", new BasicNameValuePair("smime-type", "enveloped-datat"),
@@ -101,10 +101,7 @@ public class ApplicationPkcs7MimeEntity extends MimeEntity {
     }
     
     public MimeEntity getEncryptedEntity(PrivateKey privateKey) throws HttpException {
-        
         return EntityParser.parseEnvelopedEntity(encryptedData, privateKey);
-        
-        
     }
     
     private byte[] createEncryptedData(MimeEntity entity2Encrypt, CMSEnvelopedDataGenerator envelopedDataGenerator, OutputEncryptor encryptor) throws Exception {
diff --git a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/EntityParser.java b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/EntityParser.java
index 4d8a2b2..5fb23f4 100644
--- a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/EntityParser.java
+++ b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/EntityParser.java
@@ -882,7 +882,7 @@ public final class EntityParser {
         }
     }
 
-    public static ApplicationPkcs7MimeEntity parseApplicationPkcs7MimeEntityBody(AS2SessionInputBuffer inbuffer,
+    public static ApplicationPkcs7MimeEnvelopedDataEntity parseApplicationPkcs7MimeEntityBody(AS2SessionInputBuffer inbuffer,
                                                                                       String boundary,
                                                                                       ContentType contentType,
                                                                                       String contentTransferEncoding)
@@ -903,7 +903,7 @@ public final class EntityParser {
 
             byte[] encryptedContent = EntityUtils.decode(pkcs7EncryptedBodyContent.getBytes(charset), contentTransferEncoding);
 
-            ApplicationPkcs7MimeEntity applicationPkcs7MimeEntity = new ApplicationPkcs7MimeEntity(
+            ApplicationPkcs7MimeEnvelopedDataEntity applicationPkcs7MimeEntity = new ApplicationPkcs7MimeEnvelopedDataEntity(
                     encryptedContent, contentTransferEncoding, false);
             return applicationPkcs7MimeEntity;
         } catch (Exception e) {
diff --git a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2MessageStructure.java b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/util/CompressionUtils.java
similarity index 52%
copy from components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2MessageStructure.java
copy to components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/util/CompressionUtils.java
index 3c8210a..89e243f 100644
--- a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2MessageStructure.java
+++ b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/util/CompressionUtils.java
@@ -14,31 +14,23 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.component.as2.api;
+package org.apache.camel.component.as2.api.util;
 
-public enum AS2MessageStructure {
-    PLAIN(false, false, false),
-    SIGNED(false, false, false),
-    ENCRYPTED(false, false, false),
-    ENCRYPTED_SIGNED(false, false, false);
+import org.apache.camel.component.as2.api.AS2CompressionAlgorithm;
+import org.bouncycastle.cms.CMSCompressedDataGenerator;
+import org.bouncycastle.operator.OutputCompressor;
 
-    private final boolean isSigned;
-    private final boolean isEncrypted;
-    private final boolean isCompressed;
-
-    private AS2MessageStructure(boolean isSigned, boolean isEncrypted, boolean isCompressed) {
-        this.isSigned = isSigned;
-        this.isEncrypted = isEncrypted;
-        this.isCompressed = isCompressed;
-    }
-
-    public boolean isSigned() {
-        return isSigned;
+public final class CompressionUtils {
+    
+    private CompressionUtils() {
     }
-    public boolean isEncrypted() {
-        return isEncrypted;
+    
+    public static CMSCompressedDataGenerator createCompressedDataGenerator() {
+        return new CMSCompressedDataGenerator();
     }
-    public boolean isCompressed() {
-        return isCompressed;
+    
+    public static OutputCompressor createCompressor(AS2CompressionAlgorithm compressionAlgorithm) {
+        return compressionAlgorithm.getOutputCompressor();
     }
+
 }
diff --git a/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/AS2MessageTest.java b/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/AS2MessageTest.java
index 3cdd384..9a43f10 100644
--- a/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/AS2MessageTest.java
+++ b/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/AS2MessageTest.java
@@ -32,7 +32,7 @@ import org.apache.camel.component.as2.api.entity.AS2DispositionType;
 import org.apache.camel.component.as2.api.entity.AS2MessageDispositionNotificationEntity;
 import org.apache.camel.component.as2.api.entity.ApplicationEDIEntity;
 import org.apache.camel.component.as2.api.entity.ApplicationEDIFACTEntity;
-import org.apache.camel.component.as2.api.entity.ApplicationPkcs7MimeEntity;
+import org.apache.camel.component.as2.api.entity.ApplicationPkcs7MimeEnvelopedDataEntity;
 import org.apache.camel.component.as2.api.entity.ApplicationPkcs7SignatureEntity;
 import org.apache.camel.component.as2.api.entity.DispositionMode;
 import org.apache.camel.component.as2.api.entity.DispositionNotificationMultipartReportEntity;
@@ -270,7 +270,7 @@ public class AS2MessageTest {
 
         HttpCoreContext httpContext = clientManager.send(EDI_MESSAGE, REQUEST_URI, SUBJECT, FROM, AS2_NAME, AS2_NAME,
                 AS2MessageStructure.PLAIN, ContentType.create(AS2MediaType.APPLICATION_EDIFACT, AS2Charset.US_ASCII),
-                null, null, null, null, DISPOSITION_NOTIFICATION_TO, SIGNED_RECEIPT_MIC_ALGORITHMS, null, null, null);
+                null, null, null, null, null, DISPOSITION_NOTIFICATION_TO, SIGNED_RECEIPT_MIC_ALGORITHMS, null, null, null);
 
         HttpRequest request = httpContext.getRequest();
         assertEquals("Unexpected method value", METHOD, request.getRequestLine().getMethod());
@@ -313,8 +313,8 @@ public class AS2MessageTest {
 
         HttpCoreContext httpContext = clientManager.send(EDI_MESSAGE, REQUEST_URI, SUBJECT, FROM, AS2_NAME, AS2_NAME,
                 AS2MessageStructure.SIGNED, ContentType.create(AS2MediaType.APPLICATION_EDIFACT, AS2Charset.US_ASCII),
-                null, AS2SignatureAlgorithm.SHA256WITHRSA, certList.toArray(new Certificate[0]), signingKP.getPrivate(), DISPOSITION_NOTIFICATION_TO,
-                SIGNED_RECEIPT_MIC_ALGORITHMS, null, null, null);
+                null, AS2SignatureAlgorithm.SHA256WITHRSA, certList.toArray(new Certificate[0]), signingKP.getPrivate(),
+                null, DISPOSITION_NOTIFICATION_TO, SIGNED_RECEIPT_MIC_ALGORITHMS, null, null, null);
 
         HttpRequest request = httpContext.getRequest();
         assertEquals("Unexpected method value", METHOD, request.getRequestLine().getMethod());
@@ -472,10 +472,11 @@ public class AS2MessageTest {
         LOG.info("Key Algoritm: " + signingKP.getPrivate().getAlgorithm());
 
         HttpCoreContext httpContext = clientManager.send(EDI_MESSAGE, REQUEST_URI, SUBJECT, FROM, AS2_NAME, AS2_NAME,
-                AS2MessageStructure.ENCRYPTED, ContentType.create(AS2MediaType.APPLICATION_EDIFACT, AS2Charset.US_ASCII),
-                null, AS2SignatureAlgorithm.SHA256WITHRSA, certList.toArray(new Certificate[0]), signingKP.getPrivate(), DISPOSITION_NOTIFICATION_TO,
-                SIGNED_RECEIPT_MIC_ALGORITHMS, encryptionAlgorithm, certList.toArray(new Certificate[0]),
-                signingKP.getPrivate());
+                AS2MessageStructure.ENCRYPTED,
+                ContentType.create(AS2MediaType.APPLICATION_EDIFACT, AS2Charset.US_ASCII), null,
+                AS2SignatureAlgorithm.SHA256WITHRSA, certList.toArray(new Certificate[0]), signingKP.getPrivate(), null,
+                DISPOSITION_NOTIFICATION_TO, SIGNED_RECEIPT_MIC_ALGORITHMS, encryptionAlgorithm,
+                certList.toArray(new Certificate[0]), signingKP.getPrivate());
 
         HttpRequest request = httpContext.getRequest();
         assertEquals("Unexpected method value", METHOD, request.getRequestLine().getMethod());
@@ -503,8 +504,8 @@ public class AS2MessageTest {
         assertTrue("Request does not contain entity", request instanceof BasicHttpEntityEnclosingRequest);
         HttpEntity entity = ((BasicHttpEntityEnclosingRequest) request).getEntity();
         assertNotNull("Request does not contain entity", entity);
-        assertTrue("Unexpected request entity type", entity instanceof ApplicationPkcs7MimeEntity);
-        ApplicationPkcs7MimeEntity envelopedEntity = (ApplicationPkcs7MimeEntity) entity;
+        assertTrue("Unexpected request entity type", entity instanceof ApplicationPkcs7MimeEnvelopedDataEntity);
+        ApplicationPkcs7MimeEnvelopedDataEntity envelopedEntity = (ApplicationPkcs7MimeEnvelopedDataEntity) entity;
         assertTrue("Entity not set as main body of request", envelopedEntity.isMainBody());
 
         // Validated enveloped part.
@@ -532,10 +533,11 @@ public class AS2MessageTest {
         LOG.info("Key Algoritm: " + signingKP.getPrivate().getAlgorithm());
 
         HttpCoreContext httpContext = clientManager.send(EDI_MESSAGE, REQUEST_URI, SUBJECT, FROM, AS2_NAME, AS2_NAME,
-                AS2MessageStructure.ENCRYPTED_SIGNED, ContentType.create(AS2MediaType.APPLICATION_EDIFACT, AS2Charset.US_ASCII),
-                null, AS2SignatureAlgorithm.SHA256WITHRSA, certList.toArray(new Certificate[0]), signingKP.getPrivate(), DISPOSITION_NOTIFICATION_TO,
-                SIGNED_RECEIPT_MIC_ALGORITHMS, encryptionAlgorithm, certList.toArray(new Certificate[0]),
-                signingKP.getPrivate());
+                AS2MessageStructure.SIGNED_ENCRYPTED,
+                ContentType.create(AS2MediaType.APPLICATION_EDIFACT, AS2Charset.US_ASCII), null,
+                AS2SignatureAlgorithm.SHA256WITHRSA, certList.toArray(new Certificate[0]), signingKP.getPrivate(), null,
+                DISPOSITION_NOTIFICATION_TO, SIGNED_RECEIPT_MIC_ALGORITHMS, encryptionAlgorithm,
+                certList.toArray(new Certificate[0]), signingKP.getPrivate());
 
         HttpRequest request = httpContext.getRequest();
         assertEquals("Unexpected method value", METHOD, request.getRequestLine().getMethod());
@@ -563,8 +565,8 @@ public class AS2MessageTest {
         assertTrue("Request does not contain entity", request instanceof BasicHttpEntityEnclosingRequest);
         HttpEntity entity = ((BasicHttpEntityEnclosingRequest) request).getEntity();
         assertNotNull("Request does not contain entity", entity);
-        assertTrue("Unexpected request entity type", entity instanceof ApplicationPkcs7MimeEntity);
-        ApplicationPkcs7MimeEntity envelopedEntity = (ApplicationPkcs7MimeEntity) entity;
+        assertTrue("Unexpected request entity type", entity instanceof ApplicationPkcs7MimeEnvelopedDataEntity);
+        ApplicationPkcs7MimeEnvelopedDataEntity envelopedEntity = (ApplicationPkcs7MimeEnvelopedDataEntity) entity;
         assertTrue("Entity not set as main body of request", envelopedEntity.isMainBody());
 
         // Validated enveloped part.
@@ -601,8 +603,8 @@ public class AS2MessageTest {
 
         HttpCoreContext httpContext = clientManager.send(EDI_MESSAGE, REQUEST_URI, SUBJECT, FROM, AS2_NAME, AS2_NAME,
                 AS2MessageStructure.SIGNED, ContentType.create(AS2MediaType.APPLICATION_EDIFACT, AS2Charset.US_ASCII),
-                null, AS2SignatureAlgorithm.SHA256WITHRSA, certList.toArray(new Certificate[0]), signingKP.getPrivate(), DISPOSITION_NOTIFICATION_TO,
-                SIGNED_RECEIPT_MIC_ALGORITHMS, null, null, null);
+                null, AS2SignatureAlgorithm.SHA256WITHRSA, certList.toArray(new Certificate[0]), signingKP.getPrivate(),
+                null, DISPOSITION_NOTIFICATION_TO, SIGNED_RECEIPT_MIC_ALGORITHMS, null, null, null);
 
         HttpRequest request = httpContext.getRequest();
         assertTrue("Request does not contain entity", request instanceof BasicHttpEntityEnclosingRequest);
@@ -630,7 +632,8 @@ public class AS2MessageTest {
 
         HttpCoreContext httpContext = clientManager.send(EDI_MESSAGE, REQUEST_URI, SUBJECT, FROM, AS2_NAME, AS2_NAME,
                 AS2MessageStructure.PLAIN, ContentType.create(AS2MediaType.APPLICATION_EDIFACT, AS2Charset.US_ASCII),
-                null, null, null, null, DISPOSITION_NOTIFICATION_TO, SIGNED_RECEIPT_MIC_ALGORITHMS, null, null, null);
+                null, null, null, null, null, DISPOSITION_NOTIFICATION_TO, SIGNED_RECEIPT_MIC_ALGORITHMS, null, null,
+                null);
 
         HttpResponse response = httpContext.getResponse();
         assertEquals("Unexpected method value", HttpVersion.HTTP_1_1, response.getStatusLine().getProtocolVersion());
diff --git a/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/entity/EntityParserTest.java b/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/entity/EntityParserTest.java
index cd47c82..d5b3a0d 100644
--- a/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/entity/EntityParserTest.java
+++ b/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/entity/EntityParserTest.java
@@ -317,7 +317,7 @@ public class EntityParserTest {
         // Build Enveloped Entity
         //
         TextPlainEntity textEntity = new TextPlainEntity("This is a super secret messatge!", "US-ASCII", "7bit", false);
-        ApplicationPkcs7MimeEntity applicationPkcs7MimeEntity = new ApplicationPkcs7MimeEntity(textEntity, cmsEnvelopeDataGenerator, contentEncryptor, "binary", true);
+        ApplicationPkcs7MimeEnvelopedDataEntity applicationPkcs7MimeEntity = new ApplicationPkcs7MimeEnvelopedDataEntity(textEntity, cmsEnvelopeDataGenerator, contentEncryptor, "binary", true);
         
         MimeEntity decryptedMimeEntity = applicationPkcs7MimeEntity.getEncryptedEntity(encryptKP.getPrivate());
         assertEquals("Decrypted entity has unexpected content type", "text/plain; charset=US-ASCII", decryptedMimeEntity.getContentTypeValue());
diff --git a/components/camel-as2/camel-as2-component/src/main/docs/as2-component.adoc b/components/camel-as2/camel-as2-component/src/main/docs/as2-component.adoc
index aef14ca..11bfb22 100644
--- a/components/camel-as2/camel-as2-component/src/main/docs/as2-component.adoc
+++ b/components/camel-as2/camel-as2-component/src/main/docs/as2-component.adoc
@@ -70,7 +70,7 @@ with the following path and query parameters:
 |===
 
 
-==== Query Parameters (30 parameters):
+==== Query Parameters (31 parameters):
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
@@ -81,6 +81,7 @@ with the following path and query parameters:
 | *as2To* (common) | The value of the AS2To header of AS2 message. |  | String
 | *as2Version* (common) | The version of the AS2 protocol. | 1.1 | String
 | *clientFqdn* (common) | The Client Fully Qualified Domain Name (FQDN). Used in message ids sent by endpoint. | camel.apache.org | String
+| *compressionAlgorithm* (common) | The algorithm used to compress EDI message. |  | AS2Compression Algorithm
 | *dispositionNotificationTo* (common) | The value of the Disposition-Notification-To header. Assigning a value to this parameter requests a message disposition notification (MDN) for the AS2 message. |  | String
 | *ediMessageTransferEncoding* (common) | The transfer encoding of EDI message. |  | String
 | *ediMessageType* (common) | The content type of EDI message. One of application/edifact, application/edi-x12, application/edi-consent |  | ContentType
diff --git a/components/camel-as2/camel-as2-component/src/main/java/org/apache/camel/component/as2/AS2Configuration.java b/components/camel-as2/camel-as2-component/src/main/java/org/apache/camel/component/as2/AS2Configuration.java
index bd5a347..c92b50e 100644
--- a/components/camel-as2/camel-as2-component/src/main/java/org/apache/camel/component/as2/AS2Configuration.java
+++ b/components/camel-as2/camel-as2-component/src/main/java/org/apache/camel/component/as2/AS2Configuration.java
@@ -20,6 +20,7 @@ import java.security.PrivateKey;
 import java.security.cert.Certificate;
 
 import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.component.as2.api.AS2CompressionAlgorithm;
 import org.apache.camel.component.as2.api.AS2EncryptionAlgorithm;
 import org.apache.camel.component.as2.api.AS2MessageStructure;
 import org.apache.camel.component.as2.api.AS2SignatureAlgorithm;
@@ -102,6 +103,9 @@ public class AS2Configuration {
     private PrivateKey signingPrivateKey;
 
     @UriParam
+    private AS2CompressionAlgorithm compressionAlgorithm;
+
+    @UriParam
     private String dispositionNotificationTo;
 
     @UriParam
@@ -388,6 +392,17 @@ public class AS2Configuration {
         this.signingPrivateKey = signingPrivateKey;
     }
 
+    public AS2CompressionAlgorithm getCompressionAlgorithm() {
+        return compressionAlgorithm;
+    }
+
+    /**
+     * The algorithm used to compress EDI message.
+     */
+    public void setCompressionAlgorithm(AS2CompressionAlgorithm compressionAlgorithm) {
+        this.compressionAlgorithm = compressionAlgorithm;
+    }
+
     public String getDispositionNotificationTo() {
         return dispositionNotificationTo;
     }
@@ -415,7 +430,7 @@ public class AS2Configuration {
         this.signedReceiptMicAlgorithms = signedReceiptMicAlgorithms;
     }
 
-    public AS2EncryptionAlgorithm getEncryptingingAlgorithm() {
+    public AS2EncryptionAlgorithm getEncryptingAlgorithm() {
         return encryptingAlgorithm;
     }
 
diff --git a/components/camel-as2/camel-as2-component/src/test/java/org/apache/camel/component/as2/AS2ClientManagerIntegrationTest.java b/components/camel-as2/camel-as2-component/src/test/java/org/apache/camel/component/as2/AS2ClientManagerIntegrationTest.java
index ca14bf6..36c0386 100644
--- a/components/camel-as2/camel-as2-component/src/test/java/org/apache/camel/component/as2/AS2ClientManagerIntegrationTest.java
+++ b/components/camel-as2/camel-as2-component/src/test/java/org/apache/camel/component/as2/AS2ClientManagerIntegrationTest.java
@@ -45,7 +45,7 @@ import org.apache.camel.component.as2.api.entity.AS2DispositionModifier;
 import org.apache.camel.component.as2.api.entity.AS2DispositionType;
 import org.apache.camel.component.as2.api.entity.AS2MessageDispositionNotificationEntity;
 import org.apache.camel.component.as2.api.entity.ApplicationEDIEntity;
-import org.apache.camel.component.as2.api.entity.ApplicationPkcs7MimeEntity;
+import org.apache.camel.component.as2.api.entity.ApplicationPkcs7MimeEnvelopedDataEntity;
 import org.apache.camel.component.as2.api.entity.ApplicationPkcs7SignatureEntity;
 import org.apache.camel.component.as2.api.entity.DispositionMode;
 import org.apache.camel.component.as2.api.entity.DispositionNotificationMultipartReportEntity;
@@ -326,8 +326,8 @@ public class AS2ClientManagerIntegrationTest extends AbstractAS2TestSupport {
         assertTrue("Request does not contain body", request instanceof HttpEntityEnclosingRequest);
         HttpEntity entity = ((HttpEntityEnclosingRequest)request).getEntity();
         assertNotNull("Request body", entity);
-        assertTrue("Request body does not contain ApplicationPkcs7Mime entity", entity instanceof ApplicationPkcs7MimeEntity);
-        MimeEntity envelopeEntity = ((ApplicationPkcs7MimeEntity)entity).getEncryptedEntity(signingKP.getPrivate());
+        assertTrue("Request body does not contain ApplicationPkcs7Mime entity", entity instanceof ApplicationPkcs7MimeEnvelopedDataEntity);
+        MimeEntity envelopeEntity = ((ApplicationPkcs7MimeEnvelopedDataEntity)entity).getEncryptedEntity(signingKP.getPrivate());
         assertTrue("Enveloped entity is not an EDI entity", envelopeEntity instanceof ApplicationEDIEntity);
         String ediMessage = ((ApplicationEDIEntity)envelopeEntity).getEdiMessage();
         assertEquals("EDI message is different", EDI_MESSAGE.replaceAll("[\n\r]", ""), ediMessage.replaceAll("[\n\r]", ""));
diff --git a/components/camel-as2/camel-as2-component/src/test/java/org/apache/camel/component/as2/AS2ServerManagerIntegrationTest.java b/components/camel-as2/camel-as2-component/src/test/java/org/apache/camel/component/as2/AS2ServerManagerIntegrationTest.java
index 9cb635f..0f6b931 100644
--- a/components/camel-as2/camel-as2-component/src/test/java/org/apache/camel/component/as2/AS2ServerManagerIntegrationTest.java
+++ b/components/camel-as2/camel-as2-component/src/test/java/org/apache/camel/component/as2/AS2ServerManagerIntegrationTest.java
@@ -128,7 +128,7 @@ public class AS2ServerManagerIntegrationTest extends AbstractAS2TestSupport {
 
         clientManager.send(EDI_MESSAGE, REQUEST_URI, SUBJECT, FROM, AS2_NAME, AS2_NAME, AS2MessageStructure.PLAIN,
                 ContentType.create(AS2MediaType.APPLICATION_EDIFACT, AS2Charset.US_ASCII), null, null, null, null,
-                DISPOSITION_NOTIFICATION_TO, SIGNED_RECEIPT_MIC_ALGORITHMS, null, null, null);
+                null, DISPOSITION_NOTIFICATION_TO, SIGNED_RECEIPT_MIC_ALGORITHMS, null, null, null);
 
         MockEndpoint mockEndpoint = getMockEndpoint("mock:as2RcvMsgs");
         mockEndpoint.expectedMinimumMessageCount(1);
@@ -185,7 +185,7 @@ public class AS2ServerManagerIntegrationTest extends AbstractAS2TestSupport {
 
         clientManager.send(EDI_MESSAGE, REQUEST_URI, SUBJECT, FROM, AS2_NAME, AS2_NAME, AS2MessageStructure.SIGNED,
                 ContentType.create(AS2MediaType.APPLICATION_EDIFACT, AS2Charset.US_ASCII), null, AS2SignatureAlgorithm.SHA256WITHRSA,
-                certList.toArray(new Certificate[0]), signingKP.getPrivate(), DISPOSITION_NOTIFICATION_TO,
+                certList.toArray(new Certificate[0]), signingKP.getPrivate(), null, DISPOSITION_NOTIFICATION_TO,
                 SIGNED_RECEIPT_MIC_ALGORITHMS, null, null, null);
 
         MockEndpoint mockEndpoint = getMockEndpoint("mock:as2RcvMsgs");
diff --git a/platforms/spring-boot/components-starter/camel-as2-starter/src/main/java/org/apache/camel/component/as2/springboot/AS2ComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-as2-starter/src/main/java/org/apache/camel/component/as2/springboot/AS2ComponentConfiguration.java
index d5d84d5..eda444f 100644
--- a/platforms/spring-boot/components-starter/camel-as2-starter/src/main/java/org/apache/camel/component/as2/springboot/AS2ComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-as2-starter/src/main/java/org/apache/camel/component/as2/springboot/AS2ComponentConfiguration.java
@@ -19,6 +19,7 @@ package org.apache.camel.component.as2.springboot;
 import java.security.PrivateKey;
 import java.security.cert.Certificate;
 import javax.annotation.Generated;
+import org.apache.camel.component.as2.api.AS2CompressionAlgorithm;
 import org.apache.camel.component.as2.api.AS2EncryptionAlgorithm;
 import org.apache.camel.component.as2.api.AS2MessageStructure;
 import org.apache.camel.component.as2.api.AS2SignatureAlgorithm;
@@ -167,6 +168,10 @@ public class AS2ComponentConfiguration
          */
         private PrivateKey signingPrivateKey;
         /**
+         * The algorithm used to compress EDI message.
+         */
+        private AS2CompressionAlgorithm compressionAlgorithm;
+        /**
          * The value of the Disposition-Notification-To header. Assigning a
          * value to this parameter requests a message disposition notification
          * (MDN) for the AS2 message.
@@ -362,6 +367,15 @@ public class AS2ComponentConfiguration
             this.signingPrivateKey = signingPrivateKey;
         }
 
+        public AS2CompressionAlgorithm getCompressionAlgorithm() {
+            return compressionAlgorithm;
+        }
+
+        public void setCompressionAlgorithm(
+                AS2CompressionAlgorithm compressionAlgorithm) {
+            this.compressionAlgorithm = compressionAlgorithm;
+        }
+
         public String getDispositionNotificationTo() {
             return dispositionNotificationTo;
         }

Reply | Threaded
Open this post in threaded view
|

[camel] 08/35: CAMEL-12967 - Fixed CS

acosentino
In reply to this post by acosentino
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch sandbox/camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit a2517d7cde090c8079aebd72459d182f920c00fa
Author: Andrea Cosentino <[hidden email]>
AuthorDate: Fri Nov 30 11:35:24 2018 +0100

    CAMEL-12967 - Fixed CS
   
    Conflicts:
    components/camel-google-sheets/src/test/java/org/apache/camel/component/google/sheets/stream/SheetsStreamConsumerIntegrationTest.java
---
 .../google/sheets/stream/SheetsStreamConsumerIntegrationTest.java      | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/components/camel-google-sheets/src/test/java/org/apache/camel/component/google/sheets/stream/SheetsStreamConsumerIntegrationTest.java b/components/camel-google-sheets/src/test/java/org/apache/camel/component/google/sheets/stream/SheetsStreamConsumerIntegrationTest.java
index 36dd79b..4709131 100644
--- a/components/camel-google-sheets/src/test/java/org/apache/camel/component/google/sheets/stream/SheetsStreamConsumerIntegrationTest.java
+++ b/components/camel-google-sheets/src/test/java/org/apache/camel/component/google/sheets/stream/SheetsStreamConsumerIntegrationTest.java
@@ -63,7 +63,8 @@ public class SheetsStreamConsumerIntegrationTest extends AbstractGoogleSheetsStr
         return new RouteBuilder() {
             @Override
             public void configure() {
-                from("google-sheets-stream://data?spreadsheetId=" + spreadsheetId + "&range=" + range + "&delay=2000&maxResults=5").routeId("google-stream-test").to("mock:result");
+                from("google-sheets-stream://data?spreadsheetId=" + spreadsheetId
+                    + "&range=" + range + "&delay=2000&maxResults=5&splitResults=true").routeId("google-stream-values-test").to("mock:rows");
             }
         };
     }

Reply | Threaded
Open this post in threaded view
|

[camel] 09/35: Upgrade PAX Exam to version 4.13.0

acosentino
In reply to this post by acosentino
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch sandbox/camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit afd2431da5399362fbd379c601a04bb4ebe0fa88
Author: Andrea Cosentino <[hidden email]>
AuthorDate: Fri Nov 30 12:25:27 2018 +0100

    Upgrade PAX Exam to version 4.13.0
---
 parent/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/parent/pom.xml b/parent/pom.xml
index 953d347..8735fa2 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -560,7 +560,7 @@
     <paho-version>1.2.0</paho-version>
     <paranamer-bundle-version>2.8_1</paranamer-bundle-version>
     <pax-cdi-version>1.0.0</pax-cdi-version>
-    <pax-exam-version>4.12.0</pax-exam-version>
+    <pax-exam-version>4.13.0</pax-exam-version>
     <pax-tiny-bundle-version>1.3.2</pax-tiny-bundle-version>
     <pax-logging-version>1.8.6</pax-logging-version>
     <pdfbox-version>2.0.12</pdfbox-version>

Reply | Threaded
Open this post in threaded view
|

[camel] 10/35: [CAMEL-12605] Added tests and fixes for compression

acosentino
In reply to this post by acosentino
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch sandbox/camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit a463f55f9754cbd128f9a875665124be9d13becc
Author: William Collins <[hidden email]>
AuthorDate: Fri Nov 30 14:27:50 2018 -0500

     [CAMEL-12605] Added tests and fixes for compression
---
 .../camel/component/as2/api/AS2ClientManager.java  |   4 +-
 .../camel/component/as2/api/AS2MediaType.java      |   8 +-
 .../ApplicationPkcs7MimeCompressedDataEntity.java  |   2 +-
 .../ApplicationPkcs7MimeEnvelopedDataEntity.java   |   2 +-
 .../component/as2/api/entity/EntityParser.java     |  50 +++++-
 .../camel/component/as2/api/AS2MessageTest.java    | 195 +++++++++++++++++++++
 6 files changed, 254 insertions(+), 7 deletions(-)

diff --git a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2ClientManager.java b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2ClientManager.java
index 8e1905c..915d210 100644
--- a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2ClientManager.java
+++ b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2ClientManager.java
@@ -315,7 +315,7 @@ public class AS2ClientManager {
             CMSCompressedDataGenerator compressedDataGenerator = createCompressorGenerator(httpContext);
             OutputCompressor compressor = createCompressor(httpContext);
             ApplicationPkcs7MimeCompressedDataEntity pkcs7MimeCompressedDataEntity = new ApplicationPkcs7MimeCompressedDataEntity(
-                    applicationEDIEntity, compressedDataGenerator, compressor, AS2TransferEncoding.BASE64, false);
+                    applicationEDIEntity, compressedDataGenerator, compressor, AS2TransferEncoding.BASE64, true);
 
             // Add Compressed Entity to main body of request.
             EntityUtils.setMessageEntity(request, pkcs7MimeCompressedDataEntity);
@@ -331,7 +331,7 @@ public class AS2ClientManager {
             CMSCompressedDataGenerator compressedDataGenerator = createCompressorGenerator(httpContext);
             OutputCompressor compressor = createCompressor(httpContext);
             ApplicationPkcs7MimeCompressedDataEntity pkcs7MimeCompressedDataEntity = new ApplicationPkcs7MimeCompressedDataEntity(
-                    multipartSignedEntity, compressedDataGenerator, compressor, AS2TransferEncoding.BASE64, false);
+                    multipartSignedEntity, compressedDataGenerator, compressor, AS2TransferEncoding.BASE64, true);
 
             // Add Compressed Entity to main body of request.
             EntityUtils.setMessageEntity(request, pkcs7MimeCompressedDataEntity);
diff --git a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2MediaType.java b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2MediaType.java
index d6c4934..1aa3816 100644
--- a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2MediaType.java
+++ b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2MediaType.java
@@ -27,9 +27,13 @@ public interface AS2MediaType {
      */
     public static final String APPLICATION_PKCS7_SIGNATURE = "application/pkcs7-signature; name=smime.p7s; smime-type=signed-data";
     /**
-     * Media Type for Application PKCS7 Signature
+     * Media Type for Application PKCS7 Enveloped Data
+     */
+    public static final String APPLICATION_PKCS7_MIME_ENVELOPED = "application/pkcs7-mime; smime-type=enveloped-data; name=smime.p7m";
+    /**
+     * Media Type for Application PKCS7 Compressed Data
      */
-    public static final String APPLICATION_PKCS7_MIME = "application/pkcs7-mime; name=smime.p7m; smime-type=enveloped-data; name=smime.p7m";
+    public static final String APPLICATION_PKCS7_MIME_COMPRESSED = "application/pkcs7-mime; smime-type=compressed-data; name=smime.p7z";
     /**
      * Media Type for Text/Plain Data
      */
diff --git a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/ApplicationPkcs7MimeCompressedDataEntity.java b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/ApplicationPkcs7MimeCompressedDataEntity.java
index 7a88761..16402e4 100644
--- a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/ApplicationPkcs7MimeCompressedDataEntity.java
+++ b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/ApplicationPkcs7MimeCompressedDataEntity.java
@@ -64,7 +64,7 @@ public class ApplicationPkcs7MimeCompressedDataEntity extends MimeEntity {
     public ApplicationPkcs7MimeCompressedDataEntity(byte[] compressedData, String compressedContentTransferEncoding, boolean isMainBody) {
         this.compressedData = Args.notNull(compressedData, "encryptedData");
         
-        setContentType(ContentType.create("application/pkcs7-mime", new BasicNameValuePair("smime-type", "compressed-datat"),
+        setContentType(ContentType.create("application/pkcs7-mime", new BasicNameValuePair("smime-type", "compressed-data"),
                 new BasicNameValuePair("name", "smime.p7z")));
         setContentTransferEncoding(compressedContentTransferEncoding);
         addHeader(AS2Header.CONTENT_DISPOSITION, CONTENT_DISPOSITION);
diff --git a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/ApplicationPkcs7MimeEnvelopedDataEntity.java b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/ApplicationPkcs7MimeEnvelopedDataEntity.java
index 4bb9866..d6a9be6 100644
--- a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/ApplicationPkcs7MimeEnvelopedDataEntity.java
+++ b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/ApplicationPkcs7MimeEnvelopedDataEntity.java
@@ -64,7 +64,7 @@ public class ApplicationPkcs7MimeEnvelopedDataEntity extends MimeEntity {
     public ApplicationPkcs7MimeEnvelopedDataEntity(byte[] encryptedData, String encryptedContentTransferEncoding, boolean isMainBody) {
         this.encryptedData = Args.notNull(encryptedData, "encryptedData");
         
-        setContentType(ContentType.create("application/pkcs7-mime", new BasicNameValuePair("smime-type", "enveloped-datat"),
+        setContentType(ContentType.create("application/pkcs7-mime", new BasicNameValuePair("smime-type", "enveloped-data"),
                 new BasicNameValuePair("name", "smime.p7m")));
         setContentTransferEncoding(encryptedContentTransferEncoding);
         addHeader(AS2Header.CONTENT_DISPOSITION, CONTENT_DISPOSITION);
diff --git a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/EntityParser.java b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/EntityParser.java
index 5fb23f4..42a4b1b 100644
--- a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/EntityParser.java
+++ b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/EntityParser.java
@@ -800,6 +800,20 @@ public final class EntityParser {
                 entity = parseApplicationPkcs7SignatureEntityBody(inbuffer, boundary, entityContentType,
                         contentTransferEncoding);
                 break;
+            case AS2MimeType.APPLICATION_PKCS7_MIME:
+                switch(entityContentType.getParameter("smime-type")) {
+                case "compressed-data":
+                    entity = parseApplicationPkcs7MimeCompressedDataEntityBody(inbuffer, boundary, entityContentType,
+                            contentTransferEncoding);
+                    break;
+                case "enveloped-data":
+                    entity = parseApplicationPkcs7MimeEnvelopedDataEntityBody(inbuffer, boundary, entityContentType,
+                            contentTransferEncoding);
+                    break;
+                default:
+                    break;
+                }
+                break;
             default:
                 break;
             }
@@ -882,7 +896,7 @@ public final class EntityParser {
         }
     }
 
-    public static ApplicationPkcs7MimeEnvelopedDataEntity parseApplicationPkcs7MimeEntityBody(AS2SessionInputBuffer inbuffer,
+    public static ApplicationPkcs7MimeEnvelopedDataEntity parseApplicationPkcs7MimeEnvelopedDataEntityBody(AS2SessionInputBuffer inbuffer,
                                                                                       String boundary,
                                                                                       ContentType contentType,
                                                                                       String contentTransferEncoding)
@@ -915,6 +929,40 @@ public final class EntityParser {
         }
     }
 
+    public static ApplicationPkcs7MimeCompressedDataEntity parseApplicationPkcs7MimeCompressedDataEntityBody(AS2SessionInputBuffer inbuffer,
+                                                                                                           String boundary,
+                                                                                                           ContentType contentType,
+                                                                                                           String contentTransferEncoding)
+            throws ParseException {
+
+        CharsetDecoder previousDecoder = inbuffer.getCharsetDecoder();
+
+        try {
+            Charset charset = contentType.getCharset();
+            if (charset == null) {
+                charset = Charset.forName(AS2Charset.US_ASCII);
+            }
+            CharsetDecoder charsetDecoder = charset.newDecoder();
+
+            inbuffer.setCharsetDecoder(charsetDecoder);
+
+            String pkcs7CompressedBodyContent = parseBodyPartText(inbuffer, boundary);
+
+            byte[] compressedContent = EntityUtils.decode(pkcs7CompressedBodyContent.getBytes(charset),
+                    contentTransferEncoding);
+
+            ApplicationPkcs7MimeCompressedDataEntity applicationPkcs7MimeEntity = new ApplicationPkcs7MimeCompressedDataEntity(
+                    compressedContent, contentTransferEncoding, false);
+            return applicationPkcs7MimeEntity;
+        } catch (Exception e) {
+            ParseException parseException = new ParseException("failed to parse PKCS7 Mime entity");
+            parseException.initCause(e);
+            throw parseException;
+        } finally {
+            inbuffer.setCharsetDecoder(previousDecoder);
+        }
+    }
+
     public static String parseBodyPartText(final AS2SessionInputBuffer inbuffer,
                                            final String boundary)
             throws IOException {
diff --git a/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/AS2MessageTest.java b/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/AS2MessageTest.java
index 9a43f10..5b9dc3e 100644
--- a/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/AS2MessageTest.java
+++ b/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/AS2MessageTest.java
@@ -32,6 +32,7 @@ import org.apache.camel.component.as2.api.entity.AS2DispositionType;
 import org.apache.camel.component.as2.api.entity.AS2MessageDispositionNotificationEntity;
 import org.apache.camel.component.as2.api.entity.ApplicationEDIEntity;
 import org.apache.camel.component.as2.api.entity.ApplicationEDIFACTEntity;
+import org.apache.camel.component.as2.api.entity.ApplicationPkcs7MimeCompressedDataEntity;
 import org.apache.camel.component.as2.api.entity.ApplicationPkcs7MimeEnvelopedDataEntity;
 import org.apache.camel.component.as2.api.entity.ApplicationPkcs7SignatureEntity;
 import org.apache.camel.component.as2.api.entity.DispositionMode;
@@ -70,6 +71,7 @@ import org.bouncycastle.asn1.smime.SMIMEEncryptionKeyPreferenceAttribute;
 import org.bouncycastle.asn1.x500.X500Name;
 import org.bouncycastle.cert.jcajce.JcaCertStore;
 import org.bouncycastle.cms.jcajce.JcaSimpleSignerInfoGeneratorBuilder;
+import org.bouncycastle.cms.jcajce.ZlibExpanderProvider;
 import org.bouncycastle.jce.provider.BouncyCastleProvider;
 import org.junit.AfterClass;
 import org.junit.Before;
@@ -735,5 +737,198 @@ public class AS2MessageTest {
                 mdnMic.getEncodedMessageDigest());
         LOG.debug("\r\n" + AS2Utils.printMessage(mndRequest));
     }
+    
+    @Test
+    public void compressedMessageTest() throws Exception {
+        AS2ClientConnection clientConnection = new AS2ClientConnection(AS2_VERSION, USER_AGENT, CLIENT_FQDN,
+                TARGET_HOST, TARGET_PORT);
+        AS2ClientManager clientManager = new AS2ClientManager(clientConnection);
+        
+        LOG.info("Key Algoritm: " + signingKP.getPrivate().getAlgorithm());
+
+        HttpCoreContext httpContext = clientManager.send(EDI_MESSAGE, REQUEST_URI, SUBJECT, FROM, AS2_NAME, AS2_NAME,
+                AS2MessageStructure.PLAIN_COMPRESSED,
+                ContentType.create(AS2MediaType.APPLICATION_EDIFACT, AS2Charset.US_ASCII), null,
+                null, null, null, AS2CompressionAlgorithm.ZLIB,
+                DISPOSITION_NOTIFICATION_TO, SIGNED_RECEIPT_MIC_ALGORITHMS, null,
+                null, null);
+
+        HttpRequest request = httpContext.getRequest();
+        assertEquals("Unexpected method value", METHOD, request.getRequestLine().getMethod());
+        assertEquals("Unexpected request URI value", REQUEST_URI, request.getRequestLine().getUri());
+        assertEquals("Unexpected HTTP version value", HttpVersion.HTTP_1_1,
+                request.getRequestLine().getProtocolVersion());
+
+        assertEquals("Unexpected subject value", SUBJECT, request.getFirstHeader(AS2Header.SUBJECT).getValue());
+        assertEquals("Unexpected from value", FROM, request.getFirstHeader(AS2Header.FROM).getValue());
+        assertEquals("Unexpected AS2 version value", AS2_VERSION,
+                request.getFirstHeader(AS2Header.AS2_VERSION).getValue());
+        assertEquals("Unexpected AS2 from value", AS2_NAME, request.getFirstHeader(AS2Header.AS2_FROM).getValue());
+        assertEquals("Unexpected AS2 to value", AS2_NAME, request.getFirstHeader(AS2Header.AS2_TO).getValue());
+        assertTrue("Unexpected message id value",
+                request.getFirstHeader(AS2Header.MESSAGE_ID).getValue().endsWith(CLIENT_FQDN + ">"));
+        assertEquals("Unexpected target host value", TARGET_HOST + ":" + TARGET_PORT,
+                request.getFirstHeader(AS2Header.TARGET_HOST).getValue());
+        assertEquals("Unexpected user agent value", USER_AGENT,
+                request.getFirstHeader(AS2Header.USER_AGENT).getValue());
+        assertNotNull("Date value missing", request.getFirstHeader(AS2Header.DATE));
+        assertNotNull("Content length value missing", request.getFirstHeader(AS2Header.CONTENT_LENGTH));
+        assertTrue("Unexpected content type for message",
+                request.getFirstHeader(AS2Header.CONTENT_TYPE).getValue().startsWith(AS2MimeType.APPLICATION_PKCS7_MIME));
+
+        assertTrue("Request does not contain entity", request instanceof BasicHttpEntityEnclosingRequest);
+        HttpEntity entity = ((BasicHttpEntityEnclosingRequest) request).getEntity();
+        assertNotNull("Request does not contain entity", entity);
+        assertTrue("Unexpected request entity type", entity instanceof ApplicationPkcs7MimeCompressedDataEntity);
+        ApplicationPkcs7MimeCompressedDataEntity compressedDataEntity = (ApplicationPkcs7MimeCompressedDataEntity) entity;
+        assertTrue("Entity not set as main body of request", compressedDataEntity.isMainBody());
+
+        // Validated compessed part.
+        MimeEntity compressedEntity = compressedDataEntity.getCompressedEntity(new ZlibExpanderProvider());
+        assertTrue("Enveloped mime part incorrect type ", compressedEntity instanceof ApplicationEDIFACTEntity);
+        ApplicationEDIFACTEntity ediEntity = (ApplicationEDIFACTEntity) compressedEntity;
+        assertTrue("Unexpected content type for compressed entity",
+                ediEntity.getContentType().getValue().startsWith(AS2MediaType.APPLICATION_EDIFACT));
+        assertFalse("Compressed entity set as main body of request", ediEntity.isMainBody());
+
+    }
+
+
+    @Test
+    public void compressedAndSignedMessageTest() throws Exception {
+        AS2ClientConnection clientConnection = new AS2ClientConnection(AS2_VERSION, USER_AGENT, CLIENT_FQDN,
+                TARGET_HOST, TARGET_PORT);
+        AS2ClientManager clientManager = new AS2ClientManager(clientConnection);
+        
+        LOG.info("Key Algoritm: " + signingKP.getPrivate().getAlgorithm());
+
+        HttpCoreContext httpContext = clientManager.send(EDI_MESSAGE, REQUEST_URI, SUBJECT, FROM, AS2_NAME, AS2_NAME,
+                AS2MessageStructure.SIGNED_COMPRESSED,
+                ContentType.create(AS2MediaType.APPLICATION_EDIFACT, AS2Charset.US_ASCII), null,
+                AS2SignatureAlgorithm.SHA256WITHRSA, certList.toArray(new Certificate[0]), signingKP.getPrivate(), AS2CompressionAlgorithm.ZLIB,
+                DISPOSITION_NOTIFICATION_TO, SIGNED_RECEIPT_MIC_ALGORITHMS, null,
+                null, null);
+
+        HttpRequest request = httpContext.getRequest();
+        assertEquals("Unexpected method value", METHOD, request.getRequestLine().getMethod());
+        assertEquals("Unexpected request URI value", REQUEST_URI, request.getRequestLine().getUri());
+        assertEquals("Unexpected HTTP version value", HttpVersion.HTTP_1_1,
+                request.getRequestLine().getProtocolVersion());
+
+        assertEquals("Unexpected subject value", SUBJECT, request.getFirstHeader(AS2Header.SUBJECT).getValue());
+        assertEquals("Unexpected from value", FROM, request.getFirstHeader(AS2Header.FROM).getValue());
+        assertEquals("Unexpected AS2 version value", AS2_VERSION,
+                request.getFirstHeader(AS2Header.AS2_VERSION).getValue());
+        assertEquals("Unexpected AS2 from value", AS2_NAME, request.getFirstHeader(AS2Header.AS2_FROM).getValue());
+        assertEquals("Unexpected AS2 to value", AS2_NAME, request.getFirstHeader(AS2Header.AS2_TO).getValue());
+        assertTrue("Unexpected message id value",
+                request.getFirstHeader(AS2Header.MESSAGE_ID).getValue().endsWith(CLIENT_FQDN + ">"));
+        assertEquals("Unexpected target host value", TARGET_HOST + ":" + TARGET_PORT,
+                request.getFirstHeader(AS2Header.TARGET_HOST).getValue());
+        assertEquals("Unexpected user agent value", USER_AGENT,
+                request.getFirstHeader(AS2Header.USER_AGENT).getValue());
+        assertNotNull("Date value missing", request.getFirstHeader(AS2Header.DATE));
+        assertNotNull("Content length value missing", request.getFirstHeader(AS2Header.CONTENT_LENGTH));
+        assertTrue("Unexpected content type for message",
+                request.getFirstHeader(AS2Header.CONTENT_TYPE).getValue().startsWith(AS2MimeType.APPLICATION_PKCS7_MIME));
+
+        assertTrue("Request does not contain entity", request instanceof BasicHttpEntityEnclosingRequest);
+        HttpEntity entity = ((BasicHttpEntityEnclosingRequest) request).getEntity();
+        assertNotNull("Request does not contain entity", entity);
+        assertTrue("Unexpected request entity type", entity instanceof ApplicationPkcs7MimeCompressedDataEntity);
+        ApplicationPkcs7MimeCompressedDataEntity compressedDataEntity = (ApplicationPkcs7MimeCompressedDataEntity) entity;
+        assertTrue("Entity not set as main body of request", compressedDataEntity.isMainBody());
+
+        // Validated compressed part.
+        MimeEntity compressedEntity = compressedDataEntity.getCompressedEntity(new ZlibExpanderProvider());
+        assertTrue("Enveloped mime part incorrect type ", compressedEntity instanceof MultipartSignedEntity);
+        MultipartSignedEntity multipartSignedEntity = (MultipartSignedEntity) compressedEntity;
+        assertTrue("Unexpected content type for compressed entity",
+                multipartSignedEntity.getContentType().getValue().startsWith(AS2MediaType.MULTIPART_SIGNED));
+        assertFalse("Multipart signed entity set as main body of request", multipartSignedEntity.isMainBody());
+        assertTrue("Multipart signed entity contains invalid number of mime parts",
+                multipartSignedEntity.getPartCount() == 2);
+
+        // Validated first mime part.
+        assertTrue("First mime part incorrect type ", multipartSignedEntity.getPart(0) instanceof ApplicationEDIFACTEntity);
+        ApplicationEDIFACTEntity ediEntity = (ApplicationEDIFACTEntity) multipartSignedEntity.getPart(0);
+        assertTrue("Unexpected content type for first mime part",
+                ediEntity.getContentType().getValue().startsWith(AS2MediaType.APPLICATION_EDIFACT));
+        assertFalse("First mime type set as main body of request", ediEntity.isMainBody());
+        
+        // Validate second mime part.
+        assertTrue("Second mime part incorrect type ",
+                multipartSignedEntity.getPart(1) instanceof ApplicationPkcs7SignatureEntity);
+        ApplicationPkcs7SignatureEntity signatureEntity = (ApplicationPkcs7SignatureEntity) multipartSignedEntity.getPart(1);
+        assertTrue("Unexpected content type for second mime part",
+                signatureEntity.getContentType().getValue().startsWith(AS2MediaType.APPLICATION_PKCS7_SIGNATURE));
+        assertFalse("First mime type set as main body of request", signatureEntity.isMainBody());
+    }
+
+    @Test
+    public void envelopedAndCompressedMessageTest() throws Exception {
+        AS2ClientConnection clientConnection = new AS2ClientConnection(AS2_VERSION, USER_AGENT, CLIENT_FQDN,
+                TARGET_HOST, TARGET_PORT);
+        AS2ClientManager clientManager = new AS2ClientManager(clientConnection);
+        
+        LOG.info("Key Algoritm: " + signingKP.getPrivate().getAlgorithm());
+
+        HttpCoreContext httpContext = clientManager.send(EDI_MESSAGE, REQUEST_URI, SUBJECT, FROM, AS2_NAME, AS2_NAME,
+                AS2MessageStructure.ENCRYPTED_COMPRESSED,
+                ContentType.create(AS2MediaType.APPLICATION_EDIFACT, AS2Charset.US_ASCII), null,
+                null, null, null, AS2CompressionAlgorithm.ZLIB,
+                DISPOSITION_NOTIFICATION_TO, SIGNED_RECEIPT_MIC_ALGORITHMS, AS2EncryptionAlgorithm.AES128_CBC,
+                certList.toArray(new Certificate[0]), signingKP.getPrivate());
+
+        HttpRequest request = httpContext.getRequest();
+        assertEquals("Unexpected method value", METHOD, request.getRequestLine().getMethod());
+        assertEquals("Unexpected request URI value", REQUEST_URI, request.getRequestLine().getUri());
+        assertEquals("Unexpected HTTP version value", HttpVersion.HTTP_1_1,
+                request.getRequestLine().getProtocolVersion());
+
+        assertEquals("Unexpected subject value", SUBJECT, request.getFirstHeader(AS2Header.SUBJECT).getValue());
+        assertEquals("Unexpected from value", FROM, request.getFirstHeader(AS2Header.FROM).getValue());
+        assertEquals("Unexpected AS2 version value", AS2_VERSION,
+                request.getFirstHeader(AS2Header.AS2_VERSION).getValue());
+        assertEquals("Unexpected AS2 from value", AS2_NAME, request.getFirstHeader(AS2Header.AS2_FROM).getValue());
+        assertEquals("Unexpected AS2 to value", AS2_NAME, request.getFirstHeader(AS2Header.AS2_TO).getValue());
+        assertTrue("Unexpected message id value",
+                request.getFirstHeader(AS2Header.MESSAGE_ID).getValue().endsWith(CLIENT_FQDN + ">"));
+        assertEquals("Unexpected target host value", TARGET_HOST + ":" + TARGET_PORT,
+                request.getFirstHeader(AS2Header.TARGET_HOST).getValue());
+        assertEquals("Unexpected user agent value", USER_AGENT,
+                request.getFirstHeader(AS2Header.USER_AGENT).getValue());
+        assertNotNull("Date value missing", request.getFirstHeader(AS2Header.DATE));
+        assertNotNull("Content length value missing", request.getFirstHeader(AS2Header.CONTENT_LENGTH));
+        assertTrue("Unexpected content type for message",
+                request.getFirstHeader(AS2Header.CONTENT_TYPE).getValue().startsWith(AS2MimeType.APPLICATION_PKCS7_MIME));
+
+        assertTrue("Request does not contain entity", request instanceof BasicHttpEntityEnclosingRequest);
+        HttpEntity entity = ((BasicHttpEntityEnclosingRequest) request).getEntity();
+        assertNotNull("Request does not contain entity", entity);
+        assertTrue("Unexpected request entity type", entity instanceof ApplicationPkcs7MimeEnvelopedDataEntity);
+        ApplicationPkcs7MimeEnvelopedDataEntity envelopedEntity = (ApplicationPkcs7MimeEnvelopedDataEntity) entity;
+        assertTrue("Entity not set as main body of request", envelopedEntity.isMainBody());
+
+        // Validated enveloped part.
+        MimeEntity encryptedEntity = envelopedEntity.getEncryptedEntity(signingKP.getPrivate());
+        assertTrue("Enveloped mime part incorrect type ", encryptedEntity instanceof ApplicationPkcs7MimeCompressedDataEntity);
+        ApplicationPkcs7MimeCompressedDataEntity compressedDataEntity = (ApplicationPkcs7MimeCompressedDataEntity) encryptedEntity;
+        assertTrue("Unexpected content type for compressed mime part",
+                compressedDataEntity.getContentType().getValue().startsWith(AS2MimeType.APPLICATION_PKCS7_MIME));
+        assertFalse("Enveloped mime type set as main body of request", compressedDataEntity.isMainBody());
+
+        // Validated compressed part.
+        MimeEntity compressedEntity = compressedDataEntity.getCompressedEntity(new ZlibExpanderProvider());
+        assertTrue("Enveloped mime part incorrect type ", compressedEntity instanceof ApplicationEDIFACTEntity);
+        ApplicationEDIFACTEntity ediEntity = (ApplicationEDIFACTEntity) compressedEntity;
+        assertTrue("Unexpected content type for compressed entity",
+                ediEntity.getContentType().getValue().startsWith(AS2MediaType.APPLICATION_EDIFACT));
+        assertFalse("Compressed entity set as main body of request", ediEntity.isMainBody());
+        assertEquals("Unexpected content for enveloped mime part", EDI_MESSAGE.replaceAll("[\n\r]", ""),
+                ediEntity.getEdiMessage().replaceAll("[\n\r]", ""));
+    }
+
+
 
 }

Reply | Threaded
Open this post in threaded view
|

[camel] 11/35: Typo

acosentino
In reply to this post by acosentino
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch sandbox/camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 6d3120ce2a67881bcc620394473b6fb33b1fa953
Author: Claus Ibsen <[hidden email]>
AuthorDate: Sun Dec 2 12:07:44 2018 +0100

    Typo
---
 .../component/google/calendar/stream/GoogleCalendarStreamEndpoint.java  | 2 +-
 components/readme.adoc                                                  | 2 +-
 .../stream/springboot/GoogleCalendarStreamComponentConfiguration.java   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/components/camel-google-calendar/src/main/java/org/apache/camel/component/google/calendar/stream/GoogleCalendarStreamEndpoint.java b/components/camel-google-calendar/src/main/java/org/apache/camel/component/google/calendar/stream/GoogleCalendarStreamEndpoint.java
index 24e0fbc..00a032d 100644
--- a/components/camel-google-calendar/src/main/java/org/apache/camel/component/google/calendar/stream/GoogleCalendarStreamEndpoint.java
+++ b/components/camel-google-calendar/src/main/java/org/apache/camel/component/google/calendar/stream/GoogleCalendarStreamEndpoint.java
@@ -30,7 +30,7 @@ import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
 
 /**
- * The google-calendar component provides access to Google Calendar in a streaming mod.
+ * The google-calendar component provides access to Google Calendar in a streaming mode.
  */
 @UriEndpoint(firstVersion = "2.23.0",
              scheme = "google-calendar-stream",
diff --git a/components/readme.adoc b/components/readme.adoc
index 2d24f04..a3bc25f6 100644
--- a/components/readme.adoc
+++ b/components/readme.adoc
@@ -291,7 +291,7 @@ Number of Components: 287 in 190 JAR artifacts (1 deprecated)
 `google-calendar:apiName/methodName` | 2.15 | The google-calendar component provides access to Google Calendar.
 
 | link:camel-google-calendar/src/main/docs/google-calendar-stream-component.adoc[Google Calendar Stream] (camel-google-calendar) +
-`google-calendar-stream:index` | 2.23 | The google-calendar component provides access to Google Calendar in a streaming mod.
+`google-calendar-stream:index` | 2.23 | The google-calendar component provides access to Google Calendar in a streaming mode.
 
 | link:camel-google-drive/src/main/docs/google-drive-component.adoc[Google Drive] (camel-google-drive) +
 `google-drive:apiName/methodName` | 2.14 | The google-drive component provides access to Google Drive file storage service.
diff --git a/platforms/spring-boot/components-starter/camel-google-calendar-starter/src/main/java/org/apache/camel/component/google/calendar/stream/springboot/GoogleCalendarStreamComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-google-calendar-starter/src/main/java/org/apache/camel/component/google/calendar/stream/springboot/GoogleCalendarStreamComponentConfiguration.java
index 0689c8d..c16f93b 100644
--- a/platforms/spring-boot/components-starter/camel-google-calendar-starter/src/main/java/org/apache/camel/component/google/calendar/stream/springboot/GoogleCalendarStreamComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-google-calendar-starter/src/main/java/org/apache/camel/component/google/calendar/stream/springboot/GoogleCalendarStreamComponentConfiguration.java
@@ -23,7 +23,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
 
 /**
  * The google-calendar component provides access to Google Calendar in a
- * streaming mod.
+ * streaming mode.
  *
  * Generated by camel-package-maven-plugin - do not edit this file!
  */

Reply | Threaded
Open this post in threaded view
|

[camel] 12/35: Polished

acosentino
In reply to this post by acosentino
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch sandbox/camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit b423d4e129547638fc3e0bbabce39d9dd687483e
Author: Claus Ibsen <[hidden email]>
AuthorDate: Sun Dec 2 12:15:01 2018 +0100

    Polished
---
 .../bigquery/sql/GoogleBigQuerySQLEndpoint.java    | 24 +++++++++++++---------
 components/readme.adoc                             |  2 +-
 .../GoogleBigQuerySQLComponentConfiguration.java   | 11 +---------
 3 files changed, 16 insertions(+), 21 deletions(-)

diff --git a/components/camel-google-bigquery/src/main/java/org/apache/camel/component/google/bigquery/sql/GoogleBigQuerySQLEndpoint.java b/components/camel-google-bigquery/src/main/java/org/apache/camel/component/google/bigquery/sql/GoogleBigQuerySQLEndpoint.java
index 9a420f0..a268dc2 100644
--- a/components/camel-google-bigquery/src/main/java/org/apache/camel/component/google/bigquery/sql/GoogleBigQuerySQLEndpoint.java
+++ b/components/camel-google-bigquery/src/main/java/org/apache/camel/component/google/bigquery/sql/GoogleBigQuerySQLEndpoint.java
@@ -26,16 +26,20 @@ import org.apache.camel.spi.UriParam;
 import org.apache.camel.support.DefaultEndpoint;
 
 /**
- * Google BigQuery data warehouse for analytics. BigQuery Endpoint Definition
- * Represents a table within a BigQuery dataset Contains configuration details
- * for a single table and the utility methods (such as check, create) to ease
- * operations URI Parameters: * Logger ID - To ensure that logging is unified
- * under Route Logger, the logger ID can be passed on via an endpoint URI
- * parameter * Partitioned - to indicate that the table needs to be partitioned
- * - every UTC day to be written into a timestamped separate table side effect:
- * Australian operational day is always split between two UTC days, and,
- * therefore, tables Another consideration is that exceptions are not handled
- * within the class. They are expected to bubble up and be handled by Camel.
+ * Google BigQuery data warehouse for analytics (using SQL queries).
+ *
+ * BigQuery Endpoint Definition
+ * Represents a table within a BigQuery dataset
+ * Contains configuration details for a single table and the utility methods (such as check, create) to ease operations
+ * URI Parameters:
+ * * Logger ID - To ensure that logging is unified under Route Logger, the logger ID can be passed on
+ *               via an endpoint URI parameter
+ * * Partitioned - to indicate that the table needs to be partitioned - every UTC day to be written into a
+ *                 timestamped separate table
+ *                 side effect: Australian operational day is always split between two UTC days, and, therefore, tables
+ *
+ * Another consideration is that exceptions are not handled within the class. They are expected to bubble up and be handled
+ * by Camel.
  */
 @UriEndpoint(firstVersion = "2.23.0", scheme = "google-bigquery-sql", title = "Google BigQuery Standard SQL", syntax = "google-bigquery-sql:query", label = "cloud,messaging", producerOnly = true)
 public class GoogleBigQuerySQLEndpoint extends DefaultEndpoint {
diff --git a/components/readme.adoc b/components/readme.adoc
index a3bc25f6..72d5420 100644
--- a/components/readme.adoc
+++ b/components/readme.adoc
@@ -285,7 +285,7 @@ Number of Components: 287 in 190 JAR artifacts (1 deprecated)
 `google-bigquery:projectId:datasetId:tableName` | 2.20 | Google BigQuery data warehouse for analytics.
 
 | link:camel-google-bigquery/src/main/docs/google-bigquery-sql-component.adoc[Google BigQuery Standard SQL] (camel-google-bigquery) +
-`google-bigquery-sql:query` | 2.23 | Google BigQuery data warehouse for analytics. BigQuery Endpoint Definition Represents a table within a BigQuery dataset Contains configuration details for a single table and the utility methods (such as check, create) to ease operations URI Parameters: Logger ID - To ensure that logging is unified under Route Logger, the logger ID can be passed on via an endpoint URI parameter Partitioned - to indicate that the table needs to be partitioned - every UT [...]
+`google-bigquery-sql:query` | 2.23 | Google BigQuery data warehouse for analytics (using SQL queries).
 
 | link:camel-google-calendar/src/main/docs/google-calendar-component.adoc[Google Calendar] (camel-google-calendar) +
 `google-calendar:apiName/methodName` | 2.15 | The google-calendar component provides access to Google Calendar.
diff --git a/platforms/spring-boot/components-starter/camel-google-bigquery-starter/src/main/java/org/apache/camel/component/google/bigquery/sql/springboot/GoogleBigQuerySQLComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-google-bigquery-starter/src/main/java/org/apache/camel/component/google/bigquery/sql/springboot/GoogleBigQuerySQLComponentConfiguration.java
index fc08356..5ae4e9a 100644
--- a/platforms/spring-boot/components-starter/camel-google-bigquery-starter/src/main/java/org/apache/camel/component/google/bigquery/sql/springboot/GoogleBigQuerySQLComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-google-bigquery-starter/src/main/java/org/apache/camel/component/google/bigquery/sql/springboot/GoogleBigQuerySQLComponentConfiguration.java
@@ -21,16 +21,7 @@ import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 
 /**
- * Google BigQuery data warehouse for analytics. BigQuery Endpoint Definition
- * Represents a table within a BigQuery dataset Contains configuration details
- * for a single table and the utility methods (such as check, create) to ease
- * operations URI Parameters: Logger ID - To ensure that logging is unified
- * under Route Logger, the logger ID can be passed on via an endpoint URI
- * parameter Partitioned - to indicate that the table needs to be partitioned -
- * every UTC day to be written into a timestamped separate table side effect:
- * Australian operational day is always split between two UTC days, and,
- * therefore, tables Another consideration is that exceptions are not handled
- * within the class. They are expected to bubble up and be handled by Camel.
+ * Google BigQuery data warehouse for analytics (using SQL queries).
  *
  * Generated by camel-package-maven-plugin - do not edit this file!
  */

Reply | Threaded
Open this post in threaded view
|

[camel] 13/35: Typos

acosentino
In reply to this post by acosentino
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch sandbox/camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit b871a11f58c86131d5cfaecc6407f0e514a55a15
Author: Bilgin Ibryam <[hidden email]>
AuthorDate: Sun Dec 2 12:45:52 2018 +0000

    Typos
---
 components/camel-corda/README.md                          | 2 +-
 components/camel-corda/src/main/docs/corda-component.adoc | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/components/camel-corda/README.md b/components/camel-corda/README.md
index 1431dd2..ddbbbad 100644
--- a/components/camel-corda/README.md
+++ b/components/camel-corda/README.md
@@ -1,3 +1,3 @@
 # camel-corda
 
-[Apache Camel](http://camel.apache.org/) connector for R's [Corda](https://www.corda.net/) blockchain platform using corda-rpc library.
+[Apache Camel](http://camel.apache.org/) connector for R3's [Corda](https://www.corda.net/) blockchain platform using corda-rpc library.
diff --git a/components/camel-corda/src/main/docs/corda-component.adoc b/components/camel-corda/src/main/docs/corda-component.adoc
index eb454ae..9ce7fd3 100644
--- a/components/camel-corda/src/main/docs/corda-component.adoc
+++ b/components/camel-corda/src/main/docs/corda-component.adoc
@@ -3,8 +3,6 @@
 
 *Available as of Camel version 2.23*
 
-*Available as of Camel version 2.23*
-
 
 The *Corda* blockchain component uses the https://www.corda.net/[corda] rpc client
 

Reply | Threaded
Open this post in threaded view
|

[camel] 14/35: Polished

acosentino
In reply to this post by acosentino
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch sandbox/camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit dee4c1da0f7981c357ac46a64e7ad6672ca409f5
Author: Claus Ibsen <[hidden email]>
AuthorDate: Mon Dec 3 08:26:41 2018 +0100

    Polished
---
 .../src/main/docs/google-bigquery-component.adoc   | 25 ++++++++++------------
 .../main/docs/google-bigquery-sql-component.adoc   | 20 ++++++++---------
 2 files changed, 20 insertions(+), 25 deletions(-)

diff --git a/components/camel-google-bigquery/src/main/docs/google-bigquery-component.adoc b/components/camel-google-bigquery/src/main/docs/google-bigquery-component.adoc
index 5af187d..765591e 100644
--- a/components/camel-google-bigquery/src/main/docs/google-bigquery-component.adoc
+++ b/components/camel-google-bigquery/src/main/docs/google-bigquery-component.adoc
@@ -3,8 +3,6 @@
 
 *Available as of Camel version 2.20*
 
-### Component Description
-
 The Google Bigquery component provides access
 to https://cloud.google.com/bigquery/[Cloud BigQuery Infrastructure]┬ávia
 the https://developers.google.com/api-client-library/java/apis/bigquery/v2[Google Client Services API].
@@ -29,7 +27,7 @@ for this component:
 
 [[GoogleBigQuery-AuthenticationConfiguration]]
 
-### Authentication Configuration
+=== Authentication Configuration
 
 Google BigQuery component authentication is targeted for use with the GCP Service Accounts.
 For more information please refer to https://cloud.google.com/docs/authentication[Google Cloud Platform Auth Guide]
@@ -48,15 +46,15 @@ https://developers.google.com/identity/protocols/application-default-credentials
 
 Service Account Email and Service Account Key can be found in the GCP JSON credentials file as client_email and private_key respectively.
 
-### URI Format
+=== URI Format
 
-[source,java]
+[source,text]
 --------------------------------------------------------
         google-bigquery://project-id:datasetId[:tableId]?[options]
 --------------------------------------------------------
 
 
-### Options
+=== Options
 
 // component options: START
 The Google BigQuery component supports 4 options, which are listed below.
@@ -124,7 +122,7 @@ The component supports 4 options, which are listed below.
 // spring-boot-auto-configure options: END
 
 
-### Message Headers
+=== Message Headers
 
 [width="100%",cols="10%,10%,80%",options="header",]
 |=======================================================================
@@ -136,7 +134,7 @@ The component supports 4 options, which are listed below.
 |=======================================================================
 
 
-### Producer Endpoints
+=== Producer Endpoints
 
 Producer endpoints can accept and deliver to BigQuery individual and grouped
 exchanges alike. Grouped exchanges have `Exchange.GROUPED_EXCHANGE` property set.
@@ -148,7 +146,7 @@ correct suffix or partition decorator.
 Google BigQuery endpoint expects the payload to be either a map or list of maps. A payload containing a map
 will insert a single row and a payload containing a list of map's will insert a row for each entry in the list.
 
-### Template tables
+=== Template tables
 
 Reference: https://cloud.google.com/bigquery/streaming-data-into-bigquery#template-tables
 
@@ -159,13 +157,12 @@ I.e. the following route will create tables and insert records sharded on a per
 [source,java]
 ------------------------------------------------------
 from("direct:start")
-.header(GoogleBigQueryConstants.TABLE_SUFFIX, "_${date:now:yyyyMMdd}")
-.to("google-bigquery:sampleDataset:sampleTable")
-
+  .header(GoogleBigQueryConstants.TABLE_SUFFIX, "_${date:now:yyyyMMdd}")
+  .to("google-bigquery:sampleDataset:sampleTable")
 ------------------------------------------------------
 Note it is recommended to use partitioning for this use case.
 
-### Partitioning
+=== Partitioning
 
 Reference: https://cloud.google.com/bigquery/docs/creating-partitioned-tables
 
@@ -173,7 +170,7 @@ Partitioning is specified when creating a table and if set data will be automati
 separate tables. When inserting data a specific partition can be specified by setting the
 `GoogleBigQueryConstants.PARTITION_DECORATOR` header on the exchange.
 
-### Ensuring data consistency
+=== Ensuring data consistency
 
 Reference: https://cloud.google.com/bigquery/streaming-data-into-bigquery#dataconsistency
 
diff --git a/components/camel-google-bigquery/src/main/docs/google-bigquery-sql-component.adoc b/components/camel-google-bigquery/src/main/docs/google-bigquery-sql-component.adoc
index 36d7cb8..a0e06bb 100644
--- a/components/camel-google-bigquery/src/main/docs/google-bigquery-sql-component.adoc
+++ b/components/camel-google-bigquery/src/main/docs/google-bigquery-sql-component.adoc
@@ -1,9 +1,7 @@
 [[google-bigquery-sql-component]]
 == Google BigQuery Standard SQL Component
-== Google BigQuery Component
 *Available as of Camel version 2.23*
 
-### Component Description
 
 The Google Bigquery SQL component provides access
 to https://cloud.google.com/bigquery/[Cloud BigQuery Infrastructure]┬ávia
@@ -28,7 +26,7 @@ for this component:
 
 [[GoogleBigQuery-AuthenticationConfiguration]]
 
-### Authentication Configuration
+=== Authentication Configuration
 
 Google BigQuery component authentication is targeted for use with the GCP Service Accounts.
 For more information please refer to https://cloud.google.com/docs/authentication[Google Cloud Platform Auth Guide]
@@ -47,15 +45,15 @@ https://developers.google.com/identity/protocols/application-default-credentials
 
 Service Account Email and Service Account Key can be found in the GCP JSON credentials file as client_email and private_key respectively.
 
-### URI Format
+=== URI Format
 
-[source,java]
+[source,text]
 --------------------------------------------------------
         google-bigquery-sql://project-id:query?[options]
 --------------------------------------------------------
 
 Examples:
-[source,java]
+[source,text]
 --------------------------------------------------------
         google-bigquery-sql://project-17248459:delete * from test.table where id=@myId
         google-bigquery-sql://project-17248459:delete * from ${datasetId}.${tableId} where id=@myId
@@ -66,14 +64,14 @@ where
  * parameters in form @name are extracted from body or message headers and sent to Google Bigquery
 
 You can externalize your SQL queries to files in the classpath or file system as shown:
-[source,java]
+[source,text]
 --------------------------------------------------------
         google-bigquery-sql://project-17248459::classpath:delete.sql
 --------------------------------------------------------
 
 
 
-### Options
+=== Options
 
 // component options: START
 The Google BigQuery Standard SQL component supports 3 options, which are listed below.
@@ -137,7 +135,7 @@ The component supports 3 options, which are listed below.
 // spring-boot-auto-configure options: END
 
 
-### Ouput Message Headers
+=== Ouput Message Headers
 
 [width="100%",cols="10%,10%,80%",options="header",]
 |=======================================================================
@@ -146,6 +144,6 @@ The component supports 3 options, which are listed below.
 |=======================================================================
 
 
-### Producer Endpoints
+=== Producer Endpoints
 
-Google BigQuery SQL endpoint expects the payload to be either empty or a map of query parameters.
+Google BigQuery SQL endpoint expects the payload to be either empty or a map of query parameters.
\ No newline at end of file

Reply | Threaded
Open this post in threaded view
|

[camel] 16/35: Upgrade Micrometer to version 1.1.1

acosentino
In reply to this post by acosentino
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch sandbox/camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 856f83de8fe6c304817f6b572ad64931c414a1bb
Author: Andrea Cosentino <[hidden email]>
AuthorDate: Mon Dec 3 11:21:44 2018 +0100

    Upgrade Micrometer to version 1.1.1
---
 parent/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/parent/pom.xml b/parent/pom.xml
index dcd429b..3726b25 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -495,7 +495,7 @@
     <maven-surefire-report-plugin-version>2.22.1</maven-surefire-report-plugin-version>
     <maven-war-plugin-version>3.0.0</maven-war-plugin-version>
     <metrics-version>3.2.6</metrics-version>
-    <micrometer-version>1.1.0</micrometer-version>
+    <micrometer-version>1.1.1</micrometer-version>
     <milo-version>0.2.4</milo-version>
     <mina-bundle-version>1.1.7_6</mina-bundle-version>
     <mina-version>1.1.7</mina-version>

Reply | Threaded
Open this post in threaded view
|

[camel] 23/35: Upgrade Zipkin to version 2.11.9

acosentino
In reply to this post by acosentino
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch sandbox/camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 065d68d407716c2f6269cf5e7aa0da3d825c7b1e
Author: Andrea Cosentino <[hidden email]>
AuthorDate: Tue Dec 4 10:39:09 2018 +0100

    Upgrade Zipkin to version 2.11.9
---
 parent/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/parent/pom.xml b/parent/pom.xml
index c924fda..0606667 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -744,7 +744,7 @@
     <xom-version>1.2.5</xom-version>
     <zendesk-client-version>0.6.2</zendesk-client-version>
     <zipkin-reporter-version>2.7.10</zipkin-reporter-version>
-    <zipkin-version>2.11.8</zipkin-version>
+    <zipkin-version>2.11.9</zipkin-version>
     <zjsonpatch-version>0.3.0</zjsonpatch-version>
     <zookeeper-version>3.4.13</zookeeper-version>
     <zookeeper-guava-version>16.0</zookeeper-guava-version>

Reply | Threaded
Open this post in threaded view
|

[camel] 15/35: Upgrade Flink to version 1.7.0

acosentino
In reply to this post by acosentino
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch sandbox/camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit c5c22238d8db75f7201e57fb9a5bdd3411d8d391
Author: Andrea Cosentino <[hidden email]>
AuthorDate: Mon Dec 3 10:22:15 2018 +0100

    Upgrade Flink to version 1.7.0
---
 parent/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/parent/pom.xml b/parent/pom.xml
index 8735fa2..dcd429b 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -228,7 +228,7 @@
     <google-findbugs-annotations2-version>2.0.3</google-findbugs-annotations2-version>
     <google-maps-services-version>0.2.9</google-maps-services-version>
     <flatpack-version>3.4.3</flatpack-version>
-    <flink-version>1.6.2</flink-version>
+    <flink-version>1.7.0</flink-version>
     <fop-bundle-version>2.3_1</fop-bundle-version>
     <fop-version>2.3</fop-version>
     <ftpserver-version>1.1.1</ftpserver-version>

Reply | Threaded
Open this post in threaded view
|

[camel] 18/35: Update Spring Boot to version 2.1.1.RELEASE even in dm

acosentino
In reply to this post by acosentino
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch sandbox/camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 9cf7ff363de8a61482cb5a1a5e5750ec702896f7
Author: Andrea Cosentino <[hidden email]>
AuthorDate: Mon Dec 3 12:28:51 2018 +0100

    Update Spring Boot to version 2.1.1.RELEASE even in dm
---
 platforms/spring-boot/spring-boot-dm/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/platforms/spring-boot/spring-boot-dm/pom.xml b/platforms/spring-boot/spring-boot-dm/pom.xml
index 4049b0d..23dd47a 100644
--- a/platforms/spring-boot/spring-boot-dm/pom.xml
+++ b/platforms/spring-boot/spring-boot-dm/pom.xml
@@ -41,7 +41,7 @@
 
   <properties>
     <!-- Spring-Boot target version -->
-    <spring-boot-version>2.1.0.RELEASE</spring-boot-version>
+    <spring-boot-version>2.1.1.RELEASE</spring-boot-version>
 
     <!-- The following dependencies should be aligned with the ones in standard camel parent -->
     <!-- Needed by BOM generator-->

Reply | Threaded
Open this post in threaded view
|

[camel] 29/35: Upgrade Zipkin to version 2.11.10

acosentino
In reply to this post by acosentino
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch sandbox/camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit f9a1c7b020bd071807c1c90236c0caf33f703069
Author: Andrea Cosentino <[hidden email]>
AuthorDate: Wed Dec 5 09:03:19 2018 +0100

    Upgrade Zipkin to version 2.11.10
---
 parent/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/parent/pom.xml b/parent/pom.xml
index 8706652..41f88bc 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -744,7 +744,7 @@
     <xom-version>1.2.5</xom-version>
     <zendesk-client-version>0.6.2</zendesk-client-version>
     <zipkin-reporter-version>2.7.12</zipkin-reporter-version>
-    <zipkin-version>2.11.9</zipkin-version>
+    <zipkin-version>2.11.10</zipkin-version>
     <zjsonpatch-version>0.3.0</zjsonpatch-version>
     <zookeeper-version>3.4.13</zookeeper-version>
     <zookeeper-guava-version>16.0</zookeeper-guava-version>

12