From 9bcd23b23e46bb94761611f65d1afddfb927a94a Mon Sep 17 00:00:00 2001 From: Martin Ritchie Date: Thu, 3 Jun 2010 21:26:15 +0000 Subject: QPID-2632 : Ensure additional broker unit tests extend IBBC git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@951157 13f79535-47bb-0310-9956-ffa450edef68 --- java/broker-plugins/access-control/build.xml | 8 ++++---- .../server/security/access/plugins/RuleSetTest.java | 15 ++++++--------- java/broker-plugins/experimental/info/build.xml | 4 ++-- java/broker-plugins/extras/build.xml | 4 ++-- java/broker-plugins/firewall/build.xml | 6 +++--- .../qpid/server/security/access/FirewallPluginTest.java | 17 ++--------------- java/broker-plugins/simple-xml/build.xml | 4 ++-- .../security/access/PrincipalPermissionsTest.java | 17 ++++------------- 8 files changed, 25 insertions(+), 50 deletions(-) diff --git a/java/broker-plugins/access-control/build.xml b/java/broker-plugins/access-control/build.xml index ae56abcb77..690f2fb22c 100644 --- a/java/broker-plugins/access-control/build.xml +++ b/java/broker-plugins/access-control/build.xml @@ -17,13 +17,13 @@ - under the License. --> - - - + + + - \ No newline at end of file + diff --git a/java/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/plugins/RuleSetTest.java b/java/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/plugins/RuleSetTest.java index 53485f05c5..ef541dd0a8 100644 --- a/java/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/plugins/RuleSetTest.java +++ b/java/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/plugins/RuleSetTest.java @@ -21,16 +21,15 @@ package org.apache.qpid.server.security.access.plugins; -import junit.framework.TestCase; import org.apache.qpid.framing.AMQShortString; -import org.apache.qpid.server.registry.ApplicationRegistry; import org.apache.qpid.server.security.Result; import org.apache.qpid.server.security.access.ObjectProperties; import org.apache.qpid.server.security.access.ObjectType; import org.apache.qpid.server.security.access.Operation; import org.apache.qpid.server.security.access.Permission; import org.apache.qpid.server.security.access.config.RuleSet; +import org.apache.qpid.server.util.InternalBrokerBaseCase; /** * This test checks that the {@link RuleSet} object which forms the core of the access control plugin performs correctly. @@ -40,7 +39,7 @@ import org.apache.qpid.server.security.access.config.RuleSet; * access control mechanism is validated by checking whether operations would be authorised by calling the * {@link RuleSet#check(String, Operation, ObjectType, ObjectProperties)} method. */ -public class RuleSetTest extends TestCase +public class RuleSetTest extends InternalBrokerBaseCase { private RuleSet _ruleSet; @@ -50,20 +49,18 @@ public class RuleSetTest extends TestCase private AMQShortString _exchangeType = new AMQShortString("direct"); @Override - public void setUp() + public void setUp() throws Exception { - // Each test will cause a new application registry and non-transitive rule set to be created - ApplicationRegistry.getInstance(); + super.setUp(); _ruleSet = new RuleSet(); _ruleSet.configure(RuleSet.TRANSITIVE, Boolean.FALSE); } @Override - protected void tearDown() throws Exception + public void tearDown() throws Exception { - // Ensure we close the opened Registry - ApplicationRegistry.remove(); _ruleSet.clear(); + super.tearDown(); } public void assertDenyGrantAllow(String identity, Operation operation, ObjectType objectType) diff --git a/java/broker-plugins/experimental/info/build.xml b/java/broker-plugins/experimental/info/build.xml index e6927b5704..bc7dd19410 100644 --- a/java/broker-plugins/experimental/info/build.xml +++ b/java/broker-plugins/experimental/info/build.xml @@ -20,8 +20,8 @@ nn - or more contributor license agreements. See the NOTICE file --> - - + + diff --git a/java/broker-plugins/extras/build.xml b/java/broker-plugins/extras/build.xml index 1a3d933f46..7c1d0be49f 100644 --- a/java/broker-plugins/extras/build.xml +++ b/java/broker-plugins/extras/build.xml @@ -19,8 +19,8 @@ nn - or more contributor license agreements. See the NOTICE file - --> - - + + diff --git a/java/broker-plugins/firewall/build.xml b/java/broker-plugins/firewall/build.xml index 2be844e1fc..576435de7f 100644 --- a/java/broker-plugins/firewall/build.xml +++ b/java/broker-plugins/firewall/build.xml @@ -17,8 +17,8 @@ - under the License. --> - - + + @@ -26,4 +26,4 @@ - \ No newline at end of file + 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 ab340ab849..89dba035e4 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 @@ -27,7 +27,7 @@ import java.net.InetSocketAddress; import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.configuration.XMLConfiguration; -import org.apache.qpid.server.registry.ApplicationRegistry; +import org.apache.qpid.server.configuration.ServerConfiguration; 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; @@ -73,18 +73,7 @@ public class FirewallPluginTest extends InternalBrokerBaseCase } // IP address - private String _address; - - @Override - public void setUp() throws Exception - { - super.setUp(); - - _address = "127.0.0.1"; - - // Create new ApplicationRegistry - ApplicationRegistry.getInstance(); - } + private String _address= "127.0.0.1"; private Firewall initialisePlugin(String defaultAction, RuleInfo[] rules) throws IOException, ConfigurationException @@ -93,7 +82,6 @@ public class FirewallPluginTest extends InternalBrokerBaseCase File confFile = File.createTempFile(getClass().getSimpleName()+"conffile", null); confFile.deleteOnExit(); BufferedWriter buf = new BufferedWriter(new FileWriter(confFile)); - buf.write("\n"); buf.write("\n"); if (rules != null) { @@ -113,7 +101,6 @@ public class FirewallPluginTest extends InternalBrokerBaseCase } } buf.write(""); - buf.write("\n"); buf.close(); // Configure plugin diff --git a/java/broker-plugins/simple-xml/build.xml b/java/broker-plugins/simple-xml/build.xml index 2c26c9129a..8780bc42b7 100644 --- a/java/broker-plugins/simple-xml/build.xml +++ b/java/broker-plugins/simple-xml/build.xml @@ -17,8 +17,8 @@ - under the License. --> - - + + diff --git a/java/broker-plugins/simple-xml/src/test/java/org/apache/qpid/server/security/access/PrincipalPermissionsTest.java b/java/broker-plugins/simple-xml/src/test/java/org/apache/qpid/server/security/access/PrincipalPermissionsTest.java index 3cbad83369..e5942c73c2 100644 --- a/java/broker-plugins/simple-xml/src/test/java/org/apache/qpid/server/security/access/PrincipalPermissionsTest.java +++ b/java/broker-plugins/simple-xml/src/test/java/org/apache/qpid/server/security/access/PrincipalPermissionsTest.java @@ -32,8 +32,9 @@ import org.apache.qpid.server.security.Result; import org.apache.qpid.server.security.access.config.PrincipalPermissions; import org.apache.qpid.server.security.access.config.PrincipalPermissions.Permission; import org.apache.qpid.server.virtualhost.VirtualHost; +import org.apache.qpid.server.util.InternalBrokerBaseCase; -public class PrincipalPermissionsTest extends TestCase +public class PrincipalPermissionsTest extends InternalBrokerBaseCase { private String _user = "user"; private PrincipalPermissions _perms; @@ -49,21 +50,18 @@ public class PrincipalPermissionsTest extends TestCase private boolean _autoDelete = false; private AMQShortString _exchangeType = new AMQShortString("direct"); private DirectExchange _exchange; - private VirtualHost _virtualHost; private AMQShortString _owner = new AMQShortString(this.getClass().getName() + "owner"); private Boolean _temporary = false; private Boolean _ownQueue = false; @Override - public void setUp() + public void setUp() throws Exception { - //Highlight that this test will cause a new AR to be created - ApplicationRegistry.getInstance(); + super.setUp(); _perms = new PrincipalPermissions(_user); try { - _virtualHost = ApplicationRegistry.getInstance().getVirtualHostRegistry().getVirtualHost("test"); _exchange = DirectExchange.TYPE.newInstance(_virtualHost, _exchangeName, _durable, _ticket, _autoDelete); AMQQueueFactory.createAMQQueueImpl(_queueName, false, _owner , false, false, _virtualHost, _arguments); AMQQueueFactory.createAMQQueueImpl(_tempQueueName, false, _owner , true, false, _virtualHost, _arguments); @@ -74,13 +72,6 @@ public class PrincipalPermissionsTest extends TestCase } } - @Override - protected void tearDown() throws Exception - { - //Ensure we close the opened Registry - ApplicationRegistry.remove(); - } - public void testPrincipalPermissions() { -- cgit v1.2.1