qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kw...@apache.org
Subject [15/30] qpid-broker-j git commit: QPID-8151: [Broker-J] [Unit tests] Factor out QpidTestCase
Date Sun, 01 Apr 2018 20:26:22 GMT
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/d0dcd3fc/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/config/AclFileParserTest.java
----------------------------------------------------------------------
diff --git a/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/config/AclFileParserTest.java b/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/config/AclFileParserTest.java
index 8359840..ed49b45 100644
--- a/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/config/AclFileParserTest.java
+++ b/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/config/AclFileParserTest.java
@@ -18,6 +18,9 @@
  */
 package org.apache.qpid.server.security.access.config;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 import static org.mockito.Mockito.mock;
 
 import java.io.File;
@@ -26,17 +29,19 @@ import java.io.FileWriter;
 import java.io.PrintWriter;
 import java.util.List;
 
+import org.junit.Test;
+
 import org.apache.qpid.server.configuration.IllegalConfigurationException;
 import org.apache.qpid.server.logging.EventLoggerProvider;
 import org.apache.qpid.server.security.Result;
 import org.apache.qpid.server.security.access.config.ObjectProperties.Property;
-import org.apache.qpid.test.utils.QpidTestCase;
+import org.apache.qpid.test.utils.UnitTestBase;
 
-public class AclFileParserTest extends QpidTestCase
+public class AclFileParserTest extends UnitTestBase
 {
     private RuleSet writeACLConfig(String...aclData) throws Exception
     {
-        File acl = File.createTempFile(getClass().getName() + getName(), "acl");
+        File acl = File.createTempFile(getClass().getName() + getTestName(), "acl");
         acl.deleteOnExit();
 
         // Write ACL file
@@ -52,12 +57,14 @@ public class AclFileParserTest extends QpidTestCase
         return AclFileParser.parse(new FileReader(acl), mock(EventLoggerProvider.class));
     }
 
+    @Test
     public void testEmptyRuleSetDefaults() throws Exception
     {
         RuleSet ruleSet = writeACLConfig();
-        assertEquals(0, ruleSet.getRuleCount());
+        assertEquals((long) 0, (long) ruleSet.getRuleCount());
         assertEquals(Result.DENIED, ruleSet.getDefault());
     }
+    @Test
     public void testACLFileSyntaxContinuation() throws Exception
     {
         try
@@ -71,6 +78,7 @@ public class AclFileParserTest extends QpidTestCase
         }
     }
 
+    @Test
     public void testACLFileSyntaxTokens() throws Exception
     {
         try
@@ -81,11 +89,13 @@ public class AclFileParserTest extends QpidTestCase
         catch (IllegalConfigurationException ce)
         {
             assertEquals(String.format(AclFileParser.PARSE_TOKEN_FAILED_MSG, 1), ce.getMessage());
-            assertTrue(ce.getCause() instanceof IllegalArgumentException);
+            final boolean condition = ce.getCause() instanceof IllegalArgumentException;
+            assertTrue(condition);
             assertEquals("Not a valid permission: unparsed", ce.getCause().getMessage());
         }
     }
 
+    @Test
     public void testACLFileSyntaxNotEnoughACL() throws Exception
     {
         try
@@ -99,6 +109,7 @@ public class AclFileParserTest extends QpidTestCase
         }
     }
 
+    @Test
     public void testACLFileSyntaxNotEnoughConfig() throws Exception
     {
         try
@@ -112,6 +123,7 @@ public class AclFileParserTest extends QpidTestCase
         }
     }
 
+    @Test
     public void testACLFileSyntaxNotEnough() throws Exception
     {
         try
@@ -125,6 +137,7 @@ public class AclFileParserTest extends QpidTestCase
         }
     }
 
+    @Test
     public void testACLFileSyntaxPropertyKeyOnly() throws Exception
     {
         try
@@ -138,6 +151,7 @@ public class AclFileParserTest extends QpidTestCase
         }
     }
 
+    @Test
     public void testACLFileSyntaxPropertyNoEquals() throws Exception
     {
         try
@@ -151,6 +165,7 @@ public class AclFileParserTest extends QpidTestCase
         }
     }
 
+    @Test
     public void testACLFileSyntaxPropertyNoValue() throws Exception
     {
         try
@@ -164,10 +179,11 @@ public class AclFileParserTest extends QpidTestCase
         }
     }
 
+    @Test
     public void testValidConfig() throws Exception
     {
         RuleSet ruleSet = writeACLConfig("CONFIG defaultdefer=true");
-        assertEquals("Unexpected number of rules", 0, ruleSet.getRuleCount());
+        assertEquals("Unexpected number of rules", (long) 0, (long) ruleSet.getRuleCount());
         assertEquals("Unexpected number of rules", Result.DEFER, ruleSet.getDefault());
     }
 
@@ -175,68 +191,78 @@ public class AclFileParserTest extends QpidTestCase
      * Tests interpretation of an acl rule with no object properties.
      *
      */
+    @Test
     public void testValidRule() throws Exception
     {
         final RuleSet rs = writeACLConfig("ACL DENY-LOG user1 ACCESS VIRTUALHOST");
-        assertEquals(1, rs.getRuleCount());
+        assertEquals((long) 1, (long) rs.getRuleCount());
 
         final List<Rule> rules = rs.getAllRules();
-        assertEquals(1, rules.size());
+        assertEquals((long) 1, (long) rules.size());
         final Rule rule = rules.get(0);
         assertEquals("Rule has unexpected identity", "user1", rule.getIdentity());
         assertEquals("Rule has unexpected operation", LegacyOperation.ACCESS, rule.getAction().getOperation());
         assertEquals("Rule has unexpected operation", ObjectType.VIRTUALHOST, rule.getAction().getObjectType());
-        assertEquals("Rule has unexpected object properties", ObjectProperties.EMPTY, rule.getAction().getProperties());
+        assertEquals("Rule has unexpected object properties",
+                            ObjectProperties.EMPTY,
+                            rule.getAction().getProperties());
     }
 
     /**
      * Tests interpretation of an acl rule with object properties quoted in single quotes.
      */
