From 1f4e7be0079cb8f8d0a03b0ce404c25f82068f3c Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Tue, 17 Apr 2018 13:47:21 -0400 Subject: [PATCH 1/3] NO-JIRA Adding examples verification into travis --- .travis.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 582754cb88..9244f8502c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,11 @@ before_install: rm -rf $HOME/.m2/repository/org/apache/activemq/artemis-* # use 'install' so smoke-tests will work # use '-Pextra-tests' to ensure extra-tests compiles even though they won't actually run -script: mvn -Pfast-tests -Pextra-tests -B install +script: +- set -e +- mvn -Pfast-tests -Pextra-tests -B install -q +- cd examples +- mvn install -Prelease install -B -q cache: directories: From 186bc4464caa86d89600a16006766c9b2b4c502b Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Tue, 17 Apr 2018 13:55:04 -0400 Subject: [PATCH 2/3] NO-JIRA fixing checkstyle on virtual topic mapping example --- .../example/VirtualTopicMappingExample.java | 61 +++++++++---------- 1 file changed, 30 insertions(+), 31 deletions(-) diff --git a/examples/protocols/openwire/virtual-topic-mapping/src/main/java/org/apache/activemq/artemis/jms/example/VirtualTopicMappingExample.java b/examples/protocols/openwire/virtual-topic-mapping/src/main/java/org/apache/activemq/artemis/jms/example/VirtualTopicMappingExample.java index 0d0e2714dd..eff7b1840b 100644 --- a/examples/protocols/openwire/virtual-topic-mapping/src/main/java/org/apache/activemq/artemis/jms/example/VirtualTopicMappingExample.java +++ b/examples/protocols/openwire/virtual-topic-mapping/src/main/java/org/apache/activemq/artemis/jms/example/VirtualTopicMappingExample.java @@ -35,42 +35,41 @@ import org.apache.activemq.ActiveMQConnectionFactory; */ public class VirtualTopicMappingExample { - public static void main(final String[] args) throws Exception { - Connection connection = null; - try { + public static void main(final String[] args) throws Exception { + Connection connection = null; + try { - ConnectionFactory cf = new ActiveMQConnectionFactory(); + ConnectionFactory cf = new ActiveMQConnectionFactory(); - connection = cf.createConnection(); - Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); + connection = cf.createConnection(); + Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - //create consumer on queue that is used by the Virtual Topic - Queue queue = session.createQueue("Consumer.A.VirtualTopic.Orders"); - MessageConsumer messageConsumer = session.createConsumer(queue); - connection.start(); + //create consumer on queue that is used by the Virtual Topic + Queue queue = session.createQueue("Consumer.A.VirtualTopic.Orders"); + MessageConsumer messageConsumer = session.createConsumer(queue); + connection.start(); + //send message to virtual topic + Topic topic = session.createTopic("VirtualTopic.Orders"); + MessageProducer producer = session.createProducer(topic); + TextMessage message = session.createTextMessage("This is a text message"); + producer.send(message); - //send message to virtual topic - Topic topic = session.createTopic("VirtualTopic.Orders"); - MessageProducer producer = session.createProducer(topic); - TextMessage message = session.createTextMessage("This is a text message"); - producer.send(message); + System.out.println("Sent message with ID: " + message.getJMSMessageID() + " to Topic: " + topic.getTopicName()); - System.out.println("Sent message with ID: " + message.getJMSMessageID() + " to Topic: " + topic.getTopicName()); + //consume the message from the backing queue + TextMessage messageReceived = (TextMessage) messageConsumer.receive(5000); - //consume the message from the backing queue - TextMessage messageReceived = (TextMessage) messageConsumer.receive(5000); - - if (messageReceived != null) { - System.out.println("Received message with ID: " + messageReceived.getJMSMessageID() + " from Queue: " + queue.getQueueName()); - } else { - //unexpected outcome - throw new RuntimeException("EXAMPLE FAILED - No message received from Queue: " + queue.getQueueName()); - } - } finally { - if (connection != null) { - connection.close(); - } - } - } + if (messageReceived != null) { + System.out.println("Received message with ID: " + messageReceived.getJMSMessageID() + " from Queue: " + queue.getQueueName()); + } else { + //unexpected outcome + throw new RuntimeException("EXAMPLE FAILED - No message received from Queue: " + queue.getQueueName()); + } + } finally { + if (connection != null) { + connection.close(); + } + } + } } From 31baba1e16d8ba7c5828259db24fde92cf11f587 Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Tue, 17 Apr 2018 13:59:53 -0400 Subject: [PATCH 3/3] NO-JIRA Adding example to run-examples.sh --- artemis-distribution/src/test/scripts/run-examples.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/artemis-distribution/src/test/scripts/run-examples.sh b/artemis-distribution/src/test/scripts/run-examples.sh index cb1398004a..e0051c09cb 100755 --- a/artemis-distribution/src/test/scripts/run-examples.sh +++ b/artemis-distribution/src/test/scripts/run-examples.sh @@ -157,6 +157,7 @@ cd $ARTEMIS_HOME/examples/protocols/openwire/ cd queue; mvn verify; cd .. cd message-listener; mvn verify; cd .. cd message-recovery; mvn verify; cd .. +cd virtual-topic-mapping; mvn verify; cd .. cd $ARTEMIS_HOME/examples/protocols/stomp/