You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rh...@apache.org on 2007/01/26 17:48:52 UTC

svn commit: r500282 - in /incubator/qpid/branches/qpid.0-9/java: broker/src/main/java/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java systests/src/test/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBeanTest.java

Author: rhs
Date: Fri Jan 26 08:48:51 2007
New Revision: 500282

URL: http://svn.apache.org/viewvc?view=rev&rev=500282
Log:
Modified the protocol session to create channel zero by default. Updated the AMQProtocolSessionMBeanTest accordingly

Modified:
    incubator/qpid/branches/qpid.0-9/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java
    incubator/qpid/branches/qpid.0-9/java/systests/src/test/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBeanTest.java

Modified: incubator/qpid/branches/qpid.0-9/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java?view=diff&rev=500282&r1=500281&r2=500282
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java Fri Jan 26 08:48:51 2007
@@ -144,6 +144,7 @@
         _managedObject.register();
         _closePending = false;
         _closed = false;
+        createChannel(0);
     }
 
     public AMQMinaProtocolSession(IoSession session, QueueRegistry queueRegistry, ExchangeRegistry exchangeRegistry,
@@ -162,6 +163,7 @@
         _managedObject.register();
         _closePending = false;
         _closed = false;
+        createChannel(0);
     }
 
     private AMQProtocolSessionMBean createMBean() throws AMQException
@@ -215,7 +217,6 @@
                 String mechanisms = ApplicationRegistry.getInstance().getAuthenticationManager().getMechanisms();
                 String locales = "en_US";
                 // Interfacing with generated code - be aware of possible changes to parameter order as versions change.
-                createChannel(0);
                 AMQMethodBody connectionStartBody = ConnectionStartBody.createMethodBody
                     ((byte)_major, (byte)_minor,	// AMQP version (major, minor)
                      locales.getBytes(),	// locales

Modified: incubator/qpid/branches/qpid.0-9/java/systests/src/test/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBeanTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/systests/src/test/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBeanTest.java?view=diff&rev=500282&r1=500281&r2=500282
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/systests/src/test/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBeanTest.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/systests/src/test/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBeanTest.java Fri Jan 26 08:48:51 2007
@@ -50,10 +50,10 @@
     {
         // check the channel count is correct
         int channelCount = _mbean.channels().size();
-        assertTrue(channelCount == 1);
+        assertTrue(channelCount == 2);
         _protocolSession.addChannel(new AMQChannel(2,_protocolSession, _messageStore, null,null));
         channelCount = _mbean.channels().size();
-        assertTrue(channelCount == 2);
+        assertTrue(channelCount == 3);
 
         // general properties test
         _mbean.setMaximumNumberOfChannels(1000L);
@@ -82,15 +82,15 @@
         // check if closing of session works
         _protocolSession.addChannel(new AMQChannel(5,_protocolSession, _messageStore, null,null));
         _mbean.closeConnection();
+        channelCount = _mbean.channels().size();
+        assertTrue(channelCount == 0);
         try
         {
-        	channelCount = _mbean.channels().size();
-			assertTrue(channelCount == 0);
-			// session is now closed so adding another channel should throw an exception
-			_protocolSession.addChannel(new AMQChannel(6,_protocolSession, _messageStore, null,null));
-			fail();
+            // session is now closed so adding another channel should throw an exception
+            _protocolSession.addChannel(new AMQChannel(6,_protocolSession, _messageStore, null,null));
+            fail();
         }
-        catch(OpenDataException ex)
+        catch(IllegalStateException ex)
         {
             System.out.println("expected exception is thrown :" + ex.getMessage());
         }