Corrected test that was providing false positive with no running ActiveMQ instance.
Added property that disabled Spring creating embedded ActiveMQ broker.
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 @@
@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 @@
# 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 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 @@
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();
}
}