summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Ritchie <ritchiem@apache.org>2010-06-02 16:44:06 +0000
committerMartin Ritchie <ritchiem@apache.org>2010-06-02 16:44:06 +0000
commit013f813ce1f61472e4a074703b439478c6a3cdfb (patch)
treead8cdedbb5799d814c778177e23ef028fc08bfad
parent60326fb0c67294b09d62a8461bc2ec9880161b85 (diff)
downloadqpid-python-013f813ce1f61472e4a074703b439478c6a3cdfb.tar.gz
QPID-2623 : Simple changes to classes that extended TestCase, now they extend InternalBrokerBaseCase.
Fixed up @Override on setUp/tearDowns removed setUp/tearDowns that were simply super calls. Corrected existing setUp/tearDowns to call super. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@950644 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--java/broker-plugins/firewall/src/test/java/org/apache/qpid/server/security/access/FirewallPluginTest.java13
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/AMQBrokerManagerMBeanTest.java11
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/configuration/ServerConfigurationTest.java20
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/configuration/VirtualHostConfigurationTest.java11
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/configuration/plugins/ConfigurationPluginTest.java9
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/exchange/AbstractHeadersExchangeTestBase.java3
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/exchange/ExchangeMBeanTest.java12
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/exchange/HeadersExchangeTest.java10
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/exchange/TopicExchangeTest.java13
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/logging/management/LoggingManagementMBeanTest.java12
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/logging/messages/AbstractTestMessages.java13
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/logging/subjects/AbstractTestLogSubject.java11
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/logging/subjects/QueueLogSubjectTest.java1
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/management/AMQUserManagementMBeanTest.java14
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBeanTest.java10
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/protocol/MaxChannelsTest.java13
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/queue/AMQPriorityQueueTest.java2
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/queue/AckTest.java13
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/queue/SimpleAMQQueueTest.java9
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/queue/SimpleAMQQueueThreadPoolTest.java3
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/registry/ApplicationRegistryShutdownTest.java32
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/store/MessageStoreTest.java17
22 files changed, 86 insertions, 166 deletions
diff --git a/java/broker-plugins/firewall/src/test/java/org/apache/qpid/server/security/access/FirewallPluginTest.java b/java/broker-plugins/firewall/src/test/java/org/apache/qpid/server/security/access/FirewallPluginTest.java
index f94443228e..431da470e0 100644
--- a/java/broker-plugins/firewall/src/test/java/org/apache/qpid/server/security/access/FirewallPluginTest.java
+++ b/java/broker-plugins/firewall/src/test/java/org/apache/qpid/server/security/access/FirewallPluginTest.java
@@ -24,19 +24,16 @@ import java.io.FileWriter;
import java.io.IOException;
import java.net.InetSocketAddress;
-import junit.framework.TestCase;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.XMLConfiguration;
-import org.apache.qpid.server.protocol.AMQProtocolEngine;
import org.apache.qpid.server.registry.ApplicationRegistry;
import org.apache.qpid.server.security.Result;
import org.apache.qpid.server.security.access.plugins.Firewall;
import org.apache.qpid.server.security.access.plugins.FirewallConfiguration;
-import org.apache.qpid.server.virtualhost.VirtualHostRegistry;
-import org.apache.qpid.transport.TestNetworkDriver;
+import org.apache.qpid.server.util.InternalBrokerBaseCase;
-public class FirewallPluginTest extends TestCase
+public class FirewallPluginTest extends InternalBrokerBaseCase
{
public class RuleInfo
{
@@ -89,12 +86,6 @@ public class FirewallPluginTest extends TestCase
ApplicationRegistry.getInstance();
}
- public void tearDown() throws Exception
- {
- // Correctly Close the AR that we created above
- ApplicationRegistry.remove();
- super.tearDown();
- }
private Firewall initialisePlugin(String defaultAction, RuleInfo[] rules) throws IOException, ConfigurationException
{
diff --git a/java/broker/src/test/java/org/apache/qpid/server/AMQBrokerManagerMBeanTest.java b/java/broker/src/test/java/org/apache/qpid/server/AMQBrokerManagerMBeanTest.java
index 3cdb9c0c2d..6c135e8ba7 100644
--- a/java/broker/src/test/java/org/apache/qpid/server/AMQBrokerManagerMBeanTest.java
+++ b/java/broker/src/test/java/org/apache/qpid/server/AMQBrokerManagerMBeanTest.java
@@ -27,10 +27,11 @@ import org.apache.qpid.server.exchange.ExchangeRegistry;
import org.apache.qpid.server.queue.QueueRegistry;
import org.apache.qpid.server.registry.ApplicationRegistry;
import org.apache.qpid.server.registry.IApplicationRegistry;
+import org.apache.qpid.server.util.InternalBrokerBaseCase;
import org.apache.qpid.server.virtualhost.VirtualHostImpl;
import org.apache.qpid.server.virtualhost.VirtualHost;
-public class AMQBrokerManagerMBeanTest extends TestCase
+public class AMQBrokerManagerMBeanTest extends InternalBrokerBaseCase
{
private QueueRegistry _queueRegistry;
private ExchangeRegistry _exchangeRegistry;
@@ -81,7 +82,7 @@ public class AMQBrokerManagerMBeanTest extends TestCase
}
@Override
- protected void setUp() throws Exception
+ public void setUp() throws Exception
{
super.setUp();
IApplicationRegistry appRegistry = ApplicationRegistry.getInstance();
@@ -90,10 +91,4 @@ public class AMQBrokerManagerMBeanTest extends TestCase
_exchangeRegistry = _vHost.getExchangeRegistry();
}
- @Override
- protected void tearDown() throws Exception
- {
- //Ensure we close the opened Registry
- ApplicationRegistry.remove();
- }
}
diff --git a/java/broker/src/test/java/org/apache/qpid/server/configuration/ServerConfigurationTest.java b/java/broker/src/test/java/org/apache/qpid/server/configuration/ServerConfigurationTest.java
index 26f4cbf194..ddebe28d03 100644
--- a/java/broker/src/test/java/org/apache/qpid/server/configuration/ServerConfigurationTest.java
+++ b/java/broker/src/test/java/org/apache/qpid/server/configuration/ServerConfigurationTest.java
@@ -37,29 +37,15 @@ import org.apache.qpid.server.protocol.AMQProtocolEngine;
import org.apache.qpid.server.protocol.AMQProtocolSession;
import org.apache.qpid.server.registry.ApplicationRegistry;
import org.apache.qpid.server.registry.ConfigurationFileApplicationRegistry;
+import org.apache.qpid.server.util.InternalBrokerBaseCase;
import org.apache.qpid.server.virtualhost.VirtualHost;
import org.apache.qpid.server.virtualhost.VirtualHostRegistry;
import org.apache.qpid.transport.TestNetworkDriver;
-public class ServerConfigurationTest extends TestCase
+public class ServerConfigurationTest extends InternalBrokerBaseCase
{
- private XMLConfiguration _config;
+ private XMLConfiguration _config = new XMLConfiguration();
- @Override
- public void setUp()
- {
- //Highlight that this test will cause a new AR to be created
- ApplicationRegistry.getInstance();
-
- _config = new XMLConfiguration();
- }
-
- @Override
- public void tearDown() throws Exception
- {
- //Correctly Close the AR we created
- ApplicationRegistry.remove();
- }
public void testSetJMXManagementPort() throws ConfigurationException
{
diff --git a/java/broker/src/test/java/org/apache/qpid/server/configuration/VirtualHostConfigurationTest.java b/java/broker/src/test/java/org/apache/qpid/server/configuration/VirtualHostConfigurationTest.java
index c1e2406167..c74c8d28a0 100644
--- a/java/broker/src/test/java/org/apache/qpid/server/configuration/VirtualHostConfigurationTest.java
+++ b/java/broker/src/test/java/org/apache/qpid/server/configuration/VirtualHostConfigurationTest.java
@@ -27,16 +27,16 @@ import org.apache.qpid.framing.AMQShortString;
import org.apache.qpid.server.queue.AMQPriorityQueue;
import org.apache.qpid.server.queue.AMQQueue;
import org.apache.qpid.server.registry.ApplicationRegistry;
+import org.apache.qpid.server.util.InternalBrokerBaseCase;
import org.apache.qpid.server.virtualhost.VirtualHost;
-public class VirtualHostConfigurationTest extends TestCase
+public class VirtualHostConfigurationTest extends InternalBrokerBaseCase
{
- private VirtualHostConfiguration vhostConfig;
private XMLConfiguration configXml;
@Override
- protected void setUp() throws Exception
+ public void setUp() throws Exception
{
super.setUp();
// Fill config file with stuff
@@ -45,11 +45,6 @@ public class VirtualHostConfigurationTest extends TestCase
configXml.addProperty("virtualhost(-1).name", "test");
}
- public void tearDown() throws Exception
- {
- super.tearDown();
- }
-
public void testQueuePriority() throws Exception
{
configXml.addProperty("virtualhost.testQueuePriority.name", "testQueuePriority");
diff --git a/java/broker/src/test/java/org/apache/qpid/server/configuration/plugins/ConfigurationPluginTest.java b/java/broker/src/test/java/org/apache/qpid/server/configuration/plugins/ConfigurationPluginTest.java
index 090fb36a4b..ee2f77f16b 100644
--- a/java/broker/src/test/java/org/apache/qpid/server/configuration/plugins/ConfigurationPluginTest.java
+++ b/java/broker/src/test/java/org/apache/qpid/server/configuration/plugins/ConfigurationPluginTest.java
@@ -24,6 +24,7 @@ import junit.framework.TestCase;
import org.apache.commons.configuration.CompositeConfiguration;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.XMLConfiguration;
+import org.apache.qpid.server.util.InternalBrokerBaseCase;
import java.util.List;
@@ -31,7 +32,7 @@ import java.util.List;
* Test that verifies that given a Configuration a ConfigurationPlugin can
* process and validate that data.
*/
-public class ConfigurationPluginTest extends TestCase
+public class ConfigurationPluginTest extends InternalBrokerBaseCase
{
private static final double DOUBLE = 3.14;
private static final long POSITIVE_LONG = 1000;
@@ -69,8 +70,12 @@ public class ConfigurationPluginTest extends TestCase
ConfigPlugin _plugin;
- public void setUp()
+ @Override
+ public void setUp() throws Exception
{
+ // Test does not directly use the AppRegistry but the configured broker
+ // is required for the correct ConfigurationPlugin processing
+ super.setUp();
XMLConfiguration xmlconfig = new XMLConfiguration();
xmlconfig.addProperty("base.element[@property]", "property");
xmlconfig.addProperty("base.element.name", "name");
diff --git a/java/broker/src/test/java/org/apache/qpid/server/exchange/AbstractHeadersExchangeTestBase.java b/java/broker/src/test/java/org/apache/qpid/server/exchange/AbstractHeadersExchangeTestBase.java
index 21caabfff9..696e57e83f 100644
--- a/java/broker/src/test/java/org/apache/qpid/server/exchange/AbstractHeadersExchangeTestBase.java
+++ b/java/broker/src/test/java/org/apache/qpid/server/exchange/AbstractHeadersExchangeTestBase.java
@@ -50,6 +50,7 @@ import org.apache.qpid.server.store.MemoryMessageStore;
import org.apache.qpid.server.store.MessageStore;
import org.apache.qpid.server.store.StoredMessage;
import org.apache.qpid.server.subscription.Subscription;
+import org.apache.qpid.server.util.InternalBrokerBaseCase;
import java.util.ArrayList;
import java.util.Arrays;
@@ -61,7 +62,7 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
-public class AbstractHeadersExchangeTestBase extends TestCase
+public class AbstractHeadersExchangeTestBase extends InternalBrokerBaseCase
{
private static final Logger _log = Logger.getLogger(AbstractHeadersExchangeTestBase.class);
diff --git a/java/broker/src/test/java/org/apache/qpid/server/exchange/ExchangeMBeanTest.java b/java/broker/src/test/java/org/apache/qpid/server/exchange/ExchangeMBeanTest.java
index 7800a51755..e3e736509e 100644
--- a/java/broker/src/test/java/org/apache/qpid/server/exchange/ExchangeMBeanTest.java
+++ b/java/broker/src/test/java/org/apache/qpid/server/exchange/ExchangeMBeanTest.java
@@ -29,6 +29,7 @@ import org.apache.qpid.server.queue.AMQQueueFactory;
import org.apache.qpid.server.registry.ApplicationRegistry;
import org.apache.qpid.server.registry.IApplicationRegistry;
import org.apache.qpid.server.management.ManagedObject;
+import org.apache.qpid.server.util.InternalBrokerBaseCase;
import org.apache.qpid.server.virtualhost.VirtualHost;
import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.framing.AMQShortString;
@@ -39,7 +40,7 @@ import java.util.ArrayList;
/**
* Unit test class for testing different Exchange MBean operations
*/
-public class ExchangeMBeanTest extends TestCase
+public class ExchangeMBeanTest extends InternalBrokerBaseCase
{
private AMQQueue _queue;
private QueueRegistry _queueRegistry;
@@ -127,7 +128,7 @@ public class ExchangeMBeanTest extends TestCase
}
@Override
- protected void setUp() throws Exception
+ public void setUp() throws Exception
{
super.setUp();
@@ -138,11 +139,4 @@ public class ExchangeMBeanTest extends TestCase
_virtualHost, null);
_queueRegistry.registerQueue(_queue);
}
-
- protected void tearDown()
- {
- // Correctly Close the AR that we created above
- ApplicationRegistry.remove();
- }
-
}
diff --git a/java/broker/src/test/java/org/apache/qpid/server/exchange/HeadersExchangeTest.java b/java/broker/src/test/java/org/apache/qpid/server/exchange/HeadersExchangeTest.java
index f982c3976f..ac638e4e6a 100644
--- a/java/broker/src/test/java/org/apache/qpid/server/exchange/HeadersExchangeTest.java
+++ b/java/broker/src/test/java/org/apache/qpid/server/exchange/HeadersExchangeTest.java
@@ -30,22 +30,16 @@ public class HeadersExchangeTest extends AbstractHeadersExchangeTestBase
{
AMQProtocolSession _protocolSession;
- protected void setUp() throws Exception
+ @Override
+ public void setUp() throws Exception
{
super.setUp();
- // AR will use the NullAR by default
// Just use the first vhost.
VirtualHost
virtualHost = ApplicationRegistry.getInstance().getVirtualHostRegistry().getVirtualHosts().iterator().next();
_protocolSession = new InternalTestProtocolSession(virtualHost);
}
- protected void tearDown()
- {
- // Correctly Close the AR that we created above
- ApplicationRegistry.remove();
- }
-
public void testSimple() throws AMQException
{
TestQueue q1 = bindDefault("F0000");
diff --git a/java/broker/src/test/java/org/apache/qpid/server/exchange/TopicExchangeTest.java b/java/broker/src/test/java/org/apache/qpid/server/exchange/TopicExchangeTest.java
index d60cf5fa2b..f72961c03c 100644
--- a/java/broker/src/test/java/org/apache/qpid/server/exchange/TopicExchangeTest.java
+++ b/java/broker/src/test/java/org/apache/qpid/server/exchange/TopicExchangeTest.java
@@ -23,6 +23,7 @@ package org.apache.qpid.server.exchange;
import junit.framework.TestCase;
import junit.framework.Assert;
import org.apache.qpid.server.queue.*;
+import org.apache.qpid.server.util.InternalBrokerBaseCase;
import org.apache.qpid.server.virtualhost.VirtualHost;
import org.apache.qpid.server.registry.ApplicationRegistry;
import org.apache.qpid.server.store.MessageStore;
@@ -37,7 +38,7 @@ import org.apache.qpid.framing.ContentHeaderBody;
import org.apache.qpid.framing.BasicContentHeaderProperties;
import org.apache.qpid.framing.abstraction.MessagePublishInfo;
-public class TopicExchangeTest extends TestCase
+public class TopicExchangeTest extends InternalBrokerBaseCase
{
TopicExchange _exchange;
@@ -48,20 +49,16 @@ public class TopicExchangeTest extends TestCase
InternalTestProtocolSession _protocolSession;
- public void setUp() throws AMQException
+ @Override
+ public void setUp() throws Exception
{
+ super.setUp();
_exchange = new TopicExchange();
_vhost = ApplicationRegistry.getInstance().getVirtualHostRegistry().getVirtualHosts().iterator().next();
_store = new MemoryMessageStore();
_protocolSession = new InternalTestProtocolSession(_vhost);
}
- public void tearDown()
- {
- ApplicationRegistry.remove();
- }
-
-
public void testNoRoute() throws AMQException
{
AMQQueue queue = AMQQueueFactory.createAMQQueueImpl(new AMQShortString("a*#b"), false, null, false, false, _vhost, null);
diff --git a/java/broker/src/test/java/org/apache/qpid/server/logging/management/LoggingManagementMBeanTest.java b/java/broker/src/test/java/org/apache/qpid/server/logging/management/LoggingManagementMBeanTest.java
index eff6a6f59f..fe420d906d 100644
--- a/java/broker/src/test/java/org/apache/qpid/server/logging/management/LoggingManagementMBeanTest.java
+++ b/java/broker/src/test/java/org/apache/qpid/server/logging/management/LoggingManagementMBeanTest.java
@@ -37,8 +37,9 @@ import org.apache.log4j.Logger;
import org.apache.qpid.management.common.mbeans.LoggingManagement;
import junit.framework.TestCase;
+import org.apache.qpid.server.util.InternalBrokerBaseCase;
-public class LoggingManagementMBeanTest extends TestCase
+public class LoggingManagementMBeanTest extends InternalBrokerBaseCase
{
private static final String TEST_LOGGER = "LoggingManagementMBeanTestLogger";
private static final String TEST_LOGGER_CHILD1 = "LoggingManagementMBeanTestLogger.child1";
@@ -55,12 +56,15 @@ public class LoggingManagementMBeanTest extends TestCase
private File _testConfigFile;
- protected void setUp() throws Exception
+ @Override
+ public void setUp() throws Exception
{
+ super.setUp();
_testConfigFile = createTempTestLog4JConfig();
}
- protected void tearDown() throws Exception
+ @Override
+ public void tearDown() throws Exception
{
File oldTestConfigFile = new File(_testConfigFile.getAbsolutePath() + ".old");
if(oldTestConfigFile.exists())
@@ -69,6 +73,8 @@ public class LoggingManagementMBeanTest extends TestCase
}
_testConfigFile.delete();
+
+ super.tearDown();
}
private File createTempTestLog4JConfig()
diff --git a/java/broker/src/test/java/org/apache/qpid/server/logging/messages/AbstractTestMessages.java b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/AbstractTestMessages.java
index 25760a6d65..9acbe72cb3 100644
--- a/java/broker/src/test/java/org/apache/qpid/server/logging/messages/AbstractTestMessages.java
+++ b/java/broker/src/test/java/org/apache/qpid/server/logging/messages/AbstractTestMessages.java
@@ -33,10 +33,11 @@ import org.apache.qpid.server.logging.actors.TestLogActor;
import org.apache.qpid.server.logging.rawloggers.UnitTestMessageLogger;
import org.apache.qpid.server.logging.subjects.TestBlankSubject;
import org.apache.qpid.server.registry.ApplicationRegistry;
+import org.apache.qpid.server.util.InternalBrokerBaseCase;
import java.util.List;
-public abstract class AbstractTestMessages extends TestCase
+public abstract class AbstractTestMessages extends InternalBrokerBaseCase
{
protected Configuration _config = new PropertiesConfiguration();
protected LogMessage _logMessage = null;
@@ -44,11 +45,10 @@ public abstract class AbstractTestMessages extends TestCase
protected UnitTestMessageLogger _logger;
protected LogSubject _logSubject = new TestBlankSubject();
+ @Override
public void setUp() throws Exception
{
super.setUp();
- // Highlight that we create a new AR here
- ApplicationRegistry.getInstance();
ServerConfiguration serverConfig = new ServerConfiguration(_config);
@@ -61,13 +61,6 @@ public abstract class AbstractTestMessages extends TestCase
_actor = new TestLogActor(rootLogger);
}
- public void tearDown() throws Exception
- {
- // Correctly Close the AR that we created above
- ApplicationRegistry.remove();
- super.tearDown();
- }
-
protected List<Object> performLog()
{
if (_logMessage == null)
diff --git a/java/broker/src/test/java/org/apache/qpid/server/logging/subjects/AbstractTestLogSubject.java b/java/broker/src/test/java/org/apache/qpid/server/logging/subjects/AbstractTestLogSubject.java
index 4d75a899be..41fe81a717 100644
--- a/java/broker/src/test/java/org/apache/qpid/server/logging/subjects/AbstractTestLogSubject.java
+++ b/java/broker/src/test/java/org/apache/qpid/server/logging/subjects/AbstractTestLogSubject.java
@@ -35,6 +35,7 @@ import org.apache.qpid.server.logging.RootMessageLoggerImpl;
import org.apache.qpid.server.logging.actors.TestLogActor;
import org.apache.qpid.server.logging.rawloggers.UnitTestMessageLogger;
import org.apache.qpid.server.queue.AMQQueue;
+import org.apache.qpid.server.util.InternalBrokerBaseCase;
import org.apache.qpid.server.virtualhost.VirtualHost;
import org.apache.qpid.server.registry.ApplicationRegistry;
import org.apache.qpid.server.protocol.InternalTestProtocolSession;
@@ -53,13 +54,14 @@ import java.util.List;
* The resulting log file is then validated.
*
*/
-public abstract class AbstractTestLogSubject extends TestCase
+public abstract class AbstractTestLogSubject extends InternalBrokerBaseCase
{
protected Configuration _config = new PropertiesConfiguration();
protected LogSubject _subject = null;
AMQProtocolSession _session;
+ @Override
public void setUp() throws Exception
{
super.setUp();
@@ -73,13 +75,6 @@ public abstract class AbstractTestLogSubject extends TestCase
_session = new InternalTestProtocolSession(virtualHost);
}
- public void tearDown() throws Exception
- {
- // Correctly Close the AR that we created above
- ApplicationRegistry.remove();
-
- super.tearDown();
- }
protected List<Object> performLog() throws ConfigurationException
{
diff --git a/java/broker/src/test/java/org/apache/qpid/server/logging/subjects/QueueLogSubjectTest.java b/java/broker/src/test/java/org/apache/qpid/server/logging/subjects/QueueLogSubjectTest.java
index d46e1ee11b..147ec2a275 100644
--- a/java/broker/src/test/java/org/apache/qpid/server/logging/subjects/QueueLogSubjectTest.java
+++ b/java/broker/src/test/java/org/apache/qpid/server/logging/subjects/QueueLogSubjectTest.java
@@ -34,6 +34,7 @@ public class QueueLogSubjectTest extends AbstractTestLogSubject
AMQQueue _queue;
VirtualHost _testVhost;
+ @Override
public void setUp() throws Exception
{
super.setUp();
diff --git a/java/broker/src/test/java/org/apache/qpid/server/management/AMQUserManagementMBeanTest.java b/java/broker/src/test/java/org/apache/qpid/server/management/AMQUserManagementMBeanTest.java
index 8bced58b7b..a6c17e042e 100644
--- a/java/broker/src/test/java/org/apache/qpid/server/management/AMQUserManagementMBeanTest.java
+++ b/java/broker/src/test/java/org/apache/qpid/server/management/AMQUserManagementMBeanTest.java
@@ -28,17 +28,17 @@ import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
-import junit.framework.TestCase;
-
import org.apache.commons.configuration.ConfigurationException;
import org.apache.qpid.server.security.auth.database.PlainPasswordFilePrincipalDatabase;
import org.apache.qpid.server.security.auth.management.AMQUserManagementMBean;
+import org.apache.qpid.server.util.InternalBrokerBaseCase;
+
/* Note: The main purpose is to test the jmx access rights file manipulation
* within AMQUserManagementMBean. The Principal Databases are tested by their own tests,
* this test just exercises their usage in AMQUserManagementMBean.
*/
-public class AMQUserManagementMBeanTest extends TestCase
+public class AMQUserManagementMBeanTest extends InternalBrokerBaseCase
{
private PlainPasswordFilePrincipalDatabase _database;
private AMQUserManagementMBean _amqumMBean;
@@ -50,8 +50,10 @@ public class AMQUserManagementMBeanTest extends TestCase
private static final String TEST_PASSWORD = "password";
@Override
- protected void setUp() throws Exception
+ public void setUp() throws Exception
{
+ super.setUp();
+
_database = new PlainPasswordFilePrincipalDatabase();
_amqumMBean = new AMQUserManagementMBean();
loadFreshTestPasswordFile();
@@ -59,7 +61,7 @@ public class AMQUserManagementMBeanTest extends TestCase
}
@Override
- protected void tearDown() throws Exception
+ public void tearDown() throws Exception
{
//clean up test password/access files
File _oldPasswordFile = new File(_passwordFile.getAbsolutePath() + ".old");
@@ -68,6 +70,8 @@ public class AMQUserManagementMBeanTest extends TestCase
_oldAccessFile.delete();
_passwordFile.delete();
_accessFile.delete();
+
+ super.tearDown();
}
public void testDeleteUser()
diff --git a/java/broker/src/test/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBeanTest.java b/java/broker/src/test/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBeanTest.java
index e9d53c59f2..a3ad25934c 100644
--- a/java/broker/src/test/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBeanTest.java
+++ b/java/broker/src/test/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBeanTest.java
@@ -26,6 +26,7 @@ import org.apache.qpid.AMQException;
import org.apache.qpid.framing.AMQShortString;
import org.apache.qpid.management.common.mbeans.ManagedConnection;
import org.apache.qpid.server.AMQChannel;
+import org.apache.qpid.server.util.InternalBrokerBaseCase;
import org.apache.qpid.server.virtualhost.VirtualHost;
import org.apache.qpid.server.queue.AMQQueue;
import org.apache.qpid.server.queue.AMQQueueFactory;
@@ -39,7 +40,7 @@ import javax.management.openmbean.TabularData;
/** Test class to test MBean operations for AMQMinaProtocolSession. */
-public class AMQProtocolSessionMBeanTest extends TestCase
+public class AMQProtocolSessionMBeanTest extends InternalBrokerBaseCase
{
/** Used for debugging. */
private static final Logger log = Logger.getLogger(AMQProtocolSessionMBeanTest.class);
@@ -130,7 +131,7 @@ public class AMQProtocolSessionMBeanTest extends TestCase
}
@Override
- protected void setUp() throws Exception
+ public void setUp() throws Exception
{
super.setUp();
@@ -142,9 +143,4 @@ public class AMQProtocolSessionMBeanTest extends TestCase
_mbean = (AMQProtocolSessionMBean) _protocolSession.getManagedObject();
}
- @Override
- protected void tearDown()
- {
- ApplicationRegistry.remove();
- }
}
diff --git a/java/broker/src/test/java/org/apache/qpid/server/protocol/MaxChannelsTest.java b/java/broker/src/test/java/org/apache/qpid/server/protocol/MaxChannelsTest.java
index 13e712dbac..f6e83e6369 100644
--- a/java/broker/src/test/java/org/apache/qpid/server/protocol/MaxChannelsTest.java
+++ b/java/broker/src/test/java/org/apache/qpid/server/protocol/MaxChannelsTest.java
@@ -24,11 +24,12 @@ import junit.framework.TestCase;
import org.apache.qpid.AMQException;
import org.apache.qpid.protocol.AMQConstant;
import org.apache.qpid.server.AMQChannel;
+import org.apache.qpid.server.util.InternalBrokerBaseCase;
import org.apache.qpid.server.virtualhost.VirtualHost;
import org.apache.qpid.server.registry.ApplicationRegistry;
/** Test class to test MBean operations for AMQMinaProtocolSession. */
-public class MaxChannelsTest extends TestCase
+public class MaxChannelsTest extends InternalBrokerBaseCase
{
private AMQProtocolEngine _session;
@@ -61,13 +62,6 @@ public class MaxChannelsTest extends TestCase
}
@Override
- public void setUp()
- {
- //Highlight that this test will cause a new AR to be created
- ApplicationRegistry.getInstance();
- }
-
- @Override
public void tearDown() throws Exception
{
try {
@@ -78,8 +72,7 @@ public class MaxChannelsTest extends TestCase
}
finally
{
- // Correctly Close the AR we created
- ApplicationRegistry.remove();
+ super.tearDown();
}
}
diff --git a/java/broker/src/test/java/org/apache/qpid/server/queue/AMQPriorityQueueTest.java b/java/broker/src/test/java/org/apache/qpid/server/queue/AMQPriorityQueueTest.java
index dd013e6ad5..d52f4c03f3 100644
--- a/java/broker/src/test/java/org/apache/qpid/server/queue/AMQPriorityQueueTest.java
+++ b/java/broker/src/test/java/org/apache/qpid/server/queue/AMQPriorityQueueTest.java
@@ -32,7 +32,7 @@ public class AMQPriorityQueueTest extends SimpleAMQQueueTest
{
@Override
- protected void setUp() throws Exception
+ public void setUp() throws Exception
{
_arguments = new FieldTable();
_arguments.put(AMQQueueFactory.X_QPID_PRIORITIES, 3);
diff --git a/java/broker/src/test/java/org/apache/qpid/server/queue/AckTest.java b/java/broker/src/test/java/org/apache/qpid/server/queue/AckTest.java
index 8884ff0a91..04608275a3 100644
--- a/java/broker/src/test/java/org/apache/qpid/server/queue/AckTest.java
+++ b/java/broker/src/test/java/org/apache/qpid/server/queue/AckTest.java
@@ -32,6 +32,7 @@ import org.apache.qpid.server.message.AMQMessage;
import org.apache.qpid.server.message.MessageMetaData;
import org.apache.qpid.server.txn.ServerTransaction;
import org.apache.qpid.server.txn.AutoCommitTransaction;
+import org.apache.qpid.server.util.InternalBrokerBaseCase;
import org.apache.qpid.server.virtualhost.VirtualHost;
import org.apache.qpid.server.protocol.InternalTestProtocolSession;
import org.apache.qpid.server.protocol.AMQProtocolSession;
@@ -49,7 +50,7 @@ import java.util.Set;
/**
* Tests that acknowledgements are handled correctly.
*/
-public class AckTest extends TestCase
+public class AckTest extends InternalBrokerBaseCase
{
private static final Logger _log = Logger.getLogger(AckTest.class);
@@ -66,11 +67,10 @@ public class AckTest extends TestCase
private static final AMQShortString DEFAULT_CONSUMER_TAG = new AMQShortString("conTag");
private VirtualHost _virtualHost;
- protected void setUp() throws Exception
+ @Override
+ public void setUp() throws Exception
{
super.setUp();
- // The NullApplicationRegistry will be created by default when
- // calling AR.getInstance
_virtualHost = ApplicationRegistry.getInstance().getVirtualHostRegistry().getVirtualHost("test");
_messageStore = new TestMemoryMessageStore();
_protocolSession = new InternalTestProtocolSession(_virtualHost);
@@ -82,11 +82,6 @@ public class AckTest extends TestCase
_virtualHost, null);
}
- protected void tearDown()
- {
- ApplicationRegistry.remove();
- }
-
private void publishMessages(int count) throws AMQException
{
publishMessages(count, false);
diff --git a/java/broker/src/test/java/org/apache/qpid/server/queue/SimpleAMQQueueTest.java b/java/broker/src/test/java/org/apache/qpid/server/queue/SimpleAMQQueueTest.java
index e1852a0a22..cf46a1e97a 100644
--- a/java/broker/src/test/java/org/apache/qpid/server/queue/SimpleAMQQueueTest.java
+++ b/java/broker/src/test/java/org/apache/qpid/server/queue/SimpleAMQQueueTest.java
@@ -42,6 +42,7 @@ import org.apache.qpid.server.subscription.MockSubscription;
import org.apache.qpid.server.subscription.Subscription;
import org.apache.qpid.server.txn.AutoCommitTransaction;
import org.apache.qpid.server.txn.ServerTransaction;
+import org.apache.qpid.server.util.InternalBrokerBaseCase;
import org.apache.qpid.server.virtualhost.VirtualHost;
import org.apache.qpid.server.virtualhost.VirtualHostImpl;
@@ -49,7 +50,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-public class SimpleAMQQueueTest extends TestCase
+public class SimpleAMQQueueTest extends InternalBrokerBaseCase
{
protected SimpleAMQQueue _queue;
@@ -92,7 +93,7 @@ public class SimpleAMQQueueTest extends TestCase
};
@Override
- protected void setUp() throws Exception
+ public void setUp() throws Exception
{
super.setUp();
//Create Application Registry for test
@@ -106,10 +107,10 @@ public class SimpleAMQQueueTest extends TestCase
}
@Override
- protected void tearDown()
+ public void tearDown() throws Exception
{
_queue.stop();
- ApplicationRegistry.remove();
+ super.tearDown();
}
public void testCreateQueue() throws AMQException
diff --git a/java/broker/src/test/java/org/apache/qpid/server/queue/SimpleAMQQueueThreadPoolTest.java b/java/broker/src/test/java/org/apache/qpid/server/queue/SimpleAMQQueueThreadPoolTest.java
index 824f34cb0e..a40dc5670f 100644
--- a/java/broker/src/test/java/org/apache/qpid/server/queue/SimpleAMQQueueThreadPoolTest.java
+++ b/java/broker/src/test/java/org/apache/qpid/server/queue/SimpleAMQQueueThreadPoolTest.java
@@ -23,12 +23,13 @@ package org.apache.qpid.server.queue;
import junit.framework.TestCase;
import org.apache.qpid.framing.AMQShortString;
import org.apache.qpid.pool.ReferenceCountingExecutorService;
+import org.apache.qpid.server.util.InternalBrokerBaseCase;
import org.apache.qpid.server.virtualhost.VirtualHost;
import org.apache.qpid.server.registry.ApplicationRegistry;
import org.apache.qpid.AMQException;
-public class SimpleAMQQueueThreadPoolTest extends TestCase
+public class SimpleAMQQueueThreadPoolTest extends InternalBrokerBaseCase
{
public void test() throws AMQException
diff --git a/java/broker/src/test/java/org/apache/qpid/server/registry/ApplicationRegistryShutdownTest.java b/java/broker/src/test/java/org/apache/qpid/server/registry/ApplicationRegistryShutdownTest.java
index cadde1288b..512efca9bc 100644
--- a/java/broker/src/test/java/org/apache/qpid/server/registry/ApplicationRegistryShutdownTest.java
+++ b/java/broker/src/test/java/org/apache/qpid/server/registry/ApplicationRegistryShutdownTest.java
@@ -20,8 +20,7 @@
*/
package org.apache.qpid.server.registry;
-import junit.framework.TestCase;
-import org.apache.qpid.server.util.TestApplicationRegistry;
+import org.apache.qpid.server.util.InternalBrokerBaseCase;
import java.security.Security;
import java.security.Provider;
@@ -29,29 +28,23 @@ import java.util.List;
import java.util.LinkedList;
/**
- * QPID-1390 : Test to validate that the AuthenticationManger succesfully unregisters any new SASL providers when
+ * QPID-1390 : Test to validate that the AuthenticationManger can successfully unregister any new SASL providers when
* The ApplicationRegistry is closed.
*
* This should be expanded as QPID-1399 is implemented.
*/
-public class ApplicationRegistryShutdownTest extends TestCase
+public class ApplicationRegistryShutdownTest extends InternalBrokerBaseCase
{
- IApplicationRegistry _registry;
-
+ Provider[] _defaultProviders;
+ @Override
public void setUp() throws Exception
{
- //Highlight that this test will cause a new AR to be created
- // This must used TestAppRegistry but during the test getInstance()
- // will be called so we must ensure to do the remove()
- _registry = new TestApplicationRegistry();
- }
+ // Get default providers
+ _defaultProviders = Security.getProviders();
- @Override
- public void tearDown() throws Exception
- {
- // Correctly Close the AR we created
- ApplicationRegistry.remove();
+ //Startup the new broker and register the new providers
+ super.setUp();
}
@@ -62,11 +55,6 @@ public class ApplicationRegistryShutdownTest extends TestCase
*/
public void testAuthenticationMangerCleansUp() throws Exception
{
- // Get default providers
- Provider[] defaultProviders = Security.getProviders();
-
- // Register new providers
- ApplicationRegistry.initialise(_registry, ApplicationRegistry.DEFAULT_INSTANCE);
// Get the providers after initialisation
Provider[] providersAfterInitialisation = Security.getProviders();
@@ -76,7 +64,7 @@ public class ApplicationRegistryShutdownTest extends TestCase
for (Provider afterInit : providersAfterInitialisation)
{
boolean found = false;
- for (Provider defaultProvider : defaultProviders)
+ for (Provider defaultProvider : _defaultProviders)
{
if (defaultProvider == afterInit)
{
diff --git a/java/broker/src/test/java/org/apache/qpid/server/store/MessageStoreTest.java b/java/broker/src/test/java/org/apache/qpid/server/store/MessageStoreTest.java
index ef2c3fa304..66f84270aa 100644
--- a/java/broker/src/test/java/org/apache/qpid/server/store/MessageStoreTest.java
+++ b/java/broker/src/test/java/org/apache/qpid/server/store/MessageStoreTest.java
@@ -23,6 +23,7 @@ package org.apache.qpid.server.store;
import junit.framework.TestCase;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.qpid.server.util.InternalBrokerBaseCase;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -63,7 +64,7 @@ import java.util.List;
*
* This test validates that Exchanges, Queues, Bindings and Messages are persisted correctly.
*/
-public class MessageStoreTest extends TestCase
+public class MessageStoreTest extends InternalBrokerBaseCase
{
private static final int DEFAULT_PRIORTY_LEVEL = 5;
@@ -114,9 +115,6 @@ public class MessageStoreTest extends TestCase
}
}
- VirtualHost _virtualHost = null;
- String virtualHostName = "MessageStoreTest";
-
AMQShortString nonDurableExchangeName = new AMQShortString("MST-NonDurableDirectExchange");
AMQShortString directExchangeName = new AMQShortString("MST-DirectExchange");
AMQShortString topicExchangeName = new AMQShortString("MST-TopicExchange");
@@ -135,16 +133,7 @@ public class MessageStoreTest extends TestCase
AMQShortString directRouting = new AMQShortString("MST-direct");
AMQShortString topicRouting = new AMQShortString("MST-topic");
- protected void setUp()
- {
- ApplicationRegistry.getInstance();
- }
-
- protected void tearDown()
- {
- ApplicationRegistry.remove();
- }
-
+
protected void runTestWithStore(Configuration configuration)
{
//Ensure Environment Path is empty