From c0b2b10bce3099c5d8111c8f7ff8ebaff56f0820 Mon Sep 17 00:00:00 2001 From: Aidan Skinner Date: Tue, 15 Apr 2008 16:57:42 +0000 Subject: QPID-831 Remove some broker introspection stuff and transaction bumpf git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/thegreatmerge@648328 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/java/org/apache/qpid/AMQException.java | 26 +++++++++++++- .../messageStore/TestableMemoryMessageStore.java | 41 ---------------------- .../protocol/AMQProtocolSessionMBeanTest.java | 13 +++---- .../qpid/server/protocol/MaxChannelsTest.java | 2 +- .../java/org/apache/qpid/server/queue/AckTest.java | 6 +--- .../qpid/server/queue/SubscriptionTestHelper.java | 8 ++++- 6 files changed, 39 insertions(+), 57 deletions(-) delete mode 100644 qpid/java/systests/src/main/java/org/apache/qpid/server/messageStore/TestableMemoryMessageStore.java diff --git a/qpid/java/common/src/main/java/org/apache/qpid/AMQException.java b/qpid/java/common/src/main/java/org/apache/qpid/AMQException.java index 6cbb98fd86..6d07ea55ea 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/AMQException.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/AMQException.java @@ -20,6 +20,8 @@ */ package org.apache.qpid; +import javax.management.JMException; + import org.apache.qpid.protocol.AMQConstant; /** @@ -38,7 +40,7 @@ public class AMQException extends Exception { /** Holds the AMQ error code constant associated with this exception. */ private AMQConstant _errorCode; - + /** * Creates an exception with an optional error code, optional message and optional underlying cause. * @@ -52,6 +54,28 @@ public class AMQException extends Exception _errorCode = errorCode; } + /* + * Deprecated constructors brought from M2.1 + */ + @Deprecated + public AMQException (String msg) + { + this(null, (msg == null) ? "" : msg); + } + + @Deprecated + public AMQException (AMQConstant errorCode, String msg) + { + this(errorCode, (msg == null) ? "" : msg, null); + } + + @Deprecated + public AMQException(String msg, Exception cause) + { + this(null, msg, cause); + } + + /** * Gets the AMQ protocol exception code associated with this exception. * diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/messageStore/TestableMemoryMessageStore.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/messageStore/TestableMemoryMessageStore.java deleted file mode 100644 index af3b5b0baf..0000000000 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/messageStore/TestableMemoryMessageStore.java +++ /dev/null @@ -1,41 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.server.messageStore; - -import java.util.List; - -/** - * Created by Arnaud Simon - * Date: 09-May-2007 - * Time: 11:45:18 - */ -public class TestableMemoryMessageStore extends MemoryMessageStore -{ - public int getNumberStoredMessages() - { - int res = 0; - if (_queueMap != null) - { - for (List l : _queueMap.values()) - { - res = res + l.size(); - } - } - return res; - } -} diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBeanTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBeanTest.java index cd7dcc541c..e4555e020e 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBeanTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBeanTest.java @@ -33,8 +33,6 @@ import org.apache.qpid.server.registry.ApplicationRegistry; import org.apache.qpid.server.registry.IApplicationRegistry; import org.apache.qpid.server.store.MessageStore; import org.apache.qpid.server.store.SkeletonMessageStore; -import org.apache.qpid.server.txn.MemoryTransactionManager; -import org.apache.qpid.server.txn.TransactionManager; import org.apache.qpid.server.virtualhost.VirtualHost; import javax.management.JMException; @@ -49,7 +47,6 @@ public class AMQProtocolSessionMBeanTest extends TestCase private static final Logger log = Logger.getLogger(AMQProtocolSessionMBeanTest.class); private MessageStore _messageStore = new SkeletonMessageStore(); - private TransactionManager _txm = new MemoryTransactionManager(); private AMQMinaProtocolSession _protocolSession; private AMQChannel _channel; private AMQProtocolSessionMBean _mbean; @@ -64,7 +61,7 @@ public class AMQProtocolSessionMBeanTest extends TestCase new AMQShortString("test"), true, _protocolSession.getVirtualHost()); - AMQChannel channel = new AMQChannel(_protocolSession, 2, _txm, _messageStore); + AMQChannel channel = new AMQChannel(_protocolSession, 2, _messageStore); channel.setDefaultQueue(queue); _protocolSession.addChannel(channel); @@ -76,7 +73,7 @@ public class AMQProtocolSessionMBeanTest extends TestCase assertTrue(_mbean.getMaximumNumberOfChannels() == 1000L); // check APIs - AMQChannel channel3 = new AMQChannel(_protocolSession, 3, _txm, _messageStore); + AMQChannel channel3 = new AMQChannel(_protocolSession, 3, _messageStore); channel3.setLocalTransactional(); _protocolSession.addChannel(channel3); _mbean.rollbackTransactions(2); @@ -96,14 +93,14 @@ public class AMQProtocolSessionMBeanTest extends TestCase } // check if closing of session works - _protocolSession.addChannel(new AMQChannel(_protocolSession, 5, _txm, _messageStore)); + _protocolSession.addChannel(new AMQChannel(_protocolSession, 5, _messageStore)); _mbean.closeConnection(); try { channelCount = _mbean.channels().size(); assertTrue(channelCount == 0); // session is now closed so adding another channel should throw an exception - _protocolSession.addChannel(new AMQChannel(_protocolSession, 6, _txm, _messageStore)); + _protocolSession.addChannel(new AMQChannel(_protocolSession, 6, _messageStore)); fail(); } catch (AMQException ex) @@ -122,7 +119,7 @@ public class AMQProtocolSessionMBeanTest extends TestCase new AMQMinaProtocolSession(new MockIoSession(), appRegistry.getVirtualHostRegistry(), new AMQCodecFactory(true), null); _protocolSession.setVirtualHost(appRegistry.getVirtualHostRegistry().getVirtualHost("test")); - _channel = new AMQChannel(_protocolSession, 1, _txm, _messageStore); + _channel = new AMQChannel(_protocolSession, 1, _messageStore); _protocolSession.addChannel(_channel); _mbean = (AMQProtocolSessionMBean) _protocolSession.getManagedObject(); } diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/protocol/MaxChannelsTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/protocol/MaxChannelsTest.java index 99610ab885..62f5e0c6bf 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/protocol/MaxChannelsTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/protocol/MaxChannelsTest.java @@ -57,7 +57,7 @@ public class MaxChannelsTest extends TestCase { for (long currentChannel = 0L; currentChannel < maxChannels; currentChannel++) { - _protocolSession.addChannel(new AMQChannel(_protocolSession, (int) currentChannel, null, null)); + _protocolSession.addChannel(new AMQChannel(_protocolSession, (int) currentChannel, null)); } } catch (AMQException e) diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/AckTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/AckTest.java index cf6471705a..5a60d1b386 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/AckTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/AckTest.java @@ -34,7 +34,6 @@ import org.apache.qpid.server.ack.UnacknowledgedMessageMap; import org.apache.qpid.server.registry.ApplicationRegistry; import org.apache.qpid.server.store.StoreContext; import org.apache.qpid.server.store.TestableMemoryMessageStore; -import org.apache.qpid.server.txn.MemoryTransactionManager; import org.apache.qpid.server.txn.NonTransactionalContext; import org.apache.qpid.server.txn.TransactionalContext; import org.apache.qpid.server.util.NullApplicationRegistry; @@ -56,8 +55,6 @@ public class AckTest extends TestCase private TestableMemoryMessageStore _messageStore; - private MemoryTransactionManager _txm; - private StoreContext _storeContext = new StoreContext(); private AMQChannel _channel; @@ -77,9 +74,8 @@ public class AckTest extends TestCase { super.setUp(); _messageStore = new TestableMemoryMessageStore(); - _txm = new MemoryTransactionManager(); _protocolSession = new MockProtocolSession(_messageStore); - _channel = new AMQChannel(_protocolSession, 5, _txm, _messageStore); + _channel = new AMQChannel(_protocolSession, 5, _messageStore); _protocolSession.addChannel(_channel); _subscriptionManager = new SubscriptionSet(); diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/SubscriptionTestHelper.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/SubscriptionTestHelper.java index 5846ad0a9d..0fefb0b34b 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/SubscriptionTestHelper.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/SubscriptionTestHelper.java @@ -88,7 +88,12 @@ public class SubscriptionTestHelper implements Subscription { return null; } - + + public void start() + { + //no-op + } + public void queueDeleted(AMQQueue queue) { } @@ -157,4 +162,5 @@ public class SubscriptionTestHelper implements Subscription { return key.toString(); } + } -- cgit v1.2.1