activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r813734 - /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2383Test.java
Date Fri, 11 Sep 2009 09:17:44 GMT
Author: gtully
Date: Fri Sep 11 09:17:43 2009
New Revision: 813734

URL: http://svn.apache.org/viewvc?rev=813734&view=rev
Log:
test case for: https://issues.apache.org/activemq/browse/AMQ-2383 - works on trunk

Added:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2383Test.java 
 (with props)

Added: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2383Test.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2383Test.java?rev=813734&view=auto
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2383Test.java (added)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2383Test.java Fri
Sep 11 09:17:43 2009
@@ -0,0 +1,49 @@
+package org.apache.activemq.bugs;
+
+
+import static org.junit.Assert.*;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.command.ActiveMQQueue;
+import org.junit.Test;
+
+public class AMQ2383Test {
+
+    @Test
+    public void activeMQTest() throws Exception {
+        Destination dest = ActiveMQQueue.createDestination("testQueue", ActiveMQQueue.QUEUE_TYPE);
+        ConnectionFactory factory = new ActiveMQConnectionFactory(
+                "vm://localhost?broker.useJmx=false&broker.persistent=false");
+        Connection producerConnection = factory.createConnection();
+        producerConnection.start();
+        Connection consumerConnection = factory.createConnection();
+        consumerConnection.start();
+
+        Session producerSession = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+        MessageProducer producer = producerSession.createProducer(dest);
+        TextMessage sentMsg = producerSession.createTextMessage("test...");
+        producer.send(sentMsg);
+        producerSession.close();
+
+        Session consumerSession = consumerConnection.createSession(true, Session.SESSION_TRANSACTED);
+        MessageConsumer consumer = consumerSession.createConsumer(dest);
+        TextMessage receivedMsg = (TextMessage)consumer.receive();
+        consumerSession.rollback();
+        consumerSession.close();
+
+        assertEquals(sentMsg, receivedMsg);
+
+        Thread.sleep(10000);
+
+        producerConnection.close();
+        consumerConnection.close();
+    }
+}

Propchange: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2383Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2383Test.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message