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 2015/12/16 16:55:29 UTC

[1/2] camel git commit: Lets avoid the mock endpoint in our production route in this example

Repository: camel
Updated Branches:
  refs/heads/camel-2.16.x dc47b6b52 -> ede3663e4
  refs/heads/master 596346707 -> 8377a194a


Lets avoid the mock endpoint in our production route in this example


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

Branch: refs/heads/master
Commit: 8377a194a7073b14eec943ee0486d68002570115
Parents: 5963467
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Dec 16 16:54:50 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Dec 16 16:54:50 2015 +0100

----------------------------------------------------------------------
 .../example/spring/boot/MySpringBootRouter.java   |  6 +++---
 .../spring/boot/MySpringBootRouterTest.java       | 18 ++++++++++++------
 2 files changed, 15 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/8377a194/examples/camel-example-spring-boot/src/main/java/org/apache/camel/example/spring/boot/MySpringBootRouter.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-spring-boot/src/main/java/org/apache/camel/example/spring/boot/MySpringBootRouter.java b/examples/camel-example-spring-boot/src/main/java/org/apache/camel/example/spring/boot/MySpringBootRouter.java
index f1ebb57..c429d65 100644
--- a/examples/camel-example-spring-boot/src/main/java/org/apache/camel/example/spring/boot/MySpringBootRouter.java
+++ b/examples/camel-example-spring-boot/src/main/java/org/apache/camel/example/spring/boot/MySpringBootRouter.java
@@ -25,9 +25,9 @@ public class MySpringBootRouter extends FatJarRouter {
 
     @Override
     public void configure() {
-        from("timer://trigger").
-                transform().simple("ref:myBean").
-                to("log:out", "mock:test");
+        from("timer:trigger")
+                .transform().simple("ref:myBean")
+                .to("log:out");
     }
 
     @Bean

http://git-wip-us.apache.org/repos/asf/camel/blob/8377a194/examples/camel-example-spring-boot/src/test/java/org/apache/camel/example/spring/boot/MySpringBootRouterTest.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-spring-boot/src/test/java/org/apache/camel/example/spring/boot/MySpringBootRouterTest.java b/examples/camel-example-spring-boot/src/test/java/org/apache/camel/example/spring/boot/MySpringBootRouterTest.java
index a11e4e2..91fc2aa 100644
--- a/examples/camel-example-spring-boot/src/test/java/org/apache/camel/example/spring/boot/MySpringBootRouterTest.java
+++ b/examples/camel-example-spring-boot/src/test/java/org/apache/camel/example/spring/boot/MySpringBootRouterTest.java
@@ -16,11 +16,14 @@
  */
 package org.apache.camel.example.spring.boot;
 
-import org.apache.camel.EndpointInject;
-import org.apache.camel.component.mock.MockEndpoint;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.builder.NotifyBuilder;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.SpringApplicationConfiguration;
 import org.springframework.boot.test.WebIntegrationTest;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -30,13 +33,16 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 @WebIntegrationTest(randomPort = true)
 public class MySpringBootRouterTest extends Assert {
 
-    @EndpointInject(uri = "mock:test")
-    MockEndpoint mockEndpoint;
+    @Autowired
+    CamelContext camelContext;
 
     @Test
     public void shouldProduceMessages() throws InterruptedException {
-        mockEndpoint.setExpectedCount(1);
-        mockEndpoint.assertIsSatisfied();
+        // we expect that one or more messages is automatic done by the Camel
+        // route as it uses a timer to trigger
+        NotifyBuilder notify = new NotifyBuilder(camelContext).whenDone(1).create();
+
+        assertTrue(notify.matches(10, TimeUnit.SECONDS));
     }
 
 }


[2/2] camel git commit: Lets avoid the mock endpoint in our production route in this example

Posted by da...@apache.org.
Lets avoid the mock endpoint in our production route in this example


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

Branch: refs/heads/camel-2.16.x
Commit: ede3663e4494a71b182ae318a72afcbc79b64ab8
Parents: dc47b6b
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Dec 16 16:54:50 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Dec 16 16:55:20 2015 +0100

----------------------------------------------------------------------
 .../example/spring/boot/MySpringBootRouter.java   |  6 +++---
 .../spring/boot/MySpringBootRouterTest.java       | 18 ++++++++++++------
 2 files changed, 15 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/ede3663e/examples/camel-example-spring-boot/src/main/java/org/apache/camel/example/spring/boot/MySpringBootRouter.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-spring-boot/src/main/java/org/apache/camel/example/spring/boot/MySpringBootRouter.java b/examples/camel-example-spring-boot/src/main/java/org/apache/camel/example/spring/boot/MySpringBootRouter.java
index f1ebb57..c429d65 100644
--- a/examples/camel-example-spring-boot/src/main/java/org/apache/camel/example/spring/boot/MySpringBootRouter.java
+++ b/examples/camel-example-spring-boot/src/main/java/org/apache/camel/example/spring/boot/MySpringBootRouter.java
@@ -25,9 +25,9 @@ public class MySpringBootRouter extends FatJarRouter {
 
     @Override
     public void configure() {
-        from("timer://trigger").
-                transform().simple("ref:myBean").
-                to("log:out", "mock:test");
+        from("timer:trigger")
+                .transform().simple("ref:myBean")
+                .to("log:out");
     }
 
     @Bean

http://git-wip-us.apache.org/repos/asf/camel/blob/ede3663e/examples/camel-example-spring-boot/src/test/java/org/apache/camel/example/spring/boot/MySpringBootRouterTest.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-spring-boot/src/test/java/org/apache/camel/example/spring/boot/MySpringBootRouterTest.java b/examples/camel-example-spring-boot/src/test/java/org/apache/camel/example/spring/boot/MySpringBootRouterTest.java
index a11e4e2..91fc2aa 100644
--- a/examples/camel-example-spring-boot/src/test/java/org/apache/camel/example/spring/boot/MySpringBootRouterTest.java
+++ b/examples/camel-example-spring-boot/src/test/java/org/apache/camel/example/spring/boot/MySpringBootRouterTest.java
@@ -16,11 +16,14 @@
  */
 package org.apache.camel.example.spring.boot;
 
-import org.apache.camel.EndpointInject;
-import org.apache.camel.component.mock.MockEndpoint;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.builder.NotifyBuilder;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.SpringApplicationConfiguration;
 import org.springframework.boot.test.WebIntegrationTest;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -30,13 +33,16 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 @WebIntegrationTest(randomPort = true)
 public class MySpringBootRouterTest extends Assert {
 
-    @EndpointInject(uri = "mock:test")
-    MockEndpoint mockEndpoint;
+    @Autowired
+    CamelContext camelContext;
 
     @Test
     public void shouldProduceMessages() throws InterruptedException {
-        mockEndpoint.setExpectedCount(1);
-        mockEndpoint.assertIsSatisfied();
+        // we expect that one or more messages is automatic done by the Camel
+        // route as it uses a timer to trigger
+        NotifyBuilder notify = new NotifyBuilder(camelContext).whenDone(1).create();
+
+        assertTrue(notify.matches(10, TimeUnit.SECONDS));
     }
 
 }