camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r747084 - in /camel/trunk/camel-core/src: main/java/org/apache/camel/ main/java/org/apache/camel/processor/aggregate/ test/java/org/apache/camel/processor/ test/java/org/apache/camel/processor/aggregator/
Date Mon, 23 Feb 2009 17:06:16 GMT
Author: davsclaus
Date: Mon Feb 23 17:06:15 2009
New Revision: 747084

URL: http://svn.apache.org/viewvc?rev=747084&view=rev
Log:
Renamed a exchange header for aggregator. Unit test run faster as changing delay to 25 millis
instead of 1 sec.

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/DefaultAggregationCollection.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/BodyInAggregatingStrategy.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MultiCastAggregatorTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidationFinallyBlockNoCatchTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregatorAndOnExceptionTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/DefaultAggregatorCollectionTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/PredicateAggregatorCollectionTest.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java?rev=747084&r1=747083&r2=747084&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java Mon Feb 23 17:06:15
2009
@@ -33,7 +33,7 @@
     String BEAN_METHOD_NAME = "CamelBeanMethodName";
     String BEAN_MULTI_PARAMETER_ARRAY = "CamelBeanMultiParameterArray";
 
-    String AGGREGATED_COUNT = "CamelAggregatedCount";
+    String AGGREGATED_SIZE = "CamelAggregatedSize";
 
     String CHARSET_NAME = "CamelCharsetName";
 

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/DefaultAggregationCollection.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/DefaultAggregationCollection.java?rev=747084&r1=747083&r2=747084&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/DefaultAggregationCollection.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/DefaultAggregationCollection.java
Mon Feb 23 17:06:15 2009
@@ -63,13 +63,13 @@
         Exchange newExchange = exchange;
 
         if (oldExchange != null) {
-            Integer count = oldExchange.getProperty(Exchange.AGGREGATED_COUNT, Integer.class);
+            Integer count = oldExchange.getProperty(Exchange.AGGREGATED_SIZE, Integer.class);
             if (count == null) {
                 count = 1;
             }
             count++;
             newExchange = aggregationStrategy.aggregate(oldExchange, newExchange);
-            newExchange.setProperty(Exchange.AGGREGATED_COUNT, count);
+            newExchange.setProperty(Exchange.AGGREGATED_SIZE, count);
         }
 
         // the strategy may just update the old exchange and return it
@@ -78,7 +78,7 @@
                 LOG.debug("put exchange:" + newExchange + " for key:"  + correlationKey);
             }
             if (oldExchange == null) {
-                newExchange.setProperty(Exchange.AGGREGATED_COUNT, Integer.valueOf(1));
+                newExchange.setProperty(Exchange.AGGREGATED_SIZE, Integer.valueOf(1));
             }
             map.put(correlationKey, newExchange);
         }

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/BodyInAggregatingStrategy.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/BodyInAggregatingStrategy.java?rev=747084&r1=747083&r2=747084&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/BodyInAggregatingStrategy.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/BodyInAggregatingStrategy.java
Mon Feb 23 17:06:15 2009
@@ -35,7 +35,7 @@
     /**
      * An expression used to determine if the aggregation is complete
      */
-    public boolean isCompleted(@Header(name = Exchange.AGGREGATED_COUNT)
+    public boolean isCompleted(@Header(name = Exchange.AGGREGATED_SIZE)
                                Integer aggregated) {
 
         if (aggregated == null) {

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MultiCastAggregatorTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MultiCastAggregatorTest.java?rev=747084&r1=747083&r2=747084&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MultiCastAggregatorTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MultiCastAggregatorTest.java
Mon Feb 23 17:06:15 2009
@@ -22,12 +22,10 @@
 
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.Exchange;
-import org.apache.camel.Header;
 import org.apache.camel.Message;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.processor.aggregate.AggregationStrategy;
 
 public class MultiCastAggregatorTest extends ContextTestSupport {
 
@@ -83,7 +81,7 @@
                 from("direct:z").process(new AppendingProcessor("z")).to("direct:aggregator");
 
                 from("direct:aggregator").aggregate(header("cheese"), new BodyInAggregatingStrategy()).
-                completedPredicate(header(Exchange.AGGREGATED_COUNT).isEqualTo(3)).to("mock:result");
+                completedPredicate(header(Exchange.AGGREGATED_SIZE).isEqualTo(3)).to("mock:result");
                 // END SNIPPET: example
             }
         };

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidationFinallyBlockNoCatchTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidationFinallyBlockNoCatchTest.java?rev=747084&r1=747083&r2=747084&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidationFinallyBlockNoCatchTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidationFinallyBlockNoCatchTest.java
Mon Feb 23 17:06:15 2009
@@ -71,6 +71,9 @@
     protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             public void configure() {
+                // use little delay to run unit test fast
+                errorHandler(deadLetterChannel().delay(25));
+
                 TryType tryType = from("direct:start").tryBlock().
                         process(validator).
                         to("mock:valid");

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregatorAndOnExceptionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregatorAndOnExceptionTest.java?rev=747084&r1=747083&r2=747084&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregatorAndOnExceptionTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregatorAndOnExceptionTest.java
Mon Feb 23 17:06:15 2009
@@ -55,7 +55,7 @@
                                 return newExchange;
                             }
                         },
-                        header(Exchange.AGGREGATED_COUNT).isEqualTo(2)))
+                        header(Exchange.AGGREGATED_SIZE).isEqualTo(2)))
                     .batchTimeout(500L)
                     .to("mock:result");
             }

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/DefaultAggregatorCollectionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/DefaultAggregatorCollectionTest.java?rev=747084&r1=747083&r2=747084&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/DefaultAggregatorCollectionTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/DefaultAggregatorCollectionTest.java
Mon Feb 23 17:06:15 2009
@@ -33,10 +33,10 @@
         // we expect 4 messages grouped by the latest message only
         result.expectedMessageCount(4);
         result.expectedBodiesReceived("Message 1d", "Message 2b", "Message 3c", "Message
4");
-        result.message(0).property(Exchange.AGGREGATED_COUNT).isEqualTo(4);
-        result.message(1).property(Exchange.AGGREGATED_COUNT).isEqualTo(2);
-        result.message(2).property(Exchange.AGGREGATED_COUNT).isEqualTo(3);
-        result.message(3).property(Exchange.AGGREGATED_COUNT).isEqualTo(1);
+        result.message(0).property(Exchange.AGGREGATED_SIZE).isEqualTo(4);
+        result.message(1).property(Exchange.AGGREGATED_SIZE).isEqualTo(2);
+        result.message(2).property(Exchange.AGGREGATED_SIZE).isEqualTo(3);
+        result.message(3).property(Exchange.AGGREGATED_SIZE).isEqualTo(1);
 
         // then we sent all the message at once
         template.sendBodyAndHeader("direct:start", "Message 1a", "id", "1");

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/PredicateAggregatorCollectionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/PredicateAggregatorCollectionTest.java?rev=747084&r1=747083&r2=747084&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/PredicateAggregatorCollectionTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/PredicateAggregatorCollectionTest.java
Mon Feb 23 17:06:15 2009
@@ -66,7 +66,7 @@
                 // - and finally we stop aggregate if we receive 2 or more messages
                 AggregationCollection ag = new PredicateAggregationCollection(header("id"),
                     new UseLatestAggregationStrategy(),
-                    header(Exchange.AGGREGATED_COUNT).isEqualTo(3));
+                    header(Exchange.AGGREGATED_SIZE).isEqualTo(3));
 
                 // our route is aggregating from the direct queue and sending the response
to the mock
                 from("direct:start")



Mime
View raw message