This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new f45dde8  Polished
f45dde8 is described below

commit f45dde8ebedd267865ade86c9cf914f72a2acc13
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Sat Mar 10 09:16:52 2018 +0100

    Polished
---
 .../src/main/resources/archetype-resources/pom.xml    | 19 +++++++++++--------
 .../src/main/java/MySpringBootRouter.java             |  2 +-
 .../test/java/sample/camel/FooApplicationTest.java    | 11 +++++++++++
 3 files changed, 23 insertions(+), 9 deletions(-)

diff --git 
a/archetypes/camel-archetype-spring-boot/src/main/resources/archetype-resources/pom.xml
 
b/archetypes/camel-archetype-spring-boot/src/main/resources/archetype-resources/pom.xml
index 40760e9..d8a3fca 100644
--- 
a/archetypes/camel-archetype-spring-boot/src/main/resources/archetype-resources/pom.xml
+++ 
b/archetypes/camel-archetype-spring-boot/src/main/resources/archetype-resources/pom.xml
@@ -56,13 +56,6 @@
 
   <dependencies>
 
-    <!-- Camel -->
-    <dependency>
-      <groupId>org.apache.camel</groupId>
-      <artifactId>camel-spring-boot-starter</artifactId>
-      <version>${camel-version}</version>
-    </dependency>
-
     <!-- Spring Boot -->
     <dependency>
       <groupId>org.springframework.boot</groupId>
@@ -77,7 +70,17 @@
       <artifactId>spring-boot-starter-actuator</artifactId>
     </dependency>
 
-    <!-- testing -->
+    <!-- Camel -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-spring-boot-starter</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-stream-starter</artifactId>
+    </dependency>
+
+    <!-- Test -->
     <dependency>
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-starter-test</artifactId>
diff --git 
a/archetypes/camel-archetype-spring-boot/src/main/resources/archetype-resources/src/main/java/MySpringBootRouter.java
 
b/archetypes/camel-archetype-spring-boot/src/main/resources/archetype-resources/src/main/java/MySpringBootRouter.java
index dc5c216..236fbfd 100644
--- 
a/archetypes/camel-archetype-spring-boot/src/main/resources/archetype-resources/src/main/java/MySpringBootRouter.java
+++ 
b/archetypes/camel-archetype-spring-boot/src/main/resources/archetype-resources/src/main/java/MySpringBootRouter.java
@@ -35,7 +35,7 @@ public class MySpringBootRouter extends RouteBuilder {
             .filter(simple("${body} contains 'foo'"))
                 .to("log:foo")
             .end()
-            .log("${body}");
+            .to("stream:out");
     }
 
 }
diff --git 
a/examples/camel-example-spring-boot/src/test/java/sample/camel/FooApplicationTest.java
 
b/examples/camel-example-spring-boot/src/test/java/sample/camel/FooApplicationTest.java
index 721e8cb..b05058b 100644
--- 
a/examples/camel-example-spring-boot/src/test/java/sample/camel/FooApplicationTest.java
+++ 
b/examples/camel-example-spring-boot/src/test/java/sample/camel/FooApplicationTest.java
@@ -19,9 +19,12 @@ package sample.camel;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.camel.CamelContext;
+import org.apache.camel.EndpointInject;
 import org.apache.camel.builder.NotifyBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.spring.CamelSpringBootRunner;
 import org.apache.camel.test.spring.EnableRouteCoverage;
+import org.apache.camel.test.spring.MockEndpoints;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -33,19 +36,27 @@ import static org.junit.Assert.assertTrue;
 @SpringBootTest(classes = MyCamelApplication.class,
     properties = "greeting = Hello foo")
 @EnableRouteCoverage
+@MockEndpoints("log:foo") // mock the log:foo endpoint => mock:log:foo which 
we then use in the testing
 //@Ignore // enable me to run this test as well so we can cover testing the 
route completely
 public class FooApplicationTest {
 
     @Autowired
     private CamelContext camelContext;
 
+    @EndpointInject(uri = "mock:log:foo")
+    private MockEndpoint mock;
+
     @Test
     public void shouldSayFoo() throws Exception {
+        mock.expectedBodiesReceived("Hello foo");
+
         // 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));
+
+        mock.assertIsSatisfied();
     }
 
 }

-- 
To stop receiving notification emails like this one, please contact
davscl...@apache.org.

Reply via email to