diff --git a/spring-boot-cli/samples/jms.groovy b/spring-boot-cli/samples/jms.groovy index c03672877f..f824d61814 100644 --- a/spring-boot-cli/samples/jms.groovy +++ b/spring-boot-cli/samples/jms.groovy @@ -1,10 +1,12 @@ package org.test -@Grab("org.apache.activemq:activemq-all:5.4.0") -@Grab("activemq-pool") +@Grab("spring-boot-starter-hornetq") +@Grab("hornetq-jms-server") import java.util.concurrent.CountDownLatch +import org.hornetq.jms.server.config.impl.JMSQueueConfigurationImpl @Log +@Configuration @EnableJms class JmsExample implements CommandLineRunner { @@ -15,7 +17,7 @@ class JmsExample implements CommandLineRunner { void run(String... args) { def messageCreator = { session -> - session.createObjectMessage("Greetings from Spring Boot via ActiveMQ") + session.createObjectMessage("Greetings from Spring Boot via HornetQ") } as MessageCreator log.info "Sending JMS message..." jmsTemplate.send("spring-boot", messageCreator) @@ -29,4 +31,8 @@ class JmsExample implements CommandLineRunner { latch.countDown() } + @Bean JMSQueueConfigurationImpl springBootQueue() { + new JMSQueueConfigurationImpl('spring-boot', null, false) + } + } diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/ReproIntegrationTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/ReproIntegrationTests.java index a653f61275..bc12c93f28 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/ReproIntegrationTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/ReproIntegrationTests.java @@ -73,10 +73,5 @@ public class ReproIntegrationTests { this.cli.jar("secure.groovy", "crsh.groovy"); } - @Test - public void jmsListener() throws Exception { - this.cli.run("jms.groovy"); - assertThat(this.cli.getOutput(), containsString("Hello World")); - } } diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/SampleIntegrationTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/SampleIntegrationTests.java index bc6bb0444e..60b372fb84 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/SampleIntegrationTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/SampleIntegrationTests.java @@ -136,12 +136,10 @@ public class SampleIntegrationTests { } @Test - @Ignore("Intermittent failure on CI. See #323") public void jmsSample() throws Exception { String output = this.cli.run("jms.groovy"); assertTrue("Wrong output: " + output, - output.contains("Received Greetings from Spring Boot via ActiveMQ")); - FileUtils.deleteDirectory(new File("activemq-data"));// cleanup ActiveMQ cruft + output.contains("Received Greetings from Spring Boot via HornetQ")); } @Test diff --git a/spring-boot-cli/src/test/resources/repro-samples/jms.groovy b/spring-boot-cli/src/test/resources/repro-samples/jms.groovy deleted file mode 100644 index 80bf5bb821..0000000000 --- a/spring-boot-cli/src/test/resources/repro-samples/jms.groovy +++ /dev/null @@ -1,33 +0,0 @@ -package org.test - -@Grab("org.apache.activemq:activemq-all:5.4.0") -@Grab("activemq-pool") -import java.util.concurrent.CountDownLatch - -@Log -@EnableJms -class SampleJmsListener implements CommandLineRunner { - - private CountDownLatch latch = new CountDownLatch(1) - - @Autowired - JmsTemplate jmsTemplate - - void run(String... args) { - def messageCreator = { session -> - session.createObjectMessage("Hello World") - } as MessageCreator - log.info "Sending JMS message..." - jmsTemplate.send("testQueue", messageCreator) - log.info "Sent JMS message, waiting..." - latch.await() - } - - @JmsListener(destination = 'testQueue') - def receive(String message) { - log.info "Received ${message}" - latch.countDown() - } -} - -