From b821efbe56fd4b44d2aa3c96f6e37f1f30ec4545 Mon Sep 17 00:00:00 2001 From: Ben Alex Date: Wed, 3 Nov 2004 23:52:27 +0000 Subject: [PATCH] Fix Catalina tests to be Maven compatible. --- .classpath | 1 + .../adapters/catalinaAdapterTest-invalid.xml | 38 ++++++++++++++ .../adapters/catalinaAdapterTest-valid.xml | 51 +++++++++++++++++++ .../catalina/CatalinaAcegiUserRealmTests.java | 23 ++++++--- 4 files changed, 105 insertions(+), 8 deletions(-) create mode 100644 adapters/catalina/src/main/resources/org/acegisecurity/adapters/catalinaAdapterTest-invalid.xml create mode 100644 adapters/catalina/src/main/resources/org/acegisecurity/adapters/catalinaAdapterTest-valid.xml diff --git a/.classpath b/.classpath index f86dde57e5..2e29f72c00 100644 --- a/.classpath +++ b/.classpath @@ -1,6 +1,7 @@ + diff --git a/adapters/catalina/src/main/resources/org/acegisecurity/adapters/catalinaAdapterTest-invalid.xml b/adapters/catalina/src/main/resources/org/acegisecurity/adapters/catalinaAdapterTest-invalid.xml new file mode 100644 index 0000000000..d2d53302fa --- /dev/null +++ b/adapters/catalina/src/main/resources/org/acegisecurity/adapters/catalinaAdapterTest-invalid.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + marissa=koala,ROLE_TELLER,ROLE_SUPERVISOR + dianne=emu,ROLE_TELLER + scott=wombat,ROLE_TELLER + peter=opal,disabled,ROLE_TELLER + + + + + + + diff --git a/adapters/catalina/src/main/resources/org/acegisecurity/adapters/catalinaAdapterTest-valid.xml b/adapters/catalina/src/main/resources/org/acegisecurity/adapters/catalinaAdapterTest-valid.xml new file mode 100644 index 0000000000..0c3ce24b6e --- /dev/null +++ b/adapters/catalina/src/main/resources/org/acegisecurity/adapters/catalinaAdapterTest-valid.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + marissa=koala,ROLE_TELLER,ROLE_SUPERVISOR + dianne=emu,ROLE_TELLER + scott=wombat,ROLE_TELLER + peter=opal,disabled,ROLE_TELLER + + + + + + + + true + + + + + + + + + + + + diff --git a/adapters/catalina/src/test/java/org/acegisecurity/adapters/catalina/CatalinaAcegiUserRealmTests.java b/adapters/catalina/src/test/java/org/acegisecurity/adapters/catalina/CatalinaAcegiUserRealmTests.java index 0877ac62b9..cc2d73282c 100644 --- a/adapters/catalina/src/test/java/org/acegisecurity/adapters/catalina/CatalinaAcegiUserRealmTests.java +++ b/adapters/catalina/src/test/java/org/acegisecurity/adapters/catalina/CatalinaAcegiUserRealmTests.java @@ -65,7 +65,7 @@ public class CatalinaAcegiUserRealmTests extends TestCase { throws Exception { try { CatalinaAcegiUserRealm adapter = makeAdapter( - "adaptertest-invalid.xml"); + "catalinaAdapterTest-invalid.xml"); fail("Should have thrown IllegalArgumentException"); } catch (IllegalArgumentException expected) { assertTrue(true); @@ -139,7 +139,8 @@ public class CatalinaAcegiUserRealmTests extends TestCase { } public void testAdapterStartsUpSuccess() throws Exception { - CatalinaAcegiUserRealm adapter = makeAdapter("adaptertest-valid.xml"); + CatalinaAcegiUserRealm adapter = makeAdapter( + "catalinaAdapterTest-valid.xml"); assertTrue(true); } @@ -156,19 +157,22 @@ public class CatalinaAcegiUserRealmTests extends TestCase { public void testAuthenticationFailsForIncorrectPassword() throws Exception { - CatalinaAcegiUserRealm adapter = makeAdapter("adaptertest-valid.xml"); + CatalinaAcegiUserRealm adapter = makeAdapter( + "catalinaAdapterTest-valid.xml"); assertEquals(null, adapter.authenticate("marissa", "kangaroo")); } public void testAuthenticationFailsForIncorrectUserName() throws Exception { - CatalinaAcegiUserRealm adapter = makeAdapter("adaptertest-valid.xml"); + CatalinaAcegiUserRealm adapter = makeAdapter( + "catalinaAdapterTest-valid.xml"); assertEquals(null, adapter.authenticate("melissa", "koala")); } public void testAuthenticationUsingByteArrayForCredentials() throws Exception { - CatalinaAcegiUserRealm adapter = makeAdapter("adaptertest-valid.xml"); + CatalinaAcegiUserRealm adapter = makeAdapter( + "catalinaAdapterTest-valid.xml"); byte[] credentials = {'k', 'o', 'a', 'l', 'a'}; Principal result = adapter.authenticate("marissa", credentials); @@ -188,7 +192,8 @@ public class CatalinaAcegiUserRealmTests extends TestCase { public void testAuthenticationUsingStringForCredentials() throws Exception { - CatalinaAcegiUserRealm adapter = makeAdapter("adaptertest-valid.xml"); + CatalinaAcegiUserRealm adapter = makeAdapter( + "catalinaAdapterTest-valid.xml"); Principal result = adapter.authenticate("marissa", "koala"); if (!(result instanceof PrincipalAcegiUserToken)) { @@ -207,13 +212,15 @@ public class CatalinaAcegiUserRealmTests extends TestCase { public void testAuthenticationWithNullPasswordHandledGracefully() throws Exception { - CatalinaAcegiUserRealm adapter = makeAdapter("adaptertest-valid.xml"); + CatalinaAcegiUserRealm adapter = makeAdapter( + "catalinaAdapterTest-valid.xml"); assertEquals(null, adapter.authenticate("marissa", (String) null)); } public void testAuthenticationWithNullUserNameHandledGracefully() throws Exception { - CatalinaAcegiUserRealm adapter = makeAdapter("adaptertest-valid.xml"); + CatalinaAcegiUserRealm adapter = makeAdapter( + "catalinaAdapterTest-valid.xml"); assertEquals(null, adapter.authenticate(null, "koala")); }