activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject activemq-artemis git commit: Adding simple test sending core & consuming OpenWire
Date Tue, 25 Aug 2015 12:31:42 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 54d9a3e9b -> 2b45d6eb9


Adding simple test sending core & consuming OpenWire


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/2b45d6eb
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/2b45d6eb
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/2b45d6eb

Branch: refs/heads/master
Commit: 2b45d6eb9ea5e8d69ce6e4a846f06e8082621e94
Parents: 54d9a3e
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Tue Aug 25 08:31:24 2015 -0400
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Tue Aug 25 08:31:24 2015 -0400

----------------------------------------------------------------------
 .../openwire/SimpleOpenWireTest.java            | 41 ++++++++++++++++++++
 1 file changed, 41 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2b45d6eb/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java
----------------------------------------------------------------------
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 c41d30b..b87fc7d 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();
+   }
+
+
 }


Mime
View raw message