camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r935364 - in /camel/trunk/camel-core/src: main/java/org/apache/camel/model/ main/java/org/apache/camel/processor/aggregate/ test/java/org/apache/camel/processor/aggregator/
Date Sun, 18 Apr 2010 16:59:18 GMT
Author: davsclaus
Date: Sun Apr 18 16:59:18 2010
New Revision: 935364

URL: http://svn.apache.org/viewvc?rev=935364&view=rev
Log:
Renamed option on aggregator.

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/AggregateDefinition.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregateProcessorTest.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/AggregateDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/AggregateDefinition.java?rev=935364&r1=935363&r2=935364&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/AggregateDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/AggregateDefinition.java Sun
Apr 18 16:59:18 2010
@@ -50,11 +50,11 @@ import org.apache.camel.util.concurrent.
 public class AggregateDefinition extends ProcessorDefinition<AggregateDefinition> implements
ExecutorServiceAwareDefinition<AggregateDefinition> {
     @XmlElement(name = "correlationExpression", required = true)
     private ExpressionSubElementDefinition correlationExpression;
-    @XmlElement(name = "completionPredicate", required = false)
+    @XmlElement(name = "completionPredicate")
     private ExpressionSubElementDefinition completionPredicate;
-    @XmlElement(name = "completionTimeout", required = false)
+    @XmlElement(name = "completionTimeout")
     private ExpressionSubElementDefinition completionTimeoutExpression;
-    @XmlElement(name = "completionSize", required = false)
+    @XmlElement(name = "completionSize")
     private ExpressionSubElementDefinition completionSizeExpression;
     @XmlTransient
     private ExpressionDefinition expression;
@@ -66,27 +66,27 @@ public class AggregateDefinition extends
     private ExecutorService executorService;
     @XmlTransient
     private AggregationRepository aggregationRepository;
-    @XmlAttribute(required = false)
+    @XmlAttribute
     private Boolean parallelProcessing;
-    @XmlAttribute(required = false)
+    @XmlAttribute
     private String executorServiceRef;
-    @XmlAttribute(required = false)
+    @XmlAttribute
     private String aggregationRepositoryRef;
-    @XmlAttribute(required = true)
+    @XmlAttribute
     private String strategyRef;
-    @XmlAttribute(required = false)
+    @XmlAttribute
     private Integer completionSize;
-    @XmlAttribute(required = false)
+    @XmlAttribute
     private Long completionTimeout;
-    @XmlAttribute(required = false)
+    @XmlAttribute
     private Boolean completionFromBatchConsumer;
-    @XmlAttribute(required = false)
+    @XmlAttribute
     private Boolean groupExchanges;
-    @XmlAttribute(required = false)
+    @XmlAttribute
     private Boolean eagerCheckCompletion;
-    @XmlAttribute(required = false)
+    @XmlAttribute
     private Boolean ignoreInvalidCorrelationKeys;
-    @XmlAttribute(required = false)
+    @XmlAttribute
     private Integer closeCorrelationKeyOnCompletion;
 
     public AggregateDefinition() {
@@ -194,7 +194,7 @@ public class AggregateDefinition extends
             answer.setEagerCheckCompletion(isEagerCheckCompletion());
         }
         if (isIgnoreInvalidCorrelationKeys() != null) {
-            answer.setIgnoreBadCorrelationKeys(isIgnoreInvalidCorrelationKeys());
+            answer.setIgnoreInvalidCorrelationKeys(isIgnoreInvalidCorrelationKeys());
         }
         if (getCloseCorrelationKeyOnCompletion() != null) {
             answer.setCloseCorrelationKeyOnCompletion(getCloseCorrelationKeyOnCompletion());
@@ -208,10 +208,15 @@ public class AggregateDefinition extends
         if (strategy == null && strategyRef != null) {
             strategy = routeContext.lookup(strategyRef, AggregationStrategy.class);
         }
-        if (strategy == null && groupExchanges != null && groupExchanges)
{
+
+        if (groupExchanges != null && groupExchanges) {
+            if (strategy != null || strategyRef != null) {
+                throw new IllegalArgumentException("Options groupExchanges and AggregationStrategy
cannot be enabled at the same time");
+            }
             // if grouped exchange is enabled then use special strategy for that
             strategy = new GroupedExchangeAggregationStrategy();
         }
+
         if (strategy == null) {
             throw new IllegalArgumentException("AggregationStrategy or AggregationStrategyRef
must be set on " + this);
         }

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java?rev=935364&r1=935363&r2=935364&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java
Sun Apr 18 16:59:18 2010
@@ -100,7 +100,7 @@ public class AggregateProcessor extends 
     }
 
     // options
-    private boolean ignoreBadCorrelationKeys;
+    private boolean ignoreInvalidCorrelationKeys;
     private Integer closeCorrelationKeyOnCompletion;
     private boolean parallelProcessing;
 
@@ -156,7 +156,7 @@ public class AggregateProcessor extends 
         String key = correlationExpression.evaluate(exchange, String.class);
         if (ObjectHelper.isEmpty(key)) {
             // we have a bad correlation key
-            if (isIgnoreBadCorrelationKeys()) {
+            if (isIgnoreInvalidCorrelationKeys()) {
                 if (LOG.isDebugEnabled()) {
                     LOG.debug("Invalid correlation key. This Exchange will be ignored: "
+ exchange);
                 }
@@ -436,12 +436,12 @@ public class AggregateProcessor extends 
         this.completionSizeExpression = completionSizeExpression;
     }
 
-    public boolean isIgnoreBadCorrelationKeys() {
-        return ignoreBadCorrelationKeys;
+    public boolean isIgnoreInvalidCorrelationKeys() {
+        return ignoreInvalidCorrelationKeys;
     }
 
-    public void setIgnoreBadCorrelationKeys(boolean ignoreBadCorrelationKeys) {
-        this.ignoreBadCorrelationKeys = ignoreBadCorrelationKeys;
+    public void setIgnoreInvalidCorrelationKeys(boolean ignoreInvalidCorrelationKeys) {
+        this.ignoreInvalidCorrelationKeys = ignoreInvalidCorrelationKeys;
     }
 
     public Integer getCloseCorrelationKeyOnCompletion() {

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregateProcessorTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregateProcessorTest.java?rev=935364&r1=935363&r2=935364&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregateProcessorTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregateProcessorTest.java
Sun Apr 18 16:59:18 2010
@@ -236,7 +236,7 @@ public class AggregateProcessorTest exte
         ap.stop();
     }
 
-    public void testAggregateIgnoreBadCorrelationKey() throws Exception {
+    public void testAggregateIgnoreInvalidCorrelationKey() throws Exception {
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedBodiesReceived("A+C+END");
 
@@ -247,7 +247,7 @@ public class AggregateProcessorTest exte
 
         AggregateProcessor ap = new AggregateProcessor(context, done, corr, as, executorService);
         ap.setCompletionPredicate(complete);
-        ap.setIgnoreBadCorrelationKeys(true);
+        ap.setIgnoreInvalidCorrelationKeys(true);
 
         ap.start();
 
@@ -312,7 +312,7 @@ public class AggregateProcessorTest exte
             ap.process(e2);
             fail("Should have thrown an exception");
         } catch (CamelExchangeException e) {
-            assertEquals("Correlation key could not be evaluated to a value. Exchange[Message:
B]", e.getMessage());
+            assertEquals("Invalid correlation key. Exchange[Message: B]", e.getMessage());
         }
 
         ap.process(e3);



Mime
View raw message