+    @Test
     public void testValidRuleWithSingleQuotedProperty() throws Exception
     {
         final RuleSet rs = writeACLConfig("ACL ALLOW all CREATE EXCHANGE name = \'value\'");
-        assertEquals(1, rs.getRuleCount());
+        assertEquals((long) 1, (long) rs.getRuleCount());
 
         final List<Rule> rules = rs.getAllRules();
-        assertEquals(1, rules.size());
+        assertEquals((long) 1, (long) rules.size());
         final Rule rule = rules.get(0);
         assertEquals("Rule has unexpected identity", "all", rule.getIdentity());
         assertEquals("Rule has unexpected operation", LegacyOperation.CREATE, rule.getAction().getOperation());
         assertEquals("Rule has unexpected operation", ObjectType.EXCHANGE, rule.getAction().getObjectType());
         final ObjectProperties expectedProperties = new ObjectProperties();
         expectedProperties.setName("value");
-        assertEquals("Rule has unexpected object properties", expectedProperties, rule.getAction().getProperties());
+        assertEquals("Rule has unexpected object properties",
+                            expectedProperties,
+                            rule.getAction().getProperties());
     }
 
     /**
      * Tests interpretation of an acl rule with object properties quoted in double quotes.
      */
+    @Test
     public void testValidRuleWithDoubleQuotedProperty() throws Exception
     {
         final RuleSet rs = writeACLConfig("ACL ALLOW all CREATE EXCHANGE name = \"value\"");
-        assertEquals(1, rs.getRuleCount());
+        assertEquals((long) 1, (long) rs.getRuleCount());
 
         final List<Rule> rules = rs.getAllRules();
-        assertEquals(1, rules.size());
+        assertEquals((long) 1, (long) rules.size());
         final Rule rule = rules.get(0);
         assertEquals("Rule has unexpected identity", "all", rule.getIdentity());
         assertEquals("Rule has unexpected operation", LegacyOperation.CREATE, rule.getAction().getOperation());
         assertEquals("Rule has unexpected operation", ObjectType.EXCHANGE, rule.getAction().getObjectType());
         final ObjectProperties expectedProperties = new ObjectProperties();
         expectedProperties.setName("value");
-        assertEquals("Rule has unexpected object properties", expectedProperties, rule.getAction().getProperties());
+        assertEquals("Rule has unexpected object properties",
+                            expectedProperties,
+                            rule.getAction().getProperties());
     }
 
     /**
      * Tests interpretation of an acl rule with many object properties.
      */
