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/04/19 19:38:26 UTC

[2/2] camel git commit: CAMEL-9881 Fixed completionPredicate method definition for scala DSL and added a simple unit test

CAMEL-9881 Fixed completionPredicate method definition for scala DSL and added a simple unit test


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

Branch: refs/heads/camel-2.17.x
Commit: e4f4ed38fc5a3bca575e4f87fd50f90a262a588e
Parents: 713ce06
Author: Bob Gaudaen <bo...@gmail.com>
Authored: Tue Apr 19 13:40:46 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Apr 19 19:38:17 2016 +0200

----------------------------------------------------------------------
 .../camel/scala/dsl/SAggregateDefinition.scala   |  4 ++--
 .../apache/camel/scala/dsl/AggregatorTest.scala  | 19 ++++++++++++++++++-
 2 files changed, 20 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/e4f4ed38/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/SAggregateDefinition.scala
----------------------------------------------------------------------
diff --git a/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/SAggregateDefinition.scala b/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/SAggregateDefinition.scala
index 8f08f96..acdf4ab 100644
--- a/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/SAggregateDefinition.scala
+++ b/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/SAggregateDefinition.scala
@@ -61,8 +61,8 @@ case class SAggregateDefinition(override val target: AggregateDefinition)(implic
       = wrap(target.setTimeoutCheckerExecutorService(executorService))
   def executorService(executorService: ExecutorService) = wrap(target.setExecutorService(executorService))
   def executorServiceRef(ref: String) = wrap(target.setExecutorServiceRef(ref))
-  
-  def completionPredicate(filter: Exchange => Any) {
+
+  def completionPredicate(filter: Exchange => Any) = {
      // uses implicit conversion
      val predicate = filter
      target.completionPredicate(predicate)

http://git-wip-us.apache.org/repos/asf/camel/blob/e4f4ed38/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/AggregatorTest.scala
----------------------------------------------------------------------
diff --git a/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/AggregatorTest.scala b/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/AggregatorTest.scala
index b826be4..874730e 100644
--- a/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/AggregatorTest.scala
+++ b/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/AggregatorTest.scala
@@ -15,7 +15,8 @@
  * limitations under the License.
  */
 package org.apache.camel.scala.dsl
- 
+
+import org.apache.camel.processor.BodyInAggregatingStrategy
 import org.apache.camel.processor.aggregate.UseLatestAggregationStrategy
 import org.junit.Test
 import builder.RouteBuilder
@@ -71,6 +72,18 @@ class AggregatorTest extends ScalaTestSupport {
     }
   }
 
+  @Test
+  def testAggregateSimplePredicate() {
+    "mock:e" expect {
+      _.received("A+B+C")
+    }
+    test {
+      "direct:e" ! "A"
+      "direct:e" ! "B"
+      "direct:e" ! "C"
+    }
+  }
+
   val builder =
     new RouteBuilder {
        "direct:a" ==> {
@@ -99,6 +112,10 @@ class AggregatorTest extends ScalaTestSupport {
         }
         aggregate ("constant", aggregator) completionSize 2 to "mock:d"
       }
+
+      "direct:e" ==> {
+        aggregate("constant", new BodyInAggregatingStrategy()) completionPredicate(_.in[String].contains("A+B+C")) to "mock:e"
+      }
     }
 
 }
\ No newline at end of file