The testcase now sets the system properties so that they don't need to be set by maven

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@386090 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2006-03-15 15:11:48 +00:00
parent 9c19776c17
commit 15023df29b
2 changed files with 14 additions and 9 deletions

View File

@ -43,12 +43,6 @@
<includes>
<include implementation="java.lang.String">**/*Test.*</include>
</includes>
<systemProperties>
<property>
<name>java.security.auth.login.config</name>
<value>${basedir}/src/test/resources/login.config</value>
</property>
</systemProperties>
</configuration>
</plugin>

View File

@ -17,6 +17,8 @@
package org.apache.activemq.jaas;
import java.io.IOException;
import java.net.URL;
import javax.security.auth.Subject;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
@ -27,9 +29,6 @@ import javax.security.auth.login.FailedLoginException;
import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;
import org.apache.activemq.jaas.GroupPrincipal;
import org.apache.activemq.jaas.UserPrincipal;
import junit.framework.TestCase;
@ -37,6 +36,18 @@ import junit.framework.TestCase;
* @version $Rev: $ $Date: $
*/
public class PropertiesLoginModuleTest extends TestCase {
static {
String path = System.getProperty("java.security.auth.login.config");
if (path == null) {
URL resource = PropertiesLoginModuleTest.class.getClassLoader().getResource("login.config");
if (resource != null) {
path = resource.getFile();
System.setProperty("java.security.auth.login.config", path);
}
}
System.out.println("Path to login config: " + path);
}
public void testLogin() throws LoginException {
LoginContext context = new LoginContext("PropertiesLogin", new CallbackHandler() {