+    @Test
     public void testValidRuleWithManyProperties() throws Exception
     {
         final RuleSet rs = writeACLConfig("ACL ALLOW admin DELETE QUEUE name=name1 owner = owner1");
-        assertEquals(1, rs.getRuleCount());
+        assertEquals((long) 1, (long) rs.getRuleCount());
 
         final List<Rule> rules = rs.getAllRules();
-        assertEquals(1, rules.size());
+        assertEquals((long) 1, (long) rules.size());
         final Rule rule = rules.get(0);
         assertEquals("Rule has unexpected identity", "admin", rule.getIdentity());
         assertEquals("Rule has unexpected operation", LegacyOperation.DELETE, rule.getAction().getOperation());
@@ -251,50 +277,60 @@ public class AclFileParserTest extends QpidTestCase
      * Tests interpretation of an acl rule with object properties containing wildcards.  Values containing
      * hashes must be quoted otherwise they are interpreted as comments.
      */
+    @Test
     public void testValidRuleWithWildcardProperties() throws Exception
     {
         final RuleSet rs = writeACLConfig("ACL ALLOW all CREATE EXCHANGE routingKey = \'news.#\'",
                                                          "ACL ALLOW all CREATE EXCHANGE routingKey = \'news.co.#\'",
                                                          "ACL ALLOW all CREATE EXCHANGE routingKey = *.co.medellin");
-        assertEquals(3, rs.getRuleCount());
+        assertEquals((long) 3, (long) rs.getRuleCount());
 
         final List<Rule> rules = rs.getAllRules();
-        assertEquals(3, rules.size());
+        assertEquals((long) 3, (long) rules.size());
         final Rule rule1 = rules.get(0);
         assertEquals("Rule has unexpected identity", "all", rule1.getIdentity());
         assertEquals("Rule has unexpected operation", LegacyOperation.CREATE, rule1.getAction().getOperation());
         assertEquals("Rule has unexpected operation", ObjectType.EXCHANGE, rule1.getAction().getObjectType());
         final ObjectProperties expectedProperties1 = new ObjectProperties();
         expectedProperties1.put(Property.ROUTING_KEY,"news.#");
-        assertEquals("Rule has unexpected object properties", expectedProperties1, rule1.getAction().getProperties());
+        assertEquals("Rule has unexpected object properties",
+                            expectedProperties1,
+                            rule1.getAction().getProperties());
 
         final Rule rule2 = rules.get(1);
         final ObjectProperties expectedProperties2 = new ObjectProperties();
         expectedProperties2.put(Property.ROUTING_KEY,"news.co.#");
-        assertEquals("Rule has unexpected object properties", expectedProperties2, rule2.getAction().getProperties());
+        assertEquals("Rule has unexpected object properties",
+                            expectedProperties2,
+                            rule2.getAction().getProperties());
 
         final Rule rule3 = rules.get(2);
         final ObjectProperties expectedProperties3 = new ObjectProperties();
         expectedProperties3.put(Property.ROUTING_KEY,"*.co.medellin");
-        assertEquals("Rule has unexpected object properties", expectedProperties3, rule3.getAction().getProperties());
+        assertEquals("Rule has unexpected object properties",
+                            expectedProperties3,
+                            rule3.getAction().getProperties());
     }
 
     /**
      * Tests that rules are case insignificant.
      */
+    @Test
     public void testMixedCaseRuleInterpretation() throws Exception
     {
         final RuleSet rs  = writeACLConfig("AcL deny-LOG User1 BiND Exchange Name=AmQ.dIrect");
-        assertEquals(1, rs.getRuleCount());
+        assertEquals((long) 1, (long) rs.getRuleCount());
 
         final List<Rule> rules = rs.getAllRules();
-        assertEquals(1, rules.size());
+        assertEquals((long) 1, (long) rules.size());
         final Rule rule = rules.get(0);
         assertEquals("Rule has unexpected identity", "User1", rule.getIdentity());
         assertEquals("Rule has unexpected operation", LegacyOperation.BIND, rule.getAction().getOperation());
         assertEquals("Rule has unexpected operation", ObjectType.EXCHANGE, rule.getAction().getObjectType());
         final ObjectProperties expectedProperties = new ObjectProperties("AmQ.dIrect");
-        assertEquals("Rule has unexpected object properties", expectedProperties, rule.getAction().getProperties());
+        assertEquals("Rule has unexpected object properties",
+                            expectedProperties,
+                            rule.getAction().getProperties());
     }
 
     /**
@@ -302,58 +338,68 @@ public class AclFileParserTest extends QpidTestCase
      * be introduced anywhere in the ACL, whereas the C++ supports only whitespace at the beginning of
      * of line.
      */
+    @Test
     public void testCommentsSupported() throws Exception
     {
         final RuleSet rs = writeACLConfig("#Comment",
                                                          "ACL DENY-LOG user1 ACCESS VIRTUALHOST # another comment",
                                                          "  # final comment with leading whitespace");
-        assertEquals(1, rs.getRuleCount());
+        assertEquals((long) 1, (long) rs.getRuleCount());
 
         final List<Rule> rules = rs.getAllRules();
-        assertEquals(1, rules.size());
+        assertEquals((long) 1, (long) rules.size());
         final Rule rule = rules.get(0);
         assertEquals("Rule has unexpected identity", "user1", rule.getIdentity());
         assertEquals("Rule has unexpected operation", LegacyOperation.ACCESS, rule.getAction().getOperation());
         assertEquals("Rule has unexpected operation", ObjectType.VIRTUALHOST, rule.getAction().getObjectType());
-        assertEquals("Rule has unexpected object properties", ObjectProperties.EMPTY, rule.getAction().getProperties());
+        assertEquals("Rule has unexpected object properties",
+                            ObjectProperties.EMPTY,
+                            rule.getAction().getProperties());
     }
 
     /**
      * Tests interpretation of an acl rule using mixtures of tabs/spaces as token separators.
      *
      */
+    @Test
     public void testWhitespace() throws Exception
     {
         final RuleSet rs = writeACLConfig("ACL\tDENY-LOG\t\t user1\t \tACCESS VIRTUALHOST");
-        assertEquals(1, rs.getRuleCount());
+        assertEquals((long) 1, (long) rs.getRuleCount());
 
         final List<Rule> rules = rs.getAllRules();
-        assertEquals(1, rules.size());
+        assertEquals((long) 1, (long) rules.size());
         final Rule rule = rules.get(0);
         assertEquals("Rule has unexpected identity", "user1", rule.getIdentity());
         assertEquals("Rule has unexpected operation", LegacyOperation.ACCESS, rule.getAction().getOperation());
         assertEquals("Rule has unexpected operation", ObjectType.VIRTUALHOST, rule.getAction().getObjectType());
-        assertEquals("Rule has unexpected object properties", ObjectProperties.EMPTY, rule.getAction().getProperties());
+        assertEquals("Rule has unexpected object properties",
+                            ObjectProperties.EMPTY,
+                            rule.getAction().getProperties());
     }
 
     /**
      * Tests interpretation of an acl utilising line continuation.
      */
+    @Test
     public void testLineContinuation() throws Exception
     {
         final RuleSet rs = writeACLConfig("ACL DENY-LOG user1 \\",
                                                          "ACCESS VIRTUALHOST");
-        assertEquals(1, rs.getRuleCount());
+        assertEquals((long) 1, (long) rs.getRuleCount());
 
         final List<Rule> rules = rs.getAllRules();
-        assertEquals(1, rules.size());
+        assertEquals((long) 1, (long) rules.size());
         final Rule rule = rules.get(0);
         assertEquals("Rule has unexpected identity", "user1", rule.getIdentity());
         assertEquals("Rule has unexpected operation", LegacyOperation.ACCESS, rule.getAction().getOperation());
         assertEquals("Rule has unexpected operation", ObjectType.VIRTUALHOST, rule.getAction().getObjectType());
-        assertEquals("Rule has unexpected object properties", ObjectProperties.EMPTY, rule.getAction().getProperties());
+        assertEquals("Rule has unexpected object properties",
+                            ObjectProperties.EMPTY,
+                            rule.getAction().getProperties());
     }
 
+    @Test
     public void testUserRuleParsing() throws Exception
     {
         validateRule(writeACLConfig("ACL ALLOW user1 CREATE USER"),
@@ -377,6 +423,7 @@ public class AclFileParserTest extends QpidTestCase
                      "user1", LegacyOperation.ALL, ObjectType.USER, new ObjectProperties("otherUser"));
     }
 
+    @Test
     public void testGroupRuleParsing() throws Exception
     {
         validateRule(writeACLConfig("ACL ALLOW user1 CREATE GROUP"),
@@ -401,6 +448,7 @@ public class AclFileParserTest extends QpidTestCase
     }
 
     /** explicitly test for exception indicating that this functionality has been moved to Group Providers */
+    @Test
     public void testGroupDefinitionThrowsException() throws Exception
     {
         try
@@ -414,6 +462,7 @@ public class AclFileParserTest extends QpidTestCase
         }
     }
 
+    @Test
     public void testManagementRuleParsing() throws Exception
     {
         validateRule(writeACLConfig("ACL ALLOW user1 ALL MANAGEMENT"),
@@ -423,6 +472,7 @@ public class AclFileParserTest extends QpidTestCase
                      "user1", LegacyOperation.ACCESS, ObjectType.MANAGEMENT, ObjectProperties.EMPTY);
     }
 
+    @Test
     public void testBrokerRuleParsing() throws Exception
     {
         validateRule(writeACLConfig("ACL ALLOW user1 CONFIGURE BROKER"), "user1", LegacyOperation.CONFIGURE, ObjectType.BROKER,
@@ -432,10 +482,10 @@ public class AclFileParserTest extends QpidTestCase
 
     private void validateRule(final RuleSet rs, String username, LegacyOperation operation, ObjectType objectType, ObjectProperties objectProperties)
     {
-        assertEquals(1, rs.getRuleCount());
+        assertEquals((long) 1, (long) rs.getRuleCount());
 
         final List<Rule> rules = rs.getAllRules();
-        assertEquals(1, rules.size());
+        assertEquals((long) 1, (long) rules.size());
         final Rule rule = rules.get(0);
         assertEquals("Rule has unexpected identity", username, rule.getIdentity());
         assertEquals("Rule has unexpected operation", operation, rule.getAction().getOperation());

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/d0dcd3fc/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/config/AclRulePredicatesTest.java
----------------------------------------------------------------------
diff --git a/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/config/AclRulePredicatesTest.java b/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/config/AclRulePredicatesTest.java
index 493ffd4..2b4c3d5 100644
--- a/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/config/AclRulePredicatesTest.java
+++ b/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/config/AclRulePredicatesTest.java
@@ -23,6 +23,8 @@ import static org.apache.qpid.server.security.access.config.ObjectProperties.Pro
 import static org.apache.qpid.server.security.access.config.ObjectProperties.Property.FROM_HOSTNAME;
 import static org.apache.qpid.server.security.access.config.ObjectProperties.Property.FROM_NETWORK;
 import static org.apache.qpid.server.security.access.config.ObjectProperties.Property.NAME;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
 import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
@@ -30,27 +32,29 @@ import static org.mockito.Mockito.when;
 
 import java.util.Set;
 
+import org.junit.Before;
+import org.junit.Test;
 import org.mockito.internal.util.collections.Sets;
 
 import org.apache.qpid.server.security.access.firewall.FirewallRule;
 import org.apache.qpid.server.security.access.firewall.FirewallRuleFactory;
-import org.apache.qpid.test.utils.QpidTestCase;
+import org.apache.qpid.test.utils.UnitTestBase;
 
-public class AclRulePredicatesTest extends QpidTestCase
+public class AclRulePredicatesTest extends UnitTestBase
 {
     private AclRulePredicates _aclRulePredicates = new AclRulePredicates();
     private FirewallRuleFactory _firewallRuleFactory = mock(FirewallRuleFactory.class);
 
-    @Override
-    protected void setUp() throws Exception
+    @Before
+    public void setUp() throws Exception
     {
-        super.setUp();
         _aclRulePredicates.setFirewallRuleFactory(_firewallRuleFactory);
 
         when(_firewallRuleFactory.createForHostname(any())).thenReturn(mock(FirewallRule.class));
         when(_firewallRuleFactory.createForNetwork(any())).thenReturn(mock(FirewallRule.class));
     }
 
+    @Test
     public void testParse()
     {
         String name = "name";
@@ -63,6 +67,7 @@ public class AclRulePredicatesTest extends QpidTestCase
         assertEquals(className, _aclRulePredicates.getObjectProperties().get(CLASS));
     }
 
+    @Test
     public void testParseHostnameFirewallRule()
     {
         String hostname = "hostname1,hostname2";
@@ -71,6 +76,7 @@ public class AclRulePredicatesTest extends QpidTestCase
         verify(_firewallRuleFactory).createForHostname(new String[] {"hostname1", "hostname2"});
     }
 
+    @Test
     public void testParseNetworkFirewallRule()
     {
         _aclRulePredicates.setFirewallRuleFactory(_firewallRuleFactory);
@@ -81,6 +87,7 @@ public class AclRulePredicatesTest extends QpidTestCase
         verify(_firewallRuleFactory).createForNetwork(new String[] {"network1", "network2"});
     }
 
+    @Test
     public void testParseThrowsExceptionIfBothHostnameAndNetworkSpecified()
     {
         _aclRulePredicates.parse(FROM_NETWORK.name(), "network1,network2");
@@ -95,6 +102,7 @@ public class AclRulePredicatesTest extends QpidTestCase
         }
     }
 
+    @Test
     public void testParseAttributesRule()
     {
         String attributes = "attribute1,attribute2";
@@ -102,7 +110,8 @@ public class AclRulePredicatesTest extends QpidTestCase
 
         final Set<String> attributesSet = Sets.newSet(attributes.split(","));
         assertEquals("Unexpected attributes",
-                     attributesSet,
-                     _aclRulePredicates.getObjectProperties().getAttributeNames());
+                            attributesSet,
+                            _aclRulePredicates.getObjectProperties().getAttributeNames());
+
     }
 }

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/d0dcd3fc/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/config/ActionTest.java
----------------------------------------------------------------------
diff --git a/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/config/ActionTest.java b/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/config/ActionTest.java
index 1b022fa..c6e18ad 100644
--- a/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/config/ActionTest.java
+++ b/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/config/ActionTest.java
@@ -18,17 +18,23 @@
  */
 package org.apache.qpid.server.security.access.config;
 
-import static org.mockito.Mockito.*;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 import java.util.Collections;
 
-import org.apache.qpid.test.utils.QpidTestCase;
+import org.junit.Test;
 
-public class ActionTest extends QpidTestCase
+import org.apache.qpid.test.utils.UnitTestBase;
+
+public class ActionTest extends UnitTestBase
 {
     private ObjectProperties _properties1 = mock(ObjectProperties.class);
     private ObjectProperties _properties2 = mock(ObjectProperties.class);
 
+    @Test
     public void testMatchesReturnsTrueForMatchingActions()
     {
         when(_properties1.propertiesMatch(_properties2)).thenReturn(true);
@@ -38,6 +44,7 @@ public class ActionTest extends QpidTestCase
                 new Action(LegacyOperation.CONSUME, ObjectType.QUEUE, _properties2));
     }
 
+    @Test
     public void testMatchesReturnsFalseWhenOperationsDiffer()
     {
         assertDoesntMatch(
@@ -45,6 +52,7 @@ public class ActionTest extends QpidTestCase
                 new Action(LegacyOperation.CREATE, ObjectType.QUEUE, _properties1));
     }
 
+    @Test
     public void testMatchesReturnsFalseWhenOperationTypesDiffer()
     {
         assertDoesntMatch(
@@ -52,6 +60,7 @@ public class ActionTest extends QpidTestCase
                 new Action(LegacyOperation.CREATE, ObjectType.EXCHANGE, _properties1));
     }
 
+    @Test
     public void testMatchesReturnsFalseWhenOperationPropertiesDiffer()
     {
         assertDoesntMatch(
@@ -59,6 +68,7 @@ public class ActionTest extends QpidTestCase
                 new Action(LegacyOperation.CREATE, ObjectType.QUEUE, _properties2));
     }
 
+    @Test
     public void testMatchesReturnsFalseWhenMyOperationPropertiesIsNull()
     {
         assertDoesntMatch(
@@ -66,6 +76,7 @@ public class ActionTest extends QpidTestCase
                 new Action(LegacyOperation.CREATE, ObjectType.QUEUE, _properties1));
     }
 
+    @Test
     public void testMatchesReturnsFalseWhenOtherOperationPropertiesIsNull()
     {
         assertDoesntMatch(
@@ -73,6 +84,7 @@ public class ActionTest extends QpidTestCase
                 new Action(LegacyOperation.CREATE, ObjectType.QUEUE, (ObjectProperties)null));
     }
 
+    @Test
     public void testMatchesReturnsTrueWhenBothOperationPropertiesAreNull()
     {
         assertMatches(
@@ -80,6 +92,7 @@ public class ActionTest extends QpidTestCase
                 new Action(LegacyOperation.CREATE, ObjectType.QUEUE, (ObjectProperties)null));
     }
 
+    @Test
     public void testAttributesIgnoredForCreate()
     {
         final ObjectProperties objectProperties1 = new ObjectProperties();
@@ -90,6 +103,7 @@ public class ActionTest extends QpidTestCase
                       new Action(LegacyOperation.CREATE, ObjectType.QUEUE, objectProperties2));
     }
 
+    @Test
     public void testAttributesDifferForUpdate()
     {
         final ObjectProperties objectProperties1 = new ObjectProperties();
@@ -100,6 +114,7 @@ public class ActionTest extends QpidTestCase
                           new Action(LegacyOperation.UPDATE, ObjectType.QUEUE, objectProperties2));
     }
 
