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 2016/03/04 15:40:53 UTC

[1/3] camel git commit: CAMEL-9667: Added unit test.

Repository: camel
Updated Branches:
  refs/heads/master 59939fddd -> 192a3b2bc


CAMEL-9667: Added unit test.


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

Branch: refs/heads/master
Commit: df092872f124a9682ac15e65d3920021035cd7d9
Parents: 59939fd
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Mar 4 15:38:01 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Mar 4 15:38:01 2016 +0100

----------------------------------------------------------------------
 .../apache/camel/processor/BatchProcessor.java  | 11 +--
 .../resequencer/ResequencerBatchOrderTest.java  | 73 ++++++++++++++++++++
 2 files changed, 79 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/df092872/camel-core/src/main/java/org/apache/camel/processor/BatchProcessor.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/processor/BatchProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/BatchProcessor.java
index f7056e0..f6059ba 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/BatchProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/BatchProcessor.java
@@ -24,6 +24,7 @@ import java.util.List;
 import java.util.Queue;
 import java.util.concurrent.ConcurrentLinkedQueue;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.locks.Condition;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
@@ -335,7 +336,7 @@ public class BatchProcessor extends ServiceSupport implements AsyncProcessor, Na
 
         private Queue<Exchange> queue;
         private Lock queueLock = new ReentrantLock();
-        private boolean exchangeEnqueued;
+        private final AtomicBoolean exchangeEnqueued = new AtomicBoolean();
         private final Queue<String> completionPredicateMatched = new ConcurrentLinkedQueue<String>();
         private Condition exchangeEnqueuedCondition = queueLock.newCondition();
 
