camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [3/3] camel git commit: Dropbox component support specifying route params using headers
Date Sun, 28 May 2017 14:42:58 GMT
Dropbox component support specifying route params using headers


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

Branch: refs/heads/master
Commit: ede89279e79f73c2d5d5c37fbdcee2023848df84
Parents: d896f56
Author: Thomas Lehoux <tlehoux@gmail.com>
Authored: Sun May 28 06:11:43 2017 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Sun May 28 16:41:58 2017 +0200

----------------------------------------------------------------------
 .../component/dropbox/DropboxComponent.java     |  3 +-
 .../producer/DropboxDelProducer.java            | 13 +++-
 .../producer/DropboxGetProducer.java            |  9 ++-
 .../producer/DropboxMoveProducer.java           | 13 +++-
 .../producer/DropboxPutProducer.java            | 14 +++-
 .../producer/DropboxSearchProducer.java         | 11 ++-
 .../component/dropbox/util/DropboxHelper.java   | 66 +++++++++++++++++
 .../dropbox/util/DropboxRequestHeader.java      | 35 +++++++++
 .../DropboxConfigurationValidator.java          | 54 +++++---------
 .../producer/DropboxProducerDelTest.java        | 28 ++++++++
 .../producer/DropboxProducerGetFolderTest.java  | 76 +++++++++++++++++++-
 .../producer/DropboxProducerGetSingleTest.java  | 29 ++++++++
 .../producer/DropboxProducerMoveTest.java       | 29 ++++++++
 .../DropboxProducerPutSingleFileTest.java       | 30 ++++++++
 ...ProducerPutSingleFileWithRemotePathTest.java | 31 ++++++++
 .../DropboxProducerPutWithRemotePathTest.java   | 30 ++++++++
 .../DropboxProducerSearchQueryTest.java         | 31 ++++++++
 .../producer/DropboxProducerSearchTest.java     | 29 +++++++-
 18 files changed, 483 insertions(+), 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/ede89279/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/DropboxComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/DropboxComponent.java b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/DropboxComponent.java
index 47426af..af2d741 100755
--- a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/DropboxComponent.java
+++ b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/DropboxComponent.java
@@ -65,8 +65,9 @@ public class DropboxComponent extends UriEndpointComponent {
             configuration.setUploadMode(DropboxUploadMode.valueOf((String)parameters.get("uploadMode")));
         }
 
+
         //pass validation test
-        DropboxConfigurationValidator.validate(configuration);
+        DropboxConfigurationValidator.validateCommonProperties(configuration);
 
         // and then override from parameters
         setProperties(configuration, parameters);

http://git-wip-us.apache.org/repos/asf/camel/blob/ede89279/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxDelProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxDelProducer.java b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxDelProducer.java
index 41ceb8e..743185e 100755
--- a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxDelProducer.java
+++ b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxDelProducer.java
@@ -21,7 +21,11 @@ import org.apache.camel.component.dropbox.DropboxConfiguration;
 import org.apache.camel.component.dropbox.DropboxEndpoint;
 import org.apache.camel.component.dropbox.core.DropboxAPIFacade;
 import org.apache.camel.component.dropbox.dto.DropboxDelResult;
+import org.apache.camel.component.dropbox.util.DropboxHelper;
+import org.apache.camel.component.dropbox.util.DropboxRequestHeader;
 import org.apache.camel.component.dropbox.util.DropboxResultHeader;
