summaryrefslogtreecommitdiff
path: root/qpid/java/broker-plugins/access-control/src/test
diff options
context:
space:
mode:
authorAlex Rudyy <orudyy@apache.org>2013-04-19 16:16:20 +0000
committerAlex Rudyy <orudyy@apache.org>2013-04-19 16:16:20 +0000
commit8735514651a4873dc0b9b0ea4cf0fc58267e6fb3 (patch)
treeb6375211efcd355c8a00690c56f2ffab40aa3c17 /qpid/java/broker-plugins/access-control/src/test
parent8daa35c9f6fc4f4e8f18e7fa5dafb2cd0a6c3460 (diff)
downloadqpid-python-8735514651a4873dc0b9b0ea4cf0fc58267e6fb3.tar.gz
QPID-4753: move ACL config from broker attribute to a top level entity
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1469937 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/broker-plugins/access-control/src/test')
-rw-r--r--qpid/java/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/plugins/DefaultAccessControlFactoryTest.java34
1 files changed, 11 insertions, 23 deletions
diff --git a/qpid/java/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/plugins/DefaultAccessControlFactoryTest.java b/qpid/java/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/plugins/DefaultAccessControlFactoryTest.java
index ca1f19098f..2c55652f04 100644
--- a/qpid/java/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/plugins/DefaultAccessControlFactoryTest.java
+++ b/qpid/java/broker-plugins/access-control/src/test/java/org/apache/qpid/server/security/access/plugins/DefaultAccessControlFactoryTest.java
@@ -6,7 +6,9 @@ import java.util.Map;
import java.util.regex.Pattern;
import org.apache.qpid.server.configuration.IllegalConfigurationException;
+import org.apache.qpid.server.model.GroupProvider;
import org.apache.qpid.server.security.AccessControl;
+import org.apache.qpid.server.security.access.FileAccessControlProviderConstants;
import org.apache.qpid.test.utils.QpidTestCase;
import org.apache.qpid.test.utils.TestFileUtils;
@@ -25,8 +27,10 @@ public class DefaultAccessControlFactoryTest extends QpidTestCase
File aclFile = TestFileUtils.createTempFile(this, ".acl", "ACL ALLOW all all");
DefaultAccessControlFactory factory = new DefaultAccessControlFactory();
Map<String, Object> attributes = new HashMap<String, Object>();
- attributes.put(DefaultAccessControlFactory.ATTRIBUTE_ACL_FILE, aclFile.getAbsolutePath());
+ attributes.put(GroupProvider.TYPE, FileAccessControlProviderConstants.ACL_FILE_PROVIDER_TYPE);
+ attributes.put(FileAccessControlProviderConstants.PATH, aclFile.getAbsolutePath());
AccessControl acl = factory.createInstance(attributes);
+ acl.open();
assertNotNull("ACL was not created from acl file: " + aclFile.getAbsolutePath(), acl);
}
@@ -37,33 +41,17 @@ public class DefaultAccessControlFactoryTest extends QpidTestCase
assertFalse("ACL file " + aclFile.getAbsolutePath() + " actually exists but should not", aclFile.exists());
DefaultAccessControlFactory factory = new DefaultAccessControlFactory();
Map<String, Object> attributes = new HashMap<String, Object>();
- attributes.put(DefaultAccessControlFactory.ATTRIBUTE_ACL_FILE, aclFile.getAbsolutePath());
+ attributes.put(GroupProvider.TYPE, FileAccessControlProviderConstants.ACL_FILE_PROVIDER_TYPE);
+ attributes.put(FileAccessControlProviderConstants.PATH, aclFile.getAbsolutePath());
try
{
- factory.createInstance(attributes);
- fail("It should not be possible to create ACL from non existing file");
+ AccessControl control = factory.createInstance(attributes);
+ control.open();
+ fail("It should not be possible to create and initialise ACL with non existing file");
}
catch (IllegalConfigurationException e)
{
- assertTrue("Unexpected exception message", Pattern.matches("ACL file '.*' is not found", e.getMessage()));
- }
- }
-
- public void testCreateInstanceWhenAclFileIsSpecifiedAsNonString()
- {
- DefaultAccessControlFactory factory = new DefaultAccessControlFactory();
- Map<String, Object> attributes = new HashMap<String, Object>();
- Integer aclFile = new Integer(0);
- attributes.put(DefaultAccessControlFactory.ATTRIBUTE_ACL_FILE, aclFile);
- try
- {
- factory.createInstance(attributes);
- fail("It should not be possible to create ACL from Integer");
- }
- catch (IllegalConfigurationException e)
- {
- assertEquals("Unexpected exception message", "Expected '" + DefaultAccessControlFactory.ATTRIBUTE_ACL_FILE
- + "' attribute value of type String but was " + Integer.class + ": " + aclFile, e.getMessage());
+ assertTrue("Unexpected exception message: " + e.getMessage(), Pattern.matches("ACL file '.*' is not found", e.getMessage()));
}
}
}