+    @Test
     public void testAttributesMatchForUpdate()
     {
         final ObjectProperties objectProperties1 = new ObjectProperties();

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/d0dcd3fc/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/config/ClientActionTest.java
----------------------------------------------------------------------
diff --git a/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/config/ClientActionTest.java b/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/config/ClientActionTest.java
index 3ce4496..2135688 100644
--- a/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/config/ClientActionTest.java
+++ b/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/config/ClientActionTest.java
@@ -18,15 +18,21 @@
  */
 package org.apache.qpid.server.security.access.config;
 
-import static org.mockito.Mockito.*;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verifyZeroInteractions;
+import static org.mockito.Mockito.when;
 
 import java.net.InetAddress;
 
-import org.apache.qpid.server.security.access.firewall.FirewallRule;
+import org.junit.Test;
 
-import org.apache.qpid.test.utils.QpidTestCase;
+import org.apache.qpid.server.security.access.firewall.FirewallRule;
+import org.apache.qpid.test.utils.UnitTestBase;
 
-public class ClientActionTest extends QpidTestCase
+public class ClientActionTest extends UnitTestBase
 {
     private Action _action = mock(Action.class);
     private AclAction _ruleAction = mock(AclAction.class);
@@ -34,6 +40,7 @@ public class ClientActionTest extends QpidTestCase
 
     private ClientAction _clientAction = new ClientAction(_action);
 
+    @Test
     public void testMatches_returnsTrueWhenActionsMatchAndNoFirewallRule()
     {
         when(_action.matches(any(Action.class))).thenReturn(true);
@@ -42,6 +49,7 @@ public class ClientActionTest extends QpidTestCase
         assertTrue(_clientAction.matches(_ruleAction, _addressOfClient));
     }
 
+    @Test
     public void testMatches_returnsFalseWhenActionsDontMatch()
     {
         FirewallRule firewallRule = mock(FirewallRule.class);
@@ -53,6 +61,7 @@ public class ClientActionTest extends QpidTestCase
         assertFalse(_clientAction.matches(_ruleAction, _addressOfClient));
     }
 
+    @Test
     public void testMatches_returnsTrueWhenActionsAndFirewallRuleMatch()
     {
         FirewallRule firewallRule = mock(FirewallRule.class);
@@ -64,6 +73,7 @@ public class ClientActionTest extends QpidTestCase
         assertTrue(_clientAction.matches(_ruleAction, _addressOfClient));
     }
 
+    @Test
     public void testMatches_ignoresFirewallRuleIfClientAddressIsNull()
     {
         FirewallRule firewallRule = mock(FirewallRule.class);

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/d0dcd3fc/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/config/LegacyAccessControlAdapterTest.java
----------------------------------------------------------------------
diff --git a/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/config/LegacyAccessControlAdapterTest.java b/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/config/LegacyAccessControlAdapterTest.java
index 3d21010..24373b5 100644
--- a/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/config/LegacyAccessControlAdapterTest.java
+++ b/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/config/LegacyAccessControlAdapterTest.java
@@ -20,9 +20,10 @@
  */
 package org.apache.qpid.server.security.access.config;
 
+import static org.apache.qpid.server.security.access.config.LegacyOperation.ACCESS_LOGS;
 import static org.apache.qpid.server.security.access.config.ObjectType.BROKER;
 import static org.apache.qpid.server.security.access.config.ObjectType.VIRTUALHOST;
-import static org.apache.qpid.server.security.access.config.LegacyOperation.ACCESS_LOGS;
+import static org.junit.Assert.assertEquals;
 import static org.mockito.Matchers.any;
 import static org.mockito.Matchers.eq;
 import static org.mockito.Matchers.same;
@@ -36,13 +37,16 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
+import org.junit.Before;
+import org.junit.Test;
+
 import org.apache.qpid.server.model.*;
 import org.apache.qpid.server.queue.QueueConsumer;
 import org.apache.qpid.server.security.Result;
 import org.apache.qpid.server.virtualhost.QueueManagingVirtualHost;
-import org.apache.qpid.test.utils.QpidTestCase;
+import org.apache.qpid.test.utils.UnitTestBase;
 
-public class LegacyAccessControlAdapterTest extends QpidTestCase
+public class LegacyAccessControlAdapterTest extends UnitTestBase
 {
     private static final String TEST_EXCHANGE_TYPE = "testExchangeType";
     private static final String TEST_VIRTUAL_HOST = "testVirtualHost";
@@ -56,10 +60,9 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
     private LegacyAccessControlAdapter _adapter;
     private Model _model;
 
-    @Override
+    @Before
     public void setUp() throws Exception
     {
-        super.setUp();
         _accessControl = mock(LegacyAccessControl.class);
         _model = BrokerModel.getInstance();
         _broker = mock(Broker.class);
@@ -105,6 +108,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
     }
 
 
+    @Test
     public void testAuthoriseCreateAccessControlProvider()
     {
         AccessControlProvider accessControlProvider = mock(AccessControlProvider.class);
@@ -115,6 +119,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         assertBrokerChildCreateAuthorization(accessControlProvider);
     }
 
+    @Test
     public void testAuthoriseCreateConsumer()
     {
         Queue queue = mock(Queue.class);
@@ -147,6 +152,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
     }
 
 
+    @Test
     public void testAuthoriseUpdatePort()
     {
         Port mock = mock(Port.class);
@@ -156,6 +162,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         assertBrokerChildUpdateAuthorization(mock);
     }
 
+    @Test
     public void testAuthoriseUpdateUser()
     {
         AuthenticationProvider authenticationProvider = mock(AuthenticationProvider.class);
@@ -175,6 +182,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
     }
 
 
+    @Test
     public void testAuthoriseDeleteVirtualHost()
     {
         VirtualHostNode vhn = getMockVirtualHostNode();
@@ -189,6 +197,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         assertDeleteAuthorization(virtualHost, LegacyOperation.DELETE, ObjectType.VIRTUALHOST, properties);
     }
 
+    @Test
     public void testAuthoriseDeleteKeyStore()
     {
         KeyStore mock = mock(KeyStore.class);
@@ -198,6 +207,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         assertBrokerChildDeleteAuthorization(mock);
     }
 
+    @Test
     public void testAuthoriseDeleteTrustStore()
     {
         TrustStore mock = mock(TrustStore.class);
@@ -207,6 +217,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         assertBrokerChildDeleteAuthorization(mock);
     }
 
+    @Test
     public void testAuthoriseDeleteGroup()
     {
         GroupProvider groupProvider = mock(GroupProvider.class);
@@ -220,6 +231,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         assertDeleteAuthorization(mock, LegacyOperation.DELETE, ObjectType.GROUP, properties);
     }
 
+    @Test
     public void testAuthoriseDeleteGroupMember()
     {
         Group group = mock(Group.class);
@@ -233,6 +245,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         assertDeleteAuthorization(mock, LegacyOperation.UPDATE, ObjectType.GROUP, properties);
     }
 
+    @Test
     public void testAuthoriseDeleteUser()
     {
         AuthenticationProvider authenticationProvider = mock(AuthenticationProvider.class);
@@ -246,6 +259,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         assertDeleteAuthorization(mock, LegacyOperation.DELETE, ObjectType.USER, properties);
     }
 
+    @Test
     public void testAuthoriseCreateExchange()
     {
         VirtualHost vh = getMockVirtualHost();
@@ -262,6 +276,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         assertCreateAuthorization(exchange, LegacyOperation.CREATE, ObjectType.EXCHANGE, expectedProperties);
     }
 
+    @Test
     public void testAuthoriseCreateQueue()
     {
         VirtualHost vh = getMockVirtualHost();
@@ -281,6 +296,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         assertCreateAuthorization(queue, LegacyOperation.CREATE, ObjectType.QUEUE, expectedProperties);
     }
 
+    @Test
     public void testAuthoriseDeleteQueue()
     {
         VirtualHost vh = getMockVirtualHost();
@@ -298,6 +314,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         assertDeleteAuthorization(queueObject, LegacyOperation.DELETE, ObjectType.QUEUE, expectedProperties);
     }
 
+    @Test
     public void testAuthoriseUpdateQueue()
     {
         VirtualHost vh = getMockVirtualHost();
@@ -317,6 +334,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
                                   Collections.singletonMap(ConfiguredObject.DESCRIPTION, "Test"));
     }
 
+    @Test
     public void testAuthoriseUpdateExchange()
     {
         VirtualHost vh = getMockVirtualHost();
@@ -335,6 +353,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
                                   Collections.singletonMap(ConfiguredObject.DESCRIPTION, "Test"));
     }
 
+    @Test
     public void testAuthoriseDeleteExchange()
     {
         VirtualHost vh = getMockVirtualHost();
@@ -352,12 +371,14 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         assertDeleteAuthorization(exchange, LegacyOperation.DELETE, ObjectType.EXCHANGE, expectedProperties);
     }
 
+    @Test
     public void testAuthoriseCreateVirtualHostNode()
     {
         VirtualHostNode vhn = getMockVirtualHostNode();
         assertCreateAuthorization(vhn, LegacyOperation.CREATE, ObjectType.VIRTUALHOSTNODE, new ObjectProperties("testVHN"));
     }
 
+    @Test
     public void testAuthoriseCreatePort()
     {
         Port port = mock(Port.class);
@@ -368,6 +389,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         assertBrokerChildCreateAuthorization(port);
     }
 
+    @Test
     public void testAuthoriseCreateAuthenticationProvider()
     {
         AuthenticationProvider authenticationProvider = mock(AuthenticationProvider.class);
@@ -378,6 +400,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         assertBrokerChildCreateAuthorization(authenticationProvider);
     }
 
+    @Test
     public void testAuthoriseCreateGroupProvider()
     {
         GroupProvider groupProvider = mock(GroupProvider.class);
@@ -389,6 +412,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
     }
 
 
+    @Test
     public void testAuthoriseCreateKeyStore()
     {
         KeyStore keyStore = mock(KeyStore.class);
@@ -399,6 +423,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         assertBrokerChildCreateAuthorization(keyStore);
     }
 
+    @Test
     public void testAuthoriseCreateTrustStore()
     {
         TrustStore trustStore = mock(TrustStore.class);
@@ -409,6 +434,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         assertBrokerChildCreateAuthorization(trustStore);
     }
 
+    @Test
     public void testAuthoriseCreateGroup()
     {
         GroupProvider groupProvider = mock(GroupProvider.class);
@@ -426,6 +452,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         assertCreateAuthorization(group, LegacyOperation.CREATE, ObjectType.GROUP, new ObjectProperties("test"));
     }
 
+    @Test
     public void testAuthoriseCreateGroupMember()
     {
         Group group = mock(Group.class);
@@ -443,6 +470,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         assertCreateAuthorization(groupMember, LegacyOperation.UPDATE, ObjectType.GROUP, new ObjectProperties("test"));
     }
 
+    @Test
     public void testAuthoriseCreateUser()
     {
         AuthenticationProvider authenticationProvider = mock(AuthenticationProvider.class);
@@ -460,6 +488,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         assertCreateAuthorization(user, LegacyOperation.CREATE, ObjectType.USER, new ObjectProperties("test"));
     }
 
+    @Test
     public void testAuthoriseCreateVirtualHost()
     {
         VirtualHost vh = getMockVirtualHost();
@@ -469,6 +498,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
                                   expectedProperties);
     }
 
+    @Test
     public void testAuthoriseUpdateVirtualHostNode()
     {
         VirtualHostNode vhn = getMockVirtualHostNode();
@@ -482,6 +512,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
     }
 
 
+    @Test
     public void testAuthoriseUpdateAuthenticationProvider()
     {
         AuthenticationProvider mock = mock(AuthenticationProvider.class);
@@ -491,6 +522,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         assertBrokerChildUpdateAuthorization(mock);
     }
 
+    @Test
     public void testAuthoriseUpdateGroupProvider()
     {
         GroupProvider mock = mock(GroupProvider.class);
@@ -500,6 +532,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         assertBrokerChildUpdateAuthorization(mock);
     }
 
+    @Test
     public void testAuthoriseUpdateAccessControlProvider()
     {
         AccessControlProvider mock = mock(AccessControlProvider.class);
@@ -509,6 +542,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         assertBrokerChildUpdateAuthorization(mock);
     }
 
+    @Test
     public void testAuthoriseUpdateKeyStore()
     {
         KeyStore mock = mock(KeyStore.class);
@@ -518,6 +552,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         assertBrokerChildUpdateAuthorization(mock);
     }
 
+    @Test
     public void testAuthoriseUpdateTrustStore()
     {
         TrustStore mock = mock(TrustStore.class);
@@ -527,6 +562,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         assertBrokerChildUpdateAuthorization(mock);
     }
 
+    @Test
     public void testAuthoriseUpdateGroup()
     {
         GroupProvider groupProvider = mock(GroupProvider.class);
@@ -541,6 +577,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         assertUpdateAuthorization(mock, LegacyOperation.UPDATE, ObjectType.GROUP, properties, Collections.singletonMap(ConfiguredObject.DESCRIPTION, "Test"));
     }
 
+    @Test
     public void testAuthoriseUpdateGroupMember()
     {
         Group group = mock(Group.class);
@@ -559,6 +596,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
                                   Collections.singletonMap(ConfiguredObject.DESCRIPTION, "Test"));
     }
 
+    @Test
     public void testAuthoriseUpdateVirtualHost()
     {
         VirtualHostNode vhn = getMockVirtualHostNode();
@@ -575,12 +613,14 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
                                   Collections.singletonMap(ConfiguredObject.DESCRIPTION, "Test"));
     }
 
+    @Test
     public void testAuthoriseDeleteVirtualHostNode()
     {
         VirtualHostNode vhn = getMockVirtualHostNode();
         assertDeleteAuthorization(vhn, LegacyOperation.DELETE, ObjectType.VIRTUALHOSTNODE, new ObjectProperties(vhn.getName()));
     }
 
+    @Test
     public void testAuthoriseDeletePort()
     {
         Port mock = mock(Port.class);
@@ -590,6 +630,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         assertBrokerChildDeleteAuthorization(mock);
     }
 
+    @Test
     public void testAuthoriseDeleteAuthenticationProvider()
     {
         AuthenticationProvider mock = mock(AuthenticationProvider.class);
@@ -599,6 +640,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         assertBrokerChildDeleteAuthorization(mock);
     }
 
+    @Test
     public void testAuthoriseDeleteGroupProvider()
     {
         GroupProvider mock = mock(GroupProvider.class);
@@ -608,6 +650,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         assertBrokerChildDeleteAuthorization(mock);
     }
 