+import org.apache.camel.component.dropbox.validator.DropboxConfigurationValidator;
+import org.apache.camel.util.ObjectHelper;
 
 public class DropboxDelProducer extends DropboxProducer {
     
@@ -31,11 +35,16 @@ public class DropboxDelProducer extends DropboxProducer {
 
     @Override
     public void process(Exchange exchange) throws Exception {
+
+        String remotePath = DropboxHelper.getRemotePath(configuration, exchange);
+        DropboxConfigurationValidator.validateDelOp(remotePath);
+
         DropboxDelResult result = new DropboxAPIFacade(configuration.getClient(), exchange)
-            .del(configuration.getRemotePath());
+            .del(remotePath);
+
         exchange.getIn().setHeader(DropboxResultHeader.DELETED_PATH.name(), result.getEntry());
         exchange.getIn().setBody(result.getEntry());
-        log.debug("Deleted: {}", configuration.getRemotePath());
+        log.debug("Deleted: {}", remotePath);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/ede89279/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxGetProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxGetProducer.java b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxGetProducer.java
index 3427c1d..2f9a6bd 100755
--- a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxGetProducer.java
+++ b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxGetProducer.java
@@ -23,7 +23,11 @@ import org.apache.camel.component.dropbox.DropboxConfiguration;
 import org.apache.camel.component.dropbox.DropboxEndpoint;
 import org.apache.camel.component.dropbox.core.DropboxAPIFacade;
 import org.apache.camel.component.dropbox.dto.DropboxFileDownloadResult;
+import org.apache.camel.component.dropbox.util.DropboxHelper;
+import org.apache.camel.component.dropbox.util.DropboxRequestHeader;
 import org.apache.camel.component.dropbox.util.DropboxResultHeader;
+import org.apache.camel.component.dropbox.validator.DropboxConfigurationValidator;
+import org.apache.camel.util.ObjectHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -36,8 +40,11 @@ public class DropboxGetProducer extends DropboxProducer {
 
     @Override
     public void process(Exchange exchange) throws Exception {
+        String remotePath = DropboxHelper.getRemotePath(configuration, exchange);
+        DropboxConfigurationValidator.validateGetOp(remotePath);
+
         DropboxFileDownloadResult result = new DropboxAPIFacade(configuration.getClient(), exchange)
-                .get(configuration.getRemotePath());
+                .get(remotePath);
 
         Map<String, Object> map = result.getEntries();
         if (map.size() == 1) {

http://git-wip-us.apache.org/repos/asf/camel/blob/ede89279/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxMoveProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxMoveProducer.java b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxMoveProducer.java
index a1e46a2..b792f92 100755
--- a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxMoveProducer.java
+++ b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxMoveProducer.java
@@ -21,7 +21,11 @@ import org.apache.camel.component.dropbox.DropboxConfiguration;
 import org.apache.camel.component.dropbox.DropboxEndpoint;
 import org.apache.camel.component.dropbox.core.DropboxAPIFacade;
 import org.apache.camel.component.dropbox.dto.DropboxMoveResult;
+import org.apache.camel.component.dropbox.util.DropboxHelper;
+import org.apache.camel.component.dropbox.util.DropboxRequestHeader;
 import org.apache.camel.component.dropbox.util.DropboxResultHeader;
+import org.apache.camel.component.dropbox.validator.DropboxConfigurationValidator;
+import org.apache.camel.util.ObjectHelper;
 
 public class DropboxMoveProducer extends DropboxProducer {
 
@@ -31,13 +35,18 @@ public class DropboxMoveProducer extends DropboxProducer {
 
     @Override
     public void process(Exchange exchange) throws Exception {
+        String remotePath = DropboxHelper.getRemotePath(configuration, exchange);
+        String newRemotePath = DropboxHelper.getNewRemotePath(configuration, exchange);
+
+        DropboxConfigurationValidator.validateMoveOp(remotePath, newRemotePath);
+
         DropboxMoveResult result = new DropboxAPIFacade(configuration.getClient(), exchange)
-                .move(configuration.getRemotePath(), configuration.getNewRemotePath());
+                .move(remotePath, newRemotePath);
 
         exchange.getIn().setHeader(DropboxResultHeader.MOVED_PATH.name(), result.getOldPath());
         exchange.getIn().setBody(result.getNewPath());
 
-        log.debug("Moved from {} to {}", configuration.getRemotePath(), configuration.getNewRemotePath());
+        log.debug("Moved from {} to {}", remotePath, newRemotePath);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/ede89279/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxPutProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxPutProducer.java b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxPutProducer.java
index 0bbe6d1..b7cf6be 100755
--- a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxPutProducer.java
+++ b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxPutProducer.java
@@ -23,8 +23,13 @@ import org.apache.camel.component.dropbox.DropboxConfiguration;
 import org.apache.camel.component.dropbox.DropboxEndpoint;
 import org.apache.camel.component.dropbox.core.DropboxAPIFacade;
 import org.apache.camel.component.dropbox.dto.DropboxFileUploadResult;
+import org.apache.camel.component.dropbox.util.DropboxHelper;
+import org.apache.camel.component.dropbox.util.DropboxRequestHeader;
 import org.apache.camel.component.dropbox.util.DropboxResultCode;
 import org.apache.camel.component.dropbox.util.DropboxResultHeader;
+import org.apache.camel.component.dropbox.util.DropboxUploadMode;
+import org.apache.camel.component.dropbox.validator.DropboxConfigurationValidator;
+import org.apache.camel.util.ObjectHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -37,9 +42,14 @@ public class DropboxPutProducer extends DropboxProducer {
 
     @Override
     public void process(Exchange exchange) throws Exception {
-        DropboxFileUploadResult result = new DropboxAPIFacade(configuration.getClient(), exchange)
-                .put(configuration.getLocalPath(), configuration.getRemotePath(), configuration.getUploadMode());
+        String remotePath = DropboxHelper.getRemotePath(configuration, exchange);
+        String localPath = DropboxHelper.getLocalPath(configuration, exchange);
+        DropboxUploadMode uploadMode = DropboxHelper.getUploadMode(configuration, exchange);
+
+        DropboxConfigurationValidator.validatePutOp(localPath, remotePath, uploadMode);
 
+        DropboxFileUploadResult result = new DropboxAPIFacade(configuration.getClient(), exchange)
+                .put(localPath, remotePath, uploadMode);
 
         Map<String, DropboxResultCode> map = result.getResults();
         if (map.size() == 1) {

http://git-wip-us.apache.org/repos/asf/camel/blob/ede89279/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxSearchProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxSearchProducer.java b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxSearchProducer.java
index 9177a15..e296214 100755
--- a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxSearchProducer.java
+++ b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxSearchProducer.java
@@ -22,7 +22,11 @@ import org.apache.camel.component.dropbox.DropboxConfiguration;
 import org.apache.camel.component.dropbox.DropboxEndpoint;
 import org.apache.camel.component.dropbox.core.DropboxAPIFacade;
 import org.apache.camel.component.dropbox.dto.DropboxSearchResult;
+import org.apache.camel.component.dropbox.util.DropboxHelper;
+import org.apache.camel.component.dropbox.util.DropboxRequestHeader;
 import org.apache.camel.component.dropbox.util.DropboxResultHeader;
+import org.apache.camel.component.dropbox.validator.DropboxConfigurationValidator;
+import org.apache.camel.util.ObjectHelper;
 
 public class DropboxSearchProducer extends DropboxProducer {
 
@@ -32,8 +36,13 @@ public class DropboxSearchProducer extends DropboxProducer {
 
     @Override
     public void process(Exchange exchange) throws Exception {
+        String remotePath = DropboxHelper.getRemotePath(configuration, exchange);
+        String query = DropboxHelper.getQuery(configuration, exchange);
+
+        DropboxConfigurationValidator.validateSearchOp(remotePath);
+
         DropboxSearchResult result = new DropboxAPIFacade(configuration.getClient(), exchange)
-                .search(configuration.getRemotePath(), configuration.getQuery());
+                .search(remotePath, query);
 
         StringBuilder fileExtracted = new StringBuilder();
         for (DbxEntry entry : result.getFound()) {

http://git-wip-us.apache.org/repos/asf/camel/blob/ede89279/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/util/DropboxHelper.java
----------------------------------------------------------------------
diff --git a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/util/DropboxHelper.java b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/util/DropboxHelper.java
new file mode 100755
index 0000000..54a8a58
--- /dev/null
+++ b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/util/DropboxHelper.java
@@ -0,0 +1,66 @@
+/**
+ * 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.util;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.component.dropbox.DropboxConfiguration;
+import org.apache.camel.util.ObjectHelper;
+
+public final class DropboxHelper {
+
+    private DropboxHelper() { }
+
+    public static String getRemotePath(DropboxConfiguration configuration, Exchange exchange) {
+        return ObjectHelper.isNotEmpty(
+            exchange.getIn().getHeader(DropboxRequestHeader.REMOTE_PATH.name()))
+            ? exchange.getIn().getHeader(DropboxRequestHeader.REMOTE_PATH.name(), String.class).replaceAll("\\s", "+")
+            : configuration.getRemotePath();
+    }
+
+    public static String getNewRemotePath(DropboxConfiguration configuration, Exchange exchange) {
+        return ObjectHelper.isNotEmpty(
+            exchange.getIn().getHeader(DropboxRequestHeader.NEW_REMOTE_PATH.name()))
+            ? exchange.getIn().getHeader(DropboxRequestHeader.NEW_REMOTE_PATH.name(), String.class)
+            : configuration.getNewRemotePath();
+    }
+
+    public static String getLocalPath(DropboxConfiguration configuration, Exchange exchange) {
+        return ObjectHelper.isNotEmpty(
+            exchange.getIn().getHeader(DropboxRequestHeader.LOCAL_PATH.name()))
+            ? exchange.getIn().getHeader(DropboxRequestHeader.LOCAL_PATH.name(), String.class)
+            : configuration.getLocalPath();
+    }
+
+    public static String getQuery(DropboxConfiguration configuration, Exchange exchange) {
+        return ObjectHelper.isNotEmpty(
+            exchange.getIn().getHeader(DropboxRequestHeader.QUERY.name()))
+            ? exchange.getIn().getHeader(DropboxRequestHeader.QUERY.name(), String.class)
+            : configuration.getQuery();
+    }
+
+    public static DropboxUploadMode getUploadMode(DropboxConfiguration configuration, Exchange exchange) {
+        return ObjectHelper.isNotEmpty(
+            exchange.getIn().getHeader(DropboxRequestHeader.UPLOAD_MODE.name()))
+            ? DropboxUploadMode.valueOf(exchange.getIn().getHeader(DropboxRequestHeader.UPLOAD_MODE.name(), String.class))
+            : configuration.getUploadMode();
+    }
+
+
+
+
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/ede89279/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/util/DropboxRequestHeader.java
----------------------------------------------------------------------
diff --git a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/util/DropboxRequestHeader.java b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/util/DropboxRequestHeader.java
new file mode 100644
index 0000000..572025e
--- /dev/null
+++ b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/util/DropboxRequestHeader.java
@@ -0,0 +1,35 @@
+/**
+ * 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.util;
+
+public enum DropboxRequestHeader {
+    REMOTE_PATH("remotePath"),
+    NEW_REMOTE_PATH("newRemotePath"),
+    LOCAL_PATH("localPath"),
+    UPLOAD_MODE("uploadMode"),
+    QUERY("query");
+
+    private String name;
+
+    DropboxRequestHeader(String name) {
+        this.name = name;
+    }
+
+    public String toString() {
+        return name;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/ede89279/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/validator/DropboxConfigurationValidator.java
----------------------------------------------------------------------
diff --git a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/validator/DropboxConfigurationValidator.java b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/validator/DropboxConfigurationValidator.java
index f45f7c1..f7fb6bb 100755
--- a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/validator/DropboxConfigurationValidator.java
+++ b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/validator/DropboxConfigurationValidator.java
@@ -23,6 +23,7 @@ import java.util.regex.Pattern;
 import org.apache.camel.component.dropbox.DropboxConfiguration;
 import org.apache.camel.component.dropbox.util.DropboxException;
 import org.apache.camel.component.dropbox.util.DropboxOperation;
+import org.apache.camel.component.dropbox.util.DropboxUploadMode;
 
 import static org.apache.camel.component.dropbox.util.DropboxConstants.DROPBOX_FILE_SEPARATOR;
 
@@ -32,28 +33,8 @@ public final class DropboxConfigurationValidator {
 
     private DropboxConfigurationValidator() { }
 
-    /**
-     * Validate the parameters passed in the incoming url.
-     * @param configuration object containing the parameters.
-     * @throws DropboxException
-     */
-    public static void validate(DropboxConfiguration configuration) throws DropboxException {
-        validateCommonProperties(configuration);
-        DropboxOperation op = configuration.getOperation();
-        if (op == DropboxOperation.get) {
-            validateGetOp(configuration);
-        } else if (op == DropboxOperation.put) {
-            validatePutOp(configuration);
-        } else if (op == DropboxOperation.search) {
-            validateSearchOp(configuration);
-        } else if (op == DropboxOperation.del) {
-            validateDelOp(configuration);
-        } else if (op == DropboxOperation.move) {
-            validateMoveOp(configuration);
-        }
-    }
 
-    private static void validateCommonProperties(DropboxConfiguration configuration) throws DropboxException {
+    public static void validateCommonProperties(DropboxConfiguration configuration) throws DropboxException {
         if (configuration.getAccessToken() == null || configuration.getAccessToken().equals("")) {
             throw new DropboxException("option <accessToken> is not present or not valid!");
         }
@@ -62,34 +43,34 @@ public final class DropboxConfigurationValidator {
         }
     }
 
-    private static void validateGetOp(DropboxConfiguration configuration) throws DropboxException {
-        validateRemotePath(configuration.getRemotePath());
+    public static void validateGetOp(String remotePath) throws DropboxException {
+        validateRemotePath(remotePath);
     }
 
-    private static void validatePutOp(DropboxConfiguration configuration) throws DropboxException {
-        validateLocalPath(configuration.getLocalPath());
+    public static void validatePutOp(String localPath, String remotePath, DropboxUploadMode uploadMode) throws DropboxException {
+        validateLocalPath(localPath);
         //remote path is optional
-        if (configuration.getRemotePath() != null) {
-            validateRemotePathForPut(configuration.getRemotePath());
+        if (remotePath != null) {
+            validateRemotePathForPut(remotePath);
         } else {  //in case remote path is not set, local path is even the remote path so it must be validated as UNIX
-            validatePathInUnix(configuration.getLocalPath());
+            validatePathInUnix(localPath);
         }
-        if (configuration.getUploadMode() == null) {
+        if (uploadMode == null) {
             throw new DropboxException("option <uploadMode> is not present or not valid!");
         }
     }
 
-    private static void validateSearchOp(DropboxConfiguration configuration) throws DropboxException {
-        validateRemotePath(configuration.getRemotePath());
+    public static void validateSearchOp(String remotePath) throws DropboxException {
+        validateRemotePath(remotePath);
     }
 
-    private static void validateDelOp(DropboxConfiguration configuration) throws DropboxException {
-        validateRemotePath(configuration.getRemotePath());
+    public static void validateDelOp(String remotePath) throws DropboxException {
+        validateRemotePath(remotePath);
     }
 
-    private static void validateMoveOp(DropboxConfiguration configuration) throws DropboxException {
-        validateRemotePath(configuration.getRemotePath());
-        validateRemotePath(configuration.getNewRemotePath());
+    public static void validateMoveOp(String remotePath, String newRemotePath) throws DropboxException {
+        validateRemotePath(remotePath);
+        validateRemotePath(newRemotePath);
     }
 
     private static void validateLocalPath(String localPath) throws DropboxException {
@@ -103,6 +84,7 @@ public final class DropboxConfigurationValidator {
     }
 
     private static void validateRemotePath(String remotePath) throws DropboxException {
+
         if (remotePath == null || !remotePath.startsWith(DROPBOX_FILE_SEPARATOR)) {
             throw new DropboxException("option <remotePath> is not valid!");
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/ede89279/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerDelTest.java
----------------------------------------------------------------------
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 437d76e..c4682b4 100755
--- 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
@@ -22,6 +22,7 @@ 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.DropboxRequestHeader;
 import org.apache.camel.component.dropbox.util.DropboxResultHeader;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.junit.Test;
@@ -52,6 +53,28 @@ public class DropboxProducerDelTest extends DropboxTestSupport {
         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.DELETED_PATH.name());
+        Object body = exchange.getIn().getBody();
+        assertNotNull(header);
+        assertNotNull(body);
+    }
+
     @Override
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
@@ -59,6 +82,11 @@ public class DropboxProducerDelTest extends DropboxTestSupport {
                 from("direct:start")
                         .to("dropbox://del?accessToken={{accessToken}}&clientIdentifier={{clientIdentifier}}&remotePath=/XXX")
                         .to("mock:result");
+
+                from("direct:start2")
+                    .setHeader(DropboxRequestHeader.REMOTE_PATH.name(), constant("/XXX"))
+                    .to("dropbox://del?accessToken={{accessToken}}&clientIdentifier={{clientIdentifier}}")
+                    .to("mock:result");
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/ede89279/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerGetFolderTest.java
----------------------------------------------------------------------
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 c23c577..c4e2c24 100755
--- 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
@@ -22,6 +22,7 @@ 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.DropboxRequestHeader;
 import org.apache.camel.component.dropbox.util.DropboxResultHeader;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.junit.Test;
@@ -39,9 +40,39 @@ public class DropboxProducerGetFolderTest extends DropboxTestSupport {
             }
         });
 
+        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
+    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(DropboxRequestHeader.REMOTE_PATH.name(), "/XXX");
+            }
+        });
+
 
         MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedMinimumMessageCount(1);       
+        mock.expectedMinimumMessageCount(2);
         assertMockEndpointsSatisfied();
 
         List<Exchange> exchanges = mock.getReceivedExchanges();
@@ -51,7 +82,33 @@ public class DropboxProducerGetFolderTest extends DropboxTestSupport {
         assertNotNull(header);
         assertNotNull(body);
 
-        System.out.println(header.toString());
+        exchange = exchanges.get(1);
+        header =  exchange.getIn().getHeader(DropboxResultHeader.DOWNLOADED_FILES.name());
+        body = exchange.getIn().getBody();
+        assertNotNull(header);
+        assertNotNull(body);
+    }
+
+
+    @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");
+            }
+        });
+
+        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);
     }
 
     @Override
@@ -61,6 +118,21 @@ public class DropboxProducerGetFolderTest extends DropboxTestSupport {
                 from("direct:start")
                         .to("dropbox://get?accessToken={{accessToken}}&clientIdentifier={{clientIdentifier}}&remotePath=/XXX")
                         .to("mock:result");
+
+                from("direct:start2")
+                    .setHeader(DropboxRequestHeader.REMOTE_PATH.name(), constant("/XXX"))
+                    .to("dropbox://get?accessToken={{accessToken}}&clientIdentifier={{clientIdentifier}}")
+                    .to("mock:result");
+
+                from("direct:start3")
+                    .to("dropbox://get?accessToken={{accessToken}}&clientIdentifier={{clientIdentifier}}")
+                    .to("mock:result");
+
+                from("direct:start4")
+                    .setHeader(DropboxRequestHeader.REMOTE_PATH.name(), constant("/XXX"))
+                    .to("dropbox://get?accessToken={{accessToken}}&clientIdentifier={{clientIdentifier}}&remotePath=/aWrongPath")
+                    .to("mock:result");
+
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/ede89279/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerGetSingleTest.java
----------------------------------------------------------------------
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 fbfd9d5..f61dfef 100755
--- 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
@@ -22,6 +22,7 @@ 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.DropboxRequestHeader;
 import org.apache.camel.component.dropbox.util.DropboxResultHeader;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.junit.Test;
@@ -52,6 +53,28 @@ public class DropboxProducerGetSingleTest extends DropboxTestSupport {
         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.DOWNLOADED_FILE.name());
+        Object body = exchange.getIn().getBody();
+        assertNotNull(header);
+        assertNotNull(body);
+    }
+
     @Override
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
@@ -60,6 +83,12 @@ public class DropboxProducerGetSingleTest extends DropboxTestSupport {
                         .to("dropbox://get?accessToken={{accessToken}}&clientIdentifier={{clientIdentifier}}&remotePath=/XXX")
                         .to("file:///XXX?fileName=XXX")
                         .to("mock:result");
+
+                from("direct:start2")
+                    .setHeader(DropboxRequestHeader.REMOTE_PATH.name(), constant("/XXX"))
+                    .to("dropbox://get?accessToken={{accessToken}}&clientIdentifier={{clientIdentifier}}")
+                    .to("file:///XXX?fileName=XXX")
+                    .to("mock:result");
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/ede89279/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerMoveTest.java
----------------------------------------------------------------------
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 a074d0d..57f8c9f 100755
--- 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
@@ -22,6 +22,7 @@ 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.DropboxRequestHeader;
 import org.apache.camel.component.dropbox.util.DropboxResultHeader;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.junit.Test;
@@ -52,6 +53,28 @@ public class DropboxProducerMoveTest extends DropboxTestSupport {
         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.MOVED_PATH.name());
+        Object body = exchange.getIn().getBody();
+        assertNotNull(header);
+        assertNotNull(body);
+    }
+
     @Override
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
@@ -59,6 +82,12 @@ public class DropboxProducerMoveTest extends DropboxTestSupport {
                 from("direct:start")
                         .to("dropbox://move?accessToken={{accessToken}}&clientIdentifier={{clientIdentifier}}&remotePath=/XXX&newRemotePath=/XXX")
                         .to("mock:result");
+
+                from("direct:start2")
+                    .setHeader(DropboxRequestHeader.REMOTE_PATH.name(), constant("/XXX"))
+                    .setHeader(DropboxRequestHeader.NEW_REMOTE_PATH.name(), constant("/XXX"))
+                    .to("dropbox://move?accessToken={{accessToken}}&clientIdentifier={{clientIdentifier}}")
+                    .to("mock:result");
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/ede89279/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerPutSingleFileTest.java
----------------------------------------------------------------------
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 4ff4c8d..9cf0098 100755
--- 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
@@ -22,7 +22,9 @@ 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.DropboxRequestHeader;
 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;
 
@@ -52,6 +54,28 @@ public class DropboxProducerPutSingleFileTest extends DropboxTestSupport {
         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() {
@@ -59,6 +83,12 @@ public class DropboxProducerPutSingleFileTest extends DropboxTestSupport {
                 from("direct:start")
                         .to("dropbox://put?accessToken={{accessToken}}&clientIdentifier={{clientIdentifier}}&uploadMode=add&localPath=/XXX")
                         .to("mock:result");
+
+                from("direct:start2")
+                    .setHeader(DropboxRequestHeader.LOCAL_PATH.name(), constant("/XXX"))
+                    .setHeader(DropboxRequestHeader.UPLOAD_MODE.name(), constant(DropboxUploadMode.add))
+                    .to("dropbox://put?accessToken={{accessToken}}&clientIdentifier={{clientIdentifier}}")
+                    .to("mock:result");
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/ede89279/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerPutSingleFileWithRemotePathTest.java
----------------------------------------------------------------------
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
index dbe1fbd..e60e933 100755
--- 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
@@ -22,7 +22,9 @@ 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.DropboxRequestHeader;
 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;
 
@@ -52,6 +54,28 @@ public class DropboxProducerPutSingleFileWithRemotePathTest extends DropboxTestS
         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() {
@@ -59,6 +83,13 @@ public class DropboxProducerPutSingleFileWithRemotePathTest extends DropboxTestS
                 from("direct:start")
                         .to("dropbox://put?accessToken={{accessToken}}&clientIdentifier={{clientIdentifier}}&uploadMode=add&localPath=/XXX&remotePath=/XXX")
                         .to("mock:result");
+
+                from("direct:start2")
+                    .setHeader(DropboxRequestHeader.UPLOAD_MODE.name(), constant(DropboxUploadMode.add))
+                    .setHeader(DropboxRequestHeader.LOCAL_PATH.name(), constant("/tmp/toto.txt"))
+                    .setHeader(DropboxRequestHeader.REMOTE_PATH.name(), constant("/test"))
+                    .to("dropbox://put?accessToken={{accessToken}}&clientIdentifier={{clientIdentifier}}")
+                    .to("mock:result");
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/ede89279/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerPutWithRemotePathTest.java
----------------------------------------------------------------------
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
index 4cb8313..261e9d0 100755
--- 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
@@ -22,7 +22,9 @@ 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.DropboxRequestHeader;
 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;
 
@@ -52,6 +54,27 @@ public class DropboxProducerPutWithRemotePathTest extends DropboxTestSupport {
         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() {
@@ -59,6 +82,13 @@ public class DropboxProducerPutWithRemotePathTest extends DropboxTestSupport {
                 from("direct:start")
                         .to("dropbox://put?accessToken={{accessToken}}&clientIdentifier={{clientIdentifier}}&uploadMode=add&localPath=/XXX&remotePath=/XXX")
                         .to("mock:result");
+
+                from("direct:start2")
+                    .setHeader(DropboxRequestHeader.LOCAL_PATH.name(), constant("/XXX"))
+                    .setHeader(DropboxRequestHeader.REMOTE_PATH.name(), constant("/XXX"))
+                    .setHeader(DropboxRequestHeader.UPLOAD_MODE.name(), constant(DropboxUploadMode.add))
+                    .to("dropbox://put?accessToken={{accessToken}}&clientIdentifier={{clientIdentifier}}")
+                    .to("mock:result");
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/ede89279/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerSearchQueryTest.java
----------------------------------------------------------------------
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 ae20169..03e9ebb 100755
--- 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
@@ -22,6 +22,7 @@ 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.DropboxRequestHeader;
 import org.apache.camel.component.dropbox.util.DropboxResultHeader;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.junit.Test;
@@ -53,6 +54,30 @@ public class DropboxProducerSearchQueryTest extends DropboxTestSupport {
 
     }
 
+
+    @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() {
@@ -60,6 +85,12 @@ public class DropboxProducerSearchQueryTest extends DropboxTestSupport {
                 from("direct:start")
                         .to("dropbox://search?accessToken={{accessToken}}&clientIdentifier={{clientIdentifier}}&remotePath=/XXX&query=XXX")
                         .to("mock:result");
+
+                from("direct:start2")
+                    .setHeader(DropboxRequestHeader.REMOTE_PATH.name(), constant("/XXX"))
+                    .setHeader(DropboxRequestHeader.QUERY.name(), constant("/XXX"))
+                    .to("dropbox://search?accessToken={{accessToken}}&clientIdentifier={{clientIdentifier}}")
+                    .to("mock:result");
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/ede89279/components/camel-dropbox/src/test/java/org/apache/camel/component/dropbox/integration/producer/DropboxProducerSearchTest.java
----------------------------------------------------------------------
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
index fce5fbf..277c267 100755
--- 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
@@ -22,6 +22,7 @@ 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.DropboxRequestHeader;
 import org.apache.camel.component.dropbox.util.DropboxResultHeader;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.junit.Test;
@@ -39,7 +40,6 @@ public class DropboxProducerSearchTest extends DropboxTestSupport {
             }
         });
 
-
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedMinimumMessageCount(1);       
         assertMockEndpointsSatisfied();
@@ -52,6 +52,28 @@ public class DropboxProducerSearchTest extends DropboxTestSupport {
         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() {
@@ -59,6 +81,11 @@ public class DropboxProducerSearchTest extends DropboxTestSupport {
                 from("direct:start")
                         .to("dropbox://search?accessToken={{accessToken}}&clientIdentifier={{clientIdentifier}}&remotePath=/XXX")
                         .to("mock:result");
+
+                from("direct:start")
+                    .setHeader(DropboxRequestHeader.REMOTE_PATH.name(), constant("/XXX"))
+                    .to("dropbox://search?accessToken={{accessToken}}&clientIdentifier={{clientIdentifier}}")
+                    .to("mock:result");
             }
         };
     }


Mime
View raw message