@@ -372,7 +373,7 @@ public class BatchProcessor extends ServiceSupport implements AsyncProcessor, Na
             try {
                 do {
                     try {
-                        if (!exchangeEnqueued) {
+                        if (!exchangeEnqueued.get()) {
                             LOG.trace("Waiting for new exchange to arrive or batchTimeout to occur after {} ms.", batchTimeout);
                             exchangeEnqueuedCondition.await(batchTimeout, TimeUnit.MILLISECONDS);
                         }
@@ -383,7 +384,7 @@ public class BatchProcessor extends ServiceSupport implements AsyncProcessor, Na
                             id = completionPredicateMatched.poll();
                         }
 
-                        if (id != null || !exchangeEnqueued) {
+                        if (id != null || !exchangeEnqueued.get()) {
                             if (id != null) {
                                 LOG.trace("Collecting exchanges to be aggregated triggered by completion predicate");
                             } else {
@@ -391,7 +392,7 @@ public class BatchProcessor extends ServiceSupport implements AsyncProcessor, Na
                             }
                             drainQueueTo(collection, batchSize, id);
                         } else {
-                            exchangeEnqueued = false;
+                            exchangeEnqueued.set(false);
                             boolean drained = false;
                             while (isInBatchCompleted(queue.size())) {
                                 drained = true;
@@ -471,7 +472,7 @@ public class BatchProcessor extends ServiceSupport implements AsyncProcessor, Na
                     }
                 }
                 queue.add(exchange);
-                exchangeEnqueued = true;
+                exchangeEnqueued.set(true);
                 exchangeEnqueuedCondition.signal();
             } finally {
                 queueLock.unlock();

http://git-wip-us.apache.org/repos/asf/camel/blob/df092872/camel-core/src/test/java/org/apache/camel/processor/resequencer/ResequencerBatchOrderTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/resequencer/ResequencerBatchOrderTest.java b/camel-core/src/test/java/org/apache/camel/processor/resequencer/ResequencerBatchOrderTest.java
new file mode 100644
index 0000000..0bfc82d
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/processor/resequencer/ResequencerBatchOrderTest.java
@@ -0,0 +1,73 @@
+/**
+ * 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.resequencer;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ResequencerBatchOrderTest extends ContextTestSupport {
+
+    private static final Logger LOG = LoggerFactory.getLogger(ResequencerBatchOrderTest.class);
+
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            public void configure() {
+                from("direct:start")
+                    .resequence(body()).batch().size(2).timeout(3000)
+                    .to("mock:result");
+            }
+        };
+    }
+
+    public void testResequencerBatch() throws Exception {
+        for (int i = 0; i < 100; i++) {
+            testIteration(i);
+        }
+    }
+
+    private void testIteration(int i) throws Exception {
+        MockEndpoint me = context.getEndpoint("mock:result", MockEndpoint.class);
+        me.reset();
+        me.expectedMessageCount(4);
+
+        LOG.info("Run #{}", i);
+
+        template.sendBody("direct:start", "4");
+        template.sendBody("direct:start", "1");
+
+        template.sendBody("direct:start", "3");
+        template.sendBody("direct:start", "2");
+
+        assertMockEndpointsSatisfied();
+
+        // because the order can change a bit depending when the resequencer trigger cut-off
+        // then the order can be a bit different
+
+        String a = me.getExchanges().get(0).getIn().getBody(String.class);
+        String b = me.getExchanges().get(1).getIn().getBody(String.class);
+        String c = me.getExchanges().get(2).getIn().getBody(String.class);
+        String d = me.getExchanges().get(3).getIn().getBody(String.class);
+        String line = a + b + c + d;
+
+        LOG.info("Order: {}", line);
+
+        assertTrue("Line was " + line, "1423".equals(line) || "1234".equals(line));
+    }
+}
\ No newline at end of file


[2/3] camel git commit: Deprecated those mvn archetypes

Posted by da...@apache.org.
Deprecated those mvn archetypes


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

Branch: refs/heads/master
Commit: 77be4fae958375a133f4da3a674ae47355cd2ea1
Parents: df09287
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Mar 4 15:40:08 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Mar 4 15:40:08 2016 +0100

----------------------------------------------------------------------
 .../archetypes/camel-archetype-cxf-code-first-blueprint/pom.xml    | 2 +-
 .../camel-archetype-cxf-contract-first-blueprint/pom.xml           | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/77be4fae/tooling/archetypes/camel-archetype-cxf-code-first-blueprint/pom.xml
----------------------------------------------------------------------
diff --git a/tooling/archetypes/camel-archetype-cxf-code-first-blueprint/pom.xml b/tooling/archetypes/camel-archetype-cxf-code-first-blueprint/pom.xml
index 91d9e33..cd871e3 100644
--- a/tooling/archetypes/camel-archetype-cxf-code-first-blueprint/pom.xml
+++ b/tooling/archetypes/camel-archetype-cxf-code-first-blueprint/pom.xml
@@ -29,7 +29,7 @@
 
   <groupId>org.apache.camel.archetypes</groupId>
   <artifactId>camel-archetype-cxf-code-first-blueprint</artifactId>
-  <name>Camel :: Archetypes :: CXF :: Code First :: Blueprint (OSGi)</name>
+  <name>Camel :: Archetypes :: CXF :: Code First :: Blueprint (OSGi) (deprecated)</name>
   <description>Creates a new Camel project with Apache CXF code-first example using OSGi blueprint.</description>
   <packaging>maven-archetype</packaging>
 

http://git-wip-us.apache.org/repos/asf/camel/blob/77be4fae/tooling/archetypes/camel-archetype-cxf-contract-first-blueprint/pom.xml
----------------------------------------------------------------------
diff --git a/tooling/archetypes/camel-archetype-cxf-contract-first-blueprint/pom.xml b/tooling/archetypes/camel-archetype-cxf-contract-first-blueprint/pom.xml
index 0d4c25a..544a428 100644
--- a/tooling/archetypes/camel-archetype-cxf-contract-first-blueprint/pom.xml
+++ b/tooling/archetypes/camel-archetype-cxf-contract-first-blueprint/pom.xml
@@ -29,7 +29,7 @@
 
   <groupId>org.apache.camel.archetypes</groupId>
   <artifactId>camel-archetype-cxf-contract-first-blueprint</artifactId>
-  <name>Camel :: Archetypes :: CXF :: Contract First :: Blueprint (OSGi)</name>
+  <name>Camel :: Archetypes :: CXF :: Contract First :: Blueprint (OSGi) (deprecated)</name>
   <description>Creates a new Camel project with Apache CXF contract-first example using OSGi blueprint.</description>
   <packaging>maven-archetype</packaging>
 


[3/3] camel git commit: Fixed CS

Posted by da...@apache.org.
Fixed CS


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

Branch: refs/heads/master
Commit: 192a3b2bc7f8e161c0853bb4f9c356a6f1bc3898
Parents: 77be4fa
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Mar 4 15:40:43 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Mar 4 15:40:43 2016 +0100

----------------------------------------------------------------------
 .../camel/processor/resequencer/ResequencerBatchOrderTest.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/192a3b2b/camel-core/src/test/java/org/apache/camel/processor/resequencer/ResequencerBatchOrderTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/resequencer/ResequencerBatchOrderTest.java b/camel-core/src/test/java/org/apache/camel/processor/resequencer/ResequencerBatchOrderTest.java
index 0bfc82d..e677b9c 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/resequencer/ResequencerBatchOrderTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/resequencer/ResequencerBatchOrderTest.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.