JBoss Portal SVN: r5847 - in trunk/identity: . src/main/org/jboss/portal/identity/db
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2006-12-13 11:06:20 -0500 (Wed, 13 Dec 2006)
New Revision: 5847
Modified:
trunk/identity/build.xml
trunk/identity/src/main/org/jboss/portal/identity/db/DBUserModuleImpl.java
Log:
cleanup and sync for previous commits
Modified: trunk/identity/build.xml
===================================================================
--- trunk/identity/build.xml 2006-12-13 15:59:34 UTC (rev 5846)
+++ trunk/identity/build.xml 2006-12-13 16:06:20 UTC (rev 5847)
@@ -334,7 +334,7 @@
<x-test>
- <test todir="${test.reports}" name="org.jboss.portal.test.identity.db.DBUserTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.identity.db_old.DBUserTestCase"/>
</x-test>
<x-classpath>
<pathelement location="${build.lib}/portal-identity-lib.jar"/>
@@ -401,6 +401,7 @@
<pathelement location="${build.resources}/hibernate"/>
+
<path refid="apache.commons.classpath"/>
<path refid="sun.opends.classpath"/>
<path refid="dom4j.dom4j.classpath"/>
@@ -444,11 +445,14 @@
<x-test>
+ <!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.db_old.DBUserTestCase"/>-->
+ <test todir="${test.reports}" name="org.jboss.portal.test.identity.db.DBIdentityTestCase"/>
+ <!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.UserProtoTestCase"/>-->
<!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.ConfigurationTestCase"/>-->
- <test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPSimpleUserModuleTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPSimpleRoleModuleTestCase"/>
+ <!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPSimpleUserModuleTestCase"/>-->
+ <!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPSimpleRoleModuleTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPStaticGroupMembershipModuleTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPStaticRoleMembershipModuleTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPStaticRoleMembershipModuleTestCase"/>-->
</x-test>
@@ -456,10 +460,15 @@
<pathelement location="${build.lib}/portal-identity-lib.jar"/>
<pathelement location="${build.lib}/portal-identity-test-lib.jar"/>
<pathelement location="${jboss.portal-test.root}/etc"/>
- <pathelement location="${jboss.portal-identity.root}/resources/test"/>
+ <!--<pathelement location="${jboss.portal-identity.root}/resources/test"/>-->
<pathelement location="${build.resources}/hibernate"/>
+ <pathelement location="${build.resources}"/>
+ <!--temp-->
+ <!--<pathelement location="/home/bdaw/Workshop/libs/mysql-connector-java-5.0.4/mysql-connector-java-5.0.4-bin.jar"/>-->
+
+ <path refid="beanshell.beanshell.classpath"/>
<path refid="apache.commons.classpath"/>
<path refid="sun.opends.classpath"/>
<path refid="dom4j.dom4j.classpath"/>
Modified: trunk/identity/src/main/org/jboss/portal/identity/db/DBUserModuleImpl.java
===================================================================
19 years, 7 months
JBoss Portal SVN: r5846 - trunk/jems/src/main/org/jboss/portal/jems/hibernate
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2006-12-13 10:59:34 -0500 (Wed, 13 Dec 2006)
New Revision: 5846
Modified:
trunk/jems/src/main/org/jboss/portal/jems/hibernate/SessionFactoryBinder.java
Log:
minor changes to enable some hacks in usage
Modified: trunk/jems/src/main/org/jboss/portal/jems/hibernate/SessionFactoryBinder.java
===================================================================
--- trunk/jems/src/main/org/jboss/portal/jems/hibernate/SessionFactoryBinder.java 2006-12-13 15:53:37 UTC (rev 5845)
+++ trunk/jems/src/main/org/jboss/portal/jems/hibernate/SessionFactoryBinder.java 2006-12-13 15:59:34 UTC (rev 5846)
@@ -86,7 +86,7 @@
private LoaderResource setupResource;
/** The hibernate configuration object. */
- private Configuration config;
+ protected Configuration config;
/**
*
19 years, 7 months
JBoss Portal SVN: r5845 - trunk/test/src/main/org/jboss/portal/test/framework/embedded
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2006-12-13 10:53:37 -0500 (Wed, 13 Dec 2006)
New Revision: 5845
Modified:
trunk/test/src/main/org/jboss/portal/test/framework/embedded/DSConfig.java
trunk/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java
trunk/test/src/main/org/jboss/portal/test/framework/embedded/HibernateSupport.java
Log:
minor changes to enable some hacks in usage
Modified: trunk/test/src/main/org/jboss/portal/test/framework/embedded/DSConfig.java
===================================================================
--- trunk/test/src/main/org/jboss/portal/test/framework/embedded/DSConfig.java 2006-12-13 15:52:20 UTC (rev 5844)
+++ trunk/test/src/main/org/jboss/portal/test/framework/embedded/DSConfig.java 2006-12-13 15:53:37 UTC (rev 5845)
@@ -98,13 +98,13 @@
public String toString()
{
- return new StringBuffer().append(name).
- append("-").
+ return new StringBuffer().//append(name).
+ //append("-").
append(description).
- append(";").
- append(host).
- append(":").
- append(port).
+ //append(";").
+ //append(host).
+ //append(":").
+ //append(port).
append("/").
append(configFile).
toString();
Modified: trunk/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java
===================================================================
--- trunk/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java 2006-12-13 15:52:20 UTC (rev 5844)
+++ trunk/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java 2006-12-13 15:53:37 UTC (rev 5845)
@@ -193,6 +193,11 @@
this.password = password;
}
+ public Config()
+ {
+
+ }
+
public String getName()
{
return name;
@@ -223,6 +228,32 @@
return "Datasource[" + name + "]";
}
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public void setConnectionURL(String connectionURL)
+ {
+ this.connectionURL = connectionURL;
+ }
+
+ public void setDriverClass(String driverClass)
+ {
+ this.driverClass = driverClass;
+ }
+
+ public void setUserName(String userName)
+ {
+ this.userName = userName;
+ }
+
+ public void setPassword(String password)
+ {
+ this.password = password;
+ }
+
public static MultiValuedTestParameterValue fromXML2(URL url) throws Exception
{
Config[] configs = fromXML(url);
Modified: trunk/test/src/main/org/jboss/portal/test/framework/embedded/HibernateSupport.java
===================================================================
19 years, 7 months
JBoss Portal SVN: r5844 - trunk/identity/src/resources/test/config
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2006-12-13 10:52:20 -0500 (Wed, 13 Dec 2006)
New Revision: 5844
Added:
trunk/identity/src/resources/test/config/standardidentity-config.xml
Log:
missing file in previous commits
Added: trunk/identity/src/resources/test/config/standardidentity-config.xml
===================================================================
--- trunk/identity/src/resources/test/config/standardidentity-config.xml 2006-12-13 15:51:20 UTC (rev 5843)
+++ trunk/identity/src/resources/test/config/standardidentity-config.xml 2006-12-13 15:52:20 UTC (rev 5844)
@@ -0,0 +1,479 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<identity-configuration>
+ <datasources>
+ <datasource>
+ <name>LDAP</name>
+ <!--name of service and class for creating mbean-->
+ <service-name>portal:service=Module,type=LDAPConnectionContext</service-name>
+ <class>org.jboss.portal.identity2.ldap.LDAPConnectionContext</class>
+ <config>
+ <option>
+ <name>host</name>
+ <value>jboss.com</value>
+ </option>
+ <option>
+ <name>port</name>
+ <value>389</value>
+ </option>
+ <option>
+ <name>contextFactory</name>
+ <value>com.sun.jndi.ldap.LdapCtxFactory</value>
+ </option>
+ <option>
+ <name>adminDN</name>
+ <value>cn=Directory Manager</value>
+ </option>
+ <option>
+ <name>adminPassword</name>
+ <value>password</value>
+ </option>
+ <option>
+ <name>jndiName</name>
+ <value>java:/portal/LDAPConnectionContext</value>
+ </option>
+ </config>
+ </datasource>
+ <datasource>
+ <name>DB</name>
+ <service-name>portal:service=Hibernate</service-name>
+ <class>org.jboss.portal.identity2.experimental.db.IdentitySessionFactoryBinder</class>
+ <config>
+ <option>
+ <name>doChecking</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>configLocation</name>
+ <value>hibernate-single.cfg.xml</value>
+ </option>
+ <!--<option>
+ <name>setupLocation</name>
+ <value>conf/hibernate/user/setup.txt</value>
+ </option>-->
+ <option>
+ <name>jNDIName</name>
+ <value>java:/portal/UserSessionFactory</value>
+ </option>
+ <option>
+ <name>profileConfigFile</name>
+ <value>profile-config.xml</value>
+ </option>
+ <option>
+ <name>mappingTemplateFile</name>
+ <value>domain-template.hbm.xml</value>
+ </option>
+ <option>
+ <name>mappingOutputFile</name>
+ <value>domain-identity.hbm.xml</value>
+ </option>
+ <option>
+ <name>mappingPattern</name>
+ <value><![CDATA[<property name="@name@" column="@column@" type="java.lang.String" update="true" insert="true" unique="false"/>]]></value>
+ </option>
+ </config>
+ </datasource>
+ </datasources>
+ <modules>
+ <module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>User</type>
+ <implementation>DB</implementation>
+
+ <!--name of service and class for creating mbean-->
+ <service-name>portal:service=Module,type=User</service-name>
+ <class>org.jboss.portal.identity2.db.HibernateUserModuleImpl</class>
+ <jndi-name>java:/portal/UserModule</jndi-name>
+
+ <!--set of options that are passed to a class constructor-->
+ <config>
+ <option>
+ <name>sessionFactoryJNDIName</name>
+ <value>java:/portal/IdentitySessionFactory</value>
+ </option>
+ <option>
+ <name>jndiName</name>
+ <value>java:/portal/UserModule</value>
+ </option>
+ </config>
+ </module>
+
+ <module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>Role</type>
+ <implementation>DB</implementation>
+
+ <!--name of service and class for creating mbean-->
+ <service-name>portal:service=Module,type=Role</service-name>
+ <class>org.jboss.portal.identity2.db.HibernateRoleModuleImpl</class>
+ <jndi-name>java:/portal/RoleModule</jndi-name>
+
+ <!--set of options that are passed to a class constructor-->
+ <config>
+ <option>
+ <name>sessionFactoryJNDIName</name>
+ <value>java:/portal/IdentitySessionFactory</value>
+ </option>
+ <option>
+ <name>jndiName</name>
+ <value>java:/portal/RoleModule</value>
+ </option>
+ </config>
+ </module>
+
+ <module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>Membership</type>
+ <implementation>DB</implementation>
+
+ <!--name of service and class for creating mbean-->
+ <service-name>portal:service=Module,type=Membership</service-name>
+ <class>org.jboss.portal.identity2.db.HibernateMembershipModuleImpl</class>
+ <jndi-name>java:/portal/MembershipModule</jndi-name>
+
+ <!--set of options that are passed to a class constructor-->
+ <config>
+ <option>
+ <name>sessionFactoryJNDIName</name>
+ <value>java:/portal/IdentitySessionFactory</value>
+ </option>
+ <option>
+ <name>jndiName</name>
+ <value>java:/portal/MembershipModule</value>
+ </option>
+ </config>
+ </module>
+
+ <module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>UserProfile</type>
+ <implementation>DB</implementation>
+
+ <!--name of service and class for creating mbean-->
+ <service-name>portal:service=Module,type=UserProfile</service-name>
+ <class>org.jboss.portal.identity2.db.HibernateUserProfileModuleImpl</class>
+ <jndi-name>java:/portal/UserProfileModule</jndi-name>
+
+ <!--set of options that are passed to a class constructor-->
+ <config>
+ <option>
+ <name>sessionFactoryJNDIName</name>
+ <value>java:/portal/IdentitySessionFactory</value>
+ </option>
+ <option>
+ <name>jndiName</name>
+ <value>java:/portal/UserProfileModule</value>
+ </option>
+ </config>
+ </module>
+
+ <!--for ldap modules...-->
+ <module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>User</type>
+ <implementation>LDAP</implementation>
+
+ <!--name of service and class for creating mbean-->
+ <service-name>portal:service=Module,type=User</service-name>
+ <class>org.jboss.portal.identity2.ldap.LDAPUserModuleImpl</class>
+ <jndi-name>java:/portal/UserModule</jndi-name>
+
+ <!--set of options that are passed to a class constructor-->
+ <config>
+ <option>
+ <name>jndiName</name>
+ <value>java:/portal/UserModule</value>
+ </option>
+ <option>
+ <name>connectionJNDIName</name>
+ <value>java:/portal/LDAPConnectionContext</value>
+ </option>
+ </config>
+ </module>
+
+ <module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>Role</type>
+ <implementation>LDAP</implementation>
+
+ <!--name of service and class for creating mbean-->
+ <service-name>portal:service=Module,type=Role</service-name>
+ <class>org.jboss.portal.identity2.ldap.LDAPRoleModuleImpl</class>
+ <jndi-name>java:/portal/RoleModule</jndi-name>
+
+ <!--set of options that are passed to a class constructor-->
+ <config>
+ <option>
+ <name>jndiName</name>
+ <value>java:/portal/RoleModule</value>
+ </option>
+ <option>
+ <name>connectionJNDIName</name>
+ <value>java:/portal/LDAPConnectionContext</value>
+ </option>
+ </config>
+ </module>
+
+ <module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>Membership</type>
+ <implementation>LDAP</implementation>
+
+ <!--name of service and class for creating mbean-->
+ <service-name>portal:service=Module,type=Membership</service-name>
+ <class>org.jboss.portal.identity2.ldap.LDAPStaticGroupMembershipModuleImpl</class>
+ <jndi-name>java:/portal/MembershipModule</jndi-name>
+
+ <!--set of options that are passed to a class constructor-->
+ <config>
+ <option>
+ <name>jndiName</name>
+ <value>java:/portal/MembershipModule</value>
+ </option>
+ <option>
+ <name>connectionJNDIName</name>
+ <value>java:/portal/LDAPConnectionContext</value>
+ </option>
+ </config>
+ </module>
+
+ <module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>UserProfile</type>
+ <implementation>LDAP</implementation>
+
+ <!--name of service and class for creating mbean-->
+ <service-name>portal:service=Module,type=UserProfile</service-name>
+ <class>org.jboss.portal.identity2.ldap.LDAPUserProfileModuleImpl</class>
+ <jndi-name>java:/portal/UserProfileModule</jndi-name>
+
+ <!--set of options that are passed to a class constructor-->
+ <config>
+ <!--<option>
+ <name>LDAPConnectionJNDIName</name>
+ <value>java:/portal/UserSessionFactory</value>
+ </option>-->
+ <!--Hibernate mappings for db level store (dynamic properties not mapped as ldap attributes)-->
+ <!--<option>
+ <name>SessionFactoryJNDIName</name>
+ <value>java:/portal/PropertyStoreSessionFactory</value>
+ </option>
+ <option>
+ <name>profileMappings</name>
+ <value>ldap-profile.xml</value>
+ </option>-->
+ <option>
+ <name>jndiName</name>
+ <value>java:/portal/UserProfileModule</value>
+ </option>
+ <option>
+ <name>connectionJNDIName</name>
+ <value>java:/portal/LDAPConnectionContext</value>
+ </option>
+ </config>
+ </module>
+
+ </modules>
+
+ <options>
+ <!--Common options section-->
+ <option-group>
+ <group-name>common</group-name>
+ <option>
+ <name>userContainerDN</name>
+ <value>ou=People,dc=example,dc=com</value>
+ </option>
+ <option>
+ <name>uidAttributeId</name>
+ <value>uid</value>
+ </option>
+ <option>
+ <name>passwordAttributeID</name>
+ <value>userPassword</value>
+ </option>
+ <option>
+ <name>hashAlgorithm</name>
+ <value>MD5</value>
+ </option>
+ <option>
+ <name>hashEncoding</name>
+ <value>hex</value>
+ </option>
+ <option>
+ <name>roleContainerDN</name>
+ <value>ou=Roles,dc=example,dc=com</value>
+ </option>
+ <option>
+ <name>ridAttributeId</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>roleDisplayNameAttributeID</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>membershipAttributeID</name>
+ <value>member</value>
+ </option>
+ <option>
+ <name>membershipAttributeIsDN</name>
+ <value>true</value>
+ </option>
+ </option-group>
+ <option-group>
+ <group-name>userCreateAttibutes</group-name>
+ <option>
+ <name>objectClass</name>
+ <value>top</value>
+ <value>uidObject</value>
+ <value>person</value>
+ <value>inetUser</value>
+ </option>
+ <!--Schema requires those to have initial value-->
+ <option>
+ <name>cn</name>
+ <value>none</value>
+ </option>
+ <option>
+ <name>sn</name>
+ <value>none</value>
+ </option>
+ </option-group>
+ <option-group>
+ <group-name>roleCreateAttibutes</group-name>
+ <option>
+ <name>objectClass</name>
+ <value>top</value>
+ <value>groupOfNames</value>
+ </option>
+ <!--Schema requires those to have initial value-->
+ <option>
+ <name>cn</name>
+ <value>none</value>
+ </option>
+ <!--Some directory servers require this attribute to be valid DN-->
+ <!--For safety reasons point to the admin user here-->
+ <option>
+ <name>member</name>
+ <value>uid=dummynonexistinguser,ou=People,dc=jboss,dc=org</value>
+ </option>
+ </option-group>
+ <option-group>
+ <group-name>userProfileMappings</group-name>
+ <option>
+ <name>portal.user.name.given</name>
+ <!--inetOrgPerson-->
+ <value>givenName</value>
+ </option>
+ <!--<option>
+ <name>portal.user.name.family</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.location</name>
+ <value></value>
+ </option>-->
+ <option>
+ <name>portal.user.occupation</name>
+ <!--inetOrgPerson-->
+ <value>title</value>
+ </option>
+ <!--<option>
+ <name>portal.user.extra</name>
+ <value></value>
+ </option>-->
+ <option>
+ <name>portal.user.signature</name>
+ <!--newPilotPerson-->
+ <value>personalSignature</value>
+ </option>
+ <!--<option>
+ <name>portal.user.interests</name>
+ <value></value>
+ </option>-->
+ <option>
+ <name>portal.user.locale</name>
+ <!--inetOrgPerson-->
+ <value>localityName</value><!--or prefferedLanguage-->
+ </option>
+ <!--<option>
+ <name>portal.user.im.icq</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.im.aim</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.im.msnm</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.im.yim</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.im.skype</name>
+ <value></value>
+ </option>-->
+ <option>
+ <name>portal.user.homepage</name>
+ <!--inetOrgPerson-->
+ <value>seeAlso</value>
+ </option>
+ <!--<option>
+ <name>portal.user.time-zone-offset</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.theme</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.security.question</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.security.answer</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.email.fake</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.email.view-real</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.last-login-date</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.registration-date</name>
+ <value></value>
+ </option>-->
+ </option-group>
+ </options>
+</identity-configuration>
\ No newline at end of file
19 years, 7 months
JBoss Portal SVN: r5843 - in trunk/identity/src/resources: . experimental
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2006-12-13 10:51:20 -0500 (Wed, 13 Dec 2006)
New Revision: 5843
Added:
trunk/identity/src/resources/experimental/
trunk/identity/src/resources/experimental/domain-proto.hbm.xml
trunk/identity/src/resources/experimental/domain-template.hbm.xml
Log:
abandoned mappings for dynamic-map implementation
Added: trunk/identity/src/resources/experimental/domain-proto.hbm.xml
===================================================================
--- trunk/identity/src/resources/experimental/domain-proto.hbm.xml 2006-12-13 15:49:59 UTC (rev 5842)
+++ trunk/identity/src/resources/experimental/domain-proto.hbm.xml 2006-12-13 15:51:20 UTC (rev 5843)
@@ -0,0 +1,128 @@
+<?xml version="1.0"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+<hibernate-mapping>
+ <class
+ entity-name="PortalUser">
+ <!--<cache usage="@portal.hibernate.cache.usage@"/>-->
+ <id
+ name="key"
+ column="jbp_uid"
+ type="java.lang.Long">
+ <generator class="native">
+ <param name="sequence">user_seq</param>
+ </generator>
+ </id>
+ <property
+ name="userName"
+ column="jbp_uname"
+ type="java.lang.String"
+ update="false"
+ insert="true"
+ unique="true"/>
+ <map
+ name="dynamic"
+ table="jbp_user_prop"
+ lazy="false"
+ sort="unsorted"
+ cascade="all">
+ <!--<cache usage="@portal.hibernate.cache.usage@"/>-->
+ <key column="jbp_uid"/>
+ <index
+ column="jbp_name"
+ type="java.lang.String"/>
+ <element
+ column="jbp_value"
+ type="java.lang.String"
+ not-null="false"
+ unique="false"/>
+ </map>
+ <!--@mappings@-->
+ <property
+ name="password"
+ column="jbp_password"
+ type="java.lang.String"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <set
+ name="roles"
+ table="jbp_role_membership"
+ lazy="false"
+ inverse="false"
+ cascade="none"
+ sort="unsorted">
+ <!--<cache usage="@portal.hibernate.cache.usage@"/>-->
+ <key column="jbp_uid"/>
+ <many-to-many
+ entity-name="PortalRole"
+ column="jbp_rid"
+ outer-join="true"/>
+ </set>
+ </class>
+ <class
+ entity-name="PortalRole"
+ table="jbp_roles">
+ <!--<cache usage="@portal.hibernate.cache.usage@"/>-->
+ <id
+ name="key"
+ column="jbp_rid"
+ type="java.lang.Long">
+ <generator class="native">
+ <param name="sequence">user_seq</param>
+ </generator>
+ </id>
+ <property
+ name="name"
+ column="jbp_name"
+ type="java.lang.String"
+ update="false"
+ insert="true"
+ unique="true"/>
+ <property
+ name="displayName"
+ column="jbp_displayname"
+ type="java.lang.String"
+ update="true"
+ insert="true"
+ unique="true"/>
+ <set
+ name="users"
+ table="jbp_role_membership"
+ lazy="true"
+ inverse="true"
+ cascade="none"
+ sort="unsorted">
+ <!--<cache usage="@portal.hibernate.cache.usage@"/>-->
+ <key column="jbp_rid"/>
+ <many-to-many
+ entity-name="PortalUser"
+ column="jbp_uid"
+ outer-join="false"/>
+ </set>
+ </class>
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/identity/src/resources/experimental/domain-template.hbm.xml
===================================================================
--- trunk/identity/src/resources/experimental/domain-template.hbm.xml 2006-12-13 15:49:59 UTC (rev 5842)
+++ trunk/identity/src/resources/experimental/domain-template.hbm.xml 2006-12-13 15:51:20 UTC (rev 5843)
@@ -0,0 +1,128 @@
+<?xml version="1.0"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+<hibernate-mapping>
+ <class
+ entity-name="PortalUser">
+ <cache usage="@portal.hibernate.cache.usage@"/>
+ <id
+ name="key"
+ column="jbp_uid"
+ type="java.lang.Long">
+ <generator class="native">
+ <param name="sequence">user_seq</param>
+ </generator>
+ </id>
+ <property
+ name="userName"
+ column="jbp_uname"
+ type="java.lang.String"
+ update="false"
+ insert="true"
+ unique="true"/>
+ <map
+ name="dynamic"
+ table="jbp_user_prop"
+ lazy="false"
+ sort="unsorted"
+ cascade="all">
+ <cache usage="@portal.hibernate.cache.usage@"/>
+ <key column="jbp_uid"/>
+ <index
+ column="jbp_name"
+ type="java.lang.String"/>
+ <element
+ column="jbp_value"
+ type="java.lang.String"
+ not-null="false"
+ unique="false"/>
+ </map>
+ @mappings@
+ <property
+ name="password"
+ column="jbp_password"
+ type="java.lang.String"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <set
+ name="roles"
+ table="jbp_role_membership"
+ lazy="false"
+ inverse="false"
+ cascade="none"
+ sort="unsorted">
+ <cache usage="@portal.hibernate.cache.usage@"/>
+ <key column="jbp_uid"/>
+ <many-to-many
+ entity-name="PortalRole"
+ column="jbp_rid"
+ outer-join="true"/>
+ </set>
+ </class>
+ <class
+ entity-name="PortalRole"
+ table="jbp_roles">
+ <cache usage="@portal.hibernate.cache.usage@"/>
+ <id
+ name="key"
+ column="jbp_rid"
+ type="java.lang.Long">
+ <generator class="native">
+ <param name="sequence">user_seq</param>
+ </generator>
+ </id>
+ <property
+ name="name"
+ column="jbp_name"
+ type="java.lang.String"
+ update="false"
+ insert="true"
+ unique="true"/>
+ <property
+ name="displayName"
+ column="jbp_displayname"
+ type="java.lang.String"
+ update="true"
+ insert="true"
+ unique="true"/>
+ <set
+ name="users"
+ table="jbp_role_membership"
+ lazy="true"
+ inverse="true"
+ cascade="none"
+ sort="unsorted">
+ <cache usage="@portal.hibernate.cache.usage@"/>
+ <key column="jbp_rid"/>
+ <many-to-many
+ entity-name="PortalUser"
+ column="jbp_uid"
+ outer-join="false"/>
+ </set>
+ </class>
+</hibernate-mapping>
\ No newline at end of file
19 years, 7 months
JBoss Portal SVN: r5841 - in trunk/identity/src/resources: hibernate portal-identity-test-jar/org/jboss/portal/test/identity test/config
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2006-12-13 10:49:11 -0500 (Wed, 13 Dec 2006)
New Revision: 5841
Added:
trunk/identity/src/resources/hibernate/domain-identity.hbm.xml
trunk/identity/src/resources/portal-identity-test-jar/org/jboss/portal/test/identity/db_old-beans.xml
trunk/identity/src/resources/portal-identity-test-jar/org/jboss/portal/test/identity/proto-beans.xml
trunk/identity/src/resources/test/config/db-config.xml
trunk/identity/src/resources/test/config/opends-config.xml
trunk/identity/src/resources/test/config/profile-config.xml
trunk/identity/src/resources/test/config/rhds-config.xml
Removed:
trunk/identity/src/resources/test/config/minimal-db-identity-config.xml
trunk/identity/src/resources/test/config/minimal-ldap-identity-config.xml
trunk/identity/src/resources/test/config/standardidentity-config.xml
Modified:
trunk/identity/src/resources/portal-identity-test-jar/org/jboss/portal/test/identity/db-beans.xml
trunk/identity/src/resources/portal-identity-test-jar/org/jboss/portal/test/identity/ldap-beans.xml
Log:
move test resources and configuration files
Added: trunk/identity/src/resources/hibernate/domain-identity.hbm.xml
===================================================================
--- trunk/identity/src/resources/hibernate/domain-identity.hbm.xml 2006-12-13 15:40:19 UTC (rev 5840)
+++ trunk/identity/src/resources/hibernate/domain-identity.hbm.xml 2006-12-13 15:49:11 UTC (rev 5841)
@@ -0,0 +1,177 @@
+<?xml version="1.0"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+<hibernate-mapping>
+ <class
+ name="org.jboss.portal.identity2.db.HibernateUserImpl"
+ table="jbp_users">
+ <!--<cache usage="@portal.hibernate.cache.usage@"/>-->
+ <id
+ name="key"
+ column="jbp_uid"
+ type="java.lang.Long">
+ <generator class="native">
+ <param name="sequence">user_seq</param>
+ </generator>
+ </id>
+ <property
+ name="userName"
+ column="jbp_uname"
+ type="java.lang.String"
+ update="false"
+ insert="true"
+ unique="true"/>
+ <map
+ name="dynamic"
+ table="jbp_user_prop"
+ lazy="false"
+ sort="unsorted"
+ cascade="all">
+ <!--<cache usage="@portal.hibernate.cache.usage@"/>-->
+ <key column="jbp_uid"/>
+ <index
+ column="jbp_name"
+ type="java.lang.String"/>
+ <element
+ column="jbp_value"
+ type="java.lang.String"
+ not-null="false"
+ unique="false"/>
+ </map>
+ <property
+ name="givenName"
+ column="jbp_givenname"
+ type="java.lang.String"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <property
+ name="familyName"
+ column="jbp_familyname"
+ type="java.lang.String"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <property
+ name="password"
+ column="jbp_password"
+ type="java.lang.String"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <property
+ name="realEmail"
+ column="jbp_realemail"
+ type="java.lang.String"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <property
+ name="fakeEmail"
+ column="jbp_fakeemail"
+ type="java.lang.String"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <property
+ name="registrationDate"
+ column="jbp_regdate"
+ type="java.util.Date"
+ update="false"
+ insert="true"
+ unique="false"/>
+ <property
+ name="viewRealEmail"
+ column="jbp_viewrealemail"
+ type="boolean"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <property
+ name="enabled"
+ column="jbp_enabled"
+ type="boolean"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <set
+ name="roles"
+ table="jbp_role_membership"
+ lazy="false"
+ inverse="false"
+ cascade="none"
+ sort="unsorted">
+ <!--<cache usage="@portal.hibernate.cache.usage@"/>-->
+ <key column="jbp_uid"/>
+ <many-to-many
+ class="org.jboss.portal.identity2.db.HibernateRoleImpl"
+ column="jbp_rid"
+ outer-join="true"/>
+ </set>
+ </class>
+ <class
+ name="org.jboss.portal.identity2.db.HibernateRoleImpl"
+ table="jbp_roles">
+ <!--<cache usage="@portal.hibernate.cache.usage@"/>-->
+ <id
+ name="key"
+ column="jbp_rid"
+ type="java.lang.Long">
+ <generator class="native">
+ <param name="sequence">user_seq</param>
+ </generator>
+ </id>
+ <property
+ name="name"
+ column="jbp_name"
+ type="java.lang.String"
+ update="false"
+ insert="true"
+ unique="true"/>
+ <property
+ name="displayName"
+ column="jbp_displayname"
+ type="java.lang.String"
+ update="true"
+ insert="true"
+ unique="true"/>
+ <set
+ name="users"
+ table="jbp_role_membership"
+ lazy="true"
+ inverse="true"
+ cascade="none"
+ sort="unsorted">
+ <!--<cache usage="@portal.hibernate.cache.usage@"/>-->
+ <key column="jbp_rid"/>
+ <many-to-many
+ class="org.jboss.portal.identity2.db.HibernateUserImpl"
+ column="jbp_uid"
+ outer-join="false"/>
+ </set>
+ </class>
+</hibernate-mapping>
\ No newline at end of file
Modified: trunk/identity/src/resources/portal-identity-test-jar/org/jboss/portal/test/identity/db-beans.xml
===================================================================
--- trunk/identity/src/resources/portal-identity-test-jar/org/jboss/portal/test/identity/db-beans.xml 2006-12-13 15:40:19 UTC (rev 5840)
+++ trunk/identity/src/resources/portal-identity-test-jar/org/jboss/portal/test/identity/db-beans.xml 2006-12-13 15:49:11 UTC (rev 5841)
@@ -58,21 +58,26 @@
</bean>
<bean name="HibernateSupport" class="org.jboss.portal.test.framework.embedded.HibernateSupport">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory"/>
+ <parameter>HibernateSupport</parameter>
+ </constructor>
<property name="config"><inject bean="HibernateConfig"/></property>
- <property name="jNDIName">java:/SessionFactory</property>
+ <property name="jNDIName">java:/portal/IdentitySessionFactory</property>
<property name="mappings">
<list elementClass="java.lang.String">
- <value>domain-single.hbm.xml</value>
+ <value>domain-identity.hbm.xml</value>
+ <!--<value>domain-single.hbm.xml</value>-->
</list>
</property>
</bean>
- <bean name="DBTestBean" class="org.jboss.portal.test.identity.db.DBUserTestCase">
+ <bean name="DBTestBean" class="org.jboss.portal.test.identity.db_old.DBUserTestCase">
<constructor factoryMethod="getBean">
<factory bean="BeanFactory"/>
<parameter>DBTestBean</parameter>
</constructor>
- <property name="hibernate"><inject bean="HibernateSupport"/></property>
+ <!--<property name="hibernate" class="org.jboss.portal.test.framework.embedded.HibernateSupport"><inject bean="HibernateSupport"/></property>-->
</bean>
</deployment>
Added: trunk/identity/src/resources/portal-identity-test-jar/org/jboss/portal/test/identity/db_old-beans.xml
===================================================================
--- trunk/identity/src/resources/portal-identity-test-jar/org/jboss/portal/test/identity/db_old-beans.xml 2006-12-13 15:40:19 UTC (rev 5840)
+++ trunk/identity/src/resources/portal-identity-test-jar/org/jboss/portal/test/identity/db_old-beans.xml 2006-12-13 15:49:11 UTC (rev 5841)
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
+ xmlns="urn:jboss:bean-deployer">
+
+ <bean name="DataSourceConfig" class="org.jboss.portal.test.framework.embedded.DataSourceSupport$Config">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory"/>
+ <parameter>DataSourceConfig</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="HibernateConfig" class="org.jboss.portal.test.framework.embedded.HibernateSupport$Config">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory"/>
+ <parameter>HibernateConfig</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="JNDISupport" class="org.jboss.portal.test.framework.embedded.JNDISupport">
+ </bean>
+
+ <bean name="TransactionManagerSupport" class="org.jboss.portal.test.framework.embedded.TransactionManagerSupport">
+ </bean>
+
+ <bean name="ConnectionManagerSupport" class="org.jboss.portal.test.framework.embedded.ConnectionManagerSupport">
+ <property name="transactionManager"><inject bean="TransactionManagerSupport" property="transactionManager"/></property>
+ </bean>
+
+ <bean name="DataSourceSupport" class="org.jboss.portal.test.framework.embedded.DataSourceSupport">
+ <property name="transactionManager"><inject bean="TransactionManagerSupport" property="transactionManager"/></property>
+ <property name="connectionManagerReference"><inject bean="ConnectionManagerSupport" property="connectionManagerReference"/></property>
+ <property name="config"><inject bean="DataSourceConfig"/></property>
+ </bean>
+
+ <bean name="HibernateSupport" class="org.jboss.portal.test.framework.embedded.HibernateSupport">
+ <property name="config"><inject bean="HibernateConfig"/></property>
+ <property name="jNDIName">java:/SessionFactory</property>
+ <property name="mappings">
+ <list elementClass="java.lang.String">
+ <value>domain-single.hbm.xml</value>
+ </list>
+ </property>
+ </bean>
+
+ <bean name="DBTestBean" class="org.jboss.portal.test.identity.db_old.DBUserTestCase">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory"/>
+ <parameter>DBTestBean</parameter>
+ </constructor>
+ <property name="hibernate"><inject bean="HibernateSupport"/></property>
+ </bean>
+
+</deployment>
Modified: trunk/identity/src/resources/portal-identity-test-jar/org/jboss/portal/test/identity/ldap-beans.xml
===================================================================
--- trunk/identity/src/resources/portal-identity-test-jar/org/jboss/portal/test/identity/ldap-beans.xml 2006-12-13 15:40:19 UTC (rev 5840)
+++ trunk/identity/src/resources/portal-identity-test-jar/org/jboss/portal/test/identity/ldap-beans.xml 2006-12-13 15:49:11 UTC (rev 5841)
@@ -27,18 +27,54 @@
xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
xmlns="urn:jboss:bean-deployer">
- <!--<bean name="ApacheDSService" class="org.jboss.portal.test.framework.embedded.apacheds.ApacheDSService">
- <constructor factoryMethod="getBean">
+ <bean name="JNDISupport" class="org.jboss.portal.test.framework.embedded.JNDISupport">
+ </bean>
+
+ <bean name="DataSourceConfig" class="org.jboss.portal.test.framework.embedded.DataSourceSupport$Config">
+ <!--<constructor factoryMethod="getBean">
<factory bean="BeanFactory"/>
- <parameter>ApacheDSServiceBean</parameter>
- </constructor>
- <property name="removeWorkingDir">true</property>
- </bean>-->
+ <parameter>DataSourceConfig</parameter>
+ </constructor>-->
+ <property name="name">dummy</property>
+ <property name="connectionURL">jdbc:mysql://localhost:3306/portal_test</property>
+ <property name="driverClass">org.gjt.mm.mysql.Driver</property>
+ <property name="userName">root</property>
+ <!--<property name="password"></property>-->
+ </bean>
+ <bean name="TransactionManagerSupport" class="org.jboss.portal.test.framework.embedded.TransactionManagerSupport">
+ </bean>
- <bean name="JNDISupport" class="org.jboss.portal.test.framework.embedded.JNDISupport">
+ <bean name="ConnectionManagerSupport" class="org.jboss.portal.test.framework.embedded.ConnectionManagerSupport">
+ <property name="transactionManager"><inject bean="TransactionManagerSupport" property="transactionManager"/></property>
</bean>
+ <bean name="DataSourceSupport" class="org.jboss.portal.test.framework.embedded.DataSourceSupport">
+ <property name="transactionManager"><inject bean="TransactionManagerSupport" property="transactionManager"/></property>
+ <property name="connectionManagerReference"><inject bean="ConnectionManagerSupport" property="connectionManagerReference"/></property>
+ <property name="config"><inject bean="DataSourceConfig"/></property>
+ </bean>
+
+ <!--<bean name="HibernateSupport" class="org.jboss.portal.test.framework.embedded.HibernateSupport">
+ <property name="jNDIName">java:/TestSessionFactory</property>
+ <property name="mappings">
+ <list elementClass="java.lang.String">
+ <value>domain-single.hbm.xml</value>
+ </list>
+ </property>
+ </bean>-->
+
+ <!--<bean name="HibernateSupport" class="org.jboss.portal.test.framework.embedded.HibernateSupport">
+ <property name="config"><inject bean="HibernateConfig"/></property>
+ <property name="jNDIName">java:/SessionFactory</property>
+ <property name="mappings">
+ <list elementClass="java.lang.String">
+ <value>domain-single.hbm.xml</value>
+ </list>
+ </property>
+ </bean>-->
+
+
<bean name="LDAPTestBean" class="org.jboss.portal.test.identity.ldap.LDAPUserTestCase">
<constructor factoryMethod="getBean">
<factory bean="BeanFactory"/>
Added: trunk/identity/src/resources/portal-identity-test-jar/org/jboss/portal/test/identity/proto-beans.xml
===================================================================
--- trunk/identity/src/resources/portal-identity-test-jar/org/jboss/portal/test/identity/proto-beans.xml 2006-12-13 15:40:19 UTC (rev 5840)
+++ trunk/identity/src/resources/portal-identity-test-jar/org/jboss/portal/test/identity/proto-beans.xml 2006-12-13 15:49:11 UTC (rev 5841)
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
+ xmlns="urn:jboss:bean-deployer">
+
+ <bean name="JNDISupport" class="org.jboss.portal.test.framework.embedded.JNDISupport">
+ </bean>
+
+ <bean name="DataSourceConfig" class="org.jboss.portal.test.framework.embedded.DataSourceSupport$Config">
+ <!--<constructor factoryMethod="getBean">
+ <factory bean="BeanFactory"/>
+ <parameter>DataSourceConfig</parameter>
+ </constructor>-->
+ <property name="name">dummy</property>
+ <property name="connectionURL">jdbc:mysql://localhost:3306/portal_test</property>
+ <property name="driverClass">org.gjt.mm.mysql.Driver</property>
+ <property name="userName">root</property>
+ <!--<property name="password"></property>-->
+ </bean>
+
+ <bean name="HibernateConfig" class="org.jboss.portal.test.framework.embedded.HibernateSupport$Config">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory"/>
+ <parameter>HibernateConfig</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="TransactionManagerSupport" class="org.jboss.portal.test.framework.embedded.TransactionManagerSupport">
+ </bean>
+
+ <bean name="ConnectionManagerSupport" class="org.jboss.portal.test.framework.embedded.ConnectionManagerSupport">
+ <property name="transactionManager"><inject bean="TransactionManagerSupport" property="transactionManager"/></property>
+ </bean>
+
+ <bean name="DataSourceSupport" class="org.jboss.portal.test.framework.embedded.DataSourceSupport">
+ <property name="transactionManager"><inject bean="TransactionManagerSupport" property="transactionManager"/></property>
+ <property name="connectionManagerReference"><inject bean="ConnectionManagerSupport" property="connectionManagerReference"/></property>
+ <property name="config"><inject bean="DataSourceConfig"/></property>
+ </bean>
+
+ <bean name="HibernateSupport" class="org.jboss.portal.test.framework.embedded.HibernateSupport">
+ <property name="config"><inject bean="HibernateConfig"/></property>
+ <property name="jNDIName">java:/TestSessionFactory</property>
+ <property name="mappings">
+ <list elementClass="java.lang.String">
+ <value>domain-proto.hbm.xml</value>
+ </list>
+ </property>
+ </bean>
+
+ <bean name="LDAPTestBean" class="org.jboss.portal.test.identity.UserProtoTestCase">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory"/>
+ <parameter>LDAPTestBean</parameter>
+ </constructor>
+ <property name="hibernate"><inject bean="HibernateSupport"/></property>
+ </bean>
+
+</deployment>
Added: trunk/identity/src/resources/test/config/db-config.xml
===================================================================
--- trunk/identity/src/resources/test/config/db-config.xml 2006-12-13 15:40:19 UTC (rev 5840)
+++ trunk/identity/src/resources/test/config/db-config.xml 2006-12-13 15:49:11 UTC (rev 5841)
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<identity-configuration>
+ <datasources>
+ <!--in tests Hibernate SF is created separately-->
+ <!--<datasource>
+ <name>DB</name>
+ <config/>
+ </datasource>-->
+ </datasources>
+ <modules>
+ <module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>User</type>
+ <implementation>DB</implementation>
+ <config/>
+ </module>
+
+ <module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>Role</type>
+ <implementation>DB</implementation>
+ <config/>
+ </module>
+ <module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>Membership</type>
+ <implementation>DB</implementation>
+ <config/>
+ </module>
+ <module>
+ <type>UserProfile</type>
+ <implementation>DB</implementation>
+ <config>
+ <option>
+ <name>profileConfigFile</name>
+ <value>test/config/profile-config.xml</value>
+ </option>
+ </config>
+ </module>
+
+ </modules>
+</identity-configuration>
\ No newline at end of file
Deleted: trunk/identity/src/resources/test/config/minimal-db-identity-config.xml
===================================================================
--- trunk/identity/src/resources/test/config/minimal-db-identity-config.xml 2006-12-13 15:40:19 UTC (rev 5840)
+++ trunk/identity/src/resources/test/config/minimal-db-identity-config.xml 2006-12-13 15:49:11 UTC (rev 5841)
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ JBoss, a division of Red Hat ~
- ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
- ~ contributors as indicated by the @authors tag. See the ~
- ~ copyright.txt in the distribution for a full listing of ~
- ~ individual contributors. ~
- ~ ~
- ~ This is free software; you can redistribute it and/or modify it ~
- ~ under the terms of the GNU Lesser General Public License as ~
- ~ published by the Free Software Foundation; either version 2.1 of ~
- ~ the License, or (at your option) any later version. ~
- ~ ~
- ~ This software is distributed in the hope that it will be useful, ~
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
- ~ Lesser General Public License for more details. ~
- ~ ~
- ~ You should have received a copy of the GNU Lesser General Public ~
- ~ License along with this software; if not, write to the Free ~
- ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
- ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
-<identity-configuration>
- <modules>
- <module>
- <!--type used to correctly map in IdentityContext registry-->
- <type>UserModule</type>
- <implementation>DB</implementation>
- </module>
- <module>
- <!--type used to correctly map in IdentityContext registry-->
- <type>RoleModule</type>
- <implementation>DB</implementation>
- </module>
- <module>
- <!--type used to correctly map in IdentityContext registry-->
- <type>MembershipModule</type>
- <implementation>DB</implementation>
- </module>
- <module>
- <!--type used to correctly map in IdentityContext registry-->
- <type>UserProfileModule</type>
- <implementation>DB</implementation>
- </module>
- </modules>
-</identity-configuration>
\ No newline at end of file
Deleted: trunk/identity/src/resources/test/config/minimal-ldap-identity-config.xml
===================================================================
--- trunk/identity/src/resources/test/config/minimal-ldap-identity-config.xml 2006-12-13 15:40:19 UTC (rev 5840)
+++ trunk/identity/src/resources/test/config/minimal-ldap-identity-config.xml 2006-12-13 15:49:11 UTC (rev 5841)
@@ -1,86 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ JBoss, a division of Red Hat ~
- ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
- ~ contributors as indicated by the @authors tag. See the ~
- ~ copyright.txt in the distribution for a full listing of ~
- ~ individual contributors. ~
- ~ ~
- ~ This is free software; you can redistribute it and/or modify it ~
- ~ under the terms of the GNU Lesser General Public License as ~
- ~ published by the Free Software Foundation; either version 2.1 of ~
- ~ the License, or (at your option) any later version. ~
- ~ ~
- ~ This software is distributed in the hope that it will be useful, ~
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
- ~ Lesser General Public License for more details. ~
- ~ ~
- ~ You should have received a copy of the GNU Lesser General Public ~
- ~ License along with this software; if not, write to the Free ~
- ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
- ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
-<identity-configuration>
- <modules>
- <module>
- <!--type used to correctly map in IdentityContext registry-->
- <type>UserModule</type>
- <implementation>LDAP</implementation>
- </module>
- <module>
- <!--type used to correctly map in IdentityContext registry-->
- <type>RoleModule</type>
- <implementation>LDAP</implementation>
- </module>
- <module>
- <!--type used to correctly map in IdentityContext registry-->
- <type>MembershipModule</type>
- <implementation>LDAP</implementation>
- </module>
- <module>
- <!--type used to correctly map in IdentityContext registry-->
- <type>UserProfileModule</type>
- <implementation>LDAP</implementation>
- </module>
-
- <!--For ldap configuration this is needed additionally to use ldap connection...-->
- <module>
- <!--type used to correctly map in IdentityContext registry-->
- <type>ConnectionContext</type>
- <implementation>LDAP</implementation>
- <config>
- <option>
- <name>host</name>
- <value>localhost</value>
- </option>
- <option>
- <name>port</name>
- <value>10389</value>
- </option>
- <option>
- <name>admin-dn</name>
- <value>cn=Directory Manager</value>
- </option>
- <option>
- <name>admin-password</name>
- <value>password</value>
- </option>
- </config>
- </module>
- </modules>
-
- <options>
- <option-group>
- <group-name>common</group-name>
- <option>
- <name>userContainerDN</name>
- <value>ou=People,dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</value>
- </option>
- <option>
- <name>roleContainerDN</name>
- <value>ou=Roles,dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</value>
- </option>
- </option-group>
- </options>
-</identity-configuration>
\ No newline at end of file
Copied: trunk/identity/src/resources/test/config/opends-config.xml (from rev 5770, trunk/test/src/etc/identityconfig/opends-config.xml)
===================================================================
--- trunk/test/src/etc/identityconfig/opends-config.xml 2006-12-06 09:43:49 UTC (rev 5770)
+++ trunk/identity/src/resources/test/config/opends-config.xml 2006-12-13 15:49:11 UTC (rev 5841)
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<identity-configuration>
+ <datasources>
+ <datasource>
+ <name>LDAP</name>
+ <config>
+ <option>
+ <name>host</name>
+ <value>localhost</value>
+ </option>
+ <option>
+ <name>port</name>
+ <value>10389</value>
+ </option>
+ <option>
+ <name>adminDN</name>
+ <value>cn=Directory Manager</value>
+ </option>
+ <option>
+ <name>adminPassword</name>
+ <value>password</value>
+ </option>
+ </config>
+ </datasource>
+ </datasources>
+ <modules>
+ <module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>User</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+ <module>
+ <type>Role</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+ <module>
+ <type>Membership</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+ <module>
+ <type>UserProfile</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+ </modules>
+
+ <options>
+ <option-group>
+ <group-name>common</group-name>
+ <option>
+ <name>userContainerDN</name>
+ <value>ou=People,dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</value>
+ </option>
+ <option>
+ <name>roleContainerDN</name>
+ <value>ou=Roles,dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</value>
+ </option>
+ </option-group>
+ </options>
+</identity-configuration>
\ No newline at end of file
Added: trunk/identity/src/resources/test/config/profile-config.xml
===================================================================
--- trunk/identity/src/resources/test/config/profile-config.xml 2006-12-13 15:40:19 UTC (rev 5840)
+++ trunk/identity/src/resources/test/config/profile-config.xml 2006-12-13 15:49:11 UTC (rev 5841)
@@ -0,0 +1,376 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<profile>
+ <!--Database mapping - jbp_user table column mapping-->
+ <property>
+ <name>portal.user.name.given</name>
+ <type>java.lang.String</type>
+ <access-mode>read-write</access-mode>
+ <usage>mandatory</usage>
+ <display-name xml:lang="en">Name</display-name>
+ <description xml:lang="en">The user name</description>
+ <mapping>
+ <database>
+ <type>column</type>
+ <value>jbp_username</value>
+ </database>
+ </mapping>
+ </property>
+ <property>
+ <name>portal.user.name.family</name>
+ <type>java.lang.String</type>
+ <access-mode>read-write</access-mode>
+ <usage>mandatory</usage>
+ <display-name xml:lang="en">Family name</display-name>
+ <description xml:lang="en">The user family name</description>
+ <mapping>
+ <database>
+ <type>column</type>
+ <value>jbp_familyname</value>
+ </database>
+ </mapping>
+ </property>
+ <property>
+ <name>portal.user.email.real</name>
+ <type>java.lang.String</type>
+ <access-mode>read-write</access-mode>
+ <usage>mandatory</usage>
+ <display-name xml:lang="en">Email</display-name>
+ <description xml:lang="en">The user real email</description>
+ <mapping>
+ <database>
+ <type>column</type>
+ <value>jbp_realemail</value>
+ </database>
+ </mapping>
+ </property>
+ <property>
+ <name>portal.user.email.fake</name>
+ <type>java.lang.String</type>
+ <access-mode>read-write</access-mode>
+ <usage>mandatory</usage>
+ <display-name xml:lang="en">Fake email</display-name>
+ <description xml:lang="en">The user fake email</description>
+ <mapping>
+ <database>
+ <type>column</type>
+ <value>jbp_fakeemail</value>
+ </database>
+ </mapping>
+ </property>
+ <property>
+ <name>portal.user.registration-date</name>
+ <type>java.lang.String</type>
+ <access-mode>read-write</access-mode>
+ <usage>mandatory</usage>
+ <display-name xml:lang="en">Registration date</display-name>
+ <description xml:lang="en">Registration date of user</description>
+ <mapping>
+ <database>
+ <type>column</type>
+ <value>jbp_regdate</value>
+ </database>
+ </mapping>
+ </property>
+ <property>
+ <name>portal.user.email.view-real</name>
+ <type>java.lang.String</type>
+ <access-mode>read-write</access-mode>
+ <usage>mandatory</usage>
+ <display-name xml:lang="en">View real email</display-name>
+ <description xml:lang="en">Is user real email displayed in public</description>
+ <mapping>
+ <database>
+ <type>column</type>
+ <value>jbp_viewrealemail</value>
+ </database>
+ </mapping>
+ </property>
+ <property>
+ <name>portal.user.enabled</name>
+ <type>java.lang.String</type>
+ <access-mode>read-write</access-mode>
+ <usage>mandatory</usage>
+ <display-name xml:lang="en">Enabled</display-name>
+ <description xml:lang="en">User enabled state</description>
+ <mapping>
+ <database>
+ <type>column</type>
+ <value>jbp_enabled</value>
+ </database>
+ </mapping>
+ </property>
+
+ <!--Dynamic database store-->
+ <property>
+ <name>portal.user.location</name>
+ <type>java.lang.String</type>
+ <access-mode>read-write</access-mode>
+ <usage>optional</usage>
+ <display-name xml:lang="en">Location</display-name>
+ <description xml:lang="en">The user location</description>
+ <mapping>
+ <database>
+ <type>dynamic</type>
+ <value>portal.user.location</value>
+ </database>
+ </mapping>
+ </property>
+ <property>
+ <name>portal.user.occupation</name>
+ <type>java.lang.String</type>
+ <access-mode>read-write</access-mode>
+ <usage>optional</usage>
+ <display-name xml:lang="en">Occupation</display-name>
+ <description xml:lang="en">The user occupation</description>
+ <mapping>
+ <database>
+ <type>dynamic</type>
+ <value>portal.user.occupation</value>
+ </database>
+ <ldap>
+ <value>title</value>
+ </ldap>
+ </mapping>
+ </property>
+ <property>
+ <name>portal.user.extra</name>
+ <type>java.lang.String</type>
+ <access-mode>read-write</access-mode>
+ <usage>optional</usage>
+ <display-name xml:lang="en">Extra info</display-name>
+ <description xml:lang="en">Extra informtion about user</description>
+ <mapping>
+ <database>
+ <type>dynamic</type>
+ <value>portal.user.extra</value>
+ </database>
+ </mapping>
+ </property>
+ <property>
+ <name>portal.user.signature</name>
+ <type>java.lang.String</type>
+ <access-mode>read-write</access-mode>
+ <usage>optional</usage>
+ <display-name xml:lang="en">Signature</display-name>
+ <description xml:lang="en">The user signature</description>
+ <mapping>
+ <database>
+ <type>dynamic</type>
+ <value>portal.user.signature</value>
+ </database>
+ <ldap>
+ <value>personalSignature</value>
+ </ldap>
+ </mapping>
+ </property>
+ <property>
+ <name>portal.user.interests</name>
+ <type>java.lang.String</type>
+ <access-mode>read-write</access-mode>
+ <usage>optional</usage>
+ <display-name xml:lang="en">Interests</display-name>
+ <description xml:lang="en">The user interests</description>
+ <mapping>
+ <database>
+ <type>dynamic</type>
+ <value>portal.user.interests</value>
+ </database>
+ </mapping>
+ </property>
+ <property>
+ <name>portal.user.locale</name>
+ <type>java.lang.String</type>
+ <access-mode>read-write</access-mode>
+ <usage>optional</usage>
+ <display-name xml:lang="en">Locale</display-name>
+ <description xml:lang="en">The user locale</description>
+ <mapping>
+ <database>
+ <type>dynamic</type>
+ <value>portal.user.locale</value>
+ </database>
+ <ldap>
+ <value>localityName</value>
+ </ldap>
+ </mapping>
+ </property>
+ <property>
+ <name>portal.user.im.icq</name>
+ <type>java.lang.String</type>
+ <access-mode>read-write</access-mode>
+ <usage>optional</usage>
+ <display-name xml:lang="en">ICQ</display-name>
+ <description xml:lang="en">The user ICQ id</description>
+ <mapping>
+ <database>
+ <type>dynamic</type>
+ <value>portal.user.im.icq</value>
+ </database>
+ </mapping>
+ </property>
+ <property>
+ <name>portal.user.im.aim</name>
+ <type>java.lang.String</type>
+ <access-mode>read-write</access-mode>
+ <usage>optional</usage>
+ <display-name xml:lang="en">AIM</display-name>
+ <description xml:lang="en">The user AIM id</description>
+ <mapping>
+ <database>
+ <type>dynamic</type>
+ <value>portal.user.im.aim</value>
+ </database>
+ </mapping>
+ </property>
+ <property>
+ <name>portal.user.im.msnm</name>
+ <type>java.lang.String</type>
+ <access-mode>read-write</access-mode>
+ <usage>optional</usage>
+ <display-name xml:lang="en">MSN</display-name>
+ <description xml:lang="en">The user MSN id</description>
+ <mapping>
+ <database>
+ <type>dynamic</type>
+ <value>portal.user.im.msnm</value>
+ </database>
+ </mapping>
+ </property>
+ <property>
+ <name>portal.user.im.yim</name>
+ <type>java.lang.String</type>
+ <access-mode>read-write</access-mode>
+ <usage>optional</usage>
+ <display-name xml:lang="en">YIM</display-name>
+ <description xml:lang="en">The user YIM id</description>
+ <mapping>
+ <database>
+ <type>dynamic</type>
+ <value>portal.user.im.yim</value>
+ </database>
+ </mapping>
+ </property>
+ <property>
+ <name>portal.user.im.skype</name>
+ <type>java.lang.String</type>
+ <access-mode>read-write</access-mode>
+ <usage>optional</usage>
+ <display-name xml:lang="en">Skype</display-name>
+ <description xml:lang="en">The user skype id</description>
+ <mapping>
+ <database>
+ <type>dynamic</type>
+ <value>portal.user.im.skype</value>
+ </database>
+ </mapping>
+ </property>
+ <property>
+ <name>portal.user.homepage</name>
+ <type>java.lang.String</type>
+ <access-mode>read-write</access-mode>
+ <usage>optional</usage>
+ <display-name xml:lang="en">Homepage</display-name>
+ <description xml:lang="en">The user homepage</description>
+ <mapping>
+ <database>
+ <type>dynamic</type>
+ <value>portal.user.homepage</value>
+ </database>
+ <ldap>
+ <value>seeAlso</value>
+ </ldap>
+ </mapping>
+ </property>
+ <property>
+ <name>portal.user.time-zone-offset</name>
+ <type>java.lang.String</type>
+ <access-mode>read-write</access-mode>
+ <usage>optional</usage>
+ <display-name xml:lang="en">Timezone</display-name>
+ <description xml:lang="en">Timezone in users location</description>
+ <mapping>
+ <database>
+ <type>dynamic</type>
+ <value>portal.user.time-zone-offset</value>
+ </database>
+ </mapping>
+ </property>
+ <property>
+ <name>portal.user.theme</name>
+ <type>java.lang.String</type>
+ <access-mode>read-write</access-mode>
+ <usage>optional</usage>
+ <display-name xml:lang="en">Theme</display-name>
+ <description xml:lang="en">Portlat theme that user is using</description>
+ <mapping>
+ <database>
+ <type>dynamic</type>
+ <value>portal.user.theme</value>
+ </database>
+ </mapping>
+ </property>
+ <property>
+ <name>portal.user.security.question</name>
+ <type>java.lang.String</type>
+ <access-mode>read-write</access-mode>
+ <usage>optional</usage>
+ <display-name xml:lang="en">Password Question</display-name>
+ <description xml:lang="en">Portal password recovery question</description>
+ <mapping>
+ <database>
+ <type>dynamic</type>
+ <value>portal.user.security.question</value>
+ </database>
+ </mapping>
+ </property>
+ <property>
+ <name>portal.user.security.answer</name>
+ <type>java.lang.String</type>
+ <access-mode>read-write</access-mode>
+ <usage>optional</usage>
+ <display-name xml:lang="en">Password Answer</display-name>
+ <description xml:lang="en">Portal password recovery answer</description>
+ <mapping>
+ <database>
+ <type>dynamic</type>
+ <value>portal.user.security.answer</value>
+ </database>
+ </mapping>
+ </property>
+ <property>
+ <name>portal.user.last-login-date</name>
+ <type>java.lang.String</type>
+ <access-mode>read-write</access-mode>
+ <usage>optional</usage>
+ <display-name xml:lang="en">Last login</display-name>
+ <description xml:lang="en">The date of users last login</description>
+ <mapping>
+ <database>
+ <type>dynamic</type>
+ <value>portal.user.last-login-date</value>
+ </database>
+ </mapping>
+ </property>
+</profile>
\ No newline at end of file
Copied: trunk/identity/src/resources/test/config/rhds-config.xml (from rev 5770, trunk/test/src/etc/identityconfig/rhds-config.xml)
===================================================================
--- trunk/test/src/etc/identityconfig/rhds-config.xml 2006-12-06 09:43:49 UTC (rev 5770)
+++ trunk/identity/src/resources/test/config/rhds-config.xml 2006-12-13 15:49:11 UTC (rev 5841)
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<identity-configuration>
+ <datasources>
+ <datasource>
+ <name>LDAP</name>
+ <config>
+ <option>
+ <name>host</name>
+ <value>dev39.qa.atl.jboss.com</value>
+ </option>
+ <option>
+ <name>port</name>
+ <value>10389</value>
+ </option>
+ <option>
+ <name>adminDN</name>
+ <value>cn=Directory Manager</value>
+ </option>
+ <option>
+ <name>adminPassword</name>
+ <value>qpq123qpq</value>
+ </option>
+ </config>
+ </datasource>
+ </datasources>
+ <modules>
+ <module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>User</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+ <module>
+ <type>Role</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+ <module>
+ <type>Membership</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+ <module>
+ <type>UserProfile</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+
+ <!--For ldap configuration this is needed additionally to use ldap connection...-->
+ <module>
+ <type>ConnectionContext</type>
+ <implementation>LDAP</implementation>
+ </module>
+ </modules>
+ <options>
+ <option-group>
+ <group-name>common</group-name>
+ <option>
+ <name>userContainerDN</name>
+ <value>ou=People,dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</value>
+ </option>
+ <option>
+ <name>roleContainerDN</name>
+ <value>ou=Roles,dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</value>
+ </option>
+ </option-group>
+ </options>
+</identity-configuration>
\ No newline at end of file
Deleted: trunk/identity/src/resources/test/config/standardidentity-config.xml
===================================================================
--- trunk/identity/src/resources/test/config/standardidentity-config.xml 2006-12-13 15:40:19 UTC (rev 5840)
+++ trunk/identity/src/resources/test/config/standardidentity-config.xml 2006-12-13 15:49:11 UTC (rev 5841)
@@ -1,384 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ JBoss, a division of Red Hat ~
- ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
- ~ contributors as indicated by the @authors tag. See the ~
- ~ copyright.txt in the distribution for a full listing of ~
- ~ individual contributors. ~
- ~ ~
- ~ This is free software; you can redistribute it and/or modify it ~
- ~ under the terms of the GNU Lesser General Public License as ~
- ~ published by the Free Software Foundation; either version 2.1 of ~
- ~ the License, or (at your option) any later version. ~
- ~ ~
- ~ This software is distributed in the hope that it will be useful, ~
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
- ~ Lesser General Public License for more details. ~
- ~ ~
- ~ You should have received a copy of the GNU Lesser General Public ~
- ~ License along with this software; if not, write to the Free ~
- ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
- ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
-<identity-configuration>
- <datasources>
- <datasouce>
- <!--schema that maps hibernate objects-->
- <name>Identity</name>
-
- <class>blah.IdentitySessionFactoryBinder</class>
- <service-name>portal:service=Hibernate,type=Identity</service-name>
-
- <config>
- <option>
- <name>DoChecking</name>
- <value>true</value>
- </option>
- <option>
- <name>ProfileConfigLocation</name>
- <value>conf/hibernate/user/profile-config.xml</value>
- </option>
- <option>
- <name>ConfigLocation</name>
- <value>conf/hibernate/user/hibernate.cfg.xml</value>
- </option>
- <option>
- <name>SetupLocation</name>
- <value>conf/hibernate/user/setup.txt</value>
- </option>
- <option>
- <name>JNDIName</name>
- <value>java:/portal/UserSessionFactory</value>
- </option>
- </config>
- </datasouce>
- <datasouce>
- <!--schema that provides dynamic database property store for ldap impl-->
- <name>Dynamic</name>
-
- <class>org.jboss.portal.jems.hibernate.SessionFactoryBinder</class>
- <service-name>portal:service=Hibernate,type=UserDynProfile</service-name>
-
- <config>
- <option>
- <name>DoChecking</name>
- <value>true</value>
- </option>
- <option>
- <name>ProfileConfigLocation</name>
- <value>conf/hibernate/user/profile-config.xml</value>
- </option>
- <option>
- <name>ConfigLocation</name>
- <value>conf/hibernate/user/hibernate.cfg.xml</value>
- </option>
- <option>
- <name>SetupLocation</name>
- <value>conf/hibernate/user/setup.txt</value>
- </option>
- <option>
- <name>JNDIName</name>
- <value>java:/portal/DynamicProfileSessionFactory</value>
- </option>
- </config>
- </datasouce>
- </datasources>
- <modules>
- <module>
- <!--type used to correctly map in IdentityContext registry-->
- <type>UserModule</type>
- <implementation>DB</implementation>
-
- <!--name of service and class for creating mbean-->
- <service-name>portal:service=Module,type=User</service-name>
- <class>org.jboss.portal.identity.db.DBUserModuleImp</class>
- <jndi-name>java:/portal/UserModule</jndi-name>
-
- <!--set of options that are passed to a class constructor-->
- <config>
- <option>
- <name>SessionFactoryJNDIName</name>
- <value>java:/portal/UserSessionFactory</value>
- </option>
- </config>
- </module>
-
- <module>
- <!--type used to correctly map in IdentityContext registry-->
- <type>RoleModule</type>
- <implementation>DB</implementation>
-
- <!--name of service and class for creating mbean-->
- <service-name>portal:service=Module,type=Role</service-name>
- <class>org.jboss.portal.identity.db.DBRoleModuleImp</class>
- <jndi-name>java:/portal/RoleModule</jndi-name>
-
- <!--set of options that are passed to a class constructor-->
- <config>
- <option>
- <name>SessionFactoryJNDIName</name>
- <value>java:/portal/UserSessionFactory</value>
- </option>
- </config>
- </module>
-
- <module>
- <!--type used to correctly map in IdentityContext registry-->
- <type>MembershipModule</type>
- <implementation>DB</implementation>
-
- <!--name of service and class for creating mbean-->
- <service-name>portal:service=Module,type=Membership</service-name>
- <class>org.jboss.portal.identity.db.DBMembershipModuleImp</class>
- <jndi-name>java:/portal/MembershipModule</jndi-name>
-
- <!--set of options that are passed to a class constructor-->
- <config>
- <option>
- <name>SessionFactoryJNDIName</name>
- <value>java:/portal/UserSessionFactory</value>
- </option>
- </config>
- </module>
-
- <module>
- <!--type used to correctly map in IdentityContext registry-->
- <type>UserProfileModule</type>
- <implementation>DB</implementation>
-
- <!--name of service and class for creating mbean-->
- <service-name>portal:service=Module,type=UserProfile</service-name>
- <class>org.jboss.portal.identity.db.DBUserProfileModuleImp</class>
- <jndi-name>java:/portal/UserProfileModule</jndi-name>
-
- <!--set of options that are passed to a class constructor-->
- <config>
- <option>
- <name>SessionFactoryJNDIName</name>
- <value>java:/portal/UserSessionFactory</value>
- </option>
- </config>
- </module>
-
- <!--for ldap modules...-->
- <module>
- <!--type used to correctly map in IdentityContext registry-->
- <type>UserModule</type>
- <implementation>LDAP</implementation>
-
- <!--name of service and class for creating mbean-->
- <service-name>portal:service=Module,type=User</service-name>
- <class>org.jboss.portal.identity2.ldap.LDAPUserModuleImpl</class>
- <jndi-name>java:/portal/UserModule</jndi-name>
-
- <!--set of options that are passed to a class constructor-->
- <config/>
- </module>
-
- <module>
- <!--type used to correctly map in IdentityContext registry-->
- <type>RoleModule</type>
- <implementation>LDAP</implementation>
-
- <!--name of service and class for creating mbean-->
- <service-name>portal:service=Module,type=Role</service-name>
- <class>org.jboss.portal.identity2.ldap.LDAPRoleModuleImpl</class>
- <jndi-name>java:/portal/RoleModule</jndi-name>
-
- <!--set of options that are passed to a class constructor-->
- <config/>
- </module>
-
- <module>
- <!--type used to correctly map in IdentityContext registry-->
- <type>MembershipModule</type>
- <implementation>LDAP</implementation>
-
- <!--name of service and class for creating mbean-->
- <service-name>portal:service=Module,type=Membership</service-name>
- <class>org.jboss.portal.identity2.ldap.LDAPStaticGroupMembershipModuleImpl</class>
- <jndi-name>java:/portal/MembershipModule</jndi-name>
-
- <!--set of options that are passed to a class constructor-->
- <config/>
- </module>
-
- <module>
- <!--type used to correctly map in IdentityContext registry-->
- <type>UserProfileModule</type>
- <implementation>LDAP</implementation>
-
- <!--name of service and class for creating mbean-->
- <service-name>portal:service=Module,type=UserProfile</service-name>
- <class>org.jboss.portal.identity2.ldap.LDAPUserProfileModuleImpl</class>
- <jndi-name>java:/portal/UserProfileModule</jndi-name>
-
- <!--set of options that are passed to a class constructor-->
- <config>
- <!--<option>
- <name>LDAPConnectionJNDIName</name>
- <value>java:/portal/UserSessionFactory</value>
- </option>-->
- <!--Hibernate mappings for db level store (dynamic properties not mapped as ldap attributes)-->
- <option>
- <name>SessionFactoryJNDIName</name>
- <value>java:/portal/PropertyStoreSessionFactory</value>
- </option>
- <option>
- <name>profileMappings</name>
- <value>ldap-profile.xml</value>
- </option>
- </config>
- </module>
-
- <!--For ldap configuration this is needed additionally to use ldap connection...-->
- <module>
- <!--type used to correctly map in IdentityContext registry-->
- <type>ConnectionContext</type>
- <implementation>LDAP</implementation>
-
- <!--name of service and class for creating mbean-->
- <service-name>portal:service=Module,type=LDAPConnectionContext</service-name>
- <class>org.jboss.portal.identity2.ldap.LDAPConnectionContext</class>
- <jndi-name>java:/portal/LDAPConnectionContext</jndi-name>
-
- <!--set of options that are passed to a class constructor-->
- <config>
- <option>
- <name>host</name>
- <value>jboss.com</value>
- </option>
- <option>
- <name>port</name>
- <value>389</value>
- </option>
- <option>
- <name>context-factory</name>
- <value>com.sun.jndi.ldap.LdapCtxFactory</value>
- </option>
- <option>
- <name>admin-dn</name>
- <value>cn=Directory Manager</value>
- </option>
- <option>
- <name>admin-password</name>
- <value>password</value>
- </option>
- <option>
- <name>authentication</name>
- <value>simple</value>
- </option>
- </config>
- </module>
- </modules>
-
- <options>
- <!--Common options section-->
- <!--
- <option-group>
- <group-name>connection</group-name>
- <option>
- <name>host</name>
- <value>localhost</value>
- </option>
- <option>
- <name>port</name>
- <value>10389</value>
- </option>
- <option>
- <name>context-factory</name>
- <value>com.sun.jndi.ldap.LdapCtxFactory</value>
- </option>
- <option>
- <name>admin-dn</name>
- <value>cn=Directory Manager</value>
- </option>
- <option>
- <name>admin-password</name>
- <value>password</value>
- </option>
- </option-group> -->
- <option-group>
- <group-name>common</group-name>
- <option>
- <name>userContainerDN</name>
- <value>ou=People,dc=example,dc=com</value>
- </option>
- <option>
- <name>uidAttributeId</name>
- <value>uid</value>
- </option>
- <option>
- <name>passwordAttributeID</name>
- <value>userPassword</value>
- </option>
- <option>
- <name>hashAlgorithm</name>
- <value>MD5</value>
- </option>
- <option>
- <name>hashEncoding</name>
- <value>hex</value>
- </option>
- <option>
- <name>roleContainerDN</name>
- <value>ou=Roles,dc=example,dc=com</value>
- </option>
- <option>
- <name>ridAttributeId</name>
- <value>cn</value>
- </option>
- <option>
- <name>roleDisplayNameAttributeID</name>
- <value>cn</value>
- </option>
- <option>
- <name>membershipAttributeID</name>
- <value>member</value>
- </option>
- <option>
- <name>membershipAttributeIsDN</name>
- <value>true</value>
- </option>
- </option-group>
- <option-group>
- <group-name>userCreateAttibutes</group-name>
- <option>
- <name>objectClass</name>
- <value>top</value>
- <value>uidObject</value>
- <value>person</value>
- <value>inetUser</value>
- </option>
- <!--Schema requires those to have initial value-->
- <option>
- <name>cn</name>
- <value>none</value>
- </option>
- <option>
- <name>sn</name>
- <value>none</value>
- </option>
- </option-group>
- <option-group>
- <group-name>roleCreateAttibutes</group-name>
- <option>
- <name>objectClass</name>
- <value>top</value>
- <value>groupOfNames</value>
- </option>
- <!--Schema requires those to have initial value-->
- <option>
- <name>cn</name>
- <value>none</value>
- </option>
- <!--Some directory servers require this attribute to be valid DN-->
- <!--For safety reasons point to the admin user here-->
- <option>
- <name>member</name>
- <value>uid=dummynonexistinguser,ou=People,dc=jboss,dc=org</value>
- </option>
- </option-group>
- </options>
-</identity-configuration>
\ No newline at end of file
19 years, 7 months
JBoss Portal SVN: r5840 - in trunk/identity/src/main/org/jboss/portal/test/identity: . db
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2006-12-13 10:40:19 -0500 (Wed, 13 Dec 2006)
New Revision: 5840
Added:
trunk/identity/src/main/org/jboss/portal/test/identity/db/
trunk/identity/src/main/org/jboss/portal/test/identity/db/DBIdentityTestCase.java
trunk/identity/src/main/org/jboss/portal/test/identity/db/DBTestCase.java
Log:
refactored identity tests for the new stuff
Added: trunk/identity/src/main/org/jboss/portal/test/identity/db/DBIdentityTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/db/DBIdentityTestCase.java 2006-12-13 15:39:20 UTC (rev 5839)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/db/DBIdentityTestCase.java 2006-12-13 15:40:19 UTC (rev 5840)
@@ -0,0 +1,261 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.test.identity.db;
+
+import org.jboss.portal.identity2.IdentityServiceControllerImpl;
+import org.jboss.portal.identity2.IdentityContext;
+import org.jboss.portal.identity2.ProfileMap;
+import org.jboss.portal.identity2.User;
+import org.jboss.portal.identity2.db.HibernateUserImpl;
+import org.jboss.portal.identity2.db.HibernateUserModuleImpl;
+import org.jboss.portal.identity2.db.HibernateRoleModuleImpl;
+import org.jboss.portal.identity2.db.HibernateMembershipModuleImpl;
+import org.jboss.portal.identity2.db.HibernateUserProfileModuleImpl;
+import org.jboss.portal.identity2.config.metadata.ConfigurationParser;
+import org.jboss.portal.identity2.config.info.ProfileInfoSupport;
+import org.jboss.portal.identity2.info.ProfileInfo;
+import org.jboss.portal.test.identity.UserTest;
+import org.jboss.portal.common.p3p.P3PConstants;
+import junit.framework.TestSuite;
+
+import java.util.Date;
+import java.text.SimpleDateFormat;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5748 $
+ */
+public class DBIdentityTestCase extends DBTestCase
+{
+
+ public static TestSuite suite() throws Exception
+ {
+ System.out.println("###");
+ return createTestSuite(DBIdentityTestCase.class);
+ }
+
+ public void setUp() throws Exception
+ {
+
+ //generate hibernate mappings based on the profile file
+// ProfileInfo info = new ProfileInfoSupport(ConfigurationParser.parseProfileConfiguration("test/config/profile-config.xml"));
+// String pattern = "<property name=\"@name@\" column=\"@column@\" type=\"java.lang.String\" update=\"true\" insert=\"true\" unique=\"false\"/>";
+// HibernateHelper.generateProfileMappings("hibernate/domain-template-single.hbm.xml",
+// "resources/hibernate/domain-identity.hbm.xml",
+// pattern,
+// info,
+// Thread.currentThread().getContextClassLoader());
+
+
+
+ //initialize microcontainer stuff
+ super.setUp();
+
+
+ //bootstrap identity modules
+ IdentityServiceControllerImpl controller = new IdentityServiceControllerImpl();
+ controller.setConfigFile("test/config/db-config.xml");
+ controller.setDefaultConfigFile("test/config/standardidentity-config.xml");
+ controller.setRegisterMBeans(false);
+ controller.start();
+ identityContext = controller.getIdentityContext();
+ this.userModule = (HibernateUserModuleImpl)identityContext.getObject(IdentityContext.TYPE_USER_MODULE);
+ this.roleModule = (HibernateRoleModuleImpl)identityContext.getObject(IdentityContext.TYPE_ROLE_MODULE);
+ this.membershipModule = (HibernateMembershipModuleImpl)identityContext.getObject(IdentityContext.TYPE_MEMBERSHIP_MODULE);
+ this.userProfileModule = (HibernateUserProfileModuleImpl)identityContext.getObject(IdentityContext.TYPE_USER_PROFILE_MODULE);
+
+ //
+ utc = new UserTest();
+ utc.setUserModule(userModule);
+ utc.setRoleModule(roleModule);
+ utc.setMembershipModule(membershipModule);
+ utc.setContext(this);
+ utc.populate();
+ }
+
+
+
+
+
+
+ public void testWorking() throws Exception
+ {
+
+ }
+
+ //
+
+ public void testFindUsersUsingFilter() throws Exception
+ {
+ utc.testFindUsersUsingFilter();
+ }
+
+ public void testFindUser1() throws Exception
+ {
+ utc.testFindUser1();
+ }
+
+ public void testFindUser2() throws Exception
+ {
+ utc.testFindUser2();
+ }
+
+ public void testFindUsers() throws Exception
+ {
+ utc.testFindUsers();
+ }
+
+ public void testCreateUser() throws Exception
+ {
+ utc.testCreateUser();
+ }
+
+ public void testCreateRole() throws Exception
+ {
+ utc.testCreateRole();
+ }
+
+ public void testCountUser() throws Exception
+ {
+ utc.testCountUser();
+ }
+
+ public void testRemoveNonExistingRole() throws Exception
+ {
+ utc.testRemoveNonExistingRole();
+ }
+
+ public void testRemoveRole() throws Exception
+ {
+ utc.testRemoveRole();
+ }
+
+ public void testRemoveUser() throws Exception
+ {
+ utc.testRemoveUser();
+ }
+
+ public void testFindRoles() throws Exception
+ {
+ utc.testFindRoles();
+ }
+
+ public void testFindRoleMembers() throws Exception
+ {
+ utc.testFindRoleMembers();
+ }
+
+ public void testDynamicProperty() throws Exception
+ {
+ begin();
+ User user = userModule.createUser("testname", "testpassword");
+ ProfileMap map = ((HibernateUserImpl)user).getProfileMap();
+ assertNull(map.get("foo"));
+ assertFalse(map.isReadOnly("foo"));
+ map.put("foo", "value");
+ assertEquals("value", map.get("foo"));
+ assertFalse(map.isReadOnly("foo"));
+ commit();
+
+ begin();
+ user = userModule.findUserByUserName("testname");
+ map = ((HibernateUserImpl)user).getProfileMap();
+ assertEquals("value", map.get("foo"));
+ assertFalse(map.isReadOnly("foo"));
+ commit();
+ }
+
+ public void testStaticProperty() throws Exception
+ {
+ begin();
+
+ //
+ User user = userModule.createUser("testname", "testpassword");
+ ProfileMap map = ((HibernateUserImpl)user).getProfileMap();
+ assertEquals("testname", map.get(P3PConstants.INFO_USER_NAME_NICKNAME));
+
+ // Test cannot remove a static property
+ try
+ {
+ map.remove(P3PConstants.INFO_USER_NAME_GIVEN);
+ fail("Should not be capable to remove static property");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ // Test read only property
+ assertTrue(map.isReadOnly(P3PConstants.INFO_USER_NAME_NICKNAME));
+ try
+ {
+ map.put(P3PConstants.INFO_USER_NAME_NICKNAME, "anothername");
+ fail("Should not be capable to modify a read only static property");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ // Test non nullable and writable property
+ try
+ {
+ map.put(User.INFO_USER_VIEW_EMAIL_VIEW_REAL, null);
+ fail("Should not be capable to nullify a non nullable static property");
+ }
+ catch (NullPointerException expected)
+ {
+ }
+ map.put(User.INFO_USER_VIEW_EMAIL_VIEW_REAL, "true");
+ assertEquals("true", userProfileModule.getProperty(user, User.INFO_USER_VIEW_EMAIL_VIEW_REAL));
+
+ // Test boolean property
+ map.put(User.INFO_USER_VIEW_EMAIL_VIEW_REAL, "false");
+ assertEquals("false", map.get(User.INFO_USER_VIEW_EMAIL_VIEW_REAL));
+ assertEquals("false", userProfileModule.getProperty(user, User.INFO_USER_VIEW_EMAIL_VIEW_REAL));
+
+ map.put(User.INFO_USER_VIEW_EMAIL_VIEW_REAL, "true");
+ assertEquals("true", map.get(User.INFO_USER_VIEW_EMAIL_VIEW_REAL));
+ assertEquals("true", userProfileModule.getProperty(user, User.INFO_USER_VIEW_EMAIL_VIEW_REAL));
+
+ userProfileModule.setProperty(user, User.INFO_USER_VIEW_EMAIL_VIEW_REAL, "false");
+ assertEquals("false", map.get(User.INFO_USER_VIEW_EMAIL_VIEW_REAL));
+ assertEquals("false", userProfileModule.getProperty(user, User.INFO_USER_VIEW_EMAIL_VIEW_REAL));
+
+ userProfileModule.setProperty(user, User.INFO_USER_VIEW_EMAIL_VIEW_REAL, "true");
+ assertEquals("true", map.get(User.INFO_USER_VIEW_EMAIL_VIEW_REAL));
+ assertEquals("true", userProfileModule.getProperty(user, User.INFO_USER_VIEW_EMAIL_VIEW_REAL));
+ try
+ {
+ map.put(User.INFO_USER_VIEW_EMAIL_VIEW_REAL, "truee");
+ fail("Should not be capable to set a bad value to boolean property");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ // Test date
+ Date date = ((HibernateUserImpl)user).getRegistrationDate();
+ SimpleDateFormat sdf = new SimpleDateFormat();
+ assertEquals(sdf.format(date), map.get(User.INFO_USER_REGISTRATION_DATE));
+
+ commit();
+ }
+}
Added: trunk/identity/src/main/org/jboss/portal/test/identity/db/DBTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/db/DBTestCase.java 2006-12-13 15:39:20 UTC (rev 5839)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/db/DBTestCase.java 2006-12-13 15:40:19 UTC (rev 5840)
@@ -0,0 +1,201 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.test.identity.db;
+
+import org.jboss.portal.test.framework.embedded.DataSourceSupport;
+import org.jboss.portal.test.framework.embedded.HibernateSupport;
+import org.jboss.portal.test.framework.TestRuntimeContext;
+import org.jboss.portal.test.identity.UserTest;
+import org.jboss.portal.common.test.junit.POJOJUnitTest;
+import org.jboss.portal.common.test.junit.JUnitAdapter;
+import org.jboss.portal.identity2.IdentityContext;
+import org.jboss.portal.identity2.db.HibernateUserModuleImpl;
+import org.jboss.portal.identity2.db.HibernateRoleModuleImpl;
+import org.jboss.portal.identity2.db.HibernateMembershipModuleImpl;
+import org.jboss.portal.identity2.db.HibernateUserProfileModuleImpl;
+import org.apache.log4j.Appender;
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.SimpleLayout;
+import org.apache.log4j.Logger;
+import org.apache.log4j.Level;
+import junit.framework.TestSuite;
+
+import java.net.URL;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class DBTestCase extends junit.framework.TestCase implements UserTest.Context
+{
+
+ static
+ {
+ Appender appender = new ConsoleAppender(new SimpleLayout());
+ Logger.getRoot().addAppender(appender);
+ Logger.getRoot().setLevel(Level.DEBUG);
+ Logger.getLogger("org.hibernate").setLevel(Level.ERROR);
+ Logger.getLogger("org.jboss.portal.identity2").setLevel(Level.DEBUG);
+ }
+
+ public static TestSuite createTestSuite(Class clazz) throws Exception
+ {
+ URL configsURL = Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
+ Map parameterMap = new HashMap();
+ parameterMap.put("DataSourceConfig", DataSourceSupport.Config.fromXML2(configsURL));
+ POJOJUnitTest abc = new POJOJUnitTest(clazz);
+ JUnitAdapter adapter = new JUnitAdapter(abc, parameterMap);
+ TestSuite suite = new TestSuite();
+ suite.addTest(adapter);
+ return suite;
+ }
+
+
+ /**
+ * .
+ */
+ protected DataSourceSupport.Config dataSourceConfigParameter;
+
+ /**
+ * .
+ */
+ protected TestRuntimeContext runtimeContext;
+
+ /**
+ * .
+ */
+ protected HibernateSupport hibernate;
+
+ /**
+ * .
+ */
+ protected IdentityContext identityContext;
+
+ /** . */
+ protected UserTest utc;
+
+ /**
+ * .
+ */
+ protected HibernateUserModuleImpl userModule;
+
+ /**
+ * .
+ */
+ protected HibernateRoleModuleImpl roleModule;
+
+ /**
+ * .
+ */
+ protected HibernateMembershipModuleImpl membershipModule;
+
+ /**
+ * .
+ */
+ protected HibernateUserProfileModuleImpl userProfileModule;
+
+ public DataSourceSupport.Config getDataSourceConfigParameter()
+ {
+ return dataSourceConfigParameter;
+ }
+
+ public void setDataSourceConfigParameter(DataSourceSupport.Config dataSourceConfig)
+ {
+ this.dataSourceConfigParameter = dataSourceConfig;
+ }
+
+ public HibernateSupport getHibernate()
+ {
+ return hibernate;
+ }
+
+ public void setHibernate(HibernateSupport hibernate)
+ {
+ this.hibernate = hibernate;
+ }
+
+
+ public String getName()
+ {
+ return super.getName() + "," + dataSourceConfigParameter.getName();
+ }
+
+
+ protected void setUp() throws Exception
+ {
+ hibernate = new HibernateSupport();
+
+
+ runtimeContext = new TestRuntimeContext("org/jboss/portal/test/identity/db-beans.xml");
+ runtimeContext.addBean("DBTestBean", this);
+ runtimeContext.addBean("HibernateSupport", hibernate);
+ runtimeContext.addBean("DataSourceConfig", dataSourceConfigParameter);
+
+ HibernateSupport.Config config = HibernateSupport.getConfig(dataSourceConfigParameter.getName());
+ //add hibernate properties for dynamic entities
+ //config.getProperties().put("hibernate.default_entity_mode","dynamic-map");
+
+ runtimeContext.addBean("HibernateConfig", config);
+ runtimeContext.start();
+ }
+
+
+
+ public void tearDown() throws Exception
+ {
+ utc.setUserModule(null);
+ utc.setRoleModule(null);
+ utc.setMembershipModule(null);
+ utc.setUserProfileModule(null);
+ utc.setContext(null);
+ utc = null;
+
+ //
+ roleModule.destroy();
+ userModule.destroy();
+ membershipModule.destroy();
+ userProfileModule.destroy();
+
+ roleModule = null;
+ userModule = null;
+ membershipModule = null;
+ userProfileModule = null;
+
+ //
+ runtimeContext.stop();
+ }
+
+
+ public void begin()
+ {
+ hibernate.openSession();
+ }
+
+ public void commit()
+ {
+ assertTrue(hibernate.commitTransaction());
+ }
+
+
+}
19 years, 7 months
JBoss Portal SVN: r5839 - in trunk/identity/src/main/org/jboss/portal/test/identity: . db_old ldap
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2006-12-13 10:39:20 -0500 (Wed, 13 Dec 2006)
New Revision: 5839
Added:
trunk/identity/src/main/org/jboss/portal/test/identity/UserProtoTestCase.java
trunk/identity/src/main/org/jboss/portal/test/identity/UserTest.java
trunk/identity/src/main/org/jboss/portal/test/identity/db_old/
trunk/identity/src/main/org/jboss/portal/test/identity/db_old/DBUserTestCase.java
trunk/identity/src/main/org/jboss/portal/test/identity/db_old/UserTest.java
Removed:
trunk/identity/src/main/org/jboss/portal/test/identity/UserTest.java
trunk/identity/src/main/org/jboss/portal/test/identity/db_old/DBUserTestCase.java
Modified:
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleRoleModuleTestCase.java
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleUserModuleTestCase.java
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticGroupMembershipModuleTestCase.java
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticRoleMembershipModuleTestCase.java
Log:
refactored identity tests for the new stuff
Added: trunk/identity/src/main/org/jboss/portal/test/identity/UserProtoTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/UserProtoTestCase.java 2006-12-13 15:36:15 UTC (rev 5838)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/UserProtoTestCase.java 2006-12-13 15:39:20 UTC (rev 5839)
@@ -0,0 +1,193 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.test.identity;
+
+import org.apache.log4j.Appender;
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.SimpleLayout;
+import org.apache.log4j.Logger;
+import org.apache.log4j.Level;
+import org.jboss.portal.identity2.IdentityContextImpl;
+import org.jboss.portal.identity2.IdentityServiceControllerImpl;
+import org.jboss.portal.identity2.IdentityContext;
+import org.jboss.portal.identity2.service.IdentityModuleService;
+import org.jboss.portal.test.framework.TestRuntimeContext;
+import org.jboss.portal.test.framework.embedded.HibernateSupport;
+import org.jboss.portal.identity.Role;
+import org.jboss.portal.identity.db.RoleImpl;
+import org.jboss.portal.identity.db.UserImpl;
+import org.hibernate.SessionFactory;
+import org.hibernate.Session;
+import org.hibernate.EntityMode;
+import org.hibernate.Query;
+import org.hibernate.Transaction;
+
+import javax.naming.InitialContext;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss dot com">Boleslaw Dawidowicz</a>
+ * @version $Revision: 5247 $
+ */
+public class UserProtoTestCase extends junit.framework.TestCase
+{
+
+ private static final org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(UserProtoTestCase.class);
+
+ private HibernateSupport hibernate;
+
+ static
+ {
+ Appender appender = new ConsoleAppender(new SimpleLayout());
+ Logger.getRoot().addAppender(appender);
+ Logger.getRoot().setLevel(Level.INFO);
+ Logger.getLogger("org.jboss.portal.identity2").setLevel(Level.DEBUG);
+ }
+
+ /*public static TestSuite createTestSuite(Class clazz) throws Exception
+ {
+ URL configsURL = Thread.currentThread().getContextClassLoader().getResource("directories.xml");
+ Map parameterMap = new HashMap();
+ parameterMap.put("DirectoryServerConfig", DSConfig.fromXML2(configsURL));
+ POJOJUnitTest abc = new POJOJUnitTest(clazz);
+ JUnitAdapter adapter = new JUnitAdapter(abc);
+ TestSuite suite = new TestSuite();
+ suite.addTest(adapter);
+ return suite;
+ }*/
+
+ public UserProtoTestCase()
+ {
+
+ }
+
+ public HibernateSupport getHibernate()
+ {
+ return hibernate;
+ }
+
+ public void setHibernate(HibernateSupport hibernate)
+ {
+ this.hibernate = hibernate;
+ }
+
+ /*public ConfigurationTestCase(DSConfig dsConfig)
+ {
+ this.directoryServerConfigParameter = dsConfig;
+ }
+
+ private DSConfig directoryServerConfigParameter;
+
+ public String getName()
+ {
+ return super.getName();// + "," + directoryServerConfigParameter.getName() + "," + directoryServerConfigParameter.getDescription();
+ }
+
+ public DSConfig getDirectoryServerConfigParameter()
+ {
+ return directoryServerConfigParameter;
+ }
+
+ public void setDirectoryServerConfigParameter(DSConfig directoryServerConfigParameter)
+ {
+ this.directoryServerConfigParameter = directoryServerConfigParameter;
+ }*/
+
+ IdentityContextImpl context;
+
+
+ public void setUp() throws Exception
+ {
+ TestRuntimeContext runtimeContext = new TestRuntimeContext("org/jboss/portal/test/identity/proto-beans.xml");
+ runtimeContext.addBean("LDAPTestBean", this);
+ runtimeContext.addBean("HibernateConfig", HibernateSupport.getConfig("proto"));
+ runtimeContext.start();
+ this.context = new IdentityContextImpl();
+ context.start();
+ }
+
+
+ public void testSimle() throws Exception
+ {
+ log.info("I'm here");
+
+ //SessionFactory sf = (SessionFactory)new InitialContext().lookup("java:/TestSessionFactory");
+
+
+ Session es = hibernate.openSession();
+ //Session es = session.getSession(EntityMode.MAP);
+ Map lolo = new HashMap();
+ lolo.put("userName", "lolo");
+ //lolo.put("roles", new HashSet());
+ es.save("PortalUser", lolo);
+ Map dummy = new HashMap();
+ dummy.put("name", "dummy");
+ es.save("PortalRole", dummy);
+
+ Set roles = new HashSet();
+ roles.add(dummy);
+ lolo.put("roles",roles);
+ Map props = new HashMap();
+ props.put("theme", "pp");
+ props.put("signature", "alalala");
+ lolo.put("dynamic", props);
+ es.save("PortalUser", lolo);
+ hibernate.commitTransaction();
+
+ hibernate.openSession();
+ es = hibernate.getCurrentSession();
+ Query query = es.createQuery("from PortalUser where userName=:userName");
+ query.setParameter("userName", "lolo");
+ lolo = (Map)query.uniqueResult();
+ assertNotNull(lolo.get("roles"));
+ assertNotNull(lolo.get("dynamic"));
+ hibernate.commitTransaction();
+
+ //hibernate.openSession();
+
+ //Session es = hibernate.getCurrentSession();
+ /*Session es = sf.openSession();
+ Transaction tx = es.beginTransaction();
+ Map lolo = new HashMap();
+ lolo.put("userName", "lolo");
+ es.save("PortalUser", lolo);
+ Query query = es.createQuery("from PortalUser where userName=:userName");
+ query.setParameter("userName", "lolo");
+ lolo = (Map)query.uniqueResult();
+ tx.commit();
+ //hibernate.commitTransaction();
+
+
+ es = sf.getCurrentSession();
+ tx = es.beginTransaction();
+ query = es.createQuery("from PortalUser where userName=:userName");
+ query.setParameter("userName", "lolo");
+ lolo = (Map)query.uniqueResult();
+ //hibernate.commitTransaction();
+ tx.commit();*/
+ }
+
+
+}
Deleted: trunk/identity/src/main/org/jboss/portal/test/identity/UserTest.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/UserTest.java 2006-12-13 15:36:15 UTC (rev 5838)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/UserTest.java 2006-12-13 15:39:20 UTC (rev 5839)
@@ -1,393 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.test.identity;
-
-import junit.framework.Assert;
-import org.jboss.portal.common.util.CollectionBuilder;
-import org.jboss.portal.identity.IdentityException;
-import org.jboss.portal.identity.Role;
-import org.jboss.portal.identity.RoleModule;
-import org.jboss.portal.identity.User;
-import org.jboss.portal.identity.UserModule;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class UserTest extends Assert
-{
-
- /** . */
- private UserModule userModule;
-
- /** . */
- private RoleModule roleModule;
-
- /** . */
- private Context ctx;
-
- public void setUserModule(UserModule userModule)
- {
- this.userModule = userModule;
- }
-
- public void setRoleModule(RoleModule roleModule)
- {
- this.roleModule = roleModule;
- }
-
- public void setContext(Context ctx)
- {
- this.ctx = ctx;
- }
-
- public void testFindUsersUsingFilter() throws Exception
- {
- ctx.begin();
- 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);
- ctx.commit();
- }
-
- public void testFindUser1() throws Exception
- {
- ctx.begin();
- User u1 = userModule.findUserByUserName("user1");
- assertNotNull(u1);
- Assert.assertEquals("user1", u1.getUserName());
- assertNotNull(roleModule.getRoles(u1));
- Assert.assertEquals(1, roleModule.getRoles(u1).size());
- Assert.assertEquals("role1", ((Role)roleModule.getRoles(u1).iterator().next()).getName());
- Assert.assertEquals(u1.getId(), userModule.findUserById(u1.getId()).getId());
- ctx.commit();
- }
-
- public void testFindUser2() throws Exception
- {
- ctx.begin();
- Set roleNames = new HashSet(Arrays.asList(new Object[]{"role1", "role2"}));
- User u2 = userModule.findUserByUserName("user2");
- assertNotNull(u2);
- Assert.assertEquals("user2", u2.getUserName());
- assertNotNull(roleModule.getRoles(u2));
- Assert.assertEquals(2, roleModule.getRoles(u2).size());
- Iterator iterator = roleModule.getRoles(u2).iterator();
- assertTrue(roleNames.contains(((Role)iterator.next()).getName()));
- assertTrue(roleNames.contains(((Role)iterator.next()).getName()));
- Assert.assertEquals(u2.getId(), userModule.findUserById(u2.getId()).getId());
- ctx.commit();
- }
-
- public void testFindUsers() throws Exception
- {
- ctx.begin();
- Set c1 = userModule.findUsers(0, 1);
- assertNotNull(c1);
- assertEquals(1, c1.size());
-
- Set c2 = userModule.findUsers(1, 1);
- assertNotNull(c2);
- assertEquals(1, c2.size());
-
- Set c3 = userModule.findUsers(0, 2);
- assertNotNull(c3);
- assertEquals(2, c3.size());
-
- Set s1 = new HashSet();
- s1.add(((User)c1.iterator().next()).getUserName());
- s1.add(((User)c2.iterator().next()).getUserName());
- Set s2 = new HashSet();
- Iterator iterator = c3.iterator();
- s2.add(((User)iterator.next()).getUserName());
- s2.add(((User)iterator.next()).getUserName());
- assertEquals(s1, s2);
- ctx.commit();
- }
-
- public void testCreateUser() throws Exception
- {
- ctx.begin();
- User u3 = userModule.createUser("user3", "password", "realemail");
- Role g1 = roleModule.findRoleByName("role1");
- roleModule.setRoles(u3, Collections.singleton(g1));
- Assert.assertEquals("user3", u3.getUserName());
- assertNotNull(roleModule.getRoles(u3));
- Assert.assertEquals(1, roleModule.getRoles(u3).size());
- Assert.assertEquals("role1", ((Role)roleModule.getRoles(u3).iterator().next()).getName());
- ctx.commit();
-
- ctx.begin();
- u3 = userModule.findUserByUserName("user3");
- assertNotNull(u3);
- Assert.assertEquals("user3", u3.getUserName());
- assertNotNull(roleModule.getRoles(u3));
- Assert.assertEquals(1, roleModule.getRoles(u3).size());
- Assert.assertEquals("role1", ((Role)roleModule.getRoles(u3).iterator().next()).getName());
- ctx.commit();
- }
-
- // public void testCreateDuplicateUser() throws Exception
- // {
- // try
- // {
- // userModule.createUser("user1");
- // fail("Expected exception on duplicate user");
- // }
- // catch (ModuleException expected)
- // {
- // }
- // }
-
- public void testCreateRole() throws Exception
- {
- ctx.begin();
- Role g3 = roleModule.createRole("role3", "roleName");
- Assert.assertEquals("role3", g3.getName());
- ctx.commit();
-
- ctx.begin();
- g3 = roleModule.findRoleByName("role3");
- assertNotNull(g3);
- Assert.assertEquals("role3", g3.getName());
- ctx.commit();
- }
-
- // public void testCreateDuplicateRole() throws Exception
- // {
- // try
- // {
- // roleModule.createRole("user1");
- // fail("Expected exception on duplicate role");
- // }
- // catch (ModuleException expected)
- // {
- // }
- // }
-
- public void testCountUser() throws Exception
- {
- ctx.begin();
- Assert.assertEquals(2, userModule.getUserCount());
- ctx.commit();
- }
-
- public void testRemoveNonExistingRole() throws Exception
- {
- ctx.begin();
- try
- {
- roleModule.removeRole(new Long(Long.MAX_VALUE));
- fail("Expected exception");
- }
- catch (IdentityException expected)
- {
- }
- ctx.commit();
- }
-
- public void testRemoveRole() throws Exception
- {
- ctx.begin();
- Role g1 = roleModule.findRoleByName("role1");
- Object id = g1.getId();
- roleModule.removeRole(id);
- try
- {
- roleModule.findRoleById(id);
- fail("Expected exception");
- }
- catch (IdentityException expected)
- {
- }
- ctx.commit();
-
- ctx.begin();
- try
- {
- roleModule.findRoleById(id);
- fail("Expected exception");
- }
- catch (IdentityException expected)
- {
- }
- User u1 = userModule.findUserByUserName("user1");
- assertNotNull(u1);
- Assert.assertEquals("user1", u1.getUserName());
- ctx.commit();
- }
-
- public void testRemoveUser() throws Exception
- {
- ctx.begin();
- User u1 = userModule.findUserByUserName("user1");
- Object id = u1.getId();
- userModule.removeUser(id);
- try
- {
- userModule.findUserById(id);
- fail("Expected exception");
- }
- catch (IdentityException expected)
- {
- }
- ctx.commit();
-
- ctx.begin();
- try
- {
- userModule.findUserById(id);
- fail("Expected exception");
- }
- catch (IdentityException expected)
- {
- }
- Role g1 = roleModule.findRoleByName("role1");
- assertNotNull(g1);
- Assert.assertEquals("role1", g1.getName());
- Role g2 = roleModule.findRoleByName("role2");
- assertNotNull(g2);
- Assert.assertEquals("role2", g2.getName());
- ctx.commit();
- }
-
- public void testFindRoles() throws Exception
- {
- ctx.begin();
- Set roleNames = new HashSet(Arrays.asList(new Object[]{"role1", "role2"}));
- Set roles = roleModule.findRoles();
- assertEquals(2, roles.size());
- Iterator iterator = roles.iterator();
- assertTrue(roleNames.contains(((Role)iterator.next()).getName()));
- assertTrue(roleNames.contains(((Role)iterator.next()).getName()));
- ctx.commit();
- }
-
- public void testFindRoleMembers() throws Exception
- {
- ctx.begin();
- Set set1 = roleModule.findRoleMembers("role1", 0, 10, "user");
- 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 = roleModule.findRoleMembers("role1", 0, 10, "blah");
- assertEquals(0, set2.size());
-
- //
- Set set3 = roleModule.findRoleMembers("role1", 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 = roleModule.findRoleMembers("role1", 0, 10, "user1");
- 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);
- ctx.commit();
- }
-
- public void populate() throws Exception
- {
- ctx.begin();
- User u1 = userModule.createUser("user1", "", "");
- User u2 = userModule.createUser("user2", "", "");
- Role g1 = roleModule.createRole("role1", "role1");
- Role g2 = roleModule.createRole("role2", "role2");
- roleModule.setRoles(u1, Collections.singleton(g1));
- roleModule.setRoles(u2, new CollectionBuilder().add(g1).add(g2).toHashSet());
- ctx.commit();
- }
-
- public interface Context
- {
- void begin();
-
- void commit();
- }
-}
Added: trunk/identity/src/main/org/jboss/portal/test/identity/UserTest.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/UserTest.java 2006-12-13 15:36:15 UTC (rev 5838)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/UserTest.java 2006-12-13 15:39:20 UTC (rev 5839)
@@ -0,0 +1,411 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.test.identity;
+
+import junit.framework.Assert;
+import org.jboss.portal.identity2.UserModule;
+import org.jboss.portal.identity2.RoleModule;
+import org.jboss.portal.identity2.User;
+import org.jboss.portal.identity2.Role;
+import org.jboss.portal.identity2.MembershipModule;
+import org.jboss.portal.identity2.UserProfileModule;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.common.util.CollectionBuilder;
+
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Arrays;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class UserTest extends Assert
+{
+
+ /** . */
+ private UserModule userModule;
+
+ /** . */
+ private RoleModule roleModule;
+
+ /** . */
+ private MembershipModule membershipModule;
+
+ /** . */
+ private UserProfileModule userProfileModule;
+
+
+ /** . */
+ private UserTest.Context ctx;
+
+ public void setUserModule(UserModule userModule)
+ {
+ this.userModule = userModule;
+ }
+
+ public void setRoleModule(RoleModule roleModule)
+ {
+ this.roleModule = roleModule;
+ }
+
+ public void setMembershipModule(MembershipModule membershipModule)
+ {
+ this.membershipModule = membershipModule;
+ }
+
+ public void setUserProfileModule(UserProfileModule userProfileModule)
+ {
+ this.userProfileModule = userProfileModule;
+ }
+
+ public void setContext(UserTest.Context ctx)
+ {
+ this.ctx = ctx;
+ }
+
+ public void testFindUsersUsingFilter() throws Exception
+ {
+ ctx.begin();
+ 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);
+ ctx.commit();
+ }
+
+ public void testFindUser1() throws Exception
+ {
+ ctx.begin();
+ User u1 = userModule.findUserByUserName("user1");
+ assertNotNull(u1);
+ Assert.assertEquals("user1", u1.getUserName());
+ assertNotNull(membershipModule.getRoles(u1));
+ Assert.assertEquals(1, membershipModule.getRoles(u1).size());
+ Assert.assertEquals("role1", ((Role)membershipModule.getRoles(u1).iterator().next()).getName());
+ Assert.assertEquals(u1.getId(), userModule.findUserById(u1.getId()).getId());
+ ctx.commit();
+ }
+
+ public void testFindUser2() throws Exception
+ {
+ ctx.begin();
+ Set roleNames = new HashSet(Arrays.asList(new Object[]{"role1", "role2"}));
+ User u2 = userModule.findUserByUserName("user2");
+ assertNotNull(u2);
+ Assert.assertEquals("user2", u2.getUserName());
+ assertNotNull(membershipModule.getRoles(u2));
+ Assert.assertEquals(2, membershipModule.getRoles(u2).size());
+ Iterator iterator = membershipModule.getRoles(u2).iterator();
+ assertTrue(roleNames.contains(((Role)iterator.next()).getName()));
+ assertTrue(roleNames.contains(((Role)iterator.next()).getName()));
+ Assert.assertEquals(u2.getId(), userModule.findUserById(u2.getId()).getId());
+ ctx.commit();
+ }
+
+ public void testFindUsers() throws Exception
+ {
+ ctx.begin();
+ Set c1 = userModule.findUsers(0, 1);
+ assertNotNull(c1);
+ assertEquals(1, c1.size());
+
+ Set c2 = userModule.findUsers(1, 1);
+ assertNotNull(c2);
+ assertEquals(1, c2.size());
+
+ Set c3 = userModule.findUsers(0, 2);
+ assertNotNull(c3);
+ assertEquals(2, c3.size());
+
+ Set s1 = new HashSet();
+ s1.add(((User)c1.iterator().next()).getUserName());
+ s1.add(((User)c2.iterator().next()).getUserName());
+ Set s2 = new HashSet();
+ Iterator iterator = c3.iterator();
+ s2.add(((User)iterator.next()).getUserName());
+ s2.add(((User)iterator.next()).getUserName());
+ assertEquals(s1, s2);
+ ctx.commit();
+ }
+
+ public void testCreateUser() throws Exception
+ {
+ ctx.begin();
+ User u3 = userModule.createUser("user3", "password");
+ Role g1 = roleModule.findRoleByName("role1");
+ membershipModule.assignRoles(u3, Collections.singleton(g1));
+ Assert.assertEquals("user3", u3.getUserName());
+ assertNotNull(membershipModule.getRoles(u3));
+ Assert.assertEquals(1, membershipModule.getRoles(u3).size());
+ Assert.assertEquals("role1", ((Role)membershipModule.getRoles(u3).iterator().next()).getName());
+ ctx.commit();
+
+ ctx.begin();
+ u3 = userModule.findUserByUserName("user3");
+ assertNotNull(u3);
+ Assert.assertEquals("user3", u3.getUserName());
+ assertNotNull(membershipModule.getRoles(u3));
+ Assert.assertEquals(1, membershipModule.getRoles(u3).size());
+ Assert.assertEquals("role1", ((Role)membershipModule.getRoles(u3).iterator().next()).getName());
+ ctx.commit();
+ }
+
+ // public void testCreateDuplicateUser() throws Exception
+ // {
+ // try
+ // {
+ // userModule.createUser("user1");
+ // fail("Expected exception on duplicate user");
+ // }
+ // catch (ModuleException expected)
+ // {
+ // }
+ // }
+
+ public void testCreateRole() throws Exception
+ {
+ ctx.begin();
+ Role g3 = roleModule.createRole("role3", "roleName");
+ Assert.assertEquals("role3", g3.getName());
+ ctx.commit();
+
+ ctx.begin();
+ g3 = roleModule.findRoleByName("role3");
+ assertNotNull(g3);
+ Assert.assertEquals("role3", g3.getName());
+ ctx.commit();
+ }
+
+ // public void testCreateDuplicateRole() throws Exception
+ // {
+ // try
+ // {
+ // roleModule.createRole("user1");
+ // fail("Expected exception on duplicate role");
+ // }
+ // catch (ModuleException expected)
+ // {
+ // }
+ // }
+
+ public void testCountUser() throws Exception
+ {
+ ctx.begin();
+ Assert.assertEquals(2, userModule.getUserCount());
+ ctx.commit();
+ }
+
+ public void testRemoveNonExistingRole() throws Exception
+ {
+ ctx.begin();
+ try
+ {
+ roleModule.removeRole(new Long(Long.MAX_VALUE));
+ fail("Expected exception");
+ }
+ catch (IdentityException expected)
+ {
+ }
+ ctx.commit();
+ }
+
+ public void testRemoveRole() throws Exception
+ {
+ ctx.begin();
+ Role g1 = roleModule.findRoleByName("role1");
+ Object id = g1.getId();
+ roleModule.removeRole(id);
+ try
+ {
+ roleModule.findRoleById(id);
+ fail("Expected exception");
+ }
+ catch (IdentityException expected)
+ {
+ }
+ ctx.commit();
+
+ ctx.begin();
+ try
+ {
+ roleModule.findRoleById(id);
+ fail("Expected exception");
+ }
+ catch (IdentityException expected)
+ {
+ }
+ User u1 = userModule.findUserByUserName("user1");
+ assertNotNull(u1);
+ Assert.assertEquals("user1", u1.getUserName());
+ ctx.commit();
+ }
+
+ public void testRemoveUser() throws Exception
+ {
+ ctx.begin();
+ User u1 = userModule.findUserByUserName("user1");
+ Object id = u1.getId();
+ userModule.removeUser(id);
+ try
+ {
+ userModule.findUserById(id);
+ fail("Expected exception");
+ }
+ catch (IdentityException expected)
+ {
+ }
+ ctx.commit();
+
+ ctx.begin();
+ try
+ {
+ userModule.findUserById(id);
+ fail("Expected exception");
+ }
+ catch (IdentityException expected)
+ {
+ }
+ Role g1 = roleModule.findRoleByName("role1");
+ assertNotNull(g1);
+ Assert.assertEquals("role1", g1.getName());
+ Role g2 = roleModule.findRoleByName("role2");
+ assertNotNull(g2);
+ Assert.assertEquals("role2", g2.getName());
+ ctx.commit();
+ }
+
+ public void testFindRoles() throws Exception
+ {
+ ctx.begin();
+ Set roleNames = new HashSet(Arrays.asList(new Object[]{"role1", "role2"}));
+ Set roles = roleModule.findRoles();
+ assertEquals(2, roles.size());
+ Iterator iterator = roles.iterator();
+ assertTrue(roleNames.contains(((Role)iterator.next()).getName()));
+ assertTrue(roleNames.contains(((Role)iterator.next()).getName()));
+ ctx.commit();
+ }
+
+ public void testFindRoleMembers() throws Exception
+ {
+ ctx.begin();
+ Set set1 = membershipModule.findRoleMembers("role1", 0, 10, "user");
+ 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 = membershipModule.findRoleMembers("role1", 0, 10, "blah");
+ assertEquals(0, set2.size());
+
+ //
+ Set set3 = membershipModule.findRoleMembers("role1", 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 = membershipModule.findRoleMembers("role1", 0, 10, "user1");
+ 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);
+ ctx.commit();
+ }
+//
+ public void populate() throws Exception
+ {
+ ctx.begin();
+ User u1 = userModule.createUser("user1", "");
+ User u2 = userModule.createUser("user2", "");
+ Role g1 = roleModule.createRole("role1", "role1");
+ Role g2 = roleModule.createRole("role2", "role2");
+ membershipModule.assignRoles(u1, Collections.singleton(g1));
+ membershipModule.assignRoles(u2, new CollectionBuilder().add(g1).add(g2).toHashSet());
+ ctx.commit();
+ }
+
+ public interface Context
+ {
+ void begin();
+
+ void commit();
+ }
+}
Copied: trunk/identity/src/main/org/jboss/portal/test/identity/db_old (from rev 5770, trunk/identity/src/main/org/jboss/portal/test/identity/db)
Deleted: trunk/identity/src/main/org/jboss/portal/test/identity/db_old/DBUserTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/db/DBUserTestCase.java 2006-12-06 09:43:49 UTC (rev 5770)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/db_old/DBUserTestCase.java 2006-12-13 15:39:20 UTC (rev 5839)
@@ -1,326 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.test.identity.db;
-
-import junit.framework.TestSuite;
-import org.apache.log4j.Appender;
-import org.apache.log4j.ConsoleAppender;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.apache.log4j.SimpleLayout;
-import org.jboss.portal.common.test.junit.POJOJUnitTest;
-import org.jboss.portal.common.test.junit.JUnitAdapter;
-import org.jboss.portal.common.p3p.P3PConstants;
-import org.jboss.portal.identity.ProfileMap;
-import org.jboss.portal.identity.User;
-import org.jboss.portal.identity.db.DBRoleModuleImpl;
-import org.jboss.portal.identity.db.DBUserModuleImpl;
-import org.jboss.portal.test.framework.TestRuntimeContext;
-import org.jboss.portal.test.framework.embedded.DataSourceSupport;
-import org.jboss.portal.test.framework.embedded.HibernateSupport;
-import org.jboss.portal.test.identity.UserTest;
-
-import java.net.URL;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Map;
-import java.util.HashMap;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class DBUserTestCase extends junit.framework.TestCase implements UserTest.Context
-{
-
- static
- {
- Appender appender = new ConsoleAppender(new SimpleLayout());
- Logger.getRoot().addAppender(appender);
- Logger.getRoot().setLevel(Level.DEBUG);
- Logger.getLogger("org.hibernate").setLevel(Level.ERROR);
- }
-
- public static TestSuite suite() throws Exception
- {
- URL configsURL = Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
- Map parameterMap = new HashMap();
- parameterMap.put("DataSourceConfig", DataSourceSupport.Config.fromXML2(configsURL));
- POJOJUnitTest abc = new POJOJUnitTest(DBUserTestCase.class);
- JUnitAdapter adapter = new JUnitAdapter(abc, parameterMap);
- TestSuite suite = new TestSuite();
- suite.addTest(adapter);
- return suite;
- }
-
- /** . */
- private DataSourceSupport.Config dataSourceConfigParameter;
-
- /** . */
- private TestRuntimeContext runtimeContext;
-
- /** . */
- private HibernateSupport hibernate;
-
- /** . */
- private UserTest utc;
-
- /** . */
- private DBUserModuleImpl userModule;
-
- /** . */
- private DBRoleModuleImpl roleModule;
-
- public DataSourceSupport.Config getDataSourceConfigParameter()
- {
- return dataSourceConfigParameter;
- }
-
- public void setDataSourceConfigParameter(DataSourceSupport.Config dataSourceConfig)
- {
- this.dataSourceConfigParameter = dataSourceConfig;
- }
-
- public HibernateSupport getHibernate()
- {
- return hibernate;
- }
-
- public void setHibernate(HibernateSupport hibernate)
- {
- this.hibernate = hibernate;
- }
-
- public String getName()
- {
- return super.getName() + "," + dataSourceConfigParameter.getName();
- }
-
- public void setUp() throws Exception
- {
- runtimeContext = new TestRuntimeContext("org/jboss/portal/test/identity/db-beans.xml");
- runtimeContext.addBean("DBTestBean", this);
- runtimeContext.addBean("DataSourceConfig", dataSourceConfigParameter);
- runtimeContext.addBean("HibernateConfig", HibernateSupport.getConfig(dataSourceConfigParameter.getName()));
- runtimeContext.start();
-
- //
- utc = new UserTest();
- userModule = new DBUserModuleImpl();
- userModule.setSessionFactoryJNDIName("java:/SessionFactory");
- userModule.start();
-
- //
- roleModule = new DBRoleModuleImpl();
- roleModule.setSessionFactoryJNDIName("java:/SessionFactory");
- roleModule.start();
-
- //
- utc.setUserModule(userModule);
- utc.setRoleModule(roleModule);
- utc.setContext(this);
- utc.populate();
- }
-
- public void tearDown() throws Exception
- {
- utc.setUserModule(null);
- utc.setRoleModule(null);
- utc.setContext(null);
- utc = null;
-
- //
- roleModule.destroy();
- userModule.destroy();
- roleModule = null;
- userModule = null;
-
- //
- runtimeContext.stop();
- }
-
-
- public void begin()
- {
- hibernate.openSession();
- }
-
- public void commit()
- {
- assertTrue(hibernate.commitTransaction());
- }
-
- //
-
- public void testFindUsersUsingFilter() throws Exception
- {
- utc.testFindUsersUsingFilter();
- }
-
- public void testFindUser1() throws Exception
- {
- utc.testFindUser1();
- }
-
- public void testFindUser2() throws Exception
- {
- utc.testFindUser2();
- }
-
- public void testFindUsers() throws Exception
- {
- utc.testFindUsers();
- }
-
- public void testCreateUser() throws Exception
- {
- utc.testCreateUser();
- }
-
- public void testCreateRole() throws Exception
- {
- utc.testCreateRole();
- }
-
- public void testCountUser() throws Exception
- {
- utc.testCountUser();
- }
-
- public void testRemoveNonExistingRole() throws Exception
- {
- utc.testRemoveNonExistingRole();
- }
-
- public void testRemoveRole() throws Exception
- {
- utc.testRemoveRole();
- }
-
- public void testRemoveUser() throws Exception
- {
- utc.testRemoveUser();
- }
-
- public void testFindRoles() throws Exception
- {
- utc.testFindRoles();
- }
-
- public void testFindRoleMembers() throws Exception
- {
- utc.testFindRoleMembers();
- }
-
- public void testDynamicProperty() throws Exception
- {
- begin();
- User user = userModule.createUser("testname", "testpassword", "testemail");
- ProfileMap map = user.getProfile();
- assertNull(map.get("foo"));
- assertFalse(map.isReadOnly("foo"));
- map.put("foo", "value");
- assertEquals("value", map.get("foo"));
- assertFalse(map.isReadOnly("foo"));
- commit();
-
- begin();
- user = userModule.findUserByUserName("testname");
- map = user.getProfile();
- assertEquals("value", map.get("foo"));
- assertFalse(map.isReadOnly("foo"));
- commit();
- }
-
- public void testStaticProperty() throws Exception
- {
- begin();
-
- //
- User user = userModule.createUser("testname", "testpassword", "testemail");
- ProfileMap map = user.getProfile();
- assertEquals("testname", map.get(P3PConstants.INFO_USER_NAME_NICKNAME));
-
- // Test cannot remove a static property
- try
- {
- map.remove(P3PConstants.INFO_USER_NAME_GIVEN);
- fail("Should not be capable to remove static property");
- }
- catch (IllegalArgumentException expected)
- {
- }
-
- // Test read only property
- assertTrue(map.isReadOnly(P3PConstants.INFO_USER_NAME_NICKNAME));
- try
- {
- map.put(P3PConstants.INFO_USER_NAME_NICKNAME, "anothername");
- fail("Should not be capable to modify a read only static property");
- }
- catch (IllegalArgumentException expected)
- {
- }
-
- // Test non nullable and writable property
- try
- {
- map.put(User.INFO_USER_VIEW_EMAIL_VIEW_REAL, null);
- fail("Should not be capable to nullify a non nullable static property");
- }
- catch (NullPointerException expected)
- {
- }
- map.put(User.INFO_USER_VIEW_EMAIL_VIEW_REAL, "true");
- assertEquals(true, user.getViewRealEmail());
-
- // Test boolean property
- map.put(User.INFO_USER_VIEW_EMAIL_VIEW_REAL, "false");
- assertEquals("false", map.get(User.INFO_USER_VIEW_EMAIL_VIEW_REAL));
- assertEquals(false, user.getViewRealEmail());
- map.put(User.INFO_USER_VIEW_EMAIL_VIEW_REAL, "true");
- assertEquals("true", map.get(User.INFO_USER_VIEW_EMAIL_VIEW_REAL));
- assertEquals(true, user.getViewRealEmail());
- user.setViewRealEmail(false);
- assertEquals("false", map.get(User.INFO_USER_VIEW_EMAIL_VIEW_REAL));
- assertEquals(false, user.getViewRealEmail());
- user.setViewRealEmail(true);
- assertEquals("true", map.get(User.INFO_USER_VIEW_EMAIL_VIEW_REAL));
- assertEquals(true, user.getViewRealEmail());
- try
- {
- map.put(User.INFO_USER_VIEW_EMAIL_VIEW_REAL, "truee");
- fail("Should not be capable to set a bad value to boolean property");
- }
- catch (IllegalArgumentException expected)
- {
- }
-
- // Test date
- Date date = user.getRegistrationDate();
- SimpleDateFormat sdf = new SimpleDateFormat();
- assertEquals(sdf.format(date), map.get(User.INFO_USER_REGISTRATION_DATE));
-
- commit();
- }
-}
Copied: trunk/identity/src/main/org/jboss/portal/test/identity/db_old/DBUserTestCase.java (from rev 5809, trunk/identity/src/main/org/jboss/portal/test/identity/db/DBUserTestCase.java)
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/db/DBUserTestCase.java 2006-12-12 18:42:45 UTC (rev 5809)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/db_old/DBUserTestCase.java 2006-12-13 15:39:20 UTC (rev 5839)
@@ -0,0 +1,327 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.identity.db_old;
+
+import junit.framework.TestSuite;
+import org.apache.log4j.Appender;
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.SimpleLayout;
+import org.jboss.portal.common.test.junit.POJOJUnitTest;
+import org.jboss.portal.common.test.junit.JUnitAdapter;
+import org.jboss.portal.common.p3p.P3PConstants;
+import org.jboss.portal.identity.ProfileMap;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.identity.db.DBRoleModuleImpl;
+import org.jboss.portal.identity.db.DBUserModuleImpl;
+import org.jboss.portal.test.framework.TestRuntimeContext;
+import org.jboss.portal.test.framework.embedded.DataSourceSupport;
+import org.jboss.portal.test.framework.embedded.HibernateSupport;
+import org.jboss.portal.test.identity.db_old.UserTest;
+
+import java.net.URL;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class DBUserTestCase extends junit.framework.TestCase implements UserTest.Context
+{
+
+ static
+ {
+ Appender appender = new ConsoleAppender(new SimpleLayout());
+ Logger.getRoot().addAppender(appender);
+ Logger.getRoot().setLevel(Level.DEBUG);
+ Logger.getLogger("org.hibernate").setLevel(Level.ERROR);
+ }
+
+ public static TestSuite suite() throws Exception
+ {
+ URL configsURL = Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
+ Map parameterMap = new HashMap();
+ parameterMap.put("DataSourceConfig", DataSourceSupport.Config.fromXML2(configsURL));
+ POJOJUnitTest abc = new POJOJUnitTest(DBUserTestCase.class);
+ JUnitAdapter adapter = new JUnitAdapter(abc, parameterMap);
+ TestSuite suite = new TestSuite();
+ suite.addTest(adapter);
+ return suite;
+ }
+
+ /** . */
+ private DataSourceSupport.Config dataSourceConfigParameter;
+
+ /** . */
+ private TestRuntimeContext runtimeContext;
+
+ /** . */
+ private HibernateSupport hibernate;
+
+ /** . */
+ private UserTest utc;
+
+ /** . */
+ private DBUserModuleImpl userModule;
+
+ /** . */
+ private DBRoleModuleImpl roleModule;
+
+ public DataSourceSupport.Config getDataSourceConfigParameter()
+ {
+ return dataSourceConfigParameter;
+ }
+
+ public void setDataSourceConfigParameter(DataSourceSupport.Config dataSourceConfig)
+ {
+ this.dataSourceConfigParameter = dataSourceConfig;
+ }
+
+ public HibernateSupport getHibernate()
+ {
+ return hibernate;
+ }
+
+ public void setHibernate(HibernateSupport hibernate)
+ {
+ this.hibernate = hibernate;
+ }
+
+ public String getName()
+ {
+ return super.getName() + "," + dataSourceConfigParameter.getName();
+ }
+
+ public void setUp() throws Exception
+ {
+ runtimeContext = new TestRuntimeContext("org/jboss/portal/test/identity/db_old-beans.xml");
+ runtimeContext.addBean("DBTestBean", this);
+ runtimeContext.addBean("DataSourceConfig", dataSourceConfigParameter);
+ runtimeContext.addBean("HibernateConfig", HibernateSupport.getConfig(dataSourceConfigParameter.getName()));
+ runtimeContext.start();
+
+ //HibernateSupport.getConfig(dataSourceConfigParameter.getName()).
+ //
+ utc = new UserTest();
+ userModule = new DBUserModuleImpl();
+ userModule.setSessionFactoryJNDIName("java:/SessionFactory");
+ userModule.start();
+
+ //
+ roleModule = new DBRoleModuleImpl();
+ roleModule.setSessionFactoryJNDIName("java:/SessionFactory");
+ roleModule.start();
+
+ //
+ utc.setUserModule(userModule);
+ utc.setRoleModule(roleModule);
+ utc.setContext(this);
+ utc.populate();
+ }
+
+ public void tearDown() throws Exception
+ {
+ utc.setUserModule(null);
+ utc.setRoleModule(null);
+ utc.setContext(null);
+ utc = null;
+
+ //
+ roleModule.destroy();
+ userModule.destroy();
+ roleModule = null;
+ userModule = null;
+
+ //
+ runtimeContext.stop();
+ }
+
+
+ public void begin()
+ {
+ hibernate.openSession();
+ }
+
+ public void commit()
+ {
+ assertTrue(hibernate.commitTransaction());
+ }
+
+ //
+
+ public void testFindUsersUsingFilter() throws Exception
+ {
+ utc.testFindUsersUsingFilter();
+ }
+
+ public void testFindUser1() throws Exception
+ {
+ utc.testFindUser1();
+ }
+
+ public void testFindUser2() throws Exception
+ {
+ utc.testFindUser2();
+ }
+
+ public void testFindUsers() throws Exception
+ {
+ utc.testFindUsers();
+ }
+
+ public void testCreateUser() throws Exception
+ {
+ utc.testCreateUser();
+ }
+
+ public void testCreateRole() throws Exception
+ {
+ utc.testCreateRole();
+ }
+
+ public void testCountUser() throws Exception
+ {
+ utc.testCountUser();
+ }
+
+ public void testRemoveNonExistingRole() throws Exception
+ {
+ utc.testRemoveNonExistingRole();
+ }
+
+ public void testRemoveRole() throws Exception
+ {
+ utc.testRemoveRole();
+ }
+
+ public void testRemoveUser() throws Exception
+ {
+ utc.testRemoveUser();
+ }
+
+ public void testFindRoles() throws Exception
+ {
+ utc.testFindRoles();
+ }
+
+ public void testFindRoleMembers() throws Exception
+ {
+ utc.testFindRoleMembers();
+ }
+
+ public void testDynamicProperty() throws Exception
+ {
+ begin();
+ User user = userModule.createUser("testname", "testpassword", "testemail");
+ ProfileMap map = user.getProfile();
+ assertNull(map.get("foo"));
+ assertFalse(map.isReadOnly("foo"));
+ map.put("foo", "value");
+ assertEquals("value", map.get("foo"));
+ assertFalse(map.isReadOnly("foo"));
+ commit();
+
+ begin();
+ user = userModule.findUserByUserName("testname");
+ map = user.getProfile();
+ assertEquals("value", map.get("foo"));
+ assertFalse(map.isReadOnly("foo"));
+ commit();
+ }
+
+ public void testStaticProperty() throws Exception
+ {
+ begin();
+
+ //
+ User user = userModule.createUser("testname", "testpassword", "testemail");
+ ProfileMap map = user.getProfile();
+ assertEquals("testname", map.get(P3PConstants.INFO_USER_NAME_NICKNAME));
+
+ // Test cannot remove a static property
+ try
+ {
+ map.remove(P3PConstants.INFO_USER_NAME_GIVEN);
+ fail("Should not be capable to remove static property");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ // Test read only property
+ assertTrue(map.isReadOnly(P3PConstants.INFO_USER_NAME_NICKNAME));
+ try
+ {
+ map.put(P3PConstants.INFO_USER_NAME_NICKNAME, "anothername");
+ fail("Should not be capable to modify a read only static property");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ // Test non nullable and writable property
+ try
+ {
+ map.put(User.INFO_USER_VIEW_EMAIL_VIEW_REAL, null);
+ fail("Should not be capable to nullify a non nullable static property");
+ }
+ catch (NullPointerException expected)
+ {
+ }
+ map.put(User.INFO_USER_VIEW_EMAIL_VIEW_REAL, "true");
+ assertEquals(true, user.getViewRealEmail());
+
+ // Test boolean property
+ map.put(User.INFO_USER_VIEW_EMAIL_VIEW_REAL, "false");
+ assertEquals("false", map.get(User.INFO_USER_VIEW_EMAIL_VIEW_REAL));
+ assertEquals(false, user.getViewRealEmail());
+ map.put(User.INFO_USER_VIEW_EMAIL_VIEW_REAL, "true");
+ assertEquals("true", map.get(User.INFO_USER_VIEW_EMAIL_VIEW_REAL));
+ assertEquals(true, user.getViewRealEmail());
+ user.setViewRealEmail(false);
+ assertEquals("false", map.get(User.INFO_USER_VIEW_EMAIL_VIEW_REAL));
+ assertEquals(false, user.getViewRealEmail());
+ user.setViewRealEmail(true);
+ assertEquals("true", map.get(User.INFO_USER_VIEW_EMAIL_VIEW_REAL));
+ assertEquals(true, user.getViewRealEmail());
+ try
+ {
+ map.put(User.INFO_USER_VIEW_EMAIL_VIEW_REAL, "truee");
+ fail("Should not be capable to set a bad value to boolean property");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ // Test date
+ Date date = user.getRegistrationDate();
+ SimpleDateFormat sdf = new SimpleDateFormat();
+ assertEquals(sdf.format(date), map.get(User.INFO_USER_REGISTRATION_DATE));
+
+ commit();
+ }
+}
Copied: trunk/identity/src/main/org/jboss/portal/test/identity/db_old/UserTest.java (from rev 5770, trunk/identity/src/main/org/jboss/portal/test/identity/UserTest.java)
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/UserTest.java 2006-12-06 09:43:49 UTC (rev 5770)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/db_old/UserTest.java 2006-12-13 15:39:20 UTC (rev 5839)
@@ -0,0 +1,393 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.identity.db_old;
+
+import junit.framework.Assert;
+import org.jboss.portal.common.util.CollectionBuilder;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.Role;
+import org.jboss.portal.identity.RoleModule;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.identity.UserModule;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class UserTest extends Assert
+{
+
+ /** . */
+ private UserModule userModule;
+
+ /** . */
+ private RoleModule roleModule;
+
+ /** . */
+ private Context ctx;
+
+ public void setUserModule(UserModule userModule)
+ {
+ this.userModule = userModule;
+ }
+
+ public void setRoleModule(RoleModule roleModule)
+ {
+ this.roleModule = roleModule;
+ }
+
+ public void setContext(Context ctx)
+ {
+ this.ctx = ctx;
+ }
+
+ public void testFindUsersUsingFilter() throws Exception
+ {
+ ctx.begin();
+ 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);
+ ctx.commit();
+ }
+
+ public void testFindUser1() throws Exception
+ {
+ ctx.begin();
+ User u1 = userModule.findUserByUserName("user1");
+ assertNotNull(u1);
+ Assert.assertEquals("user1", u1.getUserName());
+ assertNotNull(roleModule.getRoles(u1));
+ Assert.assertEquals(1, roleModule.getRoles(u1).size());
+ Assert.assertEquals("role1", ((Role)roleModule.getRoles(u1).iterator().next()).getName());
+ Assert.assertEquals(u1.getId(), userModule.findUserById(u1.getId()).getId());
+ ctx.commit();
+ }
+
+ public void testFindUser2() throws Exception
+ {
+ ctx.begin();
+ Set roleNames = new HashSet(Arrays.asList(new Object[]{"role1", "role2"}));
+ User u2 = userModule.findUserByUserName("user2");
+ assertNotNull(u2);
+ Assert.assertEquals("user2", u2.getUserName());
+ assertNotNull(roleModule.getRoles(u2));
+ Assert.assertEquals(2, roleModule.getRoles(u2).size());
+ Iterator iterator = roleModule.getRoles(u2).iterator();
+ assertTrue(roleNames.contains(((Role)iterator.next()).getName()));
+ assertTrue(roleNames.contains(((Role)iterator.next()).getName()));
+ Assert.assertEquals(u2.getId(), userModule.findUserById(u2.getId()).getId());
+ ctx.commit();
+ }
+
+ public void testFindUsers() throws Exception
+ {
+ ctx.begin();
+ Set c1 = userModule.findUsers(0, 1);
+ assertNotNull(c1);
+ assertEquals(1, c1.size());
+
+ Set c2 = userModule.findUsers(1, 1);
+ assertNotNull(c2);
+ assertEquals(1, c2.size());
+
+ Set c3 = userModule.findUsers(0, 2);
+ assertNotNull(c3);
+ assertEquals(2, c3.size());
+
+ Set s1 = new HashSet();
+ s1.add(((User)c1.iterator().next()).getUserName());
+ s1.add(((User)c2.iterator().next()).getUserName());
+ Set s2 = new HashSet();
+ Iterator iterator = c3.iterator();
+ s2.add(((User)iterator.next()).getUserName());
+ s2.add(((User)iterator.next()).getUserName());
+ assertEquals(s1, s2);
+ ctx.commit();
+ }
+
+ public void testCreateUser() throws Exception
+ {
+ ctx.begin();
+ User u3 = userModule.createUser("user3", "password", "realemail");
+ Role g1 = roleModule.findRoleByName("role1");
+ roleModule.setRoles(u3, Collections.singleton(g1));
+ Assert.assertEquals("user3", u3.getUserName());
+ assertNotNull(roleModule.getRoles(u3));
+ Assert.assertEquals(1, roleModule.getRoles(u3).size());
+ Assert.assertEquals("role1", ((Role)roleModule.getRoles(u3).iterator().next()).getName());
+ ctx.commit();
+
+ ctx.begin();
+ u3 = userModule.findUserByUserName("user3");
+ assertNotNull(u3);
+ Assert.assertEquals("user3", u3.getUserName());
+ assertNotNull(roleModule.getRoles(u3));
+ Assert.assertEquals(1, roleModule.getRoles(u3).size());
+ Assert.assertEquals("role1", ((Role)roleModule.getRoles(u3).iterator().next()).getName());
+ ctx.commit();
+ }
+
+ // public void testCreateDuplicateUser() throws Exception
+ // {
+ // try
+ // {
+ // userModule.createUser("user1");
+ // fail("Expected exception on duplicate user");
+ // }
+ // catch (ModuleException expected)
+ // {
+ // }
+ // }
+
+ public void testCreateRole() throws Exception
+ {
+ ctx.begin();
+ Role g3 = roleModule.createRole("role3", "roleName");
+ Assert.assertEquals("role3", g3.getName());
+ ctx.commit();
+
+ ctx.begin();
+ g3 = roleModule.findRoleByName("role3");
+ assertNotNull(g3);
+ Assert.assertEquals("role3", g3.getName());
+ ctx.commit();
+ }
+
+ // public void testCreateDuplicateRole() throws Exception
+ // {
+ // try
+ // {
+ // roleModule.createRole("user1");
+ // fail("Expected exception on duplicate role");
+ // }
+ // catch (ModuleException expected)
+ // {
+ // }
+ // }
+
+ public void testCountUser() throws Exception
+ {
+ ctx.begin();
+ Assert.assertEquals(2, userModule.getUserCount());
+ ctx.commit();
+ }
+
+ public void testRemoveNonExistingRole() throws Exception
+ {
+ ctx.begin();
+ try
+ {
+ roleModule.removeRole(new Long(Long.MAX_VALUE));
+ fail("Expected exception");
+ }
+ catch (IdentityException expected)
+ {
+ }
+ ctx.commit();
+ }
+
+ public void testRemoveRole() throws Exception
+ {
+ ctx.begin();
+ Role g1 = roleModule.findRoleByName("role1");
+ Object id = g1.getId();
+ roleModule.removeRole(id);
+ try
+ {
+ roleModule.findRoleById(id);
+ fail("Expected exception");
+ }
+ catch (IdentityException expected)
+ {
+ }
+ ctx.commit();
+
+ ctx.begin();
+ try
+ {
+ roleModule.findRoleById(id);
+ fail("Expected exception");
+ }
+ catch (IdentityException expected)
+ {
+ }
+ User u1 = userModule.findUserByUserName("user1");
+ assertNotNull(u1);
+ Assert.assertEquals("user1", u1.getUserName());
+ ctx.commit();
+ }
+
+ public void testRemoveUser() throws Exception
+ {
+ ctx.begin();
+ User u1 = userModule.findUserByUserName("user1");
+ Object id = u1.getId();
+ userModule.removeUser(id);
+ try
+ {
+ userModule.findUserById(id);
+ fail("Expected exception");
+ }
+ catch (IdentityException expected)
+ {
+ }
+ ctx.commit();
+
+ ctx.begin();
+ try
+ {
+ userModule.findUserById(id);
+ fail("Expected exception");
+ }
+ catch (IdentityException expected)
+ {
+ }
+ Role g1 = roleModule.findRoleByName("role1");
+ assertNotNull(g1);
+ Assert.assertEquals("role1", g1.getName());
+ Role g2 = roleModule.findRoleByName("role2");
+ assertNotNull(g2);
+ Assert.assertEquals("role2", g2.getName());
+ ctx.commit();
+ }
+
+ public void testFindRoles() throws Exception
+ {
+ ctx.begin();
+ Set roleNames = new HashSet(Arrays.asList(new Object[]{"role1", "role2"}));
+ Set roles = roleModule.findRoles();
+ assertEquals(2, roles.size());
+ Iterator iterator = roles.iterator();
+ assertTrue(roleNames.contains(((Role)iterator.next()).getName()));
+ assertTrue(roleNames.contains(((Role)iterator.next()).getName()));
+ ctx.commit();
+ }
+
+ public void testFindRoleMembers() throws Exception
+ {
+ ctx.begin();
+ Set set1 = roleModule.findRoleMembers("role1", 0, 10, "user");
+ 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 = roleModule.findRoleMembers("role1", 0, 10, "blah");
+ assertEquals(0, set2.size());
+
+ //
+ Set set3 = roleModule.findRoleMembers("role1", 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 = roleModule.findRoleMembers("role1", 0, 10, "user1");
+ 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);
+ ctx.commit();
+ }
+
+ public void populate() throws Exception
+ {
+ ctx.begin();
+ User u1 = userModule.createUser("user1", "", "");
+ User u2 = userModule.createUser("user2", "", "");
+ Role g1 = roleModule.createRole("role1", "role1");
+ Role g2 = roleModule.createRole("role2", "role2");
+ roleModule.setRoles(u1, Collections.singleton(g1));
+ roleModule.setRoles(u2, new CollectionBuilder().add(g1).add(g2).toHashSet());
+ ctx.commit();
+ }
+
+ public interface Context
+ {
+ void begin();
+
+ void commit();
+ }
+}
Property changes on: trunk/identity/src/main/org/jboss/portal/test/identity/db_old/UserTest.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleRoleModuleTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleRoleModuleTestCase.java 2006-12-13 15:36:15 UTC (rev 5838)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleRoleModuleTestCase.java 2006-12-13 15:39:20 UTC (rev 5839)
@@ -85,7 +85,7 @@
IdentityServiceControllerImpl controller = new IdentityServiceControllerImpl();
controller.setConfigFile(getDirectoryServerConfigParameter().getConfigFile());
- controller.setDefaultConfigFile("identityconfig/standardidentity-config.xml");
+ controller.setDefaultConfigFile("test/config/standardidentity-config.xml");
controller.setRegisterMBeans(false);
controller.start();
identityContext = controller.getIdentityContext();
Modified: trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleUserModuleTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleUserModuleTestCase.java 2006-12-13 15:36:15 UTC (rev 5838)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleUserModuleTestCase.java 2006-12-13 15:39:20 UTC (rev 5839)
@@ -83,7 +83,7 @@
IdentityServiceControllerImpl controller = new IdentityServiceControllerImpl();
controller.setConfigFile(getDirectoryServerConfigParameter().getConfigFile());
- controller.setDefaultConfigFile("identityconfig/standardidentity-config.xml");
+ controller.setDefaultConfigFile("test/config/standardidentity-config.xml");
controller.setRegisterMBeans(false);
controller.start();
identityContext = controller.getIdentityContext();
@@ -120,7 +120,7 @@
public void testCreateUser() throws Exception
{
- LDAPUserImpl ldapu = (LDAPUserImpl)userModule.createUser("testUser", "testPassword", "email");
+ LDAPUserImpl ldapu = (LDAPUserImpl)userModule.createUser("testUser", "testPassword");
assertNotNull(ldapu);
assertEquals("testUser", ldapu.getUserName());
Modified: trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticGroupMembershipModuleTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticGroupMembershipModuleTestCase.java 2006-12-13 15:36:15 UTC (rev 5838)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticGroupMembershipModuleTestCase.java 2006-12-13 15:39:20 UTC (rev 5839)
@@ -79,7 +79,7 @@
IdentityServiceControllerImpl controller = new IdentityServiceControllerImpl();
controller.setConfigFile(getDirectoryServerConfigParameter().getConfigFile());
- controller.setDefaultConfigFile("identityconfig/standardidentity-config.xml");
+ controller.setDefaultConfigFile("test/config/standardidentity-config.xml");
controller.setRegisterMBeans(false);
controller.start();
identityContext = controller.getIdentityContext();
Modified: trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticRoleMembershipModuleTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticRoleMembershipModuleTestCase.java 2006-12-13 15:36:15 UTC (rev 5838)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticRoleMembershipModuleTestCase.java 2006-12-13 15:39:20 UTC (rev 5839)
@@ -76,7 +76,7 @@
IdentityServiceControllerImpl controller = new IdentityServiceControllerImpl();
controller.setConfigFile(getDirectoryServerConfigParameter().getConfigFile());
- controller.setDefaultConfigFile("identityconfig/standardidentity-config.xml");
+ controller.setDefaultConfigFile("test/config/standardidentity-config.xml");
controller.setRegisterMBeans(false);
controller.start();
identityContext = controller.getIdentityContext();
19 years, 7 months