Author: kien_nguyen
Date: 2011-09-05 02:56:49 -0400 (Mon, 05 Sep 2011)
New Revision: 7296
Modified:
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserDAOImpl.java
portal/trunk/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganizationService.java
Log:
GTNPORTAL-2036 Cant search username and email in user and group management
Modified:
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserDAOImpl.java
===================================================================
---
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserDAOImpl.java 2011-09-02
22:12:24 UTC (rev 7295)
+++
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserDAOImpl.java 2011-09-05
06:56:49 UTC (rev 7296)
@@ -440,21 +440,6 @@
}
}, 1);
}
- else
- {
- return new LazyPageList<User>( new ListAccess<User>()
- {
- public User[] load(int index, int length) throws Exception,
IllegalArgumentException
- {
- return new User[0];
- }
-
- public int getSize() throws Exception
- {
- return 0;
- }
- }, 1);
- }
}
Modified:
portal/trunk/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganizationService.java
===================================================================
---
portal/trunk/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganizationService.java 2011-09-02
22:12:24 UTC (rev 7295)
+++
portal/trunk/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganizationService.java 2011-09-05
06:56:49 UTC (rev 7296)
@@ -249,7 +249,55 @@
}
}
- //
+ public void testFindUsers() throws Exception
+ {
+ if (userHandler_ instanceof UserDAOImpl)
+ {
+ UserDAOImpl ud = (UserDAOImpl)userHandler_;
+ User user1 = ud.createUserInstance("foo");
+ user1.setFirstName("foo");
+ user1.setLastName("bar");
+ user1.setEmail("foo(a)bar.com");
+ ud.createUser(user1, true);
+
+ User user2 = ud.createUserInstance("foobar");
+ user2.setFirstName("foobar");
+ user2.setLastName("foobar");
+ user2.setEmail("foobar(a)foobar.com");
+ ud.createUser(user2, true);
+
+ Query query = new Query();
+ List<User> users = ud.findUsers(query).getAll();
+ assertEquals(3, users.size());
+ assertEquals("demo", users.get(0).getUserName());
+ assertEquals("foo", users.get(1).getUserName());
+ assertEquals("foobar", users.get(2).getUserName());
+
+ query.setEmail("*foo*");
+ users = ud.findUsers(query).getAll();
+ assertEquals(2, users.size());
+ assertEquals("foo", users.get(0).getUserName());
+ assertEquals("foobar", users.get(1).getUserName());
+
+ query.setEmail("*bar*");
+ users = ud.findUsers(query).getAll();
+ assertEquals(2, users.size());
+ assertEquals("foo", users.get(0).getUserName());
+ assertEquals("foobar", users.get(1).getUserName());
+
+ query.setEmail("*bar.com*");
+ users = ud.findUsers(query).getAll();
+ assertEquals(2, users.size());
+ assertEquals("foo", users.get(0).getUserName());
+ assertEquals("foobar", users.get(1).getUserName());
+
+ query.setEmail("*foobar*");
+ users = ud.findUsers(query).getAll();
+ assertEquals(1, users.size());
+ assertEquals("foobar", users.get(0).getUserName());
+ }
+ }
+ //
public void testGroup() throws Exception
{
/* Create a parent group with name is: GroupParent */