let the test find its login.config

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1164507 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2011-09-02 12:33:13 +00:00
parent 5ac1540c63
commit 937d5dd0c4
1 changed files with 18 additions and 1 deletions

View File

@ -23,6 +23,8 @@ import org.apache.directory.server.ldap.LdapServer;
import org.apache.directory.server.annotations.CreateLdapServer; import org.apache.directory.server.annotations.CreateLdapServer;
import org.apache.directory.server.annotations.CreateTransport; import org.apache.directory.server.annotations.CreateTransport;
import org.apache.directory.server.core.annotations.ApplyLdifFiles; import org.apache.directory.server.core.annotations.ApplyLdifFiles;
import org.junit.After;
import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@ -55,7 +57,22 @@ public class LDAPLoginModuleTest extends AbstractLdapTestUnit {
private static final String PRINCIPAL = "uid=admin,ou=system"; private static final String PRINCIPAL = "uid=admin,ou=system";
private static final String CREDENTIALS = "secret"; 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") @SuppressWarnings("unchecked")
@Test @Test
public void testRunning() throws Exception { public void testRunning() throws Exception {