qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arnaudsi...@apache.org
Subject svn commit: r583498 - /incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/client/MessageListenerTest.java
Date Wed, 10 Oct 2007 14:49:35 GMT
Author: arnaudsimon
Date: Wed Oct 10 07:49:34 2007
New Revision: 583498

URL: http://svn.apache.org/viewvc?rev=583498&view=rev
Log:
Changed for using QpidTestCase

Modified:
    incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/client/MessageListenerTest.java

Modified: incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/client/MessageListenerTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/client/MessageListenerTest.java?rev=583498&r1=583497&r2=583498&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/client/MessageListenerTest.java
(original)
+++ incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/client/MessageListenerTest.java
Wed Oct 10 07:49:34 2007
@@ -20,16 +20,13 @@
  */
 package org.apache.qpid.client;
 
-import junit.framework.TestCase;
 
-import org.apache.qpid.client.transport.TransportConnection;
-import org.apache.qpid.jndi.PropertiesFileInitialContextFactory;
+import org.apache.qpid.testutil.QpidTestCase;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
 import javax.jms.Message;
 import javax.jms.MessageConsumer;
 import javax.jms.MessageListener;
@@ -37,9 +34,6 @@
 import javax.jms.Queue;
 import javax.jms.Session;
 import javax.naming.Context;
-import javax.naming.spi.InitialContextFactory;
-
-import java.util.Hashtable;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
@@ -52,7 +46,7 @@
  * the message listener later the _synchronousQueue is just poll()'ed and the first message
delivered the remaining
  * messages will be left on the queue and lost, subsequent messages on the session will arrive
first.
  */
-public class MessageListenerTest extends TestCase implements MessageListener
+public class MessageListenerTest extends QpidTestCase implements MessageListener
 {
     private static final Logger _logger = LoggerFactory.getLogger(MessageListenerTest.class);
 
@@ -63,40 +57,25 @@
     private MessageConsumer _consumer;
     private Connection _clientConnection;
     private CountDownLatch _awaitMessages = new CountDownLatch(MSG_COUNT);
-    private static final String BROKER = "vm://:1";
-    private static final String VHOST = "test";
 
     protected void setUp() throws Exception
     {
         super.setUp();
-        if (BROKER.contains("vm://"))
-        {
-            TransportConnection.createVMBroker(1);
-        }
-
-        InitialContextFactory factory = new PropertiesFileInitialContextFactory();
-
-        Hashtable<String, String> env = new Hashtable<String, String>();
-
-        env.put("connectionfactory.connection", "amqp://guest:guest@MLT_ID/" + VHOST + "?brokerlist='"
+ BROKER + "'");
-        env.put("queue.queue", "MessageListenerTest");
-
-        _context = factory.getInitialContext(env);
-
-        Queue queue = (Queue) _context.lookup("queue");
 
         // Create Client
-        _clientConnection = ((ConnectionFactory) _context.lookup("connection")).createConnection();
+        _clientConnection = getConnection("guest", "guest");
 
         _clientConnection.start();
 
         Session clientSession = _clientConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
 
+        Queue queue =clientSession.createQueue("queue");
+
         _consumer = clientSession.createConsumer(queue);
 
         // Create Producer
 
-        Connection producerConnection = ((ConnectionFactory) _context.lookup("connection")).createConnection();
+        Connection producerConnection = getConnection("guest", "guest");
 
         producerConnection.start();
 
@@ -116,12 +95,7 @@
     protected void tearDown() throws Exception
     {
         _clientConnection.close();
-
         super.tearDown();
-        if (BROKER.contains("vm://"))
-        {
-            TransportConnection.killAllVMBrokers();
-        }
     }
 
     public void testSynchronousRecieve() throws Exception



Mime
View raw message