change AuthenticationProcessingFilter and SecurityEnforcementFilter to use Spring's WebApplicationContextUtils by defualt to find their config context.

This commit is contained in:
Colin Sampaleanu
2004-04-09 02:44:17 +00:00
parent 7bb4f14849
commit 6c26e79a0f
9 changed files with 185 additions and 66 deletions

View File

@@ -150,8 +150,7 @@ public class SecurityEnforcementFilterTests extends TestCase {
}
}
public void testStartupDetectsMissingAppContextLocation()
throws Exception {
public void testStartupDetectsMissingAppContext() throws Exception {
MockFilterConfig config = new MockFilterConfig();
config.setInitParmeter("loginFormUrl", "/login.jsp");
@@ -161,8 +160,7 @@ public class SecurityEnforcementFilterTests extends TestCase {
filter.init(config);
fail("Should have thrown ServletException");
} catch (ServletException expected) {
assertEquals("appContextLocation must be specified",
expected.getMessage());
assertTrue(expected.getMessage().startsWith("Error obtaining/creating ApplicationContext for config."));
}
config.setInitParmeter("appContextLocation", "");
@@ -171,8 +169,7 @@ public class SecurityEnforcementFilterTests extends TestCase {
filter.init(config);
fail("Should have thrown ServletException");
} catch (ServletException expected) {
assertEquals("appContextLocation must be specified",
expected.getMessage());
assertTrue(expected.getMessage().startsWith("Error obtaining/creating ApplicationContext for config."));
}
}

View File

@@ -287,8 +287,7 @@ public class AuthenticationProcessingFilterTests extends TestCase {
}
}
public void testStartupDetectsMissingAppContextLocation()
throws Exception {
public void testStartupDetectsMissingAppContext() throws Exception {
MockFilterConfig config = new MockFilterConfig();
config.setInitParmeter("defaultTargetUrl", "/");
config.setInitParmeter("authenticationFailureUrl", "/failed.jsp");
@@ -299,8 +298,7 @@ public class AuthenticationProcessingFilterTests extends TestCase {
filter.init(config);
fail("Should have thrown ServletException");
} catch (ServletException expected) {
assertEquals("appContextLocation must be specified",
expected.getMessage());
assertTrue(expected.getMessage().startsWith("Error obtaining/creating ApplicationContext for config."));
}
config.setInitParmeter("appContextLocation", "");
@@ -309,8 +307,7 @@ public class AuthenticationProcessingFilterTests extends TestCase {
filter.init(config);
fail("Should have thrown ServletException");
} catch (ServletException expected) {
assertEquals("appContextLocation must be specified",
expected.getMessage());
assertTrue(expected.getMessage().startsWith("Error obtaining/creating ApplicationContext for config."));
}
}