+    @Test
     public void testAuthoriseDeleteAccessControlProvider()
     {
         AccessControlProvider mock = mock(AccessControlProvider.class);
@@ -617,6 +660,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         assertBrokerChildDeleteAuthorization(mock);
     }
 
+    @Test
     public void testAuthoriseBrokerLoggerOperations()
     {
         BrokerLogger mock = mock(BrokerLogger.class);
@@ -630,6 +674,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         assertBrokerChildDeleteAuthorization(mock);
     }
 
+    @Test
     public void testAuthoriseBrokerLogInclusionRuleOperations()
     {
         BrokerLogger bl = mock(BrokerLogger.class);
@@ -649,6 +694,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         assertBrokerChildDeleteAuthorization(mock);
     }
 
+    @Test
     public void testAuthoriseInvokeVirtualHostDescendantMethod()
     {
         String methodName = "clearQueue";
@@ -678,6 +724,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         verify(_accessControl).authorise(eq(LegacyOperation.INVOKE), eq(ObjectType.QUEUE), eq(properties));
         verify(_accessControl, never()).authorise(eq(LegacyOperation.PURGE), eq(ObjectType.QUEUE), any(ObjectProperties.class));
     }
+    @Test
     public void testAuthoriseInvokeBrokerDescendantMethod()
     {
         String methodName = "getStatistics";
@@ -698,6 +745,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         verify(_accessControl).authorise(eq(LegacyOperation.INVOKE), eq(ObjectType.VIRTUALHOSTNODE), eq(properties));
     }
 
