qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ritch...@apache.org
Subject svn commit: r449646 - in /incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid: ack/ basic/ client/channelclose/ client/message/ client/testutil/ cluster/ connection/ failover/ forwardall/ requestreply1/ topic/ transacted/ transport/ vmbroker/
Date Mon, 25 Sep 2006 11:03:18 GMT
Author: ritchiem
Date: Mon Sep 25 04:03:15 2006
New Revision: 449646

URL: http://svn.apache.org/viewvc?view=rev&rev=449646
Log:
Removed VmOrRemoteTestCase.java and the testutil package.
Updated all other tests to have correct connection URLs to allow inVM Broker usage.
Added FailoverBrokerTester.java that starts up and kills VM Brokers.

Added:
    incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/failover/FailoverBrokerTester.java   (with props)
Removed:
    incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/client/testutil/
    incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/transport/
    incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/vmbroker/
Modified:
    incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/ack/DisconnectAndRedeliverTest.java
    incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/ack/RecoverTest.java
    incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/basic/BytesMessageTest.java
    incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/basic/FieldTableMessageTest.java
    incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/basic/MultipleConnectionTest.java
    incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/basic/ObjectMessageTest.java
    incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/basic/ReceiveTest.java
    incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/basic/SessionStartTest.java
    incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/basic/TextMessageTest.java
    incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/client/channelclose/ChannelCloseOkTest.java
    incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/client/message/ObjectMessageTest.java
    incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/cluster/Client.java
    incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/connection/TestManyConnections.java
    incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/failover/FailoverTxTest.java
    incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/forwardall/Combined.java
    incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/requestreply1/VmRequestReply.java
    incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/topic/DurableSubscriptionTest.java
    incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/transacted/TransactedTest.java

Modified: incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/ack/DisconnectAndRedeliverTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/ack/DisconnectAndRedeliverTest.java?view=diff&rev=449646&r1=449645&r2=449646
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/ack/DisconnectAndRedeliverTest.java (original)
+++ incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/ack/DisconnectAndRedeliverTest.java Mon Sep 25 04:03:15 2006
@@ -20,17 +20,20 @@
 import junit.framework.JUnit4TestAdapter;
 import org.apache.qpid.client.AMQConnection;
 import org.apache.qpid.client.AMQQueue;
-import org.apache.qpid.client.testutil.VmOrRemoteTestCase;
+import org.apache.qpid.client.transport.TransportConnection;
 import org.apache.qpid.server.registry.ApplicationRegistry;
 import org.apache.qpid.server.store.TestableMemoryMessageStore;
+import org.apache.qpid.vmbroker.AMQVMBrokerCreationException;
 import org.apache.log4j.Logger;
 import org.apache.log4j.xml.DOMConfigurator;
 import org.junit.Assert;
 import org.junit.Test;
+import org.junit.After;
+import org.junit.Before;
 
 import javax.jms.*;
 
-public class DisconnectAndRedeliverTest extends VmOrRemoteTestCase
+public class DisconnectAndRedeliverTest
 {
     private static final Logger _logger = Logger.getLogger(DisconnectAndRedeliverTest.class);
 
@@ -40,21 +43,30 @@
         DOMConfigurator.configure("broker/etc/log4j.xml");
     }
 
+    @After
+    public void stopVmBroker()
+    {
+        TransportConnection.killVMBroker(1);
+    }
+
     /**
      * This tests that when there are unacknowledged messages on a channel they are requeued for delivery when
      * the channel is closed.
+     *
      * @throws Exception
      */
     @Test
     public void disconnectRedeliversMessages() throws Exception
     {
-        Connection con = new AMQConnection("foo", 1, "guest", "guest", "consumer1", "/test");
+        Connection con = new AMQConnection("vm://:1", "guest", "guest", "consumer1", "/test");
+
+        TestableMemoryMessageStore store = (TestableMemoryMessageStore) ApplicationRegistry.getInstance().getMessageStore();
 
         Session consumerSession = con.createSession(false, Session.CLIENT_ACKNOWLEDGE);
         AMQQueue queue = new AMQQueue("someQ", "someQ", false, false);
         MessageConsumer consumer = consumerSession.createConsumer(queue);
 
-        Connection con2 = new AMQConnection("bar", 2, "guest", "guest", "producer1", "/test");
+        Connection con2 = new AMQConnection("vm://:1", "guest", "guest", "producer1", "/test");
         Session producerSession = con2.createSession(false, Session.CLIENT_ACKNOWLEDGE);
         MessageProducer producer = producerSession.createProducer(queue);
 
@@ -64,6 +76,8 @@
         producer.send(producerSession.createTextMessage("msg3"));
         producer.send(producerSession.createTextMessage("msg4"));
 
+        con2.close();
+
         _logger.info("Starting connection");
         con.start();
         TextMessage tm = (TextMessage) consumer.receive();
@@ -75,7 +89,7 @@
         _logger.info("Received all four messages. About to disconnect and reconnect");
 
         con.close();
-        con = new AMQConnection("foo", 1, "guest", "guest", "consumer1", "/test");
+        con = new AMQConnection("vm://:1", "guest", "guest", "consumer1", "/test");
         consumerSession = con.createSession(false, Session.CLIENT_ACKNOWLEDGE);
         consumer = consumerSession.createConsumer(queue);
 
@@ -85,9 +99,11 @@
         tm = (TextMessage) consumer.receive(3000);
         Assert.assertEquals(tm.getText(), "msg2");
 
+
         tm = (TextMessage) consumer.receive(3000);
         Assert.assertEquals(tm.getText(), "msg3");
 
+
         tm = (TextMessage) consumer.receive(3000);
         Assert.assertEquals(tm.getText(), "msg4");
 
@@ -96,7 +112,7 @@
 
         con.close();
 
-        con = new AMQConnection("foo", 1, "guest", "guest", "consumer1", "/test");
+        con = new AMQConnection("vm://:1", "guest", "guest", "consumer1", "/test");
         consumerSession = con.createSession(false, Session.CLIENT_ACKNOWLEDGE);
         consumer = consumerSession.createConsumer(queue);
         _logger.info("Starting third consumer connection");
@@ -105,23 +121,38 @@
         Assert.assertNull(tm);
         _logger.info("No messages redelivered as is expected");
         con.close();
+
+        con = new AMQConnection("vm://:1", "guest", "guest", "consumer1", "/test");
+        consumerSession = con.createSession(false, Session.CLIENT_ACKNOWLEDGE);
+        consumer = consumerSession.createConsumer(queue);
+        _logger.info("Starting fourth consumer connection");
+        con.start();
+        tm = (TextMessage) consumer.receive(3000);
+        Assert.assertNull(tm);
+        _logger.info("No messages redelivered as is expected");
+        con.close();
+
+        _logger.info("Actually:" + store.getMessageMap().size());
+        //  Assert.assertTrue(store.getMessageMap().size() == 0);
     }
 
     /**
      * Tests that unacknowledged messages are thrown away when the channel is closed and they cannot be
      * requeued (due perhaps to the queue being deleted).
+     *
      * @throws Exception
      */
     @Test
     public void disconnectWithTransientQueueThrowsAwayMessages() throws Exception
     {
-        Connection con = new AMQConnection("foo", 1, "guest", "guest", "consumer1", "/test");
 
+        Connection con = new AMQConnection("vm://:1", "guest", "guest", "consumer1", "/test");
+        TestableMemoryMessageStore store = (TestableMemoryMessageStore) ApplicationRegistry.getInstance().getMessageStore();
         Session consumerSession = con.createSession(false, Session.CLIENT_ACKNOWLEDGE);
         Queue queue = new AMQQueue("someQ", "someQ", false, true);
         MessageConsumer consumer = consumerSession.createConsumer(queue);
 
-        Connection con2 = new AMQConnection("bar", 2, "guest", "guest", "producer1", "/test");
+        Connection con2 = new AMQConnection("vm://:1", "guest", "guest", "producer1", "/test");
         Session producerSession = con2.createSession(false, Session.CLIENT_ACKNOWLEDGE);
         MessageProducer producer = producerSession.createProducer(queue);
 
@@ -131,6 +162,8 @@
         producer.send(producerSession.createTextMessage("msg3"));
         producer.send(producerSession.createTextMessage("msg4"));
 
+        con2.close();
+
         _logger.info("Starting connection");
         con.start();
         TextMessage tm = (TextMessage) consumer.receive();
@@ -142,7 +175,7 @@
         _logger.info("Received all four messages. About to disconnect and reconnect");
 
         con.close();
-        con = new AMQConnection("foo", 1, "guest", "guest", "consumer1", "/test");
+        con = new AMQConnection("vm://:1", "guest", "guest", "consumer1", "/test");
         consumerSession = con.createSession(false, Session.CLIENT_ACKNOWLEDGE);
         consumer = consumerSession.createConsumer(queue);
 
@@ -152,7 +185,8 @@
         tm = (TextMessage) consumer.receiveNoWait();
         Assert.assertNull(tm);
         _logger.info("No messages redelivered as is expected");
-        TestableMemoryMessageStore store = (TestableMemoryMessageStore) ApplicationRegistry.getInstance().getMessageStore();
+
+        _logger.info("Actually:" + store.getMessageMap().size());
         Assert.assertTrue(store.getMessageMap().size() == 0);
         con.close();
     }

Modified: incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/ack/RecoverTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/ack/RecoverTest.java?view=diff&rev=449646&r1=449645&r2=449646
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/ack/RecoverTest.java (original)
+++ incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/ack/RecoverTest.java Mon Sep 25 04:03:15 2006
@@ -20,15 +20,18 @@
 import junit.framework.JUnit4TestAdapter;
 import org.apache.qpid.client.AMQConnection;
 import org.apache.qpid.client.AMQQueue;
-import org.apache.qpid.client.testutil.VmOrRemoteTestCase;
+import org.apache.qpid.client.transport.TransportConnection;
+import org.apache.qpid.vmbroker.AMQVMBrokerCreationException;
 import org.apache.log4j.Logger;
 import org.apache.log4j.xml.DOMConfigurator;
 import org.junit.Assert;
 import org.junit.Test;
+import org.junit.Before;
+import org.junit.After;
 
 import javax.jms.*;
 
-public class RecoverTest extends VmOrRemoteTestCase
+public class RecoverTest
 {
     private static final Logger _logger = Logger.getLogger(RecoverTest.class);
 
@@ -38,16 +41,22 @@
         DOMConfigurator.configure("broker/etc/log4j.xml");
     }
 
+    @After
+    public void stopVmBroker()
+    {
+       TransportConnection.killVMBroker(1);
+    }
+
     @Test
     public void recoverResendsMsgs() throws Exception
     {
-        Connection con = new AMQConnection("foo", 1, "guest", "guest", "consumer1", "/test");
+        Connection con = new AMQConnection("vm://:1", "guest", "guest", "consumer1", "/test");
 
         Session consumerSession = con.createSession(false, Session.CLIENT_ACKNOWLEDGE);
         Queue queue = new AMQQueue("someQ", "someQ", false, true);
         MessageConsumer consumer = consumerSession.createConsumer(queue);
 
-        Connection con2 = new AMQConnection("bar", 2, "guest", "guest", "producer1", "/test");
+        Connection con2 = new AMQConnection("vm://:1", "guest", "guest", "producer1", "/test");
         Session producerSession = con2.createSession(false, Session.CLIENT_ACKNOWLEDGE);
         MessageProducer producer = producerSession.createProducer(queue);
 
@@ -57,6 +66,8 @@
         producer.send(producerSession.createTextMessage("msg3"));
         producer.send(producerSession.createTextMessage("msg4"));
 
+        con2.close();
+
         _logger.info("Starting connection");
         con.start();
         TextMessage tm = (TextMessage) consumer.receive();
@@ -87,6 +98,9 @@
         tm = (TextMessage) consumer.receiveNoWait();
         Assert.assertNull(tm);
         _logger.info("No messages redelivered as is expected");
+
+        con.close();
+
     }
 
     public static junit.framework.Test suite()

Modified: incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/basic/BytesMessageTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/basic/BytesMessageTest.java?view=diff&rev=449646&r1=449645&r2=449646
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/basic/BytesMessageTest.java (original)
+++ incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/basic/BytesMessageTest.java Mon Sep 25 04:03:15 2006
@@ -23,7 +23,6 @@
 import org.apache.qpid.client.AMQQueue;
 import org.apache.qpid.client.AMQSession;
 import org.apache.qpid.client.message.JMSBytesMessage;
-import org.apache.qpid.client.testutil.VmOrRemoteTestCase;
 import org.apache.mina.common.ByteBuffer;
 import org.junit.Test;
 
@@ -32,7 +31,7 @@
 import java.util.Iterator;
 import java.util.List;
 
-public class BytesMessageTest extends VmOrRemoteTestCase implements MessageListener
+public class BytesMessageTest implements MessageListener
 {
     private Connection _connection;
     private Destination _destination;
@@ -40,10 +39,11 @@
     private final List<JMSBytesMessage> received = new ArrayList<JMSBytesMessage>();
     private final List<byte[]> messages = new ArrayList<byte[]>();
     private int _count = 100;
+    public String _connectionString = "vm://:1";
 
     void init() throws Exception
     {
-        init(new AMQConnection(getConnectionString(), "guest", "guest", randomize("Client"), "/test_path"));
+        init(new AMQConnection(_connectionString, "guest", "guest", randomize("Client"), "/test_path"));
     }
 
     void init(AMQConnection connection) throws Exception
@@ -182,7 +182,7 @@
         final int count;
         if (argv.length == 0)
         {
-            connectionString = "localhost:5672";
+            connectionString = "vm://:1";
             count = 100;
         }
         else
@@ -195,7 +195,7 @@
         System.out.println("count = " + count);
 
         BytesMessageTest test = new BytesMessageTest();
-        test.setConnectionString(connectionString);
+        test._connectionString = connectionString;
         test._count = count;
         test.test();
     }

Modified: incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/basic/FieldTableMessageTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/basic/FieldTableMessageTest.java?view=diff&rev=449646&r1=449645&r2=449646
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/basic/FieldTableMessageTest.java (original)
+++ incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/basic/FieldTableMessageTest.java Mon Sep 25 04:03:15 2006
@@ -23,7 +23,6 @@
 import org.apache.qpid.client.AMQQueue;
 import org.apache.qpid.client.AMQSession;
 import org.apache.qpid.client.message.JMSBytesMessage;
-import org.apache.qpid.client.testutil.VmOrRemoteTestCase;
 import org.apache.qpid.framing.AMQFrameDecodingException;
 import org.apache.qpid.framing.FieldTable;
 import org.apache.qpid.framing.FieldTableTest;
@@ -36,7 +35,7 @@
 import java.util.ArrayList;
 import java.util.Enumeration;
 
