|
@@ -1,4 +1,4 @@
|
|
-/* Copyright 2004 Acegi Technology Pty Limited
|
|
|
|
|
|
+/* Copyright 2004, 2005 Acegi Technology Pty Limited
|
|
*
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* you may not use this file except in compliance with the License.
|
|
@@ -19,6 +19,8 @@ import junit.framework.TestCase;
|
|
|
|
|
|
import net.sf.acegisecurity.providers.dao.UsernameNotFoundException;
|
|
import net.sf.acegisecurity.providers.dao.UsernameNotFoundException;
|
|
|
|
|
|
|
|
+import java.util.Properties;
|
|
|
|
+
|
|
|
|
|
|
/**
|
|
/**
|
|
* Tests {@link InMemoryDaoImpl}.
|
|
* Tests {@link InMemoryDaoImpl}.
|
|
@@ -68,7 +70,7 @@ public class InMemoryDaoTests extends TestCase {
|
|
assertEquals("wombat", dao.loadUserByUsername("scott").getPassword());
|
|
assertEquals("wombat", dao.loadUserByUsername("scott").getPassword());
|
|
}
|
|
}
|
|
|
|
|
|
- public void testLookupSuccessWithMixedeCase() throws Exception {
|
|
|
|
|
|
+ public void testLookupSuccessWithMixedCase() throws Exception {
|
|
InMemoryDaoImpl dao = new InMemoryDaoImpl();
|
|
InMemoryDaoImpl dao = new InMemoryDaoImpl();
|
|
dao.setUserMap(makeUserMap());
|
|
dao.setUserMap(makeUserMap());
|
|
dao.afterPropertiesSet();
|
|
dao.afterPropertiesSet();
|
|
@@ -106,6 +108,16 @@ public class InMemoryDaoTests extends TestCase {
|
|
assertEquals(2, dao.getUserMap().getUserCount());
|
|
assertEquals(2, dao.getUserMap().getUserCount());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public void testUseOfExternalPropertiesObject() throws Exception {
|
|
|
|
+ InMemoryDaoImpl dao = new InMemoryDaoImpl();
|
|
|
|
+ Properties props = new Properties();
|
|
|
|
+ props.put("marissa", "koala,ROLE_ONE,ROLE_TWO,enabled");
|
|
|
|
+ props.put("scott", "wombat,ROLE_ONE,ROLE_TWO,enabled");
|
|
|
|
+ dao.setUserProperties(props);
|
|
|
|
+ assertEquals("koala", dao.loadUserByUsername("marissa").getPassword());
|
|
|
|
+ assertEquals("wombat", dao.loadUserByUsername("scott").getPassword());
|
|
|
|
+ }
|
|
|
|
+
|
|
private UserMap makeUserMap() {
|
|
private UserMap makeUserMap() {
|
|
UserMapEditor editor = new UserMapEditor();
|
|
UserMapEditor editor = new UserMapEditor();
|
|
editor.setAsText(
|
|
editor.setAsText(
|