+    @Test
     public void testAuthorisePurge()
     {
         Queue queue = mock(Queue.class);
@@ -726,6 +774,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
 
     }
 
+    @Test
     public void testAuthoriseLogsAccessOnBroker()
     {
         when(_accessControl.authorise(same(LegacyOperation.INVOKE),
@@ -743,10 +792,10 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         Result result = _adapter.authoriseMethod(logger, "getFile", Collections.singletonMap("fileName", "qpid.log"));
         assertEquals("Unexpected authorise result", Result.ALLOWED, result);
 
-
         verify(_accessControl).authorise(ACCESS_LOGS, BROKER, ObjectProperties.EMPTY);
     }
 
+    @Test
     public void testAuthoriseLogsAccessOnVirtualHost()
     {
         when(_accessControl.authorise(same(LegacyOperation.INVOKE),
@@ -768,6 +817,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         verify(_accessControl).authorise(ACCESS_LOGS, VIRTUALHOST, expectedObjectProperties);
     }
 
+    @Test
     public void testAuthoriseMethod()
     {
         when(_accessControl.authorise(same(LegacyOperation.INVOKE),
@@ -797,12 +847,14 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         verify(_accessControl).authorise(eq(LegacyOperation.UPDATE), eq(ObjectType.METHOD), eq(properties));
     }
 
+    @Test
     public void testAccessManagement()
     {
         _adapter.authoriseAction(_broker, "manage", Collections.emptyMap());
         verify(_accessControl).authorise(LegacyOperation.ACCESS, ObjectType.MANAGEMENT, ObjectProperties.EMPTY);
     }
 
+    @Test
     public void testAuthorisePublish()
     {
         String routingKey = "routingKey";
@@ -825,6 +877,7 @@ public class LegacyAccessControlAdapterTest extends QpidTestCase
         verify(_accessControl).authorise(eq(LegacyOperation.PUBLISH), eq(ObjectType.EXCHANGE), eq(properties));
     }
 
+    @Test
     public void testAuthoriseCreateConnection()
     {
         ObjectProperties properties = new ObjectProperties();

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/d0dcd3fc/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/config/RuleBasedAccessControlTest.java
----------------------------------------------------------------------
diff --git a/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/config/RuleBasedAccessControlTest.java b/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/config/RuleBasedAccessControlTest.java
index 8b8f4d5c..02429de 100644
--- a/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/config/RuleBasedAccessControlTest.java
+++ b/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/config/RuleBasedAccessControlTest.java
@@ -20,6 +20,8 @@
  */
 package org.apache.qpid.server.security.access.config;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
@@ -31,6 +33,9 @@ import java.security.PrivilegedExceptionAction;
 
 import javax.security.auth.Subject;
 
+import org.junit.Before;
+import org.junit.Test;
+
 import org.apache.qpid.server.connection.ConnectionPrincipal;
 import org.apache.qpid.server.logging.EventLogger;
 import org.apache.qpid.server.logging.EventLoggerProvider;
@@ -40,14 +45,15 @@ import org.apache.qpid.server.security.Result;
 import org.apache.qpid.server.security.access.plugins.RuleOutcome;
 import org.apache.qpid.server.security.auth.TestPrincipalUtils;
 import org.apache.qpid.server.transport.AMQPConnection;
-import org.apache.qpid.test.utils.QpidTestCase;
+import org.apache.qpid.test.utils.UnitTestBase;
+
 
 /**
  * In these tests, the ruleset is configured programmatically rather than from an external file.
  *
  * @see RuleSetTest
  */
-public class RuleBasedAccessControlTest extends QpidTestCase
+public class RuleBasedAccessControlTest extends UnitTestBase
 {
     private static final String ALLOWED_GROUP = "allowed_group";
     private static final String DENIED_GROUP = "denied_group";
@@ -56,10 +62,9 @@ public class RuleBasedAccessControlTest extends QpidTestCase
     private UnitTestMessageLogger _messageLogger;
     private EventLogger _eventLogger;
 
-    @Override
+    @Before
     public void setUp() throws Exception
     {
-        super.setUp();
         _messageLogger = new UnitTestMessageLogger();
         _eventLogger = new EventLogger(_messageLogger);
         _plugin = null;
@@ -95,6 +100,7 @@ public class RuleBasedAccessControlTest extends QpidTestCase
     /**
      * ACL plugin must always defer if there is no  subject attached to the thread.
      */
+    @Test
     public void testNoSubjectAlwaysDefers()
     {
         setUpGroupAccessControl();
@@ -106,6 +112,7 @@ public class RuleBasedAccessControlTest extends QpidTestCase
      * Tests that an allow rule expressed with a username allows an operation performed by a thread running
      * with the same username.
      */
+    @Test
     public void testUsernameAllowsOperation()
     {
         setUpGroupAccessControl();
@@ -115,6 +122,7 @@ public class RuleBasedAccessControlTest extends QpidTestCase
             public Object run()
             {
                 final Result result = _plugin.authorise(LegacyOperation.ACCESS, ObjectType.VIRTUALHOST, ObjectProperties.EMPTY);
+
                 assertEquals(Result.ALLOWED, result);
                 return null;
             }
@@ -125,6 +133,7 @@ public class RuleBasedAccessControlTest extends QpidTestCase
      * Tests that an allow rule expressed with an <b>ACL groupname</b> allows an operation performed by a thread running
      * by a user who belongs to the same group..
      */
+    @Test
     public void testGroupMembershipAllowsOperation()
     {
         setUpGroupAccessControl();
@@ -138,6 +147,7 @@ public class RuleBasedAccessControlTest extends QpidTestCase
      * Tests that a deny rule expressed with a <b>groupname</b> denies an operation performed by a thread running
      * by a user who belongs to the same group.
      */
+    @Test
     public void testGroupMembershipDeniesOperation()
     {
         setUpGroupAccessControl();
@@ -147,6 +157,7 @@ public class RuleBasedAccessControlTest extends QpidTestCase
     /**
      * Tests that the catch all deny denies the operation and logs with the logging actor.
      */
+    @Test
     public void testCatchAllRuleDeniesUnrecognisedUsername()
     {
         setUpGroupAccessControl();
@@ -157,14 +168,18 @@ public class RuleBasedAccessControlTest extends QpidTestCase
                          public Object run()
                          {
                              assertEquals("Expecting zero messages before test",
-                                          0,
-                                          _messageLogger.getLogMessages().size());
-                             final Result result = _plugin.authorise(LegacyOperation.ACCESS, ObjectType.VIRTUALHOST, ObjectProperties.EMPTY);
+                                                 (long) 0,
+                                                 (long) _messageLogger.getLogMessages().size());
+
+                             final Result result = _plugin.authorise(LegacyOperation.ACCESS, ObjectType.VIRTUALHOST,
+                                                                     ObjectProperties.EMPTY);
                              assertEquals(Result.DENIED, result);
 
-                             assertEquals("Expecting one message before test", 1, _messageLogger.getLogMessages().size());
+                             assertEquals("Expecting one message before test",
+                                                 (long) 1,
+                                                 (long) _messageLogger.getLogMessages().size());
                              assertTrue("Logged message does not contain expected string",
-                                        _messageLogger.messageContains(0, "ACL-1002"));
+                                               _messageLogger.messageContains(0, "ACL-1002"));
                              return null;
                          }
                      });
@@ -174,6 +189,7 @@ public class RuleBasedAccessControlTest extends QpidTestCase
     /**
      * Tests that a grant access method rule allows any access operation to be performed on any component
      */
+    @Test
     public void testAuthoriseAccessMethodWhenAllAccessOperationsAllowedOnAllComponents()
     {
         final RuleSetCreator rs = new RuleSetCreator();
@@ -200,6 +216,7 @@ public class RuleBasedAccessControlTest extends QpidTestCase
     /**
      * Tests that a grant access method rule allows any access operation to be performed on a specified component
      */
+    @Test
     public void testAuthoriseAccessMethodWhenAllAccessOperationsAllowedOnSpecifiedComponent()
     {
         final RuleSetCreator rs = new RuleSetCreator();
@@ -229,10 +246,11 @@ public class RuleBasedAccessControlTest extends QpidTestCase
 
     }
 
+    @Test
     public void testAccess() throws Exception
     {
         final Subject subject = TestPrincipalUtils.createTestSubject("user1");
-        final String testVirtualHost = getName();
+        final String testVirtualHost = getTestName();
         final InetAddress inetAddress = InetAddress.getLocalHost();
         final InetSocketAddress inetSocketAddress = new InetSocketAddress(inetAddress, 1);
 
@@ -261,6 +279,7 @@ public class RuleBasedAccessControlTest extends QpidTestCase
 
     }
 
+    @Test
     public void testAccessIsDeniedIfRuleThrowsException() throws Exception
     {
         final Subject subject = TestPrincipalUtils.createTestSubject("user1");
@@ -302,6 +321,7 @@ public class RuleBasedAccessControlTest extends QpidTestCase
     /**
      * Tests that a grant access method rule allows any access operation to be performed on a specified component
      */
+    @Test
     public void testAuthoriseAccessMethodWhenSpecifiedAccessOperationsAllowedOnSpecifiedComponent()
     {
         final RuleSetCreator rs = new RuleSetCreator();
@@ -339,6 +359,7 @@ public class RuleBasedAccessControlTest extends QpidTestCase
     /**
      * Tests that granting of all method rights on a method allows a specified operation to be performed on any component
      */
+    @Test
     public void testAuthoriseAccessUpdateMethodWhenAllRightsGrantedOnSpecifiedMethodForAllComponents()
     {
         final RuleSetCreator rs = new RuleSetCreator();
@@ -378,6 +399,7 @@ public class RuleBasedAccessControlTest extends QpidTestCase
     /**
      * Tests that granting of all method rights allows any operation to be performed on any component
      */
+    @Test
     public void testAuthoriseAccessUpdateMethodWhenAllRightsGrantedOnAllMethodsInAllComponents()
     {
         final RuleSetCreator rs = new RuleSetCreator();
@@ -416,6 +438,7 @@ public class RuleBasedAccessControlTest extends QpidTestCase
     /**
      * Tests that granting of access method rights with mask allows matching operations to be performed on the specified component
      */
+    @Test
     public void testAuthoriseAccessMethodWhenMatchingAccessOperationsAllowedOnSpecifiedComponent()
     {
         final RuleSetCreator rs = new RuleSetCreator();


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message