You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gr...@apache.org on 2011/03/07 17:59:01 UTC

svn commit: r1078854 - /qpid/branches/grkvlt-network-20110301/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseTest.java

Author: grkvlt
Date: Mon Mar  7 16:59:01 2011
New Revision: 1078854

URL: http://svn.apache.org/viewvc?rev=1078854&view=rev
Log:
QPID-3113: Exclude ChannelCloseTest from 0-10 profiles only

Modified:
    qpid/branches/grkvlt-network-20110301/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseTest.java

Modified: qpid/branches/grkvlt-network-20110301/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/grkvlt-network-20110301/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseTest.java?rev=1078854&r1=1078853&r2=1078854&view=diff
==============================================================================
--- qpid/branches/grkvlt-network-20110301/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseTest.java (original)
+++ qpid/branches/grkvlt-network-20110301/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseTest.java Mon Mar  7 16:59:01 2011
@@ -28,7 +28,6 @@ import org.apache.qpid.client.protocol.A
 import org.apache.qpid.framing.*;
 import org.apache.qpid.jms.ConnectionListener;
 import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.url.URLSyntaxException;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -48,70 +47,67 @@ public class ChannelCloseTest extends Qp
     private static final Logger _logger = LoggerFactory.getLogger(ChannelCloseTest.class);
 
     Connection _connection;
-    private String _brokerlist = "vm://:1";
     private Session _session;
     private static final long SYNC_TIMEOUT = 500;
     private int TEST = 0;
 
-    /*
-          close channel, use chanel with same id ensure error.
+    /**
+     * Close channel, use chanel with same id ensure error.
+     *
+     * This test is only valid for non 0-10 connection .
      */
     public void testReusingChannelAfterFullClosure() throws Exception
     {
-        // this is testing an inVM Connetion conneciton 
-        if (isJavaBroker() && !isExternalBroker())
+        _connection=newConnection();
+
+        // Create Producer
+        try
         {
-            _connection=newConnection();
+            _connection.start();
+
+            createChannelAndTest(1);
 
-            // Create Producer
+            // Cause it to close
             try
             {
-                _connection.start();
-
-                createChannelAndTest(1);
-
-                // Cause it to close
-                try
-                {
-                    _logger.info("Testing invalid exchange");
-                    declareExchange(1, "", "name_that_will_lookup_to_null", false);
-                    fail("Exchange name is empty so this should fail ");
-                }
-                catch (AMQException e)
-                {
-                    assertEquals("Exchange should not be found", AMQConstant.NOT_FOUND, e.getErrorCode());
-                }
+                _logger.info("Testing invalid exchange");
+                declareExchange(1, "", "name_that_will_lookup_to_null", false);
+                fail("Exchange name is empty so this should fail ");
+            }
+            catch (AMQException e)
+            {
+                assertEquals("Exchange should not be found", AMQConstant.NOT_FOUND, e.getErrorCode());
+            }
 
-                // Check that
-                try
+            // Check that
+            try
+            {
+                _logger.info("Testing valid exchange should fail");
+                declareExchange(1, "topic", "amq.topic", false);
+                fail("This should not succeed as the channel should be closed ");
+            }
+            catch (AMQException e)
+            {
+                if (_logger.isInfoEnabled())
                 {
-                    _logger.info("Testing valid exchange should fail");
-                    declareExchange(1, "topic", "amq.topic", false);
-                    fail("This should not succeed as the channel should be closed ");
+                    _logger.info("Exception occured was:" + e.getErrorCode());
                 }
-                catch (AMQException e)
-                {
-                    if (_logger.isInfoEnabled())
-                    {
-                        _logger.info("Exception occured was:" + e.getErrorCode());
-                    }
 
-                    assertEquals("Connection should be closed", AMQConstant.CHANNEL_ERROR, e.getErrorCode());
+                assertEquals("Connection should be closed", AMQConstant.CHANNEL_ERROR, e.getErrorCode());
 
-                    _connection=newConnection();
-                }
+                _connection=newConnection();
+            }
 
-                checkSendingMessage();
+            checkSendingMessage();
 
-                _session.close();
-                _connection.close();
+            _session.close();
+            _connection.close();
 
-            }
-            catch (JMSException e)
-            {
-                e.printStackTrace();
-                fail(e.getMessage());
-            }
+        }
+        catch (JMSException e)
+        {
+            e.printStackTrace();
+            fail(e.getMessage());
         }
     }
 
@@ -305,27 +301,19 @@ public class ChannelCloseTest extends Qp
 
     private Connection newConnection()
     {
-        AMQConnection connection = null;
+        Connection connection = null;
         try
         {
-            connection = new AMQConnection("amqp://guest:guest@CCTTest/test?brokerlist='" + _brokerlist + "'");
+            connection = getConnection();
 
-            connection.setConnectionListener(this);
+            ((AMQConnection) connection).setConnectionListener(this);
 
             _session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
 
             connection.start();
 
         }
-        catch (JMSException e)
-        {
-            fail("Creating new connection when:" + e.getMessage());
-        }
-        catch (AMQException e)
-        {
-            fail("Creating new connection when:" + e.getMessage());
-        }
-        catch (URLSyntaxException e)
+        catch (Exception e)
         {
             fail("Creating new connection when:" + e.getMessage());
         }



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org