You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2018/02/05 15:28:21 UTC

[camel] branch 8958 created (now b416c74)

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

davsclaus pushed a change to branch 8958
in repository https://gitbox.apache.org/repos/asf/camel.git.


      at b416c74  CAMEL-8958: Claim Check EIP with push/pop. Work in progress.

This branch includes the following new commits:

     new 8ab6a6f  CAMEL-8958: Claim Check EIP with push/pop. Work in progress.
     new 148a16f  CAMEL-8958: Claim Check EIP with push/pop. Work in progress.
     new d83291c  Regen docs
     new d7ccd6d  CAMEL-8958: Claim Check EIP with push/pop. Work in progress.
     new dd38a8c  CAMEL-8958: Claim Check EIP with push/pop. Work in progress.
     new 92977ad  CAMEL-8958: Claim Check EIP with push/pop. Work in progress.
     new b416c74  CAMEL-8958: Claim Check EIP with push/pop. Work in progress.

The 7 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.


-- 
To stop receiving notification emails like this one, please contact
davsclaus@apache.org.

[camel] 05/07: CAMEL-8958: Claim Check EIP with push/pop. Work in progress.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch 8958
in repository https://gitbox.apache.org/repos/asf/camel.git

commit dd38a8c2eb77aa9a5ef52048d72195df47601664
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Feb 5 10:45:54 2018 +0100

    CAMEL-8958: Claim Check EIP with push/pop. Work in progress.
---
 camel-core/src/main/docs/eips/claimCheck-eip.adoc  | 178 +++++++++++++++++++++
 .../apache/camel/model/ClaimCheckDefinition.java   |   8 +-
 .../apache/camel/model/ProcessorDefinition.java    |  29 ++++
 3 files changed, 213 insertions(+), 2 deletions(-)

diff --git a/camel-core/src/main/docs/eips/claimCheck-eip.adoc b/camel-core/src/main/docs/eips/claimCheck-eip.adoc
new file mode 100644
index 0000000..f9d34e0
--- /dev/null
+++ b/camel-core/src/main/docs/eips/claimCheck-eip.adoc
@@ -0,0 +1,178 @@
+[[claimCheck-eip]]
+== Claim Check EIP
+
+The Claim Check EIP allows you to replace message content with a claim check (a unique key),
+which can be used to retrieve the message content at a later time.
+
+It can also be useful in situations where you cannot trust the information with an outside party; in this case, you can use the Claim Check to hide the sensitive portions of data.
+
+NOTE: The Camel implementation of this EIP pattern stores the message content temporarily in an internal memory store.
+
+
+// eip options: START
+The Claim Check EIP supports 5 options which are listed below:
+
+
+[width="100%",cols="2,5,^1,2",options="header"]
+|===
+| Name | Description | Default | Type
+| *operation* | *Required* The claim check operation to use. The following operations is supported: Get - Gets (does not remove) the claim check by the given key. GetAndRemove - Gets and remove the claim check by the given key. Set - Sets a new (will override if key already exists) claim check with the given key. Push - Sets a new claim check on the stack (does not use key). Pop - Gets the latest claim check from the stack (does not use key). |  | ClaimCheckOperation
+| *key* | To use a specific key for claim check id. |  | String
+| *data* | What data to merge when claiming from the repository. The following syntax is supported: body - to aggregate the message body headers - to aggregate all the message headers header:pattern - to aggregate all the message headers that matches the pattern. The pattern syntax is documented by: link EndpointHelpermatchPattern(String String). You can specify multiple rules separated by comma. For example to include the message body and all headers starting with foo bodyheader:foo. If [...]
+| *strategyRef* | To use a custom AggregationStrategy instead of the default implementation. Notice you cannot use both custom aggregation strategy and configure data at the same time. |  | String
+| *strategyMethodName* | This option can be used to explicit declare the method name to use when using POJOs as the AggregationStrategy. |  | String
+|===
+// eip options: END
+
+
+=== Claim Check Operation
+
+When using this EIP you must specify the operation to use which can be of the following:
+
+* Get - Gets (does not remove) the claim check by the given key.
+* GetAndRemove - Gets and remove the claim check by the given key.
+* Set - Sets a new (will override if key already exists) claim check with the given key.
+* Push - Sets a new claim check on the stack (does not use key).
+* Pop - Gets the latest claim check from the stack (does not use key).
+
+When using the `Get`, `GetAndRemove`, or `Set` operation you must specify a key.
+These operations will then store and retrieve the data using this key. You can use this to store multiple data in different keys.
+
+The `Push` and `Pop` operations do *not* use a key but stores the data in a stack structure.
+
+
+=== What data to merge back
+
+The `data` option is used to define what data to merge back when using the `Get` or `Pop` operation. When data is merged back
+then its merged using a `AggregationStrategy`. The default strategy uses the `data` option to easily specify what data to merge back.
+
+The `data` option takes a String value with the following syntax:
+
+* body - to aggregate the message body
+* headers - to aggregate all the message headers
+* header:pattern - to aggregate all the message headers that matches the pattern.
+
+The pattern rule supports wildcard and regular expression:
+
+* wildcard match (pattern ends with a * and the name starts with the pattern)
+* regular expression match
+
+You can specify multiple rules separated by comma.
+
+For example to include the message body and all headers starting with _foo_:
+
+[text]
+----
+body,header:foo*
+----
+
+To only merge back the message body:
+
+[text]
+----
+body
+----
+
+To only merge back headers:
+
+[text]
+----
+headers
+----
+
+To only merge back a header name foo:
+
+[text]
+----
+header:foo
+----
+
+If the data rule is specified as empty or as wildcard then everything is merged.
+
+Notice that when merging back data, then any existing data is overriden, and any other existing data is preserved.
+
+
+=== Java Examples
+
+The following example shows the `Push` and `Pop` operations in action;
+
+[java]
+----
+from("direct:start")
+    .to("mock:a")
+    .claimCheck(ClaimCheckOperation.Push)
+    .transform().constant("Bye World")
+    .to("mock:b")
+    .claimCheck(ClaimCheckOperation.Pop)
+    .to("mock:c");
+----
+
+For example if the message body from the beginning is `Hello World` then that data is pushed on the stack of the Claim Check EIP.
+And then the message body is transformed to `Bye World`, which is what `mock:b` endpoint receives. When we `Pop` from the Claim Check EIP
+then the original message body is retrieved and merged back so `mock:c` will retrieve the message body with `Hello World`.
+
+Here is an example using `Get` and `Set` operations, which uses the key `foo`:
+
+[java]
+----
+from("direct:start")
+    .to("mock:a")
+    .claimCheck(ClaimCheckOperation.Set, "foo")
+    .transform().constant("Bye World")
+    .to("mock:b")
+    .claimCheck(ClaimCheckOperation.Get, "foo")
+    .to("mock:c")
+    .transform().constant("Hi World")
+    .to("mock:d")
+    .claimCheck(ClaimCheckOperation.Get, "foo")
+    .to("mock:e");
+----
+
+Notice how we can `Get` the same data twice using the `Get` operation as it will not remove the data. If you only want
+to get the data once, you can use `GetAndRemove`.
+
+The last example shows how to use the `data` option where we only want to get back header named `foo` or `bar`:
+
+[java]
+----
+from("direct:start")
+    .to("mock:a")
+    .claimCheck(ClaimCheckOperation.Push)
+    .transform().constant("Bye World")
+    .setHeader("foo", constant(456))
+    .removeHeader("bar")
+    .to("mock:b")
+    // only merge in the message headers foo or bar
+    .claimCheck(ClaimCheckOperation.Pop, null, "header:(foo|bar)")
+    .to("mock:c");
+----
+
+=== XML examples
+
+The following example shows the `Push` and `Pop` operations in action;
+
+[xml]
+----
+TODO: XML example
+----
+
+For example if the message body from the beginning is `Hello World` then that data is pushed on the stack of the Claim Check EIP.
+And then the message body is transformed to `Bye World`, which is what `mock:b` endpoint receives. When we `Pop` from the Claim Check EIP
+then the original message body is retrieved and merged back so `mock:c` will retrieve the message body with `Hello World`.
+
+Here is an example using `Get` and `Set` operations, which uses the key `foo`:
+
+[xml]
+----
+TODO: XML example
+----
+
+Notice how we can `Get` the same data twice using the `Get` operation as it will not remove the data. If you only want
+to get the data once, you can use `GetAndRemove`.
+
+The last example shows how to use the `data` option where we only want to get back header named `foo` or `bar`:
+
+[xml]
+----
+TODO: XML example
+----
diff --git a/camel-core/src/main/java/org/apache/camel/model/ClaimCheckDefinition.java b/camel-core/src/main/java/org/apache/camel/model/ClaimCheckDefinition.java
index 8b9080e..d38460f 100644
--- a/camel-core/src/main/java/org/apache/camel/model/ClaimCheckDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/ClaimCheckDefinition.java
@@ -33,7 +33,7 @@ import org.apache.camel.util.EndpointHelper;
 import org.apache.camel.util.ObjectHelper;
 
 /**
- * The Claim Check from the EIP patterns allows you to replace message content with a claim check (a unique key),
+ * The Claim Check EIP allows you to replace message content with a claim check (a unique key),
  * which can be used to retrieve the message content at a later time.
  */
 @Metadata(label = "eip,routing")
@@ -59,7 +59,11 @@ public class ClaimCheckDefinition extends NoOutputDefinition<ClaimCheckDefinitio
 
     @Override
     public String toString() {
-        return "ClaimCheck";
+        if (operation != null) {
+            return "ClaimCheck[" + operation + "]";
+        } else {
+            return "ClaimCheck";
+        }
     }
 
     @Override
diff --git a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
index 9d168b1..19ac9c8 100644
--- a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
@@ -3445,12 +3445,24 @@ public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type>
         return ExpressionClause.createAndSetExpression(answer);
     }
 
+    /**
+     * The <a href="http://camel.apache.org/claim-check.html">Claim Check EIP</a>
+     * allows you to replace message content with a claim check (a unique key),
+     * which can be used to retrieve the message content at a later time.
+     */
     public ClaimCheckDefinition claimCheck() {
         ClaimCheckDefinition answer = new ClaimCheckDefinition();
         addOutput(answer);
         return answer;
     }
 
+    /**
+     * The <a href="http://camel.apache.org/claim-check.html">Claim Check EIP</a>
+     * allows you to replace message content with a claim check (a unique key),
+     * which can be used to retrieve the message content at a later time.
+     *
+     * @param operation the claim check operation to use.
+     */
     public Type claimCheck(ClaimCheckOperation operation) {
         ClaimCheckDefinition answer = new ClaimCheckDefinition();
         answer.setOperation(operation);
@@ -3458,6 +3470,14 @@ public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type>
         return (Type) this;
     }
 
+    /**
+     * The <a href="http://camel.apache.org/claim-check.html">Claim Check EIP</a>
+     * allows you to replace message content with a claim check (a unique key),
+     * which can be used to retrieve the message content at a later time.
+     *
+     * @param operation the claim check operation to use.
+     * @param key       the unique key to use for the get and set operations, can be <tt>null</tt> for push/pop operations
+     */
     public Type claimCheck(ClaimCheckOperation operation, String key) {
         ClaimCheckDefinition answer = new ClaimCheckDefinition();
         answer.setOperation(operation);
@@ -3466,6 +3486,15 @@ public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type>
         return (Type) this;
     }
 
+    /**
+     * The <a href="http://camel.apache.org/claim-check.html">Claim Check EIP</a>
+     * allows you to replace message content with a claim check (a unique key),
+     * which can be used to retrieve the message content at a later time.
+     *
+     * @param operation the claim check operation to use.
+     * @param key       the unique key to use for the get and set operations, can be <tt>null</tt> for push/pop operations
+     * @param data      describes what data to retrieve and merge back when using get or pop operations.
+     */
     public Type claimCheck(ClaimCheckOperation operation, String key, String data) {
         ClaimCheckDefinition answer = new ClaimCheckDefinition();
         answer.setOperation(operation);

-- 
To stop receiving notification emails like this one, please contact
davsclaus@apache.org.

[camel] 02/07: CAMEL-8958: Claim Check EIP with push/pop. Work in progress.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch 8958
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 148a16f2867e3fd8580e3e206817edd6737c6dd8
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Feb 5 09:38:51 2018 +0100

    CAMEL-8958: Claim Check EIP with push/pop. Work in progress.
---
 .../camel/impl/DefaultClaimCheckRepository.java    |  8 ++--
 .../apache/camel/model/ClaimCheckDefinition.java   | 40 ++++++++++++++++----
 .../processor/ClaimCheckAggregationStrategy.java   | 44 ++++++++++++++++++----
 .../camel/processor/ClaimCheckProcessor.java       |  9 +++--
 .../ClaimCheckEipGetAndRemoveSetTest.java          |  6 +--
 .../camel/processor/ClaimCheckEipGetSetTest.java   |  6 +--
 .../processor/ClaimCheckEipPushPopBodyTest.java    |  6 +--
 ...=> ClaimCheckEipPushPopHeadersPatternTest.java} | 32 ++++++++++++----
 .../processor/ClaimCheckEipPushPopHeadersTest.java |  6 +--
 .../camel/processor/ClaimCheckEipPushPopTest.java  |  6 +--
 10 files changed, 120 insertions(+), 43 deletions(-)

diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultClaimCheckRepository.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultClaimCheckRepository.java
index adac797..91e1db2 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultClaimCheckRepository.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultClaimCheckRepository.java
@@ -5,9 +5,9 @@
  * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+ *
