qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arnaudsi...@apache.org
Subject svn commit: r581009 - in /incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/basic: ObjectMessageTest.java PropertyValueTest.java PubSubTwoConnectionTest.java ReceiveTest.java SelectorTest.java TextMessageTest.java
Date Mon, 01 Oct 2007 16:33:33 GMT
Author: arnaudsimon
Date: Mon Oct  1 09:33:29 2007
New Revision: 581009

URL: http://svn.apache.org/viewvc?rev=581009&view=rev
Log:
Changed to use QpidTestCase

Modified:
    incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/basic/ObjectMessageTest.java
    incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/basic/PropertyValueTest.java
    incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/basic/PubSubTwoConnectionTest.java
    incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/basic/ReceiveTest.java
    incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/basic/SelectorTest.java
    incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/basic/TextMessageTest.java

Modified: incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/basic/ObjectMessageTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/basic/ObjectMessageTest.java?rev=581009&r1=581008&r2=581009&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/basic/ObjectMessageTest.java
(original)
+++ incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/basic/ObjectMessageTest.java
Mon Oct  1 09:33:29 2007
@@ -28,6 +28,7 @@
 import org.apache.qpid.client.AMQSession;
 import org.apache.qpid.client.message.JMSObjectMessage;
 import org.apache.qpid.client.transport.TransportConnection;
+import org.apache.qpid.testutil.QpidTestCase;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -43,7 +44,7 @@
 import java.util.Iterator;
 import java.util.List;
 
-public class ObjectMessageTest extends TestCase implements MessageListener
+public class ObjectMessageTest extends QpidTestCase implements MessageListener
 {
     private static final Logger _logger = LoggerFactory.getLogger(ObjectMessageTest.class);
 
@@ -58,10 +59,9 @@
     protected void setUp() throws Exception
     {
         super.setUp();
-        TransportConnection.createVMBroker(1);
         try
         {
-            init(new AMQConnection(_connectionString, "guest", "guest", randomize("Client"),
"test"));
+            init( (AMQConnection) getConnection("guest", "guest"));
         }
         catch (Exception e)
         {
@@ -72,7 +72,6 @@
     protected void tearDown() throws Exception
     {
         super.tearDown();
-        TransportConnection.killAllVMBrokers();
     }
 
     private void init(AMQConnection connection) throws Exception

Modified: incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/basic/PropertyValueTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/basic/PropertyValueTest.java?rev=581009&r1=581008&r2=581009&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/basic/PropertyValueTest.java
(original)
+++ incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/basic/PropertyValueTest.java
Mon Oct  1 09:33:29 2007
@@ -30,6 +30,7 @@
 import org.apache.qpid.client.message.JMSTextMessage;
 import org.apache.qpid.client.transport.TransportConnection;
 import org.apache.qpid.framing.AMQShortString;
+import org.apache.qpid.testutil.QpidTestCase;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -47,7 +48,7 @@
 import java.util.Iterator;
 import java.util.List;
 
-public class PropertyValueTest extends TestCase implements MessageListener
+public class PropertyValueTest extends QpidTestCase implements MessageListener
 {
     private static final Logger _logger = LoggerFactory.getLogger(PropertyValueTest.class);
 
@@ -63,13 +64,11 @@
     protected void setUp() throws Exception
     {
         super.setUp();
-        TransportConnection.createVMBroker(1);
     }
 
     protected void tearDown() throws Exception
     {
         super.tearDown();
-        TransportConnection.killVMBroker(1);
     }
 
     private void init(AMQConnection connection) throws Exception
@@ -109,7 +108,7 @@
                 _logger.error("Run Number:" + run++);
                 try
                 {
-                    init(new AMQConnection(_connectionString, "guest", "guest", randomize("Client"),
"test"));
+                    init( (AMQConnection) getConnection("guest", "guest"));
                 }
                 catch (Exception e)
                 {

Modified: incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/basic/PubSubTwoConnectionTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/basic/PubSubTwoConnectionTest.java?rev=581009&r1=581008&r2=581009&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/basic/PubSubTwoConnectionTest.java
(original)
+++ incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/basic/PubSubTwoConnectionTest.java
Mon Oct  1 09:33:29 2007
@@ -33,16 +33,16 @@
 import org.apache.qpid.client.AMQSession;
 import org.apache.qpid.client.AMQTopic;
 import org.apache.qpid.client.transport.TransportConnection;
+import org.apache.qpid.testutil.QpidTestCase;
 
 /**
  * @author Apache Software Foundation
  */
-public class PubSubTwoConnectionTest extends TestCase
+public class PubSubTwoConnectionTest extends QpidTestCase
 {
     protected void setUp() throws Exception
     {
         super.setUp();
-        TransportConnection.createVMBroker(1);
     }
 
     protected void tearDown() throws Exception
@@ -57,14 +57,14 @@
     public void testTwoConnections() throws Exception
     {
 
-        AMQConnection con1 = new AMQConnection("vm://:1", "guest", "guest", "Client1", "test");
+        AMQConnection con1 = (AMQConnection) getConnection("guest", "guest");
 
         Topic topic = new AMQTopic(con1, "MyTopic");
 
         Session session1 = con1.createSession(false, AMQSession.NO_ACKNOWLEDGE);
         MessageProducer producer = session1.createProducer(topic);
 
-        Connection con2 = new AMQConnection("vm://:1", "guest", "guest", "Client2", "test");
+        Connection con2 = (AMQConnection) getConnection("guest", "guest") ;
         Session session2 = con2.createSession(false, AMQSession.NO_ACKNOWLEDGE);
         MessageConsumer consumer = session2.createConsumer(topic);
         con2.start();        

Modified: incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/basic/ReceiveTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/basic/ReceiveTest.java?rev=581009&r1=581008&r2=581009&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/basic/ReceiveTest.java
(original)
+++ incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/basic/ReceiveTest.java
Mon Oct  1 09:33:29 2007
@@ -21,6 +21,7 @@
 package org.apache.qpid.test.unit.basic;
 
 import javax.jms.MessageConsumer;
+import javax.jms.Message;
 
 import junit.framework.TestCase;
 
@@ -30,46 +31,23 @@
 import org.apache.qpid.client.AMQSession;
 import org.apache.qpid.client.transport.TransportConnection;
 import org.apache.qpid.client.vmbroker.AMQVMBrokerCreationException;
+import org.apache.qpid.testutil.QpidTestCase;
 
-public class ReceiveTest extends TestCase
+public class ReceiveTest extends QpidTestCase
 {
     private AMQConnection _connection;
     private AMQDestination _destination;
     private AMQSession _session;
     private MessageConsumer _consumer;
 
-    private static final String VM_BROKER = "vm://:1";
-    public String _connectionString = VM_BROKER;
-
     protected void setUp() throws Exception
     {
         super.setUp();
-        if (_connectionString.equals(VM_BROKER))
-        {
-            createVMBroker();
-            String broker = _connectionString;
-            init(new AMQConnection(broker, "guest", "guest", "ReceiveTestClient", "test"));
-        }
-    }
-
-    public void createVMBroker()
-    {
-        try
-        {
-            TransportConnection.createVMBroker(1);
-        }
-        catch (AMQVMBrokerCreationException e)
-        {
-            fail("Unable to create broker: " + e);
-        }
+       init((AMQConnection) getConnection("guest", "guest"));
     }
 
-    protected void tearDown() throws Exception
+   protected void tearDown() throws Exception
     {
-        if (_connectionString.equals(VM_BROKER))
-        {
-            TransportConnection.killVMBroker(1);
-        }
         super.tearDown();
     }
 
@@ -89,18 +67,11 @@
 
     public void test() throws Exception
     {
-        _consumer.receive(5000);
+        Message m = _consumer.receive(5000);
+        assertNull("should not have received a message", m);
         _connection.close();
     }
 
-    public static void main(String[] argv) throws Exception
-    {
-        ReceiveTest test = new ReceiveTest();
-        test._connectionString = argv.length == 0 ? VM_BROKER : argv[0];
-        test.setUp();
-        test.test();
-        test.tearDown();
-    }
 
     public static junit.framework.Test suite()
     {

Modified: incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/basic/SelectorTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/basic/SelectorTest.java?rev=581009&r1=581008&r2=581009&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/basic/SelectorTest.java
(original)
+++ incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/basic/SelectorTest.java
Mon Oct  1 09:33:29 2007
@@ -28,6 +28,7 @@
 import org.apache.qpid.client.AMQSession;
 import org.apache.qpid.client.BasicMessageProducer;
 import org.apache.qpid.client.transport.TransportConnection;
+import org.apache.qpid.testutil.QpidTestCase;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -37,7 +38,7 @@
 import javax.jms.Message;
 import javax.jms.MessageListener;
 
-public class SelectorTest extends TestCase implements MessageListener
+public class SelectorTest extends QpidTestCase  implements MessageListener
 {
     private static final Logger _logger = LoggerFactory.getLogger(SelectorTest.class);
 
@@ -50,14 +51,12 @@
     protected void setUp() throws Exception
     {
         super.setUp();
-        TransportConnection.createVMBroker(1);
-        init(new AMQConnection(_connectionString, "guest", "guest", randomize("Client"),
"test"));
+         init((AMQConnection) getConnection("guest", "guest"));
     }
 
     protected void tearDown() throws Exception
     {
         super.tearDown();
-        TransportConnection.killAllVMBrokers();
     }
 
     private void init(AMQConnection connection) throws Exception

Modified: incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/basic/TextMessageTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/basic/TextMessageTest.java?rev=581009&r1=581008&r2=581009&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/basic/TextMessageTest.java
(original)
+++ incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/basic/TextMessageTest.java
Mon Oct  1 09:33:29 2007
@@ -27,7 +27,6 @@
 import org.apache.qpid.client.AMQSession;
 import org.apache.qpid.client.message.JMSTextMessage;
 import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.testutil.VMBrokerSetup;
 import org.apache.qpid.testutil.QpidTestCase;
 
 import org.slf4j.Logger;
@@ -95,7 +94,6 @@
         }
         catch (Throwable  e)
         {
-// TODO
             e.printStackTrace();
         }
         connection.start();
@@ -120,7 +118,7 @@
             String text = "Message " + i;
             messages.add(text);
             Message m = _session.createTextMessage(text);
-            m.setStringProperty("String", "hello");
+            //m.setStringProperty("String", "hello");
 
             _logger.info("Sending Msg:" + m);
             producer.send(m);



Mime
View raw message