[camel] branch sandbox/camel-3.x updated (32919f0 -> 2a874f5)

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

[camel] branch sandbox/camel-3.x updated (32919f0 -> 2a874f5)

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 32919f0  Regen
     new 63c3d5d  CAMEL-12810 - Added a note about the Karaf feature missing
     new c97987e  CAMEL-12810 - Changed the referenced repository for nessus deps
     new 96d1012  CAMEL-12940: Fixed an issue where dynamic doneFileName does not manage filename with 2 dots
     new 6ec3c4c  Camel-Jbpm: Fixed CS
     new 7774b09  Camel-Schematron: Fixed CS
     new fbee9c1  Refactor dopbox tests
     new bb4504d  [CAMEL-12942] Fix dropbox put operation
     new 2a874f5  Camel-Dropbox: Fixed test after backport refactor

The 8 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/component/file/GenericFileEndpoint.java  |   4 +-
 ...ConsumeDynamicDoneFileNameWithTwoDotsTest.java} |  43 +++---
 ...eSimpleDynamicDoneFileNameWithTwoDotsTest.java} |  43 +++---
 components/camel-dropbox/pom.xml                   |  32 +++--
 .../component/dropbox/core/DropboxAPIFacade.java   |  24 ++--
 .../component/dropbox/DropboxConsumerTest.java     |  16 +--
 .../dropbox/integration/DropboxTestSupport.java    |  66 +++++++--
 .../consumer/DropboxConsumerGetSingleTest.java     |  25 ++--
 .../consumer/DropboxConsumerSearchQueryTest.java   |  23 ++--
 .../consumer/DropboxConsumerSearchTest.java        |  56 --------
 .../producer/DropboxProducerDelTest.java           |  54 +++-----
 .../producer/DropboxProducerGetFolderTest.java     | 106 +++++----------
 .../producer/DropboxProducerGetSingleTest.java     |  61 +++------
 .../producer/DropboxProducerMoveTest.java          |  59 +++-----
 .../producer/DropboxProducerPutSingleFileTest.java |  99 ++++++++------
 ...boxProducerPutSingleFileWithRemotePathTest.java |  96 -------------
 .../DropboxProducerPutWithRemotePathTest.java      |  95 -------------
 .../producer/DropboxProducerSearchQueryTest.java   |  66 +++------
 .../producer/DropboxProducerSearchTest.java        |  92 -------------
 .../src/test/resources/test-options.properties     |   3 +-
 components/camel-ipfs/pom.xml                      |   4 +-
 .../camel-ipfs/src/main/docs/ipfs-component.adoc   |   3 +
 .../camel/component/jbpm/JBPMConfiguration.java    |  28 ++--
 .../apache/camel/component/jbpm/JBPMEndpoint.java  |  12 +-
 .../apache/camel/component/jbpm/JBPMProducer.java  | 148 +++++++++++++--------
 .../jbpm/server/CamelKieServerExtension.java       |  67 +++++-----
 .../jbpm/JBPMComponentIntegrationTest.java         |  41 +++---
 .../component/schematron/SchematronProducer.java   |  14 +-
 .../schematron/SchematronProducerTest.java         |  12 +-
 .../components-starter/camel-ipfs-starter/pom.xml  |   4 +-
 30 files changed, 512 insertions(+), 884 deletions(-)
 copy camel-core/src/test/java/org/apache/camel/{impl/GzipDataFormatFileUnmarshalDeleteTest.java => component/file/FileConsumeDynamicDoneFileNameWithTwoDotsTest.java} (54%)
 copy camel-core/src/test/java/org/apache/camel/{impl/GzipDataFormatFileUnmarshalDeleteTest.java => component/file/FileConsumeSimpleDynamicDoneFileNameWithTwoDotsTest.java} (53%)
 delete mode 100644 components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/consumer/DropboxConsumerSearchTest.java
 delete mode 100644 components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerPutSingleFileWithRemotePathTest.java
 delete mode 100644 components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerPutWithRemotePathTest.java
 delete mode 100644 components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerSearchTest.java

Reply | Threaded
Open this post in threaded view
|

[camel] 01/08: CAMEL-12810 - Added a note about the Karaf feature missing

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 63c3d5de1ed0446344fa60b52f8394e2924c039e
Author: Andrea Cosentino <[hidden email]>
AuthorDate: Thu Nov 15 15:11:05 2018 +0100

    CAMEL-12810 - Added a note about the Karaf feature missing
---
 components/camel-ipfs/src/main/docs/ipfs-component.adoc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/components/camel-ipfs/src/main/docs/ipfs-component.adoc b/components/camel-ipfs/src/main/docs/ipfs-component.adoc
index a975f43..78f6742 100644
--- a/components/camel-ipfs/src/main/docs/ipfs-component.adoc
+++ b/components/camel-ipfs/src/main/docs/ipfs-component.adoc
@@ -76,6 +76,9 @@ The component supports 2 options, which are listed below.
 |===
 // spring-boot-auto-configure options: END
 
+### Karaf support
+
+Actually this component is not supported in Karaf
 
 ### Message Headers
 

Reply | Threaded
Open this post in threaded view
|

[camel] 02/08: CAMEL-12810 - Changed the referenced repository for nessus deps

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 c97987e6c66b69d572d038163b780dc2b58bbd4d
Author: Andrea Cosentino <[hidden email]>
AuthorDate: Thu Nov 15 15:50:33 2018 +0100

    CAMEL-12810 - Changed the referenced repository for nessus deps
---
 components/camel-ipfs/pom.xml                                       | 4 ++--
 platforms/spring-boot/components-starter/camel-ipfs-starter/pom.xml | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/components/camel-ipfs/pom.xml b/components/camel-ipfs/pom.xml
index 94dad67..76cd2b5 100644
--- a/components/camel-ipfs/pom.xml
+++ b/components/camel-ipfs/pom.xml
@@ -38,9 +38,9 @@
 
   <repositories>
     <repository>
-      <id>jboss.ea</id>
+      <id>jboss.thirdparty</id>
       <name>JBoss Repository</name>
-      <url>https://repository.jboss.org/nexus/content/groups/ea</url>
+      <url>https://repository.jboss.org/nexus/service/local/repositories/thirdparty-releases/content/</url>
       <snapshots>
         <enabled>false</enabled>
       </snapshots>
diff --git a/platforms/spring-boot/components-starter/camel-ipfs-starter/pom.xml b/platforms/spring-boot/components-starter/camel-ipfs-starter/pom.xml
index f48a4cc..25b2c62 100644
--- a/platforms/spring-boot/components-starter/camel-ipfs-starter/pom.xml
+++ b/platforms/spring-boot/components-starter/camel-ipfs-starter/pom.xml
@@ -53,9 +53,9 @@
   <!--START OF GENERATED CODE-->
   <repositories>
     <repository>
-      <id>jboss.ea</id>
+      <id>jboss.thirdparty</id>
       <name>JBoss Repository</name>
-      <url>https://repository.jboss.org/nexus/content/groups/ea</url>
+      <url>https://repository.jboss.org/nexus/service/local/repositories/thirdparty-releases/content/</url>
       <snapshots>
         <enabled>false</enabled>
       </snapshots>

Reply | Threaded
Open this post in threaded view
|

[camel] 03/08: CAMEL-12940: Fixed an issue where dynamic doneFileName does not manage filename with 2 dots

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 96d1012f94e5139c5ad9e85bd8cffe5042e8f514
Author: aldettinger <[hidden email]>
AuthorDate: Thu Nov 15 18:57:10 2018 +0100

    CAMEL-12940: Fixed an issue where dynamic doneFileName does not manage filename with 2 dots
---
 .../camel/component/file/GenericFileEndpoint.java  |  4 +-
 ...eConsumeDynamicDoneFileNameWithTwoDotsTest.java | 68 ++++++++++++++++++++++
 ...meSimpleDynamicDoneFileNameWithTwoDotsTest.java | 68 ++++++++++++++++++++++
 3 files changed, 138 insertions(+), 2 deletions(-)

diff --git a/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
index d860fef..1956c8c 100644
--- a/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
@@ -1421,8 +1421,8 @@ public abstract class GenericFileEndpoint<T> extends ScheduledPollEndpoint imple
 
         pattern = pattern.replaceFirst("\\$\\{file:name\\}", onlyName);
         pattern = pattern.replaceFirst("\\$simple\\{file:name\\}", onlyName);
-        pattern = pattern.replaceFirst("\\$\\{file:name.noext\\}", FileUtil.stripExt(onlyName));
-        pattern = pattern.replaceFirst("\\$simple\\{file:name.noext\\}", FileUtil.stripExt(onlyName));
+        pattern = pattern.replaceFirst("\\$\\{file:name.noext\\}", FileUtil.stripExt(onlyName, true));
+        pattern = pattern.replaceFirst("\\$simple\\{file:name.noext\\}", FileUtil.stripExt(onlyName, true));
 
         // must be able to resolve all placeholders supported
         if (StringHelper.hasStartToken(pattern, "simple")) {
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeDynamicDoneFileNameWithTwoDotsTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeDynamicDoneFileNameWithTwoDotsTest.java
new file mode 100644
index 0000000..a45905a
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeDynamicDoneFileNameWithTwoDotsTest.java
@@ -0,0 +1,68 @@
+/**
+ * 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.file;
+
+import java.io.File;
+import java.lang.invoke.MethodHandles;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.NotifyBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * This class tests an issue where an input file is not picked up due to a dynamic
+ * doneFileName containing two dots.
+ */
+public class FileConsumeDynamicDoneFileNameWithTwoDotsTest extends ContextTestSupport {
+
+    private static final String TARGET_DIR_NAME = "target/" + MethodHandles.lookup().lookupClass().getSimpleName();
+
+    @Override
+    @Before
+    public void setUp() throws Exception {
+        deleteDirectory(TARGET_DIR_NAME);
+        super.setUp();
+    }
+
+    @Test
+    public void testDynamicDoneFileNameContainingTwoDots() throws Exception {
+        NotifyBuilder notify = new NotifyBuilder(context).whenDone(1).create();
+        getMockEndpoint("mock:result").expectedBodiesReceivedInAnyOrder("input-body");
+
+        template.sendBodyAndHeader("file:" + TARGET_DIR_NAME, "input-body", Exchange.FILE_NAME, "test.twodot.txt");
+        template.sendBodyAndHeader("file:" + TARGET_DIR_NAME, "done-body", Exchange.FILE_NAME, "test.twodot.done");
+
+        assertMockEndpointsSatisfied();
+        assertTrue(notify.matchesMockWaitTime());
+
+        assertFalse("Input file should be deleted", new File(TARGET_DIR_NAME, "test.twodot.txt").exists());
+        assertFalse("Done file should be deleted", new File(TARGET_DIR_NAME, "test.twodot.done").exists());
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("file:" + TARGET_DIR_NAME + "?doneFileName=${file:name.noext}.done&initialDelay=0").to("mock:result");
+            }
+        };
+    }
+}
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeSimpleDynamicDoneFileNameWithTwoDotsTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeSimpleDynamicDoneFileNameWithTwoDotsTest.java
new file mode 100644
index 0000000..d1de7a9
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeSimpleDynamicDoneFileNameWithTwoDotsTest.java
@@ -0,0 +1,68 @@
+/**
+ * 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.file;
+
+import java.io.File;
+import java.lang.invoke.MethodHandles;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.NotifyBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * This class tests an issue where an input file is not picked up due to a
+ * dynamic doneFileName using the simple syntax and containing two dots.
+ */
+public class FileConsumeSimpleDynamicDoneFileNameWithTwoDotsTest extends ContextTestSupport {
+
+    private static final String TARGET_DIR_NAME = "target/" + MethodHandles.lookup().lookupClass().getSimpleName();
+
+    @Override
+    @Before
+    public void setUp() throws Exception {
+        deleteDirectory(TARGET_DIR_NAME);
+        super.setUp();
+    }
+
+    @Test
+    public void testSimpleDynamicDoneFileNameContainingTwoDots() throws Exception {
+        NotifyBuilder notify = new NotifyBuilder(context).whenDone(1).create();
+        getMockEndpoint("mock:result").expectedBodiesReceivedInAnyOrder("input-body");
+
+        template.sendBodyAndHeader("file:" + TARGET_DIR_NAME, "input-body", Exchange.FILE_NAME, "test.twodot.txt");
+        template.sendBodyAndHeader("file:" + TARGET_DIR_NAME, "done-body", Exchange.FILE_NAME, "test.twodot.done");
+
+        assertMockEndpointsSatisfied();
+        assertTrue(notify.matchesMockWaitTime());
+
+        assertFalse("Input file should be deleted", new File(TARGET_DIR_NAME, "test.twodot.txt").exists());
+        assertFalse("Done file should be deleted", new File(TARGET_DIR_NAME, "test.twodot.done").exists());
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("file:" + TARGET_DIR_NAME + "?doneFileName=$simple{file:name.noext}.done&initialDelay=0").to("mock:result");
+            }
+        };
+    }
+}

Reply | Threaded
Open this post in threaded view
|

[camel] 04/08: Camel-Jbpm: 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 6ec3c4ca50300b9e75e4db5de563cc566a95bbb3
Author: Andrea Cosentino <[hidden email]>
AuthorDate: Fri Nov 16 09:28:34 2018 +0100

    Camel-Jbpm: Fixed CS
---
 .../camel/component/jbpm/JBPMConfiguration.java    |  28 ++--
 .../apache/camel/component/jbpm/JBPMEndpoint.java  |  12 +-
 .../apache/camel/component/jbpm/JBPMProducer.java  | 148 +++++++++++++--------
 .../jbpm/server/CamelKieServerExtension.java       |  67 +++++-----
 .../jbpm/JBPMComponentIntegrationTest.java         |  41 +++---
 5 files changed, 169 insertions(+), 127 deletions(-)

diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMConfiguration.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMConfiguration.java
index 9633aaa..b415bfe 100644
--- a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMConfiguration.java
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMConfiguration.java
@@ -30,11 +30,13 @@ import org.kie.api.task.model.Task;
 @UriParams
 public class JBPMConfiguration {
 
-    @UriPath @Metadata(required = "true")
+    @UriPath
+    @Metadata(required = "true")
     private URL connectionURL;
     @UriParam(label = "producer", defaultValue = "startProcess")
     private String operation;
-    @UriParam @Metadata(required = "true")
+    @UriParam
+    @Metadata(required = "true")
     private String deploymentId;
     @UriParam
     private Long processInstanceId;
@@ -84,7 +86,7 @@ public class JBPMConfiguration {
     private Class[] extraJaxbClasses;
     @UriParam
     private Boolean emitterSendItems;
-    
+
     @UriPath
     private String eventListenerType;
 
@@ -159,7 +161,8 @@ public class JBPMConfiguration {
     }
 
     /**
-     * the data associated with this event when signalEvent operation is performed
+     * the data associated with this event when signalEvent operation is
+     * performed
      */
     public void setEvent(Object event) {
         this.event = event;
@@ -203,7 +206,7 @@ public class JBPMConfiguration {
     }
 
     /**
-     *the id of the task
+     * the id of the task
      */
     public void setTaskId(Long taskId) {
         this.taskId = taskId;
@@ -241,7 +244,7 @@ public class JBPMConfiguration {
     public void setPage(Integer page) {
         this.page = page;
     }
-    
+
     public Integer getPageSize() {
         return pageSize;
     }
@@ -374,7 +377,6 @@ public class JBPMConfiguration {
         this.extraJaxbClasses = extraJaxbClasses;
     }
 
-    
     public String getEventListenerType() {
         return eventListenerType;
     }
@@ -385,13 +387,14 @@ public class JBPMConfiguration {
     public void setEventListenerType(String eventListenerType) {
         this.eventListenerType = eventListenerType;
     }
-    
+
     public Boolean getEmitterSendItems() {
         return emitterSendItems;
     }
 
     /**
-     * Sets if event produced by emitter should be sent as single items or complete collection
+     * Sets if event produced by emitter should be sent as single items or
+     * complete collection
      */
     public void setEmitterSendItems(Boolean emiterSendItems) {
         this.emitterSendItems = emiterSendItems;
@@ -399,6 +402,11 @@ public class JBPMConfiguration {
 
     @Override
     public String toString() {
-        return "JBPMConfiguration [connectionURL=" + connectionURL + ", operation=" + operation + ", deploymentId=" + deploymentId + ", processInstanceId=" + processInstanceId + ", value=" + value + ", processId=" + processId + ", eventType=" + eventType + ", event=" + event + ", maxNumber=" + maxNumber + ", identifier=" + identifier + ", workItemId=" + workItemId + ", taskId=" + taskId + ", userId=" + userId + ", page=" + page + ", pageSize=" + pageSize + ", targetUserId=" + targetUserI [...]
+        return "JBPMConfiguration [connectionURL=" + connectionURL + ", operation=" + operation + ", deploymentId=" + deploymentId + ", processInstanceId=" + processInstanceId
+               + ", value=" + value + ", processId=" + processId + ", eventType=" + eventType + ", event=" + event + ", maxNumber=" + maxNumber + ", identifier=" + identifier
+               + ", workItemId=" + workItemId + ", taskId=" + taskId + ", userId=" + userId + ", page=" + page + ", pageSize=" + pageSize + ", targetUserId=" + targetUserId
+               + ", attachmentId=" + attachmentId + ", contentId=" + contentId + ", task=" + task + ", entities=" + entities + ", statuses=" + statuses + ", userName=" + userName
+               + ", password=" + password + ", timeout=" + timeout + ", parameters=" + parameters + ", extraJaxbClasses=" + Arrays.toString(extraJaxbClasses)
+               + ", eventListenerType=" + eventListenerType + "]";
     }
 }
diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMEndpoint.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMEndpoint.java
index 4796336..b6060e8 100644
--- a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMEndpoint.java
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMEndpoint.java
@@ -35,7 +35,8 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * The jbpm component provides integration with jBPM (Business Process Management).
+ * The jbpm component provides integration with jBPM (Business Process
+ * Management).
  */
 @UriEndpoint(firstVersion = "2.6.0", scheme = "jbpm", title = "JBPM", syntax = "jbpm:connectionURL", label = "process")
 public class JBPMEndpoint extends DefaultEndpoint {
@@ -50,8 +51,9 @@ public class JBPMEndpoint extends DefaultEndpoint {
     }
 
     public Producer createProducer() throws Exception {
-        KieServicesConfiguration kieConfiguration = KieServicesFactory.newRestConfiguration(configuration.getConnectionURL().toExternalForm(), configuration.getUserName(), configuration.getPassword());
-  
+        KieServicesConfiguration kieConfiguration = KieServicesFactory.newRestConfiguration(configuration.getConnectionURL().toExternalForm(), configuration.getUserName(),
+                                                                                            configuration.getPassword());
+
         if (configuration.getTimeout() != null) {
             kieConfiguration.setTimeout(configuration.getTimeout());
         }
@@ -59,8 +61,8 @@ public class JBPMEndpoint extends DefaultEndpoint {
             List<Class<?>> classes = Arrays.asList(configuration.getExtraJaxbClasses());
             kieConfiguration.addExtraClasses(new LinkedHashSet<>(classes));
         }
-        
-        KieServicesClient kieServerClient = KieServicesFactory.newKieServicesClient(kieConfiguration);        
+
+        KieServicesClient kieServerClient = KieServicesFactory.newKieServicesClient(kieConfiguration);
         LOGGER.debug("JBPM Producer created with KieServerClient configured for {}", configuration.getConnectionURL());
         return new JBPMProducer(this, kieServerClient);
     }
diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMProducer.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMProducer.java
index 86571c9..d40c226 100644
--- a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMProducer.java
+++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMProducer.java
@@ -49,15 +49,14 @@ public class JBPMProducer extends DefaultProducer {
     private static final transient Logger LOGGER = LoggerFactory.getLogger(JBPMProducer.class);
 
     private static KieCommands commandsFactory = KieServices.get().getCommands();
-    
+
     private JBPMConfiguration configuration;
     private KieServicesClient kieServicesClient;
-    
 
     public JBPMProducer(JBPMEndpoint endpoint, KieServicesClient kieServicesClient) {
         super(endpoint);
         this.configuration = endpoint.getConfiguration();
-        this.kieServicesClient = kieServicesClient;        
+        this.kieServicesClient = kieServicesClient;
     }
 
     @Override
@@ -69,7 +68,7 @@ public class JBPMProducer extends DefaultProducer {
 
     @Override
     protected void doStop() throws Exception {
-        super.doStop();        
+        super.doStop();
     }
 
     public void process(Exchange exchange) throws Exception {
@@ -90,7 +89,7 @@ public class JBPMProducer extends DefaultProducer {
 
     enum Operation {
 
-        //PROCESS OPERATIONS
+        // PROCESS OPERATIONS
         startProcess {
             @Override
             void execute(KieServicesClient kieServicesClient, JBPMConfiguration configuration, Exchange exchange) {
@@ -98,31 +97,36 @@ public class JBPMProducer extends DefaultProducer {
                 Long processInstance = processClient.startProcess(configuration.getDeploymentId(), getProcessId(configuration, exchange), getParameters(configuration, exchange));
                 setResult(exchange, processInstance);
             }
-        }, abortProcessInstance {
+        },
+        abortProcessInstance {
             @Override
             void execute(KieServicesClient kieServicesClient, JBPMConfiguration configuration, Exchange exchange) {
                 ProcessServicesClient processClient = kieServicesClient.getServicesClient(ProcessServicesClient.class);
                 processClient.abortProcessInstance(configuration.getDeploymentId(), safe(getProcessInstanceId(configuration, exchange)));
             }
-        }, signalEvent {
+        },
+        signalEvent {
             @Override
             void execute(KieServicesClient kieServicesClient, JBPMConfiguration configuration, Exchange exchange) {
                 ProcessServicesClient processClient = kieServicesClient.getServicesClient(ProcessServicesClient.class);
                 Long processInstanceId = getProcessInstanceId(configuration, exchange);
                 if (processInstanceId != null) {
-                    processClient.signalProcessInstance(configuration.getDeploymentId(), processInstanceId, getEventType(configuration, exchange), getEvent(configuration, exchange));
+                    processClient.signalProcessInstance(configuration.getDeploymentId(), processInstanceId, getEventType(configuration, exchange),
+                                                        getEvent(configuration, exchange));
                 } else {
                     processClient.signal(configuration.getDeploymentId(), getEventType(configuration, exchange), getEvent(configuration, exchange));
                 }
             }
-        }, getProcessInstance {
+        },
+        getProcessInstance {
             @Override
             void execute(KieServicesClient kieServicesClient, JBPMConfiguration configuration, Exchange exchange) {
                 ProcessServicesClient processClient = kieServicesClient.getServicesClient(ProcessServicesClient.class);
                 ProcessInstance processInstance = processClient.getProcessInstance(configuration.getDeploymentId(), safe(getProcessInstanceId(configuration, exchange)));
                 setResult(exchange, processInstance);
             }
-        }, getProcessInstances {
+        },
+        getProcessInstances {
             @Override
             void execute(KieServicesClient kieServicesClient, JBPMConfiguration configuration, Exchange exchange) {
                 QueryServicesClient queryClient = kieServicesClient.getServicesClient(QueryServicesClient.class);
@@ -131,24 +135,25 @@ public class JBPMProducer extends DefaultProducer {
             }
         },
 
-        //RULE OPERATIONS
+        // RULE OPERATIONS
         fireAllRules {
             @Override
             void execute(KieServicesClient kieServicesClient, JBPMConfiguration configuration, Exchange exchange) {
                 RuleServicesClient ruleClient = kieServicesClient.getServicesClient(RuleServicesClient.class);
                 List<Command<?>> commands = new ArrayList<Command<?>>();
                 BatchExecutionCommand executionCommand = commandsFactory.newBatchExecution(commands);
-                
+
                 Integer max = getMaxNumber(configuration, exchange);
                 if (max != null) {
                     commands.add(commandsFactory.newFireAllRules(max));
                 } else {
                     commands.add(commandsFactory.newFireAllRules());
                 }
-                ServiceResponse<ExecutionResults> reply = ruleClient.executeCommandsWithResults(configuration.getDeploymentId(), executionCommand);                
+                ServiceResponse<ExecutionResults> reply = ruleClient.executeCommandsWithResults(configuration.getDeploymentId(), executionCommand);
                 setResult(exchange, reply.getResult());
             }
-        }, getGlobal {
+        },
+        getGlobal {
             @Override
             void execute(KieServicesClient kieServicesClient, JBPMConfiguration configuration, Exchange exchange) {
                 RuleServicesClient ruleClient = kieServicesClient.getServicesClient(RuleServicesClient.class);
@@ -157,10 +162,11 @@ public class JBPMProducer extends DefaultProducer {
                 String identifier = getIdentifier(configuration, exchange);
                 commands.add(commandsFactory.newGetGlobal(identifier, identifier));
 
-                ServiceResponse<ExecutionResults> reply = ruleClient.executeCommandsWithResults(configuration.getDeploymentId(), executionCommand);  
+                ServiceResponse<ExecutionResults> reply = ruleClient.executeCommandsWithResults(configuration.getDeploymentId(), executionCommand);
                 setResult(exchange, reply.getResult().getValue(identifier));
             }
-        }, setGlobal {
+        },
+        setGlobal {
             @Override
             void execute(KieServicesClient kieServicesClient, JBPMConfiguration configuration, Exchange exchange) {
                 RuleServicesClient ruleClient = kieServicesClient.getServicesClient(RuleServicesClient.class);
@@ -169,165 +175,196 @@ public class JBPMProducer extends DefaultProducer {
 
                 commands.add(commandsFactory.newSetGlobal(getIdentifier(configuration, exchange), getValue(configuration, exchange)));
 
-                ruleClient.executeCommandsWithResults(configuration.getDeploymentId(), executionCommand);                
+                ruleClient.executeCommandsWithResults(configuration.getDeploymentId(), executionCommand);
             }
         },
 
-        //WORK ITEM OPERATIONS
+        // WORK ITEM OPERATIONS
         abortWorkItem {
             @Override
             void execute(KieServicesClient kieServicesClient, JBPMConfiguration configuration, Exchange exchange) {
                 ProcessServicesClient processClient = kieServicesClient.getServicesClient(ProcessServicesClient.class);
                 processClient.abortWorkItem(configuration.getDeploymentId(), safe(getProcessInstanceId(configuration, exchange)), safe(getWorkItemId(configuration, exchange)));
             }
-        }, completeWorkItem {
+        },
+        completeWorkItem {
             @Override
             void execute(KieServicesClient kieServicesClient, JBPMConfiguration configuration, Exchange exchange) {
                 ProcessServicesClient processClient = kieServicesClient.getServicesClient(ProcessServicesClient.class);
-                processClient.completeWorkItem(configuration.getDeploymentId(), safe(getProcessInstanceId(configuration, exchange)), safe(getWorkItemId(configuration, exchange)), getParameters(configuration, exchange));
+                processClient.completeWorkItem(configuration.getDeploymentId(), safe(getProcessInstanceId(configuration, exchange)), safe(getWorkItemId(configuration, exchange)),
+                                               getParameters(configuration, exchange));
             }
         },
 
-        //TASK OPERATIONS
+        // TASK OPERATIONS
         activateTask {
             @Override
             void execute(KieServicesClient kieServicesClient, JBPMConfiguration configuration, Exchange exchange) {
                 UserTaskServicesClient taskClient = kieServicesClient.getServicesClient(UserTaskServicesClient.class);
                 taskClient.activateTask(configuration.getDeploymentId(), safe(getTaskId(configuration, exchange)), getUserId(configuration, exchange));
             }
-        }, claimTask {
+        },
+        claimTask {
             @Override
             void execute(KieServicesClient kieServicesClient, JBPMConfiguration configuration, Exchange exchange) {
                 UserTaskServicesClient taskClient = kieServicesClient.getServicesClient(UserTaskServicesClient.class);
                 taskClient.claimTask(configuration.getDeploymentId(), safe(getTaskId(configuration, exchange)), getUserId(configuration, exchange));
             }
-        }, completeTask {
+        },
+        completeTask {
             @Override
             void execute(KieServicesClient kieServicesClient, JBPMConfiguration configuration, Exchange exchange) {
                 UserTaskServicesClient taskClient = kieServicesClient.getServicesClient(UserTaskServicesClient.class);
-                taskClient.completeAutoProgress(configuration.getDeploymentId(), safe(getTaskId(configuration, exchange)), getUserId(configuration, exchange), getParameters(configuration, exchange));
+                taskClient.completeAutoProgress(configuration.getDeploymentId(), safe(getTaskId(configuration, exchange)), getUserId(configuration, exchange),
+                                                getParameters(configuration, exchange));
             }
-        }, delegateTask {
+        },
+        delegateTask {
             @Override
             void execute(KieServicesClient kieServicesClient, JBPMConfiguration configuration, Exchange exchange) {
                 UserTaskServicesClient taskClient = kieServicesClient.getServicesClient(UserTaskServicesClient.class);
-                taskClient.delegateTask(configuration.getDeploymentId(), safe(getTaskId(configuration, exchange)), getUserId(configuration, exchange), getTargetUserId(configuration, exchange));
+                taskClient.delegateTask(configuration.getDeploymentId(), safe(getTaskId(configuration, exchange)), getUserId(configuration, exchange),
+                                        getTargetUserId(configuration, exchange));
             }
-        }, exitTask {
+        },
+        exitTask {
             @Override
             void execute(KieServicesClient kieServicesClient, JBPMConfiguration configuration, Exchange exchange) {
                 UserTaskServicesClient taskClient = kieServicesClient.getServicesClient(UserTaskServicesClient.class);
                 taskClient.exitTask(configuration.getDeploymentId(), safe(getTaskId(configuration, exchange)), getUserId(configuration, exchange));
             }
-        }, failTask {
+        },
+        failTask {
             @Override
             void execute(KieServicesClient kieServicesClient, JBPMConfiguration configuration, Exchange exchange) {
                 UserTaskServicesClient taskClient = kieServicesClient.getServicesClient(UserTaskServicesClient.class);
-                taskClient.failTask(configuration.getDeploymentId(), safe(getTaskId(configuration, exchange)), getUserId(configuration, exchange), getParameters(configuration, exchange));
+                taskClient.failTask(configuration.getDeploymentId(), safe(getTaskId(configuration, exchange)), getUserId(configuration, exchange),
+                                    getParameters(configuration, exchange));
             }
-        }, getAttachment {
+        },
+        getAttachment {
             @Override
             void execute(KieServicesClient kieServicesClient, JBPMConfiguration configuration, Exchange exchange) {
                 UserTaskServicesClient taskClient = kieServicesClient.getServicesClient(UserTaskServicesClient.class);
-                TaskAttachment attachment = taskClient.getTaskAttachmentById(configuration.getDeploymentId(), safe(getTaskId(configuration, exchange)), safe(getAttachmentId(configuration, exchange)));
+                TaskAttachment attachment = taskClient.getTaskAttachmentById(configuration.getDeploymentId(), safe(getTaskId(configuration, exchange)),
+                                                                             safe(getAttachmentId(configuration, exchange)));
                 setResult(exchange, attachment);
             }
-        }, getTasksAssignedAsBusinessAdministrator {
+        },
+        getTasksAssignedAsBusinessAdministrator {
             @Override
             void execute(KieServicesClient kieServicesClient, JBPMConfiguration configuration, Exchange exchange) {
                 UserTaskServicesClient taskClient = kieServicesClient.getServicesClient(UserTaskServicesClient.class);
-                List<TaskSummary> taskSummaries = taskClient.findTasksAssignedAsBusinessAdministrator(getUserId(configuration, exchange), getPage(configuration, exchange), getPageSize(configuration, exchange));
+                List<TaskSummary> taskSummaries = taskClient.findTasksAssignedAsBusinessAdministrator(getUserId(configuration, exchange), getPage(configuration, exchange),
+                                                                                                      getPageSize(configuration, exchange));
                 setResult(exchange, taskSummaries);
             }
-        }, getTasksAssignedAsPotentialOwnerByStatus {
+        },
+        getTasksAssignedAsPotentialOwnerByStatus {
             @Override
             void execute(KieServicesClient kieServicesClient, JBPMConfiguration configuration, Exchange exchange) {
                 UserTaskServicesClient taskClient = kieServicesClient.getServicesClient(UserTaskServicesClient.class);
-                List<TaskSummary> taskSummaries = taskClient.findTasksAssignedAsPotentialOwner(getUserId(configuration, exchange), getStatuses(configuration, exchange), getPage(configuration, exchange), getPageSize(configuration, exchange));
+                List<TaskSummary> taskSummaries = taskClient.findTasksAssignedAsPotentialOwner(getUserId(configuration, exchange), getStatuses(configuration, exchange),
+                                                                                               getPage(configuration, exchange), getPageSize(configuration, exchange));
                 setResult(exchange, taskSummaries);
             }
-        }, getTaskByWorkItem {
+        },
+        getTaskByWorkItem {
             @Override
             void execute(KieServicesClient kieServicesClient, JBPMConfiguration configuration, Exchange exchange) {
                 UserTaskServicesClient taskClient = kieServicesClient.getServicesClient(UserTaskServicesClient.class);
                 TaskInstance task = taskClient.findTaskByWorkItemId(safe(getWorkItemId(configuration, exchange)));
                 setResult(exchange, task);
             }
-        }, getTaskBy {
+        },
+        getTaskBy {
             @Override
             void execute(KieServicesClient kieServicesClient, JBPMConfiguration configuration, Exchange exchange) {
                 UserTaskServicesClient taskClient = kieServicesClient.getServicesClient(UserTaskServicesClient.class);
                 TaskInstance task = taskClient.findTaskById(safe(getTaskId(configuration, exchange)));
                 setResult(exchange, task);
             }
-        }, getTaskContent {
+        },
+        getTaskContent {
             @Override
             void execute(KieServicesClient kieServicesClient, JBPMConfiguration configuration, Exchange exchange) {
                 UserTaskServicesClient taskClient = kieServicesClient.getServicesClient(UserTaskServicesClient.class);
                 Map<String, Object> content = taskClient.getTaskOutputContentByTaskId(configuration.getDeploymentId(), safe(getTaskId(configuration, exchange)));
                 setResult(exchange, content);
             }
-        }, getTasksByProcessInstance {
+        },
+        getTasksByProcessInstance {
             @Override
             void execute(KieServicesClient kieServicesClient, JBPMConfiguration configuration, Exchange exchange) {
                 UserTaskServicesClient taskClient = kieServicesClient.getServicesClient(UserTaskServicesClient.class);
                 List<TaskSummary> processInstanceIds = taskClient.findTasksByStatusByProcessInstanceId(safe(getProcessInstanceId(configuration, exchange)), Collections.emptyList(),
-                        getPage(configuration, exchange), getPageSize(configuration, exchange));
+                                                                                                       getPage(configuration, exchange), getPageSize(configuration, exchange));
                 setResult(exchange, processInstanceIds);
             }
-        }, getTasksByStatusByProcessInstance {
+        },
+        getTasksByStatusByProcessInstance {
             @Override
             void execute(KieServicesClient kieServicesClient, JBPMConfiguration configuration, Exchange exchange) {
                 UserTaskServicesClient taskClient = kieServicesClient.getServicesClient(UserTaskServicesClient.class);
-                List<TaskSummary> taskSummaryList = taskClient.findTasksByStatusByProcessInstanceId(
-                        safe(getProcessInstanceId(configuration, exchange)), getStatuses(configuration, exchange),
-                        getPage(configuration, exchange), getPageSize(configuration, exchange));
+                List<TaskSummary> taskSummaryList = taskClient.findTasksByStatusByProcessInstanceId(safe(getProcessInstanceId(configuration, exchange)),
+                                                                                                    getStatuses(configuration, exchange), getPage(configuration, exchange),
+                                                                                                    getPageSize(configuration, exchange));
                 setResult(exchange, taskSummaryList);
             }
-        }, getTasksOwned {
+        },
+        getTasksOwned {
             @Override
             void execute(KieServicesClient kieServicesClient, JBPMConfiguration configuration, Exchange exchange) {
                 UserTaskServicesClient taskClient = kieServicesClient.getServicesClient(UserTaskServicesClient.class);
-                List<TaskSummary> summaryList = taskClient.findTasksOwned(getUserId(configuration, exchange), getPage(configuration, exchange), getPageSize(configuration, exchange));
+                List<TaskSummary> summaryList = taskClient.findTasksOwned(getUserId(configuration, exchange), getPage(configuration, exchange),
+                                                                          getPageSize(configuration, exchange));
                 setResult(exchange, summaryList);
             }
-        }, nominateTask {
+        },
+        nominateTask {
             @Override
             void execute(KieServicesClient kieServicesClient, JBPMConfiguration configuration, Exchange exchange) {
                 UserTaskServicesClient taskClient = kieServicesClient.getServicesClient(UserTaskServicesClient.class);
-                taskClient.nominateTask(configuration.getDeploymentId(), safe(getTaskId(configuration, exchange)), getUserId(configuration, exchange), getEntities(configuration, exchange));
+                taskClient.nominateTask(configuration.getDeploymentId(), safe(getTaskId(configuration, exchange)), getUserId(configuration, exchange),
+                                        getEntities(configuration, exchange));
             }
-        }, releaseTask {
+        },
+        releaseTask {
             @Override
             void execute(KieServicesClient kieServicesClient, JBPMConfiguration configuration, Exchange exchange) {
                 UserTaskServicesClient taskClient = kieServicesClient.getServicesClient(UserTaskServicesClient.class);
                 taskClient.releaseTask(configuration.getDeploymentId(), safe(getTaskId(configuration, exchange)), getUserId(configuration, exchange));
             }
-        }, resumeTask {
+        },
+        resumeTask {
             @Override
             void execute(KieServicesClient kieServicesClient, JBPMConfiguration configuration, Exchange exchange) {
                 UserTaskServicesClient taskClient = kieServicesClient.getServicesClient(UserTaskServicesClient.class);
                 taskClient.resumeTask(configuration.getDeploymentId(), safe(getTaskId(configuration, exchange)), getUserId(configuration, exchange));
             }
-        }, skipTask {
+        },
+        skipTask {
             @Override
             void execute(KieServicesClient kieServicesClient, JBPMConfiguration configuration, Exchange exchange) {
                 UserTaskServicesClient taskClient = kieServicesClient.getServicesClient(UserTaskServicesClient.class);
                 taskClient.skipTask(configuration.getDeploymentId(), safe(getTaskId(configuration, exchange)), getUserId(configuration, exchange));
             }
-        }, startTask {
+        },
+        startTask {
             @Override
             void execute(KieServicesClient kieServicesClient, JBPMConfiguration configuration, Exchange exchange) {
                 UserTaskServicesClient taskClient = kieServicesClient.getServicesClient(UserTaskServicesClient.class);
                 taskClient.startTask(configuration.getDeploymentId(), safe(getTaskId(configuration, exchange)), getUserId(configuration, exchange));
             }
-        }, stopTask {
+        },
+        stopTask {
             @Override
             void execute(KieServicesClient kieServicesClient, JBPMConfiguration configuration, Exchange exchange) {
                 UserTaskServicesClient taskClient = kieServicesClient.getServicesClient(UserTaskServicesClient.class);
                 taskClient.stopTask(configuration.getDeploymentId(), safe(getTaskId(configuration, exchange)), getUserId(configuration, exchange));
             }
-        }, suspendTask {
+        },
+        suspendTask {
             @Override
             void execute(KieServicesClient kieServicesClient, JBPMConfiguration configuration, Exchange exchange) {
                 UserTaskServicesClient taskClient = kieServicesClient.getServicesClient(UserTaskServicesClient.class);
@@ -382,7 +419,7 @@ public class JBPMProducer extends DefaultProducer {
             }
             return page;
         }
-        
+
         Integer getPageSize(JBPMConfiguration configuration, Exchange exchange) {
             Integer pageSize = exchange.getIn().getHeader(JBPMConstants.RESULT_PAGE_SIZE, Integer.class);
             if (pageSize == null) {
@@ -502,4 +539,3 @@ public class JBPMProducer extends DefaultProducer {
         abstract void execute(KieServicesClient kieServicesClient, JBPMConfiguration configuration, Exchange exchange);
     }
 }
-
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 3a8a0ea..fbc4448 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
@@ -36,29 +36,28 @@ import org.kie.server.services.impl.KieServerImpl;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
 public class CamelKieServerExtension implements KieServerExtension {
     public static final String EXTENSION_NAME = "Camel";
 
-    private static final Logger logger = LoggerFactory.getLogger(CamelKieServerExtension.class);
+    private static final Logger LOGGER = LoggerFactory.getLogger(CamelKieServerExtension.class);
 
-    private static final Boolean disabled = Boolean.parseBoolean(System.getProperty("org.camel.server.ext.disabled", "false"));
+    private static final Boolean DISABLED = Boolean.parseBoolean(System.getProperty("org.camel.server.ext.disabled", "false"));
 
     protected DefaultCamelContext camel;
-    
+
     protected boolean managedCamel;
 
     protected Map<String, DefaultCamelContext> camelContexts = new HashMap<>();
-    
+
     public CamelKieServerExtension() {
         this.managedCamel = true;
     }
-    
+
     public CamelKieServerExtension(DefaultCamelContext camel) {
         this.camel = camel;
         this.managedCamel = false;
     }
-    
+
     @Override
     public boolean isInitialized() {
         return camel != null;
@@ -66,7 +65,7 @@ public class CamelKieServerExtension implements KieServerExtension {
 
     @Override
     public boolean isActive() {
-        return disabled == false;
+        return !DISABLED;
     }
 
     @Override
@@ -74,55 +73,55 @@ public class CamelKieServerExtension implements KieServerExtension {
         if (this.managedCamel && this.camel == null) {
             this.camel = new DefaultCamelContext();
             this.camel.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 = camel.loadRoutesDefinition(is);
+                    camel.addRouteDefinitions(routes.getRoutes());
                 }
             } catch (Exception e) {
-                logger.error("Error while adding Camel context for KIE Server", e);
+                LOGGER.error("Error while adding Camel context for KIE Server", e);
             }
         }
-        
+
         ServiceRegistry.get().register("GlobalCamelService", this.camel);
     }
 
     @Override
     public void destroy(KieServerImpl kieServer, KieServerRegistry registry) {
         ServiceRegistry.get().remove("GlobalCamelService");
-        
+
         if (this.managedCamel && this.camel != null) {
             try {
                 this.camel.stop();
             } catch (Exception e) {
-                logger.error("Failed at stopping KIE Server extension {}", EXTENSION_NAME);
+                LOGGER.error("Failed at stopping KIE Server extension {}", EXTENSION_NAME);
             }
         }
     }
 
     @Override
     public void createContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters) {
-        
+
         ClassLoader classloader = kieContainerInstance.getKieContainer().getClassLoader();
         try (InputStream is = classloader.getResourceAsStream("camel-routes.xml")) {
             if (is != null) {
-                
+
                 DefaultCamelContext context = new DefaultCamelContext();
-                context.setName("KIE Server Camel context for container " + kieContainerInstance.getContainerId());                            
-                
-                RoutesDefinition routes = context.loadRoutesDefinition(is);              
+                context.setName("KIE Server Camel context for container " + kieContainerInstance.getContainerId());
+
+                RoutesDefinition routes = context.loadRoutesDefinition(is);
                 annotateKJarRoutes(routes, id);
                 context.addRouteDefinitions(routes.getRoutes());
                 context.start();
                 camelContexts.put(id, context);
-                
+
                 ServiceRegistry.get().register(id + "_CamelService", this.camel);
-              
+
             }
         } catch (Exception e) {
-            logger.error("Error while adding Camel context for {}", kieContainerInstance.getContainerId(), e);
+            LOGGER.error("Error while adding Camel context for {}", kieContainerInstance.getContainerId(), e);
         }
     }
 
@@ -140,14 +139,14 @@ public class CamelKieServerExtension implements KieServerExtension {
     @Override
     public void disposeContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters) {
         DefaultCamelContext context = camelContexts.get(id);
-        
+
         if (context != null) {
-            
+
             ServiceRegistry.get().remove(id + "_CamelService");
             try {
                 context.stop();
             } catch (Exception e) {
-                logger.error("Error while removing Camel context for container {}", id, e);
+                LOGGER.error("Error while removing Camel context for container {}", id, e);
             }
         }
     }
@@ -181,18 +180,18 @@ public class CamelKieServerExtension implements KieServerExtension {
     public Integer getStartOrder() {
         return 50;
     }
-    
+
     @Override
     public void serverStarted() {
         if (this.managedCamel && this.camel != null && !this.camel.isStarted()) {
             try {
                 this.camel.start();
             } catch (Exception e) {
-                logger.error("Failed at start Camel context", e);
+                LOGGER.error("Failed at start Camel context", e);
             }
         }
     }
-    
+
     @Override
     public String toString() {
         return EXTENSION_NAME + " KIE Server extension";
@@ -200,12 +199,12 @@ public class CamelKieServerExtension implements KieServerExtension {
 
     protected void annotateKJarRoutes(RoutesDefinition routes, String deploymentId) {
         for (RouteDefinition route : routes.getRoutes()) {
-            
+
             for (FromDefinition from : route.getInputs()) {
-                
+
                 if (from.getUri().startsWith("jbpm:events") && !from.getUri().contains("deploymentId")) {
                     StringBuilder uri = new StringBuilder(from.getUri());
-                    
+
                     String[] split = from.getUri().split("\\?");
                     if (split.length == 1) {
                         // no query given
@@ -217,7 +216,7 @@ public class CamelKieServerExtension implements KieServerExtension {
                     uri.append("deploymentId=").append(deploymentId);
                     from.setUri(uri.toString());
                 }
-                
+
                 System.out.println(from.getUri());
             }
         }
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 18e1055..fbab216 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
@@ -29,11 +29,10 @@ import org.junit.Test;
 import org.kie.server.api.model.instance.TaskSummary;
 
 /**
- * To run this example you need jBPM to run locally, easiest is to use single zip
- * distribution - download from jbpm.org
- *
- * Next, start it and import Evaluation sample project, build and deploy.
- * Once done this test can be ran out of the box.
+ * To run this example you need jBPM to run locally, easiest is to use single
+ * zip distribution - download from jbpm.org Next, start it and import
+ * Evaluation sample project, build and deploy. Once done this test can be ran
+ * out of the box.
  */
 @Ignore("This is an integration test that needs jBPM running on the local machine")
 public class JBPMComponentIntegrationTest extends CamelTestSupport {
@@ -42,46 +41,46 @@ public class JBPMComponentIntegrationTest extends CamelTestSupport {
     @Test
     public void interactsOverRest() throws Exception {
         getMockEndpoint("mock:result").expectedMessageCount(1);
-        
+
         // let's start process instance for evaluation process
         Map<String, Object> params = new HashMap<>();
         params.put("employee", "wbadmin");
         params.put("reason", "Camel asks for it");
-        
+
         Map<String, Object> headers = new HashMap<>();
         headers.put(JBPMConstants.PROCESS_ID, "evaluation");
         headers.put(JBPMConstants.PARAMETERS, params);
-        
+
         template.sendBodyAndHeaders("direct:start", null, headers);
         assertMockEndpointsSatisfied();
-        Long processInstanceId = (Long) getMockEndpoint("mock:result").getExchanges().get(0).getIn().getBody();
+        Long processInstanceId = (Long)getMockEndpoint("mock:result").getExchanges().get(0).getIn().getBody();
         assertNotNull(processInstanceId);
-        
+
         // now let's collect user tasks
-        headers = new HashMap<>();        
+        headers = new HashMap<>();
         headers.put(JBPMConstants.OPERATION, JBPMConstants.OPERATION + Operation.getTasksOwned);
-        
+
         template.sendBodyAndHeaders("direct:start", null, headers);
         getMockEndpoint("mock:result").expectedMessageCount(2);
         assertMockEndpointsSatisfied();
-        
-        List<TaskSummary> tasks = (List<TaskSummary>) getMockEndpoint("mock:result").getExchanges().get(1).getIn().getBody();
+
+        List<TaskSummary> tasks = (List<TaskSummary>)getMockEndpoint("mock:result").getExchanges().get(1).getIn().getBody();
         assertEquals(1, tasks.size());
-        
+
         // let's complete first user task
         headers = new HashMap<>();
         headers.put(JBPMConstants.TASK_ID, tasks.get(0).getId());
         headers.put(JBPMConstants.OPERATION, JBPMConstants.OPERATION + Operation.completeTask);
-        
+
         template.sendBodyAndHeaders("direct:start", null, headers);
         getMockEndpoint("mock:result").expectedMessageCount(3);
         assertMockEndpointsSatisfied();
-        
+
         // lastly let's abort process instance we just created
         headers = new HashMap<>();
         headers.put(JBPMConstants.PROCESS_INSTANCE_ID, processInstanceId);
         headers.put(JBPMConstants.OPERATION, JBPMConstants.OPERATION + Operation.abortProcessInstance);
-        
+
         template.sendBodyAndHeaders("direct:start", null, headers);
         getMockEndpoint("mock:result").expectedMessageCount(4);
         assertMockEndpointsSatisfied();
@@ -92,10 +91,8 @@ public class JBPMComponentIntegrationTest extends CamelTestSupport {
         return new RouteBuilder() {
             @Override
             public void configure() {
-                from("direct:start")
-                        .to("jbpm:http://localhost:8080/kie-server/services/rest/server?userName=wbadmin&password=wbadmin"
-                            + "&deploymentId=evaluation")
-                        .to("mock:result");
+                from("direct:start").to("jbpm:http://localhost:8080/kie-server/services/rest/server?userName=wbadmin&password=wbadmin" + "&deploymentId=evaluation")
+                    .to("mock:result");
             }
         };
     }

Reply | Threaded
Open this post in threaded view
|

[camel] 05/08: Camel-Schematron: 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 7774b0900c8bf73ea873803112f44bab247bd2b5
Author: Andrea Cosentino <[hidden email]>
AuthorDate: Fri Nov 16 09:33:39 2018 +0100

    Camel-Schematron: Fixed CS
---
 .../camel/component/schematron/SchematronProducer.java     | 14 +++++++-------
 .../camel/component/schematron/SchematronProducerTest.java | 12 +++++-------
 2 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/components/camel-schematron/src/main/java/org/apache/camel/component/schematron/SchematronProducer.java b/components/camel-schematron/src/main/java/org/apache/camel/component/schematron/SchematronProducer.java
index 0b0e977..9e91bab 100644
--- a/components/camel-schematron/src/main/java/org/apache/camel/component/schematron/SchematronProducer.java
+++ b/components/camel-schematron/src/main/java/org/apache/camel/component/schematron/SchematronProducer.java
@@ -16,6 +16,11 @@
  */
 package org.apache.camel.component.schematron;
 
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.transform.Source;
+
 import org.apache.camel.Exchange;
 import org.apache.camel.component.schematron.constant.Constants;
 import org.apache.camel.component.schematron.exception.SchematronValidationException;
@@ -25,10 +30,6 @@ import org.apache.camel.support.DefaultProducer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.xml.transform.Source;
-import java.util.HashMap;
-import java.util.Map;
-
 /**
  * The Schematron producer.
  */
@@ -36,7 +37,6 @@ public class SchematronProducer extends DefaultProducer {
     private Logger logger = LoggerFactory.getLogger(SchematronProducer.class);
     private SchematronEndpoint endpoint;
 
-
     /**
      * @param endpoint the schematron endpoint.
      */
@@ -58,10 +58,10 @@ public class SchematronProducer extends DefaultProducer {
 
         if (payload instanceof Source) {
             logger.debug("Applying schematron validation on payload: {}", payload);
-            report = schematronProcessor.validate((Source) payload);
+            report = schematronProcessor.validate((Source)payload);
         } else if (payload instanceof String) {
             logger.debug("Applying schematron validation on payload: {}", payload);
-            report = schematronProcessor.validate((String) payload);
+            report = schematronProcessor.validate((String)payload);
         } else {
             String stringPayload = exchange.getIn().getBody(String.class);
             logger.debug("Applying schematron validation on payload: {}", stringPayload);
diff --git a/components/camel-schematron/src/test/java/org/apache/camel/component/schematron/SchematronProducerTest.java b/components/camel-schematron/src/test/java/org/apache/camel/component/schematron/SchematronProducerTest.java
index 322fd38..2185401 100644
--- a/components/camel-schematron/src/test/java/org/apache/camel/component/schematron/SchematronProducerTest.java
+++ b/components/camel-schematron/src/test/java/org/apache/camel/component/schematron/SchematronProducerTest.java
@@ -22,8 +22,12 @@ import javax.xml.parsers.SAXParserFactory;
 import javax.xml.transform.Templates;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.sax.SAXSource;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
 
 import net.sf.saxon.TransformerFactoryImpl;
+
 import org.apache.camel.Exchange;
 import org.apache.camel.ExchangePattern;
 import org.apache.camel.component.schematron.constant.Constants;
@@ -31,16 +35,11 @@ import org.apache.camel.component.schematron.processor.ClassPathURIResolver;
 import org.apache.camel.component.schematron.processor.TemplatesFactory;
 import org.apache.camel.support.DefaultExchange;
 import org.apache.camel.test.junit4.CamelTestSupport;
-import org.apache.commons.io.IOUtils;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
 
 /**
  * Schematron Producer Unit Test.
- *
  */
 public class SchematronProducerTest extends CamelTestSupport {
 
@@ -51,8 +50,7 @@ public class SchematronProducerTest extends CamelTestSupport {
         SchematronEndpoint endpoint = new SchematronEndpoint();
         TransformerFactory fac = new TransformerFactoryImpl();
         fac.setURIResolver(new ClassPathURIResolver(Constants.SCHEMATRON_TEMPLATES_ROOT_DIR, endpoint.getUriResolver()));
-        Templates templates = TemplatesFactory.newInstance().getTemplates(ClassLoader.
-                getSystemResourceAsStream("sch/schematron-1.sch"), fac);
+        Templates templates = TemplatesFactory.newInstance().getTemplates(ClassLoader.getSystemResourceAsStream("sch/schematron-1.sch"), fac);
         endpoint.setRules(templates);
         producer = new SchematronProducer(endpoint);
     }

Reply | Threaded
Open this post in threaded view
|

[camel] 06/08: Refactor dopbox tests

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 fbee9c11b80bc071e082291db6a7f0818e77d9d1
Author: Jan <[hidden email]>
AuthorDate: Tue Nov 13 10:28:39 2018 +0100

    Refactor dopbox tests
---
 components/camel-dropbox/pom.xml                   |  32 +++++--
 .../component/dropbox/DropboxConsumerTest.java     |  16 ++--
 .../dropbox/integration/DropboxTestSupport.java    |  66 ++++++++++---
 .../consumer/DropboxConsumerGetSingleTest.java     |  25 ++---
 .../consumer/DropboxConsumerSearchQueryTest.java   |  23 ++---
 .../consumer/DropboxConsumerSearchTest.java        |  56 -----------
 .../producer/DropboxProducerDelTest.java           |  54 ++++-------
 .../producer/DropboxProducerGetFolderTest.java     | 106 ++++++---------------
 .../producer/DropboxProducerGetSingleTest.java     |  61 ++++--------
 .../producer/DropboxProducerMoveTest.java          |  59 ++++--------
 .../producer/DropboxProducerPutSingleFileTest.java |  99 +++++++++++--------
 ...boxProducerPutSingleFileWithRemotePathTest.java |  96 -------------------
 .../DropboxProducerPutWithRemotePathTest.java      |  95 ------------------
 .../producer/DropboxProducerSearchQueryTest.java   |  66 +++++--------
 .../producer/DropboxProducerSearchTest.java        |  92 ------------------
 .../src/test/resources/test-options.properties     |   3 +-
 16 files changed, 268 insertions(+), 681 deletions(-)

diff --git a/components/camel-dropbox/pom.xml b/components/camel-dropbox/pom.xml
index 5553e80..0344d28 100644
--- a/components/camel-dropbox/pom.xml
+++ b/components/camel-dropbox/pom.xml
@@ -97,27 +97,39 @@
     </dependency>
   </dependencies>
 
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <excludes>
+            <exclude>
+              **/integration/**
+            </exclude>
+          </excludes>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
   <profiles>
     <profile>
-      <id>no-integration-test</id>
-      <activation>
-        <activeByDefault>true</activeByDefault>
-      </activation>
+      <id>dropbox-test</id>
       <build>
         <plugins>
           <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-surefire-plugin</artifactId>
-            <configuration>
-              <excludes>
-                <exclude>
-                  **/integration/**
-                </exclude>
-              </excludes>
+            <configuration combine.self="override">
+              <includes>
+                <include>**/*Test.java</include>
+              </includes>
             </configuration>
           </plugin>
         </plugins>
       </build>
+
     </profile>
   </profiles>
 
diff --git a/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/DropboxConsumerTest.java b/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/DropboxConsumerTest.java
index 199d5da..6fee8a6 100644
--- a/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/DropboxConsumerTest.java
+++ b/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/DropboxConsumerTest.java
@@ -21,22 +21,20 @@ import org.apache.camel.Endpoint;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.dropbox.integration.DropboxTestSupport;
 import org.apache.camel.component.dropbox.integration.consumer.DropboxScheduledPollGetConsumer;
+import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Assert;
 import org.junit.Test;
 
-public class DropboxConsumerTest extends DropboxTestSupport {
-
-    public DropboxConsumerTest() throws Exception {
-    }
+public class DropboxConsumerTest extends CamelTestSupport {
 
     @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
+    protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("dropbox://get?accessToken={{accessToken}}&remotePath=/path").to("mock:test1");
+                from("dropbox://get?accessToken=accessToken&remotePath=/path").to("mock:test1");
                 
-                from("dropbox://get?accessToken={{accessToken}}&remotePath=/path with spaces/file").to("mock:test2");
+                from("dropbox://get?accessToken=accessToken&remotePath=/path with spaces/file").to("mock:test2");
             }
         };
     }
@@ -44,7 +42,7 @@ public class DropboxConsumerTest extends DropboxTestSupport {
     @Test
     public void shouldCreateGetConsumer() throws Exception {
         // Given
-        Endpoint dropboxEndpoint1 = context.getEndpoint("dropbox://get?accessToken={{accessToken}}&remotePath=/path");
+        Endpoint dropboxEndpoint1 = context.getEndpoint("dropbox://get?accessToken=accessToken&remotePath=/path");
 
         // When
         Consumer consumer1 = dropboxEndpoint1.createConsumer(null);
@@ -53,7 +51,7 @@ public class DropboxConsumerTest extends DropboxTestSupport {
         Assert.assertTrue(consumer1 instanceof DropboxScheduledPollGetConsumer);
         
         // Given
-        Endpoint dropboxEndpoint2 = context.getEndpoint("dropbox://get?accessToken={{accessToken}}&remotePath=/path with spaces/file");
+        Endpoint dropboxEndpoint2 = context.getEndpoint("dropbox://get?accessToken=accessToken&remotePath=/path with spaces/file");
 
         // When
         Consumer consumer2 = dropboxEndpoint2.createConsumer(null);
diff --git a/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/DropboxTestSupport.java b/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/DropboxTestSupport.java
index 9636142..ef174b7 100644
--- a/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/DropboxTestSupport.java
+++ b/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/DropboxTestSupport.java
@@ -16,36 +16,78 @@
  */
 package org.apache.camel.component.dropbox.integration;
 
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.net.URL;
 import java.util.Properties;
-
+import com.dropbox.core.DbxDownloader;
+import com.dropbox.core.DbxException;
+import com.dropbox.core.DbxRequestConfig;
+import com.dropbox.core.v2.DbxClientV2;
+import com.dropbox.core.v2.files.FileMetadata;
 import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Before;
 
 
 public class DropboxTestSupport extends CamelTestSupport {
 
+
     protected final Properties properties;
+    protected String workdir;
+    protected String token;
+    private DbxClientV2 client;
 
     protected DropboxTestSupport() {
-        URL url = getClass().getResource("/test-options.properties");
-
-        InputStream inStream;
-        try {
-            inStream = url.openStream();
+        properties = new Properties();
+        try (InputStream inStream = getClass().getResourceAsStream("/test-options.properties")) {
+            properties.load(inStream);
         } catch (IOException e) {
             e.printStackTrace();
             throw new IllegalAccessError("test-options.properties could not be found");
         }
 
-        properties = new Properties();
+        workdir = properties.getProperty("workDir");
+        token = properties.getProperty("accessToken");
+
+        DbxRequestConfig config = DbxRequestConfig.newBuilder(properties.getProperty("clientIdentifier")).build();
+        client = new DbxClientV2(config, token);
+
+    }
+
+    @Before
+    public void setUpWorkingFolder() throws DbxException {
+        createDir(workdir);
+    }
+
+    protected void createDir(String name) throws DbxException {
         try {
-            properties.load(inStream);
-        } catch (IOException e) {
-            e.printStackTrace();
-            throw new IllegalAccessError("test-options.properties could not be found");
+            removeDir(name);
+        } finally {
+            client.files().createFolder(name);
+        }
+    }
+
+    protected void removeDir(String name) throws DbxException {
+        client.files().delete(name);
+    }
+
+    protected void createFile(String fileName, String content) throws IOException {
+        try {
+            client.files().uploadBuilder(workdir + "/" + fileName).uploadAndFinish(new ByteArrayInputStream(content.getBytes()));
+        } catch (DbxException e) {
+            log.info("folder is already created");
+        }
+
+    }
+
+    protected String getFileContent(String path) throws DbxException, IOException {
+        ByteArrayOutputStream target = new ByteArrayOutputStream();
+        DbxDownloader<FileMetadata> downloadedFile = client.files().download(path);
+        if (downloadedFile != null) {
+            downloadedFile.download(target);
         }
+        return new String(target.toByteArray());
     }
 
     @Override
diff --git a/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/consumer/DropboxConsumerGetSingleTest.java b/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/consumer/DropboxConsumerGetSingleTest.java
index b9b340c..c923c68 100644
--- a/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/consumer/DropboxConsumerGetSingleTest.java
+++ b/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/consumer/DropboxConsumerGetSingleTest.java
@@ -16,9 +16,6 @@
  */
 package org.apache.camel.component.dropbox.integration.consumer;
 
-import java.util.List;
-
-import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.dropbox.integration.DropboxTestSupport;
 import org.apache.camel.component.dropbox.util.DropboxResultHeader;
@@ -27,29 +24,27 @@ import org.junit.Test;
 
 public class DropboxConsumerGetSingleTest extends DropboxTestSupport {
 
-    public DropboxConsumerGetSingleTest() throws Exception { }
+    public static final String FILE_NAME = "myFile.txt";
 
     @Test
     public void testCamelDropbox() throws Exception {
+        final String content = "Hi camels";
+        createFile(FILE_NAME, content);
 
-        MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedMinimumMessageCount(1);      
-        assertMockEndpointsSatisfied();
+        context.startRoute("consumer");
 
-        List<Exchange> exchanges = mock.getReceivedExchanges();
-        Exchange exchange = exchanges.get(0);
-        Object header =  exchange.getIn().getHeader(DropboxResultHeader.DOWNLOADED_FILE.name());
-        Object body = exchange.getIn().getBody();
-        assertNotNull(header);
-        assertNotNull(body);
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMinimumMessageCount(1);
+        mock.expectedBodiesReceived(content);
+        mock.expectedHeaderReceived(DropboxResultHeader.DOWNLOADED_FILE.name(), String.format("%s/%s", workdir, FILE_NAME));
+        mock.assertIsSatisfied();
     }
 
     @Override
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() {
-                from("dropbox://get?accessToken={{accessToken}}&remotePath=XXX")
-                        .to("file:XXX")
+                from(String.format("dropbox://get?accessToken={{accessToken}}&remotePath=%s/%s", workdir, FILE_NAME)).autoStartup(false).id("consumer")
                         .to("mock:result");
             }
         };
diff --git a/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/consumer/DropboxConsumerSearchQueryTest.java b/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/consumer/DropboxConsumerSearchQueryTest.java
index 253efd1..d343a75 100644
--- a/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/consumer/DropboxConsumerSearchQueryTest.java
+++ b/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/consumer/DropboxConsumerSearchQueryTest.java
@@ -16,9 +16,6 @@
  */
 package org.apache.camel.component.dropbox.integration.consumer;
 
-import java.util.List;
-
-import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.dropbox.integration.DropboxTestSupport;
 import org.apache.camel.component.dropbox.util.DropboxResultHeader;
@@ -27,28 +24,26 @@ import org.junit.Test;
 
 public class DropboxConsumerSearchQueryTest extends DropboxTestSupport {
 
-    public DropboxConsumerSearchQueryTest() throws Exception { }
+    public static final String FILE_NAME = "myTestFile.txt";
 
     @Test
     public void testCamelDropbox() throws Exception {
+        final String content = "Hi camels";
+        createFile(FILE_NAME, content);
 
-        MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedMinimumMessageCount(1);      
-        assertMockEndpointsSatisfied();
+        context.startRoute("consumer");
 
-        List<Exchange> exchanges = mock.getReceivedExchanges();
-        Exchange exchange = exchanges.get(0);
-        Object header =  exchange.getIn().getHeader(DropboxResultHeader.FOUND_FILES.name());
-        Object body = exchange.getIn().getBody();
-        assertNotNull(header);
-        assertNotNull(body);
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMinimumMessageCount(1);
+        mock.message(0).header(DropboxResultHeader.FOUND_FILES.name()).contains(String.format("%s/%s", workdir, FILE_NAME));
+        mock.assertIsSatisfied();
     }
 
     @Override
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() {
-                from("dropbox://search?accessToken={{accessToken}}&remotePath=/XXX&query=XXX")
+                from(String.format("dropbox://search?accessToken={{accessToken}}&remotePath=%s&query=%s", workdir, FILE_NAME)).id("consumer").autoStartup(false)
                         .to("mock:result");
             }
         };
diff --git a/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/consumer/DropboxConsumerSearchTest.java b/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/consumer/DropboxConsumerSearchTest.java
deleted file mode 100644
index b6f3273..0000000
--- a/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/consumer/DropboxConsumerSearchTest.java
+++ /dev/null
@@ -1,56 +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.dropbox.integration.consumer;
-
-import java.util.List;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.dropbox.integration.DropboxTestSupport;
-import org.apache.camel.component.dropbox.util.DropboxResultHeader;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
-
-public class DropboxConsumerSearchTest extends DropboxTestSupport {
-
-    public DropboxConsumerSearchTest() throws Exception { }
-
-    @Test
-    public void testCamelDropbox() throws Exception {
-
-        MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedMinimumMessageCount(1);      
-        assertMockEndpointsSatisfied();
-
-        List<Exchange> exchanges = mock.getReceivedExchanges();
-        Exchange exchange = exchanges.get(0);
-        Object header =  exchange.getIn().getHeader(DropboxResultHeader.FOUND_FILES.name());
-        Object body = exchange.getIn().getBody();
-        assertNotNull(header);
-        assertNotNull(body);
-    }
-
-    @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
-        return new RouteBuilder() {
-            public void configure() {
-                from("dropbox://search?accessToken={{accessToken}}&remotePath=/XXX")
-                        .to("mock:result");
-            }
-        };
-    }
-}
diff --git a/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerDelTest.java b/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerDelTest.java
index 766a22c..1934edb 100644
--- a/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerDelTest.java
+++ b/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerDelTest.java
@@ -16,63 +16,41 @@
  */
 package org.apache.camel.component.dropbox.integration.producer;
 
-import java.util.List;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
+import java.io.IOException;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.dropbox.integration.DropboxTestSupport;
 import org.apache.camel.component.dropbox.util.DropboxConstants;
 import org.apache.camel.component.dropbox.util.DropboxResultHeader;
 import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Before;
 import org.junit.Test;
 
 public class DropboxProducerDelTest extends DropboxTestSupport {
 
-    public DropboxProducerDelTest() throws Exception { }
+    public static final String FILE_NAME = "file.txt";
+
+    @Before
+    public void createFile() throws IOException {
+        createFile(FILE_NAME, "content");
+    }
 
     @Test
     public void testCamelDropbox() throws Exception {
-        template.send("direct:start", new Processor() {
-            @Override
-            public void process(Exchange exchange) throws Exception {
-                exchange.getIn().setHeader("test", "test");
-            }
-        });
-
-
-        MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedMinimumMessageCount(1);      
-        assertMockEndpointsSatisfied();
-
-        List<Exchange> exchanges = mock.getReceivedExchanges();
-        Exchange exchange = exchanges.get(0);
-        Object header =  exchange.getIn().getHeader(DropboxResultHeader.DELETED_PATH.name());
-        Object body = exchange.getIn().getBody();
-        assertNotNull(header);
-        assertNotNull(body);
+        test("direct:start");
     }
 
     @Test
     public void testCamelDropboxWithOptionInHeader() throws Exception {
-        template.send("direct:start2", new Processor() {
-            @Override
-            public void process(Exchange exchange) throws Exception {
-                exchange.getIn().setHeader("test", "test");
-            }
-        });
+        test("direct:start2");
+    }
 
 
+    private void test(String endpointURI) throws InterruptedException {
+        template.sendBody(endpointURI, null);
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedMinimumMessageCount(1);
+        mock.expectedHeaderReceived(DropboxResultHeader.DELETED_PATH.name(), workdir + "/" + FILE_NAME);
         assertMockEndpointsSatisfied();
-
-        List<Exchange> exchanges = mock.getReceivedExchanges();
-        Exchange exchange = exchanges.get(0);
-        Object header =  exchange.getIn().getHeader(DropboxResultHeader.DELETED_PATH.name());
-        Object body = exchange.getIn().getBody();
-        assertNotNull(header);
-        assertNotNull(body);
     }
 
     @Override
@@ -80,11 +58,11 @@ public class DropboxProducerDelTest extends DropboxTestSupport {
         return new RouteBuilder() {
             public void configure() {
                 from("direct:start")
-                        .to("dropbox://del?accessToken={{accessToken}}&remotePath=/XXX")
+                        .to("dropbox://del?accessToken={{accessToken}}&remotePath=" + workdir + "/" + FILE_NAME)
                         .to("mock:result");
 
                 from("direct:start2")
-                    .setHeader(DropboxConstants.HEADER_REMOTE_PATH, constant("/XXX"))
+                        .setHeader(DropboxConstants.HEADER_REMOTE_PATH, constant(workdir + "/" + FILE_NAME))
                     .to("dropbox://del?accessToken={{accessToken}}")
                     .to("mock:result");
             }
diff --git a/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerGetFolderTest.java b/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerGetFolderTest.java
index f39d213..6d8eb82 100644
--- a/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerGetFolderTest.java
+++ b/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerGetFolderTest.java
@@ -16,120 +16,74 @@
  */
 package org.apache.camel.component.dropbox.integration.producer;
 
-import java.util.List;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
+import java.io.IOException;
+import java.util.Map;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.dropbox.integration.DropboxTestSupport;
 import org.apache.camel.component.dropbox.util.DropboxConstants;
 import org.apache.camel.component.dropbox.util.DropboxResultHeader;
 import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Before;
 import org.junit.Test;
 
 public class DropboxProducerGetFolderTest extends DropboxTestSupport {
 
-    public DropboxProducerGetFolderTest() throws Exception { }
+    public static final String FILE_NAME1 = "myFile.txt";
+    public static final String FILE_NAME2 = "myFile2.txt";
+    private static final String CONTENT1 = "content1";
+    private static final String CONTENT2 = "content2";
+
+    @Before
+    public void createFile() throws IOException {
+        createFile(FILE_NAME1, CONTENT1);
+        createFile(FILE_NAME2, CONTENT2);
+    }
 
     @Test
     public void testCamelDropbox() throws Exception {
-        template.send("direct:start", new Processor() {
-            @Override
-            public void process(Exchange exchange) throws Exception {
-                exchange.getIn().setHeader("test", "test");
-            }
-        });
-
-        MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedMinimumMessageCount(1);
-        assertMockEndpointsSatisfied();
-
-        List<Exchange> exchanges = mock.getReceivedExchanges();
-        Exchange exchange = exchanges.get(0);
-        Object header =  exchange.getIn().getHeader(DropboxResultHeader.DOWNLOADED_FILES.name());
-        Object body = exchange.getIn().getBody();
-        assertNotNull(header);
-        assertNotNull(body);
+        test("direct:start");
     }
 
     @Test
     public void testCamelDropboxWithOptionInHeader() throws Exception {
-        template.send("direct:start2", new Processor() {
-            @Override
-            public void process(Exchange exchange) throws Exception {
-                exchange.getIn().setHeader("test", "test");
-            }
-        });
-
-
-        template.send("direct:start3", new Processor() {
-            @Override
-            public void process(Exchange exchange) throws Exception {
-                exchange.getIn().setHeader("test", "test");
-                exchange.getIn().setHeader(DropboxConstants.HEADER_REMOTE_PATH, "/XXX");
-            }
-        });
-
-
-        MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedMinimumMessageCount(2);
-        assertMockEndpointsSatisfied();
-
-        List<Exchange> exchanges = mock.getReceivedExchanges();
-        Exchange exchange = exchanges.get(0);
-        Object header =  exchange.getIn().getHeader(DropboxResultHeader.DOWNLOADED_FILES.name());
-        Object body = exchange.getIn().getBody();
-        assertNotNull(header);
-        assertNotNull(body);
-
-        exchange = exchanges.get(1);
-        header =  exchange.getIn().getHeader(DropboxResultHeader.DOWNLOADED_FILES.name());
-        body = exchange.getIn().getBody();
-        assertNotNull(header);
-        assertNotNull(body);
+        test("direct:start2");
     }
 
 
     @Test
     public void testCamelDropboxHeaderHasPriorityOnParameter() throws Exception {
-        template.send("direct:start4", new Processor() {
-            @Override
-            public void process(Exchange exchange) throws Exception {
-                exchange.getIn().setHeader("test", "test");
-            }
-        });
+        test("direct:start3");
+    }
 
+    private void test(String endpoint) throws InterruptedException {
+        template.sendBody(endpoint, null);
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedMinimumMessageCount(1);
-        assertMockEndpointsSatisfied();
+        mock.message(0).header(DropboxResultHeader.DOWNLOADED_FILES.name()).contains(String.format("%s/%s", workdir, FILE_NAME1));
+        mock.message(0).header(DropboxResultHeader.DOWNLOADED_FILES.name()).contains(String.format("%s/%s", workdir, FILE_NAME2));
+        mock.assertIsSatisfied();
 
-        List<Exchange> exchanges = mock.getReceivedExchanges();
-        Exchange exchange = exchanges.get(0);
-        Object header =  exchange.getIn().getHeader(DropboxResultHeader.DOWNLOADED_FILES.name());
-        Object body = exchange.getIn().getBody();
-        assertNotNull(header);
-        assertNotNull(body);
+        final Map<String, byte[]> items = mock.getExchanges().get(0).getIn().getBody(Map.class);
+        assertEquals(CONTENT1, new String(items.get(String.format("%s/%s", workdir, FILE_NAME1))));
+        assertEquals(CONTENT2, new String(items.get(String.format("%s/%s", workdir, FILE_NAME2))));
     }
 
     @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
+    protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             public void configure() {
                 from("direct:start")
-                        .to("dropbox://get?accessToken={{accessToken}}&remotePath=/XXX")
+                        .to("dropbox://get?accessToken={{accessToken}}&remotePath=" + workdir)
                         .to("mock:result");
 
                 from("direct:start2")
-                    .setHeader(DropboxConstants.HEADER_REMOTE_PATH, constant("/XXX"))
+                        .setHeader(DropboxConstants.HEADER_REMOTE_PATH, constant(workdir))
                     .to("dropbox://get?accessToken={{accessToken}}")
                     .to("mock:result");
 
-                from("direct:start3")
-                    .to("dropbox://get?accessToken={{accessToken}}")
-                    .to("mock:result");
 
-                from("direct:start4")
-                    .setHeader(DropboxConstants.HEADER_REMOTE_PATH, constant("/XXX"))
+                from("direct:start3")
+                        .setHeader(DropboxConstants.HEADER_REMOTE_PATH, constant(workdir))
                     .to("dropbox://get?accessToken={{accessToken}}&remotePath=/aWrongPath")
                     .to("mock:result");
 
diff --git a/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerGetSingleTest.java b/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerGetSingleTest.java
index 27f604b..fd4cbc2 100644
--- a/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerGetSingleTest.java
+++ b/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerGetSingleTest.java
@@ -16,63 +16,42 @@
  */
 package org.apache.camel.component.dropbox.integration.producer;
 
-import java.util.List;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
+import java.io.IOException;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.dropbox.integration.DropboxTestSupport;
 import org.apache.camel.component.dropbox.util.DropboxConstants;
 import org.apache.camel.component.dropbox.util.DropboxResultHeader;
 import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Before;
 import org.junit.Test;
 
 public class DropboxProducerGetSingleTest extends DropboxTestSupport {
 
-    public DropboxProducerGetSingleTest() throws Exception { }
+    public static final String FILE_NAME = "myFile.txt";
+    public static final String CONTENT = "Hi camels";
+
+    @Before
+    public void createFile() throws IOException {
+        createFile(FILE_NAME, CONTENT);
+    }
 
     @Test
     public void testCamelDropbox() throws Exception {
-        template.send("direct:start", new Processor() {
-            @Override
-            public void process(Exchange exchange) throws Exception {
-                exchange.getIn().setHeader("test", "test");
-            }
-        });
-
-
-        MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedMinimumMessageCount(1);      
-        assertMockEndpointsSatisfied();
-
-        List<Exchange> exchanges = mock.getReceivedExchanges();
-        Exchange exchange = exchanges.get(0);
-        Object header =  exchange.getIn().getHeader(DropboxResultHeader.DOWNLOADED_FILE.name());
-        Object body = exchange.getIn().getBody();
-        assertNotNull(header);
-        assertNotNull(body);
+        test("direct:start");
     }
 
     @Test
     public void testCamelDropboxWithOptionInHeader() throws Exception {
-        template.send("direct:start2", new Processor() {
-            @Override
-            public void process(Exchange exchange) throws Exception {
-                exchange.getIn().setHeader("test", "test");
-            }
-        });
-
+        test("direct:start2");
+    }
 
+    private void test(String endpoint) throws InterruptedException {
+        template.sendBody(endpoint, null);
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedMinimumMessageCount(1);
-        assertMockEndpointsSatisfied();
-
-        List<Exchange> exchanges = mock.getReceivedExchanges();
-        Exchange exchange = exchanges.get(0);
-        Object header =  exchange.getIn().getHeader(DropboxResultHeader.DOWNLOADED_FILE.name());
-        Object body = exchange.getIn().getBody();
-        assertNotNull(header);
-        assertNotNull(body);
+        mock.message(0).header(DropboxResultHeader.DOWNLOADED_FILE.name()).contains(String.format("%s/%s", workdir, FILE_NAME));
+        mock.message(0).body(String.class).isEqualTo(CONTENT);
+        mock.assertIsSatisfied();
     }
 
     @Override
@@ -80,14 +59,12 @@ public class DropboxProducerGetSingleTest extends DropboxTestSupport {
         return new RouteBuilder() {
             public void configure() {
                 from("direct:start")
-                        .to("dropbox://get?accessToken={{accessToken}}&remotePath=/XXX")
-                        .to("file:///XXX?fileName=XXX")
+                        .to("dropbox://get?accessToken={{accessToken}}&remotePath=" + workdir + "/" + FILE_NAME)
                         .to("mock:result");
 
                 from("direct:start2")
-                    .setHeader(DropboxConstants.HEADER_REMOTE_PATH, constant("/XXX"))
+                        .setHeader(DropboxConstants.HEADER_REMOTE_PATH, constant(workdir + "/" + FILE_NAME))
                     .to("dropbox://get?accessToken={{accessToken}}")
-                    .to("file:///XXX?fileName=XXX")
                     .to("mock:result");
             }
         };
diff --git a/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerMoveTest.java b/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerMoveTest.java
index f396897..086ab58 100644
--- a/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerMoveTest.java
+++ b/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerMoveTest.java
@@ -16,63 +16,44 @@
  */
 package org.apache.camel.component.dropbox.integration.producer;
 
-import java.util.List;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
+import java.io.IOException;
+import com.dropbox.core.DbxException;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.dropbox.integration.DropboxTestSupport;
 import org.apache.camel.component.dropbox.util.DropboxConstants;
 import org.apache.camel.component.dropbox.util.DropboxResultHeader;
 import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Before;
 import org.junit.Test;
 
 public class DropboxProducerMoveTest extends DropboxTestSupport {
 
-    public DropboxProducerMoveTest() throws Exception { }
+    public static final String COPY_WORKDIR = "/test-workdir";
+    public static final String FILE = "file.txt";
+
+    @Before
+    public void removeDir() throws DbxException, IOException {
+        createDir(COPY_WORKDIR);
+        createFile(FILE, "content");
+    }
 
     @Test
     public void testCamelDropbox() throws Exception {
-        template.send("direct:start", new Processor() {
-            @Override
-            public void process(Exchange exchange) throws Exception {
-                exchange.getIn().setHeader("test", "test");
-            }
-        });
-
-
-        MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedMinimumMessageCount(1);      
-        assertMockEndpointsSatisfied();
-
-        List<Exchange> exchanges = mock.getReceivedExchanges();
-        Exchange exchange = exchanges.get(0);
-        Object header =  exchange.getIn().getHeader(DropboxResultHeader.MOVED_PATH.name());
-        Object body = exchange.getIn().getBody();
-        assertNotNull(header);
-        assertNotNull(body);
+        test("direct:start");
     }
 
     @Test
     public void testCamelDropboxWithOptionInHeader() throws Exception {
-        template.send("direct:start2", new Processor() {
-            @Override
-            public void process(Exchange exchange) throws Exception {
-                exchange.getIn().setHeader("test", "test");
-            }
-        });
+        test("direct:start2");
+    }
 
+    private void test(String endpoint) throws InterruptedException {
+        template.sendBody(endpoint, null);
 
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedMinimumMessageCount(1);
+        mock.expectedHeaderReceived(DropboxResultHeader.MOVED_PATH.name(), workdir + "/" + FILE);
         assertMockEndpointsSatisfied();
-
-        List<Exchange> exchanges = mock.getReceivedExchanges();
-        Exchange exchange = exchanges.get(0);
-        Object header =  exchange.getIn().getHeader(DropboxResultHeader.MOVED_PATH.name());
-        Object body = exchange.getIn().getBody();
-        assertNotNull(header);
-        assertNotNull(body);
     }
 
     @Override
@@ -80,12 +61,12 @@ public class DropboxProducerMoveTest extends DropboxTestSupport {
         return new RouteBuilder() {
             public void configure() {
                 from("direct:start")
-                        .to("dropbox://move?accessToken={{accessToken}}&remotePath=/XXX&newRemotePath=/XXX")
+                        .to(String.format("dropbox://move?accessToken={{accessToken}}&remotePath=%s&newRemotePath=%s", workdir + "/" + FILE, COPY_WORKDIR + "/" + FILE))
                         .to("mock:result");
 
                 from("direct:start2")
-                    .setHeader(DropboxConstants.HEADER_REMOTE_PATH, constant("/XXX"))
-                    .setHeader(DropboxConstants.HEADER_NEW_REMOTE_PATH, constant("/XXX"))
+                        .setHeader(DropboxConstants.HEADER_REMOTE_PATH, constant(workdir + "/" + FILE))
+                        .setHeader(DropboxConstants.HEADER_NEW_REMOTE_PATH, constant(COPY_WORKDIR + "/" + FILE))
                     .to("dropbox://move?accessToken={{accessToken}}")
                     .to("mock:result");
             }
diff --git a/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerPutSingleFileTest.java b/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerPutSingleFileTest.java
index a4acea7..a7ba22d 100644
--- a/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerPutSingleFileTest.java
+++ b/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerPutSingleFileTest.java
@@ -16,64 +16,85 @@
  */
 package org.apache.camel.component.dropbox.integration.producer;
 
-import java.util.List;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.dropbox.integration.DropboxTestSupport;
 import org.apache.camel.component.dropbox.util.DropboxConstants;
+import org.apache.camel.component.dropbox.util.DropboxException;
 import org.apache.camel.component.dropbox.util.DropboxResultHeader;
 import org.apache.camel.component.dropbox.util.DropboxUploadMode;
 import org.apache.camel.component.mock.MockEndpoint;
+import org.hamcrest.core.IsInstanceOf;
+import org.junit.Assert;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.ExpectedException;
 
 public class DropboxProducerPutSingleFileTest extends DropboxTestSupport {
+    public static final String FILENAME = "newFile.txt";
 
-    public DropboxProducerPutSingleFileTest() throws Exception { }
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
 
     @Test
-    public void testCamelDropbox() throws Exception {
-        template.send("direct:start", new Processor() {
-            @Override
-            public void process(Exchange exchange) throws Exception {
-                exchange.getIn().setHeader("test", "test");
-            }
-        });
+    public void testCamelDropboxWithOptionInHeader() throws Exception {
+        final Path file = Files.createTempFile("camel", ".txt");
+        final Map<String, Object> headers = new HashMap<>();
+        headers.put(DropboxConstants.HEADER_LOCAL_PATH, file.toAbsolutePath().toString());
+        headers.put(DropboxConstants.HEADER_UPLOAD_MODE, DropboxUploadMode.add);
+        template.sendBodyAndHeaders("direct:start", null, headers);
 
+        assertFileUploaded();
+    }
 
-        MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedMinimumMessageCount(1);      
-        assertMockEndpointsSatisfied();
+    @Test
+    public void uploadBodyTest() throws Exception {
+        template.sendBodyAndHeader("direct:start", "Helo Camels", DropboxConstants.HEADER_UPLOAD_MODE, DropboxUploadMode.add);
 
-        List<Exchange> exchanges = mock.getReceivedExchanges();
-        Exchange exchange = exchanges.get(0);
-        Object header =  exchange.getIn().getHeader(DropboxResultHeader.UPLOADED_FILE.name());
-        Object body = exchange.getIn().getBody();
-        assertNotNull(header);
-        assertNotNull(body);
+        assertFileUploaded();
     }
 
     @Test
-    public void testCamelDropboxWithOptionInHeader() throws Exception {
-        template.send("direct:start2", new Processor() {
-            @Override
-            public void process(Exchange exchange) throws Exception {
-                exchange.getIn().setHeader("test", "test");
-            }
-        });
+    public void uploadIfExistsAddTest() throws Exception {
+        thrown.expectCause(IsInstanceOf.instanceOf(DropboxException.class));
+        createFile(FILENAME, "content");
+        final Path file = Files.createTempFile("camel", ".txt");
+        final Map<String, Object> headers = new HashMap<>();
+        headers.put(DropboxConstants.HEADER_LOCAL_PATH, file.toAbsolutePath().toString());
+        headers.put(DropboxConstants.HEADER_UPLOAD_MODE, DropboxUploadMode.add);
+        template.sendBodyAndHeaders("direct:start", null, headers);
+    }
+
+    @Test
+    public void uploadIfExistsForceTest() throws Exception {
+        final String newContent = UUID.randomUUID().toString();
+        createFile(FILENAME, "Hi camels");
+        final Path file = Files.createTempFile("camel", ".txt");
+        try (BufferedWriter bw = new BufferedWriter(new FileWriter(file.toFile()))) {
+            bw.write(newContent);
+            bw.flush();
+        }
+        final Map<String, Object> headers = new HashMap<>();
+        headers.put(DropboxConstants.HEADER_LOCAL_PATH, file.toAbsolutePath().toString());
+        headers.put(DropboxConstants.HEADER_UPLOAD_MODE, DropboxUploadMode.force);
+        template.sendBodyAndHeaders("direct:start", null, headers);
 
+        assertFileUploaded();
 
+        Assert.assertEquals(newContent, getFileContent(workdir + "/" + FILENAME));
+    }
+
+    private void assertFileUploaded() throws InterruptedException {
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedMinimumMessageCount(1);
+        mock.expectedHeaderReceived(DropboxResultHeader.UPLOADED_FILE.name(), workdir + "/" + FILENAME);
         assertMockEndpointsSatisfied();
-
-        List<Exchange> exchanges = mock.getReceivedExchanges();
-        Exchange exchange = exchanges.get(0);
-        Object header =  exchange.getIn().getHeader(DropboxResultHeader.UPLOADED_FILE.name());
-        Object body = exchange.getIn().getBody();
-        assertNotNull(header);
-        assertNotNull(body);
     }
 
     @Override
@@ -81,13 +102,7 @@ public class DropboxProducerPutSingleFileTest extends DropboxTestSupport {
         return new RouteBuilder() {
             public void configure() {
                 from("direct:start")
-                        .to("dropbox://put?accessToken={{accessToken}}&uploadMode=add&localPath=/XXX")
-                        .to("mock:result");
-
-                from("direct:start2")
-                    .setHeader(DropboxConstants.HEADER_LOCAL_PATH, constant("/XXX"))
-                    .setHeader(DropboxConstants.HEADER_UPLOAD_MODE, constant(DropboxUploadMode.add))
-                    .to("dropbox://put?accessToken={{accessToken}}")
+                        .to("dropbox://put?accessToken={{accessToken}}&remotePath=" + workdir + "/" + FILENAME)
                     .to("mock:result");
             }
         };
diff --git a/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerPutSingleFileWithRemotePathTest.java b/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerPutSingleFileWithRemotePathTest.java
deleted file mode 100644
index 42bd460..0000000
--- a/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerPutSingleFileWithRemotePathTest.java
+++ /dev/null
@@ -1,96 +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.dropbox.integration.producer;
-
-import java.util.List;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.dropbox.integration.DropboxTestSupport;
-import org.apache.camel.component.dropbox.util.DropboxConstants;
-import org.apache.camel.component.dropbox.util.DropboxResultHeader;
-import org.apache.camel.component.dropbox.util.DropboxUploadMode;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
-
-public class DropboxProducerPutSingleFileWithRemotePathTest extends DropboxTestSupport {
-
-    public DropboxProducerPutSingleFileWithRemotePathTest() throws Exception { }
-
-    @Test
-    public void testCamelDropbox() throws Exception {
-        template.send("direct:start", new Processor() {
-            @Override
-            public void process(Exchange exchange) throws Exception {
-                exchange.getIn().setHeader("test", "test");
-            }
-        });
-
-
-        MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedMinimumMessageCount(1);      
-        assertMockEndpointsSatisfied();
-
-        List<Exchange> exchanges = mock.getReceivedExchanges();
-        Exchange exchange = exchanges.get(0);
-        Object header =  exchange.getIn().getHeader(DropboxResultHeader.UPLOADED_FILE.name());
-        Object body = exchange.getIn().getBody();
-        assertNotNull(header);
-        assertNotNull(body);
-    }
-
-    @Test
-    public void testCamelDropboxWithOptionInHeader() throws Exception {
-        template.send("direct:start2", new Processor() {
-            @Override
-            public void process(Exchange exchange) throws Exception {
-                exchange.getIn().setHeader("test", "test");
-            }
-        });
-
-
-        MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedMinimumMessageCount(1);
-        assertMockEndpointsSatisfied();
-
-        List<Exchange> exchanges = mock.getReceivedExchanges();
-        Exchange exchange = exchanges.get(0);
-        Object header =  exchange.getIn().getHeader(DropboxResultHeader.UPLOADED_FILE.name());
-        Object body = exchange.getIn().getBody();
-        assertNotNull(header);
-        assertNotNull(body);
-    }
-
-    @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
-        return new RouteBuilder() {
-            public void configure() {
-                from("direct:start")
-                        .to("dropbox://put?accessToken={{accessToken}}&uploadMode=add&localPath=/XXX&remotePath=/XXX")
-                        .to("mock:result");
-
-                from("direct:start2")
-                    .setHeader(DropboxConstants.HEADER_UPLOAD_MODE, constant(DropboxUploadMode.add))
-                    .setHeader(DropboxConstants.HEADER_LOCAL_PATH, constant("/tmp/toto.txt"))
-                    .setHeader(DropboxConstants.HEADER_REMOTE_PATH, constant("/test"))
-                    .to("dropbox://put?accessToken={{accessToken}}")
-                    .to("mock:result");
-            }
-        };
-    }
-}
diff --git a/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerPutWithRemotePathTest.java b/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerPutWithRemotePathTest.java
deleted file mode 100644
index 2de352c..0000000
--- a/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerPutWithRemotePathTest.java
+++ /dev/null
@@ -1,95 +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.dropbox.integration.producer;
-
-import java.util.List;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.dropbox.integration.DropboxTestSupport;
-import org.apache.camel.component.dropbox.util.DropboxConstants;
-import org.apache.camel.component.dropbox.util.DropboxResultHeader;
-import org.apache.camel.component.dropbox.util.DropboxUploadMode;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
-
-public class DropboxProducerPutWithRemotePathTest extends DropboxTestSupport {
-
-    public DropboxProducerPutWithRemotePathTest() throws Exception { }
-
-    @Test
-    public void testCamelDropbox() throws Exception {
-        template.send("direct:start", new Processor() {
-            @Override
-            public void process(Exchange exchange) throws Exception {
-                exchange.getIn().setHeader("test", "test");
-            }
-        });
-
-
-        MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedMinimumMessageCount(1);      
-        assertMockEndpointsSatisfied();
-
-        List<Exchange> exchanges = mock.getReceivedExchanges();
-        Exchange exchange = exchanges.get(0);
-        Object header =  exchange.getIn().getHeader(DropboxResultHeader.UPLOADED_FILES.name());
-        Object body = exchange.getIn().getBody();
-        assertNotNull(header);
-        assertNotNull(body);
-    }
-
-    @Test
-    public void testCamelDropboxWithOptionInHeader() throws Exception {
-        template.send("direct:start2", new Processor() {
-            @Override
-            public void process(Exchange exchange) throws Exception {
-                exchange.getIn().setHeader("test", "test");
-            }
-        });
-
-        MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedMinimumMessageCount(1);
-        assertMockEndpointsSatisfied();
-
-        List<Exchange> exchanges = mock.getReceivedExchanges();
-        Exchange exchange = exchanges.get(0);
-        Object header =  exchange.getIn().getHeader(DropboxResultHeader.UPLOADED_FILES.name());
-        Object body = exchange.getIn().getBody();
-        assertNotNull(header);
-        assertNotNull(body);
-    }
-
-    @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
-        return new RouteBuilder() {
-            public void configure() {
-                from("direct:start")
-                        .to("dropbox://put?accessToken={{accessToken}}&uploadMode=add&localPath=/XXX&remotePath=/XXX")
-                        .to("mock:result");
-
-                from("direct:start2")
-                    .setHeader(DropboxConstants.HEADER_LOCAL_PATH, constant("/XXX"))
-                    .setHeader(DropboxConstants.HEADER_REMOTE_PATH, constant("/XXX"))
-                    .setHeader(DropboxConstants.HEADER_UPLOAD_MODE, constant(DropboxUploadMode.add))
-                    .to("dropbox://put?accessToken={{accessToken}}")
-                    .to("mock:result");
-            }
-        };
-    }
-}
diff --git a/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerSearchQueryTest.java b/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerSearchQueryTest.java
index 4c8939f..2a541cd 100644
--- a/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerSearchQueryTest.java
+++ b/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerSearchQueryTest.java
@@ -16,79 +16,57 @@
  */
 package org.apache.camel.component.dropbox.integration.producer;
 
-import java.util.List;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
+import java.io.IOException;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.dropbox.integration.DropboxTestSupport;
 import org.apache.camel.component.dropbox.util.DropboxConstants;
 import org.apache.camel.component.dropbox.util.DropboxResultHeader;
 import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Before;
 import org.junit.Test;
 
 public class DropboxProducerSearchQueryTest extends DropboxTestSupport {
 
-    public DropboxProducerSearchQueryTest() throws Exception { }
-
-    @Test
-    public void testCamelDropbox() throws Exception {
-        template.send("direct:start", new Processor() {
-            @Override
-            public void process(Exchange exchange) throws Exception {
-                exchange.getIn().setHeader("test", "test");
-            }
-        });
-
-
-        MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedMinimumMessageCount(1);      
-        assertMockEndpointsSatisfied();
 
-        List<Exchange> exchanges = mock.getReceivedExchanges();
-        Exchange exchange = exchanges.get(0);
-        Object header =  exchange.getIn().getHeader(DropboxResultHeader.FOUND_FILES.name());
-        Object body = exchange.getIn().getBody();
-        assertNotNull(header);
-        assertNotNull(body);
+    public static final String FILE_NAME = "myTestFile.txt";
 
+    @Before
+    public void createFile() throws IOException {
+        final String content = "Hi camels";
+        createFile(FILE_NAME, content);
     }
 
+    @Test
+    public void testCamelDropbox() throws Exception {
+        test("direct:start");
+    }
 
     @Test
     public void testCamelDropboxWithOptionInHeader() throws Exception {
-        template.send("direct:start2", new Processor() {
-            @Override
-            public void process(Exchange exchange) throws Exception {
-                exchange.getIn().setHeader("test", "test");
-            }
-        });
+        test("direct:start2");
+    }
+
 
+    private void test(String endpoint) throws InterruptedException {
+        template.sendBody(endpoint, null);
 
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedMinimumMessageCount(1);
-        assertMockEndpointsSatisfied();
-
-        List<Exchange> exchanges = mock.getReceivedExchanges();
-        Exchange exchange = exchanges.get(0);
-        Object header =  exchange.getIn().getHeader(DropboxResultHeader.FOUND_FILES.name());
-        Object body = exchange.getIn().getBody();
-        assertNotNull(header);
-        assertNotNull(body);
-
+        mock.message(0).header(DropboxResultHeader.FOUND_FILES.name()).contains(String.format("%s/%s", workdir, FILE_NAME));
+        mock.assertIsSatisfied();
     }
 
     @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
+    protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             public void configure() {
                 from("direct:start")
-                        .to("dropbox://search?accessToken={{accessToken}}&remotePath=/XXX&query=XXX")
+                        .to(String.format("dropbox://search?accessToken={{accessToken}}&remotePath=%s&query=%s", workdir, FILE_NAME))
                         .to("mock:result");
 
                 from("direct:start2")
-                    .setHeader(DropboxConstants.HEADER_REMOTE_PATH, constant("/XXX"))
-                    .setHeader(DropboxConstants.HEADER_QUERY, constant("/XXX"))
+                        .setHeader(DropboxConstants.HEADER_REMOTE_PATH, constant(workdir))
+                        .setHeader(DropboxConstants.HEADER_QUERY, constant(FILE_NAME))
                     .to("dropbox://search?accessToken={{accessToken}}")
                     .to("mock:result");
             }
diff --git a/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerSearchTest.java b/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerSearchTest.java
deleted file mode 100644
index 38ce2aa..0000000
--- a/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerSearchTest.java
+++ /dev/null
@@ -1,92 +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.dropbox.integration.producer;
-
-import java.util.List;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.dropbox.integration.DropboxTestSupport;
-import org.apache.camel.component.dropbox.util.DropboxConstants;
-import org.apache.camel.component.dropbox.util.DropboxResultHeader;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
-
-public class DropboxProducerSearchTest extends DropboxTestSupport {
-
-    public DropboxProducerSearchTest() throws Exception { }
-
-    @Test
-    public void testCamelDropbox() throws Exception {
-        template.send("direct:start", new Processor() {
-            @Override
-            public void process(Exchange exchange) throws Exception {
-                exchange.getIn().setHeader("test", "test");
-            }
-        });
-
-        MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedMinimumMessageCount(1);      
-        assertMockEndpointsSatisfied();
-
-        List<Exchange> exchanges = mock.getReceivedExchanges();
-        Exchange exchange = exchanges.get(0);
-        Object header =  exchange.getIn().getHeader(DropboxResultHeader.FOUND_FILES.name());
-        Object body = exchange.getIn().getBody();
-        assertNotNull(header);
-        assertNotNull(body);
-    }
-
-    @Test
-    public void testCamelDropboxWithOptionInHeader() throws Exception {
-        template.send("direct:start2", new Processor() {
-            @Override
-            public void process(Exchange exchange) throws Exception {
-                exchange.getIn().setHeader("test", "test");
-            }
-        });
-
-
-        MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedMinimumMessageCount(1);
-        assertMockEndpointsSatisfied();
-
-        List<Exchange> exchanges = mock.getReceivedExchanges();
-        Exchange exchange = exchanges.get(0);
-        Object header =  exchange.getIn().getHeader(DropboxResultHeader.FOUND_FILES.name());
-        Object body = exchange.getIn().getBody();
-        assertNotNull(header);
-        assertNotNull(body);
-    }
-
-    @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
-        return new RouteBuilder() {
-            public void configure() {
-                from("direct:start")
-                        .to("dropbox://search?accessToken={{accessToken}}&remotePath=/XXX")
-                        .to("mock:result");
-
-                from("direct:start")
-                    .setHeader(DropboxConstants.HEADER_REMOTE_PATH, constant("/XXX"))
-                    .to("dropbox://search?accessToken={{accessToken}}")
-                    .to("mock:result");
-            }
-        };
-    }
-}
diff --git a/components/camel-dropbox/src/test/resources/test-options.properties b/components/camel-dropbox/src/test/resources/test-options.properties
index 84dfb21..5c07059 100644
--- a/components/camel-dropbox/src/test/resources/test-options.properties
+++ b/components/camel-dropbox/src/test/resources/test-options.properties
@@ -15,5 +15,6 @@
 ## limitations under the License.
 ## ---------------------------------------------------------------------------
 
-accessToken=<access-token>
+accessToken=<api-token>
 clientIdentifier=camel-dropbox
+workDir=/camel-test

Reply | Threaded
Open this post in threaded view
|

[camel] 07/08: [CAMEL-12942] Fix dropbox put operation

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 bb4504d67f9ddcdd7a5670531e9ed74cb34cdf81
Author: Jan <[hidden email]>
AuthorDate: Fri Nov 16 09:14:20 2018 +0100

    [CAMEL-12942] Fix dropbox put operation
---
 .../component/dropbox/core/DropboxAPIFacade.java   | 24 +++++++++++-----------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/core/DropboxAPIFacade.java b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/core/DropboxAPIFacade.java
index 1b43179..d6e3c7b 100644
--- a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/core/DropboxAPIFacade.java
+++ b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/core/DropboxAPIFacade.java
@@ -92,31 +92,31 @@ public final class DropboxAPIFacade {
         // in case the remote path is not specified, the remotePath = localPath
         String dropboxPath = remotePath == null ? localPath : remotePath;
 
-        UploadUploader entry;
+        boolean isPresent = true;
         try {
-            entry = client.files().upload(dropboxPath);
+            client.files().getMetadata(dropboxPath);
         } catch (DbxException e) {
-            throw new DropboxException(dropboxPath + " does not exist or cannot obtain metadata", e);
+            isPresent = false;
         }
 
         if (localPath != null) {
-            return putFile(localPath, mode, dropboxPath, entry);
+            return putFile(localPath, mode, dropboxPath, isPresent);
         } else {
-            return putBody(exchange, mode, dropboxPath, entry);
+            return putBody(exchange, mode, dropboxPath, isPresent);
         }
     }
 
-    private DropboxFileUploadResult putFile(String localPath, DropboxUploadMode mode, String dropboxPath, UploadUploader entry) throws DropboxException {
+    private DropboxFileUploadResult putFile(String localPath, DropboxUploadMode mode, String dropboxPath, boolean isPresent) throws DropboxException {
         File fileLocalPath = new File(localPath);
         // verify uploading of a single file
         if (fileLocalPath.isFile()) {
             // check if dropbox file exists
-            if (entry != null && !DropboxUploadMode.force.equals(mode)) {
-                throw new DropboxException(dropboxPath + " exists on dropbox and is not a file!");
+            if (isPresent && !DropboxUploadMode.force.equals(mode)) {
+                throw new DropboxException(dropboxPath + " exists on dropbox. Use force upload mode to override");
             }
             // in case the entry not exists on dropbox check if the filename
             // should be appended
-            if (entry == null) {
+            if (!isPresent) {
                 if (dropboxPath.endsWith(DropboxConstants.DROPBOX_FILE_SEPARATOR)) {
                     dropboxPath = dropboxPath + fileLocalPath.getName();
                 }
@@ -139,7 +139,7 @@ public final class DropboxAPIFacade {
             // verify uploading of a list of files inside a dir
             LOG.debug("Uploading a dir...");
             // check if dropbox folder exists
-            if (entry != null && !DropboxUploadMode.force.equals(mode)) {
+            if (isPresent && !DropboxUploadMode.force.equals(mode)) {
                 throw new DropboxException(dropboxPath + " exists on dropbox and is not a folder!");
             }
             if (!dropboxPath.endsWith(DropboxConstants.DROPBOX_FILE_SEPARATOR)) {
@@ -181,7 +181,7 @@ public final class DropboxAPIFacade {
         }
     }
 
-    private DropboxFileUploadResult putBody(Exchange exchange, DropboxUploadMode mode, String dropboxPath, UploadUploader entry) throws DropboxException {
+    private DropboxFileUploadResult putBody(Exchange exchange, DropboxUploadMode mode, String dropboxPath, boolean isPresent) throws DropboxException {
         String name = exchange.getIn().getHeader(HEADER_PUT_FILE_NAME, String.class);
         if (name == null) {
             // fallback to use CamelFileName
@@ -194,7 +194,7 @@ public final class DropboxAPIFacade {
 
         // in case the entry not exists on dropbox check if the filename should
         // be appended
-        if (entry == null) {
+        if (!isPresent) {
             if (dropboxPath.endsWith(DropboxConstants.DROPBOX_FILE_SEPARATOR)) {
                 dropboxPath = dropboxPath + name;
             }

Reply | Threaded
Open this post in threaded view
|

[camel] 08/08: Camel-Dropbox: Fixed test after backport refactor

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 2a874f56b35876b2fc8a08191e417db74099e6fb
Author: Andrea Cosentino <[hidden email]>
AuthorDate: Tue Dec 4 09:27:21 2018 +0100

    Camel-Dropbox: Fixed test after backport refactor
---
 .../dropbox/integration/consumer/DropboxConsumerGetSingleTest.java      | 2 +-
 .../dropbox/integration/consumer/DropboxConsumerSearchQueryTest.java    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/consumer/DropboxConsumerGetSingleTest.java b/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/consumer/DropboxConsumerGetSingleTest.java
index c923c68..e40955c 100644
--- a/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/consumer/DropboxConsumerGetSingleTest.java
+++ b/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/consumer/DropboxConsumerGetSingleTest.java
@@ -31,7 +31,7 @@ public class DropboxConsumerGetSingleTest extends DropboxTestSupport {
         final String content = "Hi camels";
         createFile(FILE_NAME, content);
 
-        context.startRoute("consumer");
+        context.start();
 
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedMinimumMessageCount(1);
diff --git a/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/consumer/DropboxConsumerSearchQueryTest.java b/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/consumer/DropboxConsumerSearchQueryTest.java
index d343a75..6ed78f4 100644
--- a/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/consumer/DropboxConsumerSearchQueryTest.java
+++ b/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/consumer/DropboxConsumerSearchQueryTest.java
@@ -31,7 +31,7 @@ public class DropboxConsumerSearchQueryTest extends DropboxTestSupport {
         final String content = "Hi camels";
         createFile(FILE_NAME, content);
 
-        context.startRoute("consumer");
+        context.start();
 
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedMinimumMessageCount(1);