camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject camel git commit: CAMEL-9697: Test component - Allow to receive in any order, or split using expression
Date Fri, 11 Mar 2016 07:16:07 GMT
Repository: camel
Updated Branches:
  refs/heads/master 41af00a0a -> 3ee8b69bb


CAMEL-9697: Test component - Allow to receive in any order, or split using expression


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

Branch: refs/heads/master
Commit: 3ee8b69bbdd2c40e7717047616875dfd74c04158
Parents: 41af00a
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Fri Mar 11 08:14:24 2016 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Fri Mar 11 08:14:24 2016 +0100

----------------------------------------------------------------------
 .../camel/component/test/TestEndpoint.java       | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/3ee8b69b/camel-core/src/main/java/org/apache/camel/component/test/TestEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/test/TestEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/test/TestEndpoint.java
index 14eb9e3..a09b53d 100644
--- a/camel-core/src/main/java/org/apache/camel/component/test/TestEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/test/TestEndpoint.java
@@ -23,11 +23,9 @@ import java.util.List;
 import org.apache.camel.Component;
 import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
-import org.apache.camel.Expression;
 import org.apache.camel.Processor;
 import org.apache.camel.WrappedFile;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.model.language.TokenizerExpression;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
@@ -60,6 +58,8 @@ public class TestEndpoint extends MockEndpoint {
     private long timeout = 2000L;
     @UriParam
     private boolean split;
+    @UriParam
+    private String delimiter = "\\n|\\r";
 
     public TestEndpoint(String endpointUri, Component component) {
         super(endpointUri, component);
@@ -83,7 +83,7 @@ public class TestEndpoint extends MockEndpoint {
                 }
                 if (split) {
                     // use new lines in both styles
-                    Iterator it = ObjectHelper.createIterator(body, "\\n|\\r", false, true);
+                    Iterator it = ObjectHelper.createIterator(body, delimiter, false, true);
                     while (it.hasNext()) {
                         Object line = it.next();
                         LOG.trace("Received message body {}", line);
@@ -145,4 +145,17 @@ public class TestEndpoint extends MockEndpoint {
     public void setSplit(boolean split) {
         this.split = split;
     }
+
+    public String getDelimiter() {
+        return delimiter;
+    }
+
+    /**
+     * The split delimiter to use when split is enabled.
+     * By default the delimiter is new line based.
+     * The delimiter can be a regular expression.
+     */
+    public void setDelimiter(String delimiter) {
+        this.delimiter = delimiter;
+    }
 }


Mime
View raw message