summaryrefslogtreecommitdiff
path: root/java/broker
diff options
context:
space:
mode:
authorRobert Gemmell <robbie@apache.org>2012-04-18 16:02:35 +0000
committerRobert Gemmell <robbie@apache.org>2012-04-18 16:02:35 +0000
commit2c1d2fbe4ba590266a9222441c2545ea3f4039ee (patch)
tree2fe742ee0e1a87bfc7f94e7713ab02a5d6634869 /java/broker
parent4db0caf2ea9a3ab72a3b36c828de42423a016854 (diff)
downloadqpid-python-2c1d2fbe4ba590266a9222441c2545ea3f4039ee.tar.gz
QPID-3959: ensure the test creates/removes its own ApplicationRegistry with a null AuthenticationManager.
Applied patch from Andrew MacBean <andymacbean@gmail.com> git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1327556 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/broker')
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/security/auth/rmi/RMIPasswordAuthenticatorTest.java24
1 files changed, 22 insertions, 2 deletions
diff --git a/java/broker/src/test/java/org/apache/qpid/server/security/auth/rmi/RMIPasswordAuthenticatorTest.java b/java/broker/src/test/java/org/apache/qpid/server/security/auth/rmi/RMIPasswordAuthenticatorTest.java
index 0e2437978c..bef03057ec 100644
--- a/java/broker/src/test/java/org/apache/qpid/server/security/auth/rmi/RMIPasswordAuthenticatorTest.java
+++ b/java/broker/src/test/java/org/apache/qpid/server/security/auth/rmi/RMIPasswordAuthenticatorTest.java
@@ -22,10 +22,15 @@ package org.apache.qpid.server.security.auth.rmi;
import junit.framework.TestCase;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.XMLConfiguration;
+import org.apache.qpid.server.configuration.ServerConfiguration;
import org.apache.qpid.server.configuration.plugins.ConfigurationPlugin;
+import org.apache.qpid.server.registry.ApplicationRegistry;
import org.apache.qpid.server.security.auth.AuthenticationResult;
import org.apache.qpid.server.security.auth.AuthenticationResult.AuthenticationStatus;
import org.apache.qpid.server.security.auth.manager.AuthenticationManager;
+import org.apache.qpid.server.util.TestApplicationRegistry;
import javax.management.remote.JMXPrincipal;
import javax.security.auth.Subject;
@@ -48,7 +53,7 @@ public class RMIPasswordAuthenticatorTest extends TestCase
protected void setUp() throws Exception
{
_rmipa = new RMIPasswordAuthenticator();
-
+
_credentials = new String[] {USERNAME, PASSWORD};
}
@@ -115,8 +120,19 @@ public class RMIPasswordAuthenticatorTest extends TestCase
/**
* Tests case where authentication manager is not set.
*/
- public void testNullAuthenticationManager()
+ public void testNullAuthenticationManager() throws Exception
{
+ ServerConfiguration serverConfig = new ServerConfiguration(new XMLConfiguration());
+ TestApplicationRegistry reg = new TestApplicationRegistry(serverConfig)
+ {
+ @Override
+ protected AuthenticationManager createAuthenticationManager() throws ConfigurationException
+ {
+ return null;
+ }
+ };
+ ApplicationRegistry.initialise(reg);
+
try
{
_rmipa.authenticate(_credentials);
@@ -127,6 +143,10 @@ public class RMIPasswordAuthenticatorTest extends TestCase
assertEquals("Unexpected exception message",
RMIPasswordAuthenticator.UNABLE_TO_LOOKUP, se.getMessage());
}
+ finally
+ {
+ ApplicationRegistry.remove();
+ }
}
/**