-public class FieldTableMessageTest extends VmOrRemoteTestCase implements MessageListener
+public class FieldTableMessageTest implements MessageListener
 {
     private AMQConnection _connection;
     private AMQDestination _destination;
@@ -44,11 +43,12 @@
     private final ArrayList<JMSBytesMessage> received = new ArrayList<JMSBytesMessage>();
     private FieldTable _expected;
     private int _count = 10;
+    public String _connectionString = "vm://:1";
 
     @Before
     public void init() throws Exception
     {
-        init(new AMQConnection(getConnectionString(), "guest", "guest", randomize("Client"), "/test_path"));
+        init(new AMQConnection(_connectionString, "guest", "guest", randomize("Client"), "/test_path"));
     }
 
     private void init(AMQConnection connection) throws Exception
@@ -143,7 +143,7 @@
     public static void main(String[] argv) throws Exception
     {
         FieldTableMessageTest test = new FieldTableMessageTest();
-        test.setConnectionString((argv.length == 0 ? "localhost:5672" : argv[0]));
+        test._connectionString = argv.length == 0 ? "vm://:1" : argv[0];
         test.init();
         test._count = argv.length > 1 ? Integer.parseInt(argv[1]) : 5;
         test.test();

Modified: incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/basic/MultipleConnectionTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/basic/MultipleConnectionTest.java?view=diff&rev=449646&r1=449645&r2=449646
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/basic/MultipleConnectionTest.java (original)
+++ incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/basic/MultipleConnectionTest.java Mon Sep 25 04:03:15 2006
@@ -22,7 +22,6 @@
 import org.apache.qpid.client.AMQDestination;
 import org.apache.qpid.client.AMQSession;
 import org.apache.qpid.client.AMQTopic;
-import org.apache.qpid.client.testutil.VmOrRemoteTestCase;
 import org.junit.Test;
 
 import javax.jms.*;
@@ -30,8 +29,10 @@
 /**
  * This is a slow test.
  */
-public class MultipleConnectionTest extends VmOrRemoteTestCase
+public class MultipleConnectionTest
 {
+    public static String _connectionString="vm://:1";
+
     private static class Receiver
     {
         private AMQConnection _connection;
@@ -158,20 +159,20 @@
 
     public static void main(String[] argv) throws Exception
     {
-        String broker = argv.length > 0 ? argv[0] : "localhost:5672";
+        String broker = argv.length > 0 ? argv[0] : "vm://:1";
 
         int connections = 7;
         int sessions = 2;
 
         MultipleConnectionTest test = new MultipleConnectionTest();
-        test.setConnectionString(broker);
+        test._connectionString = broker;
         test.test();
     }
 
     @Test
     public void test() throws Exception
     {
-        String broker = getConnectionString();
+        String broker = _connectionString;
         int messages = 10;
 
         AMQTopic topic = new AMQTopic("amq.topic");

Modified: incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/basic/ObjectMessageTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/basic/ObjectMessageTest.java?view=diff&rev=449646&r1=449645&r2=449646
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/basic/ObjectMessageTest.java (original)
+++ incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/basic/ObjectMessageTest.java Mon Sep 25 04:03:15 2006
@@ -23,7 +23,6 @@
 import org.apache.qpid.client.AMQQueue;
 import org.apache.qpid.client.AMQSession;
 import org.apache.qpid.client.message.JMSObjectMessage;
-import org.apache.qpid.client.testutil.VmOrRemoteTestCase;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -36,7 +35,7 @@
 import java.util.Iterator;
 import java.util.List;
 
-public class ObjectMessageTest extends VmOrRemoteTestCase implements MessageListener
+public class ObjectMessageTest implements MessageListener
 {
     private AMQConnection _connection;
     private AMQDestination _destination;
@@ -44,11 +43,12 @@
     private final List<JMSObjectMessage> received = new ArrayList<JMSObjectMessage>();
     private final List<Payload> messages = new ArrayList<Payload>();
     private int _count = 100;
+    public String _connectionString = "vm://:1";
 
     @Before
     public void init() throws Exception
     {
-        String broker = getConnectionString();
+        String broker = _connectionString;
         init(new AMQConnection(broker, "guest", "guest", randomize("Client"), "/test_path"));
     }
 
@@ -190,7 +190,7 @@
     public static void main(String[] argv) throws Exception
     {
         ObjectMessageTest test = new ObjectMessageTest();
-        test.setConnectionString(argv.length == 0 ? "localhost:5672" : argv[0]);
+        test._connectionString = argv.length == 0 ? "vm://:1" : argv[0];
         test.init();
         if (argv.length > 1)
         {

Modified: incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/basic/ReceiveTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/basic/ReceiveTest.java?view=diff&rev=449646&r1=449645&r2=449646
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/basic/ReceiveTest.java (original)
+++ incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/basic/ReceiveTest.java Mon Sep 25 04:03:15 2006
@@ -22,30 +22,25 @@
 import org.apache.qpid.client.AMQDestination;
 import org.apache.qpid.client.AMQQueue;
 import org.apache.qpid.client.AMQSession;
-import org.apache.qpid.client.message.JMSTextMessage;
-import org.apache.qpid.client.testutil.VmOrRemoteTestCase;
+
 import org.junit.Before;
 import org.junit.Test;
 
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageListener;
 import javax.jms.MessageConsumer;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
 
-public class ReceiveTest extends VmOrRemoteTestCase
+public class ReceiveTest
 {
     private AMQConnection _connection;
     private AMQDestination _destination;
     private AMQSession _session;
     private MessageConsumer _consumer;
 
+    public String _connectionString = "vm://:1";
+    
     @Before
     public void init() throws Exception
     {
-        String broker = getConnectionString();
+        String broker = _connectionString;
         init(new AMQConnection(broker, "guest", "guest", "ReceiveTestClient", "/test_path"));
     }
 
@@ -73,7 +68,7 @@
     public static void main(String[] argv) throws Exception
     {
         ReceiveTest test = new ReceiveTest();
-        test.setConnectionString(argv.length == 0 ? "localhost:5672" : argv[0]);
+        test._connectionString = argv.length == 0 ? "vm://:1" : argv[0];
         test.init();
         test.test();
     }

Modified: incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/basic/SessionStartTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/basic/SessionStartTest.java?view=diff&rev=449646&r1=449645&r2=449646
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/basic/SessionStartTest.java (original)
+++ incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/basic/SessionStartTest.java Mon Sep 25 04:03:15 2006
@@ -22,26 +22,30 @@
 import org.apache.qpid.client.AMQDestination;
 import org.apache.qpid.client.AMQQueue;
 import org.apache.qpid.client.AMQSession;
-import org.apache.qpid.client.testutil.VmOrRemoteTestCase;
+import org.apache.qpid.client.transport.TransportConnection;
+import org.apache.qpid.vmbroker.AMQVMBrokerCreationException;
+
 import org.junit.Before;
 import org.junit.Test;
+import org.junit.Assert;
+import org.junit.After;
 
 import javax.jms.JMSException;
 import javax.jms.Message;
 import javax.jms.MessageListener;
 
-public class SessionStartTest extends VmOrRemoteTestCase implements MessageListener
+public class SessionStartTest implements MessageListener
 {
     private AMQConnection _connection;
     private AMQDestination _destination;
     private AMQSession _session;
     private int count;
+    public String _connectionString = "vm://:1";  
 
     @Before
     public void init() throws Exception
     {
-        String broker = getConnectionString();
-        init(new AMQConnection(broker, "guest", "guest", randomize("Client"), "/test_path"));
+        init(new AMQConnection(_connectionString, "guest", "guest", randomize("Client"), "/test_path"));
     }
 
     private void init(AMQConnection connection) throws Exception
@@ -97,7 +101,7 @@
     public static void main(String[] argv) throws Exception
     {
         SessionStartTest test = new SessionStartTest();
-        test.setConnectionString(argv.length == 0 ? "localhost:5672" : argv[0]);
+        test._connectionString = argv.length == 0 ? "localhost:5672" : argv[0];
         test.init();
         test.test();
     }

Modified: incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/basic/TextMessageTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/basic/TextMessageTest.java?view=diff&rev=449646&r1=449645&r2=449646
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/basic/TextMessageTest.java (original)
+++ incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/basic/TextMessageTest.java Mon Sep 25 04:03:15 2006
@@ -23,7 +23,6 @@
 import org.apache.qpid.client.AMQQueue;
 import org.apache.qpid.client.AMQSession;
 import org.apache.qpid.client.message.JMSTextMessage;
-import org.apache.qpid.client.testutil.VmOrRemoteTestCase;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -35,7 +34,7 @@
 import java.util.Iterator;
 import java.util.List;
 
-public class TextMessageTest extends VmOrRemoteTestCase implements MessageListener
+public class TextMessageTest implements MessageListener
 {
     private AMQConnection _connection;
     private AMQDestination _destination;
@@ -43,12 +42,12 @@
     private final List<JMSTextMessage> received = new ArrayList<JMSTextMessage>();
     private final List<String> messages = new ArrayList<String>();
     private int _count = 100;
+    public String _connectionString ="vm://:1";
 
     @Before
     public void init() throws Exception
     {
-        String broker = getConnectionString();
-        init(new AMQConnection(broker, "guest", "guest", randomize("Client"), "/test_path"));
+        init(new AMQConnection(_connectionString, "guest", "guest", randomize("Client"), "/test_path"));
     }
 
     private void init(AMQConnection connection) throws Exception
@@ -164,7 +163,7 @@
     public static void main(String[] argv) throws Exception
     {
         TextMessageTest test = new TextMessageTest();
-        test.setConnectionString(argv.length == 0 ? "localhost:5672" : argv[0]);
+        test._connectionString = argv.length == 0 ? "vm://:1" : argv[0];
         test.init();
         if (argv.length > 1) test._count = Integer.parseInt(argv[1]);
         test.test();

Modified: incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/client/channelclose/ChannelCloseOkTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/client/channelclose/ChannelCloseOkTest.java?view=diff&rev=449646&r1=449645&r2=449646
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/client/channelclose/ChannelCloseOkTest.java (original)
+++ incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/client/channelclose/ChannelCloseOkTest.java Mon Sep 25 04:03:15 2006
@@ -20,7 +20,6 @@
 import junit.framework.JUnit4TestAdapter;
 import org.apache.qpid.client.AMQConnection;
 import org.apache.qpid.client.AMQQueue;
-import org.apache.qpid.client.testutil.VmOrRemoteTestCase;
 import org.apache.log4j.Logger;
 import org.junit.After;
 import static org.junit.Assert.assertEquals;
@@ -45,7 +44,7 @@
  * 3. Since client does not have an exception listener, currently all sessions are
  *    closed.
  */
-public class ChannelCloseOkTest extends VmOrRemoteTestCase
+public class ChannelCloseOkTest
 {
     private Connection _connection;
     private Destination _destination1;
@@ -56,11 +55,12 @@
     private final List<Message> _received2 = new ArrayList<Message>();
 
     private final static Logger _log = Logger.getLogger(ChannelCloseOkTest.class);
+    public String _connectionString = "vm://:1";
 
     @Before
     public void init() throws Exception
     {
-        _connection = new AMQConnection(getConnectionString(), "guest", "guest", randomize("Client"), "/test_path");
+        _connection = new AMQConnection(_connectionString, "guest", "guest", randomize("Client"), "/test_path");
         _destination1 = new AMQQueue("q1", true);
         _destination2 = new AMQQueue("q2", true);
         _session1 = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

Modified: incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/client/message/ObjectMessageTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/client/message/ObjectMessageTest.java?view=diff&rev=449646&r1=449645&r2=449646
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/client/message/ObjectMessageTest.java (original)
+++ incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/client/message/ObjectMessageTest.java Mon Sep 25 04:03:15 2006
@@ -21,6 +21,8 @@
 import org.apache.qpid.client.AMQQueue;
 import org.apache.qpid.client.AMQDestination;
 import org.apache.qpid.client.AMQSession;
+import org.junit.Before;
+import org.junit.Test;
 
 import javax.jms.MessageListener;
 import javax.jms.MessageProducer;
@@ -31,6 +33,8 @@
 import java.util.HashMap;
 import java.util.ArrayList;
 
+import junit.framework.JUnit4TestAdapter;
+
 public class ObjectMessageTest implements MessageListener
 {
     private final AMQConnection connection;
@@ -181,7 +185,7 @@
 
     public static void main(String[] argv) throws Exception
     {
-        String broker = argv.length > 0 ? argv[0] : "localhost:5672";
+        String broker = argv.length > 0 ? argv[0] : "vm://:1";
         if("-help".equals(broker))
         {
             System.out.println("Usage: <broker>");
@@ -244,4 +248,5 @@
     {
         return in + System.currentTimeMillis();
     }
+
 }

Modified: incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/cluster/Client.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/cluster/Client.java?view=diff&rev=449646&r1=449645&r2=449646
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/cluster/Client.java (original)
+++ incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/cluster/Client.java Mon Sep 25 04:03:15 2006
@@ -117,6 +117,8 @@
     public static void main(String[] argv) throws AMQException, JMSException, InterruptedException, URLSyntaxException
     {
         //assume args describe the set of brokers to try
-        new Client(new AMQConnection(argv[0], "guest", "guest", argv[1], "/test"), argv[1]);
+
+        String clientName = argv.length > 1 ? argv[1] : "testClient";
+        new Client(new AMQConnection(argv.length > 0 ? argv[0] : "vm://:1", "guest", "guest", clientName, "/test"), clientName);
     }
 }

Modified: incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/connection/TestManyConnections.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/connection/TestManyConnections.java?view=diff&rev=449646&r1=449645&r2=449646
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/connection/TestManyConnections.java (original)
+++ incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/connection/TestManyConnections.java Mon Sep 25 04:03:15 2006
@@ -21,11 +21,10 @@
 import org.apache.qpid.AMQException;
 import org.apache.qpid.url.URLSyntaxException;
 import org.apache.qpid.client.AMQConnection;
-import org.apache.qpid.client.testutil.VmOrRemoteTestCase;
 import org.apache.log4j.Logger;
 import org.junit.Test;
 
-public class TestManyConnections extends VmOrRemoteTestCase
+public class TestManyConnections
 {
     private static final Logger _log = Logger.getLogger(TestManyConnections.class);
 
@@ -44,7 +43,7 @@
         long startTime = System.currentTimeMillis();
         for (int i = 0; i < count; i++)
         {
-            createConnection(i, "tcp://foo", "myClient" + i, "guest", "guest", "/test");
+            createConnection(i, "vm://:1", "myClient" + i, "guest", "guest", "/test");
         }
         long endTime = System.currentTimeMillis();
         _log.info("Time to create " + count + " connections: " + (endTime - startTime) +

Added: incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/failover/FailoverBrokerTester.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/failover/FailoverBrokerTester.java?view=auto&rev=449646
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/failover/FailoverBrokerTester.java (added)
+++ incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/failover/FailoverBrokerTester.java Mon Sep 25 04:03:15 2006
@@ -0,0 +1,270 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.qpid.failover;
+
+import org.apache.log4j.Logger;
+import org.apache.qpid.client.transport.TransportConnection;
+import org.apache.qpid.vmbroker.AMQVMBrokerCreationException;
+
+public class FailoverBrokerTester implements Runnable
+{
+    private static final Logger _logger = Logger.getLogger(FailoverBrokerTester.class);
+
+    private int[] _brokers;
+    private int[] _brokersKilling;
+    private long _delayBeforeKillingStart;
+    private long _delayBetweenCullings;
+    private long _delayBetweenRecreates;
+    private boolean _recreateBrokers;
+    private long _delayBeforeReCreationStart;
+
+    private volatile boolean RUNNING;
+
+
+    /**
+     * An InVM Broker Tester. Creates then kills VM brokers to allow failover testing.
+     *
+     * @param brokerCount The number of brokers to create
+     * @param delay       The delay before and between broker killings
+     */
+    public FailoverBrokerTester(int brokerCount, long delay)
+    {
+        this(brokerCount, delay, delay, false, 0, 0);
+    }
+
+    /**
+     * An InVM Broker Tester. Creates then kills VM brokers to allow failover testing.
+     *
+     * @param brokerCount                The number of brokers
+     * @param delayBeforeKillingStart
+     * @param delayBetweenCullings
+     * @param recreateBrokers
+     * @param delayBeforeReCreationStart
+     * @param delayBetweenRecreates
+     */
+    public FailoverBrokerTester(int brokerCount, long delayBeforeKillingStart,
+                                long delayBetweenCullings, boolean recreateBrokers,
+                                long delayBeforeReCreationStart, long delayBetweenRecreates)
+    {
+        int[] brokers = new int[brokerCount];
+
+        for (int n = 0; n < brokerCount; n++)
+        {
+            brokers[n] = n + 1;
+        }
+        _brokersKilling = _brokers = brokers;
+        _recreateBrokers = recreateBrokers;
+        _delayBeforeKillingStart = delayBeforeKillingStart;
+        _delayBetweenCullings = delayBetweenCullings;
+        _delayBetweenRecreates = delayBetweenRecreates;
+        _delayBeforeReCreationStart = delayBeforeReCreationStart;
+
+        createWorld();
+    }
+
+    /**
+     * An InVM Broker Tester. Creates then kills VM brokers to allow failover testing.
+     *
+     * @param brokerArray                Array for broker creation and killing order
+     * @param delayBeforeKillingStart
+     * @param delayBetweenCullings
+     * @param recreateBrokers
+     * @param delayBeforeReCreationStart
+     * @param delayBetweenRecreates
+     */
+    public FailoverBrokerTester(int[] brokerArray, long delayBeforeKillingStart,
+                                long delayBetweenCullings, boolean recreateBrokers,
+                                long delayBeforeReCreationStart, long delayBetweenRecreates)
+    {
+        _brokersKilling = _brokers = brokerArray;
+        _recreateBrokers = recreateBrokers;
+        _delayBeforeKillingStart = delayBeforeKillingStart;
+        _delayBetweenCullings = delayBetweenCullings;
+        _delayBetweenRecreates = delayBetweenRecreates;
+        _delayBeforeReCreationStart = delayBeforeReCreationStart;
+
+        createWorld();
+    }
+
+    /**
+     * An InVM Broker Tester. Creates then kills VM brokers to allow failover testing.
+     *
+     * @param brokerCreateOrder          Array for broker creation order
+     * @param brokerKillOrder            Array for broker killing order
+     * @param delayBeforeKillingStart
+     * @param delayBetweenCullings
+     * @param recreateBrokers
+     * @param delayBeforeReCreationStart
+     * @param delayBetweenRecreates
+     */
+    public FailoverBrokerTester(int[] brokerCreateOrder, int[] brokerKillOrder, long delayBeforeKillingStart,
+                                long delayBetweenCullings, boolean recreateBrokers,
+                                long delayBeforeReCreationStart, long delayBetweenRecreates)
+    {
+        _brokers = brokerCreateOrder;
+        _brokersKilling = brokerKillOrder;
+        _recreateBrokers = recreateBrokers;
+        _delayBeforeKillingStart = delayBeforeKillingStart;
+        _delayBetweenCullings = delayBetweenCullings;
+        _delayBetweenRecreates = delayBetweenRecreates;
+        _delayBeforeReCreationStart = delayBeforeReCreationStart;
+
+        createWorld();
+    }
+
+    private void createWorld()
+    {
+        System.setProperty("amqj.NoAutoCreateVMBroker", "true");
+
+        genesis();
+
+        Thread brokerGod = new Thread(this);
+        brokerGod.setName("Broker God");
+        brokerGod.start();
+    }
+
+
+    private void genesis()
+    {
+        _logger.info("Creating " + _brokers.length + " VM Brokers.");
+        for (int count = 0; count < _brokers.length; count++)
+        {
+            try
+            {
+                TransportConnection.createVMBroker(_brokers[count]);
+            }
+            catch (AMQVMBrokerCreationException e)
+            {
+                ;
+            }
+        }
+    }
+
+    public void run()
+    {
+
+        RUNNING = true;
+        try
+        {
+            _logger.info("Sleeping before culling starts.");
+            Thread.sleep(_delayBeforeKillingStart);
+        }
+        catch (InterruptedException e)
+        {
+            _logger.info("Interupted sleeping before killing starts.");
+        }
+
+        Thread brokerGod = new Thread(new BrokerDestroyer());
+        brokerGod.setName("Broker Destroyer");
+        brokerGod.start();
+
+        if (_recreateBrokers)
+        {
+            try
+            {
+                _logger.info("Sleeping before recreation starts.");
+                Thread.sleep(_delayBeforeReCreationStart - _delayBeforeKillingStart);
+            }
+            catch (InterruptedException e)
+            {
+                _logger.info("Interupted sleeping before recreation starts.");
+            }
+
+            brokerGod = new Thread(new BrokerCreator());
+            brokerGod.setName("Broker Creator");
+            brokerGod.start();
+        }
+    }
+
+
+    public void stopTesting()
+    {
+        _logger.info("Stopping Broker Tester.");
+        RUNNING = false;
+    }
+
+    class BrokerCreator implements Runnable
+    {
+        public void run()
+        {
+            _logger.info("Created Broker Creator.");
+            while (RUNNING)
+            {
+                for (int count = 0; count < _brokers.length; count++)
+                {
+                    try
+                    {
+                        _logger.info("Creating Broker:" + _brokers[count]);
+                        TransportConnection.createVMBroker(_brokers[count]);
+                    }
+                    catch (AMQVMBrokerCreationException e)
+                    {
+                        _logger.info("Unable to recreate broker:" + count + ", Port:" + _brokers[count]);
+                    }
+                    try
+                    {
+                        Thread.sleep(_delayBetweenRecreates);
+                    }
+                    catch (InterruptedException e)
+                    {
+                        _logger.info("Interupted between broker recreates.");
+                    }
+                }
+            }
+            _logger.info("Ending Broker Creator.");
+        }
+    }
+
+    class BrokerDestroyer implements Runnable
+    {
+        public void run()
+        {
+            _logger.info("Created Broker Destroyer.");
+            while (RUNNING)
+            {
+                for (int count = 0; count < _brokersKilling.length; count++)
+                {
+                    _logger.info("Destroying Broker:" + _brokersKilling[count]);
+                    killNextBroker(_brokersKilling[count], _delayBetweenCullings);
+                }
+            }
+            _logger.info("Ending Broker Destroyer.");
+        }
+
+        private void killNextBroker(int broker, long delay)
+        {
+
+            //Kill the broker
+            TransportConnection.killVMBroker(broker);
+
+            //Give the client time to get up and going
+            try
+            {
+                Thread.sleep(delay);
+            }
+            catch (InterruptedException e)
+            {
+                _logger.info("Sleeping before broker killing was interrupted,");
+            }
+
+
+        }
+    }
+
+
+}

Propchange: incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/failover/FailoverBrokerTester.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/failover/FailoverTxTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/failover/FailoverTxTest.java?view=diff&rev=449646&r1=449645&r2=449646
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/failover/FailoverTxTest.java (original)
+++ incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/failover/FailoverTxTest.java Mon Sep 25 04:03:15 2006
@@ -21,8 +21,10 @@
 import org.apache.qpid.client.AMQConnection;
 import org.apache.qpid.client.AMQConnectionURL;
 import org.apache.qpid.jms.ConnectionListener;
+import org.junit.Assert;
 
 import javax.jms.*;
+import javax.jms.IllegalStateException;
 
 public class FailoverTxTest implements ConnectionListener
 {
@@ -38,7 +40,8 @@
         Session session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
         Destination queue = session.createTemporaryQueue();
 
-        session.createConsumer(queue).setMessageListener(new MessageListener() {
+        session.createConsumer(queue).setMessageListener(new MessageListener()
+        {
             public void onMessage(Message message)
             {
                 try
@@ -47,7 +50,7 @@
                 }
                 catch (JMSException e)
                 {
-                   error(e);
+                    error(e);
                 }
             }
         });
@@ -71,12 +74,15 @@
                 TextMessage msg = session.createTextMessage("Tx=" + i + " msg=" + j);
                 _log.info("sending message = " + msg.getText());
                 producer.send(msg);
-                try {
+                try
+                {
                     Thread.sleep(1000);
-                } catch (InterruptedException e) {
+                }
+                catch (InterruptedException e)
+                {
                     throw new RuntimeException("Someone interrupted me!", e);
                 }
-             }
+            }
             session.commit();
         }
     }
@@ -91,7 +97,7 @@
     {
         System.out.println("Stopping...");
         try
-        {
+        {                                                            
             _connection.close();
         }
         catch (JMSException e)
@@ -128,19 +134,46 @@
 
     public static void main(final String[] argv) throws Exception
     {
-        try {
+        int[] creationOrder = {1, 2, 3};
+        int[] killingOrder = {1, 2, 3};
+        long delayBeforeKillingStart = 2000;
+        long delayBetweenCullings = 2000;
+        boolean recreateBrokers = true;
+        long delayBeforeReCreationStart = 4000;
+        long delayBetweenRecreates = 3000;
+
+        FailoverBrokerTester tester = new FailoverBrokerTester(creationOrder, killingOrder, delayBeforeKillingStart, delayBetweenCullings,
+                                                               recreateBrokers, delayBeforeReCreationStart, delayBetweenRecreates);
+
+        try
+        {
             final String clientId = "failover" + System.currentTimeMillis();
             final String defaultUrl = "amqp://guest:guest@" + clientId + "/test" +
-                        "?brokerlist='tcp://localhost:5672;tcp://localhost:5673'&failover='roundrobin'";
+                                      "?brokerlist='vm://:1;vm://:2;vm://:3'&failover='roundrobin?cyclecount='2''";
 
             System.out.println("url = [" + defaultUrl + "]");
 
             System.out.println("connection url = [" + new AMQConnectionURL(defaultUrl) + "]");
 
-            final String url = argv.length == 0? defaultUrl : argv[0];
+            final String url = argv.length == 0 ? defaultUrl : argv[0];
             new FailoverTxTest(url);
-        } catch (Throwable t) {
-            _log.error("test failed", t);
+
+        }
+        catch (Throwable t)
+        {
+
+            if (t instanceof IllegalStateException)
+            {
+                t.getMessage().endsWith("has been closed");
+            }
+            else
+            {
+                Assert.fail("Unexpected Exception occured:" + t.getMessage());
+            }
+        }
+        finally
+        {
+            tester.stopTesting();
         }
     }
 }

Modified: incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/forwardall/Combined.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/forwardall/Combined.java?view=diff&rev=449646&r1=449645&r2=449646
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/forwardall/Combined.java (original)
+++ incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/forwardall/Combined.java Mon Sep 25 04:03:15 2006
@@ -18,27 +18,32 @@
 package org.apache.qpid.forwardall;
 
 import junit.framework.JUnit4TestAdapter;
-import org.apache.qpid.client.testutil.VmOrRemoteTestCase;
 import org.junit.Test;
+import org.junit.Before;
+import org.junit.Assert;
+import org.junit.After;
+import org.apache.qpid.client.transport.TransportConnection;
+import org.apache.qpid.server.registry.ApplicationRegistry;
+import org.apache.qpid.vmbroker.AMQVMBrokerCreationException;
 
 /**
  * Runs the Service's and Client parts of the test in the same process
  * as the broker
  */
-public class Combined extends VmOrRemoteTestCase
+public class Combined
 {
     @Test
     public void forwardAll() throws Exception
     {
         int services = 2;
-        ServiceCreator.start("tcp://ignore:1234", services);
+        ServiceCreator.start("vm://:1", services);
 
         //give them time to get registered etc.
         System.out.println("Services started, waiting for them to initialise...");
         Thread.sleep(5 * 1000);
         System.out.println("Starting client...");
 
-        new Client("tcp://ignore:1234", services).waitUntilComplete();
+        new Client("vm://:1", services).waitUntilComplete();
 
         System.out.println("Completed successfully!");
     }

Modified: incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/requestreply1/VmRequestReply.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/requestreply1/VmRequestReply.java?view=diff&rev=449646&r1=449645&r2=449646
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/requestreply1/VmRequestReply.java (original)
+++ incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/requestreply1/VmRequestReply.java Mon Sep 25 04:03:15 2006
@@ -17,23 +17,46 @@
  */
 package org.apache.qpid.requestreply1;
 
-import org.apache.qpid.vmbroker.VmPipeBroker;
+import org.apache.qpid.vmbroker.AMQVMBrokerCreationException;
+import org.apache.qpid.client.transport.TransportConnection;
 import org.junit.Test;
+import org.junit.Before;
+import org.junit.Assert;
+import org.junit.After;
 import org.apache.log4j.Logger;
 import junit.framework.JUnit4TestAdapter;
 
-public class VmRequestReply extends VmPipeBroker
+public class VmRequestReply
 {
     private static final Logger _logger = Logger.getLogger(VmRequestReply.class);
 
+    @Before
+    public void startVmBrokers()
+    {
+        try
+        {
+            TransportConnection.createVMBroker(1);
+        }
+        catch (AMQVMBrokerCreationException e)
+        {
+            Assert.fail("Unable to create VM Broker");
+        }
+    }
+
+    @After
+    public void stopVmBrokers()
+    {
+        TransportConnection.killVMBroker(1);
+    }
+
     @Test
     public void simpleClient() throws Exception
     {
-        ServiceProvidingClient serviceProvider = new ServiceProvidingClient("tcp://foo:123", "guest", "guest",
+        ServiceProvidingClient serviceProvider = new ServiceProvidingClient("vm://:1", "guest", "guest",
                                                                             "serviceProvidingClient", "/test",
                                                                             "serviceQ");
 
-        ServiceRequestingClient serviceRequester = new ServiceRequestingClient("tcp://foo:123", "myClient", "guest", "guest",
+        ServiceRequestingClient serviceRequester = new ServiceRequestingClient("vm://:1", "myClient", "guest", "guest",
                                                                                "/test", "serviceQ", 5000, 512);
 
         serviceProvider.run();
@@ -58,7 +81,6 @@
         VmRequestReply rr = new VmRequestReply();
         try
         {
-            rr.initialiseBroker();
             rr.simpleClient();
         }
         catch (Exception e)

Modified: incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/topic/DurableSubscriptionTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/topic/DurableSubscriptionTest.java?view=diff&rev=449646&r1=449645&r2=449646
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/topic/DurableSubscriptionTest.java (original)
+++ incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/topic/DurableSubscriptionTest.java Mon Sep 25 04:03:15 2006
@@ -20,13 +20,15 @@
 import junit.framework.JUnit4TestAdapter;
 import org.junit.Assert;
 import org.junit.Test;
+import org.junit.Before;
+import org.junit.After;
 import org.apache.qpid.AMQException;
+import org.apache.qpid.vmbroker.AMQVMBrokerCreationException;
 import org.apache.qpid.url.URLSyntaxException;
 import org.apache.qpid.client.AMQConnection;
 import org.apache.qpid.client.AMQSession;
 import org.apache.qpid.client.AMQTopic;
-import org.apache.qpid.client.testutil.VmOrRemoteTestCase;
-import org.apache.qpid.vmbroker.VmPipeBroker;
+import org.apache.qpid.client.transport.TransportConnection;
 
 import javax.jms.JMSException;
 import javax.jms.Message;
@@ -36,13 +38,33 @@
 import javax.jms.TextMessage;
 import javax.jms.TopicSubscriber;
 
-public class DurableSubscriptionTest extends VmOrRemoteTestCase
+public class DurableSubscriptionTest
 {
+
+          @Before
+    public void startVmBrokers()
+    {
+        try
+        {
+            TransportConnection.createVMBroker(1);
+        }
+        catch (AMQVMBrokerCreationException e)
+        {
+            Assert.fail("Unable to create VM Broker");
+        }
+    }
+
+    @After
+    public void stopVmBrokers()
+    {
+        TransportConnection.killVMBroker(1);
+    }
+
     @Test
     public void unsubscribe() throws AMQException, JMSException, URLSyntaxException
     {
         AMQTopic topic = new AMQTopic("MyTopic");
-        AMQConnection con = new AMQConnection("vm:1", "guest", "guest", "test", "/test");
+        AMQConnection con = new AMQConnection("vm://:1", "guest", "guest", "test", "/test");
         Session session1 = con.createSession(false, AMQSession.NO_ACKNOWLEDGE);
         MessageConsumer consumer1 = session1.createConsumer(topic);
         MessageProducer producer = session1.createProducer(topic);
@@ -84,7 +106,7 @@
     public void durability() throws AMQException, JMSException, URLSyntaxException
     {
         AMQTopic topic = new AMQTopic("MyTopic");
-        AMQConnection con = new AMQConnection("vm:1", "guest", "guest", "test", "/test");
+        AMQConnection con = new AMQConnection("vm://:1", "guest", "guest", "test", "/test");
         Session session1 = con.createSession(false, AMQSession.NO_ACKNOWLEDGE);
         MessageConsumer consumer1 = session1.createConsumer(topic);
         MessageProducer producer = session1.createProducer(topic);

Modified: incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/transacted/TransactedTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/transacted/TransactedTest.java?view=diff&rev=449646&r1=449645&r2=449646
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/transacted/TransactedTest.java (original)
+++ incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/transacted/TransactedTest.java Mon Sep 25 04:03:15 2006
@@ -21,16 +21,18 @@
 import org.apache.qpid.client.AMQConnection;
 import org.apache.qpid.client.AMQQueue;
 import org.apache.qpid.client.AMQSession;
-import org.apache.qpid.client.testutil.VmOrRemoteTestCase;
+import org.apache.qpid.client.transport.TransportConnection;
+import org.apache.qpid.vmbroker.AMQVMBrokerCreationException;
 import org.junit.After;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import org.junit.Before;
 import org.junit.Test;
+import org.junit.Assert;
 
 import javax.jms.*;
 
-public class TransactedTest extends VmOrRemoteTestCase
+public class TransactedTest
 {
     private AMQQueue queue1;
     private AMQQueue queue2;
@@ -52,28 +54,36 @@
     @Before
     public void setup() throws Exception
     {
+        try
+        {
+            TransportConnection.createVMBroker(1);
+        }
+        catch (AMQVMBrokerCreationException e)
+        {
+            Assert.fail("Unable to create VM Broker");
+        }
+
         queue1 = new AMQQueue("Q1", false);
         queue2 = new AMQQueue("Q2", false);
 
-        con = new AMQConnection("localhost:5672", "guest", "guest", "TransactedTest", "/test");
+        con = new AMQConnection("vm://:1", "guest", "guest", "TransactedTest", "/test");
         session = con.createSession(true, 0);
         consumer = session.createConsumer(queue1);
         producer = session.createProducer(queue2);
         con.start();
 
-        prepCon = new AMQConnection("localhost:5672", "guest", "guest", "PrepConnection", "/test");
+        prepCon = new AMQConnection("vm://:1", "guest", "guest", "PrepConnection", "/test");
         prepSession = prepCon.createSession(false, AMQSession.NO_ACKNOWLEDGE);
         prepProducer = prepSession.createProducer(queue1);
         prepCon.start();
 
-
         //add some messages
         prepProducer.send(prepSession.createTextMessage("A"));
         prepProducer.send(prepSession.createTextMessage("B"));
         prepProducer.send(prepSession.createTextMessage("C"));
 
 
-        testCon = new AMQConnection("localhost:5672", "guest", "guest", "TestConnection", "/test");
+        testCon = new AMQConnection("vm://:1", "guest", "guest", "TestConnection", "/test");
         testSession = testCon.createSession(false, AMQSession.NO_ACKNOWLEDGE);
         testConsumer1 = testSession.createConsumer(queue1);
         testConsumer2 = testSession.createConsumer(queue2);
@@ -86,6 +96,8 @@
         con.close();
         testCon.close();
         prepCon.close();
+
+        TransportConnection.killVMBroker(1);
     }
 
     @Test



Mime
View raw message