Author: bdaw
Date: 2007-03-19 11:43:20 -0400 (Mon, 19 Mar 2007)
New Revision: 6747
Removed:
trunk/identity/src/main/org/jboss/portal/test/identity/ConfigurationTestCase.java
trunk/identity/src/main/org/jboss/portal/test/identity/MembershipStrategyTest.java
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/ldap/LDAPUserTestCase.java
trunk/identity/src/resources/experimental/
trunk/identity/src/resources/portal-identity-test-jar/org/jboss/portal/test/identity/proto-beans.xml
Modified:
trunk/identity/src/main/org/jboss/portal/test/identity/db/DBIdentityTestCase.java
trunk/identity/src/main/org/jboss/portal/test/identity/db/DBTestCase.java
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPIdentityTestCase.java
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPMembershipModuleTestCase.java
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticGroupMembershipModuleTestCase.java
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPTestCase.java
trunk/identity/src/resources/portal-identity-test-jar/org/jboss/portal/test/identity/ldap-beans.xml
trunk/test/src/etc/directories-extrolemodule.xml
trunk/test/src/etc/directories-extusermodule.xml
trunk/test/src/etc/directories-staticrolemembership.xml
Log:
- cleanup in identity testsuite
Deleted:
trunk/identity/src/main/org/jboss/portal/test/identity/ConfigurationTestCase.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/test/identity/ConfigurationTestCase.java 2007-03-19
14:54:27 UTC (rev 6746)
+++
trunk/identity/src/main/org/jboss/portal/test/identity/ConfigurationTestCase.java 2007-03-19
15:43:20 UTC (rev 6747)
@@ -1,151 +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 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.identity.IdentityContextImpl;
-import org.jboss.portal.identity.IdentityServiceControllerImpl;
-import org.jboss.portal.identity.IdentityContext;
-import org.jboss.portal.identity.service.IdentityModuleService;
-import org.jboss.portal.test.framework.TestRuntimeContext;
-
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @author <a href="mailto:boleslaw dot dawidowicz at jboss dot
com">Boleslaw Dawidowicz</a>
- * @version $Revision: 5247 $
- */
-public class ConfigurationTestCase extends junit.framework.TestCase
-{
-
- private static final org.jboss.logging.Logger log =
org.jboss.logging.Logger.getLogger(ConfigurationTestCase.class);
-
- 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 ConfigurationTestCase()
- {
-
- }
-
- /*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/ldap-beans.xml");
- runtimeContext.addBean("LDAPTestBean", this);
- runtimeContext.start();
- this.context = new IdentityContextImpl();
- context.start();
-
-
- }
-
- /*public void testSimpleConfigurationFactory() throws Exception
- {
- SimpleConfigurationImpl configuration = new SimpleConfigurationImpl();
- configuration.setIdentityContext(context);
- configuration.setConfigFile("identityconfig/test-config.xml");
- configuration.start();
- Set keys = configuration.getOptionGroups().keySet();
- log.info("Option Groups:");
- for (Iterator iterator = keys.iterator(); iterator.hasNext();)
- {
- String group = (String)iterator.next();
- log.info("option-group: " + group);
-
- log.info("Options:");
- Set names = configuration.getOptions(group).keySet();
- for (Iterator iterator1 = names.iterator(); iterator1.hasNext();)
- {
- String optionName = (String)iterator1.next();
- log.info("Name: " + optionName);
-
- }
-
- }
-
-
-
assertEquals("uid",configuration.getValue("user.uidAttributeId"));
- }*/
-
-
- public void testIdentityServiceController() throws Exception
- {
- IdentityServiceControllerImpl controller = new IdentityServiceControllerImpl();
- controller.setRegisterMBeans(false);
- controller.setConfigFile("config/minimal-ldap-identity-config.xml");
- controller.setDefaultConfigFile("config/standardidentity-config.xml");
- controller.start();
-
- IdentityModuleService service =
(IdentityModuleService)controller.getIdentityContext().getObject(IdentityContext.TYPE_USER_MODULE);
- assertEquals("java:/portal/UserModule", service.getJNDIName());
- }
-
-
-
-
-}
Deleted:
trunk/identity/src/main/org/jboss/portal/test/identity/MembershipStrategyTest.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/test/identity/MembershipStrategyTest.java 2007-03-19
14:54:27 UTC (rev 6746)
+++
trunk/identity/src/main/org/jboss/portal/test/identity/MembershipStrategyTest.java 2007-03-19
15:43:20 UTC (rev 6747)
@@ -1,88 +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.identity.MembershipModule;
-import org.jboss.portal.identity.RoleModule;
-import org.jboss.portal.identity.UserModule;
-
-/**
- * @author <a href="mailto:boleslaw dot dawidowicz at jboss dot
com">Boleslaw Dawidowicz</a>
- * @version $Revision: 2001 $
- */
-public class MembershipStrategyTest extends Assert
-{
- private static final org.jboss.logging.Logger log =
org.jboss.logging.Logger.getLogger(MembershipStrategyTest.class);
-
- /** . */
- private MembershipStrategyTest.Context ctx;
-
- protected MembershipModule membership;
-
- protected UserModule userModule;
-
- protected RoleModule roleModule;
-
- public void setContext(MembershipStrategyTest.Context ctx)
- {
- this.ctx = ctx;
- }
-
- public void setMembershipModule(MembershipModule membership)
- {
- this.membership = membership;
- }
-
- public void setUserModule(UserModule userModule)
- {
- this.userModule = userModule;
- }
-
- public void setRoleModule(RoleModule roleModule)
- {
- this.roleModule = roleModule;
- }
-
- public void testFirstSimple() throws Exception
- {
- log.info("first test");
- }
-
- public void testSecondSimple() throws Exception
- {
- log.info("second test");
- }
-
- public void testThirdSimple() throws Exception
- {
- log.info("third test");
- }
-
- public interface Context
- {
- void begin();
-
- void commit();
- }
-}
Deleted: trunk/identity/src/main/org/jboss/portal/test/identity/UserProtoTestCase.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/test/identity/UserProtoTestCase.java 2007-03-19
14:54:27 UTC (rev 6746)
+++
trunk/identity/src/main/org/jboss/portal/test/identity/UserProtoTestCase.java 2007-03-19
15:43:20 UTC (rev 6747)
@@ -1,183 +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 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.identity.IdentityContextImpl;
-import org.jboss.portal.test.framework.TestRuntimeContext;
-import org.jboss.portal.test.framework.embedded.HibernateSupport;
-import org.hibernate.Session;
-import org.hibernate.Query;
-
-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.identity").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 2007-03-19
14:54:27 UTC (rev 6746)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/UserTest.java 2007-03-19
15:43:20 UTC (rev 6747)
@@ -1,411 +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.identity.UserModule;
-import org.jboss.portal.identity.RoleModule;
-import org.jboss.portal.identity.User;
-import org.jboss.portal.identity.Role;
-import org.jboss.portal.identity.MembershipModule;
-import org.jboss.portal.identity.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();
- }
-}
Modified:
trunk/identity/src/main/org/jboss/portal/test/identity/db/DBIdentityTestCase.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/test/identity/db/DBIdentityTestCase.java 2007-03-19
14:54:27 UTC (rev 6746)
+++
trunk/identity/src/main/org/jboss/portal/test/identity/db/DBIdentityTestCase.java 2007-03-19
15:43:20 UTC (rev 6747)
@@ -27,9 +27,7 @@
import org.jboss.portal.identity.service.UserProfileModuleService;
import org.jboss.portal.identity.service.MembershipModuleService;
import org.jboss.portal.identity.service.RoleModuleService;
-import org.jboss.portal.test.identity.UserTest;
import org.jboss.portal.test.identity.IdentityTest;
-import org.jboss.portal.common.p3p.P3PConstants;
import junit.framework.TestSuite;
import java.util.Date;
Modified: trunk/identity/src/main/org/jboss/portal/test/identity/db/DBTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/db/DBTestCase.java 2007-03-19
14:54:27 UTC (rev 6746)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/db/DBTestCase.java 2007-03-19
15:43:20 UTC (rev 6747)
@@ -24,7 +24,6 @@
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.test.identity.IdentityTest;
import org.jboss.portal.common.test.junit.POJOJUnitTest;
import org.jboss.portal.common.test.junit.JUnitAdapter;
Modified:
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPIdentityTestCase.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPIdentityTestCase.java 2007-03-19
14:54:27 UTC (rev 6746)
+++
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPIdentityTestCase.java 2007-03-19
15:43:20 UTC (rev 6747)
@@ -1,18 +1,12 @@
package org.jboss.portal.test.identity.ldap;
-import org.jboss.portal.test.identity.db.DBTestCase;
-import org.jboss.portal.test.identity.db.DBIdentityTestCase;
-import org.jboss.portal.test.identity.UserTest;
import org.jboss.portal.test.identity.IdentityTest;
import org.jboss.portal.identity.IdentityServiceControllerImpl;
import org.jboss.portal.identity.IdentityContext;
-import org.jboss.portal.identity.User;
-import org.jboss.portal.identity.ProfileMap;
import org.jboss.portal.identity.UserModule;
import org.jboss.portal.identity.RoleModule;
import org.jboss.portal.identity.MembershipModule;
import org.jboss.portal.identity.UserProfileModule;
-import org.jboss.portal.identity.db.HibernateUserImpl;
import org.jboss.portal.identity.service.UserModuleService;
import org.jboss.portal.identity.service.RoleModuleService;
import org.jboss.portal.identity.service.MembershipModuleService;
@@ -34,7 +28,7 @@
*/
public class LDAPIdentityTestCase extends LDAPTestCase implements IdentityTest.Context
{
- private static final org.jboss.logging.Logger log =
org.jboss.logging.Logger.getLogger(DBTestCase.class);
+ private static final org.jboss.logging.Logger log =
org.jboss.logging.Logger.getLogger(LDAPIdentityTestCase.class);
static
{
Modified:
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPMembershipModuleTestCase.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPMembershipModuleTestCase.java 2007-03-19
14:54:27 UTC (rev 6746)
+++
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPMembershipModuleTestCase.java 2007-03-19
15:43:20 UTC (rev 6747)
@@ -32,27 +32,9 @@
public abstract class LDAPMembershipModuleTestCase extends LDAPTestCase
{
- /** . */
- //protected MembershipStrategyTest mstc;
-
public void setUp() throws Exception
{
- //mstc = new MembershipStrategyTest();
super.setUp();
}
- /*public void testFirstSimple() throws Exception
- {
- mstc.testFirstSimple();
- }
-
- public void testSecondSimple() throws Exception
- {
- mstc.testSecondSimple();
- }
-
- public void testThirdSimple() throws Exception
- {
- mstc.testThirdSimple();
- }*/
}
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 2007-03-19
14:54:27 UTC (rev 6746)
+++
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticGroupMembershipModuleTestCase.java 2007-03-19
15:43:20 UTC (rev 6747)
@@ -188,10 +188,6 @@
assertTrue(names.contains((prefix + "=jduke3,ou=People," +
suffix).toLowerCase()));
assertTrue(names.contains((prefix + "=jduke4,ou=People," +
suffix).toLowerCase()));
- /*membershipModule.assignUsers(role,new HashSet());
- users = membershipModule.getUsers(role);
-
- assertEquals(0, users.size());*/
}
Modified: trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPTestCase.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPTestCase.java 2007-03-19
14:54:27 UTC (rev 6746)
+++
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPTestCase.java 2007-03-19
15:43:20 UTC (rev 6747)
@@ -56,7 +56,7 @@
* @author <a href="mailto:boleslaw dot dawidowicz at jboss dot
com">Boleslaw Dawidowicz</a>
* @version $Revision: 5247 $
*/
-public abstract class LDAPTestCase extends junit.framework.TestCase //implements
MembershipStrategyTest.Context
+public abstract class LDAPTestCase extends junit.framework.TestCase
{
private static final org.jboss.logging.Logger log =
org.jboss.logging.Logger.getLogger(LDAPTestCase.class);
@@ -141,7 +141,6 @@
runtimeContext = new
TestRuntimeContext("org/jboss/portal/test/identity/ldap-beans.xml");
runtimeContext.addBean("LDAPTestBean", this);
- runtimeContext.addBean("DBTestBean", this);
runtimeContext.addBean("HibernateSupport", hibernate);
runtimeContext.addBean("DataSourceConfig", dataSourceConfigParameter);
HibernateSupport.Config config =
HibernateSupport.getConfig(dataSourceConfigParameter.getName());
Deleted:
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPUserTestCase.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPUserTestCase.java 2007-03-19
14:54:27 UTC (rev 6746)
+++
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPUserTestCase.java 2007-03-19
15:43:20 UTC (rev 6747)
@@ -1,412 +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.ldap;
-
-import junit.framework.TestSuite;
-//import org.apache.directory.server.protocol.shared.store.LdifFileLoader;
-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.test.framework.TestRuntimeContext;
-import org.jboss.portal.test.framework.embedded.DSConfig;
-import org.jboss.portal.test.identity.UserTest;
-
-import javax.naming.Binding;
-import javax.naming.Context;
-import javax.naming.NamingEnumeration;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.InitialDirContext;
-import java.net.URL;
-import java.util.Hashtable;
-import java.util.Map;
-import java.util.HashMap;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @author <a href="mailto:boleslaw dot dawidowicz at jboss dot
com">Boleslaw Dawidowicz</a>
- * @version $Revision: 5247 $
- */
-public class LDAPUserTestCase extends junit.framework.TestCase implements
UserTest.Context
-{
-
- private static final org.jboss.logging.Logger log =
org.jboss.logging.Logger.getLogger(LDAPUserTestCase.class);
-
- public static TestSuite suite() throws Exception
- {
- URL configsURL =
Thread.currentThread().getContextClassLoader().getResource("directories.xml");
- Map parameterMap = new HashMap();
- parameterMap.put("DirectoryServerConfig",
DSConfig.fromXML2(configsURL));
- POJOJUnitTest abc = new POJOJUnitTest(LDAPUserTestCase.class);
- JUnitAdapter adapter = new JUnitAdapter(abc, parameterMap);
- TestSuite suite = new TestSuite();
- suite.addTest(adapter);
- return suite;
- }
-
- static
- {
- Appender appender = new ConsoleAppender(new SimpleLayout());
- Logger.getRoot().addAppender(appender);
- Logger.getRoot().setLevel(Level.INFO);
- }
-
- /** . */
- private TestRuntimeContext runtimeContext;
-
- /** . */
- private DSConfig directoryServerConfigParameter;
-
- /** . */
- private UserTest utc;
-
- /** . */
- //private HibernateUserModuleImpl userModule;
-
- public DSConfig getDirectoryServerConfigParameter()
- {
- return directoryServerConfigParameter;
- }
-
- public void setDirectoryServerConfigParameter(DSConfig
directoryServerConfigParameter)
- {
- this.directoryServerConfigParameter = directoryServerConfigParameter;
- }
-
- /** . */
- //private HibernateRoleModuleImpl roleModule;
-
-
-
- public String getName()
- {
- return super.getName() + "," + directoryServerConfigParameter.getName() +
"," + directoryServerConfigParameter.getDescription();
- }
-
- protected void setUp() throws Exception
- {
- runtimeContext = new
TestRuntimeContext("org/jboss/portal/test/identity/ldap-beans.xml");
- runtimeContext.addBean("LDAPTestBean", this);
- runtimeContext.start();
-
- //
- utc = new UserTest();
- /*
- userModule = new HibernateUserModuleImpl();
- userModule.setSessionFactoryJNDIName("java:/SessionFactory");
- userModule.start();
-
- //
- roleModule = new HibernateRoleModuleImpl();
- roleModule.setSessionFactoryJNDIName("java:/SessionFactory");
- roleModule.start();
-
- //
- utc.setUserModule(userModule);
- utc.setRoleModule(roleModule);
- utc.setContext(this);
- utc.populate();*/
-
- try
- {
- //on start load the content into ldap
-
- DirContext ctx = getDirContext();
- ClassLoader tcl = Thread.currentThread().getContextClassLoader();
-
- URL ldif = tcl.getResource("ldap/ldif/example1.ldif");
- log.info("ldif to load by loader: " + ldif.getPath());
-
- /*LdifFileLoader loader = new LdifFileLoader(ctx, ldif.getPath());
- loader.execute();*/
- }
- catch (Exception e)
- {
- log.info("fail to import initial ldif for tests", e);
- }
- }
-
- protected void tearDown() throws Exception
- {
-
- /*utc.setUserModule(null);
- utc.setRoleModule(null);
- utc.setContext(null);
- utc = null;
-
- //
- roleModule.destroy();
- userModule.destroy();
- roleModule = null;
- userModule = null;*/
-
- //
- //on exit remove dc=jboss,dc=org
- try
- {
- DirContext ctx = getDirContext();
- DirContext org = (DirContext)ctx.lookup("dc=org");
- removeContext(org, "dc=jboss");
- }
- catch (Exception e)
- {
- log.info("fail to unbind content from tests", e);
- }
-
- runtimeContext.stop();
- }
-
-
- public void begin()
- {
-
- }
-
-
- public void commit()
- {
-
-
- }
-
-
- public void testSimple() throws Exception
- {
- log.info("simple test");
- DirContext ctx = getDirContext();
- DirContext org = (DirContext)ctx.lookup("dc=org");
- NamingEnumeration bindings = ctx.listBindings("dc=org");
- log.info("listing before remove: ");
- while (bindings.hasMore())
- {
-
- Binding bd = (Binding)bindings.next();
- //log.info("name enum element: " + bd.getClass().getName());
- log.info(bd.getName() + ": " + bd.getObject());
- }
-
- //removeContext(org,"dc=jboss");
-
- bindings = ctx.listBindings("dc=org");
- log.info("listing after remove: ");
- while (bindings.hasMore())
- {
- Binding bd = (Binding)bindings.next();
- log.info(bd.getName() + ": " + bd.getObject());
- }
- }
-
- public void testSecondSimple() throws Exception
- {
- log.info("second test");
- }
-
- public void testThirdSimple() throws Exception
- {
- log.info("third test");
- }
- //
-
- /*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();
- }*/
-
- private DirContext getDirContext() throws Exception
- {
- Hashtable env = new Hashtable();
- env.put(Context.INITIAL_CONTEXT_FACTORY,
directoryServerConfigParameter.getContextFactory());
- env.put(Context.PROVIDER_URL, directoryServerConfigParameter.getHost());
- env.put(Context.SECURITY_AUTHENTICATION, "simple");
- env.put(Context.SECURITY_PRINCIPAL, directoryServerConfigParameter.getAdminDN());
- env.put(Context.SECURITY_CREDENTIALS,
directoryServerConfigParameter.getAdminPassword());
- return new InitialDirContext(env);
- }
-
- //subsequent remove of javax.naming.Context
- private void removeContext(Context mainCtx, String name) throws Exception
- {
- Context deleteCtx = (Context)mainCtx.lookup(name);
- NamingEnumeration subDirs = mainCtx.listBindings(name);
-
- while (subDirs.hasMoreElements())
- {
- Binding binding = (Binding)subDirs.nextElement();
- String subName = binding.getName();
-
- removeContext(deleteCtx, subName);
- }
-
- mainCtx.unbind(name);
- }
-}
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 2007-03-19
14:54:27 UTC (rev 6746)
+++
trunk/identity/src/resources/portal-identity-test-jar/org/jboss/portal/test/identity/ldap-beans.xml 2007-03-19
15:43:20 UTC (rev 6747)
@@ -73,12 +73,11 @@
</bean>
- <bean name="LDAPTestBean"
class="org.jboss.portal.test.identity.ldap.LDAPUserTestCase">
+ <bean name="LDAPTestBean"
class="org.jboss.portal.test.identity.ldap.LDAPTestCase">
<constructor factoryMethod="getBean">
<factory bean="BeanFactory"/>
<parameter>LDAPTestBean</parameter>
</constructor>
- <!--<depends>ApacheDSService</depends>-->
</bean>
</deployment>
Deleted:
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 2007-03-19
14:54:27 UTC (rev 6746)
+++
trunk/identity/src/resources/portal-identity-test-jar/org/jboss/portal/test/identity/proto-beans.xml 2007-03-19
15:43:20 UTC (rev 6747)
@@ -1,83 +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. ~
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
-
-<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>
Modified: trunk/test/src/etc/directories-extrolemodule.xml
===================================================================
--- trunk/test/src/etc/directories-extrolemodule.xml 2007-03-19 14:54:27 UTC (rev 6746)
+++ trunk/test/src/etc/directories-extrolemodule.xml 2007-03-19 15:43:20 UTC (rev 6747)
@@ -34,7 +34,7 @@
<populate-ldif>ldap/ldif/initial-tests-qa-opends.ldif</populate-ldif>
<cleanup-dn>dc=example,dc=com</cleanup-dn>
</directory>
- <!--<directory>
+ <directory>
<directory-name>RedHatDS</directory-name>
<description>RedHat Directory in QA Labs (need vpn access) -
StaticGroupMembership config</description>
@@ -70,7 +70,7 @@
<description>OpenLDAP Directory in QA Labs (need vpn access) -
StaticGroupMembership config</description>
<config-file>test/config/identity/openldap-config.xml</config-file>
- <host>dev09.qa.atl.jboss.com</host>
+ <host>dev39.qa.atl.jboss.com</host>
<port>389</port>
<context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
<admin-dn>cn=Manager,dc=my-domain,dc=com</admin-dn>
@@ -79,7 +79,7 @@
<populate-ldif>ldap/ldif/initial-tests-notpopulated-openldap.ldif</populate-ldif>
<cleanup-dn>dc=testsuite,dc=portal,dc=my-domain,dc=com</cleanup-dn>
- </directory>-->
+ </directory>
<!--<directory>
<directory-name>MSAD</directory-name>
<description>Microsoft Active Directory in QA Labs (need vpn
access)</description>
Modified: trunk/test/src/etc/directories-extusermodule.xml
===================================================================
--- trunk/test/src/etc/directories-extusermodule.xml 2007-03-19 14:54:27 UTC (rev 6746)
+++ trunk/test/src/etc/directories-extusermodule.xml 2007-03-19 15:43:20 UTC (rev 6747)
@@ -34,7 +34,7 @@
<populate-ldif>ldap/ldif/initial-tests-qa-opends.ldif</populate-ldif>
<cleanup-dn>dc=example,dc=com</cleanup-dn>
</directory>
- <!--<directory>
+ <directory>
<directory-name>RedHatDS</directory-name>
<description>RedHat Directory in QA Labs (need vpn access) -
StaticGroupMembership config</description>
@@ -70,7 +70,7 @@
<description>OpenLDAP Directory in QA Labs (need vpn access) -
StaticGroupMembership config</description>
<config-file>test/config/identity/openldap-config.xml</config-file>
- <host>dev09.qa.atl.jboss.com</host>
+ <host>dev39.qa.atl.jboss.com</host>
<port>389</port>
<context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
<admin-dn>cn=Manager,dc=my-domain,dc=com</admin-dn>
@@ -79,7 +79,7 @@
<populate-ldif>ldap/ldif/initial-tests-notpopulated-openldap.ldif</populate-ldif>
<cleanup-dn>dc=testsuite,dc=portal,dc=my-domain,dc=com</cleanup-dn>
- </directory>-->
+ </directory>
<!--<directory>
<directory-name>MSAD</directory-name>
<description>Microsoft Active Directory in QA Labs (need vpn
access)</description>
Modified: trunk/test/src/etc/directories-staticrolemembership.xml
===================================================================
--- trunk/test/src/etc/directories-staticrolemembership.xml 2007-03-19 14:54:27 UTC (rev
6746)
+++ trunk/test/src/etc/directories-staticrolemembership.xml 2007-03-19 15:43:20 UTC (rev
6747)
@@ -57,7 +57,7 @@
<description>OpenLDAP Directory in QA Labs (need vpn
access)</description>
<config-file>test/config/openldap-config.xml</config-file>
- <host>dev09.qa.atl.jboss.com</host>
+ <host>dev39.qa.atl.jboss.com</host>
<port>389</port>
<context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
<admin-dn>cn=Manager,dc=my-domain,dc=com</admin-dn>