activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r1164507 - /activemq/trunk/activemq-jaas/src/test/java/org/apache/activemq/jaas/LDAPLoginModuleTest.java
Date Fri, 02 Sep 2011 12:33:14 GMT
Author: gtully
Date: Fri Sep  2 12:33:13 2011
New Revision: 1164507

URL: http://svn.apache.org/viewvc?rev=1164507&view=rev
Log:
let the test find its login.config

Modified:
    activemq/trunk/activemq-jaas/src/test/java/org/apache/activemq/jaas/LDAPLoginModuleTest.java

Modified: activemq/trunk/activemq-jaas/src/test/java/org/apache/activemq/jaas/LDAPLoginModuleTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-jaas/src/test/java/org/apache/activemq/jaas/LDAPLoginModuleTest.java?rev=1164507&r1=1164506&r2=1164507&view=diff
==============================================================================
--- activemq/trunk/activemq-jaas/src/test/java/org/apache/activemq/jaas/LDAPLoginModuleTest.java
(original)
+++ activemq/trunk/activemq-jaas/src/test/java/org/apache/activemq/jaas/LDAPLoginModuleTest.java
Fri Sep  2 12:33:13 2011
@@ -23,6 +23,8 @@ import org.apache.directory.server.ldap.
 import org.apache.directory.server.annotations.CreateLdapServer;
 import org.apache.directory.server.annotations.CreateTransport;
 import org.apache.directory.server.core.annotations.ApplyLdifFiles;
+import org.junit.After;
+import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -55,7 +57,22 @@ public class LDAPLoginModuleTest extends
     
     private static final String PRINCIPAL = "uid=admin,ou=system";
     private static final String CREDENTIALS = "secret";
-    
+
+    private final String loginConfigSysPropName = "java.security.auth.login.config";
+    private String oldLoginConfig;
+    @Before
+    public void setLoginConfigSysProperty() {
+        oldLoginConfig = System.getProperty(loginConfigSysPropName, null);
+        System.setProperty(loginConfigSysPropName, "src/test/resources/login.config");
+    }
+
+    @After
+    public void resetLoginConfigSysProperty() {
+        if (oldLoginConfig != null) {
+            System.setProperty(loginConfigSysPropName, oldLoginConfig);
+        }
+    }
+
     @SuppressWarnings("unchecked")
     @Test
     public void testRunning() throws Exception {



Mime
View raw message