Author: hfnukal
Date: 2011-11-07 18:25:18 -0500 (Mon, 07 Nov 2011)
New Revision: 8005
Removed:
epp/portal/branches/EPP_5_2_Branch/component/identity/src/test/java/org/exoplatform/services/organization/TestBootstrap.java
epp/portal/branches/EPP_5_2_Branch/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganization.java
epp/portal/branches/EPP_5_2_Branch/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganizationService.java
epp/portal/branches/EPP_5_2_Branch/component/identity/src/test/resources/org/exoplatform/services/organization/TestOrganization-configuration.xml
epp/portal/branches/EPP_5_2_Branch/component/identity/src/test/resources/org/exoplatform/services/organization/TestOrganizationService-configuration.xml
Log:
JBEPP-1309 Change package for test
Deleted:
epp/portal/branches/EPP_5_2_Branch/component/identity/src/test/java/org/exoplatform/services/organization/TestBootstrap.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/identity/src/test/java/org/exoplatform/services/organization/TestBootstrap.java 2011-11-07
21:02:25 UTC (rev 8004)
+++
epp/portal/branches/EPP_5_2_Branch/component/identity/src/test/java/org/exoplatform/services/organization/TestBootstrap.java 2011-11-07
23:25:18 UTC (rev 8005)
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * 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.exoplatform.services.organization;
-
-import org.exoplatform.component.test.AbstractKernelTest;
-import org.exoplatform.component.test.ConfigurationUnit;
-import org.exoplatform.component.test.ConfiguredBy;
-import org.exoplatform.component.test.ContainerScope;
-import org.exoplatform.container.PortalContainer;
-import org.exoplatform.services.database.HibernateService;
-import org.exoplatform.services.organization.impl.UserImpl;
-
-@ConfiguredBy({@ConfigurationUnit(scope = ContainerScope.PORTAL, path =
"conf/exo.portal.component.identity-configuration.xml")})
-public class TestBootstrap extends AbstractKernelTest
-{
-
- public void testWorkspace() throws Exception
- {
- PortalContainer container = PortalContainer.getInstance();
- HibernateService hibernate =
(HibernateService)container.getComponentInstanceOfType(HibernateService.class);
- assertNotNull(hibernate);
- OrganizationService organization =
(OrganizationService)container.getComponentInstanceOfType(OrganizationService.class);
- assertNotNull(organization);
- }
-
- public void testBasicOperation() throws Exception
- {
- PortalContainer container = PortalContainer.getInstance();
- OrganizationService organization =
(OrganizationService)container.getComponentInstanceOfType(OrganizationService.class);
- assertNotNull(organization);
-
- begin();
- User test = new UserImpl("testUser");
- organization.getUserHandler().createUser(test, false);
-
- test = organization.getUserHandler().findUserByName("toto");
- assertNull(test);
- test = organization.getUserHandler().findUserByName("testUser");
- assertNotNull(test);
- end();
- }
-
-}
\ No newline at end of file
Deleted:
epp/portal/branches/EPP_5_2_Branch/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganization.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganization.java 2011-11-07
21:02:25 UTC (rev 8004)
+++
epp/portal/branches/EPP_5_2_Branch/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganization.java 2011-11-07
23:25:18 UTC (rev 8005)
@@ -1,238 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * 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.exoplatform.services.organization;
-
-import junit.framework.Assert;
-import org.exoplatform.commons.utils.PageList;
-import org.exoplatform.component.test.AbstractKernelTest;
-import org.exoplatform.component.test.ConfigurationUnit;
-import org.exoplatform.component.test.ConfiguredBy;
-import org.exoplatform.component.test.ContainerScope;
-import org.exoplatform.container.PortalContainer;
-import org.exoplatform.services.organization.GroupHandler;
-import org.exoplatform.services.organization.OrganizationService;
-import org.exoplatform.services.organization.User;
-import org.exoplatform.services.organization.UserHandler;
-
-import java.util.Collection;
-import java.util.List;
-
-/**
- * Created by The eXo Platform SARL Author : Tung Pham thanhtungty(a)gmail.com Nov
- * 13, 2007
- */
-@ConfiguredBy({
- @ConfigurationUnit(scope = ContainerScope.PORTAL, path =
"conf/exo.portal.component.test.jcr-configuration.xml"),
- @ConfigurationUnit(scope = ContainerScope.PORTAL, path =
"conf/exo.portal.component.identity-configuration.xml"),
- @ConfigurationUnit(scope = ContainerScope.PORTAL, path =
"org/exoplatform/services/organization/TestOrganization-configuration.xml")
-})
-public class TestOrganization extends AbstractKernelTest
-{
-
- private static final String GROUP_1 = "testOrganization_group1";
- private static final String GROUP_2 = "testOrganization_group2";
- private static final String GROUP_3 = "testOrganization_group3";
-
- private static final String USER_1 = "testOrganization_user1";
- private static final String USER_2 = "testOrganization_user2";
- private static final String USER_3 = "testOrganization_user3";
- private static final String DEFAULT_PASSWORD = "defaultpassword";
- private static final String DESCRIPTION = " Description";
-
- private OrganizationService organizationService;
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- begin();
- PortalContainer container = getContainer();
- organizationService =
(OrganizationService)container.getComponentInstance(OrganizationService.class);
-
- createGroup(null, GROUP_1);
- createGroup(GROUP_1, GROUP_2);
- createGroup(GROUP_1, GROUP_3);
-
- createUser(USER_1, GROUP_1);
- createUser(USER_2, GROUP_2);
- createUser(USER_3, GROUP_1);
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- deleteGroup(GROUP_1);
- deleteGroup(GROUP_2);
- deleteGroup(GROUP_3);
-
- deleteUser(USER_1);
- deleteUser(USER_2);
- deleteUser(USER_3);
-
- end();
- super.tearDown();
- }
-
- public void testFindGroupNotFound() throws Exception {
- GroupHandler groupHander = organizationService.getGroupHandler();
- Group group = groupHander.findGroupById(GROUP_1 + "NOTFOUND");
- assertNull(group);
- }
-
- public void testFindGroupFromRoot() throws Exception
- {
- GroupHandler handler = organizationService.getGroupHandler();
- Collection allGroups = handler.findGroups(null);
- Assert.assertTrue(allGroups.size() > 0);
- }
-
- public void testFindGroupById() throws Exception
- {
- GroupHandler groupHandler = organizationService.getGroupHandler();
- Group group = groupHandler.findGroupById(GROUP_1);
- assertNotNull(group);
- assertEquals(GROUP_1, group.getGroupName());
- assertEquals(GROUP_1 + DESCRIPTION, group.getDescription());
-
- group = groupHandler.findGroupById(GROUP_3);
- assertNotNull(group);
- assertEquals(GROUP_3, group.getGroupName());
- }
-
- public void testFindGroupOfUser() {
- GroupHandler groupHandler = organizationService.getGroupHandler();
- try {
- Collection<Group> groups = groupHandler.findGroupsOfUser(USER_1);
- assertNotNull(groups);
- assertTrue(groups.size() >= 1);
- } catch (Exception e) {
- fail();
- }
- }
-
- public void testFindUserByGroup() throws Exception
- {
- GroupHandler groupHandler = organizationService.getGroupHandler();
- Group group = groupHandler.findGroupById(GROUP_1);
- UserHandler uHandler = organizationService.getUserHandler();
- PageList users = uHandler.findUsersByGroup("/platform/administrators");
- Assert.assertTrue(users.getAvailable() > 0);
-
- List iterator = users.getAll();
- for (Object test : iterator)
- {
- User a = (User)test;
- System.out.println(a.getUserName());
- }
- }
-
- public void testChangePassword() throws Exception
- {
- UserHandler uHandler = organizationService.getUserHandler();
- User user = uHandler.findUserByName("root");
- Assert.assertNotNull(user);
- Assert.assertTrue(uHandler.authenticate("root", "gtn"));
-
- // Test changing password
- user.setPassword("newPassword");
- uHandler.saveUser(user, false);
- user = uHandler.findUserByName("root");
- Assert.assertNotNull(user);
- Assert.assertTrue(uHandler.authenticate("root",
"newPassword"));
-
- // Reset to default password
- user.setPassword("gtn");
- uHandler.saveUser(user, false);
-
- }
-
- private void createGroup(String parent, String name)
- {
- GroupHandler groupHandler = organizationService.getGroupHandler();
- try
- {
- Group parentGroup = null;
- if (parent != null)
- {
- parentGroup = groupHandler.findGroupById(parent);
- }
- Group newGroup = groupHandler.createGroupInstance();
- newGroup.setGroupName(name);
- newGroup.setDescription(name + DESCRIPTION);
- newGroup.setLabel(name);
- if (parentGroup != null)
- {
- groupHandler.addChild(parentGroup, newGroup, true);
- }
- groupHandler.saveGroup(newGroup, true);
- }
-
- catch (Exception e)
- {
- e.printStackTrace();
- fail("Error on create group [" + name + "] " +
e.getMessage());
- }
- }
- private void deleteGroup(String name)
- {
- GroupHandler groupHandler = organizationService.getGroupHandler();
- try
- {
- Group group = groupHandler.findGroupById(name);
- groupHandler.removeGroup(group, true);
- }
- catch (Exception e)
- {
- }
- }
-
- private void createUser(String username, String... groups)
- {
- UserHandler userHandler = organizationService.getUserHandler();
- User user = userHandler.createUserInstance(username);
- user.setPassword(DEFAULT_PASSWORD);
- user.setFirstName("default");
- user.setLastName("default");
- user.setEmail("exo(a)exoportal.org");
- user.setOrganizationId(groups[0]);
- try
- {
- userHandler.createUser(user, true);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- fail("Error on create user: " + e.getMessage());
- }
- }
-
- private void deleteUser(String username)
- {
- UserHandler userHandler = organizationService.getUserHandler();
- try
- {
- userHandler.removeUser(username, true);
- }
- catch (Exception e)
- {
-
- }
- }
-}
Deleted:
epp/portal/branches/EPP_5_2_Branch/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganizationService.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganizationService.java 2011-11-07
21:02:25 UTC (rev 8004)
+++
epp/portal/branches/EPP_5_2_Branch/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganizationService.java 2011-11-07
23:25:18 UTC (rev 8005)
@@ -1,618 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * 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.exoplatform.services.organization;
-
-import org.exoplatform.commons.utils.PageList;
-import org.exoplatform.component.test.AbstractGateInTest;
-import org.exoplatform.component.test.AbstractKernelTest;
-import org.exoplatform.component.test.ConfigurationUnit;
-import org.exoplatform.component.test.ConfiguredBy;
-import org.exoplatform.component.test.ContainerScope;
-import org.exoplatform.container.PortalContainer;
-import org.exoplatform.container.component.ComponentRequestLifecycle;
-import org.exoplatform.container.component.RequestLifeCycle;
-import org.exoplatform.services.organization.idm.Config;
-import org.exoplatform.services.organization.idm.PicketLinkIDMOrganizationServiceImpl;
-import org.exoplatform.services.organization.idm.UserDAOImpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Created by The eXo Platform SAS Author : Hoa Pham
hoapham@exoplatform.com,phamvuxuanhoa(a)yahoo.com
- * Oct 27, 2005
- */
-
-@ConfiguredBy({
- @ConfigurationUnit(scope = ContainerScope.PORTAL, path =
"conf/exo.portal.component.test.jcr-configuration.xml"),
- @ConfigurationUnit(scope = ContainerScope.PORTAL, path =
"org/exoplatform/services/organization/TestOrganizationService-configuration.xml")
-})
-public class TestOrganizationService extends AbstractKernelTest
-{
-
- static String Group1 = "Group1";
-
- static String Group2 = "Group2";
-
- static String Group3 = "Group3";
-
- static String Benj = "Benj";
-
- static String Tuan = "Tuan";
-
- OrganizationService service_;
-
- UserHandler userHandler_;
-
- UserProfileHandler profileHandler_;
-
- GroupHandler groupHandler_;
-
- MembershipTypeHandler mtHandler_;
-
- MembershipHandler membershipHandler_;
-
- boolean runtest = true;
-
- private static final String USER = "test";
-
- private static final List<String> USERS;
-
- private static final int USERS_LIST_SIZE = 15;
-
- private PortalContainer manager;
-
- static
- {
- USERS = new ArrayList<String>(USERS_LIST_SIZE);
- for (int i = 0; i < USERS_LIST_SIZE; i++)
- USERS.add(USER + "_" + i);
- }
-
- public TestOrganizationService(String s)
- {
- super(s);
- }
-
- public void setUp() throws Exception
- {
- if (!runtest)
- return;
-
- manager = PortalContainer.getInstance();
- service_ =
(OrganizationService)manager.getComponentInstanceOfType(OrganizationService.class);
- userHandler_ = service_.getUserHandler();
- profileHandler_ = service_.getUserProfileHandler();
- groupHandler_ = service_.getGroupHandler();
- mtHandler_ = service_.getMembershipTypeHandler();
- membershipHandler_ = service_.getMembershipHandler();
-
-// ((ComponentRequestLifecycle)service_).startRequest(manager);
- RequestLifeCycle.begin((ComponentRequestLifecycle)service_);
-
- }
-
- public void tearDown() throws Exception
- {
- Query query = new Query();
- query.setUserName(USER + "*");
- PageList users = userHandler_.findUsers(query);
-
- List<User> allUsers = users.getAll();
-
- for (int i = allUsers.size() - 1; i >= 0; i--)
- {
- String userName = allUsers.get(i).getUserName();
- userHandler_.removeUser(userName, true);
- }
-
-// ((ComponentRequestLifecycle)service_).endRequest(manager);
- RequestLifeCycle.end();
- }
-
- public void testSimple() throws Exception
- {
- assertTrue(true);
- Config config =
((PicketLinkIDMOrganizationServiceImpl)service_).getConfiguration();
-
- assertNotNull(config);
- assertNotNull(config.getGroupTypeMappings());
- assertNotNull(config.getGroupTypeMappings().keySet());
-
- assertEquals(config.getGroupTypeMappings().keySet().size(), 5);
- assertEquals(config.getGroupTypeMappings().get("/"),
"root_type");
-
- assertEquals(config.getGroupType("/"), "root_type");
- assertEquals(config.getGroupType(null), "root_type");
- assertEquals(config.getGroupType("/platform"),
"platform_type");
- assertEquals(config.getGroupType("/platform/administrators"),
"platform_type");
- assertEquals(config.getGroupType("/platform/guests"),
"platform_type");
- assertEquals(config.getGroupType("/platform/users"),
"users_type");
- assertEquals(config.getGroupType("/platform/users/john"),
"platform_type");
- assertEquals(config.getGroupType("/organization/acme/france/offices"),
".organization.acme.france.offices");
-
assertEquals(config.getGroupType("/organization/acme/france/offices/paris"),
".organization.acme.france.offices.paris");
- assertEquals(config.getGroupType("/organization/acme/france"),
"france_type");
- assertEquals(config.getGroupType("/organization/acme"),
".organization.acme");
- assertEquals(config.getGroupType("/foo/bar"), ".foo.bar");
- assertEquals(config.getGroupType("/foo"), ".foo");
- assertEquals(config.getGroupType("/toto"), "toto_type");
- assertEquals(config.getGroupType("/toto/lolo"), "toto_type");
- assertEquals(config.getGroupType("/toto/lolo/tutu"),
"toto_type");
- }
-
- public void testUserPageSize() throws Exception
- {
- for (String name : USERS)
- createUser(name);
-
- Query query = new Query();
- PageList users = userHandler_.findUsers(query);
- // newly created plus one 'demo' from configuration
- assertEquals(USERS_LIST_SIZE + 1, users.getAll().size());
- assertEquals(1, users.getAvailablePage());
- for (Object o : users.getPage(1))
- {
- User u = (User)o;
- if (!u.getUserName().equals("demo"))
- assertTrue(USERS.contains(u.getUserName()));
- }
- }
-
- public void testUser() throws Exception
- {
- createUser(USER);
- User user = userHandler_.findUserByName(USER);
- assertTrue("Found user instance ", user != null);
- assertEquals("Expect user name is: ", USER, user.getUserName());
- UserProfile userProfile = profileHandler_.findUserProfileByName(USER);
- assertNull(profileHandler_.removeUserProfile(USER, true));
- assertNotNull(profileHandler_.findUserProfileByName(USER));
-
- userProfile = profileHandler_.createUserProfileInstance(USER);
- userProfile.getUserInfoMap().put("key", "value");
- profileHandler_.saveUserProfile(userProfile, true);
- userProfile = profileHandler_.findUserProfileByName(USER);
- assertTrue("Expect user profile is found: ", userProfile != null);
- assertEquals(userProfile.getUserInfoMap().get("key"),
"value");
-
- PageList users = userHandler_.findUsers(new Query());
- assertTrue("Expect 1 user found ", users.getAvailable() >= 1);
-
- /* Update user's information */
- user.setFirstName("Exo(Update)");
- userHandler_.saveUser(user, false);
- userProfile.getUserInfoMap().put("user.gender", "male");
- profileHandler_.saveUserProfile(userProfile, true);
- userProfile = profileHandler_.findUserProfileByName(USER);
-
- assertEquals("expect first name is", "Exo(Update)",
user.getFirstName());
- assertEquals("Expect profile is updated: user.gender is ",
"male", userProfile.getUserInfoMap()
- .get("user.gender"));
-
- PageList piterator = userHandler_.getUserPageList(10);
- // newly created 'test' and 'demo'
- assertEquals(2, piterator.currentPage().size());
-
-// membershipHandler_.removeMembershipByUser(USER,false);
- userHandler_.removeUser(USER, true);
- piterator = userHandler_.getUserPageList(10);
- // one 'demo'
- assertEquals(1, piterator.currentPage().size());
- assertNull("User: USER is removed: ",
userHandler_.findUserByName(USER));
- assertNull(" user's profile of USER was removed:",
profileHandler_.findUserProfileByName(USER));
- }
-
- public void testUniqueAttribute() throws Exception
- {
- if (userHandler_ instanceof UserDAOImpl)
- {
- UserDAOImpl ud = (UserDAOImpl)userHandler_;
-
- User user = userHandler_.createUserInstance("toto");
- user.setEmail("toto(a)gatein.org");
- userHandler_.createUser(user, true);
-
- user = userHandler_.createUserInstance("lolo");
- user.setEmail("lolo(a)gatein.org");
- userHandler_.createUser(user, true);
-
- // Find by unique attribute
- assertNull(ud.findUserByEmail("foobar"));
- user = ud.findUserByEmail("toto(a)gatein.org");
- assertNotNull(user);
- assertEquals("toto", user.getUserName());
-
- user = ud.findUserByEmail("lolo(a)gatein.org");
- assertNotNull(user);
- assertEquals("lolo", user.getUserName());
-
- ud.removeUser("toto", false);
- ud.removeUser("lolo", false);
-
- }
- }
-
- //
- public void testGroup() throws Exception
- {
- /* Create a parent group with name is: GroupParent */
- String parentName = "GroupParent";
- Group groupParent = groupHandler_.createGroupInstance();
- groupParent.setGroupName(parentName);
- groupParent.setDescription("This is description");
- groupHandler_.addChild(null, groupParent, true);
- groupParent = groupHandler_.findGroupById(groupParent.getId());
- assertEquals("GroupParent", groupParent.getGroupName());
- /* Create a child group with name: Group1 */
- Group groupChild1 = groupHandler_.createGroupInstance();
- groupChild1.setGroupName(Group1);
- groupChild1.setLabel("Group1 Label");
- groupHandler_.addChild(groupParent, groupChild1, true);
-
- assertEquals(groupHandler_.findGroupById(groupChild1.getId()).getLabel(),
"Group1 Label");
-
- groupChild1 = groupHandler_.findGroupById(groupChild1.getId());
- assertEquals(groupChild1.getParentId(), groupParent.getId());
- assertEquals("Expect group child's name is: ", Group1,
groupChild1.getGroupName());
- /* Update groupChild's information */
- groupChild1.setLabel("Group1 Label renamed");
- groupChild1.setDescription("new description ");
- groupHandler_.saveGroup(groupChild1, true);
-
- assertEquals(groupHandler_.findGroupById(groupChild1.getId()).getLabel(),
"Group1 Label renamed");
-
- /* Create a group child with name is: Group2 */
- Group groupChild2 = groupHandler_.createGroupInstance();
- groupChild2.setGroupName(Group2);
- groupHandler_.addChild(groupParent, groupChild2, true);
- groupChild2 = groupHandler_.findGroupById(groupChild2.getId());
- assertEquals(groupChild2.getParentId(), groupParent.getId());
- assertEquals("Expect group child's name is: ", Group2,
groupChild2.getGroupName());
- /*
- * find all child group in groupParent Expect result: 2 child group: group1,
- * group2
- */
- assertEquals("Expect number of child group in parent group is: ", 2,
groupHandler_.findGroups(groupParent).size());
- /* Remove a child group */
- groupHandler_.removeGroup(groupHandler_.findGroupById(groupChild1.getId()), true);
- assertNull("Expect child group has been removed: ",
groupHandler_.findGroupById(groupChild1.getId()));
- assertEquals("Expect only 1 child group in parent group", 1,
groupHandler_.findGroups(groupParent).size());
- /* Remove Parent group, all it's group child will be removed */
- groupHandler_.removeGroup(groupParent, true);
- assertEquals("Expect ParentGroup is removed:", null,
groupHandler_.findGroupById(groupParent.getId()));
- assertEquals("Expect all child group is removed: ", 0,
groupHandler_.findGroups(groupParent).size());
- }
-
- public void testMembershipType() throws Exception
- {
- /* Create a membershipType */
- String testType = "testType";
- MembershipType mt = mtHandler_.createMembershipTypeInstance();
- mt.setName(testType);
- mt.setDescription("This is a test");
- mt.setOwner("exo");
- mtHandler_.createMembershipType(mt, true);
- assertEquals("Expect mebershiptype is:", testType,
mtHandler_.findMembershipType(testType).getName());
-
- /* Update MembershipType's information */
- String desc = "This is a test (update)";
- mt.setDescription(desc);
- mtHandler_.saveMembershipType(mt, true);
- assertEquals("Expect membershiptype's description", desc,
mtHandler_.findMembershipType(testType)
- .getDescription());
-
- /* create another membershipType */
- mt = mtHandler_.createMembershipTypeInstance();
- mt.setName("anothertype");
- mt.setOwner("exo");
- mtHandler_.createMembershipType(mt, true);
-
- /*
- * find all membership type Expect result: 3 membershipType:
- * "testmembership", "anothertype" and
"member"(default membership type, it
- * is created at startup time)
- */
- assertEquals("Expect 3 membership in collection: ", 3,
mtHandler_.findMembershipTypes().size());
-
- /* remove "testmembership" */
- mtHandler_.removeMembershipType(testType, true);
- assertEquals("Membership type has been removed:", null,
mtHandler_.findMembershipType(testType));
- assertEquals("Expect 2 membership in collection(1 is default): ", 2,
mtHandler_.findMembershipTypes().size());
-
- /* remove "anothertype" */
- mtHandler_.removeMembershipType("anothertype", true);
- assertEquals("Membership type has been removed:", null,
mtHandler_.findMembershipType("anothertype"));
- assertEquals("Expect 1 membership in collection(default type): ", 1,
mtHandler_.findMembershipTypes().size());
- /* All membershipType was removed(except default membership) */
- }
-
- public void testMembership() throws Exception
- {
- /* Create 2 user: benj and tuan */
- User userBenj = createUser(Benj);
- User userTuan = createUser(Tuan);
-
- /* Create "Group1" */
- Group group1 = groupHandler_.createGroupInstance();
- group1.setGroupName(Group1);
- groupHandler_.addChild(null, group1, true);
- /* Create "Group2" */
- Group group2 = groupHandler_.createGroupInstance();
- group2.setGroupName(Group2);
- groupHandler_.addChild(null, group2, true);
-
- /* Create membership1 and assign Benj to "Group1" with this membership
*/
- MembershipType mt = mtHandler_.createMembershipTypeInstance();
- mt.setName("testmembership");
- mtHandler_.createMembershipType(mt, true);
-
- membershipHandler_.linkMembership(userBenj, group1, mt, true);
- membershipHandler_.linkMembership(userBenj, group2, mt, true);
- membershipHandler_.linkMembership(userTuan, group2, mt, true);
-
- mt = mtHandler_.createMembershipTypeInstance();
- mt.setName("membershipType2");
- mtHandler_.createMembershipType(mt, true);
- membershipHandler_.linkMembership(userBenj, group2, mt, true);
-
- mt = mtHandler_.createMembershipTypeInstance();
- mt.setName("membershipType3");
- mtHandler_.createMembershipType(mt, true);
- membershipHandler_.linkMembership(userBenj, group2, mt, true);
-
- /*
- * find all memberships in group2 Expect result: 4 membership: 3 for
- * Benj(testmebership, membershipType2, membershipType3) : 1 for
- * Tuan(testmembership)
- */
- assertEquals("Expect number of membership in group 2 is: ", 4,
membershipHandler_.findMembershipsByGroup(group2)
- .size());
-
- /*
- * find all memberships in "Group2" relate with Benj Expect result: 3
- * membership
- */
- assertEquals("Expect number of membership in " + Group2 + " relate
with benj is: ", 3, membershipHandler_
- .findMembershipsByUserAndGroup(Benj, group2.getId()).size());
-
- /*
- * find all memberships of Benj in all group Expect result: 5 membership: 3
- * memberships in "Group2", 1 membership in "Users" (default) :
1 membership
- * in "group1"
- */
- assertEquals("expect membership is: ", 5,
membershipHandler_.findMembershipsByUser(Benj).size());
-
- /*
- * find memberships of Benj in "Group2" with membership type: testType
- * Expect result: 1 membership with membershipType is "testType"
- * (testmembership)
- */
- Membership membership =
- membershipHandler_.findMembershipByUserGroupAndType(Benj, group2.getId(),
"testmembership");
- assertNotNull("Expect membership is found:", membership);
- assertEquals("Expect membership type is: ", "testmembership",
membership.getMembershipType());
- assertEquals("Expect groupId of this membership is: ", group2.getId(),
membership.getGroupId());
- assertEquals("Expect user of this membership is: ", Benj,
membership.getUserName());
-
- /*
- * find all groups of Benj Expect result: 3 group: "Group1",
"Group2" and
- * "user" ("user" is default group)
- */
- assertEquals("expect group is: ", 3,
groupHandler_.findGroupsOfUser(Benj).size());
-
- /*
- * find all groups has membership type "TYPE" relate with Benj expect
- * result: 2 group: "Group1" and "Group2"
- */
- assertEquals("expect group is: ", 2,
groupHandler_.findGroupByMembership(Benj, "testmembership").size());
-
- /* remove a membership */
- String memId =
- membershipHandler_.findMembershipByUserGroupAndType(Benj, group2.getId(),
"membershipType3").getId();
- membershipHandler_.removeMembership(memId, true);
- assertNull("Membership was removed: ",
membershipHandler_.findMembershipByUserGroupAndType(Benj, "/" + Group2,
- "membershipType3"));
-
- /*
- * remove a user Expect result: all membership related with user will be
- * remove
- */
- userHandler_.removeUser(Tuan, true);
- assertNull("This user was removed", userHandler_.findUserByName(Tuan));
-
- assertTrue("All membership related with this user was removed: ",
membershipHandler_.findMembershipsByUser(Tuan)
- .isEmpty());
-
- /*
- * Remove a group Expect result: all membership associate with this group
- * will be removed
- */
- groupHandler_.removeGroup(group1, true);
- assertNull("This group was removed ",
groupHandler_.findGroupById(group1.getId()));
- assertTrue(membershipHandler_.findMembershipsByGroup(group1).isEmpty());
-
- /*
- * Remove a MembershipType Expect result: All membership have this type will
- * be removed
- */
- mtHandler_.removeMembershipType("testmembership", true);
-
- assertNull("This membershipType was removed: ",
mtHandler_.findMembershipType("testmembership"));
- /*
- * Check all memberships associate with all groups to guarantee that no
- * membership associate with removed membershipType
- */
- for (Object o : groupHandler_.findGroups(null))
- {
- Group g = (Group)o;
- for (Object o1 : membershipHandler_.findMembershipsByGroup(g))
- {
- Membership m = (Membership)o1;
- assertFalse("MembershipType of this membership is not:
\"testmembership\"", m.getMembershipType()
- .equalsIgnoreCase("testmembership"));
- }
- }
- }
-
- public void testRemoveMembershipByUser() throws Exception
- {
- String Benj = "B";
- String Tuan = "T";
- User userBenj = createUser(Benj);
- User userTuan = createUser(Tuan);
-
- String Group1 = "G1";
- String Group2 = "G2";
- String Group3 = "G3";
- Group group1 = groupHandler_.createGroupInstance();
- group1.setGroupName(Group1);
- groupHandler_.addChild(null, group1, true);
- Group group2 = groupHandler_.createGroupInstance();
- group2.setGroupName(Group2);
- groupHandler_.addChild(null, group2, true);
- Group group3 = groupHandler_.createGroupInstance();
- group3.setGroupName(Group3);
- groupHandler_.addChild(null, group3, true);
-
- MembershipType mt = mtHandler_.createMembershipTypeInstance();
- mt.setName("testmembership_");
- mtHandler_.createMembershipType(mt, true);
-
- membershipHandler_.linkMembership(userBenj, group1, mt, true);
- membershipHandler_.linkMembership(userBenj, group2, mt, true);
- membershipHandler_.linkMembership(userBenj, group3, mt, true);
- membershipHandler_.linkMembership(userTuan, group1, mt, true);
-
- assertEquals(membershipHandler_.removeMembershipByUser(Tuan, true).size(), 2);
- assertEquals(membershipHandler_.removeMembershipByUser(Benj, true).size(), 4);
-
- mtHandler_.removeMembershipType("testmembership_", true);
- userHandler_.removeUser(Tuan, true);
- userHandler_.removeUser(Benj, true);
- groupHandler_.removeGroup(group1, true);
- groupHandler_.removeGroup(group2, true);
- groupHandler_.removeGroup(group3, true);
- }
-
-// public void testUserProfileListener() throws Exception
-// {
-// UserProfileListener l = new UserProfileListener();
-// profileHandler_.addUserProfileEventListener(l);
-// User user = createUser(USER);
-// assertNotNull(user);
-// UserProfile profile =
profileHandler_.createUserProfileInstance(user.getUserName());
-// profile.setAttribute("blah", "blah");
-// profileHandler_.saveUserProfile(profile, true);
-// assertTrue(l.preSave && l.postSave);
-// profileHandler_.removeUserProfile(user.getUserName(), true);
-// assertFalse(l.preDelete && l.postDelete);
-// userHandler_.removeUser(user.getUserName(), false);
-// }
-
- public void testLinkMembership() throws Exception {
- String g1 = "grp1";
- String usr1 = "usr1";
- String mstype1 = "mstype1";
-
- Group group1 = groupHandler_.createGroupInstance();
- group1.setGroupName(g1);
- groupHandler_.addChild(null, group1, true);
-
- User user = createUser(usr1);
-
- MembershipType mt = mtHandler_.createMembershipTypeInstance();
- mt.setName(mstype1);
-
- try {
-
- membershipHandler_.linkMembership(user, group1, mt, true);
- fail();
- }
- catch (Exception e)
- {
- //expected as membership type was not created first
- }
-
- assertNull(mtHandler_.findMembershipType(mstype1));
-
- userHandler_.removeUser(usr1, true);
- groupHandler_.removeGroup(group1, true);
- }
-
-
- public void testFindUsersByGroupId() throws Exception
- {
- PageList users = userHandler_.findUsersByGroup("/users");
- assertTrue(users.getAvailable() > 0);
- }
-
- private static class UserProfileListener extends UserProfileEventListener
- {
-
- boolean preSave;
-
- boolean postSave;
-
- boolean preDelete;
-
- boolean postDelete;
-
- @Override
- public void postDelete(UserProfile profile) throws Exception
- {
- assertEquals(USER, profile.getUserName());
- postDelete = true;
- }
-
- @Override
- public void postSave(UserProfile profile, boolean isNew) throws Exception
- {
- assertEquals(USER, profile.getUserName());
- postSave = true;
- }
-
- @Override
- public void preDelete(UserProfile profile) throws Exception
- {
- assertEquals(USER, profile.getUserName());
- preDelete = true;
- }
-
- @Override
- public void preSave(UserProfile profile, boolean isNew) throws Exception
- {
- assertEquals(USER, profile.getUserName());
- preSave = true;
- }
-
- }
-
- public User createUser(String userName) throws Exception
- {
- User user = userHandler_.createUserInstance(userName);
- user.setPassword("default");
- user.setFirstName("default");
- user.setLastName("default");
- user.setEmail("exo(a)exoportal.org");
- userHandler_.createUser(user, true);
- return user;
- }
-
-}
Deleted:
epp/portal/branches/EPP_5_2_Branch/component/identity/src/test/resources/org/exoplatform/services/organization/TestOrganization-configuration.xml
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/identity/src/test/resources/org/exoplatform/services/organization/TestOrganization-configuration.xml 2011-11-07
21:02:25 UTC (rev 8004)
+++
epp/portal/branches/EPP_5_2_Branch/component/identity/src/test/resources/org/exoplatform/services/organization/TestOrganization-configuration.xml 2011-11-07
23:25:18 UTC (rev 8005)
@@ -1,316 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-
- Copyright (C) 2009 eXo Platform SAS.
-
- 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.
-
--->
-
-<configuration
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd
http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
-
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
-
- <external-component-plugins>
-
<target-component>org.exoplatform.services.organization.OrganizationService</target-component>
- <component-plugin>
- <name>new.user.event.listener</name>
- <set-method>addListenerPlugin</set-method>
-
<type>org.exoplatform.services.organization.impl.NewUserEventListener</type>
- <description>this listener assign group and membership to a new created
user</description>
- <init-params>
- <object-param>
- <name>configuration</name>
- <description>description</description>
- <object
type="org.exoplatform.services.organization.impl.NewUserConfig">
- <field name="group">
- <collection type="java.util.ArrayList">
- <value>
- <object
type="org.exoplatform.services.organization.impl.NewUserConfig$JoinGroup">
- <field
name="groupId"><string>/platform/users</string></field>
- <field
name="membership"><string>member</string></field>
- </object>
- </value>
- </collection>
- </field>
- <field name="ignoredUser">
- <collection type="java.util.HashSet">
- <value><string>root</string></value>
- <value><string>john</string></value>
- <value><string>mary</string></value>
- <value><string>demo</string></value>
- </collection>
- </field>
- </object>
- </object-param>
- </init-params>
- </component-plugin>
- <component-plugin>
- <name>init.service.listener</name>
- <set-method>addListenerPlugin</set-method>
-
<type>org.exoplatform.services.organization.OrganizationDatabaseInitializer</type>
- <description>this listener populate organization data for the first
launch</description>
- <init-params>
- <value-param>
- <name>checkDatabaseAlgorithm</name>
- <description>check database</description>
- <value>entry</value>
- </value-param>
- <value-param>
- <name>printInformation</name>
- <description>Print information init database</description>
- <value>true</value>
- </value-param>
- <object-param>
- <name>configuration</name>
- <description>description</description>
- <object
type="org.exoplatform.services.organization.OrganizationConfig">
- <field name="membershipType">
- <collection type="java.util.ArrayList">
- <value>
- <object
type="org.exoplatform.services.organization.OrganizationConfig$MembershipType">
- <field
name="type"><string>manager</string></field>
- <field name="description"><string>manager
membership type</string></field>
- </object>
- </value>
- <value>
- <object
type="org.exoplatform.services.organization.OrganizationConfig$MembershipType">
- <field
name="type"><string>member</string></field>
- <field name="description"><string>member
membership type</string></field>
- </object>
- </value>
- <value>
- <object
type="org.exoplatform.services.organization.OrganizationConfig$MembershipType">
- <field
name="type"><string>validator</string></field>
- <field name="description"><string>validator
membership type</string></field>
- </object>
- </value>
- </collection>
- </field>
-
- <field name="group">
- <collection type="java.util.ArrayList">
- <value>
- <object
type="org.exoplatform.services.organization.OrganizationConfig$Group">
- <field
name="name"><string>platform</string></field>
- <field
name="parentId"><string></string></field>
- <field name="description"><string>the
/platform group</string></field>
- <field
name="label"><string>Platform</string></field>
- </object>
- </value>
- <value>
- <object
type="org.exoplatform.services.organization.OrganizationConfig$Group">
- <field
name="name"><string>administrators</string></field>
- <field
name="parentId"><string>/platform</string></field>
- <field name="description"><string>the
/platform/administrators group</string></field>
- <field
name="label"><string>Administrators</string></field>
- </object>
- </value>
- <value>
- <object
type="org.exoplatform.services.organization.OrganizationConfig$Group">
- <field
name="name"><string>users</string></field>
- <field
name="parentId"><string>/platform</string></field>
- <field name="description"><string>the
/platform/users group</string></field>
- <field
name="label"><string>Users</string></field>
- </object>
- </value>
- <value>
- <object
type="org.exoplatform.services.organization.OrganizationConfig$Group">
- <field
name="name"><string>guests</string></field>
- <field
name="parentId"><string>/platform</string></field>
- <field name="description"><string>the
/platform/guests group</string></field>
- <field
name="label"><string>Guests</string></field>
- </object>
- </value>
- <value>
- <object
type="org.exoplatform.services.organization.OrganizationConfig$Group">
- <field
name="name"><string>organization</string></field>
- <field
name="parentId"><string></string></field>
- <field name="description"><string>the
organization group</string></field>
- <field
name="label"><string>Organization</string></field>
- </object>
- </value>
- <value>
- <object
type="org.exoplatform.services.organization.OrganizationConfig$Group">
- <field
name="name"><string>management</string></field>
- <field
name="parentId"><string>/organization</string></field>
- <field name="description"><string>the
/organization/management group</string></field>
- <field
name="label"><string>Management</string></field>
- </object>
- </value>
- <value>
- <object
type="org.exoplatform.services.organization.OrganizationConfig$Group">
- <field
name="name"><string>executive-board</string></field>
- <field
name="parentId"><string>/organization/management</string></field>
- <field name="description"><string>the
/organization/management/executive-board group</string></field>
- <field name="label"><string>Executive
Board</string></field>
- </object>
- </value>
- <value>
- <object
type="org.exoplatform.services.organization.OrganizationConfig$Group">
- <field
name="name"><string>human-resources</string></field>
- <field
name="parentId"><string>/organization/management</string></field>
- <field name="description"><string>the
/organization/management/human-resource group</string></field>
- <field name="label"><string>Human
Resources</string></field>
- </object>
- </value>
- <value>
- <object
type="org.exoplatform.services.organization.OrganizationConfig$Group">
- <field
name="name"><string>communication</string></field>
- <field
name="parentId"><string>/organization</string></field>
- <field name="description"><string>the
/organization/communication group</string></field>
- <field
name="label"><string>Communication</string></field>
- </object>
- </value>
- <value>
- <object
type="org.exoplatform.services.organization.OrganizationConfig$Group">
- <field
name="name"><string>marketing</string></field>
- <field
name="parentId"><string>/organization/communication</string></field>
- <field name="description"><string>the
/organization/communication/marketing group</string></field>
- <field
name="label"><string>Marketing</string></field>
- </object>
- </value>
- <value>
- <object
type="org.exoplatform.services.organization.OrganizationConfig$Group">
- <field
name="name"><string>press-and-media</string></field>
- <field
name="parentId"><string>/organization/communication</string></field>
- <field name="description"><string>the
/organization/communication/press-and-media group</string></field>
- <field name="label"><string>Press and
Media</string></field>
- </object>
- </value>
- <value>
- <object
type="org.exoplatform.services.organization.OrganizationConfig$Group">
- <field
name="name"><string>operations</string></field>
- <field
name="parentId"><string>/organization</string></field>
- <field name="description"><string>the
/organization/operations and media group</string></field>
- <field
name="label"><string>Operations</string></field>
- </object>
- </value>
- <value>
- <object
type="org.exoplatform.services.organization.OrganizationConfig$Group">
- <field
name="name"><string>sales</string></field>
- <field
name="parentId"><string>/organization/operations</string></field>
- <field name="description"><string>the
/organization/operations/sales group</string></field>
- <field
name="label"><string>Sales</string></field>
- </object>
- </value>
- <value>
- <object
type="org.exoplatform.services.organization.OrganizationConfig$Group">
- <field
name="name"><string>finances</string></field>
- <field
name="parentId"><string>/organization/operations</string></field>
- <field name="description"><string>the
/organization/operations/finances group</string></field>
- <field
name="label"><string>Finances</string></field>
- </object>
- </value>
- <value>
- <object
type="org.exoplatform.services.organization.OrganizationConfig$Group">
- <field
name="name"><string>customers</string></field>
- <field
name="parentId"><string></string></field>
- <field name="description"><string>the
/customers group</string></field>
- <field
name="label"><string>Customers</string></field>
- </object>
- </value>
- <value>
- <object
type="org.exoplatform.services.organization.OrganizationConfig$Group">
- <field
name="name"><string>partners</string></field>
- <field
name="parentId"><string></string></field>
- <field name="description"><string>the
/partners group</string></field>
- <field
name="label"><string>Partners</string></field>
- </object>
- </value>
- </collection>
- </field>
-
- <field name="user">
- <collection type="java.util.ArrayList">
- <value>
- <object
type="org.exoplatform.services.organization.OrganizationConfig$User">
- <field
name="userName"><string>root</string></field>
- <field
name="password"><string>gtn</string></field>
- <field
name="firstName"><string>Root</string></field>
- <field
name="lastName"><string>Root</string></field>
- <field
name="email"><string>root@localhost</string></field>
- <field name="groups">
- <string>
- manager:/platform/administrators,member:/platform/users,
- member:/organization/management/executive-board
- </string>
- </field>
- </object>
- </value>
-
- <value>
- <object
type="org.exoplatform.services.organization.OrganizationConfig$User">
- <field
name="userName"><string>john</string></field>
- <field
name="password"><string>gtn</string></field>
- <field
name="firstName"><string>John</string></field>
- <field
name="lastName"><string>Anthony</string></field>
- <field
name="email"><string>john@localhost</string></field>
- <field name="groups">
- <string>
- member:/platform/administrators,member:/platform/users,
- manager:/organization/management/executive-board
- </string>
- </field>
- </object>
- </value>
- <value>
- <object
type="org.exoplatform.services.organization.OrganizationConfig$User">
- <field
name="userName"><string>mary</string></field>
- <field
name="password"><string>gtn</string></field>
- <field
name="firstName"><string>Mary</string></field>
- <field
name="lastName"><string>Kelly</string></field>
- <field
name="email"><string>mary@localhost</string></field>
- <field name="groups">
- <string>member:/platform/users</string>
- </field>
- </object>
- </value>
- <value>
- <object
type="org.exoplatform.services.organization.OrganizationConfig$User">
- <field
name="userName"><string>demo</string></field>
- <field
name="password"><string>gtn</string></field>
- <field
name="firstName"><string>Demo</string></field>
- <field
name="lastName"><string>gtn</string></field>
- <field
name="email"><string>demo@localhost</string></field>
- <field name="groups">
-
<string>member:/platform/guests,member:/platform/users</string>
- </field>
- </object>
- </value>
-
- <value>
- <object
type="org.exoplatform.services.organization.OrganizationConfig$User">
- <field
name="userName"><string>overwritelayout</string></field>
- <field
name="password"><string>whatever</string></field>
- <field
name="firstName"><string>whatever</string></field>
- <field
name="lastName"><string>whatever</string></field>
- <field
name="email"><string>whatever@localhost</string></field>
- <field name="groups">
- <string>member:/platform/guests</string>
- </field>
- </object>
- </value>
-
- </collection>
- </field>
- </object>
- </object-param>
- </init-params>
- </component-plugin>
- </external-component-plugins>
-
-</configuration>
Deleted:
epp/portal/branches/EPP_5_2_Branch/component/identity/src/test/resources/org/exoplatform/services/organization/TestOrganizationService-configuration.xml
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/identity/src/test/resources/org/exoplatform/services/organization/TestOrganizationService-configuration.xml 2011-11-07
21:02:25 UTC (rev 8004)
+++
epp/portal/branches/EPP_5_2_Branch/component/identity/src/test/resources/org/exoplatform/services/organization/TestOrganizationService-configuration.xml 2011-11-07
23:25:18 UTC (rev 8005)
@@ -1,309 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-
- Copyright (C) 2009 eXo Platform SAS.
-
- 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.
-
--->
-
-<configuration
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd
http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
-
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
-
- <component>
- <key>org.exoplatform.services.log.LogConfigurationInitializer</key>
- <type>org.exoplatform.services.log.LogConfigurationInitializer</type>
- <init-params>
- <value-param>
- <name>logger</name>
-
<value>org.exoplatform.services.log.impl.BufferedLog4JLogger</value>
- </value-param>
- <value-param>
- <name>configurator</name>
-
<value>org.exoplatform.services.log.impl.Log4JConfigurator</value>
- </value-param>
- <properties-param>
- <name>properties</name>
- <description>Log4J properties</description>
- <property name="log4j.rootLogger" value="DEBUG, stdout"
/>
- <property name="log4j.appender.stdout"
value="org.apache.log4j.ConsoleAppender" />
- <property name="log4j.appender.stdout.threshold"
value="INFO" />
- <property name="log4j.appender.stdout.layout"
value="org.apache.log4j.PatternLayout" />
- <property name="log4j.appender.stdout.layout.ConversionPattern"
value="%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L) %n" />
- </properties-param>
- </init-params>
- </component>
-
- <component>
- <key>org.exoplatform.services.cache.CacheService</key>
- <jmx-name>cache:type=CacheService</jmx-name>
- <type>org.exoplatform.services.cache.impl.CacheServiceImpl</type>
- <init-params>
- <object-param>
- <name>cache.config.default</name>
- <description>The default cache configuration</description>
- <object type="org.exoplatform.services.cache.ExoCacheConfig">
- <field
name="name"><string>default</string></field>
- <field
name="maxSize"><int>300</int></field>
- <field
name="liveTime"><long>300</long></field>
- <field
name="distributed"><boolean>false</boolean></field>
- <field
name="implementation"><string>org.exoplatform.services.cache.concurrent.ConcurrentFIFOExoCache</string></field>
- </object>
- </object-param>
- </init-params>
- </component>
-
- <component>
- <key>org.exoplatform.services.database.DatabaseService</key>
-
<type>org.exoplatform.services.database.impl.XAPoolTxSupportDatabaseService</type>
- <init-params>
- <properties-param>
- <name>default</name>
- <description>Connection configuration</description>
- <property name='connection.driver'
value='org.hsqldb.jdbcDriver' />
- <property name='connection.url'
value='jdbc:hsqldb:mem:db/default' />
- <property name='connection.login' value='sa' />
- <property name='connection.password' value='' />
- <property name='connection.min-size' value='3' />
- <property name='connection.max-size' value='5' />
- </properties-param>
- </init-params>
- </component>
-
- <component>
-
<key>org.exoplatform.services.organization.idm.PicketLinkIDMCacheService</key>
-
<type>org.exoplatform.services.organization.idm.PicketLinkIDMCacheService</type>
- </component>
-
- <component>
-
<key>org.exoplatform.services.organization.idm.PicketLinkIDMService</key>
-
<type>org.exoplatform.services.organization.idm.PicketLinkIDMServiceImpl</type>
- <init-params>
- <value-param>
- <name>config</name>
- <value>jar:/conf/portal/idm-config.xml</value>
- </value-param>
- </init-params>
- </component>
-
- <component>
- <key>org.exoplatform.services.organization.OrganizationService</key>
-
<type>org.exoplatform.services.organization.idm.PicketLinkIDMOrganizationServiceImpl</type>
- <init-params>
- <object-param>
- <name>configuration</name>
- <object type="org.exoplatform.services.organization.idm.Config">
- <field name="useParentIdAsGroupType">
- <boolean>true</boolean>
- </field>
- <field name="groupTypeMappings">
- <map type="java.util.HashMap">
- <entry>
- <key><string>/</string></key>
- <value><string>root_type</string></value>
- </entry>
- <entry>
- <key><string>/platform/*</string></key>
- <value><string>platform_type</string></value>
- </entry>
- <entry>
- <key><string>/platform/users</string></key>
- <value><string>users_type</string></value>
- </entry>
- <entry>
-
<key><string>/organization/acme/france</string></key>
- <value><string>france_type</string></value>
- </entry>
- <entry>
- <key><string>/toto/*</string></key>
- <value><string>toto_type</string></value>
- </entry>
- </map>
- </field>
- <!-- If this option is used then each Membership created with MembrshipType
that is
- equal to value specified here will be stored in PicketLink IDM as simple
- Group-User association-->
- <field name="associationMembershipType">
- <string>member</string>
- </field>
- <!-- if "associationMembershipType" option is used and this option
is set to true
- then Membership with MembershipType configured to be stored as PicketLink
IDM association
- will not be stored as PicketLink IDM Role -->
- <field name="ignoreMappedMembershipType">
- <boolean>false</boolean>
- </field>
- </object>
- </object-param>
- </init-params>
- </component>
-
- <component>
- <key>org.exoplatform.services.database.HibernateService</key>
- <jmx-name>database:type=HibernateService</jmx-name>
- <type>org.exoplatform.services.database.impl.HibernateServiceImpl</type>
- <init-params>
- <properties-param>
- <name>hibernate.properties</name>
- <description>Default Hibernate Service</description>
- <property name="hibernate.hbm2ddl.auto"
value="create-drop"/>
- <!--<property name="hibernate.show_sql"
value="true"/>-->
- <!--<property name="hibernate.use_sql_comments"
value="true"/>-->
- <!--<property name="hibernate.format_sql"
value="true"/>-->
- <property name="hibernate.current_session_context_class"
value="thread"/>
- <property name="hibernate.jdbc.batch_size" value="0"/>
- <property name="hibernate.cache.use_second_level_cache"
value="true"/>
- <property name="hibernate.cache.use_query_cache"
value="true"/>
- <!--CHANGEME HashtableCacheProvider shold not be used in production env-->
- <property name="hibernate.cache.provider_class"
value="org.hibernate.cache.HashtableCacheProvider"/>
- <property name="hibernate.connection.url"
value="jdbc:hsqldb:file:${basedir}/target/temp/data/exodb${container.name.suffix}"/>
- <property name="hibernate.connection.driver_class"
value="org.hsqldb.jdbcDriver"/>
- <property name="hibernate.connection.autocommit"
value="true"/>
- <property name="hibernate.connection.username"
value="sa"/>
- <property name="hibernate.connection.password"
value=""/>
- <property name="hibernate.dialect"
value="org.hibernate.dialect.HSQLDialect"/>
- <property name="hibernate.c3p0.min_size" value="5"/>
- <property name="hibernate.c3p0.max_size" value="20"/>
- <property name="hibernate.c3p0.timeout" value="1800"/>
- <property name="hibernate.c3p0.max_statements"
value="50"/>
- </properties-param>
- </init-params>
- </component>
-
- <external-component-plugins>
-
<target-component>org.exoplatform.services.database.HibernateService</target-component>
- <component-plugin>
- <name>add.hibernate.mapping</name>
- <set-method>addPlugin</set-method>
-
<type>org.exoplatform.services.database.impl.AddHibernateMappingPlugin</type>
- <init-params>
- <values-param>
- <name>hibernate.mapping</name>
- <value>conf/mappings/HibernateRealm.hbm.xml</value>
-
<value>conf/mappings/HibernateIdentityObjectCredentialBinaryValue.hbm.xml</value>
-
<value>conf/mappings/HibernateIdentityObjectAttributeBinaryValue.hbm.xml</value>
- <value>conf/mappings/HibernateIdentityObject.hbm.xml</value>
-
<value>conf/mappings/HibernateIdentityObjectCredential.hbm.xml</value>
-
<value>conf/mappings/HibernateIdentityObjectCredentialType.hbm.xml</value>
-
<value>conf/mappings/HibernateIdentityObjectAttribute.hbm.xml</value>
- <value>conf/mappings/HibernateIdentityObjectType.hbm.xml</value>
-
<value>conf/mappings/HibernateIdentityObjectRelationship.hbm.xml</value>
-
<value>conf/mappings/HibernateIdentityObjectRelationshipType.hbm.xml</value>
-
<value>conf/mappings/HibernateIdentityObjectRelationshipName.hbm.xml</value>
- </values-param>
- </init-params>
- </component-plugin>
- </external-component-plugins>
-
- <external-component-plugins>
-
<target-component>org.exoplatform.services.organization.OrganizationService</target-component>
- <component-plugin>
- <name>init.service.listener</name>
- <set-method>addListenerPlugin</set-method>
-
<type>org.exoplatform.services.organization.OrganizationDatabaseInitializer</type>
- <description>this listener populate organization data for the first
launch</description>
- <init-params>
- <value-param>
- <name>checkDatabaseAlgorithm</name>
- <description>check database</description>
- <value>empty</value>
- </value-param>
- <value-param>
- <name>printInformation</name>
- <description>Print information init database</description>
- <value>true</value>
- </value-param>
- <object-param>
- <name>configuration</name>
- <description>description</description>
- <object
type="org.exoplatform.services.organization.OrganizationConfig">
- <field name="membershipType">
- <collection type="java.util.ArrayList">
- <value>
- <object
type="org.exoplatform.services.organization.OrganizationConfig$MembershipType">
- <field
name="type"><string>member</string></field>
- <field name="description"><string>member
membershipt type</string></field>
- </object>
- </value>
- </collection>
- </field>
-
- <field name="group">
- <collection type="java.util.ArrayList">
- <value>
- <object
type="org.exoplatform.services.organization.OrganizationConfig$Group">
- <field
name="name"><string>users</string></field>
- <field
name="parentId"><string></string></field>
- <!--<field
name="type"><string>hierachy</string></field>-->
- <field name="description"><string>the /users
group</string></field>
- </object>
- </value>
- </collection>
- </field>
-
- <field name="user">
- <collection type="java.util.ArrayList">
- <value>
- <object
type="org.exoplatform.services.organization.OrganizationConfig$User">
- <field
name="userName"><string>demo</string></field>
- <field
name="password"><string>exo</string></field>
- <field
name="firstName"><string>demo</string></field>
- <field
name="lastName"><string>demo</string></field>
- <field
name="email"><string>demo@localhost</string></field>
- <field name="groups">
- <string>member:/users</string>
- </field>
- </object>
- </value>
- </collection>
- </field>
- </object>
- </object-param>
- </init-params>
- </component-plugin>
-
- <component-plugin>
- <name>new.user.event.listener</name>
- <set-method>addListenerPlugin</set-method>
-
<type>org.exoplatform.services.organization.impl.NewUserEventListener</type>
- <description>this listener assign group and membership to a new created
user</description>
- <init-params>
- <object-param>
- <name>configuration</name>
- <description>description</description>
- <object
type="org.exoplatform.services.organization.impl.NewUserConfig">
- <field name="group">
- <collection type="java.util.ArrayList">
- <value>
- <object
type="org.exoplatform.services.organization.impl.NewUserConfig$JoinGroup">
- <field
name="groupId"><string>/users</string></field>
- <field
name="membership"><string>member</string></field>
- </object>
- </value>
- </collection>
- </field>
- <field name="ignoredUser">
- <collection type="java.util.HashSet">
- <value><string>demo</string></value>
- <value><string>admin</string></value>
- </collection>
- </field>
- </object>
- </object-param>
- </init-params>
- </component-plugin>
- </external-component-plugins>
-</configuration>