+ *      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.
@@ -26,7 +26,7 @@ import org.apache.camel.spi.ClaimCheckRepository;
 
 public class DefaultClaimCheckRepository implements ClaimCheckRepository {
 
-    private final Map<String, Exchange> map = new HashMap();
+    private final Map<String, Exchange> map = new HashMap<>();
     private final Deque<Exchange> stack = new ArrayDeque<>();
 
     @Override
diff --git a/camel-core/src/main/java/org/apache/camel/model/ClaimCheckDefinition.java b/camel-core/src/main/java/org/apache/camel/model/ClaimCheckDefinition.java
index 8db7fab..899c317 100644
--- a/camel-core/src/main/java/org/apache/camel/model/ClaimCheckDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/ClaimCheckDefinition.java
@@ -5,9 +5,9 @@
  * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+ *
+ *      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.
@@ -16,7 +16,10 @@
  */
 package org.apache.camel.model;
 
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlTransient;
 
 import org.apache.camel.CamelContextAware;
@@ -24,9 +27,14 @@ import org.apache.camel.Processor;
 import org.apache.camel.processor.ClaimCheckProcessor;
 import org.apache.camel.processor.aggregate.AggregationStrategy;
 import org.apache.camel.processor.aggregate.AggregationStrategyBeanAdapter;
+import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.RouteContext;
+import org.apache.camel.util.EndpointHelper;
 import org.apache.camel.util.ObjectHelper;
 
+@Metadata(label = "eip,routing")
+@XmlRootElement(name = "claimCheck")
+@XmlAccessorType(XmlAccessType.FIELD)
 public class ClaimCheckDefinition extends NoOutputDefinition<ClaimCheckDefinition> {
 
     @XmlAttribute(required = true)
@@ -35,9 +43,9 @@ public class ClaimCheckDefinition extends NoOutputDefinition<ClaimCheckDefinitio
     private String key;
     @XmlAttribute
     private String data;
-    @XmlAttribute(name = "strategyRef")
+    @XmlAttribute(name = "strategyRef") @Metadata(label = "advanced")
     private String aggregationStrategyRef;
-    @XmlAttribute(name = "strategyMethodName")
+    @XmlAttribute(name = "strategyMethodName") @Metadata(label = "advanced")
     private String aggregationStrategyMethodName;
     @XmlTransient
     private AggregationStrategy aggregationStrategy;
@@ -101,7 +109,7 @@ public class ClaimCheckDefinition extends NoOutputDefinition<ClaimCheckDefinitio
     //-------------------------------------------------------------------------
 
     /**
-     * The claim check operation.
+     * The claim check operation to use.
      */
     public ClaimCheckDefinition operation(ClaimCheckOperation operation) {
         setOperation(operation);
@@ -118,18 +126,36 @@ public class ClaimCheckDefinition extends NoOutputDefinition<ClaimCheckDefinitio
 
     /**
      * What data to merge when claiming from the repository.
-     * // TODO: add more description here about the syntax
+     *
+     * The following syntax is supported:
+     * <ul>
+     *     <li>body</li> - to aggregate the message body
+     *     <li>headers</li> - to aggregate all the message headers
+     *     <li>header:pattern</li> - to aggregate all the message headers that matches the pattern.
+     *     The pattern syntax is documented by: {@link EndpointHelper#matchPattern(String, String)}.
+     * </ul>
+     * You can specify multiple rules separated by comma. For example to include the message body and all headers starting with foo
+     * <tt>body,header:foo*</tt>.
+     * If the data rule is specified as empty or as wildcard then everything is merged.
      */
     public ClaimCheckDefinition data(String data) {
         setData(data);
         return this;
     }
 
+    /**
+     * To use a custom {@link AggregationStrategy} instead of the default implementation.
+     * Notice you cannot use both custom aggregation strategy and configure data at the same time.
+     */
     public ClaimCheckDefinition aggregationStrategy(AggregationStrategy aggregationStrategy) {
         setAggregationStrategy(aggregationStrategy);
         return this;
     }
 
+    /**
+     * To use a custom {@link AggregationStrategy} instead of the default implementation.
+     * Notice you cannot use both custom aggregation strategy and configure data at the same time.
+     */
     public ClaimCheckDefinition aggregationStrategyRef(String aggregationStrategyRef) {
         setAggregationStrategyRef(aggregationStrategyRef);
         return this;
diff --git a/camel-core/src/main/java/org/apache/camel/processor/ClaimCheckAggregationStrategy.java b/camel-core/src/main/java/org/apache/camel/processor/ClaimCheckAggregationStrategy.java
index c22cde9..80b9bc0 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/ClaimCheckAggregationStrategy.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/ClaimCheckAggregationStrategy.java
@@ -5,9 +5,9 @@
  * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+ *
+ *      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.
@@ -16,14 +16,31 @@
  */
 package org.apache.camel.processor;
 
+import java.util.Map;
+
 import org.apache.camel.Exchange;
 import org.apache.camel.processor.aggregate.AggregationStrategy;
+import org.apache.camel.util.EndpointHelper;
 import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.util.StringHelper;
 
+/**
+ * Default {@link AggregationStrategy} used by the {@link ClaimCheckProcessor} EIP.
+ * <p/>
+ * This strategy supports the following data rules syntax:
+ * <ul>
+ *     <li>body</li> - to aggregate the message body
+ *     <li>headers</li> - to aggregate all the message headers
+ *     <li>header:pattern</li> - to aggregate all the message headers that matches the pattern.
+ *     The pattern syntax is documented by: {@link EndpointHelper#matchPattern(String, String)}.
+ * </ul>
+ * You can specify multiple rules separated by comma. For example to include the message body and all headers starting with foo
+ * <tt>body,header:foo*</tt>.
+ * If the data rule is specified as empty or as wildcard then everything is merged.
+ */
 public class ClaimCheckAggregationStrategy implements AggregationStrategy {
 
-    private final String data;
-    // TODO: pattern matching for headers, eg headers:foo*, headers, headers:*, header:foo,header:bar
+    private final String data; // describes what data to merge
 
     public ClaimCheckAggregationStrategy(String data) {
         this.data = data;
@@ -35,8 +52,8 @@ public class ClaimCheckAggregationStrategy implements AggregationStrategy {
             return oldExchange;
         }
 
-        if (ObjectHelper.isEmpty(data)) {
-            // grab everything if data is empty
+        if (ObjectHelper.isEmpty(data) || "*".equals(data)) {
+            // grab everything if data is empty or wildcard
             return newExchange;
         }
 
@@ -47,6 +64,19 @@ public class ClaimCheckAggregationStrategy implements AggregationStrategy {
                 oldExchange.getMessage().setBody(newExchange.getMessage().getBody());
             } else if ("headers".equals(part)) {
                 oldExchange.getMessage().getHeaders().putAll(newExchange.getMessage().getHeaders());
+            } else if (part.startsWith("header:")) {
+                // pattern matching for headers, eg header:foo, header:foo*, header:(foo|bar)
+                String after = StringHelper.after(part, "header:");
+                Iterable i = ObjectHelper.createIterable(after, ",");
+                for (Object o : i) {
+                    String pattern = o.toString();
+                    for (Map.Entry<String, Object> header : newExchange.getMessage().getHeaders().entrySet()) {
+                        String key = header.getKey();
+                        if (EndpointHelper.matchPattern(key, pattern)) {
+                            oldExchange.getMessage().getHeaders().put(key, header.getValue());
+                        }
+                    }
+                }
             }
         }
 
diff --git a/camel-core/src/main/java/org/apache/camel/processor/ClaimCheckProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/ClaimCheckProcessor.java
index a9cac9a..4ebfdf4 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/ClaimCheckProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/ClaimCheckProcessor.java
@@ -5,9 +5,9 @@
  * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+ *
+ *      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.
@@ -33,6 +33,9 @@ import org.apache.camel.util.ServiceHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+/**
+ * ClaimCheck EIP implementation.
+ */
 public class ClaimCheckProcessor extends ServiceSupport implements AsyncProcessor, IdAware, CamelContextAware {
 
     private static final Logger LOG = LoggerFactory.getLogger(ClaimCheckProcessor.class);
diff --git a/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipGetAndRemoveSetTest.java b/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipGetAndRemoveSetTest.java
index 4ba7a37..4c15369 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipGetAndRemoveSetTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipGetAndRemoveSetTest.java
@@ -5,9 +5,9 @@
  * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+ *
+ *      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.
diff --git a/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipGetSetTest.java b/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipGetSetTest.java
index 893040e..4714489 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipGetSetTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipGetSetTest.java
@@ -5,9 +5,9 @@
  * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+ *
+ *      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.
diff --git a/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopBodyTest.java b/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopBodyTest.java
index 59529bb..045a1ea 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopBodyTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopBodyTest.java
@@ -5,9 +5,9 @@
  * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+ *
+ *      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.
diff --git a/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopHeadersTest.java b/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopHeadersPatternTest.java
similarity index 66%
copy from camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopHeadersTest.java
copy to camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopHeadersPatternTest.java
index 3cf1e4f..6ab71a7 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopHeadersTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopHeadersPatternTest.java
@@ -5,9 +5,9 @@
  * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+ *
+ *      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.
@@ -16,21 +16,38 @@
  */
 package org.apache.camel.processor;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.model.ClaimCheckOperation;
 
-public class ClaimCheckEipPushPopHeadersTest extends ContextTestSupport {
+public class ClaimCheckEipPushPopHeadersPatternTest extends ContextTestSupport {
+
+    public void testPushPopHeadersPattern() throws Exception {
+        Map<String, Object> headers = new HashMap<>();
+        headers.put("foo", 123);
+        headers.put("bar", "Moes");
+        headers.put("car", "Toyota");
 
-    public void testPushPopHeaders() throws Exception {
         getMockEndpoint("mock:a").expectedBodiesReceived("Hello World");
         getMockEndpoint("mock:a").expectedHeaderReceived("foo", 123);
+        getMockEndpoint("mock:a").expectedHeaderReceived("bar", "Moes");
+        getMockEndpoint("mock:a").message(0).header("car").isEqualTo("Toyota");
+
         getMockEndpoint("mock:b").expectedBodiesReceived("Bye World");
         getMockEndpoint("mock:b").expectedHeaderReceived("foo", 456);
+        getMockEndpoint("mock:b").message(0).header("bar").isNull();
+        getMockEndpoint("mock:b").message(0).header("car").isEqualTo("Toyota");
+
         getMockEndpoint("mock:c").expectedBodiesReceived("Bye World");
         getMockEndpoint("mock:c").expectedHeaderReceived("foo", 123);
+        // bar header should be back now
+        getMockEndpoint("mock:c").expectedHeaderReceived("bar", "Moes");
+        getMockEndpoint("mock:c").message(0).header("car").isEqualTo("Toyota");
 
-        template.sendBodyAndHeader("direct:start", "Hello World", "foo", 123);
+        template.sendBodyAndHeaders("direct:start", "Hello World", headers);
 
         assertMockEndpointsSatisfied();
     }
@@ -45,9 +62,10 @@ public class ClaimCheckEipPushPopHeadersTest extends ContextTestSupport {
                     .claimCheck(ClaimCheckOperation.push)
                     .transform().constant("Bye World")
                     .setHeader("foo", constant(456))
+                    .removeHeader("bar")
                     .to("mock:b")
                     // only merge in the message headers
-                    .claimCheck(ClaimCheckOperation.pop, null, "headers")
+                    .claimCheck(ClaimCheckOperation.pop, null, "header:(foo|bar)")
                     .to("mock:c");
             }
         };
diff --git a/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopHeadersTest.java b/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopHeadersTest.java
index 3cf1e4f..354afce 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopHeadersTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopHeadersTest.java
@@ -5,9 +5,9 @@
  * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+ *
+ *      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.
diff --git a/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopTest.java b/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopTest.java
index 9e50e23..fc18b29 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopTest.java
@@ -5,9 +5,9 @@
  * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+ *
+ *      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.

-- 
To stop receiving notification emails like this one, please contact
davsclaus@apache.org.

[camel] 03/07: Regen docs

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch 8958
in repository https://gitbox.apache.org/repos/asf/camel.git

commit d83291ce33c357f516c4fbb94dc2ffa93487d6c6
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Feb 5 09:52:22 2018 +0100

    Regen docs
---
 camel-core/src/main/docs/eips/aggregate-eip.adoc            | 5 ++---
 camel-core/src/main/docs/eips/batch-config-eip.adoc         | 3 ++-
 camel-core/src/main/docs/eips/bean-eip.adoc                 | 4 ++--
 camel-core/src/main/docs/eips/choice-eip.adoc               | 4 ++--
 camel-core/src/main/docs/eips/circuitBreaker-eip.adoc       | 4 ++--
 camel-core/src/main/docs/eips/convertBodyTo-eip.adoc        | 3 ++-
 camel-core/src/main/docs/eips/customLoadBalancer-eip.adoc   | 3 ++-
 camel-core/src/main/docs/eips/delay-eip.adoc                | 3 ++-
 camel-core/src/main/docs/eips/dynamicRouter-eip.adoc        | 4 ++--
 camel-core/src/main/docs/eips/enrich-eip.adoc               | 4 ++--
 camel-core/src/main/docs/eips/filter-eip.adoc               | 3 ++-
 camel-core/src/main/docs/eips/hystrix-eip.adoc              | 3 ++-
 camel-core/src/main/docs/eips/hystrixConfiguration-eip.adoc | 3 ++-
 camel-core/src/main/docs/eips/idempotentConsumer-eip.adoc   | 3 ++-
 camel-core/src/main/docs/eips/loadBalance-eip.adoc          | 3 ++-
 camel-core/src/main/docs/eips/log-eip.adoc                  | 4 ++--
 camel-core/src/main/docs/eips/loop-eip.adoc                 | 4 ++--
 camel-core/src/main/docs/eips/random-eip.adoc               | 3 ++-
 camel-core/src/main/docs/eips/recipientList-eip.adoc        | 3 ++-
 camel-core/src/main/docs/eips/resequence-eip.adoc           | 4 ++--
 camel-core/src/main/docs/eips/routingSlip-eip.adoc          | 3 ++-
 camel-core/src/main/docs/eips/saga-eip.adoc                 | 3 ++-
 camel-core/src/main/docs/eips/sample-eip.adoc               | 4 ++--
 camel-core/src/main/docs/eips/script-eip.adoc               | 4 ++--
 camel-core/src/main/docs/eips/serviceCall-eip.adoc          | 3 ++-
 camel-core/src/main/docs/eips/sort-eip.adoc                 | 3 ++-
 camel-core/src/main/docs/eips/split-eip.adoc                | 4 ++--
 camel-core/src/main/docs/eips/stream-config-eip.adoc        | 3 ++-
 camel-core/src/main/docs/eips/throttle-eip.adoc             | 3 ++-
 camel-core/src/main/docs/eips/validate-eip.adoc             | 3 ++-
 camel-core/src/main/docs/eips/wireTap-eip.adoc              | 3 ++-
 31 files changed, 62 insertions(+), 44 deletions(-)

diff --git a/camel-core/src/main/docs/eips/aggregate-eip.adoc b/camel-core/src/main/docs/eips/aggregate-eip.adoc
index 59b8866..e484b9f 100644
--- a/camel-core/src/main/docs/eips/aggregate-eip.adoc
+++ b/camel-core/src/main/docs/eips/aggregate-eip.adoc
@@ -1,3 +1,4 @@
+[[aggregate-eip]]
 == Aggregate EIP
 
 The
@@ -656,6 +657,4 @@ public static final class MyUserAppender {
 
 Notice that the return type is a List which we want to contain the user
 names. The 1st parameter is the list of names, and then notice the 2nd
-parameter is the incoming `com.foo.User` type.
-
-
+parameter is the incoming `com.foo.User` type.
\ No newline at end of file
diff --git a/camel-core/src/main/docs/eips/batch-config-eip.adoc b/camel-core/src/main/docs/eips/batch-config-eip.adoc
index 6dd7b42..47dc2cd 100644
--- a/camel-core/src/main/docs/eips/batch-config-eip.adoc
+++ b/camel-core/src/main/docs/eips/batch-config-eip.adoc
@@ -1,3 +1,4 @@
+[[batch-config-eip]]
 == Batch-config EIP
 
 
@@ -14,4 +15,4 @@ The Batch-config EIP supports 5 options which are listed below:
 | *reverse* | Whether to reverse the ordering. | false | Boolean
 | *ignoreInvalidExchanges* | Whether to ignore invalid exchanges | false | Boolean
 |===
-// eip options: END
+// eip options: END
\ No newline at end of file
diff --git a/camel-core/src/main/docs/eips/bean-eip.adoc b/camel-core/src/main/docs/eips/bean-eip.adoc
index 54d298a..18f1ca2 100644
--- a/camel-core/src/main/docs/eips/bean-eip.adoc
+++ b/camel-core/src/main/docs/eips/bean-eip.adoc
@@ -1,3 +1,4 @@
+[[bean-eip]]
 == Bean EIP
 
 The *bean:* EIP binds beans to Camel message exchanges.
@@ -87,5 +88,4 @@ mechanisms in Camel.
 
 * link:class.html[Class] component
 * link:bean-binding.html[Bean Binding]
-* link:bean-integration.html[Bean Integration]
-
+* link:bean-integration.html[Bean Integration]
\ No newline at end of file
diff --git a/camel-core/src/main/docs/eips/choice-eip.adoc b/camel-core/src/main/docs/eips/choice-eip.adoc
index 26ab08d..c8da828 100644
--- a/camel-core/src/main/docs/eips/choice-eip.adoc
+++ b/camel-core/src/main/docs/eips/choice-eip.adoc
@@ -1,3 +1,4 @@
+[[choice-eip]]
 == Choice EIP
 
 The
@@ -70,5 +71,4 @@ And the same example using XML:
         </choice>
     </route>
 </camelContext>
-----
-
+----
\ No newline at end of file
diff --git a/camel-core/src/main/docs/eips/circuitBreaker-eip.adoc b/camel-core/src/main/docs/eips/circuitBreaker-eip.adoc
index afa4e8b..d50f185 100644
--- a/camel-core/src/main/docs/eips/circuitBreaker-eip.adoc
+++ b/camel-core/src/main/docs/eips/circuitBreaker-eip.adoc
@@ -1,3 +1,4 @@
+[[circuitBreaker-eip]]
 == Circuit Breaker EIP (deprecated)
 
 The Circuit Breaker load balancer is a stateful pattern that monitors all calls for certain exceptions. Initially the Circuit Breaker is in closed state and passes all messages. If there are failures and the threshold is reached, it moves to open state and rejects all calls until halfOpenAfter timeout is reached. After this timeout is reached, if there is a new call, it will pass and if the result is success the Circuit Breaker will move to closed state, or to open state if there was an error.
@@ -50,5 +51,4 @@ And the same example using Spring XML:
         </loadBalance>
     </route>
 </camelContext>
-----
-
+----
\ No newline at end of file
diff --git a/camel-core/src/main/docs/eips/convertBodyTo-eip.adoc b/camel-core/src/main/docs/eips/convertBodyTo-eip.adoc
index fb9f43c..4389938 100644
--- a/camel-core/src/main/docs/eips/convertBodyTo-eip.adoc
+++ b/camel-core/src/main/docs/eips/convertBodyTo-eip.adoc
@@ -1,3 +1,4 @@
+[[convertBodyTo-eip]]
 == Convert Body To EIP
 
 
@@ -11,4 +12,4 @@ The Convert Body To EIP supports 2 options which are listed below:
 | *type* | *Required* The java type to convert to |  | String
 | *charset* | To use a specific charset when converting |  | String
 |===
-// eip options: END
+// eip options: END
\ No newline at end of file
diff --git a/camel-core/src/main/docs/eips/customLoadBalancer-eip.adoc b/camel-core/src/main/docs/eips/customLoadBalancer-eip.adoc
index 89b2b0a..beca447 100644
--- a/camel-core/src/main/docs/eips/customLoadBalancer-eip.adoc
+++ b/camel-core/src/main/docs/eips/customLoadBalancer-eip.adoc
@@ -1,3 +1,4 @@
+[[customLoadBalancer-eip]]
 == Custom Load Balancer EIP
 
 You can use a custom load balancer (eg your own implementation) also.
@@ -78,4 +79,4 @@ public static class MyLoadBalancer extends LoadBalancerSupport {
         return true;
     }
 }
-----
+----
\ No newline at end of file
diff --git a/camel-core/src/main/docs/eips/delay-eip.adoc b/camel-core/src/main/docs/eips/delay-eip.adoc
index e53a137..47fcb08 100644
--- a/camel-core/src/main/docs/eips/delay-eip.adoc
+++ b/camel-core/src/main/docs/eips/delay-eip.adoc
@@ -1,3 +1,4 @@
+[[delay-eip]]
 == Delay EIP
 The Delayer Pattern allows you to delay the delivery of messages to some destination.
 
@@ -175,4 +176,4 @@ public class SomeBean {
 
 === See Also
 
-- Delay Interceptor
+- Delay Interceptor
\ No newline at end of file
diff --git a/camel-core/src/main/docs/eips/dynamicRouter-eip.adoc b/camel-core/src/main/docs/eips/dynamicRouter-eip.adoc
index 8aca048..e0535cb 100644
--- a/camel-core/src/main/docs/eips/dynamicRouter-eip.adoc
+++ b/camel-core/src/main/docs/eips/dynamicRouter-eip.adoc
@@ -1,3 +1,4 @@
+[[dynamicRouter-eip]]
 == Dynamic Router EIP
 
 The link:http://www.enterpriseintegrationpatterns.com/DynamicRouter.html[Dynamic Router] from the link:../../../../readme-eip.adoc[EIP patterns] allows you to route messages while avoiding the dependency of the router on all possible destinations while maintaining its efficiency.
@@ -157,5 +158,4 @@ public class MyDynamicRouter {
         // return the next endpoint uri, where to go. Return null to indicate the end.
     }
 }
-----
-
+----
\ No newline at end of file
diff --git a/camel-core/src/main/docs/eips/enrich-eip.adoc b/camel-core/src/main/docs/eips/enrich-eip.adoc
index a93e811..e705d2b 100644
--- a/camel-core/src/main/docs/eips/enrich-eip.adoc
+++ b/camel-core/src/main/docs/eips/enrich-eip.adoc
@@ -1,3 +1,4 @@
+[[enrich-eip]]
 == Enrich EIP
 
 Camel supports the Content Enricher from the EIP patterns using a Message Translator, an arbitrary Processor in the routing logic, or using the enrich DSL element to enrich the message.
@@ -365,5 +366,4 @@ And in XML DSL
   </pollEnrich>
   <to uri="direct:result"/>
 </route>
-----
-
+----
\ No newline at end of file
diff --git a/camel-core/src/main/docs/eips/filter-eip.adoc b/camel-core/src/main/docs/eips/filter-eip.adoc
index c4db1ab..351e583 100644
--- a/camel-core/src/main/docs/eips/filter-eip.adoc
+++ b/camel-core/src/main/docs/eips/filter-eip.adoc
@@ -1,3 +1,4 @@
+[[filter-eip]]
 == Filter EIP
 
 The http://www.enterpriseintegrationpatterns.com/Filter.html[Message
@@ -98,4 +99,4 @@ link:predicate.html[Predicate] matches (value set to `true`), and to the
 steps immediately following the link:message-filter.html[Message Filter]
 with the value set based on the results of the last
 link:message-filter.html[Message Filter] link:predicate.html[Predicate]
-evaluated.
+evaluated.
\ No newline at end of file
diff --git a/camel-core/src/main/docs/eips/hystrix-eip.adoc b/camel-core/src/main/docs/eips/hystrix-eip.adoc
index cac9da1..3cfd897 100644
--- a/camel-core/src/main/docs/eips/hystrix-eip.adoc
+++ b/camel-core/src/main/docs/eips/hystrix-eip.adoc
@@ -1,3 +1,4 @@
+[[hystrix-eip]]
 == Hystrix EIP
 
 Available as of Camel 2.18
@@ -132,4 +133,4 @@ You can also configure Hystrix globally and then refer to that configuration:
 
 === Other examples
 
-You can find an example with the source code: link:https://github.com/apache/camel/tree/master/examples/camel-example-hystrix[camel-example-hystrix].
+You can find an example with the source code: link:https://github.com/apache/camel/tree/master/examples/camel-example-hystrix[camel-example-hystrix].
\ No newline at end of file
diff --git a/camel-core/src/main/docs/eips/hystrixConfiguration-eip.adoc b/camel-core/src/main/docs/eips/hystrixConfiguration-eip.adoc
index 3963833..7a04bd8 100644
--- a/camel-core/src/main/docs/eips/hystrixConfiguration-eip.adoc
+++ b/camel-core/src/main/docs/eips/hystrixConfiguration-eip.adoc
@@ -1,3 +1,4 @@
+[[hystrixConfiguration-eip]]
 == Hystrix Configuration EIP
 
 
@@ -40,4 +41,4 @@ The Hystrix Configuration EIP supports 31 options which are listed below:
 | *threadPoolRollingNumber StatisticalWindowBuckets* | Number of buckets the rolling statistical window is broken into. This is passed into HystrixRollingNumber inside each HystrixThreadPoolMetrics instance. | 10 | Integer
 | *allowMaximumSizeToDiverge FromCoreSize* | Allows the configuration for maximumSize to take effect. That value can then be equal to or higher than coreSize | false | Boolean
 |===
-// eip options: END
+// eip options: END
\ No newline at end of file
diff --git a/camel-core/src/main/docs/eips/idempotentConsumer-eip.adoc b/camel-core/src/main/docs/eips/idempotentConsumer-eip.adoc
index d4eea3e..f5cb3f4 100644
--- a/camel-core/src/main/docs/eips/idempotentConsumer-eip.adoc
+++ b/camel-core/src/main/docs/eips/idempotentConsumer-eip.adoc
@@ -1,3 +1,4 @@
+[[idempotentConsumer-eip]]
 == Idempotent Consumer EIP
 
 The
@@ -49,4 +50,4 @@ The Idempotent Consumer EIP supports 5 options which are listed below:
 | *skipDuplicate* | Sets whether to skip duplicates or not. The default behavior is to skip duplicates. A duplicate message would have the Exchange property link org.apache.camel.ExchangeDUPLICATE_MESSAGE set to a link BooleanTRUE value. A none duplicate message will not have this property set. | true | Boolean
 | *removeOnFailure* | Sets whether to remove or keep the key on failure. The default behavior is to remove the key on failure. | true | Boolean
 |===
-// eip options: END
+// eip options: END
\ No newline at end of file
diff --git a/camel-core/src/main/docs/eips/loadBalance-eip.adoc b/camel-core/src/main/docs/eips/loadBalance-eip.adoc
index ca3f174..871c9b5 100644
--- a/camel-core/src/main/docs/eips/loadBalance-eip.adoc
+++ b/camel-core/src/main/docs/eips/loadBalance-eip.adoc
@@ -1,3 +1,4 @@
+[[loadBalance-eip]]
 == Load Balance EIP
 
 The Load Balancer Pattern allows you to delegate to one of a number of endpoints using a variety of different load balancing policies.
@@ -243,4 +244,4 @@ And the same example using Spring XML:
       <to uri="mock:z"/>
   </loadBalance>
 </route>
-----
+----
\ No newline at end of file
diff --git a/camel-core/src/main/docs/eips/log-eip.adoc b/camel-core/src/main/docs/eips/log-eip.adoc
index 153229f..3756f79 100644
--- a/camel-core/src/main/docs/eips/log-eip.adoc
+++ b/camel-core/src/main/docs/eips/log-eip.adoc
@@ -1,3 +1,4 @@
+[[log-eip]]
 == Log EIP
 
 How can I log the processing of a link:message.html[Message]?
@@ -200,5 +201,4 @@ And in XML:
 
 `org.apache.camel.processor.DefaultMaskingFormatter` is used for the masking by default.
 If you want to use a custom masking formatter, put it into registry with the name `CamelCustomLogMask`.
-Note that the masking formatter must implement `org.apache.camel.spi.MaskingFormatter`.
-
+Note that the masking formatter must implement `org.apache.camel.spi.MaskingFormatter`.
\ No newline at end of file
diff --git a/camel-core/src/main/docs/eips/loop-eip.adoc b/camel-core/src/main/docs/eips/loop-eip.adoc
index 6a80cd2..7abee7f 100644
--- a/camel-core/src/main/docs/eips/loop-eip.adoc
+++ b/camel-core/src/main/docs/eips/loop-eip.adoc
@@ -1,3 +1,4 @@
+[[loop-eip]]
 == Loop EIP
 
 The Loop allows for processing a message a number of times, possibly in a different way for each iteration. Useful mostly during testing.
@@ -169,5 +170,4 @@ And the same example in XML:
 </route>
 ----
 
-Notice in XML that the while loop is turned on using the *doWhile* attribute.
-
+Notice in XML that the while loop is turned on using the *doWhile* attribute.
\ No newline at end of file
diff --git a/camel-core/src/main/docs/eips/random-eip.adoc b/camel-core/src/main/docs/eips/random-eip.adoc
index 597bac0..a24cf64 100644
--- a/camel-core/src/main/docs/eips/random-eip.adoc
+++ b/camel-core/src/main/docs/eips/random-eip.adoc
@@ -1,6 +1,7 @@
+[[random-eip]]
 == Random EIP
 
 
 // eip options: START
 The Random EIP supports 0 options which are listed below:
-// eip options: END
+// eip options: END
\ No newline at end of file
diff --git a/camel-core/src/main/docs/eips/recipientList-eip.adoc b/camel-core/src/main/docs/eips/recipientList-eip.adoc
index c2dac10..9382324 100644
--- a/camel-core/src/main/docs/eips/recipientList-eip.adoc
+++ b/camel-core/src/main/docs/eips/recipientList-eip.adoc
@@ -1,3 +1,4 @@
+[[recipientList-eip]]
 == Recipient List EIP
 The link:http://www.enterpriseintegrationpatterns.com/RecipientList.html[Recipient List] from the EIP patterns allows you to route messages to a number of dynamically specified recipients.
 
@@ -372,4 +373,4 @@ be `InOnly` when the message is routed to the `file:outbox endpoint`.
 If you want to alter the exchange pattern permanently then use the `.setExchangePattern` option.
 
 See more details at Request Reply and Event Message EIPs.
-====
+====
\ No newline at end of file
diff --git a/camel-core/src/main/docs/eips/resequence-eip.adoc b/camel-core/src/main/docs/eips/resequence-eip.adoc
index 69a52d7..a456aea 100644
--- a/camel-core/src/main/docs/eips/resequence-eip.adoc
+++ b/camel-core/src/main/docs/eips/resequence-eip.adoc
@@ -1,3 +1,4 @@
+[[resequence-eip]]
 == Resequence EIP
 
 The link:http://www.enterpriseintegrationpatterns.com/Resequencer.html[Resequencer] from the link:https://camel.apache.org/enterprise-integration-patterns.html[EIP patterns] allows you to reorganise messages based on some comparator. +
@@ -240,5 +241,4 @@ And an example in XML
     </resequence>
   </route>
 </camelContext>
-----
-
+----
\ No newline at end of file
diff --git a/camel-core/src/main/docs/eips/routingSlip-eip.adoc b/camel-core/src/main/docs/eips/routingSlip-eip.adoc
index ed20268..4115457 100644
--- a/camel-core/src/main/docs/eips/routingSlip-eip.adoc
+++ b/camel-core/src/main/docs/eips/routingSlip-eip.adoc
@@ -1,3 +1,4 @@
+[[routingSlip-eip]]
 == Routing Slip EIP
 The Routing Slip from the link:https://camel.apache.org/enterprise-integration-patterns.html[EIP patterns] allows you to route a message consecutively through a series of processing steps where the sequence of steps is not known at design time and can vary for each message.
 
@@ -110,4 +111,4 @@ And in Spring XML its an attribute on the recipient list tag.
 For further examples of this pattern in use you could look at the routing slip test cases.
 
 === Using This Pattern
-If you would like to use this EIP Pattern then please read the Getting Started, you may also find the Architecture useful particularly the description of Endpoint and URIs. Then you could try out some of the Examples first before trying this pattern out.
+If you would like to use this EIP Pattern then please read the Getting Started, you may also find the Architecture useful particularly the description of Endpoint and URIs. Then you could try out some of the Examples first before trying this pattern out.
\ No newline at end of file
diff --git a/camel-core/src/main/docs/eips/saga-eip.adoc b/camel-core/src/main/docs/eips/saga-eip.adoc
index 935baed..db7ade9 100644
--- a/camel-core/src/main/docs/eips/saga-eip.adoc
+++ b/camel-core/src/main/docs/eips/saga-eip.adoc
@@ -1,3 +1,4 @@
+[[saga-eip]]
 == Saga EIP
 
 *Available as of Camel 2.21*
@@ -447,4 +448,4 @@ The following snipped shows an example:
   <to uri="direct:action1" />
   <to uri="direct:action2" />
 </route>
-----
+----
\ No newline at end of file
diff --git a/camel-core/src/main/docs/eips/sample-eip.adoc b/camel-core/src/main/docs/eips/sample-eip.adoc
index 10787cb..8b3dd80 100644
--- a/camel-core/src/main/docs/eips/sample-eip.adoc
+++ b/camel-core/src/main/docs/eips/sample-eip.adoc
@@ -1,3 +1,4 @@
+[[sample-eip]]
 == Sample EIP
 *Available as of Camel 2.1*
 
@@ -82,5 +83,4 @@ And since it uses a default of 1 second you can omit this configuration in case
         <to uri="mock:result"/>
     </sample>
 </route>
-----
-
+----
\ No newline at end of file
diff --git a/camel-core/src/main/docs/eips/script-eip.adoc b/camel-core/src/main/docs/eips/script-eip.adoc
index 8f08f25..abe4e92 100644
--- a/camel-core/src/main/docs/eips/script-eip.adoc
+++ b/camel-core/src/main/docs/eips/script-eip.adoc
@@ -1,3 +1,4 @@
+[[script-eip]]
 == Script EIP
 *Available as of Camel 2.16*
 
@@ -72,5 +73,4 @@ For example to load a groovy script from the classpath you need to prefix the va
 ----
 
 You can also refer to the script from the file system with `file:` instead of `classpath:`
-such as `file:/var/myscript.groovy`
-
+such as `file:/var/myscript.groovy`
\ No newline at end of file
diff --git a/camel-core/src/main/docs/eips/serviceCall-eip.adoc b/camel-core/src/main/docs/eips/serviceCall-eip.adoc
index b904604..735ff29 100644
--- a/camel-core/src/main/docs/eips/serviceCall-eip.adoc
+++ b/camel-core/src/main/docs/eips/serviceCall-eip.adoc
@@ -1,3 +1,4 @@
+[[serviceCall-eip]]
 == Service Call EIP
 *Available as of Camel 2.18*
 
@@ -608,4 +609,4 @@ If you are using Camel in an application based on Spring Cloud, you can leverage
     <!-- use the same version as your Camel core version -->
     <version>x.y.z</version>
 </dependency>
-----
+----
\ No newline at end of file
diff --git a/camel-core/src/main/docs/eips/sort-eip.adoc b/camel-core/src/main/docs/eips/sort-eip.adoc
index f6ce6a5..b435a4c 100644
--- a/camel-core/src/main/docs/eips/sort-eip.adoc
+++ b/camel-core/src/main/docs/eips/sort-eip.adoc
@@ -1,3 +1,4 @@
+[[sort-eip]]
 == Sort EIP
 
 Sort can be used to sort a message. Imagine you consume text files and before processing each file you want to be sure the content is sorted.
@@ -66,4 +67,4 @@ And to use our own comparator we can refer to it as a spring bean:
 <bean id="myReverseComparator" class="com.mycompany.MyReverseComparator"/>
 ----
 
-Besides `<simple>`, you can supply an expression using any language you like, so long as it returns a list.
+Besides `<simple>`, you can supply an expression using any language you like, so long as it returns a list.
\ No newline at end of file
diff --git a/camel-core/src/main/docs/eips/split-eip.adoc b/camel-core/src/main/docs/eips/split-eip.adoc
index c49ef55..5735ef3 100644
--- a/camel-core/src/main/docs/eips/split-eip.adoc
+++ b/camel-core/src/main/docs/eips/split-eip.adoc
@@ -1,3 +1,4 @@
+[[split-eip]]
 == Split EIP
 
 The link:http://www.enterpriseintegrationpatterns.com/patterns/messaging/Sequencer.html[Splitter] from the link:enterprise-integration-patterns.html[EIP patterns] allows you split a message into a number of pieces and process them individually.
@@ -684,5 +685,4 @@ Using this from XML DSL is just as easy as you just have to set the `shareUnitOf
 .Implementation of shared unit of work
 ====
 So in reality the unit of work is not shared as a single object instance. Instead `SubUnitOfWork` is attached to their parent, and issues callback to the parent about their status (commit or rollback). This may be refactored in Camel 3.0 where larger API changes can be done.
-====
-
+====
\ No newline at end of file
diff --git a/camel-core/src/main/docs/eips/stream-config-eip.adoc b/camel-core/src/main/docs/eips/stream-config-eip.adoc
index 53cdd07..23ffa7e 100644
--- a/camel-core/src/main/docs/eips/stream-config-eip.adoc
+++ b/camel-core/src/main/docs/eips/stream-config-eip.adoc
@@ -1,3 +1,4 @@
+[[stream-config-eip]]
 == Stream-config EIP
 
 
@@ -15,4 +16,4 @@ The Stream-config EIP supports 6 options which are listed below:
 | *comparatorRef* | To use a custom comparator |  | String
 | *rejectOld* | If true throws an exception when messages older than the last delivered message are processed | false | Boolean
 |===
-// eip options: END
+// eip options: END
\ No newline at end of file
diff --git a/camel-core/src/main/docs/eips/throttle-eip.adoc b/camel-core/src/main/docs/eips/throttle-eip.adoc
index b9d3d4c..3c2be63 100644
--- a/camel-core/src/main/docs/eips/throttle-eip.adoc
+++ b/camel-core/src/main/docs/eips/throttle-eip.adoc
@@ -1,3 +1,4 @@
+[[throttle-eip]]
 == Throttle EIP
 
 The Throttler Pattern allows you to ensure that a specific endpoint does not get overloaded, or that we don't exceed an agreed SLA with some external service.
@@ -80,4 +81,4 @@ You can let the Throttler use non blocking asynchronous delaying, which means Ca
 from("seda:a")
   .throttle(100).asyncDelayed()
   .to("seda:b");
----------------------
+---------------------
\ No newline at end of file
diff --git a/camel-core/src/main/docs/eips/validate-eip.adoc b/camel-core/src/main/docs/eips/validate-eip.adoc
index cd3cb2c..a782636 100644
--- a/camel-core/src/main/docs/eips/validate-eip.adoc
+++ b/camel-core/src/main/docs/eips/validate-eip.adoc
@@ -1,3 +1,4 @@
+[[validate-eip]]
 == Validate EIP
 *Available as of Camel 2.3* +
 
@@ -70,4 +71,4 @@ The XML DSL to validate the message header would looks like this:
 </route>
 
 <bean id="myServiceBean" class="com.mycompany.MyServiceBean"/>
-----
+----
\ No newline at end of file
diff --git a/camel-core/src/main/docs/eips/wireTap-eip.adoc b/camel-core/src/main/docs/eips/wireTap-eip.adoc
index 56ec216..1c1b5d8 100644
--- a/camel-core/src/main/docs/eips/wireTap-eip.adoc
+++ b/camel-core/src/main/docs/eips/wireTap-eip.adoc
@@ -1,3 +1,4 @@
+[[wireTap-eip]]
 == Wire Tap EIP
 
 http://www.enterpriseintegrationpatterns.com/WireTap.html[Wire Tap]
@@ -210,4 +211,4 @@ The following example sends a new message which has
 
 See details at link:multicast.html[Multicast]
 
-link:using-this-pattern.html[Using This Pattern]
+link:using-this-pattern.html[Using This Pattern]
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
davsclaus@apache.org.

[camel] 06/07: CAMEL-8958: Claim Check EIP with push/pop. Work in progress.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch 8958
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 92977add134b65801b6c940933d05542e0c29dd8
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Feb 5 14:56:23 2018 +0100

    CAMEL-8958: Claim Check EIP with push/pop. Work in progress.
---
 .../camel/processor/ClaimCheckProcessor.java       | 10 ++---
 .../SpringClaimCheckEipGetAndRemoveSetTest.java    | 29 +++++++++++++
 .../processor/SpringClaimCheckEipGetSetTest.java   | 29 +++++++++++++
 .../SpringClaimCheckEipPushPopBodyTest.java        | 29 +++++++++++++
 ...ringClaimCheckEipPushPopHeadersPatternTest.java | 29 +++++++++++++
 .../SpringClaimCheckEipPushPopHeadersTest.java     | 29 +++++++++++++
 .../processor/SpringClaimCheckEipPushPopTest.java  | 29 +++++++++++++
 .../processor/ClaimCheckEipGetAndRemoveSetTest.xml | 47 ++++++++++++++++++++++
 .../spring/processor/ClaimCheckEipGetSetTest.xml   | 47 ++++++++++++++++++++++
 .../processor/ClaimCheckEipPushPopBodyTest.xml     | 44 ++++++++++++++++++++
 .../ClaimCheckEipPushPopHeadersPatternTest.xml     | 45 +++++++++++++++++++++
 .../processor/ClaimCheckEipPushPopHeadersTest.xml  | 44 ++++++++++++++++++++
 .../spring/processor/ClaimCheckEipPushPopTest.xml  | 41 +++++++++++++++++++
 13 files changed, 447 insertions(+), 5 deletions(-)

diff --git a/camel-core/src/main/java/org/apache/camel/processor/ClaimCheckProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/ClaimCheckProcessor.java
index 4ebfdf4..4f83e53 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/ClaimCheckProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/ClaimCheckProcessor.java
@@ -112,7 +112,7 @@ public class ClaimCheckProcessor extends ServiceSupport implements AsyncProcesso
         }
 
         try {
-            if ("set".equals(operation)) {
+            if ("Set".equals(operation)) {
                 // copy exchange, and do not share the unit of work
                 Exchange copy = ExchangeHelper.createCorrelatedCopy(exchange, false);
                 boolean addedNew = repo.add(key, copy);
@@ -121,7 +121,7 @@ public class ClaimCheckProcessor extends ServiceSupport implements AsyncProcesso
                 } else {
                     LOG.debug("Override: {} -> {}", key, copy);
                 }
-            } else if ("get".equals(operation)) {
+            } else if ("Get".equals(operation)) {
                 Exchange copy = repo.get(key);
                 LOG.debug("Get: {} -> {}", key, exchange);
                 if (copy != null) {
@@ -130,7 +130,7 @@ public class ClaimCheckProcessor extends ServiceSupport implements AsyncProcesso
                         ExchangeHelper.copyResultsPreservePattern(exchange, result);
                     }
                 }
-            } else if ("getAndRemove".equals(operation)) {
+            } else if ("GetAndRemove".equals(operation)) {
                 Exchange copy = repo.getAndRemove(key);
                 LOG.debug("GetAndRemove: {} -> {}", key, exchange);
                 if (copy != null) {
@@ -141,12 +141,12 @@ public class ClaimCheckProcessor extends ServiceSupport implements AsyncProcesso
                         ExchangeHelper.copyResultsPreservePattern(exchange, result);
                     }
                 }
-            } else if ("push".equals(operation)) {
+            } else if ("Push".equals(operation)) {
                 // copy exchange, and do not share the unit of work
                 Exchange copy = ExchangeHelper.createCorrelatedCopy(exchange, false);
                 LOG.debug("Push: {} -> {}", key, copy);
                 repo.push(copy);
-            } else if ("pop".equals(operation)) {
+            } else if ("Pop".equals(operation)) {
                 Exchange copy = repo.pop();
                 LOG.debug("Pop: {} -> {}", key, exchange);
                 if (copy != null) {
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringClaimCheckEipGetAndRemoveSetTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringClaimCheckEipGetAndRemoveSetTest.java
new file mode 100644
index 0000000..77e299b
--- /dev/null
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringClaimCheckEipGetAndRemoveSetTest.java
@@ -0,0 +1,29 @@
+/**
+ * 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.spring.processor;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.processor.ClaimCheckEipGetAndRemoveSetTest;
+
+import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
+
+public class SpringClaimCheckEipGetAndRemoveSetTest extends ClaimCheckEipGetAndRemoveSetTest {
+
+    protected CamelContext createCamelContext() throws Exception {
+        return createSpringCamelContext(this, "org/apache/camel/spring/processor/ClaimCheckEipGetAndRemoveSetTest.xml");
+    }
+}
\ No newline at end of file
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringClaimCheckEipGetSetTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringClaimCheckEipGetSetTest.java
new file mode 100644
index 0000000..5495e73
--- /dev/null
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringClaimCheckEipGetSetTest.java
@@ -0,0 +1,29 @@
+/**
+ * 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.spring.processor;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.processor.ClaimCheckEipGetSetTest;
+
+import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
+
+public class SpringClaimCheckEipGetSetTest extends ClaimCheckEipGetSetTest {
+
+    protected CamelContext createCamelContext() throws Exception {
+        return createSpringCamelContext(this, "org/apache/camel/spring/processor/ClaimCheckEipGetSetTest.xml");
+    }
+}
\ No newline at end of file
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringClaimCheckEipPushPopBodyTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringClaimCheckEipPushPopBodyTest.java
new file mode 100644
index 0000000..b43586f
--- /dev/null
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringClaimCheckEipPushPopBodyTest.java
@@ -0,0 +1,29 @@
+/**
+ * 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.spring.processor;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.processor.ClaimCheckEipPushPopBodyTest;
+
+import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
+
+public class SpringClaimCheckEipPushPopBodyTest extends ClaimCheckEipPushPopBodyTest {
+
+    protected CamelContext createCamelContext() throws Exception {
+        return createSpringCamelContext(this, "org/apache/camel/spring/processor/ClaimCheckEipPushPopBodyTest.xml");
+    }
+}
\ No newline at end of file
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringClaimCheckEipPushPopHeadersPatternTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringClaimCheckEipPushPopHeadersPatternTest.java
new file mode 100644
index 0000000..11a73a3
--- /dev/null
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringClaimCheckEipPushPopHeadersPatternTest.java
@@ -0,0 +1,29 @@
+/**
+ * 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.spring.processor;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.processor.ClaimCheckEipPushPopHeadersPatternTest;
+
+import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
+
+public class SpringClaimCheckEipPushPopHeadersPatternTest extends ClaimCheckEipPushPopHeadersPatternTest {
+
+    protected CamelContext createCamelContext() throws Exception {
+        return createSpringCamelContext(this, "org/apache/camel/spring/processor/ClaimCheckEipPushPopHeadersPatternTest.xml");
+    }
+}
\ No newline at end of file
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringClaimCheckEipPushPopHeadersTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringClaimCheckEipPushPopHeadersTest.java
new file mode 100644
index 0000000..d4b6c78
--- /dev/null
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringClaimCheckEipPushPopHeadersTest.java
@@ -0,0 +1,29 @@
+/**
+ * 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.spring.processor;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.processor.ClaimCheckEipPushPopHeadersTest;
+
+import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
+
+public class SpringClaimCheckEipPushPopHeadersTest extends ClaimCheckEipPushPopHeadersTest {
+
+    protected CamelContext createCamelContext() throws Exception {
+        return createSpringCamelContext(this, "org/apache/camel/spring/processor/ClaimCheckEipPushPopHeadersTest.xml");
+    }
+}
\ No newline at end of file
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringClaimCheckEipPushPopTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringClaimCheckEipPushPopTest.java
new file mode 100644
index 0000000..cdd3d14
--- /dev/null
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringClaimCheckEipPushPopTest.java
@@ -0,0 +1,29 @@
+/**
+ * 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.spring.processor;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.processor.ClaimCheckEipPushPopTest;
+
+import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
+
+public class SpringClaimCheckEipPushPopTest extends ClaimCheckEipPushPopTest {
+
+    protected CamelContext createCamelContext() throws Exception {
+        return createSpringCamelContext(this, "org/apache/camel/spring/processor/ClaimCheckEipPushPopTest.xml");
+    }
+}
\ No newline at end of file
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ClaimCheckEipGetAndRemoveSetTest.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ClaimCheckEipGetAndRemoveSetTest.xml
new file mode 100644
index 0000000..2d5e643
--- /dev/null
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ClaimCheckEipGetAndRemoveSetTest.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+    ">
+
+  <camelContext xmlns="http://camel.apache.org/schema/spring">
+    <route>
+      <from uri="direct:start"/>
+      <to uri="mock:a"/>
+      <claimCheck operation="Set" key="foo"/>
+      <transform>
+        <constant>Bye World</constant>
+      </transform>
+      <to uri="mock:b"/>
+      <claimCheck operation="GetAndRemove" key="foo"/>
+      <to uri="mock:c"/>
+      <transform>
+        <constant>Hi World</constant>
+      </transform>
+      <to uri="mock:d"/>
+      <claimCheck operation="GetAndRemove" key="foo"/>
+      <to uri="mock:e"/>
+    </route>
+  </camelContext>
+
+</beans>
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ClaimCheckEipGetSetTest.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ClaimCheckEipGetSetTest.xml
new file mode 100644
index 0000000..8c54836
--- /dev/null
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ClaimCheckEipGetSetTest.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+    ">
+
+  <camelContext xmlns="http://camel.apache.org/schema/spring">
+    <route>
+      <from uri="direct:start"/>
+      <to uri="mock:a"/>
+      <claimCheck operation="Set" key="foo"/>
+      <transform>
+        <constant>Bye World</constant>
+      </transform>
+      <to uri="mock:b"/>
+      <claimCheck operation="Get" key="foo"/>
+      <to uri="mock:c"/>
+      <transform>
+        <constant>Hi World</constant>
+      </transform>
+      <to uri="mock:d"/>
+      <claimCheck operation="Get" key="foo"/>
+      <to uri="mock:e"/>
+    </route>
+  </camelContext>
+
+</beans>
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ClaimCheckEipPushPopBodyTest.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ClaimCheckEipPushPopBodyTest.xml
new file mode 100644
index 0000000..7abb4f8
--- /dev/null
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ClaimCheckEipPushPopBodyTest.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+    ">
+
+  <camelContext xmlns="http://camel.apache.org/schema/spring">
+    <route>
+      <from uri="direct:start"/>
+      <to uri="mock:a"/>
+      <claimCheck operation="Push"/>
+      <transform>
+        <constant>Bye World</constant>
+      </transform>
+      <setHeader headerName="foo">
+        <constant>456</constant>
+      </setHeader>
+      <to uri="mock:b"/>
+      <claimCheck operation="Pop" data="body"/>
+      <to uri="mock:c"/>
+    </route>
+  </camelContext>
+
+</beans>
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ClaimCheckEipPushPopHeadersPatternTest.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ClaimCheckEipPushPopHeadersPatternTest.xml
new file mode 100644
index 0000000..e79fdfb
--- /dev/null
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ClaimCheckEipPushPopHeadersPatternTest.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+    ">
+
+  <camelContext xmlns="http://camel.apache.org/schema/spring">
+    <route>
+      <from uri="direct:start"/>
+      <to uri="mock:a"/>
+      <claimCheck operation="Push"/>
+      <transform>
+        <constant>Bye World</constant>
+      </transform>
+      <setHeader headerName="foo">
+        <constant>456</constant>
+      </setHeader>
+      <removeHeader headerName="bar"/>
+      <to uri="mock:b"/>
+      <claimCheck operation="Pop" data="header:(foo|bar)"/>
+      <to uri="mock:c"/>
+    </route>
+  </camelContext>
+
+</beans>
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ClaimCheckEipPushPopHeadersTest.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ClaimCheckEipPushPopHeadersTest.xml
new file mode 100644
index 0000000..1210b5e
--- /dev/null
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ClaimCheckEipPushPopHeadersTest.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+    ">
+
+  <camelContext xmlns="http://camel.apache.org/schema/spring">
+    <route>
+      <from uri="direct:start"/>
+      <to uri="mock:a"/>
+      <claimCheck operation="Push"/>
+      <transform>
+        <constant>Bye World</constant>
+      </transform>
+      <setHeader headerName="foo">
+        <constant>456</constant>
+      </setHeader>
+      <to uri="mock:b"/>
+      <claimCheck operation="Pop" data="headers"/>
+      <to uri="mock:c"/>
+    </route>
+  </camelContext>
+
+</beans>
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ClaimCheckEipPushPopTest.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ClaimCheckEipPushPopTest.xml
new file mode 100644
index 0000000..049986b
--- /dev/null
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ClaimCheckEipPushPopTest.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+    ">
+
+  <camelContext xmlns="http://camel.apache.org/schema/spring">
+    <route>
+      <from uri="direct:start"/>
+      <to uri="mock:a"/>
+      <claimCheck operation="Push"/>
+      <transform>
+        <constant>Bye World</constant>
+      </transform>
+      <to uri="mock:b"/>
+      <claimCheck operation="Pop"/>
+      <to uri="mock:c"/>
+    </route>
+  </camelContext>
+
+</beans>

-- 
To stop receiving notification emails like this one, please contact
davsclaus@apache.org.

[camel] 07/07: CAMEL-8958: Claim Check EIP with push/pop. Work in progress.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch 8958
in repository https://gitbox.apache.org/repos/asf/camel.git

commit b416c74809afe430e7020d788b7e3d9fa66fdb2e
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Feb 5 15:50:58 2018 +0100

    CAMEL-8958: Claim Check EIP with push/pop. Work in progress.
---
 camel-core/src/main/docs/eips/claimCheck-eip.adoc  | 48 ++++++++++++++++++++--
 .../camel/impl/DefaultClaimCheckRepository.java    |  3 ++
 .../camel/processor/ClaimCheckProcessor.java       |  5 +++
 .../org/apache/camel/spi/ClaimCheckRepository.java |  9 ++--
 4 files changed, 59 insertions(+), 6 deletions(-)

diff --git a/camel-core/src/main/docs/eips/claimCheck-eip.adoc b/camel-core/src/main/docs/eips/claimCheck-eip.adoc
index f9d34e0..a250cff 100644
--- a/camel-core/src/main/docs/eips/claimCheck-eip.adoc
+++ b/camel-core/src/main/docs/eips/claimCheck-eip.adoc
@@ -1,6 +1,8 @@
 [[claimCheck-eip]]
 == Claim Check EIP
 
+Available as of Camel 2.21
+
 The Claim Check EIP allows you to replace message content with a claim check (a unique key),
 which can be used to retrieve the message content at a later time.
 
@@ -153,7 +155,17 @@ The following example shows the `Push` and `Pop` operations in action;
 
 [xml]
 ----
-TODO: XML example
+<route>
+  <from uri="direct:start"/>
+  <to uri="mock:a"/>
+  <claimCheck operation="Push"/>
+  <transform>
+    <constant>Bye World</constant>
+  </transform>
+  <to uri="mock:b"/>
+  <claimCheck operation="Pop"/>
+  <to uri="mock:c"/>
+</route>
 ----
 
 For example if the message body from the beginning is `Hello World` then that data is pushed on the stack of the Claim Check EIP.
@@ -164,7 +176,23 @@ Here is an example using `Get` and `Set` operations, which uses the key `foo`:
 
 [xml]
 ----
-TODO: XML example
+<route>
+  <from uri="direct:start"/>
+  <to uri="mock:a"/>
+  <claimCheck operation="Set" key="foo"/>
+  <transform>
+    <constant>Bye World</constant>
+  </transform>
+  <to uri="mock:b"/>
+  <claimCheck operation="Get" key="foo"/>
+  <to uri="mock:c"/>
+  <transform>
+    <constant>Hi World</constant>
+  </transform>
+  <to uri="mock:d"/>
+  <claimCheck operation="Get" key="foo"/>
+  <to uri="mock:e"/>
+</route>
 ----
 
 Notice how we can `Get` the same data twice using the `Get` operation as it will not remove the data. If you only want
@@ -174,5 +202,19 @@ The last example shows how to use the `data` option where we only want to get ba
 
 [xml]
 ----
-TODO: XML example
+<route>
+  <from uri="direct:start"/>
+  <to uri="mock:a"/>
+  <claimCheck operation="Push"/>
+  <transform>
+    <constant>Bye World</constant>
+  </transform>
+  <setHeader headerName="foo">
+    <constant>456</constant>
+  </setHeader>
+  <removeHeader headerName="bar"/>
+  <to uri="mock:b"/>
+  <claimCheck operation="Pop" data="header:(foo|bar)"/>
+  <to uri="mock:c"/>
+</route>
 ----
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultClaimCheckRepository.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultClaimCheckRepository.java
index 91e1db2..7f1c630 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultClaimCheckRepository.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultClaimCheckRepository.java
@@ -24,6 +24,9 @@ import java.util.Map;
 import org.apache.camel.Exchange;
 import org.apache.camel.spi.ClaimCheckRepository;
 
+/**
+ * The default {@link ClaimCheckRepository} implementation that is an in-memory storage.
+ */
 public class DefaultClaimCheckRepository implements ClaimCheckRepository {
 
     private final Map<String, Exchange> map = new HashMap<>();
diff --git a/camel-core/src/main/java/org/apache/camel/processor/ClaimCheckProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/ClaimCheckProcessor.java
index 4f83e53..9a904e9 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/ClaimCheckProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/ClaimCheckProcessor.java
@@ -35,6 +35,11 @@ import org.slf4j.LoggerFactory;
 
 /**
  * ClaimCheck EIP implementation.
+ * <p/>
+ * The current Claim Check EIP implementation in Camel is only intended for temporary memory repository. Likewise
+ * the repository is not shared among {@link Exchange}s, but a private instance is created per {@link Exchange}.
+ * This guards against concurrent and thread-safe issues. For off-memeory persistent storage of data, then use
+ * any of the many Camel components that support persistent storage, and do not use this Claim Check EIP implementation.
  */
 public class ClaimCheckProcessor extends ServiceSupport implements AsyncProcessor, IdAware, CamelContextAware {
 
diff --git a/camel-core/src/main/java/org/apache/camel/spi/ClaimCheckRepository.java b/camel-core/src/main/java/org/apache/camel/spi/ClaimCheckRepository.java
index 7292f4b..1eb133f 100644
--- a/camel-core/src/main/java/org/apache/camel/spi/ClaimCheckRepository.java
+++ b/camel-core/src/main/java/org/apache/camel/spi/ClaimCheckRepository.java
@@ -20,10 +20,13 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Service;
 
 /**
- * Access to a repository of Keys to implement the
+ * Access to a repository of keys to implement the
  * <a href="http://camel.apache.org/claim-check.html">Claim Check</a> pattern.
  * <p/>
- * The <tt>add</tt> and <tt>contains</tt> methods is operating according to the {@link java.util.Set} contract.
+ * The <tt>add</tt> and <tt>contains</tt> methods is operating according to the {@link java.util.Map} contract,
+ * and the <tt>push</tt> and <tt>pop</tt> methods is operating according to the {@link java.util.Stack} contract.
+ * <p/>
+ * See important details about the Claim Check EIP implementation in Apache Camel at {@link org.apache.camel.processor.ClaimCheckProcessor}.
  */
 public interface ClaimCheckRepository extends Service {
 
@@ -64,7 +67,7 @@ public interface ClaimCheckRepository extends Service {
     void push(Exchange exchange);
 
     /**
-     * Pops the repository and returns the latest.
+     * Pops the repository and returns the latest. Or returns <tt>null</tt> if the stack is empty.
      */
     Exchange pop();
 

-- 
To stop receiving notification emails like this one, please contact
davsclaus@apache.org.

[camel] 01/07: CAMEL-8958: Claim Check EIP with push/pop. Work in progress.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch 8958
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 8ab6a6f46e2687a5528f3843e0138a4c9f4abf9b
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sun Feb 4 14:47:25 2018 +0100

    CAMEL-8958: Claim Check EIP with push/pop. Work in progress.
---
 .../src/main/java/org/apache/camel/Exchange.java   |  17 +-
 .../camel/impl/DefaultClaimCheckRepository.java    |  81 +++++++++
 .../apache/camel/model/ClaimCheckDefinition.java   | 188 ++++++++++++++++++++
 .../apache/camel/model/ClaimCheckOperation.java    |  28 +++
 .../apache/camel/model/ProcessorDefinition.java    |  31 ++++
 .../processor/ClaimCheckAggregationStrategy.java   |  55 ++++++
 .../camel/processor/ClaimCheckProcessor.java       | 193 +++++++++++++++++++++
 .../org/apache/camel/spi/ClaimCheckRepository.java |  76 ++++++++
 .../java/org/apache/camel/util/ExchangeHelper.java |   2 +-
 .../resources/org/apache/camel/model/jaxb.index    |   2 +
 .../ClaimCheckEipGetAndRemoveSetTest.java          |  57 ++++++
 .../camel/processor/ClaimCheckEipGetSetTest.java   |  56 ++++++
 .../processor/ClaimCheckEipPushPopBodyTest.java    |  55 ++++++
 .../processor/ClaimCheckEipPushPopHeadersTest.java |  55 ++++++
 .../camel/processor/ClaimCheckEipPushPopTest.java  |  50 ++++++
 15 files changed, 937 insertions(+), 9 deletions(-)

diff --git a/camel-core/src/main/java/org/apache/camel/Exchange.java b/camel-core/src/main/java/org/apache/camel/Exchange.java
index 541ea16..6ca2ac6 100644
--- a/camel-core/src/main/java/org/apache/camel/Exchange.java
+++ b/camel-core/src/main/java/org/apache/camel/Exchange.java
@@ -97,14 +97,15 @@ public interface Exchange {
     // used across other Apache products such as AMQ, SMX etc.
     String BREADCRUMB_ID              = "breadcrumbId";
 
-    String CHARSET_NAME          = "CamelCharsetName";
-    String CIRCUIT_BREAKER_STATE = "CamelCircuitBreakerState";
-    String CREATED_TIMESTAMP     = "CamelCreatedTimestamp";
-    String CONTENT_ENCODING      = "Content-Encoding";
-    String CONTENT_LENGTH        = "Content-Length";
-    String CONTENT_TYPE          = "Content-Type";
-    String COOKIE_HANDLER        = "CamelCookieHandler";
-    String CORRELATION_ID        = "CamelCorrelationId";
+    String CHARSET_NAME           = "CamelCharsetName";
+    String CIRCUIT_BREAKER_STATE  = "CamelCircuitBreakerState";
+    String CREATED_TIMESTAMP      = "CamelCreatedTimestamp";
+    String CLAIM_CHECK_REPOSITORY = "CamelClaimCheckRepository";
+    String CONTENT_ENCODING       = "Content-Encoding";
+    String CONTENT_LENGTH         = "Content-Length";
+    String CONTENT_TYPE           = "Content-Type";
+    String COOKIE_HANDLER         = "CamelCookieHandler";
+    String CORRELATION_ID         = "CamelCorrelationId";
 
     String DATASET_INDEX             = "CamelDataSetIndex";
     String DEFAULT_CHARSET_PROPERTY  = "org.apache.camel.default.charset";
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultClaimCheckRepository.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultClaimCheckRepository.java
new file mode 100644
index 0000000..adac797
--- /dev/null
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultClaimCheckRepository.java
@@ -0,0 +1,81 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.impl;
+
+import java.util.ArrayDeque;
+import java.util.Deque;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.spi.ClaimCheckRepository;
+
+public class DefaultClaimCheckRepository implements ClaimCheckRepository {
+
+    private final Map<String, Exchange> map = new HashMap();
+    private final Deque<Exchange> stack = new ArrayDeque<>();
+
+    @Override
+    public boolean add(String key, Exchange exchange) {
+        return map.put(key, exchange) == null;
+    }
+
+    @Override
+    public boolean contains(String key) {
+        return map.containsKey(key);
+    }
+
+    @Override
+    public Exchange get(String key) {
+        return map.get(key);
+    }
+
+    @Override
+    public Exchange getAndRemove(String key) {
+        return map.remove(key);
+    }
+
+    @Override
+    public void push(Exchange exchange) {
+        stack.push(exchange);
+    }
+
+    @Override
+    public Exchange pop() {
+        if (!stack.isEmpty()) {
+            return stack.pop();
+        } else {
+            return null;
+        }
+    }
+
+    @Override
+    public void clear() {
+        map.clear();
+        stack.clear();
+    }
+
+    @Override
+    public void start() throws Exception {
+        // noop
+    }
+
+    @Override
+    public void stop() throws Exception {
+        // noop
+    }
+}
diff --git a/camel-core/src/main/java/org/apache/camel/model/ClaimCheckDefinition.java b/camel-core/src/main/java/org/apache/camel/model/ClaimCheckDefinition.java
new file mode 100644
index 0000000..8db7fab
--- /dev/null
+++ b/camel-core/src/main/java/org/apache/camel/model/ClaimCheckDefinition.java
@@ -0,0 +1,188 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.model;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlTransient;
+
+import org.apache.camel.CamelContextAware;
+import org.apache.camel.Processor;
+import org.apache.camel.processor.ClaimCheckProcessor;
+import org.apache.camel.processor.aggregate.AggregationStrategy;
+import org.apache.camel.processor.aggregate.AggregationStrategyBeanAdapter;
+import org.apache.camel.spi.RouteContext;
+import org.apache.camel.util.ObjectHelper;
+
+public class ClaimCheckDefinition extends NoOutputDefinition<ClaimCheckDefinition> {
+
+    @XmlAttribute(required = true)
+    private ClaimCheckOperation operation;
+    @XmlAttribute
+    private String key;
+    @XmlAttribute
+    private String data;
+    @XmlAttribute(name = "strategyRef")
+    private String aggregationStrategyRef;
+    @XmlAttribute(name = "strategyMethodName")
+    private String aggregationStrategyMethodName;
+    @XmlTransient
+    private AggregationStrategy aggregationStrategy;
+
+    public ClaimCheckDefinition() {
+    }
+
+    @Override
+    public String toString() {
+        return "ClaimCheck";
+    }
+
+    @Override
+    public String getLabel() {
+        return "claimCheck";
+    }
+
+    @Override
+    public Processor createProcessor(RouteContext routeContext) throws Exception {
+        ObjectHelper.notNull(operation, "operation", this);
+
+        ClaimCheckProcessor claim = new ClaimCheckProcessor();
+        claim.setOperation(operation.name());
+        claim.setKey(getKey());
+        claim.setData(getData());
+
+        AggregationStrategy strategy = createAggregationStrategy(routeContext);
+        if (strategy != null) {
+            claim.setAggregationStrategy(strategy);
+        }
+
+        // only data or aggregation strategy can be configured not both
+        if (getData() != null && strategy != null) {
+            throw new IllegalArgumentException("Cannot use both data and custom aggregation strategy on ClaimCheck EIP");
+        }
+
+        return claim;
+    }
+
+    private AggregationStrategy createAggregationStrategy(RouteContext routeContext) {
+        AggregationStrategy strategy = getAggregationStrategy();
+        if (strategy == null && aggregationStrategyRef != null) {
+            Object aggStrategy = routeContext.lookup(aggregationStrategyRef, Object.class);
+            if (aggStrategy instanceof AggregationStrategy) {
+                strategy = (AggregationStrategy) aggStrategy;
+            } else if (aggStrategy != null) {
+                strategy = new AggregationStrategyBeanAdapter(aggStrategy, getAggregationStrategyMethodName());
+            } else {
+                throw new IllegalArgumentException("Cannot find AggregationStrategy in Registry with name: " + aggregationStrategyRef);
+            }
+        }
+
+        if (strategy instanceof CamelContextAware) {
+            ((CamelContextAware) strategy).setCamelContext(routeContext.getCamelContext());
+        }
+
+        return strategy;
+    }
+
+    // Fluent API
+    //-------------------------------------------------------------------------
+
+    /**
+     * The claim check operation.
+     */
+    public ClaimCheckDefinition operation(ClaimCheckOperation operation) {
+        setOperation(operation);
+        return this;
+    }
+
+    /**
+     * To use a specific key for claim check id.
+     */
+    public ClaimCheckDefinition key(String key) {
+        setKey(key);
+        return this;
+    }
+
+    /**
+     * What data to merge when claiming from the repository.
+     * // TODO: add more description here about the syntax
+     */
+    public ClaimCheckDefinition data(String data) {
+        setData(data);
+        return this;
+    }
+
+    public ClaimCheckDefinition aggregationStrategy(AggregationStrategy aggregationStrategy) {
+        setAggregationStrategy(aggregationStrategy);
+        return this;
+    }
+
+    public ClaimCheckDefinition aggregationStrategyRef(String aggregationStrategyRef) {
+        setAggregationStrategyRef(aggregationStrategyRef);
+        return this;
+    }
+
+    // Properties
+    //-------------------------------------------------------------------------
+
+    public String getKey() {
+        return key;
+    }
+
+    public void setKey(String key) {
+        this.key = key;
+    }
+
+    public ClaimCheckOperation getOperation() {
+        return operation;
+    }
+
+    public void setOperation(ClaimCheckOperation operation) {
+        this.operation = operation;
+    }
+
+    public String getData() {
+        return data;
+    }
+
+    public void setData(String data) {
+        this.data = data;
+    }
+
+    public String getAggregationStrategyRef() {
+        return aggregationStrategyRef;
+    }
+
+    public void setAggregationStrategyRef(String aggregationStrategyRef) {
+        this.aggregationStrategyRef = aggregationStrategyRef;
+    }
+
+    public String getAggregationStrategyMethodName() {
+        return aggregationStrategyMethodName;
+    }
+
+    public void setAggregationStrategyMethodName(String aggregationStrategyMethodName) {
+        this.aggregationStrategyMethodName = aggregationStrategyMethodName;
+    }
+
+    public AggregationStrategy getAggregationStrategy() {
+        return aggregationStrategy;
+    }
+
+    public void setAggregationStrategy(AggregationStrategy aggregationStrategy) {
+        this.aggregationStrategy = aggregationStrategy;
+    }
+}
diff --git a/camel-core/src/main/java/org/apache/camel/model/ClaimCheckOperation.java b/camel-core/src/main/java/org/apache/camel/model/ClaimCheckOperation.java
new file mode 100644
index 0000000..5339351
--- /dev/null
+++ b/camel-core/src/main/java/org/apache/camel/model/ClaimCheckOperation.java
@@ -0,0 +1,28 @@
+/**
+ * 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.model;
+
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlType
+@XmlEnum
+public enum ClaimCheckOperation {
+
+    get, getAndRemove, set, push, pop
+
+}
diff --git a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
index bb74e2a..9d168b1 100644
--- a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
@@ -69,6 +69,7 @@ import org.apache.camel.processor.interceptor.StreamCaching;
 import org.apache.camel.processor.loadbalancer.LoadBalancer;
 import org.apache.camel.spi.AsEndpointUri;
 import org.apache.camel.spi.AsPredicate;
+import org.apache.camel.spi.ClaimCheckRepository;
 import org.apache.camel.spi.DataFormat;
 import org.apache.camel.spi.IdAware;
 import org.apache.camel.spi.IdempotentRepository;
@@ -3444,6 +3445,36 @@ public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type>
         return ExpressionClause.createAndSetExpression(answer);
     }
 
+    public ClaimCheckDefinition claimCheck() {
+        ClaimCheckDefinition answer = new ClaimCheckDefinition();
+        addOutput(answer);
+        return answer;
+    }
+
+    public Type claimCheck(ClaimCheckOperation operation) {
+        ClaimCheckDefinition answer = new ClaimCheckDefinition();
+        answer.setOperation(operation);
+        addOutput(answer);
+        return (Type) this;
+    }
+
+    public Type claimCheck(ClaimCheckOperation operation, String key) {
+        ClaimCheckDefinition answer = new ClaimCheckDefinition();
+        answer.setOperation(operation);
+        answer.setKey(key);
+        addOutput(answer);
+        return (Type) this;
+    }
+
+    public Type claimCheck(ClaimCheckOperation operation, String key, String data) {
+        ClaimCheckDefinition answer = new ClaimCheckDefinition();
+        answer.setOperation(operation);
+        answer.setKey(key);
+        answer.setData(data);
+        addOutput(answer);
+        return (Type) this;
+    }
+
     /**
      * The <a href="http://camel.apache.org/content-enricher.html">Content Enricher EIP</a>
      * enriches an exchange with additional data obtained from a <code>resourceUri</code>.
diff --git a/camel-core/src/main/java/org/apache/camel/processor/ClaimCheckAggregationStrategy.java b/camel-core/src/main/java/org/apache/camel/processor/ClaimCheckAggregationStrategy.java
new file mode 100644
index 0000000..c22cde9
--- /dev/null
+++ b/camel-core/src/main/java/org/apache/camel/processor/ClaimCheckAggregationStrategy.java
@@ -0,0 +1,55 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.processor;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.processor.aggregate.AggregationStrategy;
+import org.apache.camel.util.ObjectHelper;
+
+public class ClaimCheckAggregationStrategy implements AggregationStrategy {
+
+    private final String data;
+    // TODO: pattern matching for headers, eg headers:foo*, headers, headers:*, header:foo,header:bar
+
+    public ClaimCheckAggregationStrategy(String data) {
+        this.data = data;
+    }
+
+    @Override
+    public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
+        if (newExchange == null) {
+            return oldExchange;
+        }
+
+        if (ObjectHelper.isEmpty(data)) {
+            // grab everything if data is empty
+            return newExchange;
+        }
+
+        Iterable it = ObjectHelper.createIterable(data, ",");
+        for (Object k : it) {
+            String part = k.toString();
+            if ("body".equals(part)) {
+                oldExchange.getMessage().setBody(newExchange.getMessage().getBody());
+            } else if ("headers".equals(part)) {
+                oldExchange.getMessage().getHeaders().putAll(newExchange.getMessage().getHeaders());
+            }
+        }
+
+        return oldExchange;
+    }
+}
diff --git a/camel-core/src/main/java/org/apache/camel/processor/ClaimCheckProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/ClaimCheckProcessor.java
new file mode 100644
index 0000000..a9cac9a
--- /dev/null
+++ b/camel-core/src/main/java/org/apache/camel/processor/ClaimCheckProcessor.java
@@ -0,0 +1,193 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.processor;
+
+import org.apache.camel.AsyncCallback;
+import org.apache.camel.AsyncProcessor;
+import org.apache.camel.CamelContext;
+import org.apache.camel.CamelContextAware;
+import org.apache.camel.Exchange;
+import org.apache.camel.impl.DefaultClaimCheckRepository;
+import org.apache.camel.processor.aggregate.AggregationStrategy;
+import org.apache.camel.spi.ClaimCheckRepository;
+import org.apache.camel.spi.IdAware;
+import org.apache.camel.support.ServiceSupport;
+import org.apache.camel.util.AsyncProcessorHelper;
+import org.apache.camel.util.ExchangeHelper;
+import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.util.ServiceHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ClaimCheckProcessor extends ServiceSupport implements AsyncProcessor, IdAware, CamelContextAware {
+
+    private static final Logger LOG = LoggerFactory.getLogger(ClaimCheckProcessor.class);
+    private CamelContext camelContext;
+    private String id;
+    private String operation;
+    private AggregationStrategy aggregationStrategy;
+    private String key;
+    private String data;
+
+    @Override
+    public CamelContext getCamelContext() {
+        return camelContext;
+    }
+
+    @Override
+    public void setCamelContext(CamelContext camelContext) {
+        this.camelContext = camelContext;
+    }
+
+    @Override
+    public String getId() {
+        return id;
+    }
+
+    @Override
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getOperation() {
+        return operation;
+    }
+
+    public void setOperation(String operation) {
+        this.operation = operation;
+    }
+
+    public AggregationStrategy getAggregationStrategy() {
+        return aggregationStrategy;
+    }
+
+    public void setAggregationStrategy(AggregationStrategy aggregationStrategy) {
+        this.aggregationStrategy = aggregationStrategy;
+    }
+
+    public String getKey() {
+        return key;
+    }
+
+    public void setKey(String key) {
+        this.key = key;
+    }
+
+    public String getData() {
+        return data;
+    }
+
+    public void setData(String data) {
+        this.data = data;
+    }
+
+    public void process(Exchange exchange) throws Exception {
+        AsyncProcessorHelper.process(this, exchange);
+    }
+
+    @Override
+    public boolean process(Exchange exchange, AsyncCallback callback) {
+        // the repository is scoped per exchange
+        ClaimCheckRepository repo = exchange.getProperty(Exchange.CLAIM_CHECK_REPOSITORY, ClaimCheckRepository.class);
+        if (repo == null) {
+            repo = new DefaultClaimCheckRepository();
+            exchange.setProperty(Exchange.CLAIM_CHECK_REPOSITORY, repo);
+        }
+
+        try {
+            if ("set".equals(operation)) {
+                // copy exchange, and do not share the unit of work
+                Exchange copy = ExchangeHelper.createCorrelatedCopy(exchange, false);
+                boolean addedNew = repo.add(key, copy);
+                if (addedNew) {
+                    LOG.debug("Add: {} -> {}", key, copy);
+                } else {
+                    LOG.debug("Override: {} -> {}", key, copy);
+                }
+            } else if ("get".equals(operation)) {
+                Exchange copy = repo.get(key);
+                LOG.debug("Get: {} -> {}", key, exchange);
+                if (copy != null) {
+                    Exchange result = aggregationStrategy.aggregate(exchange, copy);
+                    if (result != null) {
+                        ExchangeHelper.copyResultsPreservePattern(exchange, result);
+                    }
+                }
+            } else if ("getAndRemove".equals(operation)) {
+                Exchange copy = repo.getAndRemove(key);
+                LOG.debug("GetAndRemove: {} -> {}", key, exchange);
+                if (copy != null) {
+                    // prepare the exchanges for aggregation
+                    ExchangeHelper.prepareAggregation(exchange, copy);
+                    Exchange result = aggregationStrategy.aggregate(exchange, copy);
+                    if (result != null) {
+                        ExchangeHelper.copyResultsPreservePattern(exchange, result);
+                    }
+                }
+            } else if ("push".equals(operation)) {
+                // copy exchange, and do not share the unit of work
+                Exchange copy = ExchangeHelper.createCorrelatedCopy(exchange, false);
+                LOG.debug("Push: {} -> {}", key, copy);
+                repo.push(copy);
+            } else if ("pop".equals(operation)) {
+                Exchange copy = repo.pop();
+                LOG.debug("Pop: {} -> {}", key, exchange);
+                if (copy != null) {
+                    // prepare the exchanges for aggregation
+                    ExchangeHelper.prepareAggregation(exchange, copy);
+                    Exchange result = aggregationStrategy.aggregate(exchange, copy);
+                    if (result != null) {
+                        ExchangeHelper.copyResultsPreservePattern(exchange, result);
+                    }
+                }
+            }
+        } catch (Throwable e) {
+            exchange.setException(e);
+        }
+
+        callback.done(true);
+        return true;
+    }
+
+    @Override
+    protected void doStart() throws Exception {
+        ObjectHelper.notNull(operation, "operation", this);
+
+        if (aggregationStrategy == null) {
+            aggregationStrategy = createAggregationStrategy(data);
+        }
+        if (aggregationStrategy instanceof CamelContextAware) {
+            ((CamelContextAware) aggregationStrategy).setCamelContext(camelContext);
+        }
+
+        ServiceHelper.startServices(aggregationStrategy);
+    }
+
+    @Override
+    protected void doStop() throws Exception {
+        ServiceHelper.stopServices(aggregationStrategy);
+    }
+
+    @Override
+    public String toString() {
+        return "ClaimCheck[" + operation + "]";
+    }
+
+    protected AggregationStrategy createAggregationStrategy(String data) {
+        return new ClaimCheckAggregationStrategy(data);
+    }
+}
diff --git a/camel-core/src/main/java/org/apache/camel/spi/ClaimCheckRepository.java b/camel-core/src/main/java/org/apache/camel/spi/ClaimCheckRepository.java
new file mode 100644
index 0000000..7292f4b
--- /dev/null
+++ b/camel-core/src/main/java/org/apache/camel/spi/ClaimCheckRepository.java
@@ -0,0 +1,76 @@
+/**
+ * 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.spi;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Service;
+
+/**
+ * Access to a repository of Keys to implement the
+ * <a href="http://camel.apache.org/claim-check.html">Claim Check</a> pattern.
+ * <p/>
+ * The <tt>add</tt> and <tt>contains</tt> methods is operating according to the {@link java.util.Set} contract.
+ */
+public interface ClaimCheckRepository extends Service {
+
+    /**
+     * Adds the exchange to the repository.
+     *
+     * @param key the claim check key
+     * @return <tt>true</tt> if this repository did <b>not</b> already contain the specified key
+     */
+    boolean add(String key, Exchange exchange);
+
+    /**
+     * Returns <tt>true</tt> if this repository contains the specified key.
+     *
+     * @param key the claim check key
+     * @return <tt>true</tt> if this repository contains the specified key
+     */
+    boolean contains(String key);
+
+    /**
+     * Gets the exchange from the repository.
+     *
+     * @param key the claim check key
+     */
+    Exchange get(String key);
+
+    /**
+     * Gets and removes the exchange from the repository.
+     *
+     * @param key the claim check key
+     * @return the removed exchange, or <tt>null</tt> if the key did not exists.
+     */
+    Exchange getAndRemove(String key);
+
+    /**
+     * Pushes the exchange on top of the repository.
+     */
+    void push(Exchange exchange);
+
+    /**
+     * Pops the repository and returns the latest.
+     */
+    Exchange pop();
+
+    /**
+     * Clear the repository.
+     */
+    void clear();
+
+}
diff --git a/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java b/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java
index 3e6ecb6..672523e 100644
--- a/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java
@@ -384,8 +384,8 @@ public final class ExchangeHelper {
      * Copies the <code>source</code> exchange to <code>target</code> exchange
      * preserving the {@link ExchangePattern} of <code>target</code>.
      *
-     * @param source source exchange.
      * @param result target exchange.
+     * @param source source exchange.
      */
     public static void copyResultsPreservePattern(Exchange result, Exchange source) {
 
diff --git a/camel-core/src/main/resources/org/apache/camel/model/jaxb.index b/camel-core/src/main/resources/org/apache/camel/model/jaxb.index
index 793f23b..ffe888e 100644
--- a/camel-core/src/main/resources/org/apache/camel/model/jaxb.index
+++ b/camel-core/src/main/resources/org/apache/camel/model/jaxb.index
@@ -19,6 +19,8 @@ AOPDefinition
 BeanDefinition
 CatchDefinition
 ChoiceDefinition
+ClaimCheckDefinition
+ClaimCheckOperation
 ConvertBodyDefinition
 ContextScanDefinition
 DataFormatDefinition
diff --git a/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipGetAndRemoveSetTest.java b/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipGetAndRemoveSetTest.java
new file mode 100644
index 0000000..4ba7a37
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipGetAndRemoveSetTest.java
@@ -0,0 +1,57 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.processor;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.model.ClaimCheckOperation;
+
+public class ClaimCheckEipGetAndRemoveSetTest extends ContextTestSupport {
+
+    public void testGetAndRemoveSet() throws Exception {
+        getMockEndpoint("mock:a").expectedBodiesReceived("Hello World");
+        getMockEndpoint("mock:b").expectedBodiesReceived("Bye World");
+        getMockEndpoint("mock:c").expectedBodiesReceived("Hello World");
+        getMockEndpoint("mock:d").expectedBodiesReceived("Hi World");
+        // it was removed so the data is not changed
+        getMockEndpoint("mock:e").expectedBodiesReceived("Hi World");
+
+        template.sendBody("direct:start", "Hello World");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:start")
+                    .to("mock:a")
+                    .claimCheck(ClaimCheckOperation.set, "foo")
+                    .transform().constant("Bye World")
+                    .to("mock:b")
+                    .claimCheck(ClaimCheckOperation.getAndRemove, "foo")
+                    .to("mock:c")
+                    .transform().constant("Hi World")
+                    .to("mock:d")
+                    .claimCheck(ClaimCheckOperation.getAndRemove, "foo")
+                    .to("mock:e");
+            }
+        };
+    }
+}
diff --git a/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipGetSetTest.java b/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipGetSetTest.java
new file mode 100644
index 0000000..893040e
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipGetSetTest.java
@@ -0,0 +1,56 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.processor;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.model.ClaimCheckOperation;
+
+public class ClaimCheckEipGetSetTest extends ContextTestSupport {
+
+    public void testGetSet() throws Exception {
+        getMockEndpoint("mock:a").expectedBodiesReceived("Hello World");
+        getMockEndpoint("mock:b").expectedBodiesReceived("Bye World");
+        getMockEndpoint("mock:c").expectedBodiesReceived("Hello World");
+        getMockEndpoint("mock:d").expectedBodiesReceived("Hi World");
+        getMockEndpoint("mock:e").expectedBodiesReceived("Hello World");
+
+        template.sendBody("direct:start", "Hello World");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:start")
+                    .to("mock:a")
+                    .claimCheck(ClaimCheckOperation.set, "foo")
+                    .transform().constant("Bye World")
+                    .to("mock:b")
+                    .claimCheck(ClaimCheckOperation.get, "foo")
+                    .to("mock:c")
+                    .transform().constant("Hi World")
+                    .to("mock:d")
+                    .claimCheck(ClaimCheckOperation.get, "foo")
+                    .to("mock:e");
+            }
+        };
+    }
+}
diff --git a/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopBodyTest.java b/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopBodyTest.java
new file mode 100644
index 0000000..59529bb
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopBodyTest.java
@@ -0,0 +1,55 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.processor;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.model.ClaimCheckOperation;
+
+public class ClaimCheckEipPushPopBodyTest extends ContextTestSupport {
+
+    public void testPushPopBody() throws Exception {
+        getMockEndpoint("mock:a").expectedBodiesReceived("Hello World");
+        getMockEndpoint("mock:a").expectedHeaderReceived("foo", 123);
+        getMockEndpoint("mock:b").expectedBodiesReceived("Bye World");
+        getMockEndpoint("mock:b").expectedHeaderReceived("foo", 456);
+        getMockEndpoint("mock:c").expectedBodiesReceived("Hello World");
+        getMockEndpoint("mock:c").expectedHeaderReceived("foo", 456);
+
+        template.sendBodyAndHeader("direct:start", "Hello World", "foo", 123);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:start")
+                    .to("mock:a")
+                    .claimCheck(ClaimCheckOperation.push)
+                    .transform().constant("Bye World")
+                    .setHeader("foo", constant(456))
+                    .to("mock:b")
+                    // only merge in the message body
+                    .claimCheck(ClaimCheckOperation.pop, null, "body")
+                    .to("mock:c");
+            }
+        };
+    }
+}
diff --git a/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopHeadersTest.java b/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopHeadersTest.java
new file mode 100644
index 0000000..3cf1e4f
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopHeadersTest.java
@@ -0,0 +1,55 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.processor;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.model.ClaimCheckOperation;
+
+public class ClaimCheckEipPushPopHeadersTest extends ContextTestSupport {
+
+    public void testPushPopHeaders() throws Exception {
+        getMockEndpoint("mock:a").expectedBodiesReceived("Hello World");
+        getMockEndpoint("mock:a").expectedHeaderReceived("foo", 123);
+        getMockEndpoint("mock:b").expectedBodiesReceived("Bye World");
+        getMockEndpoint("mock:b").expectedHeaderReceived("foo", 456);
+        getMockEndpoint("mock:c").expectedBodiesReceived("Bye World");
+        getMockEndpoint("mock:c").expectedHeaderReceived("foo", 123);
+
+        template.sendBodyAndHeader("direct:start", "Hello World", "foo", 123);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:start")
+                    .to("mock:a")
+                    .claimCheck(ClaimCheckOperation.push)
+                    .transform().constant("Bye World")
+                    .setHeader("foo", constant(456))
+                    .to("mock:b")
+                    // only merge in the message headers
+                    .claimCheck(ClaimCheckOperation.pop, null, "headers")
+                    .to("mock:c");
+            }
+        };
+    }
+}
diff --git a/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopTest.java b/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopTest.java
new file mode 100644
index 0000000..9e50e23
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopTest.java
@@ -0,0 +1,50 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.processor;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.model.ClaimCheckOperation;
+
+public class ClaimCheckEipPushPopTest extends ContextTestSupport {
+
+    public void testPushPop() throws Exception {
+        getMockEndpoint("mock:a").expectedBodiesReceived("Hello World");
+        getMockEndpoint("mock:b").expectedBodiesReceived("Bye World");
+        getMockEndpoint("mock:c").expectedBodiesReceived("Hello World");
+
+        template.sendBody("direct:start", "Hello World");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:start")
+                    .to("mock:a")
+                    .claimCheck(ClaimCheckOperation.push)
+                    .transform().constant("Bye World")
+                    .to("mock:b")
+                    .claimCheck(ClaimCheckOperation.pop)
+                    .to("mock:c");
+            }
+        };
+    }
+}

-- 
To stop receiving notification emails like this one, please contact
davsclaus@apache.org.

[camel] 04/07: CAMEL-8958: Claim Check EIP with push/pop. Work in progress.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch 8958
in repository https://gitbox.apache.org/repos/asf/camel.git

commit d7ccd6d67a6e84248443a9a16d488b5753d62f47
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Feb 5 09:58:20 2018 +0100

    CAMEL-8958: Claim Check EIP with push/pop. Work in progress.
---
 .../org/apache/camel/model/ClaimCheckDefinition.java | 20 ++++++++++++++++++++
 .../org/apache/camel/model/ClaimCheckOperation.java  |  5 ++++-
 .../processor/ClaimCheckEipGetAndRemoveSetTest.java  |  6 +++---
 .../camel/processor/ClaimCheckEipGetSetTest.java     |  6 +++---
 .../processor/ClaimCheckEipPushPopBodyTest.java      |  4 ++--
 .../ClaimCheckEipPushPopHeadersPatternTest.java      |  4 ++--
 .../processor/ClaimCheckEipPushPopHeadersTest.java   |  4 ++--
 .../camel/processor/ClaimCheckEipPushPopTest.java    |  4 ++--
 8 files changed, 38 insertions(+), 15 deletions(-)

diff --git a/camel-core/src/main/java/org/apache/camel/model/ClaimCheckDefinition.java b/camel-core/src/main/java/org/apache/camel/model/ClaimCheckDefinition.java
index 899c317..8b9080e 100644
--- a/camel-core/src/main/java/org/apache/camel/model/ClaimCheckDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/ClaimCheckDefinition.java
@@ -32,6 +32,10 @@ import org.apache.camel.spi.RouteContext;
 import org.apache.camel.util.EndpointHelper;
 import org.apache.camel.util.ObjectHelper;
 
+/**
+ * The Claim Check from the EIP patterns allows you to replace message content with a claim check (a unique key),
+ * which can be used to retrieve the message content at a later time.
+ */
 @Metadata(label = "eip,routing")
 @XmlRootElement(name = "claimCheck")
 @XmlAccessorType(XmlAccessType.FIELD)
@@ -110,6 +114,14 @@ public class ClaimCheckDefinition extends NoOutputDefinition<ClaimCheckDefinitio
 
     /**
      * The claim check operation to use.
+     * The following operations is supported:
+     * <ul>
+     *     <li>Get</li> - Gets (does not remove) the claim check by the given key.
+     *     <li>GetAndRemove</li> - Gets and remove the claim check by the given key.
+     *     <li>Set</li> - Sets a new (will override if key already exists) claim check with the given key.
+     *     <li>Push</li> - Sets a new claim check on the stack (does not use key).
+     *     <li>Pop</li> - Gets the latest claim check from the stack (does not use key).
+     * </ul>
      */
     public ClaimCheckDefinition operation(ClaimCheckOperation operation) {
         setOperation(operation);
@@ -161,6 +173,14 @@ public class ClaimCheckDefinition extends NoOutputDefinition<ClaimCheckDefinitio
         return this;
     }
 
+    /**
+     * This option can be used to explicit declare the method name to use, when using POJOs as the AggregationStrategy.
+     */
+    public ClaimCheckDefinition aggregationStrategyMethodName(String aggregationStrategyMethodName) {
+        setAggregationStrategyMethodName(aggregationStrategyMethodName);
+        return this;
+    }
+
     // Properties
     //-------------------------------------------------------------------------
 
diff --git a/camel-core/src/main/java/org/apache/camel/model/ClaimCheckOperation.java b/camel-core/src/main/java/org/apache/camel/model/ClaimCheckOperation.java
index 5339351..f3b3ec1 100644
--- a/camel-core/src/main/java/org/apache/camel/model/ClaimCheckOperation.java
+++ b/camel-core/src/main/java/org/apache/camel/model/ClaimCheckOperation.java
@@ -19,10 +19,13 @@ package org.apache.camel.model;
 import javax.xml.bind.annotation.XmlEnum;
 import javax.xml.bind.annotation.XmlType;
 
+/**
+ * Operations for the Claim Check EIP.
+ */
 @XmlType
 @XmlEnum
 public enum ClaimCheckOperation {
 
-    get, getAndRemove, set, push, pop
+    Get, GetAndRemove, Set, Push, Pop
 
 }
diff --git a/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipGetAndRemoveSetTest.java b/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipGetAndRemoveSetTest.java
index 4c15369..5c234a7 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipGetAndRemoveSetTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipGetAndRemoveSetTest.java
@@ -42,14 +42,14 @@ public class ClaimCheckEipGetAndRemoveSetTest extends ContextTestSupport {
             public void configure() throws Exception {
                 from("direct:start")
                     .to("mock:a")
-                    .claimCheck(ClaimCheckOperation.set, "foo")
+                    .claimCheck(ClaimCheckOperation.Set, "foo")
                     .transform().constant("Bye World")
                     .to("mock:b")
-                    .claimCheck(ClaimCheckOperation.getAndRemove, "foo")
+                    .claimCheck(ClaimCheckOperation.GetAndRemove, "foo")
                     .to("mock:c")
                     .transform().constant("Hi World")
                     .to("mock:d")
-                    .claimCheck(ClaimCheckOperation.getAndRemove, "foo")
+                    .claimCheck(ClaimCheckOperation.GetAndRemove, "foo")
                     .to("mock:e");
             }
         };
diff --git a/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipGetSetTest.java b/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipGetSetTest.java
index 4714489..96b91e0 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipGetSetTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipGetSetTest.java
@@ -41,14 +41,14 @@ public class ClaimCheckEipGetSetTest extends ContextTestSupport {
             public void configure() throws Exception {
                 from("direct:start")
                     .to("mock:a")
-                    .claimCheck(ClaimCheckOperation.set, "foo")
+                    .claimCheck(ClaimCheckOperation.Set, "foo")
                     .transform().constant("Bye World")
                     .to("mock:b")
-                    .claimCheck(ClaimCheckOperation.get, "foo")
+                    .claimCheck(ClaimCheckOperation.Get, "foo")
                     .to("mock:c")
                     .transform().constant("Hi World")
                     .to("mock:d")
-                    .claimCheck(ClaimCheckOperation.get, "foo")
+                    .claimCheck(ClaimCheckOperation.Get, "foo")
                     .to("mock:e");
             }
         };
diff --git a/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopBodyTest.java b/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopBodyTest.java
index 045a1ea..3b2a5af 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopBodyTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopBodyTest.java
@@ -42,12 +42,12 @@ public class ClaimCheckEipPushPopBodyTest extends ContextTestSupport {
             public void configure() throws Exception {
                 from("direct:start")
                     .to("mock:a")
-                    .claimCheck(ClaimCheckOperation.push)
+                    .claimCheck(ClaimCheckOperation.Push)
                     .transform().constant("Bye World")
                     .setHeader("foo", constant(456))
                     .to("mock:b")
                     // only merge in the message body
-                    .claimCheck(ClaimCheckOperation.pop, null, "body")
+                    .claimCheck(ClaimCheckOperation.Pop, null, "body")
                     .to("mock:c");
             }
         };
diff --git a/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopHeadersPatternTest.java b/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopHeadersPatternTest.java
index 6ab71a7..7e2086e 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopHeadersPatternTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopHeadersPatternTest.java
@@ -59,13 +59,13 @@ public class ClaimCheckEipPushPopHeadersPatternTest extends ContextTestSupport {
             public void configure() throws Exception {
                 from("direct:start")
                     .to("mock:a")
-                    .claimCheck(ClaimCheckOperation.push)
+                    .claimCheck(ClaimCheckOperation.Push)
                     .transform().constant("Bye World")
                     .setHeader("foo", constant(456))
                     .removeHeader("bar")
                     .to("mock:b")
                     // only merge in the message headers
-                    .claimCheck(ClaimCheckOperation.pop, null, "header:(foo|bar)")
+                    .claimCheck(ClaimCheckOperation.Pop, null, "header:(foo|bar)")
                     .to("mock:c");
             }
         };
diff --git a/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopHeadersTest.java b/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopHeadersTest.java
index 354afce..fbbf961 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopHeadersTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopHeadersTest.java
@@ -42,12 +42,12 @@ public class ClaimCheckEipPushPopHeadersTest extends ContextTestSupport {
             public void configure() throws Exception {
                 from("direct:start")
                     .to("mock:a")
-                    .claimCheck(ClaimCheckOperation.push)
+                    .claimCheck(ClaimCheckOperation.Push)
                     .transform().constant("Bye World")
                     .setHeader("foo", constant(456))
                     .to("mock:b")
                     // only merge in the message headers
-                    .claimCheck(ClaimCheckOperation.pop, null, "headers")
+                    .claimCheck(ClaimCheckOperation.Pop, null, "headers")
                     .to("mock:c");
             }
         };
diff --git a/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopTest.java b/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopTest.java
index fc18b29..ece3b64 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/ClaimCheckEipPushPopTest.java
@@ -39,10 +39,10 @@ public class ClaimCheckEipPushPopTest extends ContextTestSupport {
             public void configure() throws Exception {
                 from("direct:start")
                     .to("mock:a")
-                    .claimCheck(ClaimCheckOperation.push)
+                    .claimCheck(ClaimCheckOperation.Push)
                     .transform().constant("Bye World")
                     .to("mock:b")
-                    .claimCheck(ClaimCheckOperation.pop)
+                    .claimCheck(ClaimCheckOperation.Pop)
                     .to("mock:c");
             }
         };

-- 
To stop receiving notification emails like this one, please contact
davsclaus@apache.org.