Fix Catalina tests to be Maven compatible.
This commit is contained in:
parent
74452a0a0a
commit
b821efbe56
|
@ -1,6 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="samples/attributes/src/main/java"/>
|
<classpathentry kind="src" path="samples/attributes/src/main/java"/>
|
||||||
|
<classpathentry kind="src" path="adapters/catalina/src/main/resources"/>
|
||||||
<classpathentry kind="src" path="adapters/cas/src/test/resources"/>
|
<classpathentry kind="src" path="adapters/cas/src/test/resources"/>
|
||||||
<classpathentry kind="src" path="adapters/cas/src/main/resources"/>
|
<classpathentry kind="src" path="adapters/cas/src/main/resources"/>
|
||||||
<classpathentry kind="src" path="core/src/main/resources"/>
|
<classpathentry kind="src" path="core/src/main/resources"/>
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
||||||
|
<!--
|
||||||
|
* Copyright 2004 Acegi Technology Pty Limited
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
-->
|
||||||
|
|
||||||
|
<beans>
|
||||||
|
|
||||||
|
<!-- Data access object which stores authentication information -->
|
||||||
|
<bean id="inMemoryDaoImpl" class="net.sf.acegisecurity.providers.dao.memory.InMemoryDaoImpl">
|
||||||
|
<property name="userMap">
|
||||||
|
<value>
|
||||||
|
marissa=koala,ROLE_TELLER,ROLE_SUPERVISOR
|
||||||
|
dianne=emu,ROLE_TELLER
|
||||||
|
scott=wombat,ROLE_TELLER
|
||||||
|
peter=opal,disabled,ROLE_TELLER
|
||||||
|
</value>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<!-- The authentication manager is deliberately missing in order to test error detection -->
|
||||||
|
|
||||||
|
</beans>
|
|
@ -0,0 +1,51 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
||||||
|
<!--
|
||||||
|
* Copyright 2004 Acegi Technology Pty Limited
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
-->
|
||||||
|
|
||||||
|
<beans>
|
||||||
|
|
||||||
|
<!-- Data access object which stores authentication information -->
|
||||||
|
<bean id="inMemoryDaoImpl" class="net.sf.acegisecurity.providers.dao.memory.InMemoryDaoImpl">
|
||||||
|
<property name="userMap">
|
||||||
|
<value>
|
||||||
|
marissa=koala,ROLE_TELLER,ROLE_SUPERVISOR
|
||||||
|
dianne=emu,ROLE_TELLER
|
||||||
|
scott=wombat,ROLE_TELLER
|
||||||
|
peter=opal,disabled,ROLE_TELLER
|
||||||
|
</value>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<!-- Authentication provider that queries our data access object -->
|
||||||
|
<bean id="daoAuthenticationProvider" class="net.sf.acegisecurity.providers.dao.DaoAuthenticationProvider">
|
||||||
|
<property name="authenticationDao"><ref bean="inMemoryDaoImpl"/></property>
|
||||||
|
<property name="forcePrincipalAsString"><value>true</value></property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<!-- The authentication manager that iterates through our only authentication provider -->
|
||||||
|
<bean id="authenticationManager" class="net.sf.acegisecurity.providers.ProviderManager">
|
||||||
|
<property name="providers">
|
||||||
|
<list>
|
||||||
|
<ref bean="daoAuthenticationProvider"/>
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
</beans>
|
|
@ -65,7 +65,7 @@ public class CatalinaAcegiUserRealmTests extends TestCase {
|
||||||
throws Exception {
|
throws Exception {
|
||||||
try {
|
try {
|
||||||
CatalinaAcegiUserRealm adapter = makeAdapter(
|
CatalinaAcegiUserRealm adapter = makeAdapter(
|
||||||
"adaptertest-invalid.xml");
|
"catalinaAdapterTest-invalid.xml");
|
||||||
fail("Should have thrown IllegalArgumentException");
|
fail("Should have thrown IllegalArgumentException");
|
||||||
} catch (IllegalArgumentException expected) {
|
} catch (IllegalArgumentException expected) {
|
||||||
assertTrue(true);
|
assertTrue(true);
|
||||||
|
@ -139,7 +139,8 @@ public class CatalinaAcegiUserRealmTests extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAdapterStartsUpSuccess() throws Exception {
|
public void testAdapterStartsUpSuccess() throws Exception {
|
||||||
CatalinaAcegiUserRealm adapter = makeAdapter("adaptertest-valid.xml");
|
CatalinaAcegiUserRealm adapter = makeAdapter(
|
||||||
|
"catalinaAdapterTest-valid.xml");
|
||||||
assertTrue(true);
|
assertTrue(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,19 +157,22 @@ public class CatalinaAcegiUserRealmTests extends TestCase {
|
||||||
|
|
||||||
public void testAuthenticationFailsForIncorrectPassword()
|
public void testAuthenticationFailsForIncorrectPassword()
|
||||||
throws Exception {
|
throws Exception {
|
||||||
CatalinaAcegiUserRealm adapter = makeAdapter("adaptertest-valid.xml");
|
CatalinaAcegiUserRealm adapter = makeAdapter(
|
||||||
|
"catalinaAdapterTest-valid.xml");
|
||||||
assertEquals(null, adapter.authenticate("marissa", "kangaroo"));
|
assertEquals(null, adapter.authenticate("marissa", "kangaroo"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAuthenticationFailsForIncorrectUserName()
|
public void testAuthenticationFailsForIncorrectUserName()
|
||||||
throws Exception {
|
throws Exception {
|
||||||
CatalinaAcegiUserRealm adapter = makeAdapter("adaptertest-valid.xml");
|
CatalinaAcegiUserRealm adapter = makeAdapter(
|
||||||
|
"catalinaAdapterTest-valid.xml");
|
||||||
assertEquals(null, adapter.authenticate("melissa", "koala"));
|
assertEquals(null, adapter.authenticate("melissa", "koala"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAuthenticationUsingByteArrayForCredentials()
|
public void testAuthenticationUsingByteArrayForCredentials()
|
||||||
throws Exception {
|
throws Exception {
|
||||||
CatalinaAcegiUserRealm adapter = makeAdapter("adaptertest-valid.xml");
|
CatalinaAcegiUserRealm adapter = makeAdapter(
|
||||||
|
"catalinaAdapterTest-valid.xml");
|
||||||
byte[] credentials = {'k', 'o', 'a', 'l', 'a'};
|
byte[] credentials = {'k', 'o', 'a', 'l', 'a'};
|
||||||
Principal result = adapter.authenticate("marissa", credentials);
|
Principal result = adapter.authenticate("marissa", credentials);
|
||||||
|
|
||||||
|
@ -188,7 +192,8 @@ public class CatalinaAcegiUserRealmTests extends TestCase {
|
||||||
|
|
||||||
public void testAuthenticationUsingStringForCredentials()
|
public void testAuthenticationUsingStringForCredentials()
|
||||||
throws Exception {
|
throws Exception {
|
||||||
CatalinaAcegiUserRealm adapter = makeAdapter("adaptertest-valid.xml");
|
CatalinaAcegiUserRealm adapter = makeAdapter(
|
||||||
|
"catalinaAdapterTest-valid.xml");
|
||||||
Principal result = adapter.authenticate("marissa", "koala");
|
Principal result = adapter.authenticate("marissa", "koala");
|
||||||
|
|
||||||
if (!(result instanceof PrincipalAcegiUserToken)) {
|
if (!(result instanceof PrincipalAcegiUserToken)) {
|
||||||
|
@ -207,13 +212,15 @@ public class CatalinaAcegiUserRealmTests extends TestCase {
|
||||||
|
|
||||||
public void testAuthenticationWithNullPasswordHandledGracefully()
|
public void testAuthenticationWithNullPasswordHandledGracefully()
|
||||||
throws Exception {
|
throws Exception {
|
||||||
CatalinaAcegiUserRealm adapter = makeAdapter("adaptertest-valid.xml");
|
CatalinaAcegiUserRealm adapter = makeAdapter(
|
||||||
|
"catalinaAdapterTest-valid.xml");
|
||||||
assertEquals(null, adapter.authenticate("marissa", (String) null));
|
assertEquals(null, adapter.authenticate("marissa", (String) null));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAuthenticationWithNullUserNameHandledGracefully()
|
public void testAuthenticationWithNullUserNameHandledGracefully()
|
||||||
throws Exception {
|
throws Exception {
|
||||||
CatalinaAcegiUserRealm adapter = makeAdapter("adaptertest-valid.xml");
|
CatalinaAcegiUserRealm adapter = makeAdapter(
|
||||||
|
"catalinaAdapterTest-valid.xml");
|
||||||
assertEquals(null, adapter.authenticate(null, "koala"));
|
assertEquals(null, adapter.authenticate(null, "koala"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue