[prev in list] [next in list] [prev in thread] [next in thread]
List: jboss-cvs-commits
Subject: [jboss-cvs] jboss-portal/core/src/main/org/jboss/portal/test/core ...
From: Julien Viet <julien () jboss ! com>
Date: 2005-08-31 23:27:17
Message-ID: E1EAbzB-0000Kd-0n () committer01 ! frg ! pub ! inap ! atl ! jboss ! com
[Download RAW message or body]
User: julien
Date: 05/08/31 19:27:17
Modified: core/src/main/org/jboss/portal/test/core Tag:
JBoss_Portal_Branch_2_0 ModelTestCase.java
RoleModelTestCase.java
Log:
fix for JBPORTAL-382 : user module findUsersFilteredByUsername does not work
Revision Changes Path
No revision
No revision
1.3.2.1 +8 -9 \
jboss-portal/core/src/main/org/jboss/portal/test/core/ModelTestCase.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ModelTestCase.java
===================================================================
RCS file: /cvsroot/jboss/jboss-portal/core/src/main/org/jboss/portal/test/core/ModelTestCase.java,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -u -b -r1.3 -r1.3.2.1
--- ModelTestCase.java 16 May 2005 00:46:02 -0000 1.3
+++ ModelTestCase.java 31 Aug 2005 23:27:16 -0000 1.3.2.1
@@ -29,7 +29,7 @@
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet </a>
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.3.2.1 $
*/
public abstract class ModelTestCase
extends TestCase
@@ -49,21 +49,20 @@
{
Configuration cfg = new Configuration();
- cfg
- .addResource("org/jboss/portal/core/impl/user/UserImpl.hbm.xml", \
Thread.currentThread()
- .getContextClassLoader());
- cfg.addResource("org/jboss/portal/core/impl/role/RoleImpl.hbm.xml", \
Thread.currentThread()
- .getContextClassLoader());
- cfg.addResource("mapping.hbm.xml", \
Thread.currentThread().getContextClassLoader()); + \
cfg.addResource("org/jboss/portal/core/impl/user/UserImpl.hbm.xml", \
Thread.currentThread().getContextClassLoader()); + \
cfg.addResource("org/jboss/portal/core/impl/user/UserPrefSet.hbm.xml", \
Thread.currentThread().getContextClassLoader()); + \
cfg.addResource("org/jboss/portal/core/impl/user/UserPref.hbm.xml", \
Thread.currentThread().getContextClassLoader()); + \
cfg.addResource("org/jboss/portal/core/impl/role/RoleImpl.hbm.xml", \
Thread.currentThread().getContextClassLoader()); +
Properties props = new Properties();
- props.setProperty("hibernate.dialect", \
"net.sf.hibernate.dialect.HSQLDialect"); + \
props.setProperty("hibernate.dialect", \
"org.hibernate.dialect.HSQLDialect");
props.setProperty("hibernate.connection.driver_class", \
"org.hsqldb.jdbcDriver");
props.setProperty("hibernate.connection.url", "jdbc:hsqldb:test");
props.setProperty("hibernate.connection.username", "sa");
props.setProperty("hibernate.connection.password", "");
props.setProperty("hibernate.connection.pool_size", "1");
- props.setProperty("hibernate.cache.provider_class", \
"net.sf.hibernate.cache.TreeCacheProvider"); + \
props.setProperty("hibernate.cache.provider_class", \
"org.hibernate.cache.HashtableCacheProvider"); cfg.setProperties(props);
//
1.1.2.1 +45 -1 \
jboss-portal/core/src/main/org/jboss/portal/test/core/RoleModelTestCase.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: RoleModelTestCase.java
===================================================================
RCS file: /cvsroot/jboss/jboss-portal/core/src/main/org/jboss/portal/test/core/RoleModelTestCase.java,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -b -r1.1 -r1.1.2.1
--- RoleModelTestCase.java 15 Jan 2005 22:11:23 -0000 1.1
+++ RoleModelTestCase.java 31 Aug 2005 23:27:16 -0000 1.1.2.1
@@ -21,7 +21,7 @@
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.1.2.1 $
*/
public class RoleModelTestCase
extends ModelTestCase
@@ -217,6 +217,50 @@
assertTrue(roleNames.contains(((Role) iterator.next()).getName()));
}
+ public void testFindUsingFilter() throws Exception
+ {
+ Set set1 = userModule.findUsersFilteredByUsername("user", 0, 10);
+ Set nameSet1 = new HashSet();
+ for (Iterator i = set1.iterator(); i.hasNext();)
+ {
+ User user = (User)i.next();
+ nameSet1.add(user.getUserName());
+ }
+ Set expectedNameSet1 = new HashSet();
+ expectedNameSet1.add("user1");
+ expectedNameSet1.add("user2");
+ assertEquals(expectedNameSet1, nameSet1);
+
+ //
+ Set set2 = userModule.findUsersFilteredByUsername("blah", 0, 10);
+ assertEquals(0, set2.size());
+
+ //
+ Set set3 = userModule.findUsersFilteredByUsername("", 0, 10);
+ Set nameSet3 = new HashSet();
+ for (Iterator i = set3.iterator(); i.hasNext();)
+ {
+ User user = (User)i.next();
+ nameSet3.add(user.getUserName());
+ }
+ Set expectedNameSet3 = new HashSet();
+ expectedNameSet3.add("user1");
+ expectedNameSet3.add("user2");
+ assertEquals(expectedNameSet3, nameSet3);
+
+ //
+ Set set4 = userModule.findUsersFilteredByUsername("user1", 0, 10);
+ Set nameSet4 = new HashSet();
+ for (Iterator i = set4.iterator(); i.hasNext();)
+ {
+ User user = (User)i.next();
+ nameSet4.add(user.getUserName());
+ }
+ Set expectedNameSet4 = new HashSet();
+ expectedNameSet4.add("user1");
+ assertEquals(expectedNameSet4, nameSet4);
+ }
+
protected void populate() throws Exception
{
User u1 = new UserImpl("user1");
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
jboss-cvs-commits mailing list
jboss-cvs-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-cvs-commits
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic