camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [3/4] git commit: CAMEL-6650: AggregationStrategy - Allow to use a pojo with no Camel API dependencies. Work in progress.
Date Tue, 20 Aug 2013 07:39:11 GMT
CAMEL-6650: AggregationStrategy - Allow to use a pojo with no Camel API dependencies. Work
in progress.


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

Branch: refs/heads/master
Commit: b2d5e3fd205c7477a6b2523b2190be20ca4c0c6f
Parents: aea2127
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Mon Aug 19 16:56:07 2013 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Tue Aug 20 08:29:58 2013 +0200

----------------------------------------------------------------------
 .../apache/camel/model/AggregateDefinition.java | 14 ++++++++++
 .../apache/camel/model/EnrichDefinition.java    |  6 ++++
 .../apache/camel/model/MulticastDefinition.java |  6 ++++
 .../camel/model/PollEnrichDefinition.java       |  6 ++++
 .../camel/model/RecipientListDefinition.java    |  6 ++++
 .../org/apache/camel/model/SplitDefinition.java |  6 ++++
 .../util/toolbox/AggregationStrategies.java     | 29 ++++++++++++++++++++
 ...tegyBeanAdapterAllowNullOldExchangeTest.java |  1 -
 ...nStrategyBeanAdapterNonStaticMethodTest.java |  8 ++----
 ...egationStrategyBeanAdapterOneMethodTest.java |  7 ++---
 ...apterPollEnrichAllowNullNewExchangeTest.java |  1 -
 ...gationStrategyBeanAdapterPollEnrichTest.java |  8 ++----
 ...tionStrategyBeanAdapterStaticMethodTest.java |  8 ++----
 .../AggregationStrategyBeanAdapterTest.java     |  6 ++--
 ...BeanAdapterWithHeadersAndPropertiesTest.java |  7 ++---
 ...ationStrategyBeanAdapterWithHeadersTest.java |  6 ++--
 16 files changed, 87 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/b2d5e3fd/camel-core/src/main/java/org/apache/camel/model/AggregateDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/AggregateDefinition.java b/camel-core/src/main/java/org/apache/camel/model/AggregateDefinition.java
index 62cf08d..709fe92 100644
--- a/camel-core/src/main/java/org/apache/camel/model/AggregateDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/AggregateDefinition.java
@@ -28,6 +28,7 @@ import javax.xml.bind.annotation.XmlElementRef;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlTransient;
 
+import org.apache.camel.CamelContextAware;
 import org.apache.camel.Expression;
 import org.apache.camel.Predicate;
 import org.apache.camel.Processor;
@@ -305,6 +306,11 @@ public class AggregateDefinition extends ProcessorDefinition<AggregateDefinition
         if (strategy == null) {
             throw new IllegalArgumentException("AggregationStrategy or AggregationStrategyRef
must be set on " + this);
         }
+
+        if (strategy instanceof CamelContextAware) {
+            ((CamelContextAware) strategy).setCamelContext(routeContext.getCamelContext());
+        }
+
         return strategy;
     }
 
@@ -476,6 +482,14 @@ public class AggregateDefinition extends ProcessorDefinition<AggregateDefinition
         this.strategyRef = strategyRef;
     }
 
