From 2b45d6eb9ea5e8d69ce6e4a846f06e8082621e94 Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Tue, 25 Aug 2015 08:31:24 -0400 Subject: [PATCH] Adding simple test sending core & consuming OpenWire --- .../openwire/SimpleOpenWireTest.java | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java index c41d30b51d..b87fc7d474 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java @@ -31,6 +31,7 @@ import java.util.concurrent.TimeUnit; import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.artemis.api.core.SimpleString; +import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient; import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.command.ActiveMQQueue; import org.apache.activemq.command.ActiveMQTopic; @@ -473,4 +474,44 @@ public class SimpleOpenWireTest extends BasicOpenWireTest { } + // simple test sending openwire, consuming core + @Test + public void testMixedOpenWireExample2() throws Exception { + Connection conn1 = null; + + SimpleString durableQueue = new SimpleString("jms.queue.exampleQueue"); + this.server.createQueue(durableQueue, durableQueue, null, true, false); + + Queue queue = ActiveMQJMSClient.createQueue("exampleQueue"); + + org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory artemisCF = new org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory(); + + conn1 = artemisCF.createConnection(); + + conn1.start(); + + Session session1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE); + MessageProducer producer = session1.createProducer(queue); + for (int i = 0; i < 10; i++) { + TextMessage message = session1.createTextMessage("This is a text message"); + producer.send(message); + } + + ActiveMQConnectionFactory openCF = new ActiveMQConnectionFactory(); + + Connection conn2 = openCF.createConnection(); + Session sess2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE); + conn2.start(); + MessageConsumer messageConsumer = sess2.createConsumer(sess2.createQueue("exampleQueue")); + + for (int i = 0; i < 10; i++) { + TextMessage messageReceived = (TextMessage) messageConsumer.receive(5000); + assertEquals("This is a text message", messageReceived.getText()); + } + + conn1.close(); + conn2.close(); + } + + }