You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2020/10/23 13:09:56 UTC

[camel-spring-boot-examples] branch master updated: Corrected test that was providing false positive with no running ActiveMQ instance. Added property that disabled Spring creating embedded ActiveMQ broker.

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

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot-examples.git


The following commit(s) were added to refs/heads/master by this push:
     new 318466e  Corrected test that was providing false positive with no running ActiveMQ instance. Added property that disabled Spring creating embedded ActiveMQ broker.
318466e is described below

commit 318466e55804cb6625a6dd75b77b0d08f9596680
Author: Farid Guliyev <fg...@gmail.com>
AuthorDate: Fri Oct 23 06:42:55 2020 -0400

    Corrected test that was providing false positive with no running ActiveMQ instance.
    Added property that disabled Spring creating embedded ActiveMQ broker.
---
 .../src/main/java/sample/camel/SampleAutowiredAmqRoute.java    |  2 +-
 .../src/main/resources/application.properties                  |  2 +-
 .../src/test/java/sample/camel/SampleAmqApplicationTests.java  | 10 +++++++---
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/camel-example-spring-boot-activemq/src/main/java/sample/camel/SampleAutowiredAmqRoute.java b/camel-example-spring-boot-activemq/src/main/java/sample/camel/SampleAutowiredAmqRoute.java
index 51ff06d..0202731 100644
--- a/camel-example-spring-boot-activemq/src/main/java/sample/camel/SampleAutowiredAmqRoute.java
+++ b/camel-example-spring-boot-activemq/src/main/java/sample/camel/SampleAutowiredAmqRoute.java
@@ -25,7 +25,7 @@ public class SampleAutowiredAmqRoute extends RouteBuilder {
     @Override
     public void configure() throws Exception {
         from("activemq:foo")
-            .to("log:sample");
+            .to("mock:activemq");
 
         from("timer:bar")
             .setBody(constant("Hello from Camel"))
diff --git a/camel-example-spring-boot-activemq/src/main/resources/application.properties b/camel-example-spring-boot-activemq/src/main/resources/application.properties
index fb00b51..d54fbe8 100644
--- a/camel-example-spring-boot-activemq/src/main/resources/application.properties
+++ b/camel-example-spring-boot-activemq/src/main/resources/application.properties
@@ -22,5 +22,5 @@ camel.springboot.main-run-controller = true
 # you can change the port number to 61617 and reconfigure conf/activemq.xml to use port 61617 instead of 61616
 # to try using a different port than the default
 camel.component.activemq.broker-url=tcp://localhost:61616
-
+spring.activemq.broker-url=tcp://localhost:61616
 
diff --git a/camel-example-spring-boot-activemq/src/test/java/sample/camel/SampleAmqApplicationTests.java b/camel-example-spring-boot-activemq/src/test/java/sample/camel/SampleAmqApplicationTests.java
index d95b860..7b7e458 100644
--- a/camel-example-spring-boot-activemq/src/test/java/sample/camel/SampleAmqApplicationTests.java
+++ b/camel-example-spring-boot-activemq/src/test/java/sample/camel/SampleAmqApplicationTests.java
@@ -20,11 +20,10 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.builder.NotifyBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
-import org.apache.camel.test.spring.junit5.EnableRouteCoverage;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Disabled;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 
@@ -37,9 +36,14 @@ public class SampleAmqApplicationTests {
     private CamelContext camelContext;
 
     @Disabled("Requires a running activemq broker")
+//    @Test
     public void shouldProduceMessages() throws Exception {
+        MockEndpoint mock = camelContext.getEndpoint("mock:activemq", MockEndpoint.class);
         NotifyBuilder notify = new NotifyBuilder(camelContext).whenDone(1).create();
 
         assertTrue(notify.matches(10, TimeUnit.SECONDS));
+
+        mock.expectedMessageCount(1);
+        mock.assertIsSatisfied();
     }
 }