+    public String getStrategyMethodName() {
+        return strategyMethodName;
+    }
+
+    public void setStrategyMethodName(String strategyMethodName) {
+        this.strategyMethodName = strategyMethodName;
+    }
+
     public Boolean getEagerCheckCompletion() {
         return eagerCheckCompletion;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/b2d5e3fd/camel-core/src/main/java/org/apache/camel/model/EnrichDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/EnrichDefinition.java b/camel-core/src/main/java/org/apache/camel/model/EnrichDefinition.java
index bcb6f01..88f79d8 100644
--- a/camel-core/src/main/java/org/apache/camel/model/EnrichDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/EnrichDefinition.java
@@ -22,6 +22,7 @@ import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlTransient;
 
+import org.apache.camel.CamelContextAware;
 import org.apache.camel.Endpoint;
 import org.apache.camel.Processor;
 import org.apache.camel.processor.Enricher;
@@ -118,6 +119,11 @@ public class EnrichDefinition extends NoOutputDefinition<EnrichDefinition>
{
                 throw new IllegalArgumentException("Cannot find AggregationStrategy in Registry
with name: " + aggregationStrategyRef);
             }
         }
+
+        if (strategy != null && strategy instanceof CamelContextAware) {
+            ((CamelContextAware) strategy).setCamelContext(routeContext.getCamelContext());
+        }
+
         return strategy;
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/b2d5e3fd/camel-core/src/main/java/org/apache/camel/model/MulticastDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/MulticastDefinition.java b/camel-core/src/main/java/org/apache/camel/model/MulticastDefinition.java
index c9a152e..291bace 100644
--- a/camel-core/src/main/java/org/apache/camel/model/MulticastDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/MulticastDefinition.java
@@ -24,6 +24,7 @@ import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlTransient;
 
+import org.apache.camel.CamelContextAware;
 import org.apache.camel.Processor;
 import org.apache.camel.processor.CamelInternalProcessor;
 import org.apache.camel.processor.MulticastProcessor;
@@ -261,6 +262,11 @@ public class MulticastDefinition extends OutputDefinition<MulticastDefinition>
i
                 throw new IllegalArgumentException("Cannot find AggregationStrategy in Registry
with name: " + strategyRef);
             }
         }
+
+        if (strategy != null && strategy instanceof CamelContextAware) {
+            ((CamelContextAware) strategy).setCamelContext(routeContext.getCamelContext());
+        }
+
         return strategy;
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/b2d5e3fd/camel-core/src/main/java/org/apache/camel/model/PollEnrichDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/PollEnrichDefinition.java b/camel-core/src/main/java/org/apache/camel/model/PollEnrichDefinition.java
index 38310a6..ede7fea 100644
--- a/camel-core/src/main/java/org/apache/camel/model/PollEnrichDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/PollEnrichDefinition.java
@@ -22,6 +22,7 @@ import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlTransient;
 
+import org.apache.camel.CamelContextAware;
 import org.apache.camel.Endpoint;
 import org.apache.camel.Processor;
 import org.apache.camel.processor.PollEnricher;
@@ -124,6 +125,11 @@ public class PollEnrichDefinition extends NoOutputDefinition<PollEnrichDefinitio
                 throw new IllegalArgumentException("Cannot find AggregationStrategy in Registry
with name: " + aggregationStrategyRef);
             }
         }
+
+        if (strategy != null && strategy instanceof CamelContextAware) {
+            ((CamelContextAware) strategy).setCamelContext(routeContext.getCamelContext());
+        }
+
         return strategy;
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/b2d5e3fd/camel-core/src/main/java/org/apache/camel/model/RecipientListDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/RecipientListDefinition.java
b/camel-core/src/main/java/org/apache/camel/model/RecipientListDefinition.java
index ee99d55..e6f6ce8 100644
--- a/camel-core/src/main/java/org/apache/camel/model/RecipientListDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/RecipientListDefinition.java
@@ -26,6 +26,7 @@ import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlTransient;
 
+import org.apache.camel.CamelContextAware;
 import org.apache.camel.Expression;
 import org.apache.camel.Processor;
 import org.apache.camel.model.language.ExpressionDefinition;
@@ -181,6 +182,11 @@ public class RecipientListDefinition<Type extends ProcessorDefinition<Type>>
ext
             // fallback to use latest
             strategy = new UseLatestAggregationStrategy();
         }
+
+        if (strategy instanceof CamelContextAware) {
+            ((CamelContextAware) strategy).setCamelContext(routeContext.getCamelContext());
+        }
+
         return strategy;
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/b2d5e3fd/camel-core/src/main/java/org/apache/camel/model/SplitDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/SplitDefinition.java b/camel-core/src/main/java/org/apache/camel/model/SplitDefinition.java
index 77d55d3..d723e20 100644
--- a/camel-core/src/main/java/org/apache/camel/model/SplitDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/SplitDefinition.java
@@ -24,6 +24,7 @@ import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlTransient;
 
+import org.apache.camel.CamelContextAware;
 import org.apache.camel.Expression;
 import org.apache.camel.Processor;
 import org.apache.camel.model.language.ExpressionDefinition;
@@ -135,6 +136,11 @@ public class SplitDefinition extends ExpressionNode implements ExecutorServiceAw
                 throw new IllegalArgumentException("Cannot find AggregationStrategy in Registry
with name: " + strategyRef);
             }
         }
+
+        if (strategy != null && strategy instanceof CamelContextAware) {
+            ((CamelContextAware) strategy).setCamelContext(routeContext.getCamelContext());
+        }
+
         return strategy;
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/b2d5e3fd/camel-core/src/main/java/org/apache/camel/util/toolbox/AggregationStrategies.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/toolbox/AggregationStrategies.java
b/camel-core/src/main/java/org/apache/camel/util/toolbox/AggregationStrategies.java
index 9db38f8..9560ccd 100644
--- a/camel-core/src/main/java/org/apache/camel/util/toolbox/AggregationStrategies.java
+++ b/camel-core/src/main/java/org/apache/camel/util/toolbox/AggregationStrategies.java
@@ -17,6 +17,7 @@
 package org.apache.camel.util.toolbox;
 
 import org.apache.camel.processor.aggregate.AggregationStrategy;
+import org.apache.camel.processor.aggregate.AggregationStrategyBeanAdapter;
 import org.apache.camel.processor.aggregate.GroupedExchangeAggregationStrategy;
 import org.apache.camel.processor.aggregate.UseLatestAggregationStrategy;
 
@@ -63,4 +64,32 @@ public final class AggregationStrategies {
         return new GroupedExchangeAggregationStrategy();
     }
 
+    /**
+     * Creates a {@link AggregationStrategyBeanAdapter} for using a POJO as the aggregration
strategy.
+     */
+    public static AggregationStrategy bean(Object bean) {
+        return new AggregationStrategyBeanAdapter(bean);
+    }
+
+    /**
+     * Creates a {@link AggregationStrategyBeanAdapter} for using a POJO as the aggregration
strategy.
+     */
+    public static AggregationStrategy bean(Object bean, String methodName) {
+        return new AggregationStrategyBeanAdapter(bean, methodName);
+    }
+
+    /**
+     * Creates a {@link AggregationStrategyBeanAdapter} for using a POJO as the aggregration
strategy.
+     */
+    public static AggregationStrategy bean(Class<?> type) {
+        return new AggregationStrategyBeanAdapter(type);
+    }
+
+    /**
+     * Creates a {@link AggregationStrategyBeanAdapter} for using a POJO as the aggregration
strategy.
+     */
+    public static AggregationStrategy bean(Class<?> type, String methodName) {
+        return new AggregationStrategyBeanAdapter(type, methodName);
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/b2d5e3fd/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterAllowNullOldExchangeTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterAllowNullOldExchangeTest.java
b/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterAllowNullOldExchangeTest.java
index 668ef03..ea55b22 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterAllowNullOldExchangeTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterAllowNullOldExchangeTest.java
@@ -41,7 +41,6 @@ public class AggregationStrategyBeanAdapterAllowNullOldExchangeTest extends
Cont
             @Override
             public void configure() throws Exception {
                 myStrategy = new AggregationStrategyBeanAdapter(appender, "append");
-                myStrategy.setCamelContext(getContext());
                 myStrategy.setAllowNullOldExchange(true);
 
                 from("direct:start")

http://git-wip-us.apache.org/repos/asf/camel/blob/b2d5e3fd/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterNonStaticMethodTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterNonStaticMethodTest.java
b/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterNonStaticMethodTest.java
index abf633d..f1a187e 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterNonStaticMethodTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterNonStaticMethodTest.java
@@ -19,11 +19,10 @@ package org.apache.camel.processor.aggregator;
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.processor.aggregate.AggregationStrategyBeanAdapter;
+import org.apache.camel.util.toolbox.AggregationStrategies;
 
 public class AggregationStrategyBeanAdapterNonStaticMethodTest extends ContextTestSupport
{
 
-    private AggregationStrategyBeanAdapter myStrategy;
-
     public void testAggregate() throws Exception {
         getMockEndpoint("mock:result").expectedBodiesReceived("ABC");
 
@@ -39,11 +38,8 @@ public class AggregationStrategyBeanAdapterNonStaticMethodTest extends
ContextTe
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                myStrategy = new AggregationStrategyBeanAdapter(MyBodyAppender.class, "append");
-                myStrategy.setCamelContext(getContext());
-
                 from("direct:start")
-                    .aggregate(constant(true), myStrategy)
+                    .aggregate(constant(true), AggregationStrategies.bean(MyBodyAppender.class,
"append"))
                         .completionSize(3)
                         .to("mock:result");
             }

http://git-wip-us.apache.org/repos/asf/camel/blob/b2d5e3fd/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterOneMethodTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterOneMethodTest.java
b/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterOneMethodTest.java
index f4c8576..efab924 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterOneMethodTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterOneMethodTest.java
@@ -19,11 +19,11 @@ package org.apache.camel.processor.aggregator;
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.processor.aggregate.AggregationStrategyBeanAdapter;
+import org.apache.camel.util.toolbox.AggregationStrategies;
 
 public class AggregationStrategyBeanAdapterOneMethodTest extends ContextTestSupport {
 
     private MyBodyAppender appender = new MyBodyAppender();
-    private AggregationStrategyBeanAdapter myStrategy;
 
     public void testAggregate() throws Exception {
         getMockEndpoint("mock:result").expectedBodiesReceived("ABC");
@@ -40,11 +40,8 @@ public class AggregationStrategyBeanAdapterOneMethodTest extends ContextTestSupp
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                myStrategy = new AggregationStrategyBeanAdapter(appender);
-                myStrategy.setCamelContext(getContext());
-
                 from("direct:start")
-                    .aggregate(constant(true), myStrategy)
+                    .aggregate(constant(true), AggregationStrategies.bean(appender))
                         .completionSize(3)
                         .to("mock:result");
             }

http://git-wip-us.apache.org/repos/asf/camel/blob/b2d5e3fd/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterPollEnrichAllowNullNewExchangeTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterPollEnrichAllowNullNewExchangeTest.java
b/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterPollEnrichAllowNullNewExchangeTest.java
index 54ffabe..5db6dbe 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterPollEnrichAllowNullNewExchangeTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterPollEnrichAllowNullNewExchangeTest.java
@@ -39,7 +39,6 @@ public class AggregationStrategyBeanAdapterPollEnrichAllowNullNewExchangeTest
ex
             @Override
             public void configure() throws Exception {
                 myStrategy = new AggregationStrategyBeanAdapter(appender, "append");
-                myStrategy.setCamelContext(getContext());
                 myStrategy.setAllowNullNewExchange(true);
 
                 from("direct:start")

http://git-wip-us.apache.org/repos/asf/camel/blob/b2d5e3fd/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterPollEnrichTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterPollEnrichTest.java
b/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterPollEnrichTest.java
index 07deb8f..d1f4679 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterPollEnrichTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterPollEnrichTest.java
@@ -18,12 +18,11 @@ package org.apache.camel.processor.aggregator;
 
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.processor.aggregate.AggregationStrategyBeanAdapter;
+import org.apache.camel.util.toolbox.AggregationStrategies;
 
 public class AggregationStrategyBeanAdapterPollEnrichTest extends ContextTestSupport {
 
     private MyBodyAppender appender = new MyBodyAppender();
-    private AggregationStrategyBeanAdapter myStrategy;
 
     public void testNoData() throws Exception {
         getMockEndpoint("mock:result").expectedBodiesReceived("A");
@@ -48,11 +47,8 @@ public class AggregationStrategyBeanAdapterPollEnrichTest extends ContextTestSup
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                myStrategy = new AggregationStrategyBeanAdapter(appender, "append");
-                myStrategy.setCamelContext(getContext());
-
                 from("direct:start")
-                    .pollEnrich("seda:foo", 100, myStrategy)
+                    .pollEnrich("seda:foo", 100, AggregationStrategies.bean(appender))
                         .to("mock:result");
             }
         };

http://git-wip-us.apache.org/repos/asf/camel/blob/b2d5e3fd/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterStaticMethodTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterStaticMethodTest.java
b/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterStaticMethodTest.java
index 16ed73c..bf517b9 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterStaticMethodTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterStaticMethodTest.java
@@ -19,11 +19,10 @@ package org.apache.camel.processor.aggregator;
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.processor.aggregate.AggregationStrategyBeanAdapter;
+import org.apache.camel.util.toolbox.AggregationStrategies;
 
 public class AggregationStrategyBeanAdapterStaticMethodTest extends ContextTestSupport {
 
-    private AggregationStrategyBeanAdapter myStrategy;
-
     public void testAggregate() throws Exception {
         getMockEndpoint("mock:result").expectedBodiesReceived("ABC");
 
@@ -39,11 +38,8 @@ public class AggregationStrategyBeanAdapterStaticMethodTest extends ContextTestS
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                myStrategy = new AggregationStrategyBeanAdapter(MyBodyAppender.class, "append");
-                myStrategy.setCamelContext(getContext());
-
                 from("direct:start")
-                    .aggregate(constant(true), myStrategy)
+                    .aggregate(constant(true), AggregationStrategies.bean(MyBodyAppender.class,
"append"))
                         .completionSize(3)
                         .to("mock:result");
             }

http://git-wip-us.apache.org/repos/asf/camel/blob/b2d5e3fd/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterTest.java
b/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterTest.java
index cd47f1f..04c448c 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterTest.java
@@ -19,6 +19,7 @@ package org.apache.camel.processor.aggregator;
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.processor.aggregate.AggregationStrategyBeanAdapter;
+import org.apache.camel.util.toolbox.AggregationStrategies;
 
 public class AggregationStrategyBeanAdapterTest extends ContextTestSupport {
 
@@ -40,11 +41,8 @@ public class AggregationStrategyBeanAdapterTest extends ContextTestSupport
{
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                myStrategy = new AggregationStrategyBeanAdapter(appender, "append");
-                myStrategy.setCamelContext(getContext());
-
                 from("direct:start")
-                    .aggregate(constant(true), myStrategy)
+                    .aggregate(constant(true), AggregationStrategies.bean(appender, "append"))
                         .completionSize(3)
                         .to("mock:result");
             }

http://git-wip-us.apache.org/repos/asf/camel/blob/b2d5e3fd/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterWithHeadersAndPropertiesTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterWithHeadersAndPropertiesTest.java
b/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterWithHeadersAndPropertiesTest.java
index 49688d5..d5227d0 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterWithHeadersAndPropertiesTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterWithHeadersAndPropertiesTest.java
@@ -21,11 +21,11 @@ import java.util.Map;
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.processor.aggregate.AggregationStrategyBeanAdapter;
+import org.apache.camel.util.toolbox.AggregationStrategies;
 
 public class AggregationStrategyBeanAdapterWithHeadersAndPropertiesTest extends ContextTestSupport
{
 
     private MyBodyAppender appender = new MyBodyAppender();
-    private AggregationStrategyBeanAdapter myStrategy;
 
     public void testAggregate() throws Exception {
         getMockEndpoint("mock:result").expectedBodiesReceived("ABC");
@@ -44,12 +44,9 @@ public class AggregationStrategyBeanAdapterWithHeadersAndPropertiesTest
extends
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                myStrategy = new AggregationStrategyBeanAdapter(appender, "appendWithHeadersAndProperties");
-                myStrategy.setCamelContext(getContext());
-
                 from("direct:start")
                     .setHeader("foo", constant("yes"))
-                    .aggregate(constant(true), myStrategy)
+                    .aggregate(constant(true), AggregationStrategies.bean(appender, "appendWithHeadersAndProperties"))
                         .completionSize(3)
                         .to("mock:result");
             }

http://git-wip-us.apache.org/repos/asf/camel/blob/b2d5e3fd/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterWithHeadersTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterWithHeadersTest.java
b/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterWithHeadersTest.java
index 4230050..0e46159 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterWithHeadersTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterWithHeadersTest.java
@@ -21,6 +21,7 @@ import java.util.Map;
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.processor.aggregate.AggregationStrategyBeanAdapter;
+import org.apache.camel.util.toolbox.AggregationStrategies;
 
 public class AggregationStrategyBeanAdapterWithHeadersTest extends ContextTestSupport {
 
@@ -43,11 +44,8 @@ public class AggregationStrategyBeanAdapterWithHeadersTest extends ContextTestSu
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                myStrategy = new AggregationStrategyBeanAdapter(appender, "appendWithHeaders");
-                myStrategy.setCamelContext(getContext());
-
                 from("direct:start")
-                    .aggregate(constant(true), myStrategy)
+                    .aggregate(constant(true), AggregationStrategies.bean(appender, "appendWithHeaders"))
                         .completionSize(3)
                         .to("mock:result");
             }


Mime
View raw message