Author: ndkhoiits
Date: 2011-07-22 00:52:05 -0400 (Fri, 22 Jul 2011)
New Revision: 6913
Added:
portal/trunk/component/identity/src/test/java/org/exoplatform/services/organization/TestBootstrap.java
portal/trunk/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganization.java
portal/trunk/component/identity/src/test/resources/conf/exo.portal.component.identity-configuration.xml
portal/trunk/component/identity/src/test/resources/conf/exo.portal.component.identity-picketlink-idm-config.xml
portal/trunk/component/identity/src/test/resources/conf/mappings/
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObject.hbm.xml
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectAttribute.hbm.xml
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectAttributeBinaryValue.hbm.xml
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectCredential.hbm.xml
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectCredentialBinaryValue.hbm.xml
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectCredentialType.hbm.xml
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectRelationship.hbm.xml
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectRelationshipName.hbm.xml
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectRelationshipType.hbm.xml
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectType.hbm.xml
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateRealm.hbm.xml
portal/trunk/component/identity/src/test/resources/org/
portal/trunk/component/identity/src/test/resources/org/exoplatform/
portal/trunk/component/identity/src/test/resources/org/exoplatform/services/
portal/trunk/component/identity/src/test/resources/org/exoplatform/services/organization/
portal/trunk/component/identity/src/test/resources/org/exoplatform/services/organization/TestOrganization-configuration.xml
portal/trunk/component/identity/src/test/resources/org/exoplatform/services/organization/TestOrganizationService-configuration.xml
portal/trunk/component/test/core/src/main/java/org/exoplatform/component/test/KernelBootstrap.java
portal/trunk/component/test/core/src/main/java/org/exoplatform/component/test/KernelTestSuite.java
portal/trunk/component/test/core/src/test/java/org/exoplatform/component/test/KernelBootstrapTestCase.java
Removed:
portal/trunk/component/identity/src/test/java/org/exoplatform/services/organization/TestConfigOrganizationService.java
portal/trunk/component/identity/src/test/resources/conf/portal/idm-configuration.xml
portal/trunk/component/identity/src/test/resources/conf/portal/organization-configuration.xml
portal/trunk/component/identity/src/test/resources/conf/portal/test-configuration.xml
portal/trunk/component/test/organization/
Modified:
portal/trunk/component/application-registry/pom.xml
portal/trunk/component/application-registry/src/test/java/org/exoplatform/application/AbstractApplicationRegistryTest.java
portal/trunk/component/common/pom.xml
portal/trunk/component/identity/pom.xml
portal/trunk/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganizationService.java
portal/trunk/component/resources/pom.xml
portal/trunk/component/test/core/src/main/java/org/exoplatform/component/test/AbstractKernelTest.java
portal/trunk/component/test/core/src/main/java/org/exoplatform/component/test/GateInTestClassLoader.java
portal/trunk/component/test/core/src/main/resources/conf/portal-configuration.xml
portal/trunk/component/test/core/src/test/java/org/exoplatform/component/test/BootstrapTestCase.java
portal/trunk/component/test/pom.xml
portal/trunk/pom.xml
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/BasePartialUpdateToolbar.java
portal/trunk/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UINavigationPortlet.java
portal/trunk/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UISitemapPortlet.java
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
Log:
GTNPORTAL-1962 The navigation import should be configurable some modes for particular
requirement
- Improve testcase initial data on each
Modified: portal/trunk/component/application-registry/pom.xml
===================================================================
--- portal/trunk/component/application-registry/pom.xml 2011-07-22 03:13:14 UTC (rev
6912)
+++ portal/trunk/component/application-registry/pom.xml 2011-07-22 04:52:05 UTC (rev
6913)
@@ -71,7 +71,8 @@
<dependency>
<groupId>org.exoplatform.portal</groupId>
- <artifactId>exo.portal.component.test.organization</artifactId>
+ <artifactId>exo.portal.component.identity</artifactId>
+ <type>test-jar</type>
<scope>test</scope>
</dependency>
@@ -103,4 +104,19 @@
<artifactId>pc-api</artifactId>
</dependency>
</dependencies>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <forkMode>always</forkMode>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
</project>
Modified:
portal/trunk/component/application-registry/src/test/java/org/exoplatform/application/AbstractApplicationRegistryTest.java
===================================================================
---
portal/trunk/component/application-registry/src/test/java/org/exoplatform/application/AbstractApplicationRegistryTest.java 2011-07-22
03:13:14 UTC (rev 6912)
+++
portal/trunk/component/application-registry/src/test/java/org/exoplatform/application/AbstractApplicationRegistryTest.java 2011-07-22
04:52:05 UTC (rev 6913)
@@ -26,9 +26,9 @@
*/
@ConfiguredBy({
@ConfigurationUnit(scope = ContainerScope.PORTAL, path =
"conf/exo.portal.component.test.jcr-configuration.xml"),
- @ConfigurationUnit(scope = ContainerScope.PORTAL, path =
"conf/exo.portal.component.test.organization-configuration.xml"),
+ @ConfigurationUnit(scope = ContainerScope.PORTAL, path =
"conf/exo.portal.component.identity-configuration.xml"),
@ConfigurationUnit(scope = ContainerScope.PORTAL, path =
"conf/exo.portal.component.application-registry-configuration.xml"),
- @ConfigurationUnit(scope = ContainerScope.PORTAL, path =
"conf/exo.portal.component.portal-configuration1.xml")
+ @ConfigurationUnit(scope = ContainerScope.PORTAL, path =
"conf/exo.portal.component.portal-configuration.xml")
})
public abstract class AbstractApplicationRegistryTest extends AbstractKernelTest
{
Modified: portal/trunk/component/common/pom.xml
===================================================================
--- portal/trunk/component/common/pom.xml 2011-07-22 03:13:14 UTC (rev 6912)
+++ portal/trunk/component/common/pom.xml 2011-07-22 04:52:05 UTC (rev 6913)
@@ -96,4 +96,19 @@
<scope>test</scope>
</dependency>
</dependencies>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <forkMode>always</forkMode>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
</project>
Modified: portal/trunk/component/identity/pom.xml
===================================================================
--- portal/trunk/component/identity/pom.xml 2011-07-22 03:13:14 UTC (rev 6912)
+++ portal/trunk/component/identity/pom.xml 2011-07-22 04:52:05 UTC (rev 6913)
@@ -92,4 +92,35 @@
</dependency>
</dependencies>
+
+ <build>
+
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <forkMode>always</forkMode>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
Added:
portal/trunk/component/identity/src/test/java/org/exoplatform/services/organization/TestBootstrap.java
===================================================================
---
portal/trunk/component/identity/src/test/java/org/exoplatform/services/organization/TestBootstrap.java
(rev 0)
+++
portal/trunk/component/identity/src/test/java/org/exoplatform/services/organization/TestBootstrap.java 2011-07-22
04:52:05 UTC (rev 6913)
@@ -0,0 +1,61 @@
+/*
+ * 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:
portal/trunk/component/identity/src/test/java/org/exoplatform/services/organization/TestConfigOrganizationService.java
===================================================================
---
portal/trunk/component/identity/src/test/java/org/exoplatform/services/organization/TestConfigOrganizationService.java 2011-07-22
03:13:14 UTC (rev 6912)
+++
portal/trunk/component/identity/src/test/java/org/exoplatform/services/organization/TestConfigOrganizationService.java 2011-07-22
04:52:05 UTC (rev 6913)
@@ -1,157 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2010, 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.exoplatform.services.organization;
-
-import org.exoplatform.commons.utils.PageList;
-import org.exoplatform.component.test.AbstractGateInTest;
-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 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
- */
-
-public class TestConfigOrganizationService extends AbstractGateInTest
-{
-
- 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 TestConfigOrganizationService(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");
-
-
- }
-
-
-
-}
\ No newline at end of file
Added:
portal/trunk/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganization.java
===================================================================
---
portal/trunk/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganization.java
(rev 0)
+++
portal/trunk/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganization.java 2011-07-22
04:52:05 UTC (rev 6913)
@@ -0,0 +1,238 @@
+/**
+ * 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)
+ {
+
+ }
+ }
+}
Modified:
portal/trunk/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganizationService.java
===================================================================
---
portal/trunk/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganizationService.java 2011-07-22
03:13:14 UTC (rev 6912)
+++
portal/trunk/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganizationService.java 2011-07-22
04:52:05 UTC (rev 6913)
@@ -21,9 +21,15 @@
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;
@@ -34,7 +40,11 @@
* Oct 27, 2005
*/
-public class TestOrganizationService extends AbstractGateInTest
+@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";
@@ -117,6 +127,36 @@
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)
Added:
portal/trunk/component/identity/src/test/resources/conf/exo.portal.component.identity-configuration.xml
===================================================================
---
portal/trunk/component/identity/src/test/resources/conf/exo.portal.component.identity-configuration.xml
(rev 0)
+++
portal/trunk/component/identity/src/test/resources/conf/exo.portal.component.identity-configuration.xml 2011-07-22
04:52:05 UTC (rev 6913)
@@ -0,0 +1,154 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ ~ 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.
+ -->
+
+<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.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/exo.portal.component.identity-picketlink-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>
+ </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>60</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.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="false"/>
+ <property name="hibernate.current_session_context_class"
value="thread"/>
+ <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.datasource"
value="jdbcidm"/>
+ <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.naming.InitialContextInitializer</target-component>
+ <component-plugin>
+ <name>bind.datasource</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.naming.BindReferencePlugin</type>
+ <init-params>
+ <value-param>
+ <name>bind-name</name>
+ <value>jdbcidm</value>
+ </value-param>
+ <value-param>
+ <name>class-name</name>
+ <value>javax.sql.DataSource</value>
+ </value-param>
+ <value-param>
+ <name>factory</name>
+ <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
+ </value-param>
+ <properties-param profiles="hsqldb">
+ <name>ref-addresses</name>
+ <description>ref-addresses</description>
+ <property name="driverClassName"
value="org.hsqldb.jdbcDriver"/>
+ <property name="url"
value="jdbc:hsqldb:file:${gatein.test.tmp.dir}/db/data/jdbcidm"/>
+ <property name="username" value="sa"/>
+ <property name="password" value=""/>
+ </properties-param>
+ <properties-param profiles="mysql">
+ <name>ref-addresses</name>
+ <description>ref-addresses</description>
+ <property name="driverClassName"
value="com.mysql.jdbc.Driver"/>
+ <property name="url"
value="jdbc:mysql://10.37.129.4/jdbcidm?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=utf-8"/>
+ <property name="username" value="root"/>
+ <property name="password" value=""/>
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+</configuration>
Added:
portal/trunk/component/identity/src/test/resources/conf/exo.portal.component.identity-picketlink-idm-config.xml
===================================================================
---
portal/trunk/component/identity/src/test/resources/conf/exo.portal.component.identity-picketlink-idm-config.xml
(rev 0)
+++
portal/trunk/component/identity/src/test/resources/conf/exo.portal.component.identity-picketlink-idm-config.xml 2011-07-22
04:52:05 UTC (rev 6913)
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+
+<jboss-identity xmlns="urn:picketlink:idm:config:v1_0_0_ga"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:picketlink:idm:config:v1_0_0_ga
identity-config.xsd">
+ <realms>
+ <realm>
+ <id>idm_realm</id>
+ <repository-id-ref>PortalRepository</repository-id-ref>
+ <identity-type-mappings>
+ <user-mapping>USER</user-mapping>
+ </identity-type-mappings>
+ </realm>
+ </realms>
+ <repositories>
+ <repository>
+ <id>PortalRepository</id>
+
<class>org.picketlink.idm.impl.repository.WrapperIdentityStoreRepository</class>
+ <external-config/>
+
<default-identity-store-id>HibernateStore</default-identity-store-id>
+
<default-attribute-store-id>HibernateStore</default-attribute-store-id>
+ </repository>
+ </repositories>
+ <stores>
+ <attribute-stores/>
+ <identity-stores>
+ <identity-store>
+ <id>HibernateStore</id>
+
<class>org.picketlink.idm.impl.store.hibernate.HibernateIdentityStoreImpl</class>
+ <external-config/>
+ <supported-relationship-types>
+
<relationship-type>JBOSS_IDENTITY_MEMBERSHIP</relationship-type>
+
<relationship-type>JBOSS_IDENTITY_ROLE</relationship-type>
+ </supported-relationship-types>
+ <supported-identity-object-types>
+ <identity-object-type>
+ <name>USER</name>
+ <relationships/>
+ <credentials>
+ <credential-type>PASSWORD</credential-type>
+ </credentials>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ </supported-identity-object-types>
+ <options>
+ <option>
+ <name>hibernateSessionFactoryRegistryName</name>
+ <value>hibernateSessionFactory</value>
+ </option>
+ <option>
+ <name>allowNotDefinedIdentityObjectTypes</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>populateRelationshipTypes</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>populateIdentityObjectTypes</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>allowNotDefinedAttributes</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>isRealmAware</name>
+ <value>true</value>
+ </option>
+ </options>
+ </identity-store>
+ </identity-stores>
+ </stores>
+</jboss-identity>
\ No newline at end of file
Added:
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObject.hbm.xml
===================================================================
---
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObject.hbm.xml
(rev 0)
+++
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObject.hbm.xml 2011-07-22
04:52:05 UTC (rev 6913)
@@ -0,0 +1,114 @@
+<?xml version="1.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.
+ -->
+
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD
3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+<hibernate-mapping>
+ <class
name="org.picketlink.idm.impl.model.hibernate.HibernateIdentityObject"
+ table="jbid_io">
+ <cache usage="read-write"/>
+ <id name="id"
+ type="java.lang.Long"
+ access="field">
+ <column name="ID" />
+ <generator class="native"/>
+ </id>
+ <set name="attributes"
+ inverse="true"
+ cascade="all, delete-orphan"
+ lazy="extra"
+ fetch="subselect">
+ <cache usage="read-write"/>
+ <key>
+ <column name="IDENTITY_OBJECT_ID" />
+ </key>
+ <one-to-many
class="org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectAttribute"
/>
+ </set>
+ <set name="credentials"
+ inverse="true"
+ cascade="all, delete-orphan"
+ lazy="extra"
+ fetch="subselect">
+ <cache usage="read-write"/>
+ <key>
+ <column name="IDENTITY_OBJECT_ID" />
+ </key>
+ <one-to-many
class="org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectCredential"
/>
+ </set>
+ <set name="fromRelationships"
+ inverse="true"
+ lazy="extra"
+ fetch="subselect">
+ <cache usage="read-write"/>
+ <key>
+ <column name="FROM_IDENTITY" />
+ </key>
+ <one-to-many
class="org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectRelationship"
/>
+ </set>
+ <many-to-one name="identityType"
+
class="org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectType"
+ access="field"
+ fetch="join"
+ lazy="false">
+ <column name="IDENTITY_TYPE"
+ not-null="true"
+ unique-key="id"/>
+ </many-to-one>
+ <property name="name"
+ type="java.lang.String"
+ access="field"
+ lazy="false">
+ <column name="NAME"
+ not-null="true"
+ unique-key="id"/>
+ </property>
+ <map name="properties"
+ table="jbid_io_props"
+ cascade="all, delete-orphan"
+ lazy="extra"
+ fetch="subselect">
+ <cache usage="read-write"/>
+ <key column="PROP_ID"/>
+ <map-key type="string"
+ column="PROP_NAME"/>
+ <element type="string"
+ column="PROP_VALUE"
+ not-null="true"/>
+ </map>
+ <many-to-one name="realm"
+
class="org.picketlink.idm.impl.model.hibernate.HibernateRealm"
+ access="field"
+ fetch="select">
+ <column name="REALM"
+ not-null="true"
+ unique-key="id"/>
+ </many-to-one>
+ <set name="toRelationships"
+ inverse="true"
+ lazy="extra"
+ fetch="subselect">
+ <cache usage="read-write"/>
+ <key>
+ <column name="TO_IDENTITY" />
+ </key>
+ <one-to-many
class="org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectRelationship"
/>
+ </set>
+ </class>
+</hibernate-mapping>
Added:
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectAttribute.hbm.xml
===================================================================
---
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectAttribute.hbm.xml
(rev 0)
+++
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectAttribute.hbm.xml 2011-07-22
04:52:05 UTC (rev 6913)
@@ -0,0 +1,55 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD
3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+<hibernate-mapping>
+ <class
name="org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectAttribute"
+ table="jbid_io_attr">
+ <cache usage="read-write"/>
+ <id name="id"
+ type="java.lang.Long"
+ access="field">
+ <column name="ATTRIBUTE_ID" />
+ <generator class="native"/>
+ </id>
+ <many-to-one name="identityObject"
+
class="org.picketlink.idm.impl.model.hibernate.HibernateIdentityObject"
+ access="field"
+ fetch="join">
+ <column name="IDENTITY_OBJECT_ID" not-null="true"
unique-key="id"/>
+ </many-to-one>
+ <property name="name"
+ type="java.lang.String"
+ access="property"
+ lazy="false">
+ <column name="NAME"
+ unique-key="id" />
+ </property>
+ <property name="type"
+ type="java.lang.String"
+ access="field"
+ lazy="false"
+ not-null="true">
+ <column name="ATTRIBUTE_TYPE"/>
+ </property>
+ <set name="textValues"
+ table="jbid_io_attr_text_values"
+ cascade="all, delete-orphan"
+ access="field"
+ lazy="extra"
+ fetch="subselect">
+ <cache usage="read-write"/>
+ <key column="TEXT_ATTR_VALUE_ID"/>
+ <element type="string"
+ column="ATTR_VALUE"/>
+ </set>
+ <many-to-one name="binaryValue"
+
class="org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectAttributeBinaryValue"
+ not-null="false"
+ column="BIN_VALUE_ID"
+ unique="false"
+ lazy="proxy"
+ access="field"
+ fetch="select"
+ cascade="all"/>
+ </class>
+</hibernate-mapping>
Added:
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectAttributeBinaryValue.hbm.xml
===================================================================
---
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectAttributeBinaryValue.hbm.xml
(rev 0)
+++
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectAttributeBinaryValue.hbm.xml 2011-07-22
04:52:05 UTC (rev 6913)
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD
3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+<hibernate-mapping>
+ <class
name="org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectAttributeBinaryValue"
+ table="jbid_attr_bin_value">
+ <cache usage="read-write"/>
+ <id name="id"
+ type="java.lang.Long"
+ access="field">
+ <column name="BIN_VALUE_ID" />
+ <generator class="native"/>
+ </id>
+ <property name="value"
+ type="org.hibernate.type.PrimitiveByteArrayBlobType"
+ access="field"
+ lazy="false"
+ not-null="true">
+ <column name="VALUE" length="10240000"/>
+ </property>
+ </class>
+</hibernate-mapping>
Added:
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectCredential.hbm.xml
===================================================================
---
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectCredential.hbm.xml
(rev 0)
+++
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectCredential.hbm.xml 2011-07-22
04:52:05 UTC (rev 6913)
@@ -0,0 +1,62 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD
3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+<hibernate-mapping>
+ <class
name="org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectCredential"
+ table="jbid_io_creden">
+ <cache usage="read-write"/>
+
+ <id name="id"
+ type="java.lang.Long"
+ access="field">
+ <column name="ID" />
+ <generator class="native"/>
+ </id>
+ <many-to-one name="binaryValue"
+
class="org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectCredentialBinaryValue"
+ not-null="false"
+ column="BIN_VALUE_ID"
+ unique="false"
+ lazy="proxy"
+ access="field"
+ fetch="select"
+ cascade="all"/>
+ <many-to-one name="identityObject"
+
class="org.picketlink.idm.impl.model.hibernate.HibernateIdentityObject"
+ access="field"
+ fetch="select"
+ lazy="proxy">
+ <column name="IDENTITY_OBJECT_ID"
+ not-null="true"
+ unique-key="id" />
+ </many-to-one>
+ <map name="properties"
+ table="jbid_io_creden_props"
+ cascade="all, delete-orphan"
+ lazy="extra"
+ fetch="subselect">
+ <cache usage="read-write"/>
+ <key column="PROP_ID"/>
+ <map-key type="string"
+ column="PROP_NAME"/>
+ <element type="string"
+ column="PROP_VALUE"
+ not-null="true"/>
+ </map>
+ <property name="textValue"
+ type="java.lang.String"
+ access="field"
+ lazy="false">
+ <column name="TEXT" />
+ </property>
+ <many-to-one name="type"
+
class="org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectCredentialType"
+ access="field"
+ fetch="join"
+ lazy="false">
+ <column name="CREDENTIAL_TYPE"
+ not-null="true"
+ unique-key="id"/>
+ </many-to-one>
+ </class>
+</hibernate-mapping>
Added:
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectCredentialBinaryValue.hbm.xml
===================================================================
---
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectCredentialBinaryValue.hbm.xml
(rev 0)
+++
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectCredentialBinaryValue.hbm.xml 2011-07-22
04:52:05 UTC (rev 6913)
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD
3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+<hibernate-mapping>
+ <class
name="org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectCredentialBinaryValue"
+ table="jbid_creden_bin_value">
+ <cache usage="read-write"/>
+ <id name="id"
+ type="java.lang.Long"
+ access="field">
+ <column name="BIN_VALUE_ID" />
+ <generator class="native"/>
+ </id>
+ <property name="value"
+ type="org.hibernate.type.PrimitiveByteArrayBlobType"
+ access="field"
+ lazy="false"
+ not-null="true">
+ <column name="VALUE" length="10240000"/>
+ </property>
+ </class>
+</hibernate-mapping>
Added:
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectCredentialType.hbm.xml
===================================================================
---
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectCredentialType.hbm.xml
(rev 0)
+++
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectCredentialType.hbm.xml 2011-07-22
04:52:05 UTC (rev 6913)
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD
3.0//EN"
+"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+<hibernate-mapping>
+ <class
name="org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectCredentialType"
+ table="jbid_io_creden_type">
+ <cache usage="read-write"/>
+
+ <id name="id"
+ type="java.lang.Long"
+ access="field">
+ <column name="ID" />
+ <generator class="native"/>
+ </id>
+ <property name="name"
+ type="java.lang.String"
+ access="field"
+ lazy="false">
+ <column name="NAME"
+ unique="true" />
+ </property>
+ </class>
+</hibernate-mapping>
Added:
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectRelationship.hbm.xml
===================================================================
---
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectRelationship.hbm.xml
(rev 0)
+++
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectRelationship.hbm.xml 2011-07-22
04:52:05 UTC (rev 6913)
@@ -0,0 +1,63 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD
3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+<hibernate-mapping>
+ <class
name="org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectRelationship"
+ table="jbid_io_rel">
+ <cache usage="read-write"/>
+ <id name="id"
+ type="java.lang.Long"
+ access="field">
+ <column name="ID" />
+ <generator class="native"/>
+ </id>
+ <many-to-one name="fromIdentityObject"
+
class="org.picketlink.idm.impl.model.hibernate.HibernateIdentityObject"
+ access="field"
+ fetch="select"
+ lazy="proxy">
+ <column name="FROM_IDENTITY"
+ not-null="true"
+ unique-key="id"/>
+ </many-to-one>
+ <many-to-one name="name"
+
class="org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipName"
+ access="field"
+ fetch="join"
+ lazy="proxy">
+ <column name="NAME"
+ unique-key="id"/>
+ </many-to-one>
+ <many-to-one name="toIdentityObject"
+
class="org.picketlink.idm.impl.model.hibernate.HibernateIdentityObject"
+ access="field"
+ fetch="select"
+ lazy="proxy">
+ <column name="TO_IDENTITY"
+ not-null="true"
+ unique-key="id"/>
+ </many-to-one>
+ <many-to-one name="type"
+
class="org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipType"
+ access="field"
+ fetch="select"
+ lazy="proxy">
+ <column name="REL_TYPE"
+ not-null="true"
+ unique-key="id" />
+ </many-to-one>
+ <map name="properties"
+ table="jbid_io_rel_props"
+ cascade="all, delete-orphan"
+ fetch="subselect"
+ lazy="extra">
+ <cache usage="read-write"/>
+ <key column="PROP_ID"/>
+ <map-key type="string"
+ column="PROP_NAME"/>
+ <element type="string"
+ column="PROP_VALUE"
+ not-null="true"/>
+ </map>
+ </class>
+</hibernate-mapping>
Added:
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectRelationshipName.hbm.xml
===================================================================
---
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectRelationshipName.hbm.xml
(rev 0)
+++
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectRelationshipName.hbm.xml 2011-07-22
04:52:05 UTC (rev 6913)
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD
3.0//EN"
+"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+<hibernate-mapping>
+ <class
name="org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipName"
+ table="jbid_io_rel_name">
+ <cache usage="read-write"/>
+
+ <id name="id"
+ type="java.lang.Long"
+ access="field">
+ <column name="ID"/>
+ <generator class="native"/>
+ </id>
+ <property name="name"
+ type="java.lang.String"
+ access="field"
+ lazy="false">
+ <column name="NAME"
+ not-null="true"
+ unique="true"
+ unique-key="id"/>
+ </property>
+ <map name="properties"
+ table="jbid_io_rel_name_props"
+ cascade="all, delete-orphan"
+ lazy="extra"
+ fetch="subselect">
+ <cache usage="read-write"/>
+ <key column="PROP_ID"/>
+ <map-key type="string"
+ column="PROP_NAME"/>
+ <element type="string"
+ column="PROP_VALUE"
+ not-null="true"/>
+ </map>
+ <many-to-one name="realm"
+
class="org.picketlink.idm.impl.model.hibernate.HibernateRealm"
+ access="field"
+ fetch="select"
+ lazy="proxy">
+ <column name="REALM"
+ not-null="true"
+ unique-key="id"/>
+ </many-to-one>
+
+ </class>
+</hibernate-mapping>
Added:
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectRelationshipType.hbm.xml
===================================================================
---
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectRelationshipType.hbm.xml
(rev 0)
+++
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectRelationshipType.hbm.xml 2011-07-22
04:52:05 UTC (rev 6913)
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD
3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+<hibernate-mapping>
+ <class
name="org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipType"
+ table="jbid_io_rel_type">
+ <cache usage="read-write"/>
+ <id name="id"
+ type="java.lang.Long"
+ access="field">
+ <column name="ID" />
+ <generator class="native"/>
+ </id>
+ <property name="name"
+ type="java.lang.String"
+ access="field"
+ lazy="false">
+ <column name="NAME"
+ not-null="true"
+ unique="true" />
+ </property>
+ </class>
+</hibernate-mapping>
Added:
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectType.hbm.xml
===================================================================
---
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectType.hbm.xml
(rev 0)
+++
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateIdentityObjectType.hbm.xml 2011-07-22
04:52:05 UTC (rev 6913)
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD
3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+<hibernate-mapping>
+ <class
name="org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectType"
+ table="jbid_io_type">
+ <cache usage="read-write"/>
+ <id name="id"
+ type="java.lang.Long"
+ access="field">
+ <column name="ID" />
+ <generator class="native"/>
+ </id>
+ <property name="name"
+ type="java.lang.String"
+ access="field"
+ lazy="false">
+ <column name="NAME"
+ not-null="true"
+ unique="true" />
+ </property>
+ </class>
+</hibernate-mapping>
Added:
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateRealm.hbm.xml
===================================================================
---
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateRealm.hbm.xml
(rev 0)
+++
portal/trunk/component/identity/src/test/resources/conf/mappings/HibernateRealm.hbm.xml 2011-07-22
04:52:05 UTC (rev 6913)
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD
3.0//EN"
+"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+<hibernate-mapping>
+ <class name="org.picketlink.idm.impl.model.hibernate.HibernateRealm"
+ table="jbid_realm">
+ <cache usage="read-write"/>
+ <id name="id"
+ type="java.lang.Long"
+ access="field">
+ <column name="ID" />
+ <generator class="native"/>
+ </id>
+ <property name="name"
+ type="java.lang.String"
+ access="field"
+ lazy="false">
+ <column name="NAME"
+ not-null="true"
+ unique-key="id"/>
+ </property>
+ <map name="properties"
+ table="jbid_real_props"
+ cascade="all, delete-orphan"
+ fetch="subselect"
+ lazy="extra">
+ <cache usage="read-write"/>
+ <key column="PROP_ID"/>
+ <map-key type="string"
+ column="PROP_NAME"/>
+ <element type="string"
+ column="PROP_VALUE"
+ not-null="true"/>
+ </map>
+ </class>
+</hibernate-mapping>
Deleted:
portal/trunk/component/identity/src/test/resources/conf/portal/idm-configuration.xml
===================================================================
---
portal/trunk/component/identity/src/test/resources/conf/portal/idm-configuration.xml 2011-07-22
03:13:14 UTC (rev 6912)
+++
portal/trunk/component/identity/src/test/resources/conf/portal/idm-configuration.xml 2011-07-22
04:52:05 UTC (rev 6913)
@@ -1,150 +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.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>mappings/HibernateRealm.hbm.xml</value>
-
<value>mappings/HibernateIdentityObjectCredentialBinaryValue.hbm.xml</value>
-
<value>mappings/HibernateIdentityObjectAttributeBinaryValue.hbm.xml</value>
- <value>mappings/HibernateIdentityObject.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectCredential.hbm.xml</value>
-
<value>mappings/HibernateIdentityObjectCredentialType.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectAttribute.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectType.hbm.xml</value>
-
<value>mappings/HibernateIdentityObjectRelationship.hbm.xml</value>
-
<value>mappings/HibernateIdentityObjectRelationshipType.hbm.xml</value>
-
<value>mappings/HibernateIdentityObjectRelationshipName.hbm.xml</value>
- </values-param>
- </init-params>
- </component-plugin>
- </external-component-plugins>
-</configuration>
Deleted:
portal/trunk/component/identity/src/test/resources/conf/portal/organization-configuration.xml
===================================================================
---
portal/trunk/component/identity/src/test/resources/conf/portal/organization-configuration.xml 2011-07-22
03:13:14 UTC (rev 6912)
+++
portal/trunk/component/identity/src/test/resources/conf/portal/organization-configuration.xml 2011-07-22
04:52:05 UTC (rev 6913)
@@ -1,124 +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>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>
Deleted:
portal/trunk/component/identity/src/test/resources/conf/portal/test-configuration.xml
===================================================================
---
portal/trunk/component/identity/src/test/resources/conf/portal/test-configuration.xml 2011-07-22
03:13:14 UTC (rev 6912)
+++
portal/trunk/component/identity/src/test/resources/conf/portal/test-configuration.xml 2011-07-22
04:52:05 UTC (rev 6913)
@@ -1,88 +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>
-
- <import>classpath:/conf/portal/idm-configuration.xml</import>
- <import>classpath:/conf/portal/organization-configuration.xml</import>
-</configuration>
\ No newline at end of file
Added:
portal/trunk/component/identity/src/test/resources/org/exoplatform/services/organization/TestOrganization-configuration.xml
===================================================================
---
portal/trunk/component/identity/src/test/resources/org/exoplatform/services/organization/TestOrganization-configuration.xml
(rev 0)
+++
portal/trunk/component/identity/src/test/resources/org/exoplatform/services/organization/TestOrganization-configuration.xml 2011-07-22
04:52:05 UTC (rev 6913)
@@ -0,0 +1,316 @@
+<?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>
Added:
portal/trunk/component/identity/src/test/resources/org/exoplatform/services/organization/TestOrganizationService-configuration.xml
===================================================================
---
portal/trunk/component/identity/src/test/resources/org/exoplatform/services/organization/TestOrganizationService-configuration.xml
(rev 0)
+++
portal/trunk/component/identity/src/test/resources/org/exoplatform/services/organization/TestOrganizationService-configuration.xml 2011-07-22
04:52:05 UTC (rev 6913)
@@ -0,0 +1,309 @@
+<?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>
Modified: portal/trunk/component/resources/pom.xml
===================================================================
--- portal/trunk/component/resources/pom.xml 2011-07-22 03:13:14 UTC (rev 6912)
+++ portal/trunk/component/resources/pom.xml 2011-07-22 04:52:05 UTC (rev 6913)
@@ -58,4 +58,19 @@
</dependency>
</dependencies>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <forkMode>always</forkMode>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
</project>
Modified:
portal/trunk/component/test/core/src/main/java/org/exoplatform/component/test/AbstractKernelTest.java
===================================================================
---
portal/trunk/component/test/core/src/main/java/org/exoplatform/component/test/AbstractKernelTest.java 2011-07-22
03:13:14 UTC (rev 6912)
+++
portal/trunk/component/test/core/src/main/java/org/exoplatform/component/test/AbstractKernelTest.java 2011-07-22
04:52:05 UTC (rev 6913)
@@ -19,15 +19,13 @@
package org.exoplatform.component.test;
-import junit.framework.AssertionFailedError;
+import junit.framework.TestSuite;
import org.exoplatform.container.PortalContainer;
import org.exoplatform.container.component.RequestLifeCycle;
-import java.io.File;
-import java.io.FilenameFilter;
-import java.util.EnumMap;
-import java.util.HashSet;
-import java.util.Set;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
/**
* An abstract test that takes care of running the unit tests with the semantic described
by the
@@ -39,14 +37,11 @@
public class AbstractKernelTest extends AbstractGateInTest
{
- /** The system property for gatein tmp dir. */
- private static final String TMP_DIR = "gatein.test.tmp.dir";
-
/** . */
- private PortalContainer container;
+ private static KernelBootstrap bootstrap;
/** . */
- private ClassLoader realClassLoader;
+ private static final Map<Class<?>, AtomicLong> counters = new
HashMap<Class<?>, AtomicLong>();
protected AbstractKernelTest()
{
@@ -60,12 +55,12 @@
public PortalContainer getContainer()
{
- return container;
+ return bootstrap != null ? bootstrap.getContainer() : null;
}
protected void begin()
{
- RequestLifeCycle.begin(container);
+ RequestLifeCycle.begin(getContainer());
}
protected void end()
@@ -76,104 +71,41 @@
@Override
protected void beforeRunBare() throws Exception
{
- realClassLoader = Thread.currentThread().getContextClassLoader();
+ Class<?> key = getClass();
//
- Set<String> rootConfigPaths = new HashSet<String>();
- rootConfigPaths.add("conf/root-configuration.xml");
-
- //
- Set<String> portalConfigPaths = new HashSet<String>();
- portalConfigPaths.add("conf/portal-configuration.xml");
-
- //
- EnumMap<ContainerScope, Set<String>> configs = new
EnumMap<ContainerScope, Set<String>>(ContainerScope.class);
- configs.put(ContainerScope.ROOT, rootConfigPaths);
- configs.put(ContainerScope.PORTAL, portalConfigPaths);
-
- //
- ConfiguredBy cfBy = getClass().getAnnotation(ConfiguredBy.class);
- if (cfBy != null)
+ if (!counters.containsKey(key))
{
- for (ConfigurationUnit src : cfBy.value())
- {
- configs.get(src.scope()).add(src.path());
- }
- }
+ counters.put(key, new AtomicLong(new TestSuite(getClass()).testCount()));
- // Take care of creating tmp directory for unit test
- if (System.getProperty(TMP_DIR) == null)
- {
- // Get base dir set by maven or die
- File targetDir = new File(new File(System.getProperty("basedir")),
"target");
- if (!targetDir.exists())
- {
- throw new AssertionFailedError("Target dir for unit test does not
exist");
- }
- if (!targetDir.isDirectory())
- {
- throw new AssertionFailedError("Target dir is not a directory");
- }
- if (!targetDir.canWrite())
- {
- throw new AssertionFailedError("Target dir is not writable");
- }
-
//
- Set<String> fileNames = new HashSet<String>();
- for (File child : targetDir.listFiles(new FilenameFilter()
- {
- public boolean accept(File dir, String name)
- {
- return name.startsWith("gateintest-");
- }
- }))
- {
- fileNames.add(child.getName());
- }
+ bootstrap = new
KernelBootstrap(Thread.currentThread().getContextClassLoader());
- //
- String fileName;
- int count = 0;
- while (true)
- {
- fileName = "gateintest-" + count;
- if (!fileNames.contains(fileName)) {
- break;
- }
- count++;
- }
+ // Configure ourselves
+ bootstrap.addConfiguration(getClass());
//
- File tmp = new File(targetDir, fileName);
- if (!tmp.mkdirs())
- {
- throw new AssertionFailedError("Could not create directory " +
tmp.getCanonicalPath());
- }
-
- //
- System.setProperty(TMP_DIR, tmp.getCanonicalPath());
+ bootstrap.boot();
}
//
- ClassLoader testClassLoader = new GateInTestClassLoader(realClassLoader,
rootConfigPaths, portalConfigPaths);
- Thread.currentThread().setContextClassLoader(testClassLoader);
-
- // Boot the container
- container = PortalContainer.getInstance();
-
- //
// List<Throwable> failures = new ArrayList<Throwable>();
}
@Override
protected void afterRunBare()
{
- container = null;
+ Class<?> key = getClass();
//
- Thread.currentThread().setContextClassLoader(realClassLoader);
+ if (counters.get(key).decrementAndGet() == 0)
+ {
+ bootstrap.dispose();
+ //
+ bootstrap = null;
+ }
+
/*
if (failures.size() > 0)
{
Modified:
portal/trunk/component/test/core/src/main/java/org/exoplatform/component/test/GateInTestClassLoader.java
===================================================================
---
portal/trunk/component/test/core/src/main/java/org/exoplatform/component/test/GateInTestClassLoader.java 2011-07-22
03:13:14 UTC (rev 6912)
+++
portal/trunk/component/test/core/src/main/java/org/exoplatform/component/test/GateInTestClassLoader.java 2011-07-22
04:52:05 UTC (rev 6913)
@@ -42,7 +42,7 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
* @version $Revision$
*/
-public final class GateInTestClassLoader extends ClassLoader
+final class GateInTestClassLoader extends ClassLoader
{
/** . */
Added:
portal/trunk/component/test/core/src/main/java/org/exoplatform/component/test/KernelBootstrap.java
===================================================================
---
portal/trunk/component/test/core/src/main/java/org/exoplatform/component/test/KernelBootstrap.java
(rev 0)
+++
portal/trunk/component/test/core/src/main/java/org/exoplatform/component/test/KernelBootstrap.java 2011-07-22
04:52:05 UTC (rev 6913)
@@ -0,0 +1,259 @@
+/*
+ * 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.component.test;
+
+import junit.framework.AssertionFailedError;
+import org.exoplatform.container.ExoContainerContext;
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.container.RootContainer;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.lang.reflect.Field;
+import java.util.EnumMap;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ */
+public class KernelBootstrap
+{
+
+ /** The system property for gatein tmp dir. */
+ private static final String TMP_DIR = "gatein.test.tmp.dir";
+
+ /** . */
+ private File tmpDir;
+
+ /** . */
+ private File targetDir;
+
+ /** . */
+ private EnumMap<ContainerScope, Set<String>> configs;
+
+ /** . */
+ private ClassLoader realClassLoader;
+
+ /** The portal container available once the kernel is booted. */
+ private PortalContainer container;
+
+ public KernelBootstrap()
+ {
+ this(Thread.currentThread().getContextClassLoader());
+ }
+
+ public KernelBootstrap(ClassLoader realClassLoader)
+ {
+
+ //
+ Set<String> rootConfigPaths = new LinkedHashSet<String>();
+ rootConfigPaths.add("conf/root-configuration.xml");
+ Set<String> portalConfigPaths = new LinkedHashSet<String>();
+ portalConfigPaths.add("conf/portal-configuration.xml");
+ EnumMap<ContainerScope, Set<String>> configs = new
EnumMap<ContainerScope, Set<String>>(ContainerScope.class);
+ configs.put(ContainerScope.ROOT, rootConfigPaths);
+ configs.put(ContainerScope.PORTAL, portalConfigPaths);
+
+ //
+ File targetDir = new File(new File(System.getProperty("basedir")),
"target");
+ if (!targetDir.exists())
+ {
+ throw new AssertionFailedError("Target dir for unit test does not
exist");
+ }
+ if (!targetDir.isDirectory())
+ {
+ throw new AssertionFailedError("Target dir is not a directory");
+ }
+ if (!targetDir.canWrite())
+ {
+ throw new AssertionFailedError("Target dir is not writable");
+ }
+
+
+ //
+ this.configs = configs;
+ this.targetDir = targetDir;
+ this.tmpDir = findTmpDir(targetDir);
+ this.realClassLoader = realClassLoader;
+ }
+
+ private static File findTmpDir(File dir)
+ {
+ Set<String> fileNames = new HashSet<String>();
+ for (File child : dir.listFiles(new FilenameFilter()
+ {
+ public boolean accept(File dir, String name)
+ {
+ return name.startsWith("gateintest-");
+ }
+ }))
+ {
+ fileNames.add(child.getName());
+ }
+
+ //
+ String fileName;
+ int count = 0;
+ while (true)
+ {
+ fileName = "gateintest-" + count;
+ if (!fileNames.contains(fileName)) {
+ break;
+ }
+ count++;
+ }
+
+ //
+ return new File(dir, fileName);
+ }
+
+ public File getTargetDir()
+ {
+ return targetDir;
+ }
+
+ public File getTmpDir()
+ {
+ return tmpDir;
+ }
+
+ /**
+ * Set the tmp dir of the test to a new file location. The new tmp dir must be a
strict descendant of the
+ * {@link #targetDir} file.
+ *
+ * @param tmpDir the new tmp dir
+ * @throws IllegalArgumentException if the tmp dir is not a descendant of the target
dir
+ */
+ public void setTmpDir(File tmpDir) throws IllegalArgumentException
+ {
+ for (File parent = tmpDir.getParentFile();!targetDir.equals(parent);parent =
parent.getParentFile())
+ {
+ if (parent == null)
+ {
+ throw new IllegalArgumentException("Wrong tmp dir " + tmpDir);
+ }
+ }
+
+ //
+ this.tmpDir = tmpDir;
+ }
+
+ public PortalContainer getContainer()
+ {
+ return container;
+ }
+
+ public void addConfiguration(ContainerScope scope, String path)
+ {
+ configs.get(scope).add(path);
+ }
+
+ public void addConfiguration(ConfigurationUnit unit)
+ {
+ addConfiguration(unit.scope(), unit.path());
+ }
+
+ public void addConfiguration(ConfiguredBy configuredBy)
+ {
+ for (ConfigurationUnit unit : configuredBy.value())
+ {
+ addConfiguration(unit);
+ }
+ }
+
+ public void addConfiguration(Class<?> clazz)
+ {
+ ConfiguredBy cfBy = clazz.getAnnotation(ConfiguredBy.class);
+ if (cfBy != null)
+ {
+ addConfiguration(cfBy);
+ }
+ }
+
+ /**
+ * Boot the kernel.
+ *
+ * @throws IllegalStateException if the kernel is already booted
+ */
+ public void boot() throws IllegalStateException
+ {
+ if (container != null)
+ {
+ throw new IllegalStateException("Already booted");
+ }
+ try
+ {
+ // Must clear the top container first otherwise it's not going to work well
+ // it's a bit ugly but I don't want to change anything in the
ExoContainerContext class for now
+ // and this is for unit testing
+ Field topContainerField =
ExoContainerContext.class.getDeclaredField("topContainer");
+ topContainerField.setAccessible(true);
+ topContainerField.set(null, null);
+
+ // Same remark than above
+ Field singletonField =
RootContainer.class.getDeclaredField("singleton_");
+ singletonField.setAccessible(true);
+ singletonField.set(null, null);
+
+ if (!tmpDir.exists())
+ {
+ if (!tmpDir.mkdirs())
+ {
+ throw new AssertionFailedError("Could not create directory " +
tmpDir.getAbsolutePath());
+ }
+ }
+
+ // Set property globally available for configuration XML
+ System.setProperty(TMP_DIR, tmpDir.getCanonicalPath());
+
+ //
+ ClassLoader testClassLoader = new GateInTestClassLoader(
+ realClassLoader,
+ configs.get(ContainerScope.ROOT),
+ configs.get(ContainerScope.PORTAL));
+ Thread.currentThread().setContextClassLoader(testClassLoader);
+
+ // Boot the container
+ this.container = PortalContainer.getInstance();
+ }
+ catch (Exception e)
+ {
+ AssertionFailedError afe = new AssertionFailedError();
+ afe.initCause(e);
+ throw afe;
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(realClassLoader);
+ }
+ }
+
+ public void dispose()
+ {
+ if (container != null)
+ {
+ RootContainer.getInstance().stop();
+ container = null;
+ ExoContainerContext.setCurrentContainer(null);
+ }
+ }
+}
Added:
portal/trunk/component/test/core/src/main/java/org/exoplatform/component/test/KernelTestSuite.java
===================================================================
---
portal/trunk/component/test/core/src/main/java/org/exoplatform/component/test/KernelTestSuite.java
(rev 0)
+++
portal/trunk/component/test/core/src/main/java/org/exoplatform/component/test/KernelTestSuite.java 2011-07-22
04:52:05 UTC (rev 6913)
@@ -0,0 +1,64 @@
+/*
+ * 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.component.test;
+
+import junit.framework.TestResult;
+import junit.framework.TestSuite;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ */
+final class KernelTestSuite extends TestSuite
+{
+
+ /** . */
+ private final Class<? extends AbstractKernelTest> testClass;
+
+ KernelTestSuite(Class<? extends AbstractKernelTest> testClass)
+ {
+ super(testClass);
+
+ //
+ this.testClass = testClass;
+ }
+
+ @Override
+ public void run(TestResult result)
+ {
+ KernelBootstrap bootstrap = new
KernelBootstrap(Thread.currentThread().getContextClassLoader());
+
+ //
+ try
+ {
+ // Configure ourselves
+ bootstrap.addConfiguration(testClass);
+
+ //
+ bootstrap.boot();
+
+ //
+ super.run(result);
+ }
+ finally
+ {
+ bootstrap.dispose();
+ }
+ }
+}
Modified:
portal/trunk/component/test/core/src/main/resources/conf/portal-configuration.xml
===================================================================
---
portal/trunk/component/test/core/src/main/resources/conf/portal-configuration.xml 2011-07-22
03:13:14 UTC (rev 6912)
+++
portal/trunk/component/test/core/src/main/resources/conf/portal-configuration.xml 2011-07-22
04:52:05 UTC (rev 6913)
@@ -21,8 +21,8 @@
-->
<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">
+
xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_2.xsd
http://www.exoplaform.org/xml/ns/kernel_1_2.xsd"
+
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_2.xsd">
<component>
<key>org.exoplatform.services.naming.InitialContextInitializer</key>
@@ -55,14 +55,22 @@
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</value-param>
- <properties-param>
+ <properties-param profiles="hsqldb">
<name>ref-addresses</name>
<description>ref-addresses</description>
- <property name="driverClassName"
value="${gatein.test.datasource.driver}"/>
- <property name="url"
value="${gatein.test.datasource.url}"/>
- <property name="username"
value="${gatein.test.datasource.username}"/>
- <property name="password"
value="${gatein.test.datasource.password}"/>
+ <property name="driverClassName"
value="org.hsqldb.jdbcDriver"/>
+ <property name="url"
value="jdbc:hsqldb:file:${gatein.test.tmp.dir}/db/data/jdbcjcr"/>
+ <property name="username" value="sa"/>
+ <property name="password" value=""/>
</properties-param>
+ <properties-param profiles="mysql">
+ <name>ref-addresses</name>
+ <description>ref-addresses</description>
+ <property name="driverClassName"
value="com.mysql.jdbc.Driver"/>
+ <property name="url"
value="jdbc:mysql://10.37.129.4/jdbcjcr?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=utf-8"/>
+ <property name="username" value="root"/>
+ <property name="password" value=""/>
+ </properties-param>
</init-params>
</component-plugin>
</external-component-plugins>
Modified:
portal/trunk/component/test/core/src/test/java/org/exoplatform/component/test/BootstrapTestCase.java
===================================================================
---
portal/trunk/component/test/core/src/test/java/org/exoplatform/component/test/BootstrapTestCase.java 2011-07-22
03:13:14 UTC (rev 6912)
+++
portal/trunk/component/test/core/src/test/java/org/exoplatform/component/test/BootstrapTestCase.java 2011-07-22
04:52:05 UTC (rev 6913)
@@ -32,10 +32,7 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
* @version $Revision$
*/
-@ConfiguredBy({
- @ConfigurationUnit(scope = ContainerScope.PORTAL, path =
"conf/jcr/jcr-configuration.xml"),
- @ConfigurationUnit(scope = ContainerScope.PORTAL, path =
"conf/test-configuration.xml")
-})
+@ConfiguredBy({@ConfigurationUnit(scope = ContainerScope.PORTAL, path =
"conf/test-configuration.xml")})
public class BootstrapTestCase extends AbstractKernelTest
{
@@ -100,6 +97,5 @@
assertTrue(f.exists());
assertTrue(f.isDirectory());
assertTrue(f.canWrite());
- assertEquals(0, f.list().length);
}
}
Added:
portal/trunk/component/test/core/src/test/java/org/exoplatform/component/test/KernelBootstrapTestCase.java
===================================================================
---
portal/trunk/component/test/core/src/test/java/org/exoplatform/component/test/KernelBootstrapTestCase.java
(rev 0)
+++
portal/trunk/component/test/core/src/test/java/org/exoplatform/component/test/KernelBootstrapTestCase.java 2011-07-22
04:52:05 UTC (rev 6913)
@@ -0,0 +1,119 @@
+/*
+ * 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.component.test;
+
+import junit.framework.TestCase;
+import org.exoplatform.container.PortalContainer;
+
+import java.io.File;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ */
+public class KernelBootstrapTestCase extends TestCase
+{
+
+ public void testReboot()
+ {
+ KernelBootstrap bootstrap = new KernelBootstrap();
+ bootstrap.boot();
+ PortalContainer container1 = bootstrap.getContainer();
+ bootstrap.dispose();
+ bootstrap.boot();
+ PortalContainer container2 = bootstrap.getContainer();
+ assertNotSame(container1, container2);
+ }
+
+ public void testGetTmpDir()
+ {
+ KernelBootstrap bootstrap = new KernelBootstrap();
+ assertEquals(bootstrap.getTargetDir(), bootstrap.getTmpDir().getParentFile());
+ }
+
+ public void testSetTmpDir()
+ {
+ KernelBootstrap bootstrap = new KernelBootstrap();
+ try
+ {
+ bootstrap.setTmpDir(new File("a"));
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ bootstrap.setTmpDir(bootstrap.getTargetDir());
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ bootstrap.setTmpDir(new File(bootstrap.getTargetDir(), "a"));
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ }
+
+ public void testTmpDirLifeCycle()
+ {
+ KernelBootstrap bootstrap = new KernelBootstrap();
+ try
+ {
+ File tmp = bootstrap.getTmpDir();
+ assertFalse(tmp.exists());
+ tmp = bootstrap.getTmpDir();
+ bootstrap.boot();
+ assertTrue(tmp.exists());
+ }
+ finally
+ {
+ bootstrap.dispose();
+ }
+ }
+
+ public void testUseExistingTmpDir()
+ {
+ KernelBootstrap bootstrap = new KernelBootstrap();
+ File tmp;
+ try
+ {
+ bootstrap.boot();
+ tmp = bootstrap.getTmpDir();
+ }
+ finally
+ {
+ bootstrap.dispose();
+ }
+ try
+ {
+ bootstrap = new KernelBootstrap();
+ bootstrap.setTmpDir(tmp);
+ bootstrap.boot();
+ }
+ finally
+ {
+ bootstrap.dispose();
+ }
+ }
+}
Modified: portal/trunk/component/test/pom.xml
===================================================================
--- portal/trunk/component/test/pom.xml 2011-07-22 03:13:14 UTC (rev 6912)
+++ portal/trunk/component/test/pom.xml 2011-07-22 04:52:05 UTC (rev 6913)
@@ -33,7 +33,6 @@
<modules>
<module>core</module>
<module>jcr</module>
- <module>organization</module>
</modules>
</project>
Modified: portal/trunk/pom.xml
===================================================================
--- portal/trunk/pom.xml 2011-07-22 03:13:14 UTC (rev 6912)
+++ portal/trunk/pom.xml 2011-07-22 04:52:05 UTC (rev 6913)
@@ -436,6 +436,12 @@
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
+ <artifactId>exo.portal.component.identity</artifactId>
+ <version>3.2.0-M02-SNAPSHOT</version>
+ <type>test-jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.resources</artifactId>
<version>3.2.0-M02-SNAPSHOT</version>
</dependency>
@@ -513,17 +519,6 @@
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
- <artifactId>exo.portal.component.test.organization</artifactId>
- <version>3.2.0-M02-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.exoplatform.portal</groupId>
- <artifactId>exo.portal.component.test.organization</artifactId>
- <version>3.2.0-M02-SNAPSHOT</version>
- <type>test-jar</type>
- </dependency>
- <dependency>
- <groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.server.jboss.plugin</artifactId>
<version>3.2.0-Beta01-SNAPSHOT</version>
</dependency>
@@ -892,21 +887,9 @@
<value>${project.build.directory}</value>
</property>
<property>
- <name>gatein.test.datasource.driver</name>
- <value>org.hsqldb.jdbcDriver</value>
+ <name>exo.profiles</name>
+ <value>hsqldb</value>
</property>
- <property>
- <name>gatein.test.datasource.url</name>
- <value>jdbc:hsqldb:mem:gateindb</value>
- </property>
- <property>
- <name>gatein.test.datasource.username</name>
- <value>sa</value>
- </property>
- <property>
- <name>gatein.test.datasource.password</name>
- <value />
- </property>
</systemProperties>
</configuration>
</plugin>
@@ -945,21 +928,9 @@
<value>${project.build.directory}</value>
</property>
<property>
- <name>gatein.test.datasource.driver</name>
- <value>com.mysql.jdbc.Driver</value>
+ <name>exo.profiles</name>
+ <value>mysql</value>
</property>
- <property>
- <name>gatein.test.datasource.url</name>
-
<value>jdbc:mysql://10.37.129.4/gatein?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=utf-8</value>
- </property>
- <property>
- <name>gatein.test.datasource.username</name>
- <value>root</value>
- </property>
- <property>
- <name>gatein.test.datasource.password</name>
- <value>a</value>
- </property>
</systemProperties>
</configuration>
</plugin>
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/BasePartialUpdateToolbar.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/BasePartialUpdateToolbar.java 2011-07-22
03:13:14 UTC (rev 6912)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/BasePartialUpdateToolbar.java 2011-07-22
04:52:05 UTC (rev 6913)
@@ -79,7 +79,7 @@
}
else
{
- toolbarScope = new GenericScope(level);
+ toolbarScope = GenericScope.treeShape(level);
}
}
Modified:
portal/trunk/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UINavigationPortlet.java
===================================================================
---
portal/trunk/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UINavigationPortlet.java 2011-07-22
03:13:14 UTC (rev 6912)
+++
portal/trunk/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UINavigationPortlet.java 2011-07-22
04:52:05 UTC (rev 6913)
@@ -80,7 +80,7 @@
}
else
{
- portalNavigation.setScope(new GenericScope(level));
+ portalNavigation.setScope(GenericScope.treeShape(level));
}
}
Modified:
portal/trunk/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UISitemapPortlet.java
===================================================================
---
portal/trunk/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UISitemapPortlet.java 2011-07-22
03:13:14 UTC (rev 6912)
+++
portal/trunk/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UISitemapPortlet.java 2011-07-22
04:52:05 UTC (rev 6913)
@@ -90,7 +90,7 @@
}
else
{
- uiPortalNavigation.setScope(new GenericScope(level));
+ uiPortalNavigation.setScope(GenericScope.treeShape(level));
}
}
Modified:
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml
===================================================================
---
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml 2011-07-22
03:13:14 UTC (rev 6912)
+++
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml 2011-07-22
04:52:05 UTC (rev 6913)
@@ -180,6 +180,7 @@
</field>
<field
name="ownerType"><string>portal</string></field>
<field
name="templateLocation"><string>war:/conf/portal/</string></field>
+ <field
name="importMode"><string>conserve</string></field>
</object>
</object-param>
<object-param>
@@ -194,8 +195,9 @@
<value><string>/organization/management/executive-board</string></value>
</collection>
</field>
- <field
name="ownerType"><string>group</string></field>
- <field
name="templateLocation"><string>war:/conf/portal</string></field>
+ <field
name="ownerType"><string>group</string></field>
+ <field
name="templateLocation"><string>war:/conf/portal</string></field>
+ <field
name="importMode"><string>conserve</string></field>
</object>
</object-param>
<object-param>
@@ -211,8 +213,9 @@
<value><string>user</string></value>
</collection>
</field>
- <field
name="ownerType"><string>user</string></field>
- <field
name="templateLocation"><string>war:/conf/portal</string></field>
+ <field
name="ownerType"><string>user</string></field>
+ <field
name="templateLocation"><string>war:/conf/portal</string></field>
+ <field
name="importMode"><string>conserve</string></field>
</object>
</object-param>
</init-params>
@@ -251,6 +254,8 @@
</value-param>
<values-param>
<name>entities</name>
+
+ <!-- The MOP node types -->
<value>org.gatein.mop.core.api.workspace.WorkspaceImpl</value>
<value>org.gatein.mop.core.api.workspace.UIContainerImpl</value>
<value>org.gatein.mop.core.api.workspace.UIWindowImpl</value>
@@ -281,6 +286,8 @@
<value>org.gatein.mop.core.api.workspace.content.ContextSpecialization</value>
<value>org.gatein.mop.core.api.workspace.content.WorkspaceClone</value>
<value>org.gatein.mop.core.api.workspace.content.WorkspaceSpecialization</value>
+
+ <!-- GateIn node types -->
<value>org.exoplatform.portal.pom.spi.portlet.PortletState</value>
<value>org.exoplatform.portal.pom.spi.portlet.PreferenceState</value>
<value>org.exoplatform.portal.pom.spi.gadget.GadgetState</value>
@@ -291,6 +298,7 @@
<value>org.exoplatform.portal.mop.i18n.I18Nized</value>
<value>org.exoplatform.portal.mop.i18n.LanguageSpace</value>
<value>org.exoplatform.portal.mop.i18n.Language</value>
+ <value>org.exoplatform.portal.mop.importer.Imported</value>
</values-param>
<properties-param>
<name>options</name>
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java 2011-07-22
03:13:14 UTC (rev 6912)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java 2011-07-22
04:52:05 UTC (rev 6913)
@@ -27,8 +27,10 @@
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.Visibility;
import org.exoplatform.portal.mop.user.UserNavigation;
import org.exoplatform.portal.mop.user.UserNode;
+import org.exoplatform.portal.mop.user.UserNodeFilterConfig;
import org.exoplatform.portal.mop.user.UserPortal;
import org.exoplatform.portal.webui.application.UIGadget;
import org.exoplatform.portal.webui.portal.PageNodeEvent;
@@ -62,7 +64,9 @@
UserPortal userPortal = uiPortalApp.getUserPortalConfig().getUserPortal();
String uri = ((PageNodeEvent<UIPortal>)event).getTargetNodeUri();
- UserNode naviPath = userPortal.resolvePath(null, uri);
+ UserNodeFilterConfig.Builder builder = UserNodeFilterConfig.builder();
+ builder.withAuthorizationCheck();
+ UserNode naviPath = userPortal.resolvePath(builder.build(), uri);
UserNavigation targetNav = naviPath.getNavigation();
UserNode currentNavPath = showedUIPortal.getNavPath();