From 4437ede734dec42908112ef41e14a2c86a9d98c7 Mon Sep 17 00:00:00 2001 From: "Rafael H. Schloming" Date: Fri, 26 Jan 2007 16:48:51 +0000 Subject: Modified the protocol session to create channel zero by default. Updated the AMQProtocolSessionMBeanTest accordingly git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/qpid.0-9@500282 13f79535-47bb-0310-9956-ffa450edef68 --- .../qpid/server/protocol/AMQMinaProtocolSession.java | 3 ++- .../server/protocol/AMQProtocolSessionMBeanTest.java | 16 ++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) (limited to 'java') diff --git a/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java b/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java index 766a035f80..d12416437d 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java +++ b/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java @@ -144,6 +144,7 @@ public class AMQMinaProtocolSession implements AMQProtocolSession, _managedObject.register(); _closePending = false; _closed = false; + createChannel(0); } public AMQMinaProtocolSession(IoSession session, QueueRegistry queueRegistry, ExchangeRegistry exchangeRegistry, @@ -162,6 +163,7 @@ public class AMQMinaProtocolSession implements AMQProtocolSession, _managedObject.register(); _closePending = false; _closed = false; + createChannel(0); } private AMQProtocolSessionMBean createMBean() throws AMQException @@ -215,7 +217,6 @@ public class AMQMinaProtocolSession implements AMQProtocolSession, 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 diff --git a/java/systests/src/test/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBeanTest.java b/java/systests/src/test/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBeanTest.java index b4372049dd..f84f14f28d 100644 --- a/java/systests/src/test/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBeanTest.java +++ b/java/systests/src/test/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBeanTest.java @@ -50,10 +50,10 @@ public class AMQProtocolSessionMBeanTest extends TestCase { // 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 @@ public class AMQProtocolSessionMBeanTest extends TestCase // 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()); } -- cgit v1.2.1