JBoss Identity SVN: r486 - in idm/trunk: idm-cache and 12 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-05-09 11:06:22 -0400 (Sat, 09 May 2009)
New Revision: 486
Added:
idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/
idm/trunk/idm-core/src/test/resources/organization-test-config.xml
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/cache/
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/cache/IdentityStoreCacheProvider.java
Removed:
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/IdentityStoreCacheSupport.java
Modified:
idm/trunk/assembly/sources.xml
idm/trunk/idm-cache/pom.xml
idm/trunk/idm-core/pom.xml
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheAttributeStoreWrapper.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreWrapper.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/repository/AbstractIdentityStoreRepository.java
idm/trunk/idm-hibernate/pom.xml
idm/trunk/idm-ldap/pom.xml
idm/trunk/idm-testsuite/pom.xml
idm/trunk/idm-testsuite/src/test/resources/organization-test-config.xml
idm/trunk/idm-testsuite/src/test/resources/organization-test-jboss-unit-config.xml
idm/trunk/parent/pom.xml
Log:
detach the jboss cache dependency into separate module
(still a bit messy - need to have a clean cache SPI)
Modified: idm/trunk/assembly/sources.xml
===================================================================
--- idm/trunk/assembly/sources.xml 2009-05-09 11:10:49 UTC (rev 485)
+++ idm/trunk/assembly/sources.xml 2009-05-09 15:06:22 UTC (rev 486)
@@ -22,9 +22,26 @@
<directory>${basedir}/../idm-spi/src/main/java</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
- <fileSet>
- <directory>${basedir}/../idm/src/main/java</directory>
+ <fileSet>
+ <directory>${basedir}/../idm-core/src/main/java</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
+ <fileSet>
+ <directory>${basedir}/../idm-hibernate/src/main/java</directory>
+ <outputDirectory>/</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>${basedir}/../idm-ldap/src/main/java</directory>
+ <outputDirectory>/</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>${basedir}/../idm-cache/src/main/java</directory>
+ <outputDirectory>/</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>${basedir}/../idm-auth/src/main/java</directory>
+ <outputDirectory>/</outputDirectory>
+ </fileSet>
+
</fileSets>
</assembly>
Modified: idm/trunk/idm-cache/pom.xml
===================================================================
--- idm/trunk/idm-cache/pom.xml 2009-05-09 11:10:49 UTC (rev 485)
+++ idm/trunk/idm-cache/pom.xml 2009-05-09 15:06:22 UTC (rev 486)
@@ -64,101 +64,9 @@
</systemProperties>
</configuration>
</plugin>
- <!--<plugin>-->
- <!--<groupId>org.jboss.unit</groupId>-->
- <!--<artifactId>jboss-unit-tooling-maven2</artifactId>-->
- <!--<executions>-->
- <!--<execution>-->
- <!--<phase>test</phase>-->
- <!--<goals>-->
- <!--<goal>execute</goal>-->
- <!--</goals>-->
- <!--</execution>-->
- <!--</executions>-->
- <!--<configuration>-->
- <!--<jpda>true</jpda>-->
- <!--<jpdaPort>5005</jpdaPort>-->
- <!--<jpdaSuspend>true</jpdaSuspend>-->
- <!--<failOnError>true</failOnError>-->
-
-
- <!--<testsuites>-->
- <!--<testsuite>-->
- <!--<config>jboss-unit.xml</config>-->
- <!--<parameters>-->
- <!--<parameter>-->
- <!--<name>dataSourceName</name>-->
- <!--<values>-->
- <!--<value>hsqldb</value>-->
- <!--<value>mysql5</value>-->
- <!--<value>mysql4</value>-->
- <!--<value>postgresql8</value>-->
- <!--<value>sqlserver</value>-->
- <!--<value>oracle9i</value>-->
- <!--<value>oracle10g</value>-->
- <!--</values>-->
- <!--</parameter>-->
- <!--</parameters>-->
-
-
- <!--</testsuite>-->
- <!--</testsuites>-->
-
- <!--<reports>-->
- <!--<xml>idm/target/tests/reports/xml</xml>-->
- <!--<html>idm/target/tests/reports/html</html>-->
- <!--</reports>-->
- <!--</configuration>-->
- <!--</plugin>-->
-
</plugins>
</build>
- <profiles>
- <profile>
- <id>provided-jdbc-driver</id>
- <dependencies>
- <dependency>
- <groupId>privided</groupId>
- <artifactId>jdbc-driver</artifactId>
- <version>NA</version>
- <scope>system</scope>
- <systemPath>${provided.jdbc.driver.path}</systemPath>
- </dependency>
- </dependencies>
- </profile>
- <profile>
- <id>provided-jdbc-driver2</id>
- <dependencies>
- <dependency>
- <groupId>privided</groupId>
- <artifactId>jdbc-driver2</artifactId>
- <version>NA</version>
- <scope>system</scope>
- <systemPath>${provided.jdbc.driver.path2}</systemPath>
- </dependency>
- </dependencies>
- </profile>
- <!--<profile>-->
- <!--<id>oracle-provided-jdbc-drivers</id>-->
- <!--<dependencies>-->
- <!--<dependency>-->
- <!--<groupId>oracle</groupId>-->
- <!--<artifactId>jdbc-driver1</artifactId>-->
- <!--<version>NA</version>-->
- <!--<scope>system</scope>-->
- <!--<systemPath>${oracle.jdbc.driver1}</systemPath>-->
- <!--</dependency>-->
- <!--<dependency>-->
- <!--<groupId>oracle</groupId>-->
- <!--<artifactId>jdbc-driver2</artifactId>-->
- <!--<version>NA</version>-->
- <!--<scope>system</scope>-->
- <!--<systemPath>${oracle.jdbc.driver1}</systemPath>-->
- <!--</dependency>-->
- <!--</dependencies>-->
- <!--</profile>-->
- </profiles>
</project>
Modified: idm/trunk/idm-core/pom.xml
===================================================================
--- idm/trunk/idm-core/pom.xml 2009-05-09 11:10:49 UTC (rev 485)
+++ idm/trunk/idm-core/pom.xml 2009-05-09 15:06:22 UTC (rev 486)
@@ -48,68 +48,13 @@
<artifactId>jaxb-impl</artifactId>
<version>2.1.8</version>
</dependency>
- <dependency>
- <groupId>javax.persistence</groupId>
- <artifactId>persistence-api</artifactId>
- <version>1.0</version>
- </dependency>
- <!-- hibernate -->
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-core</artifactId>
- <version>3.3.1.GA</version>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-annotations</artifactId>
- <version>3.4.0.GA</version>
- </dependency>
- <!--Javassist as Hibernate's bytecode provider-->
- <dependency>
- <groupId>javassist</groupId>
- <artifactId>javassist</artifactId>
- <version>3.4.GA</version>
- </dependency>
-
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-cglib-repack</artifactId>
- <version>2.1_3</version>
- </dependency>
-
-
- <!-- Hibernate logging set up -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>1.5.2</version>
- </dependency>
- <!--<dependency>-->
- <!--<groupId>log4j</groupId>-->
- <!--<artifactId>log4j</artifactId>-->
- <!--<version>1.2.14</version>-->
- <!--</dependency>-->
-
-
<dependency>
- <groupId>org.jboss.cache</groupId>
- <artifactId>jbosscache-core</artifactId>
- <version>3.0.2.GA</version>
- </dependency>
-
- <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>hsqldb</groupId>
- <artifactId>hsqldb</artifactId>
- <version>1.8.0.7</version>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>sun-opends</groupId>
<artifactId>OpenDS</artifactId>
<version>1.0.0</version>
@@ -122,91 +67,6 @@
<scope>test</scope>
</dependency>
- <!--JBoss Unit-->
-
- <dependency>
- <groupId>org.jboss.unit</groupId>
- <artifactId>jboss-unit</artifactId>
- <version>1.2.2</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.unit</groupId>
- <artifactId>portal-test</artifactId>
- <version>1.2.2</version>
-
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>hibernate</groupId>
- <artifactId>hibernate3</artifactId>
- </exclusion>
- <exclusion>
- <groupId>sun-opends</groupId>
- <artifactId>opends-core</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>jboss.jbossas.core-libs</groupId>
- <artifactId>jboss-local-jdbc</artifactId>
- <version>4.0.4.GA</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>jboss.jbossas.core-libs</groupId>
- <artifactId>jboss-common-jdbc-wrapper</artifactId>
- <version>4.0.4.GA</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-logging-spi</artifactId>
- <version>2.0.2.GA</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-logging-jdk</artifactId>
- <version>2.0.2.GA</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-logging-log4j</artifactId>
- <version>2.0.2.GA</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>apache-log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- <version>5.1.6</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>postgresql</groupId>
- <artifactId>postgresql</artifactId>
- <version>8.3-604.jdbc3</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>net.sourceforge.jtds</groupId>
- <artifactId>jtds</artifactId>
- <version>1.2.2</version>
- <scope>test</scope>
- </dependency>
-
-
-
-
</dependencies>
@@ -242,101 +102,9 @@
</execution>
</executions>
</plugin>
- <!--<plugin>-->
- <!--<groupId>org.jboss.unit</groupId>-->
- <!--<artifactId>jboss-unit-tooling-maven2</artifactId>-->
- <!--<executions>-->
- <!--<execution>-->
- <!--<phase>test</phase>-->
- <!--<goals>-->
- <!--<goal>execute</goal>-->
- <!--</goals>-->
- <!--</execution>-->
- <!--</executions>-->
- <!--<configuration>-->
- <!--<jpda>true</jpda>-->
- <!--<jpdaPort>5005</jpdaPort>-->
- <!--<jpdaSuspend>true</jpdaSuspend>-->
-
- <!--<failOnError>true</failOnError>-->
-
-
- <!--<testsuites>-->
- <!--<testsuite>-->
- <!--<config>jboss-unit.xml</config>-->
- <!--<parameters>-->
- <!--<parameter>-->
- <!--<name>dataSourceName</name>-->
- <!--<values>-->
- <!--<value>hsqldb</value>-->
- <!--<value>mysql5</value>-->
- <!--<value>mysql4</value>-->
- <!--<value>postgresql8</value>-->
- <!--<value>sqlserver</value>-->
- <!--<value>oracle9i</value>-->
- <!--<value>oracle10g</value>-->
- <!--</values>-->
- <!--</parameter>-->
- <!--</parameters>-->
-
-
- <!--</testsuite>-->
- <!--</testsuites>-->
-
- <!--<reports>-->
- <!--<xml>idm/target/tests/reports/xml</xml>-->
- <!--<html>idm/target/tests/reports/html</html>-->
- <!--</reports>-->
- <!--</configuration>-->
- <!--</plugin>-->
-
</plugins>
</build>
- <profiles>
- <profile>
- <id>provided-jdbc-driver</id>
- <dependencies>
- <dependency>
- <groupId>privided</groupId>
- <artifactId>jdbc-driver</artifactId>
- <version>NA</version>
- <scope>system</scope>
- <systemPath>${provided.jdbc.driver.path}</systemPath>
- </dependency>
- </dependencies>
- </profile>
- <profile>
- <id>provided-jdbc-driver2</id>
- <dependencies>
- <dependency>
- <groupId>privided</groupId>
- <artifactId>jdbc-driver2</artifactId>
- <version>NA</version>
- <scope>system</scope>
- <systemPath>${provided.jdbc.driver.path2}</systemPath>
- </dependency>
- </dependencies>
- </profile>
- <!--<profile>-->
- <!--<id>oracle-provided-jdbc-drivers</id>-->
- <!--<dependencies>-->
- <!--<dependency>-->
- <!--<groupId>oracle</groupId>-->
- <!--<artifactId>jdbc-driver1</artifactId>-->
- <!--<version>NA</version>-->
- <!--<scope>system</scope>-->
- <!--<systemPath>${oracle.jdbc.driver1}</systemPath>-->
- <!--</dependency>-->
- <!--<dependency>-->
- <!--<groupId>oracle</groupId>-->
- <!--<artifactId>jdbc-driver2</artifactId>-->
- <!--<version>NA</version>-->
- <!--<scope>system</scope>-->
- <!--<systemPath>${oracle.jdbc.driver1}</systemPath>-->
- <!--</dependency>-->
- <!--</dependencies>-->
- <!--</profile>-->
- </profiles>
+
</project>
Deleted: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/IdentityStoreCacheSupport.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/IdentityStoreCacheSupport.java 2009-05-09 11:10:49 UTC (rev 485)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/IdentityStoreCacheSupport.java 2009-05-09 15:06:22 UTC (rev 486)
@@ -1,912 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-package org.jboss.identity.idm.impl.cache;
-
-import org.jboss.cache.Fqn;
-import org.jboss.cache.Cache;
-import org.jboss.cache.Node;
-import org.jboss.identity.idm.spi.model.IdentityObject;
-import org.jboss.identity.idm.spi.model.IdentityObjectAttribute;
-import org.jboss.identity.idm.spi.model.IdentityObjectType;
-import org.jboss.identity.idm.spi.model.IdentityObjectRelationshipType;
-import org.jboss.identity.idm.spi.model.IdentityObjectRelationship;
-import org.jboss.identity.idm.spi.search.IdentityObjectSearchCriteria;
-
-import java.util.logging.Logger;
-import java.util.logging.Level;
-import java.util.Map;
-import java.util.Set;
-import java.util.Collection;
-
-/**
- * Helper class providing caching support for IdentityStore. Stores search methods results using hash from a set of used
- * IdentityObjectSearchControl objects as a key. *
- *
- * TODO: update cache tree structure documentation to all used nodes/keys...
- * Cache structure:
- *
- * CACHE_ROOT (real)
- * |
- * |-JBID_ROOT_NODE
- * |
- * |-OBJECT_TYPES_NODE
- * | |
- * | |-OBJECT_TYPES_IDS_NODE
- * | | |
- * | | |- (IdentityObjectType names)
- * | | | key[NODE_OBJECT_KEY] -> IdentityObject
- * | | |- ...
- * | |
- * | |-OBJECT_TYPES_NAMES_NODE
- * | | |
- * | | |- (IdentityObjectType names)
- * | | | key[NODE_OBJECT_KEY] -> IdentityObject
- * | | | key[NODE_ATTRIBUTES_KEY] -> Map<String, IdentityObjectAttribute>
- * | | |- ...
- * | |
- * | |-OBJECT_TYPES_SEARCH_NODE
- * | |
- * | |
- * | |- ...
- * |
- * |-RELATIONSHIPS_NODE
- * |
-
- *
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public abstract class IdentityStoreCacheSupport
-{
-
- //Structure
- public static final String JBID_ROOT_NODE = "/jboss_id_idm";
-
- public static final String OBJECT_TYPES_NODE = JBID_ROOT_NODE + "/object_types";
-
- public static final String OBJECT_TYPES_IDS_NODE = OBJECT_TYPES_NODE + "/by_ids";
-
- public static final String OBJECT_TYPES_NAMES_NODE = OBJECT_TYPES_NODE + "/by_names";
-
- public static final String OBJECT_TYPES_SEARCH_BY_TYPE_NODE = OBJECT_TYPES_NODE + "/search_by_type";
-
- public static final String OBJECT_TYPES_SEARCH_NODE = OBJECT_TYPES_NODE + "/search";
-
- // Don't populate children as resident nodes!
- public static final String OBJECT_TYPES_COUNT_NODE = OBJECT_TYPES_NODE + "/count";
-
- public static final String RELATIONSHIPS_SEARCH_NODE = JBID_ROOT_NODE + "/relationship_types_names";
-
- public static final String RELATIONSHIPS_SEARCH_SIMPLE_NODE = RELATIONSHIPS_SEARCH_NODE + "/simple";
-
- public static final String RELATIONSHIPS_SEARCH_COMPLEX_NODE = RELATIONSHIPS_SEARCH_NODE + "/complex";
-
- public static final String RELATIONSHIP_NAMES_SEARCH_NODE = JBID_ROOT_NODE + "/relationship_names_search";
-
- public static final String RELATIONSHIP_NAMES_SEARCH_IO_NODE = RELATIONSHIP_NAMES_SEARCH_NODE + "/identity_object";
-
- public static final String RELATIONSHIP_NAMES_SEARCH_ALL_NODE = RELATIONSHIP_NAMES_SEARCH_NODE + "/all";
-
- // Node keys
-
- public static final String NODE_OBJECT_KEY = "object";
-
- public static final String NODE_ATTRIBUTES_KEY = "attributes";
-
- public static final String NODE_REL_NAME_KEY = "relationship_name";
-
- public static final String NODE_REL_TYPE_KEY = "relationship_type";
-
- public static final String NODE_REL_FROM_KEY = "relationship_from";
-
- public static final String NODE_REL_TO_KEY = "relationship_to";
-
- public static final String NODE_SEARCH_RESULTS_KEY = "search_results";
-
-
- // FQNs
-
- public static final Fqn FQN_OBJECT_TYPES = Fqn.fromString(OBJECT_TYPES_NODE);
-
- public static final Fqn FQN_OBJECT_TYPES_NAMES = Fqn.fromString(OBJECT_TYPES_NAMES_NODE);
-
- public static final Fqn FQN_OBJECT_TYPES_IDS = Fqn.fromString(OBJECT_TYPES_IDS_NODE);
-
- public static final Fqn FQN_OBJECT_TYPES_SEARCH_BY_TYPE = Fqn.fromString(OBJECT_TYPES_SEARCH_BY_TYPE_NODE);
-
- public static final Fqn FQN_OBJECT_TYPES_SEARCH = Fqn.fromString(OBJECT_TYPES_SEARCH_NODE);
-
- public static final Fqn FQN_OBJECT_TYPES_COUNT = Fqn.fromString(OBJECT_TYPES_COUNT_NODE);
-
- public static final Fqn FQN_RELATIONSHIPS = Fqn.fromString(RELATIONSHIPS_SEARCH_NODE);
-
- public static final Fqn FQN_RELATIONSHIPS_COMPLEX = Fqn.fromString(RELATIONSHIPS_SEARCH_COMPLEX_NODE);
-
- public static final Fqn FQN_RELATIONSHIPS_SIMPLE = Fqn.fromString(RELATIONSHIPS_SEARCH_SIMPLE_NODE);
-
-
- private Fqn createIONameNodeFQN(String ioTypeName, String ioName)
- {
- return Fqn.fromElements(OBJECT_TYPES_NAMES_NODE, ioTypeName, ioName);
- }
-
- private Fqn createIONameNodeFQN(IdentityObject io)
- {
- return Fqn.fromElements(OBJECT_TYPES_NAMES_NODE, io.getIdentityType().getName(), io.getName());
- }
-
- private Fqn createIOIdNodeFQN(IdentityObject io)
- {
- return Fqn.fromElements(OBJECT_TYPES_IDS_NODE, io.getIdentityType().getName(), io.getId());
- }
-
- private Fqn createIOTypeCountNodeFQN(IdentityObjectType iot)
- {
- return Fqn.fromElements(OBJECT_TYPES_COUNT_NODE, iot.getName());
- }
-
- private Fqn createIOTypeSearchNodeFQN(IdentityObjectType iot, Object searchId)
- {
- return Fqn.fromElements(OBJECT_TYPES_SEARCH_BY_TYPE_NODE, iot.getName(), searchId);
- }
-
- private Fqn createIOSearchNodeFQN(IdentityObject io, IdentityObjectRelationshipType relationshipType, boolean parent, Object searchId)
- {
- return Fqn.fromElements(OBJECT_TYPES_SEARCH_NODE, io.getIdentityType().getName(), relationshipType == null ? "null" : relationshipType.getName(),
- io.getName() + "_" + parent, searchId);
- }
-
- private Fqn createRelationshipNamesIdentityObjectSearchFqn(IdentityObject identityObject, Object searchId)
- {
- return Fqn.fromElements(RELATIONSHIP_NAMES_SEARCH_IO_NODE, identityObject.getIdentityType() + "_" + identityObject.getName(),
- searchId);
- }
-
- private Fqn createRelationshipNamesAllSearchFqn(Object searchId)
- {
- return Fqn.fromElements(RELATIONSHIP_NAMES_SEARCH_ALL_NODE, searchId);
- }
-
- private Fqn createRelationshipsSimpleSearchFqn(IdentityObject fromIdentity,
- IdentityObject toIdentity,
- IdentityObjectRelationshipType relationshipType)
- {
- //TODO: fixme - null relationshipType
- return Fqn.fromElements(RELATIONSHIPS_SEARCH_SIMPLE_NODE, fromIdentity.getIdentityType().getName() + "_" + toIdentity.getName(),
- toIdentity.getIdentityType().getName() + "_" + toIdentity.getName(), relationshipType == null ? "null" : relationshipType );
- }
-
- private Fqn createRelationshipsComplexSearchFqn(IdentityObject identity,
- IdentityObjectRelationshipType relationshipType,
- boolean parent,
- boolean named,
- String name)
- {
- return Fqn.fromElements(RELATIONSHIPS_SEARCH_COMPLEX_NODE, identity.getIdentityType().getName() + "_" + identity.getName(),
- parent, relationshipType, named + "_" + name);
- }
-
- public static boolean isSchemaFqn(Fqn fqn)
- {
- if (fqn.equals(JBID_ROOT_NODE) ||
- fqn.equals(OBJECT_TYPES_NODE) ||
- fqn.equals(OBJECT_TYPES_IDS_NODE) ||
- fqn.equals(OBJECT_TYPES_NAMES_NODE) ||
- fqn.equals(RELATIONSHIPS_SEARCH_NODE))
- {
- return true;
- }
- return false;
- }
-
- public static boolean isFqnObjectTypeChild(Fqn fqn)
- {
- return fqn.isChildOf(FQN_OBJECT_TYPES);
- }
-
- public static boolean isFqnObjectTypeIdsChild(Fqn fqn)
- {
- return fqn.isChildOf(FQN_OBJECT_TYPES_IDS);
- }
-
- public static boolean isFqnObjectTypeNamesChild(Fqn fqn)
- {
- return fqn.isChildOf(FQN_OBJECT_TYPES_NAMES);
- }
-
- public static boolean isFqnObjectTypeSearchChild(Fqn fqn)
- {
- return fqn.isChildOf(FQN_OBJECT_TYPES_SEARCH_BY_TYPE);
- }
-
- public static boolean isFqnRelationshipsChild(Fqn fqn)
- {
- return fqn.isChildOf(FQN_RELATIONSHIPS);
- }
-
-
- private void removeNodeChildren(String path)
- {
- Fqn fqn = Fqn.fromString(path);
- Node node = getCache().getRoot().getChild(fqn);
-
- if (node != null)
- {
- Set<Object> names = node.getChildrenNames();
- for (Object name : names)
- {
- node.removeChild(name);
- }
- }
- }
-
- protected abstract Logger getLog();
-
- protected abstract Cache getCache();
-
- protected void initResidentNodes(Set<String> supportedIdentityObjectTypes,
- Set<String> supportedRelationshipTypes)
- {
- getCache().getRoot().addChild(Fqn.fromString(IdentityStoreCacheSupport.JBID_ROOT_NODE)).setResident(true);
- getCache().getRoot().addChild(Fqn.fromString(IdentityStoreCacheSupport.OBJECT_TYPES_NODE)).setResident(true);
- getCache().getRoot().addChild(FQN_OBJECT_TYPES_IDS).setResident(true);
- getCache().getRoot().addChild(FQN_OBJECT_TYPES_NAMES).setResident(true);
- getCache().getRoot().addChild(FQN_OBJECT_TYPES_SEARCH).setResident(true);
- getCache().getRoot().addChild(FQN_OBJECT_TYPES_SEARCH_BY_TYPE).setResident(true);
- getCache().getRoot().addChild(FQN_OBJECT_TYPES_COUNT).setResident(true);
- getCache().getRoot().addChild(Fqn.fromString(RELATIONSHIP_NAMES_SEARCH_ALL_NODE)).setResident(true);
- getCache().getRoot().addChild(Fqn.fromString(RELATIONSHIP_NAMES_SEARCH_IO_NODE)).setResident(true);
- getCache().getRoot().addChild(Fqn.fromString(RELATIONSHIPS_SEARCH_COMPLEX_NODE)).setResident(true);
- getCache().getRoot().addChild(Fqn.fromString(RELATIONSHIPS_SEARCH_SIMPLE_NODE)).setResident(true);
-
- for (String objectTypeName : supportedIdentityObjectTypes)
- {
- Fqn nodeFqn = Fqn.fromRelativeElements(FQN_OBJECT_TYPES_NAMES, "/" + objectTypeName);
- getCache().getRoot().addChild(nodeFqn).setResident(true);
-
- nodeFqn = Fqn.fromRelativeElements(FQN_OBJECT_TYPES_IDS, "/" + objectTypeName);
- getCache().getRoot().addChild(nodeFqn).setResident(true);
- }
- }
-
- protected void putIntoCache(IdentityObject io)
- {
- Fqn nodeFqn = createIONameNodeFQN(io);
-
- Node ioNode = getCache().getRoot().addChild(nodeFqn);
-
- // in case this node was already present in cache
- if (!ioNode.getKeys().contains(NODE_OBJECT_KEY))
- {
- ioNode.put(NODE_OBJECT_KEY, io);
- }
-
- nodeFqn = createIOIdNodeFQN(io);
-
- ioNode = getCache().getRoot().addChild(nodeFqn);
-
- // in case this node was already present in cache
- if (!ioNode.getKeys().contains(NODE_OBJECT_KEY))
- {
- ioNode.put(NODE_OBJECT_KEY, io);
- }
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObject stored in cache: " + io.getName() + "; " + io.getId());
- }
- }
-
- protected void putIntoCache(IdentityObject io, Map<String, IdentityObjectAttribute> attributesMap)
- {
- Fqn nodeFqn = createIONameNodeFQN(io);
-
- Node ioNode = getCache().getRoot().addChild(nodeFqn);
-
- // in case this node was already present in cache
- if (!ioNode.getKeys().contains(NODE_OBJECT_KEY))
- {
- ioNode.put(NODE_OBJECT_KEY, io);
- }
-
- if (!ioNode.getKeys().contains(NODE_ATTRIBUTES_KEY))
- {
- ioNode.put(NODE_ATTRIBUTES_KEY, attributesMap);
- }
-
- nodeFqn = createIOIdNodeFQN(io);
-
- ioNode = getCache().getRoot().addChild(nodeFqn);
-
- // in case this node was already present in cache
- if (!ioNode.getKeys().contains(NODE_OBJECT_KEY))
- {
- ioNode.put(NODE_OBJECT_KEY, io);
- }
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObject stored in cache with attributes map: " + io.getName() + "; " + io.getId()
- + "; type=" + io.getIdentityType().getName() );
- }
- }
-
- protected void removeFromCache(IdentityObject io)
- {
- Fqn nodeFqn = createIONameNodeFQN(io);
-
- getCache().getRoot().removeChild(nodeFqn);
-
- nodeFqn = createIOIdNodeFQN(io);
-
- getCache().getRoot().removeChild(nodeFqn);
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObject removed from cache: " + io.getName() + "; " + io.getId()
- + "; type=" + io.getIdentityType().getName() );
- }
- }
-
- protected void removeAttributesFromCache(IdentityObject io)
- {
- Fqn nodeFqn = createIONameNodeFQN(io);
-
- Node ioNode = getCache().getRoot().addChild(nodeFqn);
-
- ioNode.remove(NODE_ATTRIBUTES_KEY);
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObject attributes removed from cache: name=" + io.getName() + "; id=" + io.getId()
- + "; type=" + io.getIdentityType().getName() );
- }
- }
-
- protected IdentityObject getFromCache(String name, IdentityObjectType identityObjectType)
- {
- Fqn nodeFqn = Fqn.fromElements(OBJECT_TYPES_NODE, identityObjectType.getName(), name);
-
- Node ioNode = getCache().getRoot().getChild(nodeFqn);
-
- if (ioNode != null)
- {
- IdentityObject io = (IdentityObject)ioNode.get(NODE_OBJECT_KEY);
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObject found in cache: name=" + io.getName() + "; id=" + io.getId());
- }
-
- return io;
- }
-
- return null;
-
- }
-
- protected Map<String, IdentityObjectAttribute> getAttributesFromCache(String name, IdentityObjectType identityObjectType)
- {
- Fqn nodeFqn = Fqn.fromElements(OBJECT_TYPES_NODE, identityObjectType.getName(), name);
-
- Node ioNode = getCache().getRoot().getChild(nodeFqn);
-
- if (ioNode != null)
- {
- Map<String, IdentityObjectAttribute> attrs = (Map<String, IdentityObjectAttribute>)ioNode.get(NODE_ATTRIBUTES_KEY);
-
- if (attrs != null)
- {
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObject attributes found in cache: name=" + name + "; type=" + identityObjectType.getName());
- }
- }
- return attrs;
- }
-
- return null;
-
- }
-
- protected IdentityObject getFromCache(String id)
- {
- Node idsNode = getCache().getRoot().getChild(OBJECT_TYPES_IDS_NODE);
-
- for (Node typeNode : (Set<Node>)idsNode.getChildren())
- {
- for (Object name : typeNode.getChildrenNames())
- {
- if (name.toString().equals(id))
- {
- IdentityObject io = (IdentityObject)typeNode.getChild(name).get(NODE_OBJECT_KEY);
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObject found in cache: name" + io.getName() + "; type" + io.getIdentityType().getName());
- }
-
- return io;
- }
- }
- }
-
- return null;
-
- }
-
- protected void putIdentityObjectSearchIntoCache(IdentityObjectType identityType,
- IdentityObjectSearchCriteria criteria,
- Collection<IdentityObject> results)
- {
- Fqn nodeFqn = createIOTypeSearchNodeFQN(identityType, getControlsHash(criteria));
-
- Node searchNode = getCache().getRoot().addChild(nodeFqn);
-
- searchNode.put(NODE_SEARCH_RESULTS_KEY, results);
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObject search results stored in cache: type" + identityType.getName());
- }
- }
-
- protected Collection<IdentityObject> getIdentityObjectSearchFromCache(IdentityObjectType identityType,
- IdentityObjectSearchCriteria criteria)
- {
- Fqn nodeFqn = createIOTypeSearchNodeFQN(identityType, getControlsHash(criteria));
-
- Node searchNode = getCache().getRoot().getChild(nodeFqn);
-
- Collection<IdentityObject> results = null;
-
- if (searchNode != null)
- {
-
-
- results = (Collection<IdentityObject>)searchNode.get(NODE_SEARCH_RESULTS_KEY);
-
- if (results != null && getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObject search results found in cache: type" + identityType.getName());
- }
- }
-
- return results;
-
- }
-
- protected void putIdentityObjectSearchToCache(IdentityObject identity,
- IdentityObjectRelationshipType relationshipType,
- boolean parent,
- IdentityObjectSearchCriteria criteria,
- Collection<IdentityObject> results)
- {
-
- Fqn nodeFqn = createIOSearchNodeFQN(identity, relationshipType, parent, getControlsHash(criteria));
-
- Node searchNode = getCache().getRoot().addChild(nodeFqn);
-
- searchNode.put(NODE_SEARCH_RESULTS_KEY, results);
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObject search results stored in cache: IdentityObject name= " + identity.getName()
- + "; IdentityObject type= " + identity.getIdentityType().getName() + "; IdentityObjectRelationshipType= " + relationshipType +
- "; parent= " + parent);
- }
-
- }
-
- protected Collection<IdentityObject> getIdentityObjectSearchFromCache(IdentityObject identity,
- IdentityObjectRelationshipType relationshipType,
- boolean parent,
- IdentityObjectSearchCriteria criteria)
- {
-
- Fqn nodeFqn = createIOSearchNodeFQN(identity, relationshipType, parent, getControlsHash(criteria));
-
- Node searchNode = getCache().getRoot().getChild(nodeFqn);
-
- Collection<IdentityObject> results = null;
-
- if (searchNode != null)
- {
- results = (Collection<IdentityObject>)searchNode.get(NODE_SEARCH_RESULTS_KEY);
-
- if (results != null && getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObject search results found in cache: IdentityObject name= " + identity.getName()
- + "; IdentityObject type= " + identity.getIdentityType().getName() + "; IdentityObjectRelationshipType= " + relationshipType +
- "; parent= " + parent);
- }
- }
-
- return results;
-
- }
-
- protected void putRelationshipsSearchIntoCache(IdentityObject fromIdentity,
- IdentityObject toIdentity,
- IdentityObjectRelationshipType relationshipType,
- Set<IdentityObjectRelationship> results)
- {
-
- Fqn fqn = createRelationshipsSimpleSearchFqn(fromIdentity, toIdentity, relationshipType);
- Node node = getCache().getRoot().addChild(fqn);
-
- node.put(NODE_SEARCH_RESULTS_KEY, results);
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObjectRelationship search stored in cache: fromIdentity" +
- fromIdentity.toString() + "; toIdentity=" + toIdentity.toString() +
- "; relationshipType=" + relationshipType.getName() ) ;
- }
-
- }
-
-
-
- protected Set<IdentityObjectRelationship> getRelationshipsSearchFromCache(IdentityObject fromIdentity,
- IdentityObject toIdentity,
- IdentityObjectRelationshipType relationshipType)
- {
- Fqn fqn = createRelationshipsSimpleSearchFqn(fromIdentity, toIdentity, relationshipType);
- Node node = getCache().getRoot().getChild(fqn);
-
- if (node != null)
- {
- if (node.getKeys().contains(NODE_SEARCH_RESULTS_KEY) && getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObjectRelationship search found in cache: fromIdentity" +
- fromIdentity.toString() + "; toIdentity=" + toIdentity.toString() +
- "; relationshipType=" + relationshipType.getName() ) ;
- }
-
- return (Set<IdentityObjectRelationship>)node.get(NODE_SEARCH_RESULTS_KEY);
- }
- return null;
- }
-
- protected void putRelationshipSearchIntoCache(IdentityObject identity,
- IdentityObjectRelationshipType relationshipType,
- boolean parent,
- boolean named,
- String name,
- Set<IdentityObjectRelationship> results)
- {
- Fqn fqn = createRelationshipsComplexSearchFqn(identity, relationshipType, parent, named, name);
- Node node = getCache().getRoot().addChild(fqn);
-
- node.put(NODE_SEARCH_RESULTS_KEY, results);
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObjectRelationship search stored in cache: " +
- "identity" + identity.toString() +
- "; relationshipType=" + relationshipType.getName() +
- "; parent=" + parent +
- "; named=" + named +
- "; name=" + name) ;
- }
-
- }
-
-
-
- protected Set<IdentityObjectRelationship> getRelationshipsSearchFromCache(IdentityObject identity,
- IdentityObjectRelationshipType relationshipType,
- boolean parent,
- boolean named,
- String name)
- {
- Fqn fqn = createRelationshipsComplexSearchFqn(identity, relationshipType, parent, named, name);
- Node node = getCache().getRoot().getChild(fqn);
-
- Set<IdentityObjectRelationship> results = null;
-
- if (node != null)
- {
- results = (Set<IdentityObjectRelationship>)node.get(NODE_SEARCH_RESULTS_KEY);
-
- if (results != null && getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObjectRelationship search found in cache: " +
- "identity" + identity.toString() +
- "; relationshipType=" + relationshipType.getName() +
- "; parent=" + parent +
- "; named=" + named +
- "; name=" + name) ;
- }
- }
- return results;
-
- }
-
- protected void invalidateCachedIdentityObjectSearches(IdentityObject io)
- {
-
- Fqn fqn = Fqn.fromElements(OBJECT_TYPES_SEARCH_BY_TYPE_NODE, io.getIdentityType().getName());
- getCache().getRoot().removeChild(fqn);
-
- // It can be in any result in the type searches
- removeNodeChildren(OBJECT_TYPES_SEARCH_NODE);
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObject searches invalidated in cache: identityObject=" + io.toString());
- }
- }
-
- protected void putIdentityObjectCountIntoCache(IdentityObjectType identityType, int count)
- {
- Fqn fqn = createIOTypeCountNodeFQN(identityType);
- Node node = getCache().getRoot().addChild(fqn);
-
- node.put(NODE_OBJECT_KEY, count);
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObjectType count search strored in cache: " +
- "identityObjectType=" + identityType.getName() +
- "; count=" + count);
- }
-
- }
-
- protected int getIdentityObjectCountFromCache(IdentityObjectType identityType)
- {
- Fqn fqn = createIOTypeCountNodeFQN(identityType);
- Node node = getCache().getRoot().getChild(fqn);
-
-
- if (node != null && node.getKeys().contains(NODE_OBJECT_KEY))
- {
- int count = (Integer)(node.get(NODE_OBJECT_KEY));
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObjectType count search result found in cache: " +
- "identityObjectType=" + identityType.getName() +
- "; count=" + count);
- }
-
- return count;
-
- }
- // -1 means nothing in cache
- return -1;
- }
-
-
- protected void invalidateCachedIdentityObjectCount(IdentityObjectType identityType)
- {
- Fqn fqn = createIOTypeCountNodeFQN(identityType);
- Node node = getCache().getRoot().addChild(fqn);
-
- node.remove(NODE_OBJECT_KEY);
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObjectType count search result invalidated in cache: " +
- "identityObjectType=" + identityType.getName());
- }
- }
-
- protected void invalidateCachedRelationshipSearches(IdentityObject fromIdentity,
- IdentityObject toIdentity,
- IdentityObjectRelationshipType relationshipType,
- String relationshipName)
- {
- String fromName = fromIdentity.getIdentityType().getName() + "_" + fromIdentity.getName();
- String toName = toIdentity.getIdentityType().getName() + "_" + toIdentity.getName();
-
- // Simple
-
-// Fqn fqn = Fqn.fromElements(RELATIONSHIPS_SEARCH_SIMPLE_NODE, fromName, toName, relationshipType.getName());
-// getCache().getRoot().removeChild(fqn);
-
- Fqn fqn = createRelationshipsSimpleSearchFqn(fromIdentity, toIdentity, relationshipType);
- getCache().getRoot().removeChild(fqn);
-
- // Complex
-
- String relNameElement;
- if (relationshipName != null)
- {
- relNameElement = true + relationshipName;
- }
- else
- {
- relNameElement = false + relationshipName;
- }
-
-
- fqn = Fqn.fromElements(RELATIONSHIPS_SEARCH_COMPLEX_NODE, fromName, true, relationshipType.getName(), relNameElement);
- getCache().getRoot().removeChild(fqn);
- fqn = Fqn.fromElements(RELATIONSHIPS_SEARCH_COMPLEX_NODE, toName, false, relationshipType.getName(), relNameElement);
- getCache().getRoot().removeChild(fqn);
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObjectRelationship search result invalidated in cache: fromIdentity" +
- fromIdentity.toString() + "; toIdentity=" + toIdentity.toString() +
- "; relationshipType=" + relationshipType.getName() ) ;
- }
-
- }
-
- protected void invalidateCachedRelationshipSearches(IdentityObject identity1, IdentityObject identity2, boolean named)
- {
-
- String name1 = identity1.getIdentityType().getName() + "_" + identity1.getName();
- String name2 = identity2.getIdentityType().getName() + "_" + identity2.getName();
-
-
- // Complex search
-
- Fqn fqn = Fqn.fromElements(RELATIONSHIPS_SEARCH_COMPLEX_NODE, name1);
- getCache().getRoot().removeChild(fqn);
- fqn = Fqn.fromElements(RELATIONSHIPS_SEARCH_COMPLEX_NODE, name2);
- getCache().getRoot().removeChild(fqn);
-
- // Simple search
-
- getCache().getRoot().removeChild(Fqn.fromElements(RELATIONSHIPS_SEARCH_SIMPLE_NODE, name1));
- getCache().getRoot().removeChild(Fqn.fromElements(RELATIONSHIPS_SEARCH_SIMPLE_NODE, name2));
-
- fqn = Fqn.fromElements(RELATIONSHIPS_SEARCH_SIMPLE_NODE);
- Set<String> names = getCache().getRoot().getChildrenNames();
-
- for (String childName : names)
- {
- //
- getCache().getRoot().removeChild(Fqn.fromElements(fqn, childName, name1));
- getCache().getRoot().removeChild(Fqn.fromElements(fqn, childName, name2));
- }
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObjectRelationship search result invalidated in cache for: identity1" +
- identity1.toString() + "; identity2=" + identity2.toString() +
- "; named=" + named ) ;
- }
-
- }
-
- protected void invalidateRelationshipNameSearches(String name)
- {
- //TODO: at the moment it just trash up all relationships searches
-
- removeNodeChildren(RELATIONSHIP_NAMES_SEARCH_ALL_NODE);
- removeNodeChildren(RELATIONSHIP_NAMES_SEARCH_IO_NODE);
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObjectRelationshipName search results invalidated in cache: name" +
- name ) ;
- }
- }
-
-
-
- protected void putRelationshipNamesSearchIntoCache(IdentityObjectSearchCriteria criteria, Set<String> results)
- {
-
- Fqn fqn = createRelationshipNamesAllSearchFqn(getControlsHash(criteria));
-
- Node node = getCache().getRoot().addChild(fqn);
-
- node.put(NODE_SEARCH_RESULTS_KEY, results);
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObjectRelationshipName search results invalidated in cache: criteria hash=" +
- getControlsHash(criteria)) ;
- }
-
- }
-
- protected Set<String> getRelationshipNamesSearchFromCache(IdentityObjectSearchCriteria criteria)
- {
-
- Fqn fqn = createRelationshipNamesAllSearchFqn(getControlsHash(criteria));
-
- Node node = getCache().getRoot().getChild(fqn);
-
- if (node != null)
- {
- Set<String> results = (Set<String>)node.get(NODE_SEARCH_RESULTS_KEY);
-
- if (results != null && getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObjectRelationshipName search result found in cache: criteria hash=" +
- getControlsHash(criteria)) ;
- }
-
- return results;
- }
-
-
- return null;
- }
-
- protected void putRelationshipNamesSearchIntoCache(IdentityObject identity,
- IdentityObjectSearchCriteria criteria,
- Set<String> results)
- {
-
- Fqn fqn = createRelationshipNamesIdentityObjectSearchFqn(identity, getControlsHash(criteria));
-
- Node node = getCache().getRoot().addChild(fqn);
-
- node.put(NODE_SEARCH_RESULTS_KEY, results);
-
- if (results != null && getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObjectRelationshipName search result stored in cache: " +
- "criteria hash=" + getControlsHash(criteria) +
- "identity=" + identity.toString()) ;
- }
-
- }
-
- protected Set<String> getRelationshipNamesSearchFromCache(IdentityObject identity, IdentityObjectSearchCriteria criteria)
- {
-
-
- Fqn fqn = createRelationshipNamesIdentityObjectSearchFqn(identity, getControlsHash(criteria));
-
- Node node = getCache().getRoot().getChild(fqn);
-
- if (node != null)
- {
- Set<String> results = (Set<String>)node.get(NODE_SEARCH_RESULTS_KEY);
-
- if (results != null && getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObjectRelationshipName search result found in cache: " +
- "criteria hash=" + getControlsHash(criteria) +
- "identity=" + identity.toString()) ;
- }
-
- return results;
- }
- return null;
- }
-
- private int getControlsHash(IdentityObjectSearchCriteria criteria)
- {
- // Convert criteria to Set to have the same hashcode regardles order of criteria
- int hashcode = 0;
-
- if (criteria != null)
- {
- hashcode = criteria.hashCode();
- }
-
- return hashcode;
- }
-
-}
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheAttributeStoreWrapper.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheAttributeStoreWrapper.java 2009-05-09 11:10:49 UTC (rev 485)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheAttributeStoreWrapper.java 2009-05-09 15:06:22 UTC (rev 486)
@@ -29,44 +29,36 @@
import org.jboss.identity.idm.spi.model.IdentityObjectAttribute;
import org.jboss.identity.idm.spi.model.IdentityObject;
import org.jboss.identity.idm.spi.configuration.metadata.IdentityObjectAttributeMetaData;
+import org.jboss.identity.idm.spi.cache.IdentityStoreCacheProvider;
import org.jboss.identity.idm.exception.IdentityException;
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheFactory;
-import org.jboss.cache.DefaultCacheFactory;
import java.util.logging.Logger;
import java.util.Set;
import java.util.Map;
-import java.io.InputStream;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
-public class JBossCacheAttributeStoreWrapper extends IdentityStoreCacheSupport implements AttributeStore
+public class JBossCacheAttributeStoreWrapper implements AttributeStore
{
private static Logger log = Logger.getLogger(JBossCacheAttributeStoreWrapper.class.getName());
private final AttributeStore attributeStore;
- protected final Cache cache;
+ protected final IdentityStoreCacheProvider cacheSupport;
// if update/add/remove operation on attributes should result in getAttributes() query to store new set in cache
// with many updates it can add additional cost
private boolean reloadAttributesToCacheOnUpdate = true;
- public JBossCacheAttributeStoreWrapper(AttributeStore attributeStore, InputStream cacheConfigInputStream)
+ public JBossCacheAttributeStoreWrapper(AttributeStore attributeStore, IdentityStoreCacheProvider cacheSupport)
{
+ //cacheSupport = new IdentityStoreCacheSupportImpl(cacheConfigInputStream);
+ this.cacheSupport = cacheSupport;
this.attributeStore = attributeStore;
-
- CacheFactory factory = new DefaultCacheFactory();
-
- this.cache = factory.createCache(cacheConfigInputStream);
-
- this.cache.start();
-
}
public String getId()
@@ -96,7 +88,7 @@
public Map<String, IdentityObjectAttribute> getAttributes(IdentityStoreInvocationContext invocationContext,
IdentityObject identity) throws IdentityException
{
- Map<String, IdentityObjectAttribute> results = getAttributesFromCache(identity.getName(), identity.getIdentityType());
+ Map<String, IdentityObjectAttribute> results = cacheSupport.getAttributesFromCache(identity.getName(), identity.getIdentityType());
if (results == null)
{
@@ -104,7 +96,7 @@
if (results != null && results.size() > 0)
{
- putIntoCache(identity, results);
+ cacheSupport.putIntoCache(identity, results);
}
}
@@ -115,7 +107,7 @@
IdentityObject identity,
String name) throws IdentityException
{
- Map<String, IdentityObjectAttribute> results = getAttributesFromCache(identity.getName(), identity.getIdentityType());
+ Map<String, IdentityObjectAttribute> results = cacheSupport.getAttributesFromCache(identity.getName(), identity.getIdentityType());
if (results != null && results.containsKey(name))
{
@@ -136,7 +128,7 @@
{
attributeStore.updateAttributes(invocationCtx, identity, attributes);
- removeAttributesFromCache(identity);
+ cacheSupport.removeAttributesFromCache(identity);
if (reloadAttributesToCacheOnUpdate)
{
@@ -144,7 +136,7 @@
if (results != null && results.size() > 0)
{
- putIntoCache(identity, results);
+ cacheSupport.putIntoCache(identity, results);
}
}
else
@@ -160,7 +152,7 @@
{
attributeStore.addAttributes(invocationCtx, identity, attributes);
- removeAttributesFromCache(identity);
+ cacheSupport.removeAttributesFromCache(identity);
if (reloadAttributesToCacheOnUpdate)
{
@@ -168,7 +160,7 @@
if (results != null && results.size() > 0)
{
- putIntoCache(identity, results);
+ cacheSupport.putIntoCache(identity, results);
}
}
else
@@ -183,7 +175,7 @@
{
attributeStore.removeAttributes(invocationCtx, identity, attributeNames);
- removeAttributesFromCache(identity);
+ cacheSupport.removeAttributesFromCache(identity);
if (reloadAttributesToCacheOnUpdate)
{
@@ -191,7 +183,7 @@
if (results != null && results.size() > 0)
{
- putIntoCache(identity, results);
+ cacheSupport.putIntoCache(identity, results);
}
}
else
@@ -205,10 +197,10 @@
return log;
}
- protected Cache getCache()
- {
- return cache;
- }
+// protected Cache getCache()
+// {
+// return cache;
+// }
@Override
public String toString()
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreWrapper.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreWrapper.java 2009-05-09 11:10:49 UTC (rev 485)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreWrapper.java 2009-05-09 15:06:22 UTC (rev 486)
@@ -33,13 +33,13 @@
import org.jboss.identity.idm.spi.exception.OperationNotSupportedException;
import org.jboss.identity.idm.spi.configuration.IdentityStoreConfigurationContext;
import org.jboss.identity.idm.spi.search.IdentityObjectSearchCriteria;
+import org.jboss.identity.idm.spi.cache.IdentityStoreCacheProvider;
import org.jboss.identity.idm.exception.IdentityException;
import java.util.Map;
import java.util.Collection;
import java.util.Set;
import java.util.logging.Logger;
-import java.io.InputStream;
/**
* IdentityStore implementation that wraps another IdentityStore and uses JBossCache to cache results.
@@ -57,15 +57,15 @@
private final IdentityStore identityStore;
- public JBossCacheIdentityStoreWrapper(IdentityStore identityStore, InputStream cacheConfigInputStream) throws IdentityException
+ public JBossCacheIdentityStoreWrapper(IdentityStore identityStore, IdentityStoreCacheProvider cacheSupport) throws IdentityException
{
- super(identityStore, cacheConfigInputStream);
+ super(identityStore, cacheSupport);
this.identityStore = identityStore;
- initResidentNodes(identityStore.getSupportedFeatures().getSupportedIdentityObjectTypes(),
+ cacheSupport.initResidentNodes(identityStore.getSupportedFeatures().getSupportedIdentityObjectTypes(),
identityStore.getSupportedFeatures().getSupportedRelationshipTypes());
log.fine("------------------------------------------------------");
@@ -98,10 +98,10 @@
if (io != null)
{
//should also invalidate IO searches cache - searches/type - clear all children
- invalidateCachedIdentityObjectSearches(io);
- invalidateCachedIdentityObjectCount(identityObjectType);
+ cacheSupport.invalidateCachedIdentityObjectSearches(io);
+ cacheSupport.invalidateCachedIdentityObjectCount(identityObjectType);
- putIntoCache(io);
+ cacheSupport.putIntoCache(io);
}
return io;
}
@@ -120,11 +120,11 @@
if (io != null)
{
//should also invalidate IO searches cache - searches/type - clear all children
- invalidateCachedIdentityObjectSearches(io);
+ cacheSupport.invalidateCachedIdentityObjectSearches(io);
//grab profile - because IS can add extra attributes we canno rely only on attributes passed
- putIntoCache(io, identityStore.getAttributes(invocationCtx, io));
+ cacheSupport.putIntoCache(io, identityStore.getAttributes(invocationCtx, io));
}
return io;
}
@@ -134,22 +134,22 @@
{
identityStore.removeIdentityObject(invocationCtx, identity);
- removeFromCache(identity);
+ cacheSupport.removeFromCache(identity);
- invalidateCachedIdentityObjectSearches(identity);
- invalidateCachedIdentityObjectCount(identity.getIdentityType());
+ cacheSupport.invalidateCachedIdentityObjectSearches(identity);
+ cacheSupport.invalidateCachedIdentityObjectCount(identity.getIdentityType());
}
public int getIdentityObjectsCount(IdentityStoreInvocationContext invocationCtx,
IdentityObjectType identityType) throws IdentityException
{
- int count = getIdentityObjectCountFromCache(identityType);
+ int count = cacheSupport.getIdentityObjectCountFromCache(identityType);
if (count == -1)
{
count = identityStore.getIdentityObjectsCount(invocationCtx, identityType);
- putIdentityObjectCountIntoCache(identityType, count);
+ cacheSupport.putIdentityObjectCountIntoCache(identityType, count);
}
return count;
@@ -162,12 +162,12 @@
String name,
IdentityObjectType identityObjectType) throws IdentityException
{
- IdentityObject io = getFromCache(name, identityObjectType);
+ IdentityObject io = cacheSupport.getFromCache(name, identityObjectType);
if (io == null)
{
io = identityStore.findIdentityObject(invocationContext, name, identityObjectType);
- putIntoCache(io);
+ cacheSupport.putIntoCache(io);
return io;
}
@@ -177,12 +177,12 @@
public IdentityObject findIdentityObject(IdentityStoreInvocationContext invocationContext,
String id) throws IdentityException
{
- IdentityObject io = getFromCache(id);
+ IdentityObject io = cacheSupport.getFromCache(id);
if (io == null)
{
io = identityStore.findIdentityObject(invocationContext, id);
- putIntoCache(io);
+ cacheSupport.putIntoCache(io);
return io;
}
@@ -194,18 +194,18 @@
IdentityObjectSearchCriteria criteria) throws IdentityException
{
- Collection<IdentityObject> results = getIdentityObjectSearchFromCache(identityType, criteria);
+ Collection<IdentityObject> results = cacheSupport.getIdentityObjectSearchFromCache(identityType, criteria);
if (results == null)
{
results = identityStore.findIdentityObject(invocationCtx, identityType, criteria);
- putIdentityObjectSearchIntoCache(identityType, criteria, results);
+ cacheSupport.putIdentityObjectSearchIntoCache(identityType, criteria, results);
// Put all the results into cache separately
for (IdentityObject result : results)
{
- putIntoCache(result);
+ cacheSupport.putIntoCache(result);
}
}
@@ -224,17 +224,17 @@
IdentityObjectSearchCriteria criteria) throws IdentityException
{
- Collection<IdentityObject> results = getIdentityObjectSearchFromCache(identity, relationshipType, parent, criteria);
+ Collection<IdentityObject> results = cacheSupport.getIdentityObjectSearchFromCache(identity, relationshipType, parent, criteria);
if (results == null)
{
results = identityStore.findIdentityObject(invocationCtx, identity, relationshipType, parent, criteria);
- putIdentityObjectSearchToCache(identity, relationshipType,parent,criteria, results);
+ cacheSupport.putIdentityObjectSearchToCache(identity, relationshipType,parent,criteria, results);
for (IdentityObject result : results)
{
- putIntoCache(result);
+ cacheSupport.putIntoCache(result);
}
}
return results;
@@ -250,7 +250,7 @@
String relationshipName,
boolean createNames) throws IdentityException
{
- invalidateCachedRelationshipSearches(fromIdentity, toIdentity, relationshipType, relationshipName);
+ cacheSupport.invalidateCachedRelationshipSearches(fromIdentity, toIdentity, relationshipType, relationshipName);
return identityStore.createRelationship(invocationCxt,
fromIdentity, toIdentity, relationshipType, relationshipName, createNames);
@@ -266,7 +266,7 @@
{
identityStore.removeRelationship(invocationCxt, fromIdentity, toIdentity, relationshipType, relationshipName);
- invalidateCachedRelationshipSearches(fromIdentity, toIdentity, relationshipType, relationshipName);
+ cacheSupport.invalidateCachedRelationshipSearches(fromIdentity, toIdentity, relationshipType, relationshipName);
}
@@ -280,7 +280,7 @@
{
identityStore.removeRelationships(invocationCtx, identity1, identity2, named);
- invalidateCachedRelationshipSearches(identity1, identity2, named);
+ cacheSupport.invalidateCachedRelationshipSearches(identity1, identity2, named);
}
@@ -292,13 +292,13 @@
{
- Set<IdentityObjectRelationship> results = getRelationshipsSearchFromCache(fromIdentity, toIdentity, relationshipType);
+ Set<IdentityObjectRelationship> results = cacheSupport.getRelationshipsSearchFromCache(fromIdentity, toIdentity, relationshipType);
if (results == null)
{
results = identityStore.resolveRelationships(invocationCxt, fromIdentity, toIdentity, relationshipType);
- putRelationshipsSearchIntoCache(fromIdentity, toIdentity, relationshipType, results);
+ cacheSupport.putRelationshipsSearchIntoCache(fromIdentity, toIdentity, relationshipType, results);
}
return results;
@@ -312,14 +312,14 @@
boolean named,
String name) throws IdentityException
{
- Set<IdentityObjectRelationship> results = getRelationshipsSearchFromCache(identity, relationshipType, parent, named, name);
+ Set<IdentityObjectRelationship> results = cacheSupport.getRelationshipsSearchFromCache(identity, relationshipType, parent, named, name);
if (results == null)
{
results = identityStore.resolveRelationships(invocationCtx,
identity, relationshipType, parent, named, name);
- putRelationshipSearchIntoCache(identity, relationshipType, parent, named, name, results);
+ cacheSupport.putRelationshipSearchIntoCache(identity, relationshipType, parent, named, name, results);
}
return results;
@@ -329,7 +329,7 @@
String name) throws IdentityException, OperationNotSupportedException
{
- invalidateRelationshipNameSearches(name);
+ cacheSupport.invalidateRelationshipNameSearches(name);
return identityStore.createRelationshipName(ctx, name);
}
@@ -337,7 +337,7 @@
public String removeRelationshipName(IdentityStoreInvocationContext ctx,
String name) throws IdentityException, OperationNotSupportedException
{
- invalidateRelationshipNameSearches(name);
+ cacheSupport.invalidateRelationshipNameSearches(name);
return identityStore.removeRelationshipName(ctx, name);
}
@@ -345,13 +345,13 @@
public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
IdentityObjectSearchCriteria criteria) throws IdentityException, OperationNotSupportedException
{
- Set<String> results = getRelationshipNamesSearchFromCache(criteria);
+ Set<String> results = cacheSupport.getRelationshipNamesSearchFromCache(criteria);
if (results == null)
{
results = identityStore.getRelationshipNames(ctx, criteria);
- putRelationshipNamesSearchIntoCache(criteria, results);
+ cacheSupport.putRelationshipNamesSearchIntoCache(criteria, results);
}
return results;
@@ -364,13 +364,13 @@
{
- Set<String> results = getRelationshipNamesSearchFromCache(identity, criteria);
+ Set<String> results = cacheSupport.getRelationshipNamesSearchFromCache(identity, criteria);
if (results == null)
{
results = identityStore.getRelationshipNames(ctx, identity, criteria);
- putRelationshipNamesSearchIntoCache(identity, criteria, results);
+ cacheSupport.putRelationshipNamesSearchIntoCache(identity, criteria, results);
}
return results;
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/repository/AbstractIdentityStoreRepository.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/repository/AbstractIdentityStoreRepository.java 2009-05-09 11:10:49 UTC (rev 485)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/repository/AbstractIdentityStoreRepository.java 2009-05-09 15:06:22 UTC (rev 486)
@@ -31,18 +31,19 @@
import org.jboss.identity.idm.spi.configuration.metadata.IdentityRepositoryConfigurationMetaData;
import org.jboss.identity.idm.spi.configuration.metadata.IdentityStoreMappingMetaData;
import org.jboss.identity.idm.spi.configuration.IdentityRepositoryConfigurationContext;
+import org.jboss.identity.idm.spi.cache.IdentityStoreCacheProvider;
import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.impl.helper.SecurityActions;
import org.jboss.identity.idm.impl.cache.JBossCacheIdentityStoreWrapper;
-import org.jboss.identity.idm.impl.helper.SecurityActions;
import java.util.Set;
import java.util.Map;
import java.util.HashSet;
import java.util.List;
import java.util.HashMap;
-import java.io.File;
import java.io.InputStream;
import java.io.Serializable;
+import java.lang.reflect.Constructor;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -63,7 +64,9 @@
public static final String CACHE_CONFIG_FILE_OPTION = "cache.config-file";
+ public static final String CACHE_PROVIDER_CLASS_OPTION = "cache.provider.class";
+
public void bootstrap(IdentityRepositoryConfigurationContext configurationContext,
Map<String, IdentityStore> bootstrappedIdentityStores,
Map<String, AttributeStore> bootstrappedAttributeStores) throws IdentityException
@@ -90,12 +93,18 @@
if (cacheOption != null && cacheOption.equalsIgnoreCase("true"))
{
String cacheConfig = configurationMD.getOptionSingleValue(CACHE_CONFIG_FILE_OPTION);
+ String cacheSupportClass = configurationMD.getOptionSingleValue(CACHE_PROVIDER_CLASS_OPTION);
if (cacheConfig == null)
{
throw new IdentityException(CACHE_CONFIG_FILE_OPTION + " is missing in the repository configuration");
}
+ if (cacheSupportClass == null)
+ {
+ throw new IdentityException(CACHE_PROVIDER_CLASS_OPTION + " is missing in the repository configuration");
+ }
+
ClassLoader classLoader = SecurityActions.getContextClassLoader();
InputStream cacheConfigInputStream = classLoader.getResourceAsStream(cacheConfig);
if (cacheConfigInputStream == null)
@@ -104,9 +113,34 @@
"\" doesn't exist: " + cacheConfig);
}
- defaultIdentityStore = new JBossCacheIdentityStoreWrapper(defaultIdentityStore, cacheConfigInputStream);
+ try
+ {
+ Class cacheClass = null;
+ cacheClass = Class.forName(cacheSupportClass);
+
+ Class partypes[] = new Class[1];
+ partypes[0] = InputStream.class;
+
+ Constructor ct = cacheClass.getConstructor(partypes);
+ Object argList[] = new Object[1];
+ argList[0] = cacheConfigInputStream;
+
+
+ IdentityStoreCacheProvider cacheSupport = (IdentityStoreCacheProvider)ct.newInstance(argList);
+
+ defaultIdentityStore = new JBossCacheIdentityStoreWrapper(defaultIdentityStore, cacheSupport);
+
+
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Cannot instantiate cache provider:" + cacheSupportClass, e);
+ }
+
+
+
}
}
@@ -119,15 +153,23 @@
String cacheOption = identityStoreMappingMetaData.getOptionSingleValue(CACHE_OPTION);
+
if (cacheOption != null && cacheOption.equalsIgnoreCase("true"))
{
String cacheConfig = identityStoreMappingMetaData.getOptionSingleValue(CACHE_CONFIG_FILE_OPTION);
+ String cacheSupportClass = identityStoreMappingMetaData.getOptionSingleValue(CACHE_PROVIDER_CLASS_OPTION);
+
if (cacheConfig == null)
{
throw new IdentityException(CACHE_CONFIG_FILE_OPTION + " is missing in the repository identity-store-mapping configuration");
}
+ if (cacheSupportClass == null)
+ {
+ throw new IdentityException(CACHE_PROVIDER_CLASS_OPTION + " is missing in the repository configuration");
+ }
+
ClassLoader classLoader = SecurityActions.getContextClassLoader();
InputStream cacheConfigInputStream = classLoader.getResourceAsStream(cacheConfig);
if (cacheConfigInputStream == null)
@@ -136,8 +178,30 @@
"\" doesn't exist: " + cacheConfig);
}
+ try
+ {
+ Class cacheClass = null;
+ cacheClass = Class.forName(cacheSupportClass);
- store = new JBossCacheIdentityStoreWrapper(store, cacheConfigInputStream);
+ Class partypes[] = new Class[1];
+ partypes[0] = InputStream.class;
+
+ Constructor ct = cacheClass.getConstructor(partypes);
+ Object argList[] = new Object[1];
+ argList[0] = cacheConfigInputStream;
+
+
+ IdentityStoreCacheProvider cacheSupport = (IdentityStoreCacheProvider)ct.newInstance(argList);
+
+ store = new JBossCacheIdentityStoreWrapper(store, cacheSupport);
+
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Cannot instantiate cache provider:" + cacheSupportClass, e);
+ }
+
+
}
if (store == null)
Copied: idm/trunk/idm-core/src/test/resources/organization-test-config.xml (from rev 485, idm/trunk/idm-testsuite/src/test/resources/organization-test-config.xml)
===================================================================
--- idm/trunk/idm-core/src/test/resources/organization-test-config.xml (rev 0)
+++ idm/trunk/idm-core/src/test/resources/organization-test-config.xml 2009-05-09 15:06:22 UTC (rev 486)
@@ -0,0 +1,800 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_alpha"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_alpha identity-config.xsd">
+ <realms>
+ <realm>
+ <id>realm://RedHat/DB</id>
+ <repository-id-ref>RedHat Repository DB</repository-id-ref>
+ <identity-type-mappings>
+ <user-mapping>USER</user-mapping>
+ </identity-type-mappings>
+ </realm>
+ <realm>
+ <id>realm://portal/SamplePortal/DB</id>
+ <repository-id-ref>Sample Portal Repository DB</repository-id-ref>
+ <identity-type-mappings>
+ <user-mapping>USER</user-mapping>
+ </identity-type-mappings>
+ </realm>
+ <realm>
+ <id>realm://RedHat/DB_LDAP</id>
+ <repository-id-ref>RedHat Repository DB+LDAP</repository-id-ref>
+ <identity-type-mappings>
+ <user-mapping>USER</user-mapping>
+ </identity-type-mappings>
+ </realm>
+ <realm>
+ <id>realm://portal/SamplePortal/DB_LDAP</id>
+ <repository-id-ref>Sample Portal Repository DB+LDAP</repository-id-ref>
+ <identity-type-mappings>
+ <user-mapping>USER</user-mapping>
+ </identity-type-mappings>
+ </realm>
+ </realms>
+ <repositories>
+ <repository>
+ <id>RedHat Repository DB</id>
+ <class>org.jboss.identity.idm.impl.repository.WrapperIdentityStoreRepository</class>
+ <external-config/>
+ <default-identity-store-id>Hibernate Identity Store</default-identity-store-id>
+ <default-attribute-store-id>Hibernate Identity Store</default-attribute-store-id>
+ <options>
+ <option>
+ <name>allowNotDefinedAttributes</name>
+ <value>true</value>
+ </option>
+ </options>
+ </repository>
+ <repository>
+ <id>Sample Portal Repository DB</id>
+ <class>org.jboss.identity.idm.impl.repository.WrapperIdentityStoreRepository</class>
+ <external-config/>
+ <default-identity-store-id>Hibernate Identity Store</default-identity-store-id>
+ <default-attribute-store-id>Hibernate Identity Store</default-attribute-store-id>
+ <options>
+ <option>
+ <name>allowNotDefinedAttributes</name>
+ <value>true</value>
+ </option>
+ </options>
+ </repository>
+ <repository>
+ <id>RedHat Repository DB+LDAP</id>
+ <class>org.jboss.identity.idm.impl.repository.FallbackIdentityStoreRepository</class>
+ <external-config/>
+ <default-identity-store-id>Hibernate Identity Store</default-identity-store-id>
+ <default-attribute-store-id>Hibernate Identity Store</default-attribute-store-id>
+ <identity-store-mappings>
+ <identity-store-mapping>
+ <identity-store-id>Hibernate Identity Store</identity-store-id>
+ <identity-object-types>
+ <identity-object-type>DIVISION</identity-object-type>
+ <identity-object-type>PROJECT</identity-object-type>
+ <identity-object-type>PEOPLE</identity-object-type>
+ </identity-object-types>
+ <options/>
+ </identity-store-mapping>
+ <identity-store-mapping>
+ <identity-store-id>LDAP Identity Store</identity-store-id>
+ <identity-object-types>
+ <identity-object-type>USER</identity-object-type>
+ <identity-object-type>ORGANIZATION</identity-object-type>
+ <identity-object-type>ORGANIZATION_UNIT</identity-object-type>
+ <identity-object-type>DEPARTMENT</identity-object-type>
+ </identity-object-types>
+ <options>
+ <option>
+ <name>cache</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>cache.provider.class</name>
+ <value>org.jboss.identity.idm.impl.cache.IdentityStoreCacheSupportImpl</value>
+ </option>
+ <option>
+ <name>cache.config-file</name>
+ <value>src/test/resources/jboss-cache-config.xml</value>
+ </option>
+ </options>
+ </identity-store-mapping>
+ </identity-store-mappings>
+ <options>
+ <option>
+ <name>allowNotDefinedAttributes</name>
+ <value>true</value>
+ </option>
+ </options>
+ </repository>
+ <repository>
+ <id>Sample Portal Repository DB+LDAP</id>
+ <class>org.jboss.identity.idm.impl.repository.FallbackIdentityStoreRepository</class>
+ <external-config/>
+ <default-identity-store-id>Hibernate Identity Store</default-identity-store-id>
+ <default-attribute-store-id>Hibernate Identity Store</default-attribute-store-id>
+ <identity-store-mappings>
+ <identity-store-mapping>
+ <identity-store-id>Hibernate Identity Store</identity-store-id>
+ <identity-object-types>
+ <identity-object-type>SYSTEM</identity-object-type>
+ <identity-object-type>ADMINISTRATION</identity-object-type>
+ <identity-object-type>COMMUNITY</identity-object-type>
+ <identity-object-type>DIVISION</identity-object-type>
+ <identity-object-type>SECURITY</identity-object-type>
+ <identity-object-type>PEOPLE</identity-object-type>
+ </identity-object-types>
+ <options/>
+ </identity-store-mapping>
+ <identity-store-mapping>
+ <identity-store-id>LDAP Identity Store</identity-store-id>
+ <identity-object-types>
+ <identity-object-type>USER</identity-object-type>
+ <identity-object-type>DEPARTMENT</identity-object-type>
+ <identity-object-type>ORGANIZATION</identity-object-type>
+ <identity-object-type>ORGANIZATION_UNIT</identity-object-type>
+ <identity-object-type>OFFICE</identity-object-type>
+ </identity-object-types>
+ <options>
+ <option>
+ <name>cache</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>cache.provider.class</name>
+ <value>org.jboss.identity.idm.impl.cache.IdentityStoreCacheSupportImpl</value>
+ </option>
+ <option>
+ <name>cache.config-file</name>
+ <value>src/test/resources/jboss-cache-config.xml</value>
+ </option>
+ </options>
+ </identity-store-mapping>
+ </identity-store-mappings>
+ <options>
+ <option>
+ <name>allowNotDefinedAttributes</name>
+ <value>true</value>
+ </option>
+ </options>
+ </repository>
+ </repositories>
+ <stores>
+ <attribute-stores/>
+ <identity-stores>
+ <identity-store>
+ <id>Hibernate Identity Store</id>
+ <class>org.jboss.identity.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>
+ <!--<relationship>-->
+ <!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
+ <!--<identity-object-type-ref>ORGANIZATION</identity-object-type-ref>-->
+ <!--</relationship>-->
+ <!--<relationship>-->
+ <!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
+ <!--<identity-object-type-ref>COMMUNITY</identity-object-type-ref>-->
+ <!--</relationship>-->
+ <!--<relationship>-->
+ <!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
+ <!--<identity-object-type-ref>OFFICE</identity-object-type-ref>-->
+ <!--</relationship>-->
+ <!--<relationship>-->
+ <!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
+ <!--<identity-object-type-ref>SECURITY</identity-object-type-ref>-->
+ <!--</relationship>-->
+ <!--<relationship>-->
+ <!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
+ <!--<identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>-->
+ <!--</relationship>-->
+ <!--<relationship>-->
+ <!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
+ <!--<identity-object-type-ref>PROJECT</identity-object-type-ref>-->
+ <!--</relationship>-->
+ <!--<relationship>-->
+ <!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
+ <!--<identity-object-type-ref>PEOPLE</identity-object-type-ref>-->
+ <!--</relationship>-->
+ </relationships>
+ <credentials>
+ <credential-type>PASSWORD</credential-type>
+ </credentials>
+ <attributes>
+ <attribute>
+ <name>picture</name>
+ <mapping>user.picture</mapping>
+ <type>binary</type>
+ <isRequired>false</isRequired>
+ <isMultivalued>false</isMultivalued>
+ <isReadOnly>false</isReadOnly>
+ </attribute>
+ </attributes>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ORGANIZATION</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>DIVISION</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ORGANIZATION_UNIT</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>DIVISION</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>DEPARTMENT</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>OFFICE</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>PEOPLE</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>PROJECT</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>DIVISION</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>DEPARTMENT</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>DEPARTMENT</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>DEPARTMENT</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>PROJECT</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>PEOPLE</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ADMINISTRATION</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>COMMUNITY</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>OFFICE</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>SECURITY</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>SYSTEM</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>SECURITY</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>COMMUNITY</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ </supported-identity-object-types>
+ <options>
+ <option>
+ <name>hibernateConfiguration</name>
+ <value>hibernate-jboss-identity.cfg.xml</value>
+ </option>
+ <!--<option>-->
+ <!--<name>hibernateSessionFactoryJNDIName</name>-->
+ <!--<value>java:/jbossidentity/HibernateStoreSessionFactory</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>
+ <option>
+ <name>allowNotDefinedAttributes</name>
+ <value>true</value>
+ </option>
+ </options>
+ </identity-store>
+ <identity-store>
+ <id>LDAP Identity Store</id>
+ <class>org.jboss.identity.idm.impl.store.ldap.LDAPIdentityStoreImpl</class>
+ <external-config/>
+ <supported-relationship-types>
+ <relationship-type>JBOSS_IDENTITY_MEMBERSHIP</relationship-type>
+ </supported-relationship-types>
+ <supported-identity-object-types>
+ <identity-object-type>
+ <name>USER</name>
+ <relationships/>
+ <credentials>
+ <credential-type>PASSWORD</credential-type>
+ </credentials>
+ <attributes>
+ <attribute>
+ <name>phone</name>
+ <mapping>telephoneNumber</mapping>
+ <type>text</type>
+ <isRequired>false</isRequired>
+ <isMultivalued>false</isMultivalued>
+ <isReadOnly>false</isReadOnly>
+ </attribute>
+ <attribute>
+ <name>description</name>
+ <mapping>description</mapping>
+ <type>text</type>
+ <isRequired>false</isRequired>
+ <isMultivalued>false</isMultivalued>
+ <isReadOnly>false</isReadOnly>
+ </attribute>
+ <attribute>
+ <name>carLicense</name>
+ <mapping>carLicense</mapping>
+ <type>text</type>
+ <isRequired>false</isRequired>
+ <isMultivalued>false</isMultivalued>
+ <isReadOnly>false</isReadOnly>
+ </attribute>
+ </attributes>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>uid</value>
+ </option>
+ <option>
+ <name>passwordAttributeName</name>
+ <value>userPassword</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=People,o=test,dc=portal,dc=example,dc=com</value>
+ </option>
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=inetOrgPerson</value>
+ <value>sn= </value>
+ <value>cn= </value>
+ </option>
+ </options>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ORGANIZATION</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>DEPARTMENT</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>OFFICE</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=Organizations,o=test,dc=portal,dc=example,dc=com</value>
+ </option>
+ <!--<option>-->
+ <!--<name>entrySearchFilter</name>-->
+ <!--<value></value>-->
+ <!--</option>-->
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>membershipAttributeName</name>
+ <value>member</value>
+ </option>
+ <option>
+ <name>isMembershipAttributeDN</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>allowEmptyMemberships</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=groupOfNames</value>
+ </option>
+ </options>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ORGANIZATION_UNIT</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>DEPARTMENT</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>OFFICE</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=OrganizationUnits,o=test,dc=portal,dc=example,dc=com</value>
+ </option>
+ <!--<option>-->
+ <!--<name>entrySearchFilter</name>-->
+ <!--<value></value>-->
+ <!--</option>-->
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>membershipAttributeName</name>
+ <value>member</value>
+ </option>
+ <option>
+ <name>isMembershipAttributeDN</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>allowEmptyMemberships</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=groupOfNames</value>
+ </option>
+ </options>
+ </identity-object-type>
+ <identity-object-type>
+ <name>DEPARTMENT</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>DEPARTMENT</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=Departments,o=test,dc=portal,dc=example,dc=com</value>
+ </option>
+ <!--<option>-->
+ <!--<name>entrySearchFilter</name>-->
+ <!--<value></value>-->
+ <!--</option>-->
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>membershipAttributeName</name>
+ <value>member</value>
+ </option>
+ <option>
+ <name>isMembershipAttributeDN</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>allowEmptyMemberships</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=groupOfNames</value>
+ </option>
+ </options>
+ </identity-object-type>
+ <identity-object-type>
+ <name>OFFICE</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=Offices,o=test,dc=portal,dc=example,dc=com</value>
+ </option>
+ <!--<option>-->
+ <!--<name>entrySearchFilter</name>-->
+ <!--<value></value>-->
+ <!--</option>-->
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>membershipAttributeName</name>
+ <value>member</value>
+ </option>
+ <option>
+ <name>isMembershipAttributeDN</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>allowEmptyMemberships</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=groupOfNames</value>
+ </option>
+ </options>
+ </identity-object-type>
+ </supported-identity-object-types>
+ <options>
+ <option>
+ <name>providerURL</name>
+ <value>ldap://localhost:10389</value>
+ </option>
+ <option>
+ <name>adminDN</name>
+ <value>cn=Directory Manager</value>
+ </option>
+ <option>
+ <name>adminPassword</name>
+ <value>password</value>
+ </option>
+ <option>
+ <name>searchTimeLimit</name>
+ <value>10000</value>
+ </option>
+ </options>
+ </identity-store>
+ </identity-stores>
+ </stores>
+</jboss-identity>
\ No newline at end of file
Modified: idm/trunk/idm-hibernate/pom.xml
===================================================================
--- idm/trunk/idm-hibernate/pom.xml 2009-05-09 11:10:49 UTC (rev 485)
+++ idm/trunk/idm-hibernate/pom.xml 2009-05-09 15:06:22 UTC (rev 486)
@@ -107,101 +107,9 @@
</systemProperties>
</configuration>
</plugin>
- <!--<plugin>-->
- <!--<groupId>org.jboss.unit</groupId>-->
- <!--<artifactId>jboss-unit-tooling-maven2</artifactId>-->
- <!--<executions>-->
- <!--<execution>-->
- <!--<phase>test</phase>-->
- <!--<goals>-->
- <!--<goal>execute</goal>-->
- <!--</goals>-->
- <!--</execution>-->
- <!--</executions>-->
- <!--<configuration>-->
- <!--<jpda>true</jpda>-->
- <!--<jpdaPort>5005</jpdaPort>-->
- <!--<jpdaSuspend>true</jpdaSuspend>-->
-
- <!--<failOnError>true</failOnError>-->
-
-
- <!--<testsuites>-->
- <!--<testsuite>-->
- <!--<config>jboss-unit.xml</config>-->
- <!--<parameters>-->
- <!--<parameter>-->
- <!--<name>dataSourceName</name>-->
- <!--<values>-->
- <!--<value>hsqldb</value>-->
- <!--<value>mysql5</value>-->
- <!--<value>mysql4</value>-->
- <!--<value>postgresql8</value>-->
- <!--<value>sqlserver</value>-->
- <!--<value>oracle9i</value>-->
- <!--<value>oracle10g</value>-->
- <!--</values>-->
- <!--</parameter>-->
- <!--</parameters>-->
-
-
- <!--</testsuite>-->
- <!--</testsuites>-->
-
- <!--<reports>-->
- <!--<xml>idm/target/tests/reports/xml</xml>-->
- <!--<html>idm/target/tests/reports/html</html>-->
- <!--</reports>-->
- <!--</configuration>-->
- <!--</plugin>-->
-
</plugins>
</build>
- <profiles>
- <profile>
- <id>provided-jdbc-driver</id>
- <dependencies>
- <dependency>
- <groupId>privided</groupId>
- <artifactId>jdbc-driver</artifactId>
- <version>NA</version>
- <scope>system</scope>
- <systemPath>${provided.jdbc.driver.path}</systemPath>
- </dependency>
- </dependencies>
- </profile>
- <profile>
- <id>provided-jdbc-driver2</id>
- <dependencies>
- <dependency>
- <groupId>privided</groupId>
- <artifactId>jdbc-driver2</artifactId>
- <version>NA</version>
- <scope>system</scope>
- <systemPath>${provided.jdbc.driver.path2}</systemPath>
- </dependency>
- </dependencies>
- </profile>
- <!--<profile>-->
- <!--<id>oracle-provided-jdbc-drivers</id>-->
- <!--<dependencies>-->
- <!--<dependency>-->
- <!--<groupId>oracle</groupId>-->
- <!--<artifactId>jdbc-driver1</artifactId>-->
- <!--<version>NA</version>-->
- <!--<scope>system</scope>-->
- <!--<systemPath>${oracle.jdbc.driver1}</systemPath>-->
- <!--</dependency>-->
- <!--<dependency>-->
- <!--<groupId>oracle</groupId>-->
- <!--<artifactId>jdbc-driver2</artifactId>-->
- <!--<version>NA</version>-->
- <!--<scope>system</scope>-->
- <!--<systemPath>${oracle.jdbc.driver1}</systemPath>-->
- <!--</dependency>-->
- <!--</dependencies>-->
- <!--</profile>-->
- </profiles>
+
</project>
Modified: idm/trunk/idm-ldap/pom.xml
===================================================================
--- idm/trunk/idm-ldap/pom.xml 2009-05-09 11:10:49 UTC (rev 485)
+++ idm/trunk/idm-ldap/pom.xml 2009-05-09 15:06:22 UTC (rev 486)
@@ -64,101 +64,10 @@
</systemProperties>
</configuration>
</plugin>
- <!--<plugin>-->
- <!--<groupId>org.jboss.unit</groupId>-->
- <!--<artifactId>jboss-unit-tooling-maven2</artifactId>-->
- <!--<executions>-->
- <!--<execution>-->
- <!--<phase>test</phase>-->
- <!--<goals>-->
- <!--<goal>execute</goal>-->
- <!--</goals>-->
- <!--</execution>-->
- <!--</executions>-->
- <!--<configuration>-->
- <!--<jpda>true</jpda>-->
- <!--<jpdaPort>5005</jpdaPort>-->
- <!--<jpdaSuspend>true</jpdaSuspend>-->
- <!--<failOnError>true</failOnError>-->
-
-
- <!--<testsuites>-->
- <!--<testsuite>-->
- <!--<config>jboss-unit.xml</config>-->
- <!--<parameters>-->
- <!--<parameter>-->
- <!--<name>dataSourceName</name>-->
- <!--<values>-->
- <!--<value>hsqldb</value>-->
- <!--<value>mysql5</value>-->
- <!--<value>mysql4</value>-->
- <!--<value>postgresql8</value>-->
- <!--<value>sqlserver</value>-->
- <!--<value>oracle9i</value>-->
- <!--<value>oracle10g</value>-->
- <!--</values>-->
- <!--</parameter>-->
- <!--</parameters>-->
-
-
- <!--</testsuite>-->
- <!--</testsuites>-->
-
- <!--<reports>-->
- <!--<xml>idm/target/tests/reports/xml</xml>-->
- <!--<html>idm/target/tests/reports/html</html>-->
- <!--</reports>-->
- <!--</configuration>-->
- <!--</plugin>-->
-
</plugins>
</build>
- <profiles>
- <profile>
- <id>provided-jdbc-driver</id>
- <dependencies>
- <dependency>
- <groupId>privided</groupId>
- <artifactId>jdbc-driver</artifactId>
- <version>NA</version>
- <scope>system</scope>
- <systemPath>${provided.jdbc.driver.path}</systemPath>
- </dependency>
- </dependencies>
- </profile>
- <profile>
- <id>provided-jdbc-driver2</id>
- <dependencies>
- <dependency>
- <groupId>privided</groupId>
- <artifactId>jdbc-driver2</artifactId>
- <version>NA</version>
- <scope>system</scope>
- <systemPath>${provided.jdbc.driver.path2}</systemPath>
- </dependency>
- </dependencies>
- </profile>
- <!--<profile>-->
- <!--<id>oracle-provided-jdbc-drivers</id>-->
- <!--<dependencies>-->
- <!--<dependency>-->
- <!--<groupId>oracle</groupId>-->
- <!--<artifactId>jdbc-driver1</artifactId>-->
- <!--<version>NA</version>-->
- <!--<scope>system</scope>-->
- <!--<systemPath>${oracle.jdbc.driver1}</systemPath>-->
- <!--</dependency>-->
- <!--<dependency>-->
- <!--<groupId>oracle</groupId>-->
- <!--<artifactId>jdbc-driver2</artifactId>-->
- <!--<version>NA</version>-->
- <!--<scope>system</scope>-->
- <!--<systemPath>${oracle.jdbc.driver1}</systemPath>-->
- <!--</dependency>-->
- <!--</dependencies>-->
- <!--</profile>-->
- </profiles>
+
</project>
Copied: idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/cache/IdentityStoreCacheProvider.java (from rev 485, idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/IdentityStoreCacheSupport.java)
===================================================================
--- idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/cache/IdentityStoreCacheProvider.java (rev 0)
+++ idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/cache/IdentityStoreCacheProvider.java 2009-05-09 15:06:22 UTC (rev 486)
@@ -0,0 +1,124 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.spi.cache;
+
+import org.jboss.identity.idm.spi.model.IdentityObjectAttribute;
+import org.jboss.identity.idm.spi.model.IdentityObjectType;
+import org.jboss.identity.idm.spi.model.IdentityObject;
+import org.jboss.identity.idm.spi.model.IdentityObjectRelationshipType;
+import org.jboss.identity.idm.spi.model.IdentityObjectRelationship;
+import org.jboss.identity.idm.spi.search.IdentityObjectSearchCriteria;
+
+import java.util.Map;
+import java.util.Collection;
+import java.util.Set;
+
+public interface IdentityStoreCacheProvider
+{
+
+ void initResidentNodes(Set<String> supportedIdentityObjectTypes,
+ Set<String> supportedRelationshipTypes);
+
+ void putIntoCache(IdentityObject io);
+
+ void putIntoCache(IdentityObject io, Map<String, IdentityObjectAttribute> attributesMap);
+
+ void removeFromCache(IdentityObject io);
+
+ void removeAttributesFromCache(IdentityObject io);
+
+ IdentityObject getFromCache(String name, IdentityObjectType identityObjectType);
+
+ Map<String, IdentityObjectAttribute> getAttributesFromCache(String name, IdentityObjectType identityObjectType);
+
+ IdentityObject getFromCache(String id);
+
+ void putIdentityObjectSearchIntoCache(IdentityObjectType identityType,
+ IdentityObjectSearchCriteria criteria,
+ Collection<IdentityObject> results);
+
+ Collection<IdentityObject> getIdentityObjectSearchFromCache(IdentityObjectType identityType,
+ IdentityObjectSearchCriteria criteria);
+
+ void putIdentityObjectSearchToCache(IdentityObject identity,
+ IdentityObjectRelationshipType relationshipType,
+ boolean parent,
+ IdentityObjectSearchCriteria criteria,
+ Collection<IdentityObject> results);
+
+ Collection<IdentityObject> getIdentityObjectSearchFromCache(IdentityObject identity,
+ IdentityObjectRelationshipType relationshipType,
+ boolean parent,
+ IdentityObjectSearchCriteria criteria);
+
+ void putRelationshipsSearchIntoCache(IdentityObject fromIdentity,
+ IdentityObject toIdentity,
+ IdentityObjectRelationshipType relationshipType,
+ Set<IdentityObjectRelationship> results);
+
+ Set<IdentityObjectRelationship> getRelationshipsSearchFromCache(IdentityObject fromIdentity,
+ IdentityObject toIdentity,
+ IdentityObjectRelationshipType relationshipType);
+
+ void putRelationshipSearchIntoCache(IdentityObject identity,
+ IdentityObjectRelationshipType relationshipType,
+ boolean parent,
+ boolean named,
+ String name,
+ Set<IdentityObjectRelationship> results);
+
+ Set<IdentityObjectRelationship> getRelationshipsSearchFromCache(IdentityObject identity,
+ IdentityObjectRelationshipType relationshipType,
+ boolean parent,
+ boolean named,
+ String name);
+
+ void invalidateCachedIdentityObjectSearches(IdentityObject io);
+
+ void putIdentityObjectCountIntoCache(IdentityObjectType identityType, int count);
+
+ int getIdentityObjectCountFromCache(IdentityObjectType identityType);
+
+ void invalidateCachedIdentityObjectCount(IdentityObjectType identityType);
+
+ void invalidateCachedRelationshipSearches(IdentityObject fromIdentity,
+ IdentityObject toIdentity,
+ IdentityObjectRelationshipType relationshipType,
+ String relationshipName);
+
+ void invalidateCachedRelationshipSearches(IdentityObject identity1, IdentityObject identity2, boolean named);
+
+ void invalidateRelationshipNameSearches(String name);
+
+ void putRelationshipNamesSearchIntoCache(IdentityObjectSearchCriteria criteria, Set<String> results);
+
+ Set<String> getRelationshipNamesSearchFromCache(IdentityObjectSearchCriteria criteria);
+
+ void putRelationshipNamesSearchIntoCache(IdentityObject identity,
+ IdentityObjectSearchCriteria criteria,
+ Set<String> results);
+
+ Set<String> getRelationshipNamesSearchFromCache(IdentityObject identity, IdentityObjectSearchCriteria criteria);
+
+
+}
Modified: idm/trunk/idm-testsuite/pom.xml
===================================================================
--- idm/trunk/idm-testsuite/pom.xml 2009-05-09 11:10:49 UTC (rev 485)
+++ idm/trunk/idm-testsuite/pom.xml 2009-05-09 15:06:22 UTC (rev 486)
@@ -184,101 +184,8 @@
</systemProperties>
</configuration>
</plugin>
- <!--<plugin>-->
- <!--<groupId>org.jboss.unit</groupId>-->
- <!--<artifactId>jboss-unit-tooling-maven2</artifactId>-->
- <!--<executions>-->
- <!--<execution>-->
- <!--<phase>test</phase>-->
- <!--<goals>-->
- <!--<goal>execute</goal>-->
- <!--</goals>-->
- <!--</execution>-->
- <!--</executions>-->
- <!--<configuration>-->
- <!--<jpda>true</jpda>-->
- <!--<jpdaPort>5005</jpdaPort>-->
- <!--<jpdaSuspend>true</jpdaSuspend>-->
-
- <!--<failOnError>true</failOnError>-->
-
-
- <!--<testsuites>-->
- <!--<testsuite>-->
- <!--<config>jboss-unit.xml</config>-->
- <!--<parameters>-->
- <!--<parameter>-->
- <!--<name>dataSourceName</name>-->
- <!--<values>-->
- <!--<value>hsqldb</value>-->
- <!--<value>mysql5</value>-->
- <!--<value>mysql4</value>-->
- <!--<value>postgresql8</value>-->
- <!--<value>sqlserver</value>-->
- <!--<value>oracle9i</value>-->
- <!--<value>oracle10g</value>-->
- <!--</values>-->
- <!--</parameter>-->
- <!--</parameters>-->
-
-
- <!--</testsuite>-->
- <!--</testsuites>-->
-
- <!--<reports>-->
- <!--<xml>idm/target/tests/reports/xml</xml>-->
- <!--<html>idm/target/tests/reports/html</html>-->
- <!--</reports>-->
- <!--</configuration>-->
- <!--</plugin>-->
-
</plugins>
</build>
- <profiles>
- <profile>
- <id>provided-jdbc-driver</id>
- <dependencies>
- <dependency>
- <groupId>privided</groupId>
- <artifactId>jdbc-driver</artifactId>
- <version>NA</version>
- <scope>system</scope>
- <systemPath>${provided.jdbc.driver.path}</systemPath>
- </dependency>
- </dependencies>
- </profile>
- <profile>
- <id>provided-jdbc-driver2</id>
- <dependencies>
- <dependency>
- <groupId>privided</groupId>
- <artifactId>jdbc-driver2</artifactId>
- <version>NA</version>
- <scope>system</scope>
- <systemPath>${provided.jdbc.driver.path2}</systemPath>
- </dependency>
- </dependencies>
- </profile>
- <!--<profile>-->
- <!--<id>oracle-provided-jdbc-drivers</id>-->
- <!--<dependencies>-->
- <!--<dependency>-->
- <!--<groupId>oracle</groupId>-->
- <!--<artifactId>jdbc-driver1</artifactId>-->
- <!--<version>NA</version>-->
- <!--<scope>system</scope>-->
- <!--<systemPath>${oracle.jdbc.driver1}</systemPath>-->
- <!--</dependency>-->
- <!--<dependency>-->
- <!--<groupId>oracle</groupId>-->
- <!--<artifactId>jdbc-driver2</artifactId>-->
- <!--<version>NA</version>-->
- <!--<scope>system</scope>-->
- <!--<systemPath>${oracle.jdbc.driver1}</systemPath>-->
- <!--</dependency>-->
- <!--</dependencies>-->
- <!--</profile>-->
- </profiles>
</project>
Modified: idm/trunk/idm-testsuite/src/test/resources/organization-test-config.xml
===================================================================
--- idm/trunk/idm-testsuite/src/test/resources/organization-test-config.xml 2009-05-09 11:10:49 UTC (rev 485)
+++ idm/trunk/idm-testsuite/src/test/resources/organization-test-config.xml 2009-05-09 15:06:22 UTC (rev 486)
@@ -89,6 +89,10 @@
<value>true</value>
</option>
<option>
+ <name>cache.provider.class</name>
+ <value>org.jboss.identity.idm.impl.cache.IdentityStoreCacheProviderImpl</value>
+ </option>
+ <option>
<name>cache.config-file</name>
<value>src/test/resources/jboss-cache-config.xml</value>
</option>
@@ -136,6 +140,10 @@
<value>true</value>
</option>
<option>
+ <name>cache.provider.class</name>
+ <value>org.jboss.identity.idm.impl.cache.IdentityStoreCacheProviderImpl</value>
+ </option>
+ <option>
<name>cache.config-file</name>
<value>src/test/resources/jboss-cache-config.xml</value>
</option>
Modified: idm/trunk/idm-testsuite/src/test/resources/organization-test-jboss-unit-config.xml
===================================================================
--- idm/trunk/idm-testsuite/src/test/resources/organization-test-jboss-unit-config.xml 2009-05-09 11:10:49 UTC (rev 485)
+++ idm/trunk/idm-testsuite/src/test/resources/organization-test-jboss-unit-config.xml 2009-05-09 15:06:22 UTC (rev 486)
@@ -89,6 +89,10 @@
<value>true</value>
</option>
<option>
+ <name>cache.provider.class</name>
+ <value>org.jboss.identity.idm.impl.cache.IdentityStoreCacheProviderImpl</value>
+ </option>
+ <option>
<name>cache.config-file</name>
<value>jboss-cache-config.xml</value>
</option>
@@ -136,6 +140,10 @@
<value>true</value>
</option>
<option>
+ <name>cache.provider.class</name>
+ <value>org.jboss.identity.idm.impl.cache.IdentityStoreCacheProviderImpl</value>
+ </option>
+ <option>
<name>cache.config-file</name>
<value>jboss-cache-config.xml</value>
</option>
Modified: idm/trunk/parent/pom.xml
===================================================================
--- idm/trunk/parent/pom.xml 2009-05-09 11:10:49 UTC (rev 485)
+++ idm/trunk/parent/pom.xml 2009-05-09 15:06:22 UTC (rev 486)
@@ -121,6 +121,30 @@
</plugins>
</build>
</profile>
+ <profile>
+ <id>provided-jdbc-driver</id>
+ <dependencies>
+ <dependency>
+ <groupId>privided</groupId>
+ <artifactId>jdbc-driver</artifactId>
+ <version>NA</version>
+ <scope>system</scope>
+ <systemPath>${provided.jdbc.driver.path}</systemPath>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>provided-jdbc-driver2</id>
+ <dependencies>
+ <dependency>
+ <groupId>privided</groupId>
+ <artifactId>jdbc-driver2</artifactId>
+ <version>NA</version>
+ <scope>system</scope>
+ <systemPath>${provided.jdbc.driver.path2}</systemPath>
+ </dependency>
+ </dependencies>
+ </profile>
</profiles>
<repositories>
15 years, 8 months
JBoss Identity SVN: r485 - in idm/trunk: idm-cache and 68 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-05-09 07:10:49 -0400 (Sat, 09 May 2009)
New Revision: 485
Added:
idm/trunk/idm-cache/
idm/trunk/idm-cache/pom.xml
idm/trunk/idm-cache/src/
idm/trunk/idm-cache/src/main/
idm/trunk/idm-cache/src/main/java/
idm/trunk/idm-cache/src/main/java/org/
idm/trunk/idm-cache/src/main/java/org/jboss/
idm/trunk/idm-cache/src/main/java/org/jboss/identity/
idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/
idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/
idm/trunk/idm-cache/src/main/resources/
idm/trunk/idm-cache/src/test/
idm/trunk/idm-cache/src/test/java/
idm/trunk/idm-cache/src/test/java/org/
idm/trunk/idm-cache/src/test/java/org/jboss/
idm/trunk/idm-cache/src/test/java/org/jboss/identity/
idm/trunk/idm-cache/src/test/java/org/jboss/identity/idm/
idm/trunk/idm-cache/src/test/resources/
idm/trunk/idm-core/src/test/resources/store-test-config.xml
idm/trunk/idm-hibernate/
idm/trunk/idm-hibernate/pom.xml
idm/trunk/idm-hibernate/src/
idm/trunk/idm-hibernate/src/main/
idm/trunk/idm-hibernate/src/main/java/
idm/trunk/idm-hibernate/src/main/java/org/
idm/trunk/idm-hibernate/src/main/java/org/jboss/
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/
idm/trunk/idm-hibernate/src/main/resources/
idm/trunk/idm-hibernate/src/test/
idm/trunk/idm-hibernate/src/test/java/
idm/trunk/idm-hibernate/src/test/java/org/
idm/trunk/idm-hibernate/src/test/java/org/jboss/
idm/trunk/idm-hibernate/src/test/java/org/jboss/identity/
idm/trunk/idm-hibernate/src/test/java/org/jboss/identity/idm/
idm/trunk/idm-hibernate/src/test/java/org/jboss/identity/idm/impl/
idm/trunk/idm-hibernate/src/test/resources/
idm/trunk/idm-ldap/
idm/trunk/idm-ldap/pom.xml
idm/trunk/idm-ldap/src/
idm/trunk/idm-ldap/src/main/
idm/trunk/idm-ldap/src/main/java/
idm/trunk/idm-ldap/src/main/java/org/
idm/trunk/idm-ldap/src/main/java/org/jboss/
idm/trunk/idm-ldap/src/main/java/org/jboss/identity/
idm/trunk/idm-ldap/src/main/java/org/jboss/identity/idm/
idm/trunk/idm-ldap/src/main/java/org/jboss/identity/idm/impl/
idm/trunk/idm-ldap/src/main/java/org/jboss/identity/idm/impl/model/
idm/trunk/idm-ldap/src/main/java/org/jboss/identity/idm/impl/model/ldap/
idm/trunk/idm-ldap/src/main/java/org/jboss/identity/idm/impl/store/
idm/trunk/idm-ldap/src/main/java/org/jboss/identity/idm/impl/store/ldap/
idm/trunk/idm-ldap/src/main/resources/
idm/trunk/idm-ldap/src/test/
idm/trunk/idm-ldap/src/test/java/
idm/trunk/idm-ldap/src/test/java/org/
idm/trunk/idm-ldap/src/test/java/org/jboss/
idm/trunk/idm-ldap/src/test/java/org/jboss/identity/
idm/trunk/idm-ldap/src/test/java/org/jboss/identity/idm/
idm/trunk/idm-ldap/src/test/resources/
idm/trunk/idm-testsuite/
idm/trunk/idm-testsuite/pom.xml
idm/trunk/idm-testsuite/src/
idm/trunk/idm-testsuite/src/main/
idm/trunk/idm-testsuite/src/main/java/
idm/trunk/idm-testsuite/src/main/java/org/
idm/trunk/idm-testsuite/src/main/resources/
idm/trunk/idm-testsuite/src/test/
idm/trunk/idm-testsuite/src/test/java/
idm/trunk/idm-testsuite/src/test/java/org/
idm/trunk/idm-testsuite/src/test/java/org/jboss/
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/HibernateTestSupport.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/IdentityTestPOJO.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/LDAPTestPOJO.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/APILDAPTestCase.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/APITestCase.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/APITestContext.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/GroupQueryTest.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/GroupTypeEnum.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/ModelTestCase.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/OrganizationLDAPTestCase.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/OrganizationTest.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/OrganizationTestCase.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/PersistenceManagerTest.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/RelationshipManagerTest.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/RoleManagerTest.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/RoleQueryTest.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/UserQueryTest.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/hibernate/
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateModelTestCase.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/ldap/
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/test/
idm/trunk/idm-testsuite/src/test/resources/
idm/trunk/idm-testsuite/src/test/resources/datasources/
idm/trunk/idm-testsuite/src/test/resources/hibernate-jboss-identity-classes.cfg.xml
idm/trunk/idm-testsuite/src/test/resources/hibernate-jboss-identity.cfg.xml
idm/trunk/idm-testsuite/src/test/resources/identity-config.xsd
idm/trunk/idm-testsuite/src/test/resources/ldap/
idm/trunk/idm-testsuite/src/test/resources/log4j.xml
idm/trunk/idm-testsuite/src/test/resources/opends/
idm/trunk/idm-testsuite/src/test/resources/organization-test-config.xml
idm/trunk/idm-testsuite/src/test/resources/organization-test-jboss-unit-config.xml
idm/trunk/idm-testsuite/src/test/resources/store-test-config.xml
Removed:
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/model/hibernate/
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/model/ldap/
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/store/hibernate/
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/store/ldap/
idm/trunk/idm-core/src/test/java/org/jboss/identity/idm/impl/HibernateTestSupport.java
idm/trunk/idm-core/src/test/java/org/jboss/identity/idm/impl/IdentityTestPOJO.java
idm/trunk/idm-core/src/test/java/org/jboss/identity/idm/impl/LDAPTestPOJO.java
idm/trunk/idm-core/src/test/java/org/jboss/identity/idm/impl/api/
idm/trunk/idm-core/src/test/java/org/jboss/identity/idm/impl/store/hibernate/
idm/trunk/idm-core/src/test/java/org/jboss/identity/idm/impl/store/ldap/
idm/trunk/idm-core/src/test/java/org/jboss/identity/idm/test/
idm/trunk/idm-core/src/test/resources/datasources/
idm/trunk/idm-core/src/test/resources/hibernate-jboss-identity-classes.cfg.xml
idm/trunk/idm-core/src/test/resources/hibernate-jboss-identity.cfg.xml
idm/trunk/idm-core/src/test/resources/ldap/
idm/trunk/idm-core/src/test/resources/log4j.xml
idm/trunk/idm-core/src/test/resources/opends/
idm/trunk/idm-core/src/test/resources/organization-test-config.xml
idm/trunk/idm-core/src/test/resources/organization-test-jboss-unit-config.xml
idm/trunk/idm-core/src/test/resources/store-test-config.xml
Modified:
idm/trunk/idm-core/pom.xml
idm/trunk/pom.xml
Log:
initial split of modules to separate hibernate, ldap and cache dependencies
Added: idm/trunk/idm-cache/pom.xml
===================================================================
--- idm/trunk/idm-cache/pom.xml (rev 0)
+++ idm/trunk/idm-cache/pom.xml 2009-05-09 11:10:49 UTC (rev 485)
@@ -0,0 +1,164 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.identity</groupId>
+ <artifactId>idm-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../parent</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>idm-cache</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Identity IDM Cachen</name>
+ <url>http://labs.jboss.org/portal/jbosssecurity/</url>
+ <description>JBoss Identity IDM Cache</description>
+ <licenses>
+ <license>
+ <name>lgpl</name>
+ <url>http://repository.jboss.com/licenses/lgpl.txt</url>
+ </license>
+ </licenses>
+ <organization>
+ <name>JBoss Inc.</name>
+ <url>http://www.jboss.org</url>
+ </organization>
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossidentity/trunk</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/jbossidentity/trunk</developerConnection>
+ <url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossidentity/trunk</url>
+ </scm>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.identity</groupId>
+ <artifactId>idm-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.jboss.cache</groupId>
+ <artifactId>jbosscache-core</artifactId>
+ <version>3.0.2.GA</version>
+ </dependency>
+
+ </dependencies>
+
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.3</version>
+ <configuration>
+ <systemProperties>
+ <property>
+ <name>dataSourceName</name>
+ <value>${dataSourceName}</value>
+ </property>
+ <property>
+ <name>directoryName</name>
+ <value>${directoryName}</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ <!--<plugin>-->
+ <!--<groupId>org.jboss.unit</groupId>-->
+ <!--<artifactId>jboss-unit-tooling-maven2</artifactId>-->
+ <!--<executions>-->
+ <!--<execution>-->
+ <!--<phase>test</phase>-->
+ <!--<goals>-->
+ <!--<goal>execute</goal>-->
+ <!--</goals>-->
+ <!--</execution>-->
+ <!--</executions>-->
+ <!--<configuration>-->
+
+ <!--<jpda>true</jpda>-->
+ <!--<jpdaPort>5005</jpdaPort>-->
+ <!--<jpdaSuspend>true</jpdaSuspend>-->
+
+ <!--<failOnError>true</failOnError>-->
+
+
+ <!--<testsuites>-->
+ <!--<testsuite>-->
+ <!--<config>jboss-unit.xml</config>-->
+ <!--<parameters>-->
+ <!--<parameter>-->
+ <!--<name>dataSourceName</name>-->
+ <!--<values>-->
+ <!--<value>hsqldb</value>-->
+ <!--<value>mysql5</value>-->
+ <!--<value>mysql4</value>-->
+ <!--<value>postgresql8</value>-->
+ <!--<value>sqlserver</value>-->
+ <!--<value>oracle9i</value>-->
+ <!--<value>oracle10g</value>-->
+ <!--</values>-->
+ <!--</parameter>-->
+ <!--</parameters>-->
+
+
+ <!--</testsuite>-->
+ <!--</testsuites>-->
+
+ <!--<reports>-->
+ <!--<xml>idm/target/tests/reports/xml</xml>-->
+ <!--<html>idm/target/tests/reports/html</html>-->
+ <!--</reports>-->
+ <!--</configuration>-->
+ <!--</plugin>-->
+
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>provided-jdbc-driver</id>
+ <dependencies>
+ <dependency>
+ <groupId>privided</groupId>
+ <artifactId>jdbc-driver</artifactId>
+ <version>NA</version>
+ <scope>system</scope>
+ <systemPath>${provided.jdbc.driver.path}</systemPath>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>provided-jdbc-driver2</id>
+ <dependencies>
+ <dependency>
+ <groupId>privided</groupId>
+ <artifactId>jdbc-driver2</artifactId>
+ <version>NA</version>
+ <scope>system</scope>
+ <systemPath>${provided.jdbc.driver.path2}</systemPath>
+ </dependency>
+ </dependencies>
+ </profile>
+ <!--<profile>-->
+ <!--<id>oracle-provided-jdbc-drivers</id>-->
+ <!--<dependencies>-->
+ <!--<dependency>-->
+ <!--<groupId>oracle</groupId>-->
+ <!--<artifactId>jdbc-driver1</artifactId>-->
+ <!--<version>NA</version>-->
+ <!--<scope>system</scope>-->
+ <!--<systemPath>${oracle.jdbc.driver1}</systemPath>-->
+ <!--</dependency>-->
+ <!--<dependency>-->
+ <!--<groupId>oracle</groupId>-->
+ <!--<artifactId>jdbc-driver2</artifactId>-->
+ <!--<version>NA</version>-->
+ <!--<scope>system</scope>-->
+ <!--<systemPath>${oracle.jdbc.driver1}</systemPath>-->
+ <!--</dependency>-->
+ <!--</dependencies>-->
+ <!--</profile>-->
+ </profiles>
+</project>
Modified: idm/trunk/idm-core/pom.xml
===================================================================
--- idm/trunk/idm-core/pom.xml 2009-05-09 10:22:47 UTC (rev 484)
+++ idm/trunk/idm-core/pom.xml 2009-05-09 11:10:49 UTC (rev 485)
@@ -230,6 +230,18 @@
</systemProperties>
</configuration>
</plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
<!--<plugin>-->
<!--<groupId>org.jboss.unit</groupId>-->
<!--<artifactId>jboss-unit-tooling-maven2</artifactId>-->
Deleted: idm/trunk/idm-core/src/test/java/org/jboss/identity/idm/impl/HibernateTestSupport.java
===================================================================
--- idm/trunk/idm-core/src/test/java/org/jboss/identity/idm/impl/HibernateTestSupport.java 2009-05-09 10:22:47 UTC (rev 484)
+++ idm/trunk/idm-core/src/test/java/org/jboss/identity/idm/impl/HibernateTestSupport.java 2009-05-09 11:10:49 UTC (rev 485)
@@ -1,135 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-package org.jboss.identity.idm.impl;
-
-import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipType;
-import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectType;
-import org.hibernate.SessionFactory;
-import org.hibernate.cfg.AnnotationConfiguration;
-
-import java.util.logging.Logger;
-import java.sql.Connection;
-import java.sql.DriverManager;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class HibernateTestSupport
-{
- private static Logger logger = Logger.getLogger(HibernateTestSupport.class.getName());
-
- protected SessionFactory sessionFactory;
-
- private Connection connection;
-
- private final String databaseName;
-
- private final String hibernateConfiguration;
-
- public HibernateTestSupport(String databaseName, String hibernateConfiguration)
- {
- this.databaseName = databaseName;
- this.hibernateConfiguration = hibernateConfiguration;
- }
-
- public SessionFactory getSessionFactory()
- {
- return sessionFactory;
- }
-
-
- public void start() throws Exception {
- try {
- logger.info("Starting in-memory HSQL database for unit tests");
- Class.forName("org.hsqldb.jdbcDriver");
- connection = DriverManager.getConnection("jdbc:hsqldb:mem:" + databaseName, "sa", "");
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- logger.fine("Exception during HSQL database startup.");
- throw ex;
- }
- try
- {
- logger.info("Building JPA EntityManager for unit tests");
- //emFactory = (HibernateEntityManagerFactory)Persistence.createEntityManagerFactory(persistenceUnit);
- sessionFactory = new AnnotationConfiguration().configure(hibernateConfiguration).buildSessionFactory();
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- logger.fine("Exception during JPA EntityManager instanciation.");
- throw ex;
- }
- }
-
- public void stop() throws Exception {
- logger.info("Shuting down Hibernate JPA layer.");
- if (sessionFactory != null)
- {
- sessionFactory.close();
- }
-
- logger.info("Stopping in-memory HSQL database.");
- try
- {
- connection.createStatement().execute("SHUTDOWN");
- }
- catch (Exception ex) {
- throw ex;
- }
- }
-
- public void populateObjectTypes(String[] typeNames) throws Exception
- {
-
- sessionFactory.getCurrentSession().getTransaction().begin();
-
- for (String typeName : typeNames)
- {
- HibernateIdentityObjectType hibernateType = new HibernateIdentityObjectType(typeName);
- sessionFactory.getCurrentSession().persist(hibernateType);
- }
-
- sessionFactory.getCurrentSession().getTransaction().commit();
-
- }
-
- public void populateRelationshipTypes(String[] typeNames) throws Exception
- {
-
- sessionFactory.getCurrentSession().getTransaction().begin();
-
- for (String typeName : typeNames)
- {
- HibernateIdentityObjectRelationshipType hibernateType = new HibernateIdentityObjectRelationshipType(typeName);
- sessionFactory.getCurrentSession().persist(hibernateType);
- }
-
- sessionFactory.getCurrentSession().getTransaction().commit();
- }
-
-
-}
Deleted: idm/trunk/idm-core/src/test/java/org/jboss/identity/idm/impl/IdentityTestPOJO.java
===================================================================
--- idm/trunk/idm-core/src/test/java/org/jboss/identity/idm/impl/IdentityTestPOJO.java 2009-05-09 10:22:47 UTC (rev 484)
+++ idm/trunk/idm-core/src/test/java/org/jboss/identity/idm/impl/IdentityTestPOJO.java 2009-05-09 11:10:49 UTC (rev 485)
@@ -1,244 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-package org.jboss.identity.idm.impl;
-
-import org.jboss.unit.api.pojo.annotations.Parameter;
-import org.jboss.unit.api.pojo.annotations.Create;
-import static org.jboss.unit.api.Assert.assertTrue;
-import org.jboss.portal.test.framework.embedded.JNDISupport;
-import org.jboss.portal.test.framework.embedded.ConnectionManagerSupport;
-import org.jboss.portal.test.framework.embedded.TransactionManagerSupport;
-import org.jboss.portal.test.framework.embedded.DataSourceSupport;
-import org.jboss.portal.test.framework.embedded.HibernateSupport;
-import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObject;
-import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectAttribute;
-import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttribute;
-import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectTextAttribute;
-import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredential;
-import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredentialType;
-import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationship;
-import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipName;
-import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipType;
-import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectType;
-import org.jboss.identity.idm.impl.model.hibernate.HibernateRealm;
-import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttributeValue;
-import org.jboss.identity.idm.test.HibernateAnnotationsSupport;
-import org.jboss.identity.idm.opends.OpenDSService;
-import org.opends.server.tools.LDAPModify;
-import org.hibernate.SessionFactory;
-
-import javax.naming.Context;
-import javax.naming.NamingEnumeration;
-import javax.naming.Binding;
-import javax.naming.ldap.InitialLdapContext;
-import javax.naming.directory.DirContext;
-import java.util.List;
-import java.util.LinkedList;
-import java.util.Hashtable;
-import java.io.File;
-
-import junit.framework.TestCase;
-
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class IdentityTestPOJO extends TestCase
-{
-
- private String identityConfig = "organization-test-jboss-unit-config.xml";
-
- private String realmName;
-
- private String dataSourceName = "hsqldb";
-
- private String hibernateConfig = "datasources/hibernates.xml";
-
- private String datasources = "datasources/datasources.xml";
-
- private JNDISupport jndiSupport;
-
- protected TransactionManagerSupport transactonManagerSupport;
-
- protected ConnectionManagerSupport connectionManagerSupport;
-
- protected DataSourceSupport dataSourceSupport;
-
- protected HibernateSupport hibernateSupport;
-
-
-
- public void start() throws Exception
- {
- overrideFromProperties();
-
- jndiSupport = new JNDISupport();
- jndiSupport.start();
- transactonManagerSupport = new TransactionManagerSupport();
- transactonManagerSupport.start();
- connectionManagerSupport = new ConnectionManagerSupport();
- connectionManagerSupport.setTransactionManager(transactonManagerSupport.getTransactionManager());
- connectionManagerSupport.start();
-
-
-
- DataSourceSupport.Config dataSourceConfig = DataSourceSupport.Config.obtainConfig(datasources, dataSourceName);
-
- HibernateSupport.Config hibernateSupportConfig = HibernateSupport.getConfig(dataSourceName, hibernateConfig);
-
- dataSourceSupport = new DataSourceSupport();
- dataSourceSupport.setTransactionManager(transactonManagerSupport.getTransactionManager());
- dataSourceSupport.setConnectionManagerReference(connectionManagerSupport.getConnectionManagerReference());
- dataSourceSupport.setConfig(dataSourceConfig);
- dataSourceSupport.start();
-
- hibernateSupport = new HibernateAnnotationsSupport();
- hibernateSupport.setConfig(hibernateSupportConfig);
- hibernateSupport.setJNDIName("java:/jbossidentity/HibernateStoreSessionFactory");
-
- List<String> annotatedClasses = new LinkedList<String>();
- annotatedClasses.add(HibernateIdentityObject.class.getName());
- annotatedClasses.add(HibernateIdentityObjectAttribute.class.getName());
- annotatedClasses.add(HibernateIdentityObjectBinaryAttribute.class.getName());
- annotatedClasses.add(HibernateIdentityObjectBinaryAttributeValue.class.getName());
- annotatedClasses.add(HibernateIdentityObjectTextAttribute.class.getName());
- annotatedClasses.add(HibernateIdentityObjectCredential.class.getName());
- annotatedClasses.add(HibernateIdentityObjectCredentialType.class.getName());
- annotatedClasses.add(HibernateIdentityObjectRelationship.class.getName());
- annotatedClasses.add(HibernateIdentityObjectRelationshipName.class.getName());
- annotatedClasses.add(HibernateIdentityObjectRelationshipType.class.getName());
- annotatedClasses.add(HibernateIdentityObjectType.class.getName());
- annotatedClasses.add(HibernateRealm.class.getName());
-
- hibernateSupport.setMappings(annotatedClasses);
-
- hibernateSupport.start();
-
-
- }
-
- public void stop() throws Exception
- {
- hibernateSupport.stop();
- dataSourceSupport.stop();
- connectionManagerSupport.stop();
- transactonManagerSupport.stop();
- jndiSupport.stop();
-
-
- }
-
- public void overrideFromProperties() throws Exception
- {
- String dsName =System.getProperties().getProperty("dataSourceName");
-
- if (dsName != null && !dsName.startsWith("$"))
- {
- setDataSourceName(dsName);
- }
-
- }
-
- public SessionFactory getSessionFactory()
- {
- return getHibernateSupport().getSessionFactory();
- }
-
-
-
-
- @Parameter(name="dataSourceName")
- public void setDataSourceName(String dataSourceName)
- {
- this.dataSourceName = dataSourceName;
- }
-
- @Parameter(name="hibernateConfig")
- public void setHibernateConfig(String hibernateConfig)
- {
- this.hibernateConfig = hibernateConfig;
- }
-
- @Parameter(name="datasources")
- public void setDatasources(String datasources)
- {
- this.datasources = datasources;
- }
-
- @Parameter(name="identityConfig")
- public void setIdentityConfig(String identityConfig)
- {
- this.identityConfig = identityConfig;
- }
-
- @Parameter(name="realmName")
- public void setRealmName(String realmName)
- {
- this.realmName = realmName;
- }
-
- public String getDataSourceName()
- {
- return dataSourceName;
- }
-
- public String getHibernateConfig()
- {
- return hibernateConfig;
- }
-
- public String getDatasources()
- {
- return datasources;
- }
-
- public String getIdentityConfig()
- {
- return identityConfig;
- }
-
- public String getRealmName()
- {
- return realmName;
- }
-
- public HibernateSupport getHibernateSupport()
- {
- return hibernateSupport;
- }
-
- public void begin()
- {
- getHibernateSupport().openSession();
- }
-
- public void commit()
- {
- assertTrue(getHibernateSupport().commitTransaction());
- }
-
-
-
-
-}
Deleted: idm/trunk/idm-core/src/test/java/org/jboss/identity/idm/impl/LDAPTestPOJO.java
===================================================================
--- idm/trunk/idm-core/src/test/java/org/jboss/identity/idm/impl/LDAPTestPOJO.java 2009-05-09 10:22:47 UTC (rev 484)
+++ idm/trunk/idm-core/src/test/java/org/jboss/identity/idm/impl/LDAPTestPOJO.java 2009-05-09 11:10:49 UTC (rev 485)
@@ -1,185 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-package org.jboss.identity.idm.impl;
-
-import org.jboss.identity.idm.opends.OpenDSService;
-import org.jboss.unit.api.pojo.annotations.Parameter;
-import org.opends.server.tools.LDAPModify;
-
-import javax.naming.Context;
-import javax.naming.NamingEnumeration;
-import javax.naming.Binding;
-import javax.naming.directory.DirContext;
-import javax.naming.ldap.InitialLdapContext;
-import javax.naming.ldap.LdapContext;
-import java.util.Hashtable;
-import java.io.File;
-import java.net.URL;
-import java.net.URISyntaxException;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class LDAPTestPOJO extends IdentityTestPOJO
-{
-
- private String directoryName = "EmbeddedOpenDS";
-
- public static final String LDAP_HOST = "localhost";
-
- public static final String LDAP_PORT = "10389";
-
- public static final String LDAP_PROVIDER_URL = "ldap://" + LDAP_HOST + ":" + LDAP_PORT;
-
- public static final String LDAP_PRINCIPAL = "cn=Directory Manager";
-
- public static final String LDAP_CREDENTIALS = "password";
-
- public static Hashtable<String,String> env = new Hashtable<String,String>();
-
- static
- {
- env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
- env.put(Context.PROVIDER_URL, LDAP_PROVIDER_URL);
- env.put(Context.SECURITY_AUTHENTICATION, "simple");
- env.put(Context.SECURITY_PRINCIPAL, LDAP_PRINCIPAL);
- env.put(Context.SECURITY_CREDENTIALS, LDAP_CREDENTIALS);
- }
-
- OpenDSService openDSService = new OpenDSService(null);
-
- @Override
- public void start() throws Exception
- {
- super.start();
-
-
- openDSService.start();
-
-
- }
-
- @Override
- public void stop() throws Exception
- {
- super.stop();
-
- cleanUp(new InitialLdapContext(env, null));
- openDSService.stop();
-
- }
-
- public void overrideFromProperties() throws Exception
- {
- super.overrideFromProperties();
-
- String dirName = System.getProperties().getProperty("directoryName");
-
- if (dirName != null && !dirName.startsWith("$"))
- {
- setDirectoryName(dirName);
- }
-
- }
-
- @Parameter
- public void setDirectoryName(String directoryName)
- {
- this.directoryName = directoryName;
- }
-
- public String getDirectoryName()
- {
- return directoryName;
- }
-
- public void populate() throws Exception
- {
- populateLDIF("ldap/initial-opends.ldif");
- }
-
- public void populateClean() throws Exception
- {
- populateLDIF("ldap/initial-empty-opends.ldif");
- }
-
- public void populateLDIF(String ldif) throws Exception
- {
-
- URL ldifURL = Thread.currentThread().getContextClassLoader().getResource(ldif);
-
- System.out.println("LDIF: " + ldifURL.toURI().getPath());
-
- String[] cmd = new String[] {"-h", LDAP_HOST,
- "-p", LDAP_PORT,
- "-D", LDAP_PRINCIPAL,
- "-w", LDAP_CREDENTIALS,
- "-a", "-f", ldifURL.toURI().getPath()};
-
- System.out.println("Populate success: " + (LDAPModify.mainModify(cmd, false, System.out, System.err) == 0));
-
- }
-
- protected void cleanUp(DirContext ldapCtx) throws Exception
- {
- try
- {
- String dn = "dc=portal,dc=example,dc=com";
-
- System.out.println("Removing: " + dn);
-
- removeContext(ldapCtx, dn);
- }
- catch (Exception e)
- {
- //
- }
- }
-
- //subsequent remove of javax.naming.Context
- protected void removeContext(Context mainCtx, String name) throws Exception
- {
- Context deleteCtx = (Context)mainCtx.lookup(name);
- NamingEnumeration subDirs = mainCtx.listBindings(name);
-
- while (subDirs.hasMoreElements())
- {
- Binding binding = (Binding)subDirs.nextElement();
- String subName = binding.getName();
-
- removeContext(deleteCtx, subName);
- }
-
- mainCtx.unbind(name);
- }
-
-
- public LdapContext getLdapContext() throws Exception
- {
- return new InitialLdapContext(env, null);
- }
-
-
-
-}
Deleted: idm/trunk/idm-core/src/test/resources/hibernate-jboss-identity-classes.cfg.xml
===================================================================
--- idm/trunk/idm-core/src/test/resources/hibernate-jboss-identity-classes.cfg.xml 2009-05-09 10:22:47 UTC (rev 484)
+++ idm/trunk/idm-core/src/test/resources/hibernate-jboss-identity-classes.cfg.xml 2009-05-09 11:10:49 UTC (rev 485)
@@ -1,60 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ JBoss, a division of Red Hat ~
- ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
- ~ contributors as indicated by the @authors tag. See the ~
- ~ copyright.txt in the distribution for a full listing of ~
- ~ individual contributors. ~
- ~ ~
- ~ This is free software; you can redistribute it and/or modify it ~
- ~ under the terms of the GNU Lesser General Public License as ~
- ~ published by the Free Software Foundation; either version 2.1 of ~
- ~ the License, or (at your option) any later version. ~
- ~ ~
- ~ This software is distributed in the hope that it will be useful, ~
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
- ~ Lesser General Public License for more details. ~
- ~ ~
- ~ You should have received a copy of the GNU Lesser General Public ~
- ~ License along with this software; if not, write to the Free ~
- ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
- ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
-
-<!DOCTYPE hibernate-configuration PUBLIC
- "-//Hibernate/Hibernate Configuration DTD//EN"
- "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
-<hibernate-configuration>
- <session-factory>
-
- <property name="show_sql">false</property>
- <property name="cache.use_second_level_cache">true</property>
- <property name="cache.use_query_cache">false</property>
-
- <property name="current_session_context_class">thread</property>
-
- <!--<property name="connection.datasource"></property>-->
-
- <property name="hibernate.connection.url">jdbc:hsqldb:mem:unit-testing-jpa1</property>
- <property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
- <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
- <property name="hibernate.hbm2ddl.auto">create-drop</property>
- <property name="hibernate.connection.username">sa</property>
- <property name="hibernate.connection.password"></property>
-
- <!-- Mapping classes -->
-
- <mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateRealm"/>
- <mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObject"/>
- <mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredential"/>
- <mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredentialType"/>
- <mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectAttribute"/>
- <mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectTextAttribute"/>
- <mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttribute"/>
- <mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectType"/>
- <mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationship"/>
- <mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipType"/>
- <mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipName"/>
- </session-factory>
-</hibernate-configuration>
\ No newline at end of file
Deleted: idm/trunk/idm-core/src/test/resources/hibernate-jboss-identity.cfg.xml
===================================================================
--- idm/trunk/idm-core/src/test/resources/hibernate-jboss-identity.cfg.xml 2009-05-09 10:22:47 UTC (rev 484)
+++ idm/trunk/idm-core/src/test/resources/hibernate-jboss-identity.cfg.xml 2009-05-09 11:10:49 UTC (rev 485)
@@ -1,61 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ JBoss, a division of Red Hat ~
- ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
- ~ contributors as indicated by the @authors tag. See the ~
- ~ copyright.txt in the distribution for a full listing of ~
- ~ individual contributors. ~
- ~ ~
- ~ This is free software; you can redistribute it and/or modify it ~
- ~ under the terms of the GNU Lesser General Public License as ~
- ~ published by the Free Software Foundation; either version 2.1 of ~
- ~ the License, or (at your option) any later version. ~
- ~ ~
- ~ This software is distributed in the hope that it will be useful, ~
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
- ~ Lesser General Public License for more details. ~
- ~ ~
- ~ You should have received a copy of the GNU Lesser General Public ~
- ~ License along with this software; if not, write to the Free ~
- ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
- ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
-
-<!DOCTYPE hibernate-configuration PUBLIC
- "-//Hibernate/Hibernate Configuration DTD//EN"
- "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
-<hibernate-configuration>
- <session-factory>
-
- <property name="show_sql">false</property>
- <property name="cache.use_second_level_cache">true</property>
- <property name="cache.use_query_cache">false</property>
-
- <property name="current_session_context_class">thread</property>
-
- <!--<property name="connection.datasource"></property>-->
-
- <property name="hibernate.connection.url">jdbc:hsqldb:mem:unit-testing-jpa1</property>
- <property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
- <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
- <property name="hibernate.hbm2ddl.auto">create-drop</property>
- <property name="hibernate.connection.username">sa</property>
- <property name="hibernate.connection.password"></property>
-
- <!-- Mapping classes -->
- <!-- all nessesary mappings are added programatically to the configuration -->
- <!--<mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateRealm"/>-->
- <!--<mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObject"/>-->
- <!--<mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredential"/>-->
- <!--<mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredentialType"/>-->
- <!--<mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectAttribute"/>-->
- <!--<mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectTextAttribute"/>-->
- <!--<mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttribute"/>-->
- <!--<mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectType"/>-->
- <!--<mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationship"/>-->
- <!--<mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipType"/>-->
- <!--<mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipName"/>-->
-
- </session-factory>
-</hibernate-configuration>
\ No newline at end of file
Deleted: idm/trunk/idm-core/src/test/resources/log4j.xml
===================================================================
--- idm/trunk/idm-core/src/test/resources/log4j.xml 2009-05-09 10:22:47 UTC (rev 484)
+++ idm/trunk/idm-core/src/test/resources/log4j.xml 2009-05-09 11:10:49 UTC (rev 485)
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
- <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern"
- value="[%d{dd/MM/yy hh:mm:ss:sss z}] %5p %c{2}: %m%n" />
- </layout>
- </appender>
-
- <appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
- <appender-ref ref="CONSOLE"/>
- <appender-ref ref="FILE"/>
- </appender>
-
- <appender name="FILE" class="org.apache.log4j.RollingFileAppender">
- <param name="File" value="log4j-output.log"/>
- <param name="MaxFileSize" value="1MB"/>
- <param name="MaxBackupIndex" value="100"/>
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern"
- value="[%d{dd/MM/yy hh:mm:ss:sss z}] %5p %c{2}: %m%n" />
- </layout>
- </appender>
-
- <root>
- <priority value="info"/>
- <appender-ref ref="CONSOLE"/>
- <!--<appender-ref ref="ASYNC"/>-->
- </root>
-</log4j:configuration>
\ No newline at end of file
Deleted: idm/trunk/idm-core/src/test/resources/organization-test-config.xml
===================================================================
--- idm/trunk/idm-core/src/test/resources/organization-test-config.xml 2009-05-09 10:22:47 UTC (rev 484)
+++ idm/trunk/idm-core/src/test/resources/organization-test-config.xml 2009-05-09 11:10:49 UTC (rev 485)
@@ -1,792 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_alpha"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_alpha identity-config.xsd">
- <realms>
- <realm>
- <id>realm://RedHat/DB</id>
- <repository-id-ref>RedHat Repository DB</repository-id-ref>
- <identity-type-mappings>
- <user-mapping>USER</user-mapping>
- </identity-type-mappings>
- </realm>
- <realm>
- <id>realm://portal/SamplePortal/DB</id>
- <repository-id-ref>Sample Portal Repository DB</repository-id-ref>
- <identity-type-mappings>
- <user-mapping>USER</user-mapping>
- </identity-type-mappings>
- </realm>
- <realm>
- <id>realm://RedHat/DB_LDAP</id>
- <repository-id-ref>RedHat Repository DB+LDAP</repository-id-ref>
- <identity-type-mappings>
- <user-mapping>USER</user-mapping>
- </identity-type-mappings>
- </realm>
- <realm>
- <id>realm://portal/SamplePortal/DB_LDAP</id>
- <repository-id-ref>Sample Portal Repository DB+LDAP</repository-id-ref>
- <identity-type-mappings>
- <user-mapping>USER</user-mapping>
- </identity-type-mappings>
- </realm>
- </realms>
- <repositories>
- <repository>
- <id>RedHat Repository DB</id>
- <class>org.jboss.identity.idm.impl.repository.WrapperIdentityStoreRepository</class>
- <external-config/>
- <default-identity-store-id>Hibernate Identity Store</default-identity-store-id>
- <default-attribute-store-id>Hibernate Identity Store</default-attribute-store-id>
- <options>
- <option>
- <name>allowNotDefinedAttributes</name>
- <value>true</value>
- </option>
- </options>
- </repository>
- <repository>
- <id>Sample Portal Repository DB</id>
- <class>org.jboss.identity.idm.impl.repository.WrapperIdentityStoreRepository</class>
- <external-config/>
- <default-identity-store-id>Hibernate Identity Store</default-identity-store-id>
- <default-attribute-store-id>Hibernate Identity Store</default-attribute-store-id>
- <options>
- <option>
- <name>allowNotDefinedAttributes</name>
- <value>true</value>
- </option>
- </options>
- </repository>
- <repository>
- <id>RedHat Repository DB+LDAP</id>
- <class>org.jboss.identity.idm.impl.repository.FallbackIdentityStoreRepository</class>
- <external-config/>
- <default-identity-store-id>Hibernate Identity Store</default-identity-store-id>
- <default-attribute-store-id>Hibernate Identity Store</default-attribute-store-id>
- <identity-store-mappings>
- <identity-store-mapping>
- <identity-store-id>Hibernate Identity Store</identity-store-id>
- <identity-object-types>
- <identity-object-type>DIVISION</identity-object-type>
- <identity-object-type>PROJECT</identity-object-type>
- <identity-object-type>PEOPLE</identity-object-type>
- </identity-object-types>
- <options/>
- </identity-store-mapping>
- <identity-store-mapping>
- <identity-store-id>LDAP Identity Store</identity-store-id>
- <identity-object-types>
- <identity-object-type>USER</identity-object-type>
- <identity-object-type>ORGANIZATION</identity-object-type>
- <identity-object-type>ORGANIZATION_UNIT</identity-object-type>
- <identity-object-type>DEPARTMENT</identity-object-type>
- </identity-object-types>
- <options>
- <option>
- <name>cache</name>
- <value>true</value>
- </option>
- <option>
- <name>cache.config-file</name>
- <value>src/test/resources/jboss-cache-config.xml</value>
- </option>
- </options>
- </identity-store-mapping>
- </identity-store-mappings>
- <options>
- <option>
- <name>allowNotDefinedAttributes</name>
- <value>true</value>
- </option>
- </options>
- </repository>
- <repository>
- <id>Sample Portal Repository DB+LDAP</id>
- <class>org.jboss.identity.idm.impl.repository.FallbackIdentityStoreRepository</class>
- <external-config/>
- <default-identity-store-id>Hibernate Identity Store</default-identity-store-id>
- <default-attribute-store-id>Hibernate Identity Store</default-attribute-store-id>
- <identity-store-mappings>
- <identity-store-mapping>
- <identity-store-id>Hibernate Identity Store</identity-store-id>
- <identity-object-types>
- <identity-object-type>SYSTEM</identity-object-type>
- <identity-object-type>ADMINISTRATION</identity-object-type>
- <identity-object-type>COMMUNITY</identity-object-type>
- <identity-object-type>DIVISION</identity-object-type>
- <identity-object-type>SECURITY</identity-object-type>
- <identity-object-type>PEOPLE</identity-object-type>
- </identity-object-types>
- <options/>
- </identity-store-mapping>
- <identity-store-mapping>
- <identity-store-id>LDAP Identity Store</identity-store-id>
- <identity-object-types>
- <identity-object-type>USER</identity-object-type>
- <identity-object-type>DEPARTMENT</identity-object-type>
- <identity-object-type>ORGANIZATION</identity-object-type>
- <identity-object-type>ORGANIZATION_UNIT</identity-object-type>
- <identity-object-type>OFFICE</identity-object-type>
- </identity-object-types>
- <options>
- <option>
- <name>cache</name>
- <value>true</value>
- </option>
- <option>
- <name>cache.config-file</name>
- <value>src/test/resources/jboss-cache-config.xml</value>
- </option>
- </options>
- </identity-store-mapping>
- </identity-store-mappings>
- <options>
- <option>
- <name>allowNotDefinedAttributes</name>
- <value>true</value>
- </option>
- </options>
- </repository>
- </repositories>
- <stores>
- <attribute-stores/>
- <identity-stores>
- <identity-store>
- <id>Hibernate Identity Store</id>
- <class>org.jboss.identity.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>
- <!--<relationship>-->
- <!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
- <!--<identity-object-type-ref>ORGANIZATION</identity-object-type-ref>-->
- <!--</relationship>-->
- <!--<relationship>-->
- <!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
- <!--<identity-object-type-ref>COMMUNITY</identity-object-type-ref>-->
- <!--</relationship>-->
- <!--<relationship>-->
- <!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
- <!--<identity-object-type-ref>OFFICE</identity-object-type-ref>-->
- <!--</relationship>-->
- <!--<relationship>-->
- <!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
- <!--<identity-object-type-ref>SECURITY</identity-object-type-ref>-->
- <!--</relationship>-->
- <!--<relationship>-->
- <!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
- <!--<identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>-->
- <!--</relationship>-->
- <!--<relationship>-->
- <!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
- <!--<identity-object-type-ref>PROJECT</identity-object-type-ref>-->
- <!--</relationship>-->
- <!--<relationship>-->
- <!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
- <!--<identity-object-type-ref>PEOPLE</identity-object-type-ref>-->
- <!--</relationship>-->
- </relationships>
- <credentials>
- <credential-type>PASSWORD</credential-type>
- </credentials>
- <attributes>
- <attribute>
- <name>picture</name>
- <mapping>user.picture</mapping>
- <type>binary</type>
- <isRequired>false</isRequired>
- <isMultivalued>false</isMultivalued>
- <isReadOnly>false</isReadOnly>
- </attribute>
- </attributes>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>ORGANIZATION</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>ORGANIZATION</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>DIVISION</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>ORGANIZATION_UNIT</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>DIVISION</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>DEPARTMENT</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>OFFICE</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>PEOPLE</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>PROJECT</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>DIVISION</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>DEPARTMENT</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>DEPARTMENT</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>DEPARTMENT</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>PROJECT</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>PEOPLE</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>ADMINISTRATION</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>COMMUNITY</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>OFFICE</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>SECURITY</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>SYSTEM</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>SECURITY</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>COMMUNITY</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>ORGANIZATION</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options/>
- </identity-object-type>
- </supported-identity-object-types>
- <options>
- <option>
- <name>hibernateConfiguration</name>
- <value>hibernate-jboss-identity.cfg.xml</value>
- </option>
- <!--<option>-->
- <!--<name>hibernateSessionFactoryJNDIName</name>-->
- <!--<value>java:/jbossidentity/HibernateStoreSessionFactory</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>
- <option>
- <name>allowNotDefinedAttributes</name>
- <value>true</value>
- </option>
- </options>
- </identity-store>
- <identity-store>
- <id>LDAP Identity Store</id>
- <class>org.jboss.identity.idm.impl.store.ldap.LDAPIdentityStoreImpl</class>
- <external-config/>
- <supported-relationship-types>
- <relationship-type>JBOSS_IDENTITY_MEMBERSHIP</relationship-type>
- </supported-relationship-types>
- <supported-identity-object-types>
- <identity-object-type>
- <name>USER</name>
- <relationships/>
- <credentials>
- <credential-type>PASSWORD</credential-type>
- </credentials>
- <attributes>
- <attribute>
- <name>phone</name>
- <mapping>telephoneNumber</mapping>
- <type>text</type>
- <isRequired>false</isRequired>
- <isMultivalued>false</isMultivalued>
- <isReadOnly>false</isReadOnly>
- </attribute>
- <attribute>
- <name>description</name>
- <mapping>description</mapping>
- <type>text</type>
- <isRequired>false</isRequired>
- <isMultivalued>false</isMultivalued>
- <isReadOnly>false</isReadOnly>
- </attribute>
- <attribute>
- <name>carLicense</name>
- <mapping>carLicense</mapping>
- <type>text</type>
- <isRequired>false</isRequired>
- <isMultivalued>false</isMultivalued>
- <isReadOnly>false</isReadOnly>
- </attribute>
- </attributes>
- <options>
- <option>
- <name>idAttributeName</name>
- <value>uid</value>
- </option>
- <option>
- <name>passwordAttributeName</name>
- <value>userPassword</value>
- </option>
- <option>
- <name>ctxDNs</name>
- <value>ou=People,o=test,dc=portal,dc=example,dc=com</value>
- </option>
- <option>
- <name>allowCreateEntry</name>
- <value>true</value>
- </option>
- <option>
- <name>createEntryAttributeValues</name>
- <value>objectClass=top</value>
- <value>objectClass=inetOrgPerson</value>
- <value>sn= </value>
- <value>cn= </value>
- </option>
- </options>
- </identity-object-type>
- <identity-object-type>
- <name>ORGANIZATION</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>ORGANIZATION</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>DEPARTMENT</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>OFFICE</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options>
- <option>
- <name>idAttributeName</name>
- <value>cn</value>
- </option>
- <option>
- <name>ctxDNs</name>
- <value>ou=Organizations,o=test,dc=portal,dc=example,dc=com</value>
- </option>
- <!--<option>-->
- <!--<name>entrySearchFilter</name>-->
- <!--<value></value>-->
- <!--</option>-->
- <option>
- <name>allowCreateEntry</name>
- <value>true</value>
- </option>
- <option>
- <name>membershipAttributeName</name>
- <value>member</value>
- </option>
- <option>
- <name>isMembershipAttributeDN</name>
- <value>true</value>
- </option>
- <option>
- <name>allowEmptyMemberships</name>
- <value>true</value>
- </option>
- <option>
- <name>createEntryAttributeValues</name>
- <value>objectClass=top</value>
- <value>objectClass=groupOfNames</value>
- </option>
- </options>
- </identity-object-type>
- <identity-object-type>
- <name>ORGANIZATION_UNIT</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>DEPARTMENT</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>OFFICE</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options>
- <option>
- <name>idAttributeName</name>
- <value>cn</value>
- </option>
- <option>
- <name>ctxDNs</name>
- <value>ou=OrganizationUnits,o=test,dc=portal,dc=example,dc=com</value>
- </option>
- <!--<option>-->
- <!--<name>entrySearchFilter</name>-->
- <!--<value></value>-->
- <!--</option>-->
- <option>
- <name>allowCreateEntry</name>
- <value>true</value>
- </option>
- <option>
- <name>membershipAttributeName</name>
- <value>member</value>
- </option>
- <option>
- <name>isMembershipAttributeDN</name>
- <value>true</value>
- </option>
- <option>
- <name>allowEmptyMemberships</name>
- <value>true</value>
- </option>
- <option>
- <name>createEntryAttributeValues</name>
- <value>objectClass=top</value>
- <value>objectClass=groupOfNames</value>
- </option>
- </options>
- </identity-object-type>
- <identity-object-type>
- <name>DEPARTMENT</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>DEPARTMENT</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options>
- <option>
- <name>idAttributeName</name>
- <value>cn</value>
- </option>
- <option>
- <name>ctxDNs</name>
- <value>ou=Departments,o=test,dc=portal,dc=example,dc=com</value>
- </option>
- <!--<option>-->
- <!--<name>entrySearchFilter</name>-->
- <!--<value></value>-->
- <!--</option>-->
- <option>
- <name>allowCreateEntry</name>
- <value>true</value>
- </option>
- <option>
- <name>membershipAttributeName</name>
- <value>member</value>
- </option>
- <option>
- <name>isMembershipAttributeDN</name>
- <value>true</value>
- </option>
- <option>
- <name>allowEmptyMemberships</name>
- <value>true</value>
- </option>
- <option>
- <name>createEntryAttributeValues</name>
- <value>objectClass=top</value>
- <value>objectClass=groupOfNames</value>
- </option>
- </options>
- </identity-object-type>
- <identity-object-type>
- <name>OFFICE</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options>
- <option>
- <name>idAttributeName</name>
- <value>cn</value>
- </option>
- <option>
- <name>ctxDNs</name>
- <value>ou=Offices,o=test,dc=portal,dc=example,dc=com</value>
- </option>
- <!--<option>-->
- <!--<name>entrySearchFilter</name>-->
- <!--<value></value>-->
- <!--</option>-->
- <option>
- <name>allowCreateEntry</name>
- <value>true</value>
- </option>
- <option>
- <name>membershipAttributeName</name>
- <value>member</value>
- </option>
- <option>
- <name>isMembershipAttributeDN</name>
- <value>true</value>
- </option>
- <option>
- <name>allowEmptyMemberships</name>
- <value>true</value>
- </option>
- <option>
- <name>createEntryAttributeValues</name>
- <value>objectClass=top</value>
- <value>objectClass=groupOfNames</value>
- </option>
- </options>
- </identity-object-type>
- </supported-identity-object-types>
- <options>
- <option>
- <name>providerURL</name>
- <value>ldap://localhost:10389</value>
- </option>
- <option>
- <name>adminDN</name>
- <value>cn=Directory Manager</value>
- </option>
- <option>
- <name>adminPassword</name>
- <value>password</value>
- </option>
- <option>
- <name>searchTimeLimit</name>
- <value>10000</value>
- </option>
- </options>
- </identity-store>
- </identity-stores>
- </stores>
-</jboss-identity>
\ No newline at end of file
Deleted: idm/trunk/idm-core/src/test/resources/organization-test-jboss-unit-config.xml
===================================================================
--- idm/trunk/idm-core/src/test/resources/organization-test-jboss-unit-config.xml 2009-05-09 10:22:47 UTC (rev 484)
+++ idm/trunk/idm-core/src/test/resources/organization-test-jboss-unit-config.xml 2009-05-09 11:10:49 UTC (rev 485)
@@ -1,792 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_alpha"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_alpha identity-config.xsd">
- <realms>
- <realm>
- <id>realm://RedHat/DB</id>
- <repository-id-ref>RedHat Repository DB</repository-id-ref>
- <identity-type-mappings>
- <user-mapping>USER</user-mapping>
- </identity-type-mappings>
- </realm>
- <realm>
- <id>realm://portal/SamplePortal/DB</id>
- <repository-id-ref>Sample Portal Repository DB</repository-id-ref>
- <identity-type-mappings>
- <user-mapping>USER</user-mapping>
- </identity-type-mappings>
- </realm>
- <realm>
- <id>realm://RedHat/DB_LDAP</id>
- <repository-id-ref>RedHat Repository DB+LDAP</repository-id-ref>
- <identity-type-mappings>
- <user-mapping>USER</user-mapping>
- </identity-type-mappings>
- </realm>
- <realm>
- <id>realm://portal/SamplePortal/DB_LDAP</id>
- <repository-id-ref>Sample Portal Repository DB+LDAP</repository-id-ref>
- <identity-type-mappings>
- <user-mapping>USER</user-mapping>
- </identity-type-mappings>
- </realm>
- </realms>
- <repositories>
- <repository>
- <id>RedHat Repository DB</id>
- <class>org.jboss.identity.idm.impl.repository.WrapperIdentityStoreRepository</class>
- <external-config/>
- <default-identity-store-id>Hibernate Identity Store</default-identity-store-id>
- <default-attribute-store-id>Hibernate Identity Store</default-attribute-store-id>
- <options>
- <option>
- <name>allowNotDefinedAttributes</name>
- <value>true</value>
- </option>
- </options>
- </repository>
- <repository>
- <id>Sample Portal Repository DB</id>
- <class>org.jboss.identity.idm.impl.repository.WrapperIdentityStoreRepository</class>
- <external-config/>
- <default-identity-store-id>Hibernate Identity Store</default-identity-store-id>
- <default-attribute-store-id>Hibernate Identity Store</default-attribute-store-id>
- <options>
- <option>
- <name>allowNotDefinedAttributes</name>
- <value>true</value>
- </option>
- </options>
- </repository>
- <repository>
- <id>RedHat Repository DB+LDAP</id>
- <class>org.jboss.identity.idm.impl.repository.FallbackIdentityStoreRepository</class>
- <external-config/>
- <default-identity-store-id>Hibernate Identity Store</default-identity-store-id>
- <default-attribute-store-id>Hibernate Identity Store</default-attribute-store-id>
- <identity-store-mappings>
- <identity-store-mapping>
- <identity-store-id>Hibernate Identity Store</identity-store-id>
- <identity-object-types>
- <identity-object-type>DIVISION</identity-object-type>
- <identity-object-type>PROJECT</identity-object-type>
- <identity-object-type>PEOPLE</identity-object-type>
- </identity-object-types>
- <options/>
- </identity-store-mapping>
- <identity-store-mapping>
- <identity-store-id>LDAP Identity Store</identity-store-id>
- <identity-object-types>
- <identity-object-type>USER</identity-object-type>
- <identity-object-type>ORGANIZATION</identity-object-type>
- <identity-object-type>ORGANIZATION_UNIT</identity-object-type>
- <identity-object-type>DEPARTMENT</identity-object-type>
- </identity-object-types>
- <options>
- <option>
- <name>cache</name>
- <value>true</value>
- </option>
- <option>
- <name>cache.config-file</name>
- <value>jboss-cache-config.xml</value>
- </option>
- </options>
- </identity-store-mapping>
- </identity-store-mappings>
- <options>
- <option>
- <name>allowNotDefinedAttributes</name>
- <value>true</value>
- </option>
- </options>
- </repository>
- <repository>
- <id>Sample Portal Repository DB+LDAP</id>
- <class>org.jboss.identity.idm.impl.repository.FallbackIdentityStoreRepository</class>
- <external-config/>
- <default-identity-store-id>Hibernate Identity Store</default-identity-store-id>
- <default-attribute-store-id>Hibernate Identity Store</default-attribute-store-id>
- <identity-store-mappings>
- <identity-store-mapping>
- <identity-store-id>Hibernate Identity Store</identity-store-id>
- <identity-object-types>
- <identity-object-type>SYSTEM</identity-object-type>
- <identity-object-type>ADMINISTRATION</identity-object-type>
- <identity-object-type>COMMUNITY</identity-object-type>
- <identity-object-type>DIVISION</identity-object-type>
- <identity-object-type>SECURITY</identity-object-type>
- <identity-object-type>PEOPLE</identity-object-type>
- </identity-object-types>
- <options/>
- </identity-store-mapping>
- <identity-store-mapping>
- <identity-store-id>LDAP Identity Store</identity-store-id>
- <identity-object-types>
- <identity-object-type>USER</identity-object-type>
- <identity-object-type>DEPARTMENT</identity-object-type>
- <identity-object-type>ORGANIZATION</identity-object-type>
- <identity-object-type>ORGANIZATION_UNIT</identity-object-type>
- <identity-object-type>OFFICE</identity-object-type>
- </identity-object-types>
- <options>
- <option>
- <name>cache</name>
- <value>true</value>
- </option>
- <option>
- <name>cache.config-file</name>
- <value>jboss-cache-config.xml</value>
- </option>
- </options>
- </identity-store-mapping>
- </identity-store-mappings>
- <options>
- <option>
- <name>allowNotDefinedAttributes</name>
- <value>true</value>
- </option>
- </options>
- </repository>
- </repositories>
- <stores>
- <attribute-stores/>
- <identity-stores>
- <identity-store>
- <id>Hibernate Identity Store</id>
- <class>org.jboss.identity.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>
- <!--<relationship>-->
- <!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
- <!--<identity-object-type-ref>ORGANIZATION</identity-object-type-ref>-->
- <!--</relationship>-->
- <!--<relationship>-->
- <!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
- <!--<identity-object-type-ref>COMMUNITY</identity-object-type-ref>-->
- <!--</relationship>-->
- <!--<relationship>-->
- <!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
- <!--<identity-object-type-ref>OFFICE</identity-object-type-ref>-->
- <!--</relationship>-->
- <!--<relationship>-->
- <!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
- <!--<identity-object-type-ref>SECURITY</identity-object-type-ref>-->
- <!--</relationship>-->
- <!--<relationship>-->
- <!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
- <!--<identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>-->
- <!--</relationship>-->
- <!--<relationship>-->
- <!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
- <!--<identity-object-type-ref>PROJECT</identity-object-type-ref>-->
- <!--</relationship>-->
- <!--<relationship>-->
- <!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
- <!--<identity-object-type-ref>PEOPLE</identity-object-type-ref>-->
- <!--</relationship>-->
- </relationships>
- <credentials>
- <credential-type>PASSWORD</credential-type>
- </credentials>
- <attributes>
- <attribute>
- <name>picture</name>
- <mapping>user.picture</mapping>
- <type>binary</type>
- <isRequired>false</isRequired>
- <isMultivalued>false</isMultivalued>
- <isReadOnly>false</isReadOnly>
- </attribute>
- </attributes>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>ORGANIZATION</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>ORGANIZATION</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>DIVISION</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>ORGANIZATION_UNIT</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>DIVISION</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>DEPARTMENT</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>OFFICE</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>PEOPLE</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>PROJECT</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>DIVISION</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>DEPARTMENT</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>DEPARTMENT</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>DEPARTMENT</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>PROJECT</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>PEOPLE</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>ADMINISTRATION</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>COMMUNITY</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>OFFICE</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>SECURITY</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>SYSTEM</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>SECURITY</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>COMMUNITY</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>ORGANIZATION</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options/>
- </identity-object-type>
- </supported-identity-object-types>
- <options>
- <!--<option>-->
- <!--<name>hibernateConfiguration</name>-->
- <!--<value>hibernate-jboss-identity.cfg.xml</value>-->
- <!--</option>-->
- <option>
- <name>hibernateSessionFactoryJNDIName</name>
- <value>java:/jbossidentity/HibernateStoreSessionFactory</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>
- <option>
- <name>allowNotDefinedAttributes</name>
- <value>true</value>
- </option>
- </options>
- </identity-store>
- <identity-store>
- <id>LDAP Identity Store</id>
- <class>org.jboss.identity.idm.impl.store.ldap.LDAPIdentityStoreImpl</class>
- <external-config/>
- <supported-relationship-types>
- <relationship-type>JBOSS_IDENTITY_MEMBERSHIP</relationship-type>
- </supported-relationship-types>
- <supported-identity-object-types>
- <identity-object-type>
- <name>USER</name>
- <relationships/>
- <credentials>
- <credential-type>PASSWORD</credential-type>
- </credentials>
- <attributes>
- <attribute>
- <name>phone</name>
- <mapping>telephoneNumber</mapping>
- <type>text</type>
- <isRequired>false</isRequired>
- <isMultivalued>false</isMultivalued>
- <isReadOnly>false</isReadOnly>
- </attribute>
- <attribute>
- <name>description</name>
- <mapping>description</mapping>
- <type>text</type>
- <isRequired>false</isRequired>
- <isMultivalued>false</isMultivalued>
- <isReadOnly>false</isReadOnly>
- </attribute>
- <attribute>
- <name>carLicense</name>
- <mapping>carLicense</mapping>
- <type>text</type>
- <isRequired>false</isRequired>
- <isMultivalued>false</isMultivalued>
- <isReadOnly>false</isReadOnly>
- </attribute>
- </attributes>
- <options>
- <option>
- <name>idAttributeName</name>
- <value>uid</value>
- </option>
- <option>
- <name>passwordAttributeName</name>
- <value>userPassword</value>
- </option>
- <option>
- <name>ctxDNs</name>
- <value>ou=People,o=test,dc=portal,dc=example,dc=com</value>
- </option>
- <option>
- <name>allowCreateEntry</name>
- <value>true</value>
- </option>
- <option>
- <name>createEntryAttributeValues</name>
- <value>objectClass=top</value>
- <value>objectClass=inetOrgPerson</value>
- <value>sn= </value>
- <value>cn= </value>
- </option>
- </options>
- </identity-object-type>
- <identity-object-type>
- <name>ORGANIZATION</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>ORGANIZATION</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>DEPARTMENT</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>OFFICE</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options>
- <option>
- <name>idAttributeName</name>
- <value>cn</value>
- </option>
- <option>
- <name>ctxDNs</name>
- <value>ou=Organizations,o=test,dc=portal,dc=example,dc=com</value>
- </option>
- <!--<option>-->
- <!--<name>entrySearchFilter</name>-->
- <!--<value></value>-->
- <!--</option>-->
- <option>
- <name>allowCreateEntry</name>
- <value>true</value>
- </option>
- <option>
- <name>membershipAttributeName</name>
- <value>member</value>
- </option>
- <option>
- <name>isMembershipAttributeDN</name>
- <value>true</value>
- </option>
- <option>
- <name>allowEmptyMemberships</name>
- <value>true</value>
- </option>
- <option>
- <name>createEntryAttributeValues</name>
- <value>objectClass=top</value>
- <value>objectClass=groupOfNames</value>
- </option>
- </options>
- </identity-object-type>
- <identity-object-type>
- <name>ORGANIZATION_UNIT</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>DEPARTMENT</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>OFFICE</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options>
- <option>
- <name>idAttributeName</name>
- <value>cn</value>
- </option>
- <option>
- <name>ctxDNs</name>
- <value>ou=OrganizationUnits,o=test,dc=portal,dc=example,dc=com</value>
- </option>
- <!--<option>-->
- <!--<name>entrySearchFilter</name>-->
- <!--<value></value>-->
- <!--</option>-->
- <option>
- <name>allowCreateEntry</name>
- <value>true</value>
- </option>
- <option>
- <name>membershipAttributeName</name>
- <value>member</value>
- </option>
- <option>
- <name>isMembershipAttributeDN</name>
- <value>true</value>
- </option>
- <option>
- <name>allowEmptyMemberships</name>
- <value>true</value>
- </option>
- <option>
- <name>createEntryAttributeValues</name>
- <value>objectClass=top</value>
- <value>objectClass=groupOfNames</value>
- </option>
- </options>
- </identity-object-type>
- <identity-object-type>
- <name>DEPARTMENT</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>DEPARTMENT</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options>
- <option>
- <name>idAttributeName</name>
- <value>cn</value>
- </option>
- <option>
- <name>ctxDNs</name>
- <value>ou=Departments,o=test,dc=portal,dc=example,dc=com</value>
- </option>
- <!--<option>-->
- <!--<name>entrySearchFilter</name>-->
- <!--<value></value>-->
- <!--</option>-->
- <option>
- <name>allowCreateEntry</name>
- <value>true</value>
- </option>
- <option>
- <name>membershipAttributeName</name>
- <value>member</value>
- </option>
- <option>
- <name>isMembershipAttributeDN</name>
- <value>true</value>
- </option>
- <option>
- <name>allowEmptyMemberships</name>
- <value>true</value>
- </option>
- <option>
- <name>createEntryAttributeValues</name>
- <value>objectClass=top</value>
- <value>objectClass=groupOfNames</value>
- </option>
- </options>
- </identity-object-type>
- <identity-object-type>
- <name>OFFICE</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options>
- <option>
- <name>idAttributeName</name>
- <value>cn</value>
- </option>
- <option>
- <name>ctxDNs</name>
- <value>ou=Offices,o=test,dc=portal,dc=example,dc=com</value>
- </option>
- <!--<option>-->
- <!--<name>entrySearchFilter</name>-->
- <!--<value></value>-->
- <!--</option>-->
- <option>
- <name>allowCreateEntry</name>
- <value>true</value>
- </option>
- <option>
- <name>membershipAttributeName</name>
- <value>member</value>
- </option>
- <option>
- <name>isMembershipAttributeDN</name>
- <value>true</value>
- </option>
- <option>
- <name>allowEmptyMemberships</name>
- <value>true</value>
- </option>
- <option>
- <name>createEntryAttributeValues</name>
- <value>objectClass=top</value>
- <value>objectClass=groupOfNames</value>
- </option>
- </options>
- </identity-object-type>
- </supported-identity-object-types>
- <options>
- <option>
- <name>providerURL</name>
- <value>ldap://localhost:10389</value>
- </option>
- <option>
- <name>adminDN</name>
- <value>cn=Directory Manager</value>
- </option>
- <option>
- <name>adminPassword</name>
- <value>password</value>
- </option>
- <option>
- <name>searchTimeLimit</name>
- <value>10000</value>
- </option>
- </options>
- </identity-store>
- </identity-stores>
- </stores>
-</jboss-identity>
\ No newline at end of file
Deleted: idm/trunk/idm-core/src/test/resources/store-test-config.xml
===================================================================
--- idm/trunk/idm-core/src/test/resources/store-test-config.xml 2009-05-09 10:22:47 UTC (rev 484)
+++ idm/trunk/idm-core/src/test/resources/store-test-config.xml 2009-05-09 11:10:49 UTC (rev 485)
@@ -1,373 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_alpha"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_alpha identity-config.xsd">
- <realms>
- <realm>
- <id>realm://Dymmy</id>
- <repository-id-ref>X</repository-id-ref>
- <identity-type-mappings>
- <user-mapping>USER</user-mapping>
- </identity-type-mappings>
- </realm>
- </realms>
- <repositories>
- <repository>
- <id>X</id>
- <class>X</class>
- <external-config/>
- <default-identity-store-id>HibernateTestStore</default-identity-store-id>
- <default-attribute-store-id>HibernateTestStore</default-attribute-store-id>
- <!--<identity-store-mappings>-->
- <!--<identity-store-mapping>-->
- <!--<identity-store-id>HibernateTestStore</identity-store-id>-->
- <!--<identity-object-types/>-->
- <!--<options/>-->
- <!--</identity-store-mapping>-->
- <!--</identity-store-mappings>-->
- </repository>
- </repositories>
- <stores>
- <attribute-stores/>
- <identity-stores>
- <identity-store>
- <id>HibernateTestStore</id>
- <class>org.jboss.identity.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>
- <credential-type>BINARY</credential-type>
- </credentials>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>GROUP</name>
- <relationships/>
- <credentials/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>ORGANIZATION</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>ROLE</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>GROUP</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>ORGANIZATION</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>ROLE</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options/>
- </identity-object-type>
- </supported-identity-object-types>
- <options>
- <!--<option>-->
- <!--<name>hibernateConfiguration</name>-->
- <!--<value>hibernate-jboss-identity.cfg.xml</value>-->
- <!--</option>-->
- <option>
- <name>hibernateSessionFactoryJNDIName</name>
- <value>java:/jbossidentity/HibernateStoreSessionFactory</value>
- </option>
- <option>
- <name>populateRelationshipTypes</name>
- <value>true</value>
- </option>
- <option>
- <name>populateIdentityObjectTypes</name>
- <value>true</value>
- </option>
- <option>
- <name>isRealmAware</name>
- <value>false</value>
- </option>
- <option>
- <name>allowNotDefinedAttributes</name>
- <value>true</value>
- </option>
- </options>
- </identity-store>
- <identity-store>
- <id>LDAPTestStore</id>
- <class>org.jboss.identity.idm.impl.store.ldap.LDAPIdentityStoreImpl</class>
- <external-config/>
- <supported-relationship-types>
- <relationship-type>JBOSS_IDENTITY_MEMBERSHIP</relationship-type>
- </supported-relationship-types>
- <supported-identity-object-types>
- <identity-object-type>
- <name>USER</name>
- <relationships/>
- <credentials>
- <credential-type>PASSWORD</credential-type>
- </credentials>
- <attributes>
- <attribute>
- <name>phone</name>
- <mapping>telephoneNumber</mapping>
- <type>text</type>
- <isRequired/>
- <isMultivalued>true</isMultivalued>
- <isReadOnly/>
- </attribute>
- <attribute>
- <name>description</name>
- <mapping>description</mapping>
- <type>text</type>
- <isRequired/>
- <isMultivalued>true</isMultivalued>
- <isReadOnly/>
- </attribute>
- <attribute>
- <name>carLicense</name>
- <mapping>carLicense</mapping>
- <type>text</type>
- <isRequired/>
- <isMultivalued>true</isMultivalued>
- <isReadOnly/>
- </attribute>
- </attributes>
- <options>
- <option>
- <name>idAttributeName</name>
- <value>uid</value>
- </option>
- <option>
- <name>passwordAttributeName</name>
- <value>userPassword</value>
- </option>
- <option>
- <name>ctxDNs</name>
- <value>ou=People,o=test,dc=portal,dc=example,dc=com</value>
- </option>
- <option>
- <name>allowCreateEntry</name>
- <value>true</value>
- </option>
- <option>
- <name>createEntryAttributeValues</name>
- <value>objectClass=top</value>
- <value>objectClass=inetOrgPerson</value>
- <value>sn= </value>
- <value>cn= </value>
- </option>
- </options>
- </identity-object-type>
- <identity-object-type>
- <name>GROUP</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>ROLE</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>GROUP</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>ORGANIZATION</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options>
- <option>
- <name>idAttributeName</name>
- <value>cn</value>
- </option>
- <option>
- <name>ctxDNs</name>
- <value>ou=Groups,o=test,dc=portal,dc=example,dc=com</value>
- </option>
- <!--<option>-->
- <!--<name>entrySearchFilter</name>-->
- <!--<value></value>-->
- <!--</option>-->
- <option>
- <name>allowCreateEntry</name>
- <value>true</value>
- </option>
- <option>
- <name>membershipAttributeName</name>
- <value>member</value>
- </option>
- <option>
- <name>isMembershipAttributeDN</name>
- <value>true</value>
- </option>
- <option>
- <name>allowEmptyMemberships</name>
- <value>true</value>
- </option>
- <option>
- <name>createEntryAttributeValues</name>
- <value>objectClass=top</value>
- <value>objectClass=groupOfNames</value>
- </option>
- </options>
- </identity-object-type>
- <identity-object-type>
- <name>ORGANIZATION</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>ROLE</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>GROUP</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>ORGANIZATION</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options>
- <option>
- <name>idAttributeName</name>
- <value>cn</value>
- </option>
- <option>
- <name>ctxDNs</name>
- <value>ou=Organizations,o=test,dc=portal,dc=example,dc=com</value>
- </option>
- <!--<option>-->
- <!--<name>entrySearchFilter</name>-->
- <!--<value></value>-->
- <!--</option>-->
- <option>
- <name>allowCreateEntry</name>
- <value>true</value>
- </option>
- <option>
- <name>membershipAttributeName</name>
- <value>member</value>
- </option>
- <option>
- <name>isMembershipAttributeDN</name>
- <value>true</value>
- </option>
- <option>
- <name>allowEmptyMemberships</name>
- <value>true</value>
- </option>
- <option>
- <name>createEntryAttributeValues</name>
- <value>objectClass=top</value>
- <value>objectClass=groupOfNames</value>
- </option>
- </options>
- </identity-object-type>
- <identity-object-type>
- <name>ROLE</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options>
- <option>
- <name>idAttributeName</name>
- <value>cn</value>
- </option>
- <option>
- <name>ctxDNs</name>
- <value>ou=Roles,o=test,dc=portal,dc=example,dc=com</value>
- </option>
- <!--<option>-->
- <!--<name>entrySearchFilter</name>-->
- <!--<value></value>-->
- <!--</option>-->
- <option>
- <name>allowCreateEntry</name>
- <value>true</value>
- </option>
- <option>
- <name>membershipAttributeName</name>
- <value>member</value>
- </option>
- <option>
- <name>isMembershipAttributeDN</name>
- <value>true</value>
- </option>
- <option>
- <name>allowEmptyMemberships</name>
- <value>true</value>
- </option>
- <option>
- <name>createEntryAttributeValues</name>
- <value>objectClass=top</value>
- <value>objectClass=groupOfNames</value>
- </option>
- </options>
- </identity-object-type>
- </supported-identity-object-types>
- <options>
- <option>
- <name>providerURL</name>
- <value>ldap://localhost:10389</value>
- </option>
- <option>
- <name>adminDN</name>
- <value>cn=Directory Manager</value>
- </option>
- <option>
- <name>adminPassword</name>
- <value>password</value>
- </option>
- <option>
- <name>searchTimeLimit</name>
- <value>10000</value>
- </option>
- </options>
- </identity-store>
- </identity-stores>
- </stores>
-</jboss-identity>
\ No newline at end of file
Added: idm/trunk/idm-core/src/test/resources/store-test-config.xml
===================================================================
--- idm/trunk/idm-core/src/test/resources/store-test-config.xml (rev 0)
+++ idm/trunk/idm-core/src/test/resources/store-test-config.xml 2009-05-09 11:10:49 UTC (rev 485)
@@ -0,0 +1,373 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_alpha"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_alpha identity-config.xsd">
+ <realms>
+ <realm>
+ <id>realm://Dymmy</id>
+ <repository-id-ref>X</repository-id-ref>
+ <identity-type-mappings>
+ <user-mapping>USER</user-mapping>
+ </identity-type-mappings>
+ </realm>
+ </realms>
+ <repositories>
+ <repository>
+ <id>X</id>
+ <class>X</class>
+ <external-config/>
+ <default-identity-store-id>HibernateTestStore</default-identity-store-id>
+ <default-attribute-store-id>HibernateTestStore</default-attribute-store-id>
+ <!--<identity-store-mappings>-->
+ <!--<identity-store-mapping>-->
+ <!--<identity-store-id>HibernateTestStore</identity-store-id>-->
+ <!--<identity-object-types/>-->
+ <!--<options/>-->
+ <!--</identity-store-mapping>-->
+ <!--</identity-store-mappings>-->
+ </repository>
+ </repositories>
+ <stores>
+ <attribute-stores/>
+ <identity-stores>
+ <identity-store>
+ <id>HibernateTestStore</id>
+ <class>org.jboss.identity.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>
+ <credential-type>BINARY</credential-type>
+ </credentials>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>GROUP</name>
+ <relationships/>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ORGANIZATION</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ROLE</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>GROUP</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ROLE</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ </supported-identity-object-types>
+ <options>
+ <!--<option>-->
+ <!--<name>hibernateConfiguration</name>-->
+ <!--<value>hibernate-jboss-identity.cfg.xml</value>-->
+ <!--</option>-->
+ <option>
+ <name>hibernateSessionFactoryJNDIName</name>
+ <value>java:/jbossidentity/HibernateStoreSessionFactory</value>
+ </option>
+ <option>
+ <name>populateRelationshipTypes</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>populateIdentityObjectTypes</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>isRealmAware</name>
+ <value>false</value>
+ </option>
+ <option>
+ <name>allowNotDefinedAttributes</name>
+ <value>true</value>
+ </option>
+ </options>
+ </identity-store>
+ <identity-store>
+ <id>LDAPTestStore</id>
+ <class>org.jboss.identity.idm.impl.store.ldap.LDAPIdentityStoreImpl</class>
+ <external-config/>
+ <supported-relationship-types>
+ <relationship-type>JBOSS_IDENTITY_MEMBERSHIP</relationship-type>
+ </supported-relationship-types>
+ <supported-identity-object-types>
+ <identity-object-type>
+ <name>USER</name>
+ <relationships/>
+ <credentials>
+ <credential-type>PASSWORD</credential-type>
+ </credentials>
+ <attributes>
+ <attribute>
+ <name>phone</name>
+ <mapping>telephoneNumber</mapping>
+ <type>text</type>
+ <isRequired/>
+ <isMultivalued>true</isMultivalued>
+ <isReadOnly/>
+ </attribute>
+ <attribute>
+ <name>description</name>
+ <mapping>description</mapping>
+ <type>text</type>
+ <isRequired/>
+ <isMultivalued>true</isMultivalued>
+ <isReadOnly/>
+ </attribute>
+ <attribute>
+ <name>carLicense</name>
+ <mapping>carLicense</mapping>
+ <type>text</type>
+ <isRequired/>
+ <isMultivalued>true</isMultivalued>
+ <isReadOnly/>
+ </attribute>
+ </attributes>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>uid</value>
+ </option>
+ <option>
+ <name>passwordAttributeName</name>
+ <value>userPassword</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=People,o=test,dc=portal,dc=example,dc=com</value>
+ </option>
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=inetOrgPerson</value>
+ <value>sn= </value>
+ <value>cn= </value>
+ </option>
+ </options>
+ </identity-object-type>
+ <identity-object-type>
+ <name>GROUP</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ROLE</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>GROUP</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=Groups,o=test,dc=portal,dc=example,dc=com</value>
+ </option>
+ <!--<option>-->
+ <!--<name>entrySearchFilter</name>-->
+ <!--<value></value>-->
+ <!--</option>-->
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>membershipAttributeName</name>
+ <value>member</value>
+ </option>
+ <option>
+ <name>isMembershipAttributeDN</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>allowEmptyMemberships</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=groupOfNames</value>
+ </option>
+ </options>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ORGANIZATION</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ROLE</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>GROUP</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=Organizations,o=test,dc=portal,dc=example,dc=com</value>
+ </option>
+ <!--<option>-->
+ <!--<name>entrySearchFilter</name>-->
+ <!--<value></value>-->
+ <!--</option>-->
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>membershipAttributeName</name>
+ <value>member</value>
+ </option>
+ <option>
+ <name>isMembershipAttributeDN</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>allowEmptyMemberships</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=groupOfNames</value>
+ </option>
+ </options>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ROLE</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=Roles,o=test,dc=portal,dc=example,dc=com</value>
+ </option>
+ <!--<option>-->
+ <!--<name>entrySearchFilter</name>-->
+ <!--<value></value>-->
+ <!--</option>-->
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>membershipAttributeName</name>
+ <value>member</value>
+ </option>
+ <option>
+ <name>isMembershipAttributeDN</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>allowEmptyMemberships</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=groupOfNames</value>
+ </option>
+ </options>
+ </identity-object-type>
+ </supported-identity-object-types>
+ <options>
+ <option>
+ <name>providerURL</name>
+ <value>ldap://localhost:10389</value>
+ </option>
+ <option>
+ <name>adminDN</name>
+ <value>cn=Directory Manager</value>
+ </option>
+ <option>
+ <name>adminPassword</name>
+ <value>password</value>
+ </option>
+ <option>
+ <name>searchTimeLimit</name>
+ <value>10000</value>
+ </option>
+ </options>
+ </identity-store>
+ </identity-stores>
+ </stores>
+</jboss-identity>
\ No newline at end of file
Added: idm/trunk/idm-hibernate/pom.xml
===================================================================
--- idm/trunk/idm-hibernate/pom.xml (rev 0)
+++ idm/trunk/idm-hibernate/pom.xml 2009-05-09 11:10:49 UTC (rev 485)
@@ -0,0 +1,207 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.identity</groupId>
+ <artifactId>idm-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../parent</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>idm-hibernate</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Identity IDM Hibernate</name>
+ <url>http://labs.jboss.org/portal/jbosssecurity/</url>
+ <description>JBoss Identity IDM Hibernate</description>
+ <licenses>
+ <license>
+ <name>lgpl</name>
+ <url>http://repository.jboss.com/licenses/lgpl.txt</url>
+ </license>
+ </licenses>
+ <organization>
+ <name>JBoss Inc.</name>
+ <url>http://www.jboss.org</url>
+ </organization>
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossidentity/trunk</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/jbossidentity/trunk</developerConnection>
+ <url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossidentity/trunk</url>
+ </scm>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.identity</groupId>
+ <artifactId>idm-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- hibernate -->
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
+ <version>3.3.1.GA</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-annotations</artifactId>
+ <version>3.4.0.GA</version>
+ </dependency>
+ <!--Javassist as Hibernate's bytecode provider-->
+ <dependency>
+ <groupId>javassist</groupId>
+ <artifactId>javassist</artifactId>
+ <version>3.4.GA</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-cglib-repack</artifactId>
+ <version>2.1_3</version>
+ </dependency>
+
+
+ <!-- Hibernate logging set up -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>1.5.2</version>
+ </dependency>
+ <!--<dependency>-->
+ <!--<groupId>log4j</groupId>-->
+ <!--<artifactId>log4j</artifactId>-->
+ <!--<version>1.2.14</version>-->
+ <!--</dependency>-->
+
+
+ <dependency>
+ <groupId>org.jboss.cache</groupId>
+ <artifactId>jbosscache-core</artifactId>
+ <version>3.0.2.GA</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.3</version>
+ <configuration>
+ <systemProperties>
+ <property>
+ <name>dataSourceName</name>
+ <value>${dataSourceName}</value>
+ </property>
+ <property>
+ <name>directoryName</name>
+ <value>${directoryName}</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ <!--<plugin>-->
+ <!--<groupId>org.jboss.unit</groupId>-->
+ <!--<artifactId>jboss-unit-tooling-maven2</artifactId>-->
+ <!--<executions>-->
+ <!--<execution>-->
+ <!--<phase>test</phase>-->
+ <!--<goals>-->
+ <!--<goal>execute</goal>-->
+ <!--</goals>-->
+ <!--</execution>-->
+ <!--</executions>-->
+ <!--<configuration>-->
+
+ <!--<jpda>true</jpda>-->
+ <!--<jpdaPort>5005</jpdaPort>-->
+ <!--<jpdaSuspend>true</jpdaSuspend>-->
+
+ <!--<failOnError>true</failOnError>-->
+
+
+ <!--<testsuites>-->
+ <!--<testsuite>-->
+ <!--<config>jboss-unit.xml</config>-->
+ <!--<parameters>-->
+ <!--<parameter>-->
+ <!--<name>dataSourceName</name>-->
+ <!--<values>-->
+ <!--<value>hsqldb</value>-->
+ <!--<value>mysql5</value>-->
+ <!--<value>mysql4</value>-->
+ <!--<value>postgresql8</value>-->
+ <!--<value>sqlserver</value>-->
+ <!--<value>oracle9i</value>-->
+ <!--<value>oracle10g</value>-->
+ <!--</values>-->
+ <!--</parameter>-->
+ <!--</parameters>-->
+
+
+ <!--</testsuite>-->
+ <!--</testsuites>-->
+
+ <!--<reports>-->
+ <!--<xml>idm/target/tests/reports/xml</xml>-->
+ <!--<html>idm/target/tests/reports/html</html>-->
+ <!--</reports>-->
+ <!--</configuration>-->
+ <!--</plugin>-->
+
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>provided-jdbc-driver</id>
+ <dependencies>
+ <dependency>
+ <groupId>privided</groupId>
+ <artifactId>jdbc-driver</artifactId>
+ <version>NA</version>
+ <scope>system</scope>
+ <systemPath>${provided.jdbc.driver.path}</systemPath>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>provided-jdbc-driver2</id>
+ <dependencies>
+ <dependency>
+ <groupId>privided</groupId>
+ <artifactId>jdbc-driver2</artifactId>
+ <version>NA</version>
+ <scope>system</scope>
+ <systemPath>${provided.jdbc.driver.path2}</systemPath>
+ </dependency>
+ </dependencies>
+ </profile>
+ <!--<profile>-->
+ <!--<id>oracle-provided-jdbc-drivers</id>-->
+ <!--<dependencies>-->
+ <!--<dependency>-->
+ <!--<groupId>oracle</groupId>-->
+ <!--<artifactId>jdbc-driver1</artifactId>-->
+ <!--<version>NA</version>-->
+ <!--<scope>system</scope>-->
+ <!--<systemPath>${oracle.jdbc.driver1}</systemPath>-->
+ <!--</dependency>-->
+ <!--<dependency>-->
+ <!--<groupId>oracle</groupId>-->
+ <!--<artifactId>jdbc-driver2</artifactId>-->
+ <!--<version>NA</version>-->
+ <!--<scope>system</scope>-->
+ <!--<systemPath>${oracle.jdbc.driver1}</systemPath>-->
+ <!--</dependency>-->
+ <!--</dependencies>-->
+ <!--</profile>-->
+ </profiles>
+</project>
Copied: idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate (from rev 482, idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/model/hibernate)
Copied: idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate (from rev 482, idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/store/hibernate)
Added: idm/trunk/idm-ldap/pom.xml
===================================================================
--- idm/trunk/idm-ldap/pom.xml (rev 0)
+++ idm/trunk/idm-ldap/pom.xml 2009-05-09 11:10:49 UTC (rev 485)
@@ -0,0 +1,164 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.identity</groupId>
+ <artifactId>idm-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../parent</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>idm-ldap</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Identity IDM LDAP</name>
+ <url>http://labs.jboss.org/portal/jbosssecurity/</url>
+ <description>JBoss Identity IDM LDAP</description>
+ <licenses>
+ <license>
+ <name>lgpl</name>
+ <url>http://repository.jboss.com/licenses/lgpl.txt</url>
+ </license>
+ </licenses>
+ <organization>
+ <name>JBoss Inc.</name>
+ <url>http://www.jboss.org</url>
+ </organization>
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossidentity/trunk</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/jbossidentity/trunk</developerConnection>
+ <url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossidentity/trunk</url>
+ </scm>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.identity</groupId>
+ <artifactId>idm-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>jboss-unit</artifactId>
+ <version>1.2.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.3</version>
+ <configuration>
+ <systemProperties>
+ <property>
+ <name>dataSourceName</name>
+ <value>${dataSourceName}</value>
+ </property>
+ <property>
+ <name>directoryName</name>
+ <value>${directoryName}</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ <!--<plugin>-->
+ <!--<groupId>org.jboss.unit</groupId>-->
+ <!--<artifactId>jboss-unit-tooling-maven2</artifactId>-->
+ <!--<executions>-->
+ <!--<execution>-->
+ <!--<phase>test</phase>-->
+ <!--<goals>-->
+ <!--<goal>execute</goal>-->
+ <!--</goals>-->
+ <!--</execution>-->
+ <!--</executions>-->
+ <!--<configuration>-->
+
+ <!--<jpda>true</jpda>-->
+ <!--<jpdaPort>5005</jpdaPort>-->
+ <!--<jpdaSuspend>true</jpdaSuspend>-->
+
+ <!--<failOnError>true</failOnError>-->
+
+
+ <!--<testsuites>-->
+ <!--<testsuite>-->
+ <!--<config>jboss-unit.xml</config>-->
+ <!--<parameters>-->
+ <!--<parameter>-->
+ <!--<name>dataSourceName</name>-->
+ <!--<values>-->
+ <!--<value>hsqldb</value>-->
+ <!--<value>mysql5</value>-->
+ <!--<value>mysql4</value>-->
+ <!--<value>postgresql8</value>-->
+ <!--<value>sqlserver</value>-->
+ <!--<value>oracle9i</value>-->
+ <!--<value>oracle10g</value>-->
+ <!--</values>-->
+ <!--</parameter>-->
+ <!--</parameters>-->
+
+
+ <!--</testsuite>-->
+ <!--</testsuites>-->
+
+ <!--<reports>-->
+ <!--<xml>idm/target/tests/reports/xml</xml>-->
+ <!--<html>idm/target/tests/reports/html</html>-->
+ <!--</reports>-->
+ <!--</configuration>-->
+ <!--</plugin>-->
+
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>provided-jdbc-driver</id>
+ <dependencies>
+ <dependency>
+ <groupId>privided</groupId>
+ <artifactId>jdbc-driver</artifactId>
+ <version>NA</version>
+ <scope>system</scope>
+ <systemPath>${provided.jdbc.driver.path}</systemPath>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>provided-jdbc-driver2</id>
+ <dependencies>
+ <dependency>
+ <groupId>privided</groupId>
+ <artifactId>jdbc-driver2</artifactId>
+ <version>NA</version>
+ <scope>system</scope>
+ <systemPath>${provided.jdbc.driver.path2}</systemPath>
+ </dependency>
+ </dependencies>
+ </profile>
+ <!--<profile>-->
+ <!--<id>oracle-provided-jdbc-drivers</id>-->
+ <!--<dependencies>-->
+ <!--<dependency>-->
+ <!--<groupId>oracle</groupId>-->
+ <!--<artifactId>jdbc-driver1</artifactId>-->
+ <!--<version>NA</version>-->
+ <!--<scope>system</scope>-->
+ <!--<systemPath>${oracle.jdbc.driver1}</systemPath>-->
+ <!--</dependency>-->
+ <!--<dependency>-->
+ <!--<groupId>oracle</groupId>-->
+ <!--<artifactId>jdbc-driver2</artifactId>-->
+ <!--<version>NA</version>-->
+ <!--<scope>system</scope>-->
+ <!--<systemPath>${oracle.jdbc.driver1}</systemPath>-->
+ <!--</dependency>-->
+ <!--</dependencies>-->
+ <!--</profile>-->
+ </profiles>
+</project>
Copied: idm/trunk/idm-ldap/src/main/java/org/jboss/identity/idm/impl/model/ldap (from rev 482, idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/model/ldap)
Copied: idm/trunk/idm-ldap/src/main/java/org/jboss/identity/idm/impl/store/ldap (from rev 482, idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/store/ldap)
Added: idm/trunk/idm-testsuite/pom.xml
===================================================================
--- idm/trunk/idm-testsuite/pom.xml (rev 0)
+++ idm/trunk/idm-testsuite/pom.xml 2009-05-09 11:10:49 UTC (rev 485)
@@ -0,0 +1,284 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.identity</groupId>
+ <artifactId>idm-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../parent</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>idm-testsuite</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Identity IDM Testsuite</name>
+ <url>http://labs.jboss.org/portal/jbosssecurity/</url>
+ <description>JBoss Identity IDM Testsuite</description>
+ <licenses>
+ <license>
+ <name>lgpl</name>
+ <url>http://repository.jboss.com/licenses/lgpl.txt</url>
+ </license>
+ </licenses>
+ <organization>
+ <name>JBoss Inc.</name>
+ <url>http://www.jboss.org</url>
+ </organization>
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossidentity/trunk</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/jbossidentity/trunk</developerConnection>
+ <url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossidentity/trunk</url>
+ </scm>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.identity</groupId>
+ <artifactId>idm-cache</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.identity</groupId>
+ <artifactId>idm-hibernate</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.identity</groupId>
+ <artifactId>idm-ldap</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.identity</groupId>
+ <artifactId>idm-core</artifactId>
+ <version>${project.version}</version>
+ <classifier>tests</classifier>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>1.8.0.7</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>sun-opends</groupId>
+ <artifactId>OpenDS</artifactId>
+ <version>1.0.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>berkeleydb</groupId>
+ <artifactId>je</artifactId>
+ <version>3.2.76</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!--JBoss Unit-->
+
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>jboss-unit</artifactId>
+ <version>1.2.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>portal-test</artifactId>
+ <version>1.2.2</version>
+
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>hibernate</groupId>
+ <artifactId>hibernate3</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>sun-opends</groupId>
+ <artifactId>opends-core</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss.jbossas.core-libs</groupId>
+ <artifactId>jboss-local-jdbc</artifactId>
+ <version>4.0.4.GA</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>jboss.jbossas.core-libs</groupId>
+ <artifactId>jboss-common-jdbc-wrapper</artifactId>
+ <version>4.0.4.GA</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ <version>2.0.2.GA</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-logging-jdk</artifactId>
+ <version>2.0.2.GA</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ <version>2.0.2.GA</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>apache-log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <version>5.1.6</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>postgresql</groupId>
+ <artifactId>postgresql</artifactId>
+ <version>8.3-604.jdbc3</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>net.sourceforge.jtds</groupId>
+ <artifactId>jtds</artifactId>
+ <version>1.2.2</version>
+ <scope>test</scope>
+ </dependency>
+
+
+
+
+ </dependencies>
+
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.3</version>
+ <configuration>
+ <systemProperties>
+ <property>
+ <name>dataSourceName</name>
+ <value>${dataSourceName}</value>
+ </property>
+ <property>
+ <name>directoryName</name>
+ <value>${directoryName}</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ <!--<plugin>-->
+ <!--<groupId>org.jboss.unit</groupId>-->
+ <!--<artifactId>jboss-unit-tooling-maven2</artifactId>-->
+ <!--<executions>-->
+ <!--<execution>-->
+ <!--<phase>test</phase>-->
+ <!--<goals>-->
+ <!--<goal>execute</goal>-->
+ <!--</goals>-->
+ <!--</execution>-->
+ <!--</executions>-->
+ <!--<configuration>-->
+
+ <!--<jpda>true</jpda>-->
+ <!--<jpdaPort>5005</jpdaPort>-->
+ <!--<jpdaSuspend>true</jpdaSuspend>-->
+
+ <!--<failOnError>true</failOnError>-->
+
+
+ <!--<testsuites>-->
+ <!--<testsuite>-->
+ <!--<config>jboss-unit.xml</config>-->
+ <!--<parameters>-->
+ <!--<parameter>-->
+ <!--<name>dataSourceName</name>-->
+ <!--<values>-->
+ <!--<value>hsqldb</value>-->
+ <!--<value>mysql5</value>-->
+ <!--<value>mysql4</value>-->
+ <!--<value>postgresql8</value>-->
+ <!--<value>sqlserver</value>-->
+ <!--<value>oracle9i</value>-->
+ <!--<value>oracle10g</value>-->
+ <!--</values>-->
+ <!--</parameter>-->
+ <!--</parameters>-->
+
+
+ <!--</testsuite>-->
+ <!--</testsuites>-->
+
+ <!--<reports>-->
+ <!--<xml>idm/target/tests/reports/xml</xml>-->
+ <!--<html>idm/target/tests/reports/html</html>-->
+ <!--</reports>-->
+ <!--</configuration>-->
+ <!--</plugin>-->
+
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>provided-jdbc-driver</id>
+ <dependencies>
+ <dependency>
+ <groupId>privided</groupId>
+ <artifactId>jdbc-driver</artifactId>
+ <version>NA</version>
+ <scope>system</scope>
+ <systemPath>${provided.jdbc.driver.path}</systemPath>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>provided-jdbc-driver2</id>
+ <dependencies>
+ <dependency>
+ <groupId>privided</groupId>
+ <artifactId>jdbc-driver2</artifactId>
+ <version>NA</version>
+ <scope>system</scope>
+ <systemPath>${provided.jdbc.driver.path2}</systemPath>
+ </dependency>
+ </dependencies>
+ </profile>
+ <!--<profile>-->
+ <!--<id>oracle-provided-jdbc-drivers</id>-->
+ <!--<dependencies>-->
+ <!--<dependency>-->
+ <!--<groupId>oracle</groupId>-->
+ <!--<artifactId>jdbc-driver1</artifactId>-->
+ <!--<version>NA</version>-->
+ <!--<scope>system</scope>-->
+ <!--<systemPath>${oracle.jdbc.driver1}</systemPath>-->
+ <!--</dependency>-->
+ <!--<dependency>-->
+ <!--<groupId>oracle</groupId>-->
+ <!--<artifactId>jdbc-driver2</artifactId>-->
+ <!--<version>NA</version>-->
+ <!--<scope>system</scope>-->
+ <!--<systemPath>${oracle.jdbc.driver1}</systemPath>-->
+ <!--</dependency>-->
+ <!--</dependencies>-->
+ <!--</profile>-->
+ </profiles>
+</project>
Copied: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/HibernateTestSupport.java (from rev 482, idm/trunk/idm-core/src/test/java/org/jboss/identity/idm/impl/HibernateTestSupport.java)
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/HibernateTestSupport.java (rev 0)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/HibernateTestSupport.java 2009-05-09 11:10:49 UTC (rev 485)
@@ -0,0 +1,135 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl;
+
+import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipType;
+import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectType;
+import org.hibernate.SessionFactory;
+import org.hibernate.cfg.AnnotationConfiguration;
+
+import java.util.logging.Logger;
+import java.sql.Connection;
+import java.sql.DriverManager;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class HibernateTestSupport
+{
+ private static Logger logger = Logger.getLogger(HibernateTestSupport.class.getName());
+
+ protected SessionFactory sessionFactory;
+
+ private Connection connection;
+
+ private final String databaseName;
+
+ private final String hibernateConfiguration;
+
+ public HibernateTestSupport(String databaseName, String hibernateConfiguration)
+ {
+ this.databaseName = databaseName;
+ this.hibernateConfiguration = hibernateConfiguration;
+ }
+
+ public SessionFactory getSessionFactory()
+ {
+ return sessionFactory;
+ }
+
+
+ public void start() throws Exception {
+ try {
+ logger.info("Starting in-memory HSQL database for unit tests");
+ Class.forName("org.hsqldb.jdbcDriver");
+ connection = DriverManager.getConnection("jdbc:hsqldb:mem:" + databaseName, "sa", "");
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ logger.fine("Exception during HSQL database startup.");
+ throw ex;
+ }
+ try
+ {
+ logger.info("Building JPA EntityManager for unit tests");
+ //emFactory = (HibernateEntityManagerFactory)Persistence.createEntityManagerFactory(persistenceUnit);
+ sessionFactory = new AnnotationConfiguration().configure(hibernateConfiguration).buildSessionFactory();
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ logger.fine("Exception during JPA EntityManager instanciation.");
+ throw ex;
+ }
+ }
+
+ public void stop() throws Exception {
+ logger.info("Shuting down Hibernate JPA layer.");
+ if (sessionFactory != null)
+ {
+ sessionFactory.close();
+ }
+
+ logger.info("Stopping in-memory HSQL database.");
+ try
+ {
+ connection.createStatement().execute("SHUTDOWN");
+ }
+ catch (Exception ex) {
+ throw ex;
+ }
+ }
+
+ public void populateObjectTypes(String[] typeNames) throws Exception
+ {
+
+ sessionFactory.getCurrentSession().getTransaction().begin();
+
+ for (String typeName : typeNames)
+ {
+ HibernateIdentityObjectType hibernateType = new HibernateIdentityObjectType(typeName);
+ sessionFactory.getCurrentSession().persist(hibernateType);
+ }
+
+ sessionFactory.getCurrentSession().getTransaction().commit();
+
+ }
+
+ public void populateRelationshipTypes(String[] typeNames) throws Exception
+ {
+
+ sessionFactory.getCurrentSession().getTransaction().begin();
+
+ for (String typeName : typeNames)
+ {
+ HibernateIdentityObjectRelationshipType hibernateType = new HibernateIdentityObjectRelationshipType(typeName);
+ sessionFactory.getCurrentSession().persist(hibernateType);
+ }
+
+ sessionFactory.getCurrentSession().getTransaction().commit();
+ }
+
+
+}
Copied: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/IdentityTestPOJO.java (from rev 482, idm/trunk/idm-core/src/test/java/org/jboss/identity/idm/impl/IdentityTestPOJO.java)
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/IdentityTestPOJO.java (rev 0)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/IdentityTestPOJO.java 2009-05-09 11:10:49 UTC (rev 485)
@@ -0,0 +1,234 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl;
+
+import org.jboss.unit.api.pojo.annotations.Parameter;
+import static org.jboss.unit.api.Assert.assertTrue;
+import org.jboss.portal.test.framework.embedded.JNDISupport;
+import org.jboss.portal.test.framework.embedded.ConnectionManagerSupport;
+import org.jboss.portal.test.framework.embedded.TransactionManagerSupport;
+import org.jboss.portal.test.framework.embedded.DataSourceSupport;
+import org.jboss.portal.test.framework.embedded.HibernateSupport;
+import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObject;
+import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectAttribute;
+import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttribute;
+import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectTextAttribute;
+import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredential;
+import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredentialType;
+import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationship;
+import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipName;
+import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipType;
+import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectType;
+import org.jboss.identity.idm.impl.model.hibernate.HibernateRealm;
+import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttributeValue;
+import org.jboss.identity.idm.test.HibernateAnnotationsSupport;
+import org.hibernate.SessionFactory;
+
+import java.util.List;
+import java.util.LinkedList;
+
+import junit.framework.TestCase;
+
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class IdentityTestPOJO extends TestCase
+{
+
+ private String identityConfig = "organization-test-jboss-unit-config.xml";
+
+ private String realmName;
+
+ private String dataSourceName = "hsqldb";
+
+ private String hibernateConfig = "datasources/hibernates.xml";
+
+ private String datasources = "datasources/datasources.xml";
+
+ private JNDISupport jndiSupport;
+
+ protected TransactionManagerSupport transactonManagerSupport;
+
+ protected ConnectionManagerSupport connectionManagerSupport;
+
+ protected DataSourceSupport dataSourceSupport;
+
+ protected HibernateSupport hibernateSupport;
+
+
+
+ public void start() throws Exception
+ {
+ overrideFromProperties();
+
+ jndiSupport = new JNDISupport();
+ jndiSupport.start();
+ transactonManagerSupport = new TransactionManagerSupport();
+ transactonManagerSupport.start();
+ connectionManagerSupport = new ConnectionManagerSupport();
+ connectionManagerSupport.setTransactionManager(transactonManagerSupport.getTransactionManager());
+ connectionManagerSupport.start();
+
+
+
+ DataSourceSupport.Config dataSourceConfig = DataSourceSupport.Config.obtainConfig(datasources, dataSourceName);
+
+ HibernateSupport.Config hibernateSupportConfig = HibernateSupport.getConfig(dataSourceName, hibernateConfig);
+
+ dataSourceSupport = new DataSourceSupport();
+ dataSourceSupport.setTransactionManager(transactonManagerSupport.getTransactionManager());
+ dataSourceSupport.setConnectionManagerReference(connectionManagerSupport.getConnectionManagerReference());
+ dataSourceSupport.setConfig(dataSourceConfig);
+ dataSourceSupport.start();
+
+ hibernateSupport = new HibernateAnnotationsSupport();
+ hibernateSupport.setConfig(hibernateSupportConfig);
+ hibernateSupport.setJNDIName("java:/jbossidentity/HibernateStoreSessionFactory");
+
+ List<String> annotatedClasses = new LinkedList<String>();
+ annotatedClasses.add(HibernateIdentityObject.class.getName());
+ annotatedClasses.add(HibernateIdentityObjectAttribute.class.getName());
+ annotatedClasses.add(HibernateIdentityObjectBinaryAttribute.class.getName());
+ annotatedClasses.add(HibernateIdentityObjectBinaryAttributeValue.class.getName());
+ annotatedClasses.add(HibernateIdentityObjectTextAttribute.class.getName());
+ annotatedClasses.add(HibernateIdentityObjectCredential.class.getName());
+ annotatedClasses.add(HibernateIdentityObjectCredentialType.class.getName());
+ annotatedClasses.add(HibernateIdentityObjectRelationship.class.getName());
+ annotatedClasses.add(HibernateIdentityObjectRelationshipName.class.getName());
+ annotatedClasses.add(HibernateIdentityObjectRelationshipType.class.getName());
+ annotatedClasses.add(HibernateIdentityObjectType.class.getName());
+ annotatedClasses.add(HibernateRealm.class.getName());
+
+ hibernateSupport.setMappings(annotatedClasses);
+
+ hibernateSupport.start();
+
+
+ }
+
+ public void stop() throws Exception
+ {
+ hibernateSupport.stop();
+ dataSourceSupport.stop();
+ connectionManagerSupport.stop();
+ transactonManagerSupport.stop();
+ jndiSupport.stop();
+
+
+ }
+
+ public void overrideFromProperties() throws Exception
+ {
+ String dsName =System.getProperties().getProperty("dataSourceName");
+
+ if (dsName != null && !dsName.startsWith("$"))
+ {
+ setDataSourceName(dsName);
+ }
+
+ }
+
+ public SessionFactory getSessionFactory()
+ {
+ return getHibernateSupport().getSessionFactory();
+ }
+
+
+
+
+ @Parameter(name="dataSourceName")
+ public void setDataSourceName(String dataSourceName)
+ {
+ this.dataSourceName = dataSourceName;
+ }
+
+ @Parameter(name="hibernateConfig")
+ public void setHibernateConfig(String hibernateConfig)
+ {
+ this.hibernateConfig = hibernateConfig;
+ }
+
+ @Parameter(name="datasources")
+ public void setDatasources(String datasources)
+ {
+ this.datasources = datasources;
+ }
+
+ @Parameter(name="identityConfig")
+ public void setIdentityConfig(String identityConfig)
+ {
+ this.identityConfig = identityConfig;
+ }
+
+ @Parameter(name="realmName")
+ public void setRealmName(String realmName)
+ {
+ this.realmName = realmName;
+ }
+
+ public String getDataSourceName()
+ {
+ return dataSourceName;
+ }
+
+ public String getHibernateConfig()
+ {
+ return hibernateConfig;
+ }
+
+ public String getDatasources()
+ {
+ return datasources;
+ }
+
+ public String getIdentityConfig()
+ {
+ return identityConfig;
+ }
+
+ public String getRealmName()
+ {
+ return realmName;
+ }
+
+ public HibernateSupport getHibernateSupport()
+ {
+ return hibernateSupport;
+ }
+
+ public void begin()
+ {
+ getHibernateSupport().openSession();
+ }
+
+ public void commit()
+ {
+ assertTrue(getHibernateSupport().commitTransaction());
+ }
+
+
+
+
+}
Copied: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/LDAPTestPOJO.java (from rev 482, idm/trunk/idm-core/src/test/java/org/jboss/identity/idm/impl/LDAPTestPOJO.java)
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/LDAPTestPOJO.java (rev 0)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/LDAPTestPOJO.java 2009-05-09 11:10:49 UTC (rev 485)
@@ -0,0 +1,185 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl;
+
+import org.jboss.identity.idm.opends.OpenDSService;
+import org.jboss.unit.api.pojo.annotations.Parameter;
+import org.opends.server.tools.LDAPModify;
+
+import javax.naming.Context;
+import javax.naming.NamingEnumeration;
+import javax.naming.Binding;
+import javax.naming.directory.DirContext;
+import javax.naming.ldap.InitialLdapContext;
+import javax.naming.ldap.LdapContext;
+import java.util.Hashtable;
+import java.io.File;
+import java.net.URL;
+import java.net.URISyntaxException;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class LDAPTestPOJO extends IdentityTestPOJO
+{
+
+ private String directoryName = "EmbeddedOpenDS";
+
+ public static final String LDAP_HOST = "localhost";
+
+ public static final String LDAP_PORT = "10389";
+
+ public static final String LDAP_PROVIDER_URL = "ldap://" + LDAP_HOST + ":" + LDAP_PORT;
+
+ public static final String LDAP_PRINCIPAL = "cn=Directory Manager";
+
+ public static final String LDAP_CREDENTIALS = "password";
+
+ public static Hashtable<String,String> env = new Hashtable<String,String>();
+
+ static
+ {
+ env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
+ env.put(Context.PROVIDER_URL, LDAP_PROVIDER_URL);
+ env.put(Context.SECURITY_AUTHENTICATION, "simple");
+ env.put(Context.SECURITY_PRINCIPAL, LDAP_PRINCIPAL);
+ env.put(Context.SECURITY_CREDENTIALS, LDAP_CREDENTIALS);
+ }
+
+ OpenDSService openDSService = new OpenDSService(null);
+
+ @Override
+ public void start() throws Exception
+ {
+ super.start();
+
+
+ openDSService.start();
+
+
+ }
+
+ @Override
+ public void stop() throws Exception
+ {
+ super.stop();
+
+ cleanUp(new InitialLdapContext(env, null));
+ openDSService.stop();
+
+ }
+
+ public void overrideFromProperties() throws Exception
+ {
+ super.overrideFromProperties();
+
+ String dirName = System.getProperties().getProperty("directoryName");
+
+ if (dirName != null && !dirName.startsWith("$"))
+ {
+ setDirectoryName(dirName);
+ }
+
+ }
+
+ @Parameter
+ public void setDirectoryName(String directoryName)
+ {
+ this.directoryName = directoryName;
+ }
+
+ public String getDirectoryName()
+ {
+ return directoryName;
+ }
+
+ public void populate() throws Exception
+ {
+ populateLDIF("ldap/initial-opends.ldif");
+ }
+
+ public void populateClean() throws Exception
+ {
+ populateLDIF("ldap/initial-empty-opends.ldif");
+ }
+
+ public void populateLDIF(String ldif) throws Exception
+ {
+
+ URL ldifURL = Thread.currentThread().getContextClassLoader().getResource(ldif);
+
+ System.out.println("LDIF: " + ldifURL.toURI().getPath());
+
+ String[] cmd = new String[] {"-h", LDAP_HOST,
+ "-p", LDAP_PORT,
+ "-D", LDAP_PRINCIPAL,
+ "-w", LDAP_CREDENTIALS,
+ "-a", "-f", ldifURL.toURI().getPath()};
+
+ System.out.println("Populate success: " + (LDAPModify.mainModify(cmd, false, System.out, System.err) == 0));
+
+ }
+
+ protected void cleanUp(DirContext ldapCtx) throws Exception
+ {
+ try
+ {
+ String dn = "dc=portal,dc=example,dc=com";
+
+ System.out.println("Removing: " + dn);
+
+ removeContext(ldapCtx, dn);
+ }
+ catch (Exception e)
+ {
+ //
+ }
+ }
+
+ //subsequent remove of javax.naming.Context
+ protected void removeContext(Context mainCtx, String name) throws Exception
+ {
+ Context deleteCtx = (Context)mainCtx.lookup(name);
+ NamingEnumeration subDirs = mainCtx.listBindings(name);
+
+ while (subDirs.hasMoreElements())
+ {
+ Binding binding = (Binding)subDirs.nextElement();
+ String subName = binding.getName();
+
+ removeContext(deleteCtx, subName);
+ }
+
+ mainCtx.unbind(name);
+ }
+
+
+ public LdapContext getLdapContext() throws Exception
+ {
+ return new InitialLdapContext(env, null);
+ }
+
+
+
+}
Added: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/APILDAPTestCase.java
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/APILDAPTestCase.java (rev 0)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/APILDAPTestCase.java 2009-05-09 11:10:49 UTC (rev 485)
@@ -0,0 +1,137 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.api;
+
+import junit.framework.TestCase;
+import org.jboss.identity.idm.impl.HibernateTestSupport;
+import org.jboss.identity.idm.impl.IdentityTestPOJO;
+import org.jboss.identity.idm.impl.LDAPTestPOJO;
+import org.jboss.identity.idm.impl.configuration.IdentityConfigurationImpl;
+import org.jboss.identity.idm.api.IdentitySessionFactory;
+import org.jboss.identity.idm.api.cfg.IdentityConfiguration;
+import org.jboss.identity.idm.opends.OpenDSService;
+import org.jboss.unit.api.pojo.annotations.Create;
+import org.jboss.unit.api.pojo.annotations.Destroy;
+import org.jboss.unit.api.pojo.annotations.Test;
+import org.opends.server.tools.LDAPModify;
+
+import javax.naming.directory.DirContext;
+import javax.naming.Context;
+import javax.naming.NamingEnumeration;
+import javax.naming.Binding;
+import javax.naming.ldap.InitialLdapContext;
+import java.util.Hashtable;
+import java.io.File;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class APILDAPTestCase extends LDAPTestPOJO implements APITestContext
+{
+
+ PersistenceManagerTest persistenceManagerTest;
+
+ RelationshipManagerTest relationshipManagerTest;
+
+ RoleManagerTest roleManagerTest;
+
+ UserQueryTest userQueryTest;
+
+ GroupQueryTest groupQueryTest;
+
+ RoleQueryTest roleQueryTest;
+
+ IdentitySessionFactory identitySessionFactory;
+
+ @Create
+ public void setUp() throws Exception
+ {
+ super.start();
+ persistenceManagerTest = new PersistenceManagerTest(this);
+ relationshipManagerTest = new RelationshipManagerTest(this);
+ roleManagerTest = new RoleManagerTest(this);
+
+ userQueryTest = new UserQueryTest(this);
+ groupQueryTest = new GroupQueryTest(this);
+ roleQueryTest = new RoleQueryTest(this);
+
+ setRealmName("realm://RedHat/DB_LDAP");
+
+ populateClean();
+
+
+ identitySessionFactory = new IdentityConfigurationImpl().
+ configure(getIdentityConfig()).buildIdentitySessionFactory();
+ }
+
+ @Destroy
+ public void tearDown() throws Exception
+ {
+ super.stop();
+ }
+
+ public IdentitySessionFactory getIdentitySessionFactory()
+ {
+ return identitySessionFactory;
+ }
+
+ @Test
+ public void testPersistenceManager() throws Exception
+ {
+ persistenceManagerTest.testMethods(getRealmName());
+ }
+
+ @Test
+ public void testRelationshipManager() throws Exception
+ {
+ relationshipManagerTest.testMethods(getRealmName());
+ }
+
+ @Test
+ public void testRelationshipManagerMergedRoleAssociations() throws Exception
+ {
+ relationshipManagerTest.testMergedRoleAssociations(getRealmName());
+ }
+
+ @Test
+ public void testRoleManager() throws Exception
+ {
+ roleManagerTest.testMethods(getRealmName());
+ }
+
+ public void testUserQuery() throws Exception
+ {
+ userQueryTest.testQuery(getRealmName());
+ }
+
+ public void testGroupQuery() throws Exception
+ {
+ groupQueryTest.testQuery(getRealmName());
+ }
+
+ public void testRoleQuery() throws Exception
+ {
+ roleQueryTest.testQuery(getRealmName());
+ }
+}
\ No newline at end of file
Added: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/APITestCase.java
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/APITestCase.java (rev 0)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/APITestCase.java 2009-05-09 11:10:49 UTC (rev 485)
@@ -0,0 +1,138 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.api;
+
+import junit.framework.TestCase;
+import org.jboss.identity.idm.impl.HibernateTestSupport;
+import org.jboss.identity.idm.impl.IdentityTestPOJO;
+import org.jboss.identity.idm.impl.configuration.IdentityConfigurationImpl;
+import org.jboss.identity.idm.api.IdentitySessionFactory;
+import org.jboss.identity.idm.api.cfg.IdentityConfiguration;
+import org.jboss.identity.idm.opends.OpenDSService;
+import org.jboss.unit.api.pojo.annotations.Create;
+import org.jboss.unit.api.pojo.annotations.Destroy;
+import org.jboss.unit.api.pojo.annotations.Test;
+import org.opends.server.tools.LDAPModify;
+
+import javax.naming.directory.DirContext;
+import javax.naming.Context;
+import javax.naming.NamingEnumeration;
+import javax.naming.Binding;
+import javax.naming.ldap.InitialLdapContext;
+import java.util.Hashtable;
+import java.io.File;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class APITestCase extends IdentityTestPOJO implements APITestContext
+{
+
+ PersistenceManagerTest persistenceManagerTest;
+
+ RelationshipManagerTest relationshipManagerTest;
+
+ RoleManagerTest roleManagerTest;
+
+ UserQueryTest userQueryTest;
+
+ GroupQueryTest groupQueryTest;
+
+ RoleQueryTest roleQueryTest;
+
+ IdentitySessionFactory identitySessionFactory;
+
+ @Create
+ public void setUp() throws Exception
+ {
+ super.start();
+ persistenceManagerTest = new PersistenceManagerTest(this);
+ relationshipManagerTest = new RelationshipManagerTest(this);
+ roleManagerTest = new RoleManagerTest(this);
+
+ userQueryTest = new UserQueryTest(this);
+ groupQueryTest = new GroupQueryTest(this);
+ roleQueryTest = new RoleQueryTest(this);
+
+ setRealmName("realm://RedHat/DB");
+
+
+ identitySessionFactory = new IdentityConfigurationImpl().
+ configure(getIdentityConfig()).buildIdentitySessionFactory();
+ }
+
+ @Destroy
+ public void tearDown() throws Exception
+ {
+ super.stop();
+ }
+
+ public IdentitySessionFactory getIdentitySessionFactory()
+ {
+ return identitySessionFactory;
+ }
+
+ @Test
+ public void testPersistenceManager() throws Exception
+ {
+ persistenceManagerTest.testMethods(getRealmName());
+ }
+
+ @Test
+ public void testRelationshipManager() throws Exception
+ {
+ relationshipManagerTest.testMethods(getRealmName());
+ }
+
+ @Test
+ public void testRelationshipManagerMergedRoleAssociations() throws Exception
+ {
+ relationshipManagerTest.testMergedRoleAssociations(getRealmName());
+ }
+
+ @Test
+ public void testRoleManager() throws Exception
+ {
+ roleManagerTest.testMethods(getRealmName());
+ }
+
+ @Test
+ public void testUserQuery() throws Exception
+ {
+ userQueryTest.testQuery(getRealmName());
+ }
+
+ @Test
+ public void testGroupQuery() throws Exception
+ {
+ groupQueryTest.testQuery(getRealmName());
+ }
+
+ @Test
+ public void testRoleQuery() throws Exception
+ {
+ roleQueryTest.testQuery(getRealmName());
+ }
+
+}
\ No newline at end of file
Added: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/APITestContext.java
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/APITestContext.java (rev 0)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/APITestContext.java 2009-05-09 11:10:49 UTC (rev 485)
@@ -0,0 +1,41 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.api;
+
+import org.jboss.identity.idm.api.IdentitySessionFactory;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface APITestContext
+{
+
+
+ IdentitySessionFactory getIdentitySessionFactory();
+
+ void begin();
+
+ void commit();
+
+}
Added: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/GroupQueryTest.java
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/GroupQueryTest.java (rev 0)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/GroupQueryTest.java 2009-05-09 11:10:49 UTC (rev 485)
@@ -0,0 +1,128 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.api;
+
+import org.jboss.identity.idm.api.IdentitySession;
+import org.jboss.identity.idm.api.User;
+import org.jboss.identity.idm.api.Group;
+import org.jboss.identity.idm.api.RoleType;
+import org.jboss.identity.idm.api.Role;
+import org.jboss.identity.idm.api.query.GroupQueryBuilder;
+import junit.framework.Assert;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class GroupQueryTest extends Assert
+{
+ private APITestContext ctx;
+
+ private String ORGANIZATION = "ORGANIZATION";
+ private String ORGANIZATION_UNIT = "ORGANIZATION_UNIT";
+ private String DEPARTMENT = "DEPARTMENT";
+
+ public GroupQueryTest(APITestContext testContext)
+ {
+ this.ctx = testContext;
+ }
+
+ public void testQuery(String realmName) throws Exception
+ {
+ ctx.begin();
+
+ IdentitySession ids = ctx.getIdentitySessionFactory().getCurrentIdentitySession(realmName);
+
+ // Create stuff
+
+ User user1 = ids.getPersistenceManager().createUser("user1");
+ User user2 = ids.getPersistenceManager().createUser("user2");
+ User user3 = ids.getPersistenceManager().createUser("user3");
+ User user4 = ids.getPersistenceManager().createUser("user4");
+
+ Group group1 = ids.getPersistenceManager().createGroup("group1", ORGANIZATION);
+ Group group2 = ids.getPersistenceManager().createGroup("group2", ORGANIZATION_UNIT);
+ Group group3 = ids.getPersistenceManager().createGroup("group3", ORGANIZATION_UNIT);
+ Group group4 = ids.getPersistenceManager().createGroup("group4", DEPARTMENT);
+ Group group5 = ids.getPersistenceManager().createGroup("group5", DEPARTMENT);
+
+ ids.getRelationshipManager().associateUser(group1, user1);
+ ids.getRelationshipManager().associateUser(group1, user2);
+ ids.getRelationshipManager().associateUser(group2, user3);
+ ids.getRelationshipManager().associateGroups(group2, group3);
+
+ RoleType rt1 = ids.getRoleManager().createRoleType("rt1");
+ RoleType rt2 = ids.getRoleManager().createRoleType("rt2");
+ RoleType rt3 = ids.getRoleManager().createRoleType("rt3");
+ RoleType rt4 = ids.getRoleManager().createRoleType("rt4");
+
+ Role role1 = ids.getRoleManager().createRole(rt1, user1, group1);
+ Role role2 = ids.getRoleManager().createRole(rt1, user1, group2);
+ Role role3 = ids.getRoleManager().createRole("rt2", user1.getId(), group1.getId());
+
+ // Assertions
+
+ GroupQueryBuilder qb = ids.createGroupQueryBuilder();
+
+ qb.addAssociatedUser(user1);
+
+ assertEquals(1, ids.execute(qb.createQuery()).size());
+ assertEquals(group1, ids.uniqueResult(qb.createQuery()));
+
+ //
+ qb.reset();
+
+ qb.addAssociatedUser(user1);
+ qb.addAssociatedUser(user2);
+
+ assertEquals(1, ids.execute(qb.createQuery()).size());
+
+ //
+ qb.reset();
+
+ qb.addAssociatedUser(user1);
+ qb.addRelatedUser(user2);
+
+ assertEquals(1, ids.execute(qb.createQuery()).size());
+
+ //
+ qb.reset();
+
+ qb.addAssociatedUser(user1);
+ qb.addRelatedUser(user4);
+
+ assertEquals(0, ids.execute(qb.createQuery()).size());
+
+ //
+ qb.reset();
+
+ qb.addAssociatedUser(user3);
+ qb.addAssociatedGroup(group3, false);
+
+ assertEquals(1, ids.execute(qb.createQuery()).size());
+ assertEquals(group2, ids.uniqueResult(qb.createQuery()));
+
+
+ ctx.commit();
+ }
+}
Added: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/GroupTypeEnum.java
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/GroupTypeEnum.java (rev 0)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/GroupTypeEnum.java 2009-05-09 11:10:49 UTC (rev 485)
@@ -0,0 +1,48 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+
+package org.jboss.identity.idm.impl.api;
+
+
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public enum GroupTypeEnum
+{
+ ADMINISTRATION,
+ ORGANIZATION,
+ DIVISION,
+ DEPARTMENT,
+ PROJECT,
+ SECURITY,
+ COMMUNITY,
+ OFFICE,
+ CUSTOM;
+
+ public String getName()
+ {
+ return this.name();
+ }
+}
Added: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/ModelTestCase.java
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/ModelTestCase.java (rev 0)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/ModelTestCase.java 2009-05-09 11:10:49 UTC (rev 485)
@@ -0,0 +1,49 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.api;
+
+import junit.framework.TestCase;
+import org.jboss.identity.idm.impl.api.model.GroupId;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class ModelTestCase extends TestCase
+{
+
+ public void testGroupId() throws Exception
+ {
+
+ GroupId id = new GroupId(GroupId.PREFIX + GroupId.SEPARATOR + "groupTypeName" + GroupId.SEPARATOR + "groupName");
+ assertEquals("groupName", id.getName());
+ assertEquals("groupTypeName", id.getType());
+
+ id = new GroupId("groupName", "groupTypeName");
+ assertEquals("groupName", id.getName());
+ assertEquals("groupTypeName", id.getType());
+
+ }
+
+
+}
Added: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/OrganizationLDAPTestCase.java
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/OrganizationLDAPTestCase.java (rev 0)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/OrganizationLDAPTestCase.java 2009-05-09 11:10:49 UTC (rev 485)
@@ -0,0 +1,109 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.api;
+
+import org.jboss.identity.idm.impl.IdentityTestPOJO;
+import org.jboss.identity.idm.impl.LDAPTestPOJO;
+import org.jboss.identity.idm.impl.configuration.IdentityConfigurationImpl;
+import org.jboss.identity.idm.api.IdentitySessionFactory;
+import org.jboss.unit.api.pojo.annotations.Create;
+import org.jboss.unit.api.pojo.annotations.Destroy;
+import org.jboss.unit.api.pojo.annotations.Test;
+import org.jboss.unit.api.pojo.annotations.Parameter;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class OrganizationLDAPTestCase extends LDAPTestPOJO implements APITestContext
+{
+ private OrganizationTest orgTest;
+
+ private IdentitySessionFactory identitySessionFactory;
+
+ private String samplePortalRealmName = "realm://portal/SamplePortal/DB_LDAP";
+
+ private String sampleOrganizationRealmName = "realm://RedHat/DB_LDAP";
+
+
+ @Create
+ public void setUp() throws Exception
+ {
+ super.start();
+
+ orgTest = new OrganizationTest(this);
+
+ populateClean();
+
+ identitySessionFactory = new IdentityConfigurationImpl().
+ configure(getIdentityConfig()).buildIdentitySessionFactory();
+ }
+
+ @Destroy
+ public void tearDown() throws Exception
+ {
+ super.stop();
+ }
+
+ public IdentitySessionFactory getIdentitySessionFactory()
+ {
+ return identitySessionFactory;
+ }
+
+ @Test
+ public void testOrganization() throws Exception
+ {
+
+ orgTest.testRedHatOrganization(getSampleOrganizationRealmName());
+ }
+
+ @Test
+ public void testSamplePortal() throws Exception
+ {
+
+ orgTest.testSamplePortal(getSamplePortalRealmName());
+
+ }
+
+ public String getSamplePortalRealmName()
+ {
+ return samplePortalRealmName;
+ }
+
+ @Parameter
+ public void setSamplePortalRealmName(String samplePortalRealmName)
+ {
+ this.samplePortalRealmName = samplePortalRealmName;
+ }
+
+ public String getSampleOrganizationRealmName()
+ {
+ return sampleOrganizationRealmName;
+ }
+
+ @Parameter
+ public void setSampleOrganizationRealmName(String sampleOrganizationRealmName)
+ {
+ this.sampleOrganizationRealmName = sampleOrganizationRealmName;
+ }
+}
\ No newline at end of file
Added: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/OrganizationTest.java
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/OrganizationTest.java (rev 0)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/OrganizationTest.java 2009-05-09 11:10:49 UTC (rev 485)
@@ -0,0 +1,592 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.api;
+
+import org.jboss.identity.idm.api.IdentitySession;
+import org.jboss.identity.idm.api.Group;
+import org.jboss.identity.idm.api.User;
+import org.jboss.identity.idm.api.RoleType;
+import org.jboss.identity.idm.api.IdentitySessionFactory;
+import org.jboss.identity.idm.api.Attribute;
+import org.jboss.identity.idm.api.AttributeDescription;
+import org.jboss.identity.idm.api.Credential;
+import org.jboss.identity.idm.p3p.P3PConstants;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Random;
+import java.util.Arrays;
+
+import junit.framework.Assert;
+
+/**
+ * Abstract test mapping real life structures using the API
+ *
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class OrganizationTest extends Assert
+{
+ APITestContext ctx;
+
+ public OrganizationTest(APITestContext ctx)
+ {
+ this.ctx = ctx;
+ }
+
+ public void setCtx(APITestContext ctx)
+ {
+ this.ctx = ctx;
+ }
+
+ public APITestContext getCtx()
+ {
+ return ctx;
+ }
+
+ public void testRedHatOrganization(String realmName) throws Exception
+ {
+ // GroupType
+
+ String ORGANIZATION = "ORGANIZATION";
+ String ORGANIZATION_UNIT = "ORGANIZATION_UNIT";
+ String DIVISION = "DIVISION";
+ String DEPARTMENT = "DEPARTMENT";
+ String PROJECT = "PROJECT";
+ String PEOPLE = "PEOPLE";
+
+ IdentitySessionFactory factory = ctx.getIdentitySessionFactory();
+
+ IdentitySession session = factory.createIdentitySession(realmName);
+
+ //ctx.begin();
+
+ ctx.begin();
+
+ // Organization structure
+
+ Group rhOrg = session.getPersistenceManager().createGroup("RedHat", ORGANIZATION);
+
+ Group jbossDivision = session.getPersistenceManager().createGroup("JBoss", DIVISION);
+ Group rhelDivision = session.getPersistenceManager().createGroup("RHEL", DIVISION);
+
+ session.getRelationshipManager().associateGroups(rhOrg, jbossDivision);
+ session.getRelationshipManager().associateGroups(rhOrg, rhelDivision);
+
+ Group itDepartment = session.getPersistenceManager().createGroup("IT", DEPARTMENT);
+ Group hrDepartment = session.getPersistenceManager().createGroup("HR", DEPARTMENT);
+
+ session.getRelationshipManager().associateGroups(jbossDivision, itDepartment);
+ session.getRelationshipManager().associateGroups(jbossDivision, hrDepartment);
+
+ Group rndDepartment = session.getPersistenceManager().createGroup("RnD", DEPARTMENT);
+
+ session.getRelationshipManager().associateGroups(itDepartment, rndDepartment);
+
+ Group projectsOU = session.getPersistenceManager().createGroup("Projects", ORGANIZATION_UNIT);
+ Group commonFrameworksOU = session.getPersistenceManager().createGroup("Common Frameworks", ORGANIZATION_UNIT);
+
+ session.getRelationshipManager().associateGroups(rndDepartment, projectsOU);
+
+ // Projects
+
+ Group portalProject = session.getPersistenceManager().createGroup("Portal", PROJECT);
+ Group soaProject = session.getPersistenceManager().createGroup("SOA", PROJECT);
+ Group jbpmProject = session.getPersistenceManager().createGroup("jBPM", PROJECT);
+ Group seamProject = session.getPersistenceManager().createGroup("Seam", PROJECT);
+ Group asProject = session.getPersistenceManager().createGroup("AS", PROJECT);
+ Group securityProject = session.getPersistenceManager().createGroup("Security", PROJECT);
+
+ session.getRelationshipManager().associateGroups(projectsOU, portalProject);
+ session.getRelationshipManager().associateGroups(projectsOU, soaProject);
+ session.getRelationshipManager().associateGroups(projectsOU, jbpmProject);
+ session.getRelationshipManager().associateGroups(projectsOU, asProject);
+ session.getRelationshipManager().associateGroups(projectsOU, seamProject);
+
+ // Check...
+ assertTrue(session.getRelationshipManager().isAssociated(projectsOU, portalProject));
+ assertTrue(session.getRelationshipManager().isAssociated(projectsOU, soaProject));
+ assertTrue(session.getRelationshipManager().isAssociated(projectsOU, jbpmProject));
+ assertTrue(session.getRelationshipManager().isAssociated(projectsOU, asProject));
+ assertTrue(session.getRelationshipManager().isAssociated(projectsOU, seamProject));
+
+ // Portal is part of common frameworks
+ session.getRelationshipManager().associateGroups(commonFrameworksOU, portalProject);
+
+ // People
+
+ Group employeesGroup = session.getPersistenceManager().createGroup("Employees", PEOPLE);
+
+ // Management
+
+ User theuteUser = session.getPersistenceManager().createUser("theute");
+ User mlittleUser = session.getPersistenceManager().createUser("mlittle");
+ User bgeorgesUser = session.getPersistenceManager().createUser("bgeorges");
+ User asaldhanaUser = session.getPersistenceManager().createUser("asaldhana");
+ User janderseUser = session.getPersistenceManager().createUser("janderse");
+
+ // Portal Team
+
+ User bdawidowUser = session.getPersistenceManager().createUser("bdawidow");
+ User claprunUser = session.getPersistenceManager().createUser("claprun");
+ User whalesUser = session.getPersistenceManager().createUser("whales");
+ User sshahUser = session.getPersistenceManager().createUser("sshah");
+ User mwringeUser = session.getPersistenceManager().createUser("mwringe");
+
+ // Store as employees
+
+ session.getRelationshipManager().associateUser(employeesGroup, theuteUser);
+ session.getRelationshipManager().associateUser(employeesGroup, mlittleUser);
+ session.getRelationshipManager().associateUser(employeesGroup, asaldhanaUser);
+ session.getRelationshipManager().associateUser(employeesGroup, bdawidowUser);
+ session.getRelationshipManager().associateUser(employeesGroup, claprunUser);
+ session.getRelationshipManager().associateUser(employeesGroup, whalesUser);
+ session.getRelationshipManager().associateUser(employeesGroup, sshahUser);
+ session.getRelationshipManager().associateUser(employeesGroup, mwringeUser);
+
+ // Portal team for management purposes
+
+ Group portalTeamGroup = session.getPersistenceManager().createGroup("Portal Team", PEOPLE);
+ session.getRelationshipManager().associateUser(portalTeamGroup, bdawidowUser);
+ session.getRelationshipManager().associateUser(portalTeamGroup, claprunUser);
+ session.getRelationshipManager().associateUser(portalTeamGroup, whalesUser);
+ session.getRelationshipManager().associateUser(portalTeamGroup, sshahUser);
+ session.getRelationshipManager().associateUser(portalTeamGroup, mwringeUser);
+
+ // Portal team is under common frameworks
+
+ session.getRelationshipManager().associateGroups(commonFrameworksOU, portalTeamGroup);
+
+ // Role Types
+
+ RoleType developerRT = session.getRoleManager().createRoleType("Developer");
+ RoleType managerRT = session.getRoleManager().createRoleType("Manager");
+ RoleType leadDeveloperRT = session.getRoleManager().createRoleType("Lead Developer");
+ RoleType productManagerRT = session.getRoleManager().createRoleType("Product Manager");
+
+ // Assign roles
+
+ // Common frameworks manager
+
+ session.getRoleManager().createRole(managerRT, bgeorgesUser, commonFrameworksOU);
+
+ // Portal developers
+
+ session.getRoleManager().createRole(developerRT, theuteUser, portalProject);
+ session.getRoleManager().createRole(developerRT, bdawidowUser, portalProject);
+ session.getRoleManager().createRole(developerRT, claprunUser, portalProject);
+ session.getRoleManager().createRole(developerRT, whalesUser, portalProject);
+ session.getRoleManager().createRole(developerRT, sshahUser, portalProject);
+ session.getRoleManager().createRole(developerRT, mwringeUser, portalProject);
+
+ // Portal management
+ session.getRoleManager().createRole(leadDeveloperRT, theuteUser, portalProject);
+ session.getRoleManager().createRole(managerRT, theuteUser, portalTeamGroup);
+ session.getRoleManager().createRole(productManagerRT, janderseUser, portalProject);
+
+ // SOA
+
+ session.getRoleManager().createRole(developerRT, mlittleUser, portalProject);
+ session.getRoleManager().createRole(productManagerRT, mlittleUser, portalProject);
+
+ // AS & Security
+
+ session.getRoleManager().createRole(developerRT, asaldhanaUser, asProject);
+ session.getRoleManager().createRole(developerRT, asaldhanaUser, securityProject);
+ session.getRoleManager().createRole(leadDeveloperRT, asaldhanaUser, securityProject);
+
+
+ // Check what RoleTypes has user theute
+ Collection<RoleType> roleTypes = session.getRoleManager().findUserRoleTypes(theuteUser);
+ assertEquals(3, roleTypes.size());
+ assertTrue(roleTypes.contains(developerRT));
+ assertTrue(roleTypes.contains(leadDeveloperRT));
+ assertTrue(roleTypes.contains(managerRT));
+ assertFalse(roleTypes.contains(productManagerRT));
+
+ assertTrue(session.getRoleManager().hasRole(theuteUser, portalProject, developerRT));
+ assertTrue(session.getRoleManager().hasRole(theuteUser, portalProject, leadDeveloperRT));
+ assertTrue(session.getRoleManager().hasRole(theuteUser, portalTeamGroup, managerRT));
+
+ // Check where anil is Lead Developer and where Developer
+
+ roleTypes = session.getRoleManager().findUserRoleTypes(asaldhanaUser);
+ assertEquals(2, roleTypes.size());
+ assertTrue(roleTypes.contains(developerRT));
+ assertTrue(roleTypes.contains(leadDeveloperRT));
+
+ roleTypes = session.getRoleManager().findRoleTypes(asaldhanaUser, securityProject);
+ assertEquals(2, roleTypes.size());
+ assertTrue(roleTypes.contains(leadDeveloperRT));
+
+ roleTypes = session.getRoleManager().findRoleTypes(asaldhanaUser, asProject);
+ assertEquals(1, roleTypes.size());
+ assertTrue(roleTypes.contains(developerRT));
+
+ // and simpler...
+ assertTrue(session.getRoleManager().hasRole(asaldhanaUser, asProject, developerRT));
+
+ // Assert relationships
+
+ Collection<User> identities = session.getRelationshipManager().findAssociatedUsers(portalTeamGroup, false);
+ assertEquals(5, identities.size());
+ assertTrue(identities.contains(claprunUser));
+ assertTrue(identities.contains(mwringeUser));
+ assertTrue(identities.contains(sshahUser));
+ assertTrue(identities.contains(whalesUser));
+ assertTrue(identities.contains(bdawidowUser));
+
+ Collection<Group> groups = session.getRelationshipManager().findAssociatedGroups(rndDepartment, PROJECT, true, false);
+ assertEquals(0, groups.size());
+
+ // Check to which group Anil belongs
+ groups = session.getRelationshipManager().findAssociatedGroups(asaldhanaUser, PEOPLE);
+ assertEquals(1, groups.size());
+ assertTrue(groups.contains(employeesGroup));
+
+ // Now check sshah
+ groups = session.getRelationshipManager().findAssociatedGroups(sshahUser, PEOPLE);
+ assertEquals(2, groups.size());
+ assertTrue(groups.contains(employeesGroup));
+ assertTrue(groups.contains(portalTeamGroup));
+
+
+ // Check that binary attribute picture is mapped
+
+ AttributeDescription attributeDescription = session.getAttributesManager().getAttributeDescription(bdawidowUser, "picture");
+ assertNotNull(attributeDescription);
+ assertEquals("binary", attributeDescription.getType());
+
+
+ // Generate random binary data for binary attribute
+ Random random = new Random();
+
+ // 900 kilobytes
+ byte[] picture = new byte[921600];
+ random.nextBytes(picture);
+
+ // User attributes
+ Attribute[] userInfo = new Attribute[]
+ {
+ new SimpleAttribute(P3PConstants.INFO_USER_NAME_GIVEN, new String[]{"Boleslaw"}),
+ new SimpleAttribute(P3PConstants.INFO_USER_NAME_FAMILY, new String[]{"Dawidowicz"}),
+ new SimpleAttribute("picture", new byte[][]{picture})
+ };
+
+ session.getAttributesManager().addAttributes(bdawidowUser, userInfo);
+
+ Map<String, Attribute> attributes = session.getAttributesManager().getAttributes(bdawidowUser);
+ assertEquals(3, attributes.keySet().size());
+ assertEquals("Dawidowicz", (attributes.get(P3PConstants.INFO_USER_NAME_FAMILY)).getValue());
+ assertTrue(Arrays.equals((byte[])attributes.get("picture").getValue(), picture));
+
+
+ // Credential
+ User anotherOne = bdawidowUser; //session.getPersistenceManager().createUser("blah1");
+
+ assertTrue(session.getAttributesManager().isCredentialTypeSupported(PasswordCredential.TYPE));
+
+ // #1
+ session.getAttributesManager().updatePassword(anotherOne, "secret");
+ assertTrue(session.getAttributesManager().validatePassword(anotherOne, "secret"));
+ assertFalse(session.getAttributesManager().validatePassword(anotherOne, "secret2"));
+ assertFalse(session.getAttributesManager().validatePassword(anotherOne, "secret3"));
+
+ // #1
+ session.getAttributesManager().updatePassword(anotherOne, "secret2");
+ assertTrue(session.getAttributesManager().validatePassword(anotherOne, "secret2"));
+ assertFalse(session.getAttributesManager().validatePassword(anotherOne, "secret"));
+ assertFalse(session.getAttributesManager().validatePassword(anotherOne, "secret3"));
+
+
+ // #1
+ session.getAttributesManager().updatePassword(anotherOne, "secret3");
+ assertTrue(session.getAttributesManager().validatePassword(anotherOne, "secret3"));
+ assertFalse(session.getAttributesManager().validatePassword(anotherOne, "secret"));
+ assertFalse(session.getAttributesManager().validatePassword(anotherOne, "secret2"));
+
+
+ // #2
+ Credential password = new PasswordCredential("secretPhrase");
+ session.getAttributesManager().updateCredential(anotherOne, password);
+ assertTrue(session.getAttributesManager().validateCredentials(anotherOne, new Credential[]{password}));
+
+ // #3
+
+ if (session.getAttributesManager().isCredentialTypeSupported(BinaryCredential.TYPE))
+ {
+ // 500 kilobytes
+ byte[] cert = new byte[512000];
+ random.nextBytes(cert);
+ Credential binaryCredential = new BinaryCredential(cert);
+ session.getAttributesManager().updateCredential(anotherOne, binaryCredential);
+ assertTrue(session.getAttributesManager().validateCredentials(anotherOne, new Credential[]{binaryCredential}));
+ }
+
+
+ ctx.commit();
+
+ }
+
+ public void testSamplePortal(String realmName) throws Exception
+ {
+ String SYSTEM = "SYSTEM";
+ String ADMINISTRATION = "ADMINISTRATION";
+ String COMMUNITY = "COMMUNITY";
+ String ORGANIZATION = "ORGANIZATION";
+ String ORGANIZATION_UNIT = "ORGANIZATION_UNIT";
+ String OFFICE = "OFFICE";
+ String DIVISION = "DIVISION";
+ String DEPARTMENT = "DEPARTMENT";
+ String SECURITY = "SECURITY";
+ String PEOPLE = "PEOPLE";
+
+ IdentitySessionFactory factory = ctx.getIdentitySessionFactory();
+
+ IdentitySession session = factory.createIdentitySession(realmName);
+
+ ctx.begin();
+
+
+
+ // Create all role types
+ RoleType adminRT = session.getRoleManager().createRoleType("Admin");
+ RoleType accountAdminRT = session.getRoleManager().createRoleType("Account Admin");
+ RoleType managerRT = session.getRoleManager().createRoleType("Manager");
+ RoleType officeManagerRT = session.getRoleManager().createRoleType("Office Manager");
+ RoleType contributorRT = session.getRoleManager().createRoleType("Contributor");
+ RoleType communityOwnerRT = session.getRoleManager().createRoleType("Community Owner");
+ RoleType communityMemberRT = session.getRoleManager().createRoleType("Community Member");
+ RoleType communityForumModeratorRT = session.getRoleManager().createRoleType("Community Forum Moderator");
+ RoleType communityCMSAdminRT = session.getRoleManager().createRoleType("Community CMS Admin");
+
+
+ // Create system root groups - groups containing all communities, global security groups and organization
+
+ Group communityRootGroup = session.getPersistenceManager().createGroup("COMMUNITY_ROOT", SYSTEM);
+ Group securityRootGroup = session.getPersistenceManager().createGroup("SECURITY_ROOT", SYSTEM);
+ Group organizationRootGroup = session.getPersistenceManager().createGroup("ORGANIZATION_ROOT",SYSTEM);
+ Group usersROOTGroup = session.getPersistenceManager().createGroup("USERS_ROOT",SYSTEM);
+
+ ctx.commit();
+
+ ctx.begin();
+
+ // Communities
+
+ Group portalLoversCommunity = session.getPersistenceManager().createGroup("Portal Lovers", COMMUNITY);
+ Group baseJumpingCommunity = session.getPersistenceManager().createGroup("BASE Jumping", COMMUNITY);
+ Group geeksCommunity = session.getPersistenceManager().createGroup("Geeks", COMMUNITY);
+
+ session.getRelationshipManager().associateGroups(communityRootGroup, portalLoversCommunity);
+ session.getRelationshipManager().associateGroups(communityRootGroup, baseJumpingCommunity);
+ session.getRelationshipManager().associateGroups(communityRootGroup, geeksCommunity);
+
+ // Security groups - act like global portal roles
+
+ Group portalAdminGroup = session.getPersistenceManager().createGroup("Poral Admin", SECURITY);
+ Group cmsAdminGroup = session.getPersistenceManager().createGroup("CMS Admin", SECURITY);
+ Group userAdminGroup = session.getPersistenceManager().createGroup("User Admin", SECURITY);
+ Group cmsEditorGroup = session.getPersistenceManager().createGroup("CMS Editor", SECURITY);
+
+ session.getRelationshipManager().associateGroups(securityRootGroup, portalAdminGroup);
+ session.getRelationshipManager().associateGroups(securityRootGroup, cmsAdminGroup);
+ session.getRelationshipManager().associateGroups(securityRootGroup, userAdminGroup);
+ session.getRelationshipManager().associateGroups(securityRootGroup, cmsEditorGroup);
+
+ // Organization structure
+
+ Group acmeOrg = session.getPersistenceManager().createGroup("ACME", ORGANIZATION);
+
+ session.getRelationshipManager().associateGroups(organizationRootGroup, acmeOrg);
+
+ Group departmentsOU = session.getPersistenceManager().createGroup("Departments", ORGANIZATION_UNIT);
+ Group officesOU = session.getPersistenceManager().createGroup("Offices", ORGANIZATION_UNIT);
+ Group employeesOU = session.getPersistenceManager().createGroup("Employees", ORGANIZATION_UNIT);
+
+ session.getRelationshipManager().associateGroups(acmeOrg, departmentsOU);
+ session.getRelationshipManager().associateGroups(acmeOrg, officesOU);
+ session.getRelationshipManager().associateGroups(acmeOrg, employeesOU);
+
+ // Departments
+
+ Group hrDepart = session.getPersistenceManager().createGroup("HR", DEPARTMENT);
+ Group financeDepart = session.getPersistenceManager().createGroup("Finance", DEPARTMENT);
+ Group rndDepart = session.getPersistenceManager().createGroup("R&D", DEPARTMENT);
+
+ session.getRelationshipManager().associateGroups(departmentsOU, hrDepart);
+ session.getRelationshipManager().associateGroups(departmentsOU, financeDepart);
+ session.getRelationshipManager().associateGroups(departmentsOU, rndDepart);
+
+ // Offices
+
+ Group parisOffice =session.getPersistenceManager().createGroup("Paris", OFFICE);
+ Group londonOffice =session.getPersistenceManager().createGroup("London", OFFICE);
+ Group nyOffice =session.getPersistenceManager().createGroup("New York", OFFICE);
+
+ session.getRelationshipManager().associateGroups(officesOU, parisOffice);
+ session.getRelationshipManager().associateGroups(officesOU, londonOffice);
+ session.getRelationshipManager().associateGroups(officesOU, nyOffice);
+
+ // People
+
+ User anneUser = session.getPersistenceManager().createUser("anne");
+ User marieUser = session.getPersistenceManager().createUser("marie");
+ User eveUser = session.getPersistenceManager().createUser("eve");
+ User angelinaUser = session.getPersistenceManager().createUser("angelina");
+ User joannaUser = session.getPersistenceManager().createUser("joanna");
+ User merilUser = session.getPersistenceManager().createUser("meril");
+ User johnUser = session.getPersistenceManager().createUser("john");
+ User stanUser = session.getPersistenceManager().createUser("stan");
+ User chrisUser = session.getPersistenceManager().createUser("chris");
+ User billUser = session.getPersistenceManager().createUser("bill");
+ User jackUser = session.getPersistenceManager().createUser("jack");
+
+ ctx.commit();
+
+ ctx.begin();
+
+ // All users are under people root
+
+ session.getRelationshipManager().associateUser(usersROOTGroup, anneUser);
+ session.getRelationshipManager().associateUser(usersROOTGroup, marieUser);
+ session.getRelationshipManager().associateUser(usersROOTGroup, eveUser);
+ session.getRelationshipManager().associateUser(usersROOTGroup, angelinaUser);
+ session.getRelationshipManager().associateUser(usersROOTGroup, joannaUser);
+ session.getRelationshipManager().associateUser(usersROOTGroup, merilUser);
+ session.getRelationshipManager().associateUser(usersROOTGroup, johnUser);
+ session.getRelationshipManager().associateUser(usersROOTGroup, stanUser);
+ session.getRelationshipManager().associateUser(usersROOTGroup, chrisUser);
+ session.getRelationshipManager().associateUser(usersROOTGroup, billUser);
+ session.getRelationshipManager().associateUser(usersROOTGroup, jackUser);
+
+ ctx.commit();
+
+ ctx.begin();
+
+ //
+
+
+ // Anna is...
+
+ // Anna Smith...
+
+
+ session.getAttributesManager().addAttribute(anneUser, P3PConstants.INFO_USER_NAME_GIVEN, "Anne");
+ session.getAttributesManager().addAttribute(anneUser, P3PConstants.INFO_USER_NAME_FAMILY, "Smith");
+ session.getAttributesManager().addAttribute(anneUser, P3PConstants.INFO_USER_JOB_TITLE, "Senior Software Developer");
+ session.getAttributesManager().addAttribute(anneUser, P3PConstants.INFO_USER_BUSINESS_INFO_ONLINE_EMAIL, "anne.smith(a)acme.com");
+ session.getAttributesManager().addAttribute(anneUser, P3PConstants.INFO_USER_BUSINESS_INFO_TELECOM_MOBILE_NUMBER, "777 777 777 7 77");
+
+ // Anna works in Paris office and participates in BASE jumping community as a forum moderator and CMS admin
+
+ session.getRelationshipManager().associateUser(parisOffice, anneUser);
+
+ // Anne could be just associated with BASE jumping community group using RelationshipManager but insted Role mechanism
+ // is used to have more fine grained control of access rights inside of a community
+
+
+ session.save();
+
+ ctx.commit();
+
+ ctx.begin();
+
+ session.getRoleManager().createRole(communityMemberRT, anneUser, baseJumpingCommunity);
+ session.getRoleManager().createRole(communityForumModeratorRT, anneUser, baseJumpingCommunity);
+ session.getRoleManager().createRole(communityCMSAdminRT, anneUser, baseJumpingCommunity);
+
+ // Anne belongs to CMS portal admins security group
+
+ session.getRelationshipManager().associateUser(cmsAdminGroup, anneUser);
+
+ // Ann is also an owner of geeks community
+
+ session.getRoleManager().createRole(communityOwnerRT, anneUser, geeksCommunity);
+
+
+ //
+
+
+ // Angelina ...
+
+ session.getAttributesManager().addAttribute(angelinaUser, P3PConstants.INFO_USER_NAME_GIVEN, "Angelina");
+ session.getAttributesManager().addAttribute(angelinaUser, P3PConstants.INFO_USER_NAME_FAMILY, "Blond");
+ session.getAttributesManager().addAttribute(angelinaUser, P3PConstants.INFO_USER_JOB_TITLE, "Very important looking job title");
+ session.getAttributesManager().addAttribute(angelinaUser, P3PConstants.INFO_USER_BUSINESS_INFO_ONLINE_EMAIL, "angelina1979(a)acme.com");
+ session.getAttributesManager().addAttribute(angelinaUser, P3PConstants.INFO_USER_BUSINESS_INFO_TELECOM_MOBILE_NUMBER, "888 88 88 8888");
+
+ // She works in London and is office manager there - se both RelationshipManager and RoleManager used against
+ // the same pair of identity objects
+
+ session.getRelationshipManager().associateUser(londonOffice, angelinaUser);
+
+ session.getRoleManager().createRole(officeManagerRT, angelinaUser, londonOffice);
+
+ // Angelina is member of geeks community and manages cms content there
+
+ session.getRoleManager().createRole(communityMemberRT, angelinaUser, geeksCommunity);
+ session.getRoleManager().createRole(communityCMSAdminRT, angelinaUser, geeksCommunity);
+
+ // As office manager she also edits portal cms content
+
+ session.getRelationshipManager().associateUser(cmsEditorGroup, angelinaUser);
+
+
+ //
+
+
+ // Some assertions
+
+ // How many users do we have in whole acme org and how many people in paris and london offices
+ assertEquals(11, session.getRelationshipManager().findAssociatedUsers(usersROOTGroup, false).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedUsers(parisOffice, false).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedUsers(londonOffice, false).size());
+
+
+ // Is anne geeks community owner?
+ assertTrue(session.getRoleManager().hasRole(anneUser, geeksCommunity, communityOwnerRT));
+
+ // Does she belong to cms admins
+ assertTrue(session.getRelationshipManager().isAssociated(cmsAdminGroup, anneUser));
+
+ // Check all groups that anna belongs to
+ Collection<Group> groups = session.getRelationshipManager().findAssociatedGroups(anneUser);
+ assertEquals(3, groups.size());
+ assertTrue(groups.contains(usersROOTGroup));
+ assertTrue(groups.contains(parisOffice));
+ assertTrue(groups.contains(cmsAdminGroup));
+
+
+
+ ctx.commit();
+
+ }
+
+
+
+
+
+
+
+}
Added: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/OrganizationTestCase.java
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/OrganizationTestCase.java (rev 0)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/OrganizationTestCase.java 2009-05-09 11:10:49 UTC (rev 485)
@@ -0,0 +1,106 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.api;
+
+import org.jboss.identity.idm.impl.IdentityTestPOJO;
+import org.jboss.identity.idm.impl.configuration.IdentityConfigurationImpl;
+import org.jboss.identity.idm.api.IdentitySessionFactory;
+import org.jboss.unit.api.pojo.annotations.Create;
+import org.jboss.unit.api.pojo.annotations.Destroy;
+import org.jboss.unit.api.pojo.annotations.Test;
+import org.jboss.unit.api.pojo.annotations.Parameter;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class OrganizationTestCase extends IdentityTestPOJO implements APITestContext
+{
+ private OrganizationTest orgTest;
+
+ private IdentitySessionFactory identitySessionFactory;
+
+ private String samplePortalRealmName = "realm://portal/SamplePortal/DB";
+
+ private String sampleOrganizationRealmName = "realm://RedHat/DB";
+
+
+ @Create
+ public void setUp() throws Exception
+ {
+ super.start();
+
+ orgTest = new OrganizationTest(this);
+
+ identitySessionFactory = new IdentityConfigurationImpl().
+ configure(getIdentityConfig()).buildIdentitySessionFactory();
+ }
+
+ @Destroy
+ public void tearDown() throws Exception
+ {
+ super.stop();
+ }
+
+ public IdentitySessionFactory getIdentitySessionFactory()
+ {
+ return identitySessionFactory;
+ }
+
+ @Test
+ public void testOrganization() throws Exception
+ {
+
+ orgTest.testRedHatOrganization(getSampleOrganizationRealmName());
+ }
+
+ @Test
+ public void testSamplePortal() throws Exception
+ {
+
+ orgTest.testSamplePortal(getSamplePortalRealmName());
+
+ }
+
+ public String getSamplePortalRealmName()
+ {
+ return samplePortalRealmName;
+ }
+
+ @Parameter
+ public void setSamplePortalRealmName(String samplePortalRealmName)
+ {
+ this.samplePortalRealmName = samplePortalRealmName;
+ }
+
+ public String getSampleOrganizationRealmName()
+ {
+ return sampleOrganizationRealmName;
+ }
+
+ @Parameter
+ public void setSampleOrganizationRealmName(String sampleOrganizationRealmName)
+ {
+ this.sampleOrganizationRealmName = sampleOrganizationRealmName;
+ }
+}
\ No newline at end of file
Added: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/PersistenceManagerTest.java
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/PersistenceManagerTest.java (rev 0)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/PersistenceManagerTest.java 2009-05-09 11:10:49 UTC (rev 485)
@@ -0,0 +1,179 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.api;
+
+import org.jboss.identity.idm.api.IdentitySession;
+import org.jboss.identity.idm.api.Group;
+import org.jboss.identity.idm.api.User;
+import org.jboss.identity.idm.api.IdentitySessionFactory;
+import org.jboss.identity.idm.api.IdentitySearchCriteria;
+
+import junit.framework.Assert;
+
+/**
+ *
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class PersistenceManagerTest extends Assert
+{
+ //TODO:
+ //TODO: - force in removeGroup (NYI)
+ //TODO: - exception handling
+ //TODO: - search criteria
+ //TODO: - features description
+
+ APITestContext ctx;
+
+ private String ORGANIZATION = "ORGANIZATION";
+ private String ORGANIZATION_UNIT = "ORGANIZATION_UNIT";
+ private String DIVISION = "DIVISION";
+ private String DEPARTMENT = "DEPARTMENT";
+ private String PROJECT = "PROJECT";
+ private String PEOPLE = "PEOPLE";
+
+ public PersistenceManagerTest(APITestContext ctx)
+ {
+ this.ctx = ctx;
+ }
+
+ public void setCtx(APITestContext ctx)
+ {
+ this.ctx = ctx;
+ }
+
+ public APITestContext getCtx()
+ {
+ return ctx;
+ }
+
+ public void testMethods(String realmName) throws Exception
+ {
+ IdentitySessionFactory factory = ctx.getIdentitySessionFactory();
+
+ IdentitySession session = factory.createIdentitySession(realmName);
+
+
+
+ ctx.begin();
+
+ // Bad names
+
+ try
+ {
+ session.getPersistenceManager().createUser("lol/olo");
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ // expected
+ }
+
+ try
+ {
+ session.getPersistenceManager().createGroup("/toto", ORGANIZATION);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ // expected
+ }
+
+
+ // Create / Remove
+
+ // Group
+ Group group1 = session.getPersistenceManager().createGroup("groupName1", ORGANIZATION);
+
+ assertNotNull(group1);
+ assertEquals(group1.getGroupType(), ORGANIZATION);
+ assertEquals(group1.getName(), "groupName1");
+
+
+ String group1Id = session.getPersistenceManager().createGroupId("groupName1", ORGANIZATION);
+
+ assertEquals(group1Id, group1.getId());
+
+ session.getPersistenceManager().createGroup("groupName2", ORGANIZATION);
+ session.getPersistenceManager().createGroup("groupName3", PROJECT);
+
+ assertEquals(2, session.getPersistenceManager().getGroupTypeCount(ORGANIZATION));
+ assertEquals(1, session.getPersistenceManager().getGroupTypeCount(PROJECT));
+ assertEquals(0, session.getPersistenceManager().getGroupTypeCount(DEPARTMENT));
+
+ assertEquals(2, session.getPersistenceManager().findGroup(ORGANIZATION).size());
+ assertEquals(1, session.getPersistenceManager().findGroup(PROJECT).size());
+ assertEquals(0, session.getPersistenceManager().findGroup(DEPARTMENT).size());
+
+ session.getPersistenceManager().removeGroup(group1, false);
+ String id = session.getPersistenceManager().createGroupId("groupName2", ORGANIZATION);
+ session.getPersistenceManager().removeGroup(id, false);
+ id = session.getPersistenceManager().createGroupId("groupName3", PROJECT);
+ session.getPersistenceManager().removeGroup(id, false);
+
+ assertEquals(0, session.getPersistenceManager().findGroup(ORGANIZATION, (IdentitySearchCriteria)null).size());
+ assertEquals(0, session.getPersistenceManager().findGroup(PROJECT).size());
+ assertEquals(0, session.getPersistenceManager().findGroup(DEPARTMENT).size());
+
+ assertEquals(0, session.getPersistenceManager().getGroupTypeCount(ORGANIZATION));
+ assertEquals(0, session.getPersistenceManager().getGroupTypeCount(PROJECT));
+ assertEquals(0, session.getPersistenceManager().getGroupTypeCount(DEPARTMENT));
+
+
+ //User
+
+ User u1 = session.getPersistenceManager().createUser("olo");
+
+ assertNotNull(u1);
+ assertEquals(u1.getId(), "olo");
+
+ session.getPersistenceManager().createUser("anna");
+
+ assertEquals(2, session.getPersistenceManager().getUserCount());
+
+ assertNotNull(session.getPersistenceManager().findUser("olo"));
+ assertNotNull(session.getPersistenceManager().findUser("anna"));
+
+ //TODO: this should throw some meaningfull exception or simply return null
+ //assertNull(session.getPersistenceManager().findUser("olaf"));
+
+ assertEquals(2, session.getPersistenceManager().findUser((IdentitySearchCriteria)null).size());
+
+ session.getPersistenceManager().removeUser(u1, false);
+
+ assertEquals(1, session.getPersistenceManager().getUserCount());
+
+ session.getPersistenceManager().removeUser("anna", false);
+
+ assertEquals(0, session.getPersistenceManager().getUserCount());
+
+ assertEquals(0, session.getPersistenceManager().findUser((IdentitySearchCriteria)null).size());
+
+
+ ctx.commit();
+
+ }
+
+
+
+}
\ No newline at end of file
Added: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/RelationshipManagerTest.java
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/RelationshipManagerTest.java (rev 0)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/RelationshipManagerTest.java 2009-05-09 11:10:49 UTC (rev 485)
@@ -0,0 +1,370 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.api;
+
+import org.jboss.identity.idm.api.IdentitySession;
+import org.jboss.identity.idm.api.Group;
+import org.jboss.identity.idm.api.User;
+import org.jboss.identity.idm.api.IdentitySessionFactory;
+import org.jboss.identity.idm.api.IdentitySearchCriteria;
+
+import java.util.Arrays;
+
+import junit.framework.Assert;
+
+/**
+ *
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class RelationshipManagerTest extends Assert
+{
+ //TODO:
+ //TODO: - inheritence in find methods
+ //TODO: - creating forbidden associations
+ //TODO: - exception handling
+ //TODO: - search criteria
+ //TODO: - features description
+
+ APITestContext ctx;
+
+ private String ORGANIZATION = "ORGANIZATION";
+ private String ORGANIZATION_UNIT = "ORGANIZATION_UNIT";
+ private String DIVISION = "DIVISION";
+ private String DEPARTMENT = "DEPARTMENT";
+ private String PROJECT = "PROJECT";
+ private String PEOPLE = "PEOPLE";
+
+ public RelationshipManagerTest(APITestContext ctx)
+ {
+ this.ctx = ctx;
+ }
+
+ public void setCtx(APITestContext ctx)
+ {
+ this.ctx = ctx;
+ }
+
+ public APITestContext getCtx()
+ {
+ return ctx;
+ }
+
+ public void testMethods(String realmName) throws Exception
+ {
+ IdentitySessionFactory factory = ctx.getIdentitySessionFactory();
+
+ IdentitySession session = factory.createIdentitySession(realmName);
+
+ ctx.begin();
+
+ // Create stuff
+ User user1 = session.getPersistenceManager().createUser("user1");
+ User user2 = session.getPersistenceManager().createUser("user2");
+ User user3 = session.getPersistenceManager().createUser("user3");
+ User user4 = session.getPersistenceManager().createUser("user4");
+
+ Group group1 = session.getPersistenceManager().createGroup("group1", ORGANIZATION);
+ Group group2 = session.getPersistenceManager().createGroup("group2", ORGANIZATION_UNIT);
+ Group group3 = session.getPersistenceManager().createGroup("group3", ORGANIZATION_UNIT);
+ Group group4 = session.getPersistenceManager().createGroup("group4", DEPARTMENT);
+ Group group5 = session.getPersistenceManager().createGroup("group5", DEPARTMENT);
+
+
+ // Associate groups
+
+ session.getRelationshipManager().associateGroups(group1, group2);
+ session.getRelationshipManager().associateGroups(group1, group3);
+
+ // Assert
+
+ // isAssociated
+
+ assertTrue(session.getRelationshipManager().isAssociated(group1, group2));
+ assertTrue(session.getRelationshipManager().isAssociated(group1, group3));
+ assertFalse(session.getRelationshipManager().isAssociated(group1, group4));
+ assertFalse(session.getRelationshipManager().isAssociated(group2, group1));
+ assertFalse(session.getRelationshipManager().isAssociated(group2, group3));
+
+ assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1), Arrays.asList(group2, group3)));
+ assertFalse(session.getRelationshipManager().isAssociated(Arrays.asList(group1, group2), Arrays.asList(group2, group3)));
+ assertFalse(session.getRelationshipManager().isAssociated(Arrays.asList(group2, group3), Arrays.asList(group1)));
+
+ assertTrue(session.getRelationshipManager().isAssociatedByIds(group1.getId(), group2.getId()));
+ assertTrue(session.getRelationshipManager().isAssociatedByIds(group1.getId(), group3.getId()));
+ assertFalse(session.getRelationshipManager().isAssociatedByIds(group1.getId(), group4.getId()));
+ assertFalse(session.getRelationshipManager().isAssociatedByIds(group2.getId(), group1.getId()));
+ assertFalse(session.getRelationshipManager().isAssociatedByIds(group2.getId(), group3.getId()));
+
+ assertTrue(session.getRelationshipManager().
+ isAssociatedByIds(Arrays.asList(group1.getId()), Arrays.asList(group2.getId(), group3.getId())));
+ assertFalse(session.getRelationshipManager().
+ isAssociatedByIds(Arrays.asList(group1.getId(), group2.getId()), Arrays.asList(group2.getId(), group3.getId())));
+ assertFalse(session.getRelationshipManager().
+ isAssociatedByIds(Arrays.asList(group2.getId(), group3.getId()), Arrays.asList(group1.getId())));
+
+
+ // Associate groups - other methods
+
+ // First disassociate and assert
+ session.getRelationshipManager().disassociateGroups(Arrays.asList(group1), Arrays.asList(group2, group3));
+
+ assertFalse(session.getRelationshipManager().isAssociated(group1, group2));
+ assertFalse(session.getRelationshipManager().isAssociated(group1, group3));
+
+ // reassociate #1
+ session.getRelationshipManager().associateGroups(Arrays.asList(group1), Arrays.asList(group2, group3));
+ assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1), Arrays.asList(group2, group3)));
+
+ session.getRelationshipManager().disassociateGroupsByIds(Arrays.asList(group1.getId()), Arrays.asList(group2.getId(), group3.getId()));
+
+ // reassociate #2
+ session.getRelationshipManager().associateGroupsByIds(Arrays.asList(group1.getId()), Arrays.asList(group2.getId(), group3.getId()));
+ assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1), Arrays.asList(group2, group3)));
+
+ session.getRelationshipManager().disassociateGroups(Arrays.asList(group1), Arrays.asList(group2, group3));
+
+ // reassociate #3
+ session.getRelationshipManager().associateGroupsByIds(group1.getId(), group2.getId());
+ session.getRelationshipManager().associateGroupsByIds(group1.getId(), group3.getId());
+ assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1), Arrays.asList(group2, group3)));
+
+ session.getRelationshipManager().disassociateGroups(Arrays.asList(group1), Arrays.asList(group2, group3));
+
+
+ // Associate Group and Users
+
+ session.getRelationshipManager().associateUser(group1, user1);
+ session.getRelationshipManager().associateUser(group1, user2);
+
+ // isAssociated
+
+ assertTrue(session.getRelationshipManager().isAssociated(group1, user1));
+ assertTrue(session.getRelationshipManager().isAssociated(group1, user2));
+ assertFalse(session.getRelationshipManager().isAssociated(group1, user3));
+ assertFalse(session.getRelationshipManager().isAssociated(group2, user1));
+ assertFalse(session.getRelationshipManager().isAssociated(group2, user3));
+
+ assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1), Arrays.asList(user1, user2)));
+ assertFalse(session.getRelationshipManager().isAssociated(Arrays.asList(group1, group2), Arrays.asList(user1, user2)));
+ assertFalse(session.getRelationshipManager().isAssociated(Arrays.asList(group2), Arrays.asList(user3)));
+
+ assertTrue(session.getRelationshipManager().isAssociatedByIds(group1.getId(), user1.getId()));
+ assertTrue(session.getRelationshipManager().isAssociatedByIds(group1.getId(), user2.getId()));
+ assertFalse(session.getRelationshipManager().isAssociatedByIds(group1.getId(), user3.getId()));
+ assertFalse(session.getRelationshipManager().isAssociatedByIds(group2.getId(), user1.getId()));
+ assertFalse(session.getRelationshipManager().isAssociatedByIds(group2.getId(), user3.getId()));
+
+ assertTrue(session.getRelationshipManager().
+ isAssociatedByIds(Arrays.asList(group1.getId()), Arrays.asList(user1.getId(), user2.getId())));
+ assertFalse(session.getRelationshipManager().
+ isAssociatedByIds(Arrays.asList(group1.getId(), group2.getId()), Arrays.asList(user1.getId(), user2.getId())));
+ assertFalse(session.getRelationshipManager().
+ isAssociatedByIds(Arrays.asList(group2.getId(), group3.getId()), Arrays.asList(user1.getId())));
+
+
+ // Associate groups / users - other methods
+
+ // First disassociate and assert
+ session.getRelationshipManager().disassociateUsers(Arrays.asList(group1), Arrays.asList(user1, user2));
+
+ assertFalse(session.getRelationshipManager().isAssociated(group1, user1));
+ assertFalse(session.getRelationshipManager().isAssociated(group1, user2));
+
+ // reassociate #1
+ session.getRelationshipManager().associateUsers(Arrays.asList(group1), Arrays.asList(user1, user2));
+ assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1), Arrays.asList(user1, user2)));
+
+ session.getRelationshipManager().disassociateUsers(Arrays.asList(group1), Arrays.asList(user1, user2));
+
+ // reassociate #2
+ session.getRelationshipManager().associateUsersByIds(Arrays.asList(group1.getId()), Arrays.asList(user1.getId(), user2.getId()));
+ assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1), Arrays.asList(user1, user2)));
+
+ session.getRelationshipManager().disassociateUsersByIds(Arrays.asList(group1.getId()), Arrays.asList(user1.getId(), user2.getId()));
+
+ // reassociate #3
+ session.getRelationshipManager().associateUserByIds(group1.getId(), user1.getId());
+ session.getRelationshipManager().associateUserByIds(group1.getId(), user2.getId());
+
+ assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1), Arrays.asList(user1, user2)));
+
+ session.getRelationshipManager().disassociateUsers(Arrays.asList(group1), Arrays.asList(user1, user2));
+
+
+ ctx.commit();
+
+ ctx.begin();
+
+
+ // Find methods - prepopulate
+
+ session.getRelationshipManager().associateUsers(Arrays.asList(group1), Arrays.asList(user1, user2, user3));
+ session.getRelationshipManager().associateUsers(Arrays.asList(group3), Arrays.asList(user2, user3));
+ session.getRelationshipManager().associateGroups(Arrays.asList(group2), Arrays.asList(group3, group4, group5));
+
+ assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1), Arrays.asList(user1, user2, user3)));
+ assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group2), Arrays.asList(group3, group4, group5)));
+ assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group3), Arrays.asList(user2, user3)));
+
+ ctx.commit();
+ ctx.begin();
+
+ // Find users
+ //TODO: check if collections contain correct objects (not only size)
+
+ assertEquals(3, session.getRelationshipManager().findAssociatedUsers(group1, false).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedUsers(group2, false).size());
+
+ assertEquals(3, session.getRelationshipManager().findAssociatedUsers(group1, false, null).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedUsers(group2, false, null).size());
+
+ assertEquals(3, session.getRelationshipManager().findAssociatedUsers(group1.getId(), false, null).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedUsers(group2.getId(), false, null).size());
+
+ // Find groups
+
+ // #1
+ assertEquals(3, session.getRelationshipManager().findAssociatedGroups(group2, null, true, false).size());
+ assertEquals(2, session.getRelationshipManager().findAssociatedGroups(group2, DEPARTMENT, true, false).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(group2, ORGANIZATION_UNIT, true, false).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedGroups(group2, ORGANIZATION, true, false).size());
+
+ // #1
+ assertEquals(2, session.getRelationshipManager().findAssociatedGroups(group2.getId(), DEPARTMENT, true, false, null).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(group2.getId(), ORGANIZATION_UNIT, true, false, null).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedGroups(group2.getId(), ORGANIZATION, true, false, null).size());
+
+ // #3
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(group3, ORGANIZATION_UNIT, false, false).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(group4, ORGANIZATION_UNIT, false, false).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedGroups(group2, ORGANIZATION, false, false).size());
+ assertEquals(3, session.getRelationshipManager().findAssociatedGroups(group2, null, true, false).size());
+
+ // #4
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(group3.getId(), ORGANIZATION_UNIT, false, false, null).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(group4.getId(), ORGANIZATION_UNIT, false, false, null).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedGroups(group2.getId(), ORGANIZATION, false, false, null).size());
+
+ // #5
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user1).size());
+ assertEquals(2, session.getRelationshipManager().findAssociatedGroups(user2).size());
+ assertEquals(2, session.getRelationshipManager().findAssociatedGroups(user3).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user4).size());
+
+ // #6
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user1.getId(), null).size());
+ assertEquals(2, session.getRelationshipManager().findAssociatedGroups(user2.getId(), null).size());
+ assertEquals(2, session.getRelationshipManager().findAssociatedGroups(user3.getId(), null).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user4.getId(), null).size());
+
+ // #7
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user1, ORGANIZATION).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user1, ORGANIZATION_UNIT).size());
+ assertEquals(2, session.getRelationshipManager().findAssociatedGroups(user2, (String)null).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user2, ORGANIZATION).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user2, ORGANIZATION_UNIT).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user3, ORGANIZATION).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user3, ORGANIZATION_UNIT).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user4, ORGANIZATION).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user4, ORGANIZATION_UNIT).size());
+
+ // #7
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user1.getId(), ORGANIZATION, null).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user1.getId(), ORGANIZATION_UNIT, null).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user2.getId(), ORGANIZATION, null).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user2.getId(), ORGANIZATION_UNIT, null).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user3.getId(), ORGANIZATION, null).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user3.getId(), ORGANIZATION_UNIT, null).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user4.getId(), ORGANIZATION, null).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user4.getId(), ORGANIZATION_UNIT, null).size());
+
+ // Cleanup and check
+ session.getRelationshipManager().disassociateUsers(Arrays.asList(group1), Arrays.asList(user1, user2, user3));
+ session.getRelationshipManager().disassociateUsers(Arrays.asList(group3), Arrays.asList(user2, user3));
+ session.getRelationshipManager().disassociateGroups(Arrays.asList(group2), Arrays.asList(group3, group4));
+
+ assertFalse(session.getRelationshipManager().isAssociated(Arrays.asList(group1), Arrays.asList(user1, user2, user3)));
+ assertFalse(session.getRelationshipManager().isAssociated(Arrays.asList(group2), Arrays.asList(group3, group4, group5)));
+ assertFalse(session.getRelationshipManager().isAssociated(Arrays.asList(group3), Arrays.asList(user2, user3)));
+
+ ctx.commit();
+
+ }
+
+ public void testMergedRoleAssociations(String realmName) throws Exception
+ {
+ IdentitySessionFactory factory = ctx.getIdentitySessionFactory();
+
+ IdentitySession session = factory.createIdentitySession(realmName);
+
+ ctx.begin();
+
+ // Create stuff
+ User user1 = session.getPersistenceManager().createUser("user1");
+ User user2 = session.getPersistenceManager().createUser("user2");
+ User user3 = session.getPersistenceManager().createUser("user3");
+ User user4 = session.getPersistenceManager().createUser("user4");
+
+ Group group1 = session.getPersistenceManager().createGroup("group1", ORGANIZATION);
+ Group group2 = session.getPersistenceManager().createGroup("group2", ORGANIZATION_UNIT);
+ Group group3 = session.getPersistenceManager().createGroup("group3", ORGANIZATION_UNIT);
+ Group group4 = session.getPersistenceManager().createGroup("group4", DEPARTMENT);
+ Group group5 = session.getPersistenceManager().createGroup("group5", DEPARTMENT);
+
+ // Associate
+
+ session.getRelationshipManager().associateGroups(group1, group2);
+ session.getRelationshipManager().associateGroups(group1, group3);
+ session.getRelationshipManager().associateUser(group1, user1);
+ session.getRelationshipManager().associateUser(group1, user2);
+
+ session.getRoleManager().createRoleType("rt1");
+ session.getRoleManager().createRoleType("rt2");
+
+ session.getRoleManager().createRole("rt1", user1.getId(), group1.getId());
+ session.getRoleManager().createRole("rt1", user3.getId(), group1.getId());
+ session.getRoleManager().createRole("rt1", user4.getId(), group1.getId());
+ session.getRoleManager().createRole("rt2", user3.getId(), group1.getId());
+
+ session.getRoleManager().createRole("rt1", user3.getId(), group2.getId());
+ session.getRoleManager().createRole("rt2", user2.getId(), group3.getId());
+
+ // Assert
+
+ assertEquals(2, session.getRelationshipManager().findAssociatedUsers(group1, false, null).size());
+ assertEquals(4, session.getRelationshipManager().findRelatedUsers(group1, null).size());
+
+ assertEquals(0, session.getRelationshipManager().findAssociatedUsers(group2, false, null).size());
+ assertEquals(1, session.getRelationshipManager().findRelatedUsers(group2, null).size());
+
+ assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user3, (IdentitySearchCriteria)null).size());
+ assertEquals(2, session.getRelationshipManager().findRelatedGroups(user3, null, null).size());
+
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user2, (IdentitySearchCriteria)null).size());
+ assertEquals(2, session.getRelationshipManager().findRelatedGroups(user2, null, null).size());
+
+ ctx.commit();
+
+ }
+}
\ No newline at end of file
Added: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/RoleManagerTest.java
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/RoleManagerTest.java (rev 0)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/RoleManagerTest.java 2009-05-09 11:10:49 UTC (rev 485)
@@ -0,0 +1,287 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.api;
+
+import org.jboss.identity.idm.api.IdentitySession;
+import org.jboss.identity.idm.api.Group;
+import org.jboss.identity.idm.api.User;
+import org.jboss.identity.idm.api.RoleType;
+import org.jboss.identity.idm.api.IdentitySessionFactory;
+import org.jboss.identity.idm.api.Role;
+
+import junit.framework.Assert;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ *
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class RoleManagerTest extends Assert
+{
+ //TODO:
+ //TODO: - exception handling
+ //TODO: - search criteria
+ //TODO: - features description
+
+ APITestContext ctx;
+
+ private String ORGANIZATION = "ORGANIZATION";
+ private String ORGANIZATION_UNIT = "ORGANIZATION_UNIT";
+ private String DIVISION = "DIVISION";
+ private String DEPARTMENT = "DEPARTMENT";
+ private String PROJECT = "PROJECT";
+ private String PEOPLE = "PEOPLE";
+
+ public RoleManagerTest(APITestContext ctx)
+ {
+ this.ctx = ctx;
+ }
+
+ public void setCtx(APITestContext ctx)
+ {
+ this.ctx = ctx;
+ }
+
+ public APITestContext getCtx()
+ {
+ return ctx;
+ }
+
+ public void testMethods(String realmName) throws Exception
+ {
+ IdentitySessionFactory factory = ctx.getIdentitySessionFactory();
+
+ IdentitySession session = factory.createIdentitySession(realmName);
+
+ ctx.begin();
+
+
+
+ // RoleTypes - pure
+ assertEquals(0, session.getRoleManager().findRoleTypes(null).size());
+
+ // Create / remove
+ RoleType rt1 = session.getRoleManager().createRoleType("rt1");
+ RoleType rt2 = session.getRoleManager().createRoleType("rt2");
+ RoleType rt3 = session.getRoleManager().createRoleType("rt3");
+ RoleType rt4 = session.getRoleManager().createRoleType("rt4");
+
+ assertEquals(4, session.getRoleManager().findRoleTypes(null).size());
+
+ session.getRoleManager().removeRoleType(rt1);
+ session.getRoleManager().removeRoleType(rt2);
+
+ assertEquals(2, session.getRoleManager().findRoleTypes(null).size());
+
+ session.getRoleManager().removeRoleType("rt3");
+ session.getRoleManager().removeRoleType("rt4");
+
+ assertEquals(0, session.getRoleManager().findRoleTypes(null).size());
+
+ // Create all entities for tests
+
+ User user1 = session.getPersistenceManager().createUser("user1");
+ User user2 = session.getPersistenceManager().createUser("user2");
+ User user3 = session.getPersistenceManager().createUser("user3");
+ User user4 = session.getPersistenceManager().createUser("user4");
+
+ Group group1 = session.getPersistenceManager().createGroup("group1", ORGANIZATION);
+ Group group2 = session.getPersistenceManager().createGroup("group2", ORGANIZATION_UNIT);
+ Group group3 = session.getPersistenceManager().createGroup("group3", ORGANIZATION_UNIT);
+ Group group4 = session.getPersistenceManager().createGroup("group4", DEPARTMENT);
+ Group group5 = session.getPersistenceManager().createGroup("group5", DEPARTMENT);
+
+ rt1 = session.getRoleManager().createRoleType("rt1");
+ rt2 = session.getRoleManager().createRoleType("rt2");
+ rt3 = session.getRoleManager().createRoleType("rt3");
+ rt4 = session.getRoleManager().createRoleType("rt4");
+
+ assertEquals(4, session.getRoleManager().findRoleTypes(null).size());
+
+
+
+
+ // Create/remove and find roles
+
+ Role role1 = session.getRoleManager().createRole(rt1, user1, group1);
+ Role role2 = session.getRoleManager().createRole(rt1, user1, group2);
+ Role role3 = session.getRoleManager().createRole("rt2", user1.getId(), group1.getId());
+
+
+
+
+ //
+
+ assertEquals(2, session.getRoleManager().findRoles(user1, rt1).size());
+ assertEquals(1, session.getRoleManager().findRoles(user1, rt2).size());
+ assertEquals(1, session.getRoleManager().findRoles(group1, rt1).size());
+ assertEquals(1, session.getRoleManager().findRoles(group1, rt2).size());
+
+ //
+
+ assertEquals(2, session.getRoleManager().findGroupRoleTypes(group1).size());
+ assertEquals(1, session.getRoleManager().findGroupRoleTypes(group2.getId(), null).size());
+
+ //
+
+ assertEquals(2, session.getRoleManager().findRoles(user1, rt1).size());
+ assertEquals(1, session.getRoleManager().findRoles(user1.getId(), "rt2").size());
+ assertEquals(1, session.getRoleManager().findRoles(group1.getId(), "rt1").size());
+ assertEquals(1, session.getRoleManager().findRoles(group1, rt1).size());
+
+ //
+
+ assertEquals(2, session.getRoleManager().findGroupsWithRelatedRole(user1, null).size());
+ assertEquals(1, session.getRoleManager().findGroupsWithRelatedRole(user1.getId(), ORGANIZATION, null).size());
+
+ //
+
+ assertEquals(2, session.getRoleManager().findRoleTypes(user1, group1).size());
+ assertEquals(1, session.getRoleManager().findRoleTypes(user1.getId(), group2.getId(), null).size());
+
+ //
+
+ assertEquals(2, session.getRoleManager().findUserRoleTypes(user1).size());
+ assertEquals(0, session.getRoleManager().findUserRoleTypes(user2.getId(), null).size());
+
+ //
+ assertTrue(session.getRoleManager().hasRole(user1, group1, rt1));
+ assertTrue(session.getRoleManager().hasRole(user1, group1, rt2));
+ assertTrue(session.getRoleManager().hasRole("user1", group2.getId(), "rt1"));
+ assertFalse(session.getRoleManager().hasRole("user2", group2.getId(), "rt1"));
+ assertFalse(session.getRoleManager().hasRole(user1, group1, rt3));
+ assertFalse(session.getRoleManager().hasRole(user1, group4, rt3));
+
+ // Role properties
+
+ assertEquals(0, session.getRoleManager().getProperties(role1).keySet().size());
+ assertEquals(0, session.getRoleManager().getProperties(rt1).keySet().size());
+ assertEquals(0, session.getRoleManager().getProperties(rt1.getName()).keySet().size());
+
+ session.getRoleManager().setProperty(role1, "roleProp1", "val1");
+ session.getRoleManager().setProperty(role1, "roleProp1", "val2");
+ session.getRoleManager().setProperty(role1, "roleProp2", "val1");
+ session.getRoleManager().setProperty(rt1, "rtProp1", "val1");
+ session.getRoleManager().setProperty(rt1.getName(), "rtProp1", "val2");
+ session.getRoleManager().setProperty(rt1, "rtProp2", "val1");
+ session.getRoleManager().setProperty(rt1, "rtProp3", "val1");
+
+ assertEquals(2, session.getRoleManager().getProperties(role1).keySet().size());
+ assertEquals(3, session.getRoleManager().getProperties(rt1).keySet().size());
+ assertEquals(3, session.getRoleManager().getProperties(rt1.getName()).keySet().size());
+
+ assertEquals("val2", session.getRoleManager().getProperties(role1).get("roleProp1"));
+ assertEquals("val1", session.getRoleManager().getProperties(role1).get("roleProp2"));
+ assertEquals("val2", session.getRoleManager().getProperties(rt1).get("rtProp1"));
+ assertEquals("val1", session.getRoleManager().getProperties(rt1).get("rtProp2"));
+ assertEquals("val1", session.getRoleManager().getProperties(rt1).get("rtProp3"));
+
+
+ Map<String, String> props = new HashMap<String, String>();
+ props.put("prop5", "val1");
+
+ session.getRoleManager().setProperties(role2, props);
+
+ assertEquals(1, session.getRoleManager().getProperties(role2).keySet().size());
+
+ assertEquals("val1", session.getRoleManager().getProperties(role2).get("prop5"));
+
+
+ props.put("prop6", "val3");
+ session.getRoleManager().setProperties(rt2, props);
+ session.getRoleManager().setProperties(rt3.getName(), props);
+
+ assertEquals(2, session.getRoleManager().getProperties(rt2).keySet().size());
+
+ assertEquals("val3", session.getRoleManager().getProperties(rt2).get("prop6"));
+ assertEquals("val3", session.getRoleManager().getProperties(rt3).get("prop6"));
+
+
+ session.getRoleManager().removeProperty(role2, "prop5");
+ assertEquals(0, session.getRoleManager().getProperties(role2).keySet().size());
+
+ session.getRoleManager().removeProperty(rt2, "prop6");
+ assertEquals(1, session.getRoleManager().getProperties(rt2).keySet().size());
+ session.getRoleManager().removeProperty(rt2, "prop5");
+ assertEquals(0, session.getRoleManager().getProperties(rt2).keySet().size());
+
+
+ // Remove roles
+
+ session.getRoleManager().removeRole(rt1, user1, group1);
+ session.getRoleManager().removeRole(role2);
+ session.getRoleManager().removeRole("rt2", user1.getId(), group1.getId());
+
+ assertFalse(session.getRoleManager().hasRole(user1, group1, rt1));
+ assertFalse(session.getRoleManager().hasRole(user1, group1, rt2));
+ assertFalse(session.getRoleManager().hasRole("user1", group2.getId(), "rt1"));
+
+ //
+
+ assertEquals(0, session.getRoleManager().findRoles(user1, rt1).size());
+ assertEquals(0, session.getRoleManager().findRoles(user1, rt2).size());
+ assertEquals(0, session.getRoleManager().findRoles(group1, rt1).size());
+ assertEquals(0, session.getRoleManager().findRoles(group1, rt2).size());
+
+ //
+
+ assertEquals(0, session.getRoleManager().findGroupRoleTypes(group1).size());
+ assertEquals(0, session.getRoleManager().findGroupRoleTypes(group2.getId(), null).size());
+
+ //
+
+ assertEquals(0, session.getRoleManager().findRoles(user1, rt1).size());
+ assertEquals(0, session.getRoleManager().findRoles(user1.getId(), "rt2").size());
+ assertEquals(0, session.getRoleManager().findRoles(group1.getId(), "rt1").size());
+ assertEquals(0, session.getRoleManager().findRoles(group1, rt1).size());
+
+ //
+
+ assertEquals(0, session.getRoleManager().findGroupsWithRelatedRole(user1, null).size());
+ assertEquals(0, session.getRoleManager().findGroupsWithRelatedRole(user1.getId(), ORGANIZATION, null).size());
+
+ //
+
+ assertEquals(0, session.getRoleManager().findRoleTypes(user1, group1).size());
+ assertEquals(0, session.getRoleManager().findRoleTypes(user1.getId(), group2.getId(), null).size());
+
+ //
+
+ assertEquals(0, session.getRoleManager().findUserRoleTypes(user1).size());
+ assertEquals(0, session.getRoleManager().findUserRoleTypes(user2.getId(), null).size());
+
+
+
+
+ ctx.commit();
+
+ }
+
+
+
+}
\ No newline at end of file
Added: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/RoleQueryTest.java
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/RoleQueryTest.java (rev 0)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/RoleQueryTest.java 2009-05-09 11:10:49 UTC (rev 485)
@@ -0,0 +1,116 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.api;
+
+import org.jboss.identity.idm.api.IdentitySession;
+import org.jboss.identity.idm.api.User;
+import org.jboss.identity.idm.api.Group;
+import org.jboss.identity.idm.api.RoleType;
+import org.jboss.identity.idm.api.Role;
+import org.jboss.identity.idm.api.query.RoleQueryBuilder;
+import org.jboss.identity.idm.api.query.RoleQuery;
+import junit.framework.Assert;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class RoleQueryTest extends Assert
+{
+ private APITestContext ctx;
+
+ private String ORGANIZATION = "ORGANIZATION";
+ private String ORGANIZATION_UNIT = "ORGANIZATION_UNIT";
+ private String DEPARTMENT = "DEPARTMENT";
+
+ public RoleQueryTest(APITestContext testContext)
+ {
+ this.ctx = testContext;
+ }
+
+ public void testQuery(String realmName) throws Exception
+ {
+ ctx.begin();
+
+ IdentitySession ids = ctx.getIdentitySessionFactory().getCurrentIdentitySession(realmName);
+
+ // Create some stuff...
+
+ User user1 = ids.getPersistenceManager().createUser("user1");
+ User user2 = ids.getPersistenceManager().createUser("user2");
+ User user3 = ids.getPersistenceManager().createUser("user3");
+ User user4 = ids.getPersistenceManager().createUser("user4");
+
+ Group group1 = ids.getPersistenceManager().createGroup("group1", ORGANIZATION);
+ Group group2 = ids.getPersistenceManager().createGroup("group2", ORGANIZATION_UNIT);
+ Group group3 = ids.getPersistenceManager().createGroup("group3", ORGANIZATION_UNIT);
+ Group group4 = ids.getPersistenceManager().createGroup("group4", DEPARTMENT);
+ Group group5 = ids.getPersistenceManager().createGroup("group5", DEPARTMENT);
+
+ RoleType rt1 = ids.getRoleManager().createRoleType("rt1");
+ RoleType rt2 = ids.getRoleManager().createRoleType("rt2");
+ RoleType rt3 = ids.getRoleManager().createRoleType("rt3");
+ RoleType rt4 = ids.getRoleManager().createRoleType("rt4");
+
+ Role role1 = ids.getRoleManager().createRole(rt1, user1, group1);
+ Role role2 = ids.getRoleManager().createRole(rt1, user1, group2);
+ Role role3 = ids.getRoleManager().createRole("rt2", user1.getId(), group1.getId());
+
+ // Test Query
+
+ //
+ RoleQueryBuilder rqb = ids.createRoleQueryBuilder();
+
+ rqb.setUser("user1");
+
+ RoleQuery rq = rqb.createQuery();
+
+ assertEquals(3, ids.execute(rq).size());
+
+ //
+ rqb.setGroup(group1);
+ rq = rqb.createQuery();
+
+ assertEquals(2, ids.execute(rq).size());
+
+ //
+ rqb.setRoleType(rt2);
+ rq = rqb.createQuery();
+
+ assertEquals(1, ids.execute(rq).size());
+
+
+ //
+ rqb.reset();
+
+ rqb.setGroup(group2);
+ rqb.setRoleType(rt1);
+
+ rq = rqb.createQuery();
+
+ assertEquals(1, ids.execute(rq).size());
+ assertEquals(role2, ids.uniqueResult(rq));
+
+ ctx.commit();
+ }
+}
Added: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/UserQueryTest.java
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/UserQueryTest.java (rev 0)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/UserQueryTest.java 2009-05-09 11:10:49 UTC (rev 485)
@@ -0,0 +1,218 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.api;
+
+import org.jboss.identity.idm.api.IdentitySession;
+import org.jboss.identity.idm.api.User;
+import org.jboss.identity.idm.api.Group;
+import org.jboss.identity.idm.api.RoleType;
+import org.jboss.identity.idm.api.Role;
+import org.jboss.identity.idm.api.SortOrder;
+import org.jboss.identity.idm.api.query.UserQuery;
+import org.jboss.identity.idm.api.query.UserQueryBuilder;
+import junit.framework.Assert;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class UserQueryTest extends Assert
+{
+ private APITestContext ctx;
+
+ private String ORGANIZATION = "ORGANIZATION";
+
+ private String ORGANIZATION_UNIT = "ORGANIZATION_UNIT";
+
+ private String DEPARTMENT = "DEPARTMENT";
+
+ public UserQueryTest(APITestContext testContext)
+ {
+ this.ctx = testContext;
+ }
+
+ public void testQuery(String realmName) throws Exception
+ {
+ ctx.begin();
+
+ IdentitySession ids = ctx.getIdentitySessionFactory().getCurrentIdentitySession(realmName);
+
+ // Create stuff
+
+ User user1 = ids.getPersistenceManager().createUser("user1");
+ User user2 = ids.getPersistenceManager().createUser("user2");
+ User user3 = ids.getPersistenceManager().createUser("user3");
+ User user4 = ids.getPersistenceManager().createUser("user4");
+ User testUser1 = ids.getPersistenceManager().createUser("testUser1");
+ User testUser2 = ids.getPersistenceManager().createUser("testUser2");
+ User testUser3 = ids.getPersistenceManager().createUser("testUser3");
+ User testUser4 = ids.getPersistenceManager().createUser("testUser4");
+
+ Group group1 = ids.getPersistenceManager().createGroup("group1", ORGANIZATION);
+ Group group2 = ids.getPersistenceManager().createGroup("group2", ORGANIZATION_UNIT);
+ Group group3 = ids.getPersistenceManager().createGroup("group3", ORGANIZATION_UNIT);
+ Group group4 = ids.getPersistenceManager().createGroup("group4", DEPARTMENT);
+ Group group5 = ids.getPersistenceManager().createGroup("group5", DEPARTMENT);
+
+ ids.getRelationshipManager().associateUser(group1, user1);
+ ids.getRelationshipManager().associateUser(group1, user2);
+
+ RoleType rt1 = ids.getRoleManager().createRoleType("rt1");
+ RoleType rt2 = ids.getRoleManager().createRoleType("rt2");
+ RoleType rt3 = ids.getRoleManager().createRoleType("rt3");
+ RoleType rt4 = ids.getRoleManager().createRoleType("rt4");
+
+ Role role1 = ids.getRoleManager().createRole(rt1, user1, group1);
+ Role role2 = ids.getRoleManager().createRole(rt1, user1, group2);
+ Role role3 = ids.getRoleManager().createRole("rt2", user1.getId(), group1.getId());
+
+ // Asserts
+
+ //
+ UserQueryBuilder qb = ids.createUserQueryBuilder();
+
+ qb.withUserId("user1");
+ UserQuery q = qb.createQuery();
+
+ assertEquals(1, ids.execute(q).size());
+ assertEquals(1, ids.list(q).size());
+ assertEquals("user1", ids.uniqueResult(q).getId());
+
+ //
+ qb.reset();
+
+ qb.addAssociatedGroup(group2);
+
+ assertEquals(0, ids.execute(qb.createQuery()).size());
+
+ //
+ qb.reset();
+
+ qb.addAssociatedGroup(group1);
+
+ assertEquals(2, ids.execute(qb.createQuery()).size());
+
+ //
+ qb.reset();
+
+ qb.addAssociatedGroup(group1);
+ qb.withUserId(user1.getId());
+
+ assertEquals(1, ids.execute(qb.createQuery()).size());
+
+ //
+ qb.reset();
+
+ qb.addAssociatedGroup(group2);
+ qb.withUserId(user1.getId());
+
+ assertEquals(0, ids.execute(qb.createQuery()).size());
+
+ //
+ qb.reset();
+
+ qb.addAssociatedGroup(group1);
+ qb.addGroupConnectedWithRole(group2);
+
+ assertEquals(1, ids.execute(qb.createQuery()).size());
+ assertEquals(user1, ids.uniqueResult(qb.createQuery()));
+
+ //
+ qb.reset();
+
+ qb.addRelatedGroup(group1);
+
+ assertEquals(2, ids.execute(qb.createQuery()).size());
+
+ //
+ qb.reset();
+
+ qb.addRelatedGroup(group2);
+ qb.addAssociatedGroup(group1);
+
+ assertEquals(1, ids.execute(qb.createQuery()).size());
+ assertEquals(user1, ids.uniqueResult(qb.createQuery()));
+
+ //
+ qb.reset();
+
+ assertEquals(8, ids.execute(qb.createQuery()).size());
+
+
+ // Criteria
+
+ // All users
+ qb.reset();
+
+ assertEquals(8, ids.execute(qb.createQuery()).size());
+
+ // All users sorted
+ qb.reset();
+ qb.sort(SortOrder.ASCENDING);
+
+ List<User> results = ids.list(qb.createQuery());
+
+ assertEquals(testUser1, results.get(0));
+ assertEquals(user4, results.get(7));
+
+ // All users sorted desc
+ qb.reset();
+ qb.sort(SortOrder.DESCENDING);
+
+ results = ids.list(qb.createQuery());
+
+ assertEquals(testUser1, results.get(7));
+ assertEquals(user4, results.get(0));
+
+ //
+ qb.reset();
+ qb.sort(SortOrder.DESCENDING);
+ qb.idFilter("test*");
+
+ results = ids.list(qb.createQuery());
+
+ assertEquals(4, results.size());
+ assertEquals(testUser1, results.get(3));
+ assertEquals(testUser4, results.get(0));
+
+ //
+ qb.reset();
+ qb.sort(SortOrder.ASCENDING);
+ qb.idFilter("user*");
+ qb.page(1, 2);
+ results = ids.list(qb.createQuery());
+
+ assertEquals(2, results.size());
+ assertEquals(user2, results.get(0));
+ assertEquals(user3, results.get(1));
+
+
+
+ ctx.commit();
+ }
+
+
+
+}
Copied: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java (from rev 482, idm/trunk/idm-core/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java)
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java (rev 0)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java 2009-05-09 11:10:49 UTC (rev 485)
@@ -0,0 +1,306 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.store.hibernate;
+
+import org.jboss.identity.idm.spi.model.IdentityObject;
+import org.jboss.identity.idm.spi.model.IdentityObjectAttribute;
+import org.jboss.identity.idm.spi.store.IdentityStoreInvocationContext;
+import org.jboss.identity.idm.spi.store.IdentityStore;
+import org.jboss.identity.idm.spi.store.IdentityStoreSession;
+import org.jboss.identity.idm.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
+import org.jboss.identity.idm.spi.configuration.metadata.IdentityConfigurationMetaData;
+import org.jboss.identity.idm.spi.configuration.IdentityStoreConfigurationContext;
+import org.jboss.identity.idm.spi.configuration.IdentityConfigurationContextRegistry;
+import org.jboss.identity.idm.impl.store.hibernate.HibernateIdentityStoreImpl;
+import org.jboss.identity.idm.impl.store.IdentityTypeEnum;
+import org.jboss.identity.idm.impl.store.CommonIdentityStoreTest;
+import org.jboss.identity.idm.impl.store.IdentityStoreTestContext;
+import org.jboss.identity.idm.impl.configuration.jaxb2.JAXB2IdentityConfiguration;
+import org.jboss.identity.idm.impl.configuration.IdentityStoreConfigurationContextImpl;
+import org.jboss.identity.idm.impl.configuration.IdentityConfigurationImpl;
+import org.jboss.identity.idm.impl.api.SimpleAttribute;
+import org.jboss.identity.idm.impl.IdentityTestPOJO;
+import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.unit.api.pojo.annotations.Create;
+import org.jboss.unit.api.pojo.annotations.Test;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class HibernateIdentityStoreTestCase extends IdentityTestPOJO implements IdentityStoreTestContext
+{
+
+ protected HibernateIdentityStoreImpl store;
+
+ protected IdentityStoreInvocationContext ctx;
+
+ protected CommonIdentityStoreTest commonTest;
+
+ public HibernateIdentityStoreTestCase()
+ {
+
+ }
+
+ @Create
+ public void setUp() throws Exception
+ {
+ super.start();
+
+ setIdentityConfig("store-test-config.xml");
+
+ commonTest = new CommonIdentityStoreTest(this);
+
+ IdentityConfigurationMetaData configurationMD = JAXB2IdentityConfiguration
+ .createConfigurationMetaData(getIdentityConfig());
+
+ IdentityConfigurationContextRegistry identityConfiguration = (IdentityConfigurationContextRegistry)
+ new IdentityConfigurationImpl().configure(configurationMD);
+
+ IdentityStoreConfigurationMetaData storeMD = null;
+
+ for (IdentityStoreConfigurationMetaData metaData : configurationMD.getIdentityStores())
+ {
+ if (metaData.getId().equals("HibernateTestStore"))
+ {
+ storeMD = metaData;
+ break;
+ }
+ }
+
+ IdentityStoreConfigurationContext context =
+ new IdentityStoreConfigurationContextImpl(configurationMD, identityConfiguration, storeMD);
+
+ store = new HibernateIdentityStoreImpl("HibernateTestStore")
+ {
+
+ @Override
+ protected Session getHibernateSession(IdentityStoreInvocationContext ctx)
+ {
+ return getHibernateSupport().getSessionFactory().getCurrentSession();
+ }
+
+ @Override
+ protected SessionFactory bootstrapHibernateSessionFactory(IdentityStoreConfigurationContext configurationContext) throws IdentityException
+ {
+ return getHibernateSupport().getSessionFactory();
+ }
+
+ };
+
+ store.bootstrap(context);
+
+
+ ctx = new IdentityStoreInvocationContext()
+ {
+ public IdentityStoreSession getIdentityStoreSession()
+ {
+ return null;
+ }
+
+ public String getRealmId()
+ {
+ return "testRealm";
+ }
+ };
+
+
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ super.stop();
+ }
+
+ public void begin()
+ {
+ getHibernateSupport().openSession();
+ }
+
+ public void commit()
+ {
+ assertTrue(getHibernateSupport().commitTransaction());
+ }
+
+ public void flush() throws Exception
+ {
+
+ getHibernateSupport().getSessionFactory().getCurrentSession().flush();
+ }
+
+ public IdentityStore getStore()
+ {
+ return store;
+ }
+
+ public IdentityStoreInvocationContext getCtx()
+ {
+ return ctx;
+ }
+
+ // Tests
+
+ @Test
+ public void testStorePersistence() throws Exception
+ {
+
+ commonTest.testStorePersistence();
+
+ }
+
+ @Test
+ public void testFindMethods() throws Exception
+ {
+
+ commonTest.testFindMethods();
+
+ }
+
+ @Test
+ public void testAttributes() throws Exception
+ {
+
+ begin();
+
+ IdentityObject user1 = store.createIdentityObject(ctx, "Adam", IdentityTypeEnum.USER);
+ IdentityObject user2 = store.createIdentityObject(ctx, "Eva", IdentityTypeEnum.USER);
+
+ flush();
+
+ IdentityObjectAttribute[] attrs = new IdentityObjectAttribute[]{
+ new SimpleAttribute("key1", new String[]{"val1", "val2", "val3"}),
+ new SimpleAttribute("key2", new String[]{"val1", "val2", "val3", "val4"})
+ };
+
+ store.addAttributes(ctx, user1, attrs);
+
+ flush();
+
+ Map<String, IdentityObjectAttribute> persistedAttrs = store.getAttributes(ctx, user1);
+
+ assertEquals(2, persistedAttrs.keySet().size());
+
+ assertTrue(persistedAttrs.containsKey("key1"));
+ assertEquals(3, persistedAttrs.get("key1").getSize());
+
+ assertTrue(persistedAttrs.containsKey("key2"));
+ assertEquals(4, persistedAttrs.get("key2").getSize());
+
+ flush();
+
+ attrs = new IdentityObjectAttribute[]{
+ new SimpleAttribute("key3", new String[]{"val1"})
+ };
+
+
+ store.addAttributes(ctx, user1, attrs);
+
+ flush();
+
+ persistedAttrs = store.getAttributes(ctx, user1);
+
+ assertEquals(3, persistedAttrs.keySet().size());
+
+ assertTrue(persistedAttrs.containsKey("key1"));
+ assertEquals(3, persistedAttrs.get("key1").getSize());
+
+ assertTrue(persistedAttrs.containsKey("key2"));
+ assertEquals(4, persistedAttrs.get("key2").getSize());
+
+ assertTrue(persistedAttrs.containsKey("key3"));
+ assertEquals(1, persistedAttrs.get("key3").getSize());
+
+ flush();
+
+ attrs = new IdentityObjectAttribute[]{
+ new SimpleAttribute("key3", new String[]{"val2"})
+ };
+
+ store.addAttributes(ctx, user1, attrs);
+
+ flush();
+
+ persistedAttrs = store.getAttributes(ctx, user1);
+
+ assertEquals(3, persistedAttrs.keySet().size());
+
+ assertTrue(persistedAttrs.containsKey("key3"));
+ assertEquals(2, persistedAttrs.get("key3").getSize());
+
+ flush();
+
+ store.updateAttributes(ctx, user1, attrs);
+
+ flush();
+
+ persistedAttrs = store.getAttributes(ctx, user1);
+
+ assertEquals(3, persistedAttrs.keySet().size());
+
+ assertTrue(persistedAttrs.containsKey("key3"));
+ assertEquals(1, persistedAttrs.get("key3").getSize());
+
+ flush();
+
+ store.removeAttributes(ctx, user1, new String[] {"key3"});
+
+ flush();
+
+ persistedAttrs = store.getAttributes(ctx, user1);
+
+ assertEquals(2, persistedAttrs.keySet().size());
+
+
+ commit();
+
+ }
+
+ @Test
+ public void testRelationships() throws Exception
+ {
+ commonTest.testRelationships();
+ }
+
+ @Test
+ public void testPasswordCredentials() throws Exception
+ {
+ commonTest.testPasswordCredential();
+ }
+
+ public void testBinaryCredentials() throws Exception
+ {
+ commonTest.testBinaryCredential();
+ }
+
+ @Test
+ public void testCriteria() throws Exception
+ {
+ commonTest.testCriteria();
+ }
+
+}
\ No newline at end of file
Copied: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateModelTestCase.java (from rev 482, idm/trunk/idm-core/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateModelTestCase.java)
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateModelTestCase.java (rev 0)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateModelTestCase.java 2009-05-09 11:10:49 UTC (rev 485)
@@ -0,0 +1,341 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.store.hibernate;
+
+import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipType;
+import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObject;
+import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectType;
+import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationship;
+import org.jboss.identity.idm.impl.model.hibernate.HibernateRealm;
+import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectTextAttribute;
+import org.jboss.identity.idm.impl.IdentityTestPOJO;
+import org.jboss.unit.api.pojo.annotations.Destroy;
+import org.jboss.unit.api.pojo.annotations.Create;
+import org.jboss.unit.api.pojo.annotations.Test;
+import org.hibernate.Session;
+import org.hibernate.Query;
+import static org.jboss.unit.api.Assert.*;
+
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class HibernateModelTestCase extends IdentityTestPOJO
+{
+ public HibernateModelTestCase()
+ {
+ }
+
+
+ @Create
+ public void setUp() throws Exception
+ {
+ super.start();
+ }
+
+ @Destroy
+ public void tearDown() throws Exception
+ {
+ super.stop();
+ }
+
+ @Test
+ public void testPersistence() {
+
+
+ begin();
+ Session session = getSessionFactory().getCurrentSession();
+
+
+ HibernateRealm realm = new HibernateRealm("default");
+ session.persist(realm);
+
+ //
+
+ HibernateIdentityObjectType iot = new HibernateIdentityObjectType();
+ iot.setName("User");
+
+ session.persist(iot);
+ assertTrue(session.contains(iot));
+
+
+ HibernateIdentityObject io = new HibernateIdentityObject();
+ io.setName("John Kowalski");
+ io.setRealm(realm);
+ io.setIdentityType(iot);
+
+ session.persist(io);
+ assertTrue(session.contains(io));
+
+ session.delete(io);
+ assertFalse(session.contains(io));
+
+ //
+
+
+
+ //
+
+ HibernateIdentityObjectRelationshipType iort = new HibernateIdentityObjectRelationshipType();
+ iort.setName("Member");
+
+ session.persist(iort);
+ assertTrue(session.contains(iort));
+
+ //
+
+// JPAIdentityObjectRelationship ior = new JPAIdentityObjectRelationship();
+// ior.setType(iort);
+//
+// em.persist(ior);
+// assertTrue(em.contains(ior));
+
+// em.remove(ior);
+// assertFalse(em.contains(ior));
+
+ //
+
+ assertTrue(session.contains(iort));
+
+ session.delete(iort);
+ assertFalse(session.contains(iort));
+
+ commit();
+
+
+ }
+
+ @Test
+ public void testRelationships()
+ {
+ begin();
+
+
+ Session session = getSessionFactory().getCurrentSession();
+
+
+ HibernateRealm realm = new HibernateRealm("default");
+ session.persist(realm);
+
+ HibernateIdentityObjectType groupType = new HibernateIdentityObjectType("Group");
+ session.persist(groupType);
+ HibernateIdentityObjectType userType = new HibernateIdentityObjectType("User");
+ session.persist(userType);
+
+ HibernateIdentityObject user1 = new HibernateIdentityObject("user1", userType, realm);
+ session.persist(user1);
+ HibernateIdentityObject user2 = new HibernateIdentityObject("user2", userType, realm);
+ session.persist(user2);
+ HibernateIdentityObject user3 = new HibernateIdentityObject("user3", userType, realm);
+ session.persist(user3);
+
+ HibernateIdentityObject group1 = new HibernateIdentityObject("group1", groupType, realm);
+ session.persist(group1);
+ HibernateIdentityObject group2 = new HibernateIdentityObject("group2", groupType, realm);
+ session.persist(group2);
+ HibernateIdentityObject group3 = new HibernateIdentityObject("group3", groupType, realm);
+ session.persist(group3);
+
+ HibernateIdentityObjectRelationshipType memberType = new HibernateIdentityObjectRelationshipType("member");
+ session.persist(memberType);
+
+ HibernateIdentityObjectRelationship relationship = new HibernateIdentityObjectRelationship(memberType, group1, user1);
+ session.persist(relationship);
+ relationship = new HibernateIdentityObjectRelationship(memberType, group1, user2);
+ session.persist(relationship);
+ relationship = new HibernateIdentityObjectRelationship(memberType, group2, user3);
+ session.persist(relationship);
+ relationship = new HibernateIdentityObjectRelationship(memberType, group2, group1);
+ session.persist(relationship);
+
+ commit();
+
+ //
+
+
+ begin();
+
+ session = getSessionFactory().getCurrentSession();
+
+ Query ioQuery = session.createQuery("select o from HibernateIdentityObject o where o.name like :name");
+
+ group1 = (HibernateIdentityObject)ioQuery.setParameter("name", "group1").uniqueResult();
+ assertEquals(2, group1.getFromRelationships().size());
+ assertEquals(1, group1.getToRelationships().size());
+ group2 = (HibernateIdentityObject)ioQuery.setParameter("name", "group2").uniqueResult();
+ assertEquals(2, group2.getFromRelationships().size());
+ assertEquals(0, group2.getToRelationships().size());
+
+ user3 = (HibernateIdentityObject)ioQuery.setParameter("name", "user3").uniqueResult();
+ assertEquals(1, user3.getToRelationships().size());
+ assertEquals(0, user3.getFromRelationships().size());
+ assertEquals("group2", user3.getToRelationships().iterator().next().getFromIdentityObject().getName());
+ commit();
+
+ }
+
+ @Test
+ public void testNameTypeConstraint() throws Exception
+ {
+
+ begin();
+ Session session = getSessionFactory().getCurrentSession();
+
+
+
+ HibernateRealm realm = new HibernateRealm("default");
+ session.persist(realm);
+
+ HibernateIdentityObjectType groupType = new HibernateIdentityObjectType("Group");
+ session.persist(groupType);
+ HibernateIdentityObjectType userType = new HibernateIdentityObjectType("User");
+ session.persist(userType);
+
+ HibernateIdentityObject user1 = new HibernateIdentityObject("user1", userType, realm);
+ session.persist(user1);
+ HibernateIdentityObject user2 = new HibernateIdentityObject("user2", userType, realm);
+ session.persist(user2);
+
+ commit();
+
+
+
+ begin();
+
+ session = getSessionFactory().getCurrentSession();
+
+ try
+ {
+
+ HibernateIdentityObject user3 = new HibernateIdentityObject("user2", userType, realm);
+ session.persist(user3);
+
+ assertFalse(getHibernateSupport().commitTransaction());
+
+ }
+ catch (Exception e)
+ {
+ // may be expected
+ getHibernateSupport().rollbackTransaction();
+ }
+
+
+
+ begin();
+
+ session = getSessionFactory().getCurrentSession();
+
+
+ HibernateIdentityObject user4 = new HibernateIdentityObject("group1", userType, realm);
+ session.persist(user4);
+
+
+ HibernateIdentityObject group1 = new HibernateIdentityObject("group1", groupType, realm);
+ session.persist(group1);
+ HibernateIdentityObject group2 = new HibernateIdentityObject("group2", groupType, realm);
+ session.persist(group2);
+
+ //session.flush();
+
+ try
+ {
+
+ HibernateIdentityObject group3 = new HibernateIdentityObject("group2", groupType, realm);
+ session.persist(group3);
+
+ // Should fail
+ assertFalse(getHibernateSupport().commitTransaction());
+ }
+ catch (Exception e)
+ {
+ //expected
+ getHibernateSupport().rollbackTransaction();
+ }
+
+
+
+ begin();
+
+ session = getSessionFactory().getCurrentSession();
+
+ HibernateIdentityObject group4 = new HibernateIdentityObject("user1", groupType, realm);
+ session.persist(group4);
+
+ session.flush();
+
+ commit();
+
+
+
+
+
+ }
+
+ @Test
+ public void testAttributes() throws Exception
+ {
+ begin();
+
+ Session session = getSessionFactory().getCurrentSession();
+
+
+
+
+ HibernateRealm realm = new HibernateRealm("default");
+ session.persist(realm);
+
+ HibernateIdentityObjectType userType = new HibernateIdentityObjectType("User");
+ session.persist(userType);
+ HibernateIdentityObject user1 = new HibernateIdentityObject("user1", userType, realm);
+ session.persist(user1);
+
+// Set<String> values1 = new HashSet<String>();
+// values1.add("Val1");
+// values1.add("Val2");
+// values1.add("Val3");
+
+
+ user1.getAttributes().add(new HibernateIdentityObjectTextAttribute(user1, "simple1", new String[]{"Val1", "Val2", "Val3"}));
+ user1.getAttributes().add(new HibernateIdentityObjectTextAttribute(user1, "simple2", new String[]{"Val1", "Val2", "Val3"}));
+
+
+ commit();
+
+
+
+ begin();
+
+ session = getSessionFactory().getCurrentSession();
+
+ user1 = (HibernateIdentityObject)session.get(HibernateIdentityObject.class, new Long(user1.getId()));
+ assertEquals(2, user1.getAttributes().size() );
+// assertNotNull(user1.getProfileAttributes().get("simple1"));
+// assertEquals(3, user1.getProfileAttributes().get("simple1").length);
+
+
+ commit();
+
+ }
+
+}
\ No newline at end of file
Copied: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java (from rev 482, idm/trunk/idm-core/src/test/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java)
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java (rev 0)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java 2009-05-09 11:10:49 UTC (rev 485)
@@ -0,0 +1,430 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.store.ldap;
+
+import org.jboss.identity.idm.spi.store.IdentityStore;
+import org.jboss.identity.idm.spi.store.IdentityStoreInvocationContext;
+import org.jboss.identity.idm.spi.store.IdentityStoreSession;
+import org.jboss.identity.idm.spi.model.IdentityObject;
+import org.jboss.identity.idm.spi.model.IdentityObjectAttribute;
+import org.jboss.identity.idm.spi.configuration.metadata.IdentityConfigurationMetaData;
+import org.jboss.identity.idm.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
+import org.jboss.identity.idm.spi.configuration.IdentityConfigurationContextRegistry;
+import org.jboss.identity.idm.spi.configuration.IdentityStoreConfigurationContext;
+import org.jboss.identity.idm.impl.store.IdentityTypeEnum;
+import org.jboss.identity.idm.impl.store.CommonIdentityStoreTest;
+import org.jboss.identity.idm.impl.store.IdentityStoreTestContext;
+import org.jboss.identity.idm.impl.configuration.jaxb2.JAXB2IdentityConfiguration;
+import org.jboss.identity.idm.impl.configuration.IdentityConfigurationImpl;
+import org.jboss.identity.idm.impl.configuration.IdentityStoreConfigurationContextImpl;
+import org.jboss.identity.idm.impl.api.SimpleAttribute;
+import org.jboss.identity.idm.impl.LDAPTestPOJO;
+import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.unit.api.pojo.annotations.Create;
+import org.jboss.unit.api.pojo.annotations.Destroy;
+import org.jboss.unit.api.pojo.annotations.Test;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.ldap.LdapContext;
+import javax.naming.ldap.InitialLdapContext;
+import java.util.Hashtable;
+import java.util.Map;
+
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class LDAPIdentityStoreTestCase extends LDAPTestPOJO implements IdentityStoreTestContext
+{
+
+ CommonIdentityStoreTest commonTest;
+
+ IdentityStoreInvocationContext ctx;
+
+ IdentityStore store;
+
+ public LDAPIdentityStoreTestCase()
+ {
+
+ }
+
+ @Create
+ public void setUp() throws Exception
+ {
+ super.start();
+
+ setIdentityConfig("store-test-config.xml");
+
+ commonTest = new CommonIdentityStoreTest(this);
+
+ IdentityConfigurationMetaData configurationMD = JAXB2IdentityConfiguration
+ .createConfigurationMetaData(getIdentityConfig());
+
+ IdentityConfigurationContextRegistry registry = (IdentityConfigurationContextRegistry) new IdentityConfigurationImpl().
+ configure(configurationMD);
+
+ IdentityStoreConfigurationMetaData storeMD = null;
+
+ for (IdentityStoreConfigurationMetaData metaData : configurationMD.getIdentityStores())
+ {
+ if (metaData.getId().equals("LDAPTestStore"))
+ {
+ storeMD = metaData;
+ break;
+ }
+ }
+
+ IdentityStoreConfigurationContext context = new IdentityStoreConfigurationContextImpl(configurationMD, registry, storeMD);
+
+ ctx = new IdentityStoreInvocationContext()
+ {
+ public IdentityStoreSession getIdentityStoreSession()
+ {
+ return new IdentityStoreSession(){
+
+ public Object getSessionContext() throws IdentityException
+ {
+ try
+ {
+ return getLdapContext();
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Failed to obtain LDAP connection: ", e);
+ }
+ }
+
+ public void close() throws IdentityException
+ {
+
+ }
+
+ public void save() throws IdentityException
+ {
+
+ }
+
+ public void clear() throws IdentityException
+ {
+
+ }
+
+ public boolean isOpen()
+ {
+ return false;
+ }
+
+ public boolean isTransactionSupported()
+ {
+ return false;
+ }
+
+ public void startTransaction()
+ {
+
+ }
+
+ public void commitTransaction()
+ {
+
+ }
+
+ public void rollbackTransaction()
+ {
+
+ }
+
+ public boolean isTransactionActive()
+ {
+ return false;
+ }
+ };
+ }
+
+ public String getRealmId()
+ {
+ return "testRealm";
+ }
+ };
+
+ //populate();
+
+ store = new LDAPIdentityStoreImpl("LDAPTestStore");
+
+ store.bootstrap(context);
+ }
+
+ @Destroy
+ public void tearDown() throws Exception
+ {
+ super.stop();
+ }
+
+
+ public void flush() throws Exception
+ {
+ //nothing
+ }
+
+ public IdentityStore getStore()
+ {
+ return store;
+ }
+
+ public IdentityStoreInvocationContext getCtx()
+ {
+ return ctx;
+ }
+
+
+ // Tests
+
+// Just test if OpenDS is running and was populated...
+ @Test
+ public void testSimple() throws Exception
+ {
+ populate();
+
+ Hashtable<String,String> env = new Hashtable<String,String>();
+ env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
+ env.put(Context.PROVIDER_URL, LDAP_PROVIDER_URL);
+ env.put(Context.SECURITY_AUTHENTICATION, "simple");
+ env.put(Context.SECURITY_PRINCIPAL, LDAP_PRINCIPAL);
+ env.put(Context.SECURITY_CREDENTIALS, LDAP_CREDENTIALS);
+
+ LdapContext ldapCtx = null;
+ try
+ {
+ ldapCtx = new InitialLdapContext(env, null);
+
+// Do something ...
+ System.out.println("Attributes: " + ldapCtx.getAttributes("o=test,dc=portal,dc=example,dc=com"));
+
+ }
+ catch (NamingException e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ try
+ {
+ if (ldapCtx != null)
+ {
+ ldapCtx.close();
+ }
+ }
+ catch (NamingException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ @Test
+ public void testIdentityObjectCount() throws Exception
+ {
+ populate();
+
+ assertEquals(7, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.USER));
+ assertEquals(5, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.ROLE));
+ assertEquals(2, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.GROUP));
+ }
+
+ @Test
+ public void testFindCreateRemove() throws Exception
+ {
+ populate();
+
+ assertEquals(7, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.USER));
+
+ IdentityObject io = store.findIdentityObject(ctx, "admin", IdentityTypeEnum.USER);
+ assertEquals("admin", io.getName());
+ assertEquals("uid=admin,ou=People,o=test,dc=portal,dc=example,dc=com", io.getId().toString());
+
+ //
+
+ store.removeIdentityObject(ctx, io);
+
+ assertEquals(6, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.USER));
+
+ store.createIdentityObject(ctx, "newUserA", IdentityTypeEnum.USER);
+
+ assertEquals(7, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.USER));
+
+ //
+
+ assertEquals(2, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.GROUP));
+
+ store.createIdentityObject(ctx, "newGroupA", IdentityTypeEnum.GROUP);
+
+ assertEquals(3, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.GROUP));
+
+ //
+
+ io = store.findIdentityObject(ctx, "cn=newGroupA,ou=Groups,o=test,dc=portal,dc=example,dc=com");
+ assertEquals("newGroupA", io.getName());
+
+ }
+
+ @Test
+ public void testAttributes() throws Exception{
+
+ populate();
+
+ IdentityObject user1 = store.createIdentityObject(ctx, "Adam", IdentityTypeEnum.USER);
+ IdentityObject user2 = store.createIdentityObject(ctx, "Eva", IdentityTypeEnum.USER);
+
+ //
+
+ IdentityObjectAttribute[] attrs = new IdentityObjectAttribute[]{
+ new SimpleAttribute("phone", new String[]{"val1", "val2", "val3"}),
+ new SimpleAttribute("description", new String[]{"val1", "val2", "val3", "val4"}),
+
+ };
+
+ store.addAttributes(ctx, user1, attrs);
+
+ //
+
+ Map<String, IdentityObjectAttribute> persistedAttrs = store.getAttributes(ctx, user1);
+
+ assertEquals(2, persistedAttrs.keySet().size());
+
+ assertTrue(persistedAttrs.containsKey("phone"));
+ assertEquals(3, persistedAttrs.get("phone").getSize());
+
+ assertTrue(persistedAttrs.containsKey("description"));
+ assertEquals(4, persistedAttrs.get("description").getSize());
+
+ //
+
+ attrs = new IdentityObjectAttribute[]{
+ new SimpleAttribute("carLicense", new String[]{"val1"})
+ };
+
+ store.addAttributes(ctx, user1, attrs);
+
+ //
+
+ persistedAttrs = store.getAttributes(ctx, user1);
+
+ assertEquals(3, persistedAttrs.keySet().size());
+
+ assertTrue(persistedAttrs.containsKey("phone"));
+ assertEquals(3, persistedAttrs.get("phone").getSize());
+
+ assertTrue(persistedAttrs.containsKey("description"));
+ assertEquals(4, persistedAttrs.get("description").getSize());
+
+ assertTrue(persistedAttrs.containsKey("carLicense"));
+ assertEquals(1, persistedAttrs.get("carLicense").getSize());
+
+ attrs = new IdentityObjectAttribute[]{
+ new SimpleAttribute("carLicense", new String[]{"val2"})
+ };
+
+ store.addAttributes(ctx, user1, attrs);
+
+ //
+
+ persistedAttrs = store.getAttributes(ctx, user1);
+
+ assertEquals(3, persistedAttrs.keySet().size());
+
+ assertTrue(persistedAttrs.containsKey("carLicense"));
+ assertEquals(2, persistedAttrs.get("carLicense").getSize());
+
+ //
+
+ store.updateAttributes(ctx, user1, attrs);
+
+ //
+
+ persistedAttrs = store.getAttributes(ctx, user1);
+
+ assertEquals(3, persistedAttrs.keySet().size());
+
+ assertTrue(persistedAttrs.containsKey("carLicense"));
+ assertEquals(1, persistedAttrs.get("carLicense").getSize());
+
+ //
+
+ String[] names = new String[]{"carLicense"};
+ store.removeAttributes(ctx, user1, names);
+
+ //
+
+ persistedAttrs = store.getAttributes(ctx, user1);
+
+ assertEquals(2, persistedAttrs.keySet().size());
+
+ }
+
+ @Test
+ public void testRelationships() throws Exception
+ {
+ populateClean();
+
+ commonTest.testRelationships();
+
+ }
+
+ @Test
+ public void testStorePersistence() throws Exception
+ {
+ populateClean();
+
+ commonTest.testStorePersistence();
+
+ }
+
+ @Test
+ public void testFindMethods() throws Exception
+ {
+ populateClean();
+
+ commonTest.testFindMethods();
+
+ }
+
+ @Test
+ public void testCriteria() throws Exception
+ {
+ populateClean();
+
+ commonTest.testCriteria();
+ }
+
+
+ @Test
+ public void testCredentials() throws Exception
+ {
+ populateClean();
+
+ commonTest.testPasswordCredential();
+ }
+
+}
Copied: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/test (from rev 482, idm/trunk/idm-core/src/test/java/org/jboss/identity/idm/test)
Copied: idm/trunk/idm-testsuite/src/test/resources/datasources (from rev 482, idm/trunk/idm-core/src/test/resources/datasources)
Copied: idm/trunk/idm-testsuite/src/test/resources/hibernate-jboss-identity-classes.cfg.xml (from rev 482, idm/trunk/idm-core/src/test/resources/hibernate-jboss-identity-classes.cfg.xml)
===================================================================
--- idm/trunk/idm-testsuite/src/test/resources/hibernate-jboss-identity-classes.cfg.xml (rev 0)
+++ idm/trunk/idm-testsuite/src/test/resources/hibernate-jboss-identity-classes.cfg.xml 2009-05-09 11:10:49 UTC (rev 485)
@@ -0,0 +1,60 @@
+<?xml version='1.0' encoding='utf-8'?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE hibernate-configuration PUBLIC
+ "-//Hibernate/Hibernate Configuration DTD//EN"
+ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+<hibernate-configuration>
+ <session-factory>
+
+ <property name="show_sql">false</property>
+ <property name="cache.use_second_level_cache">true</property>
+ <property name="cache.use_query_cache">false</property>
+
+ <property name="current_session_context_class">thread</property>
+
+ <!--<property name="connection.datasource"></property>-->
+
+ <property name="hibernate.connection.url">jdbc:hsqldb:mem:unit-testing-jpa1</property>
+ <property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
+ <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
+ <property name="hibernate.hbm2ddl.auto">create-drop</property>
+ <property name="hibernate.connection.username">sa</property>
+ <property name="hibernate.connection.password"></property>
+
+ <!-- Mapping classes -->
+
+ <mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateRealm"/>
+ <mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObject"/>
+ <mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredential"/>
+ <mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredentialType"/>
+ <mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectAttribute"/>
+ <mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectTextAttribute"/>
+ <mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttribute"/>
+ <mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectType"/>
+ <mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationship"/>
+ <mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipType"/>
+ <mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipName"/>
+ </session-factory>
+</hibernate-configuration>
\ No newline at end of file
Copied: idm/trunk/idm-testsuite/src/test/resources/hibernate-jboss-identity.cfg.xml (from rev 482, idm/trunk/idm-core/src/test/resources/hibernate-jboss-identity.cfg.xml)
===================================================================
--- idm/trunk/idm-testsuite/src/test/resources/hibernate-jboss-identity.cfg.xml (rev 0)
+++ idm/trunk/idm-testsuite/src/test/resources/hibernate-jboss-identity.cfg.xml 2009-05-09 11:10:49 UTC (rev 485)
@@ -0,0 +1,61 @@
+<?xml version='1.0' encoding='utf-8'?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE hibernate-configuration PUBLIC
+ "-//Hibernate/Hibernate Configuration DTD//EN"
+ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+<hibernate-configuration>
+ <session-factory>
+
+ <property name="show_sql">false</property>
+ <property name="cache.use_second_level_cache">true</property>
+ <property name="cache.use_query_cache">false</property>
+
+ <property name="current_session_context_class">thread</property>
+
+ <!--<property name="connection.datasource"></property>-->
+
+ <property name="hibernate.connection.url">jdbc:hsqldb:mem:unit-testing-jpa1</property>
+ <property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
+ <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
+ <property name="hibernate.hbm2ddl.auto">create-drop</property>
+ <property name="hibernate.connection.username">sa</property>
+ <property name="hibernate.connection.password"></property>
+
+ <!-- Mapping classes -->
+ <!-- all nessesary mappings are added programatically to the configuration -->
+ <!--<mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateRealm"/>-->
+ <!--<mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObject"/>-->
+ <!--<mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredential"/>-->
+ <!--<mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredentialType"/>-->
+ <!--<mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectAttribute"/>-->
+ <!--<mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectTextAttribute"/>-->
+ <!--<mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttribute"/>-->
+ <!--<mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectType"/>-->
+ <!--<mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationship"/>-->
+ <!--<mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipType"/>-->
+ <!--<mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipName"/>-->
+
+ </session-factory>
+</hibernate-configuration>
\ No newline at end of file
Copied: idm/trunk/idm-testsuite/src/test/resources/identity-config.xsd (from rev 482, idm/trunk/idm-core/src/test/resources/identity-config.xsd)
===================================================================
--- idm/trunk/idm-testsuite/src/test/resources/identity-config.xsd (rev 0)
+++ idm/trunk/idm-testsuite/src/test/resources/identity-config.xsd 2009-05-09 11:10:49 UTC (rev 485)
@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="urn:jboss:identity:idm:config:v1_0_alpha" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="jboss-identity" type="urn:jboss-identityType" xmlns:urn="urn:jboss:identity:idm:config:v1_0_alpha">
+ <xs:annotation>
+ <xs:documentation><xs:schemaattributeFormDefault="unqualified"elementFormDefault="qualified"xmlns:xs="http://www.w3.org/2001/XMLSchema"targetNamespace="urn:jboss:identity:idm:config:v1_0_alpha"xmlns="urn:jboss:identity:idm:config:v1_0_alpha"xmlns:xml="http://www.w3.org/XML/1998/namespace"xmlns:wcc="urn:jboss:identity:idm:config:v1_0_alpha"></xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:complexType name="identity-object-typesType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="identity-object-type" maxOccurs="unbounded" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="repositoryType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="id"/>
+ <xs:element type="xs:string" name="class"/>
+ <xs:element type="urn:external-configType" name="external-config" minOccurs="0" xmlns:urn="urn:jboss:identity:idm:config:v1_0_alpha"/>
+ <xs:element type="xs:string" name="default-identity-store-id" minOccurs="0"/>
+ <xs:element type="xs:string" name="default-attribute-store-id" minOccurs="0"/>
+ <xs:element type="urn:identity-store-mappingsType" name="identity-store-mappings" minOccurs="0" xmlns:urn="urn:jboss:identity:idm:config:v1_0_alpha"/>
+ <xs:element type="urn:optionsType" name="options" minOccurs="0" xmlns:urn="urn:jboss:identity:idm:config:v1_0_alpha"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="identity-storeType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="id"/>
+ <xs:element type="xs:string" name="class"/>
+ <xs:element type="urn:external-configType" name="external-config" xmlns:urn="urn:jboss:identity:idm:config:v1_0_alpha"/>
+ <xs:element type="urn:supported-relationship-typesType" name="supported-relationship-types" xmlns:urn="urn:jboss:identity:idm:config:v1_0_alpha"/>
+ <xs:element type="urn:supported-identity-object-typesType" name="supported-identity-object-types" xmlns:urn="urn:jboss:identity:idm:config:v1_0_alpha"/>
+ <xs:element name="options">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element type="urn:optionType" name="option" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:idm:config:v1_0_alpha"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="external-configType">
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute type="xs:string" name="override" use="optional"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ <xs:complexType name="identity-store-mappingsType">
+ <xs:sequence>
+ <xs:element type="urn:identity-store-mappingType" name="identity-store-mapping" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:idm:config:v1_0_alpha"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="storesType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="attribute-stores"/>
+ <xs:element type="urn:identity-storesType" name="identity-stores" xmlns:urn="urn:jboss:identity:idm:config:v1_0_alpha"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="jboss-identityType">
+ <xs:sequence>
+ <xs:element type="urn:realmsType" name="realms" xmlns:urn="urn:jboss:identity:idm:config:v1_0_alpha"/>
+ <xs:element type="urn:repositoriesType" name="repositories" xmlns:urn="urn:jboss:identity:idm:config:v1_0_alpha"/>
+ <xs:element type="urn:storesType" name="stores" xmlns:urn="urn:jboss:identity:idm:config:v1_0_alpha"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="supported-identity-object-typesType">
+ <xs:sequence>
+ <xs:element type="urn:identity-object-typeType" name="identity-object-type" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:idm:config:v1_0_alpha"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="optionType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="name"/>
+ <xs:element type="xs:string" name="value" maxOccurs="unbounded" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="group-type-mappingType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="group-type-name"/>
+ <xs:element type="xs:string" name="identity-object-type-name"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="credentialsType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="credential-type" maxOccurs="unbounded" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="repositoriesType">
+ <xs:sequence>
+ <xs:element type="urn:repositoryType" name="repository" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:idm:config:v1_0_alpha"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="realmType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="id"/>
+ <xs:element type="xs:string" name="repository-id-ref"/>
+ <xs:element type="urn:identity-type-mappingsType" name="identity-type-mappings" minOccurs="0" xmlns:urn="urn:jboss:identity:idm:config:v1_0_alpha"/>
+ <xs:element type="urn:optionsType" name="options" minOccurs="0" xmlns:urn="urn:jboss:identity:idm:config:v1_0_alpha"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="relationshipsType">
+ <xs:sequence>
+ <xs:element type="urn:relationshipType" name="relationship" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:idm:config:v1_0_alpha"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="realmsType">
+ <xs:sequence>
+ <xs:element type="urn:realmType" name="realm" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:idm:config:v1_0_alpha"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="identity-type-mappingsType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="user-mapping"/>
+ <xs:element type="urn:group-type-mappingType" name="group-type-mapping" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:idm:config:v1_0_alpha"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="supported-relationship-typesType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="relationship-type" maxOccurs="unbounded" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="identity-storesType">
+ <xs:sequence>
+ <xs:element type="urn:identity-storeType" name="identity-store" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:idm:config:v1_0_alpha"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="attributesType">
+ <xs:sequence>
+ <xs:element type="urn:attributeType" name="attribute" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:idm:config:v1_0_alpha"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="identity-store-mappingType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="identity-store-id"/>
+ <xs:element type="urn:identity-object-typesType" name="identity-object-types" xmlns:urn="urn:jboss:identity:idm:config:v1_0_alpha"/>
+ <xs:element type="urn:optionsType" name="options" xmlns:urn="urn:jboss:identity:idm:config:v1_0_alpha"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="relationshipType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="relationship-type-ref"/>
+ <xs:element type="xs:string" name="identity-object-type-ref"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="optionsType">
+ <xs:sequence>
+ <xs:element type="urn:optionType" name="option" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:idm:config:v1_0_alpha"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="identity-object-typeType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="name"/>
+ <xs:element name="relationships">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element type="urn:relationshipType" name="relationship" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:idm:config:v1_0_alpha"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="credentials">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element type="xs:string" name="credential-type" maxOccurs="unbounded" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="attributes">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element type="urn:attributeType" name="attribute" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:idm:config:v1_0_alpha"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="options">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element type="urn:optionType" name="option" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:idm:config:v1_0_alpha"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="attributeType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="name"/>
+ <xs:element type="xs:string" name="mapping"/>
+ <xs:element type="xs:string" name="type"/>
+ <xs:element name="isRequired">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value=""/>
+ <xs:enumeration value="true"/>
+ <xs:enumeration value="false"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ <xs:element name="isMultivalued">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value=""/>
+ <xs:enumeration value="true"/>
+ <xs:enumeration value="false"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ <xs:element type="xs:string" name="isReadOnly" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+</xs:schema>
\ No newline at end of file
Copied: idm/trunk/idm-testsuite/src/test/resources/ldap (from rev 482, idm/trunk/idm-core/src/test/resources/ldap)
Copied: idm/trunk/idm-testsuite/src/test/resources/log4j.xml (from rev 482, idm/trunk/idm-core/src/test/resources/log4j.xml)
===================================================================
--- idm/trunk/idm-testsuite/src/test/resources/log4j.xml (rev 0)
+++ idm/trunk/idm-testsuite/src/test/resources/log4j.xml 2009-05-09 11:10:49 UTC (rev 485)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern"
+ value="[%d{dd/MM/yy hh:mm:ss:sss z}] %5p %c{2}: %m%n" />
+ </layout>
+ </appender>
+
+ <appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
+ <appender-ref ref="CONSOLE"/>
+ <appender-ref ref="FILE"/>
+ </appender>
+
+ <appender name="FILE" class="org.apache.log4j.RollingFileAppender">
+ <param name="File" value="log4j-output.log"/>
+ <param name="MaxFileSize" value="1MB"/>
+ <param name="MaxBackupIndex" value="100"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern"
+ value="[%d{dd/MM/yy hh:mm:ss:sss z}] %5p %c{2}: %m%n" />
+ </layout>
+ </appender>
+
+ <root>
+ <priority value="info"/>
+ <appender-ref ref="CONSOLE"/>
+ <!--<appender-ref ref="ASYNC"/>-->
+ </root>
+</log4j:configuration>
\ No newline at end of file
Copied: idm/trunk/idm-testsuite/src/test/resources/opends (from rev 482, idm/trunk/idm-core/src/test/resources/opends)
Copied: idm/trunk/idm-testsuite/src/test/resources/organization-test-config.xml (from rev 482, idm/trunk/idm-core/src/test/resources/organization-test-config.xml)
===================================================================
--- idm/trunk/idm-testsuite/src/test/resources/organization-test-config.xml (rev 0)
+++ idm/trunk/idm-testsuite/src/test/resources/organization-test-config.xml 2009-05-09 11:10:49 UTC (rev 485)
@@ -0,0 +1,792 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_alpha"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_alpha identity-config.xsd">
+ <realms>
+ <realm>
+ <id>realm://RedHat/DB</id>
+ <repository-id-ref>RedHat Repository DB</repository-id-ref>
+ <identity-type-mappings>
+ <user-mapping>USER</user-mapping>
+ </identity-type-mappings>
+ </realm>
+ <realm>
+ <id>realm://portal/SamplePortal/DB</id>
+ <repository-id-ref>Sample Portal Repository DB</repository-id-ref>
+ <identity-type-mappings>
+ <user-mapping>USER</user-mapping>
+ </identity-type-mappings>
+ </realm>
+ <realm>
+ <id>realm://RedHat/DB_LDAP</id>
+ <repository-id-ref>RedHat Repository DB+LDAP</repository-id-ref>
+ <identity-type-mappings>
+ <user-mapping>USER</user-mapping>
+ </identity-type-mappings>
+ </realm>
+ <realm>
+ <id>realm://portal/SamplePortal/DB_LDAP</id>
+ <repository-id-ref>Sample Portal Repository DB+LDAP</repository-id-ref>
+ <identity-type-mappings>
+ <user-mapping>USER</user-mapping>
+ </identity-type-mappings>
+ </realm>
+ </realms>
+ <repositories>
+ <repository>
+ <id>RedHat Repository DB</id>
+ <class>org.jboss.identity.idm.impl.repository.WrapperIdentityStoreRepository</class>
+ <external-config/>
+ <default-identity-store-id>Hibernate Identity Store</default-identity-store-id>
+ <default-attribute-store-id>Hibernate Identity Store</default-attribute-store-id>
+ <options>
+ <option>
+ <name>allowNotDefinedAttributes</name>
+ <value>true</value>
+ </option>
+ </options>
+ </repository>
+ <repository>
+ <id>Sample Portal Repository DB</id>
+ <class>org.jboss.identity.idm.impl.repository.WrapperIdentityStoreRepository</class>
+ <external-config/>
+ <default-identity-store-id>Hibernate Identity Store</default-identity-store-id>
+ <default-attribute-store-id>Hibernate Identity Store</default-attribute-store-id>
+ <options>
+ <option>
+ <name>allowNotDefinedAttributes</name>
+ <value>true</value>
+ </option>
+ </options>
+ </repository>
+ <repository>
+ <id>RedHat Repository DB+LDAP</id>
+ <class>org.jboss.identity.idm.impl.repository.FallbackIdentityStoreRepository</class>
+ <external-config/>
+ <default-identity-store-id>Hibernate Identity Store</default-identity-store-id>
+ <default-attribute-store-id>Hibernate Identity Store</default-attribute-store-id>
+ <identity-store-mappings>
+ <identity-store-mapping>
+ <identity-store-id>Hibernate Identity Store</identity-store-id>
+ <identity-object-types>
+ <identity-object-type>DIVISION</identity-object-type>
+ <identity-object-type>PROJECT</identity-object-type>
+ <identity-object-type>PEOPLE</identity-object-type>
+ </identity-object-types>
+ <options/>
+ </identity-store-mapping>
+ <identity-store-mapping>
+ <identity-store-id>LDAP Identity Store</identity-store-id>
+ <identity-object-types>
+ <identity-object-type>USER</identity-object-type>
+ <identity-object-type>ORGANIZATION</identity-object-type>
+ <identity-object-type>ORGANIZATION_UNIT</identity-object-type>
+ <identity-object-type>DEPARTMENT</identity-object-type>
+ </identity-object-types>
+ <options>
+ <option>
+ <name>cache</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>cache.config-file</name>
+ <value>src/test/resources/jboss-cache-config.xml</value>
+ </option>
+ </options>
+ </identity-store-mapping>
+ </identity-store-mappings>
+ <options>
+ <option>
+ <name>allowNotDefinedAttributes</name>
+ <value>true</value>
+ </option>
+ </options>
+ </repository>
+ <repository>
+ <id>Sample Portal Repository DB+LDAP</id>
+ <class>org.jboss.identity.idm.impl.repository.FallbackIdentityStoreRepository</class>
+ <external-config/>
+ <default-identity-store-id>Hibernate Identity Store</default-identity-store-id>
+ <default-attribute-store-id>Hibernate Identity Store</default-attribute-store-id>
+ <identity-store-mappings>
+ <identity-store-mapping>
+ <identity-store-id>Hibernate Identity Store</identity-store-id>
+ <identity-object-types>
+ <identity-object-type>SYSTEM</identity-object-type>
+ <identity-object-type>ADMINISTRATION</identity-object-type>
+ <identity-object-type>COMMUNITY</identity-object-type>
+ <identity-object-type>DIVISION</identity-object-type>
+ <identity-object-type>SECURITY</identity-object-type>
+ <identity-object-type>PEOPLE</identity-object-type>
+ </identity-object-types>
+ <options/>
+ </identity-store-mapping>
+ <identity-store-mapping>
+ <identity-store-id>LDAP Identity Store</identity-store-id>
+ <identity-object-types>
+ <identity-object-type>USER</identity-object-type>
+ <identity-object-type>DEPARTMENT</identity-object-type>
+ <identity-object-type>ORGANIZATION</identity-object-type>
+ <identity-object-type>ORGANIZATION_UNIT</identity-object-type>
+ <identity-object-type>OFFICE</identity-object-type>
+ </identity-object-types>
+ <options>
+ <option>
+ <name>cache</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>cache.config-file</name>
+ <value>src/test/resources/jboss-cache-config.xml</value>
+ </option>
+ </options>
+ </identity-store-mapping>
+ </identity-store-mappings>
+ <options>
+ <option>
+ <name>allowNotDefinedAttributes</name>
+ <value>true</value>
+ </option>
+ </options>
+ </repository>
+ </repositories>
+ <stores>
+ <attribute-stores/>
+ <identity-stores>
+ <identity-store>
+ <id>Hibernate Identity Store</id>
+ <class>org.jboss.identity.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>
+ <!--<relationship>-->
+ <!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
+ <!--<identity-object-type-ref>ORGANIZATION</identity-object-type-ref>-->
+ <!--</relationship>-->
+ <!--<relationship>-->
+ <!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
+ <!--<identity-object-type-ref>COMMUNITY</identity-object-type-ref>-->
+ <!--</relationship>-->
+ <!--<relationship>-->
+ <!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
+ <!--<identity-object-type-ref>OFFICE</identity-object-type-ref>-->
+ <!--</relationship>-->
+ <!--<relationship>-->
+ <!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
+ <!--<identity-object-type-ref>SECURITY</identity-object-type-ref>-->
+ <!--</relationship>-->
+ <!--<relationship>-->
+ <!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
+ <!--<identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>-->
+ <!--</relationship>-->
+ <!--<relationship>-->
+ <!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
+ <!--<identity-object-type-ref>PROJECT</identity-object-type-ref>-->
+ <!--</relationship>-->
+ <!--<relationship>-->
+ <!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
+ <!--<identity-object-type-ref>PEOPLE</identity-object-type-ref>-->
+ <!--</relationship>-->
+ </relationships>
+ <credentials>
+ <credential-type>PASSWORD</credential-type>
+ </credentials>
+ <attributes>
+ <attribute>
+ <name>picture</name>
+ <mapping>user.picture</mapping>
+ <type>binary</type>
+ <isRequired>false</isRequired>
+ <isMultivalued>false</isMultivalued>
+ <isReadOnly>false</isReadOnly>
+ </attribute>
+ </attributes>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ORGANIZATION</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>DIVISION</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ORGANIZATION_UNIT</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>DIVISION</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>DEPARTMENT</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>OFFICE</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>PEOPLE</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>PROJECT</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>DIVISION</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>DEPARTMENT</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>DEPARTMENT</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>DEPARTMENT</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>PROJECT</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>PEOPLE</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ADMINISTRATION</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>COMMUNITY</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>OFFICE</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>SECURITY</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>SYSTEM</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>SECURITY</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>COMMUNITY</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ </supported-identity-object-types>
+ <options>
+ <option>
+ <name>hibernateConfiguration</name>
+ <value>hibernate-jboss-identity.cfg.xml</value>
+ </option>
+ <!--<option>-->
+ <!--<name>hibernateSessionFactoryJNDIName</name>-->
+ <!--<value>java:/jbossidentity/HibernateStoreSessionFactory</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>
+ <option>
+ <name>allowNotDefinedAttributes</name>
+ <value>true</value>
+ </option>
+ </options>
+ </identity-store>
+ <identity-store>
+ <id>LDAP Identity Store</id>
+ <class>org.jboss.identity.idm.impl.store.ldap.LDAPIdentityStoreImpl</class>
+ <external-config/>
+ <supported-relationship-types>
+ <relationship-type>JBOSS_IDENTITY_MEMBERSHIP</relationship-type>
+ </supported-relationship-types>
+ <supported-identity-object-types>
+ <identity-object-type>
+ <name>USER</name>
+ <relationships/>
+ <credentials>
+ <credential-type>PASSWORD</credential-type>
+ </credentials>
+ <attributes>
+ <attribute>
+ <name>phone</name>
+ <mapping>telephoneNumber</mapping>
+ <type>text</type>
+ <isRequired>false</isRequired>
+ <isMultivalued>false</isMultivalued>
+ <isReadOnly>false</isReadOnly>
+ </attribute>
+ <attribute>
+ <name>description</name>
+ <mapping>description</mapping>
+ <type>text</type>
+ <isRequired>false</isRequired>
+ <isMultivalued>false</isMultivalued>
+ <isReadOnly>false</isReadOnly>
+ </attribute>
+ <attribute>
+ <name>carLicense</name>
+ <mapping>carLicense</mapping>
+ <type>text</type>
+ <isRequired>false</isRequired>
+ <isMultivalued>false</isMultivalued>
+ <isReadOnly>false</isReadOnly>
+ </attribute>
+ </attributes>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>uid</value>
+ </option>
+ <option>
+ <name>passwordAttributeName</name>
+ <value>userPassword</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=People,o=test,dc=portal,dc=example,dc=com</value>
+ </option>
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=inetOrgPerson</value>
+ <value>sn= </value>
+ <value>cn= </value>
+ </option>
+ </options>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ORGANIZATION</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>DEPARTMENT</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>OFFICE</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=Organizations,o=test,dc=portal,dc=example,dc=com</value>
+ </option>
+ <!--<option>-->
+ <!--<name>entrySearchFilter</name>-->
+ <!--<value></value>-->
+ <!--</option>-->
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>membershipAttributeName</name>
+ <value>member</value>
+ </option>
+ <option>
+ <name>isMembershipAttributeDN</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>allowEmptyMemberships</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=groupOfNames</value>
+ </option>
+ </options>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ORGANIZATION_UNIT</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>DEPARTMENT</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>OFFICE</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=OrganizationUnits,o=test,dc=portal,dc=example,dc=com</value>
+ </option>
+ <!--<option>-->
+ <!--<name>entrySearchFilter</name>-->
+ <!--<value></value>-->
+ <!--</option>-->
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>membershipAttributeName</name>
+ <value>member</value>
+ </option>
+ <option>
+ <name>isMembershipAttributeDN</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>allowEmptyMemberships</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=groupOfNames</value>
+ </option>
+ </options>
+ </identity-object-type>
+ <identity-object-type>
+ <name>DEPARTMENT</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>DEPARTMENT</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=Departments,o=test,dc=portal,dc=example,dc=com</value>
+ </option>
+ <!--<option>-->
+ <!--<name>entrySearchFilter</name>-->
+ <!--<value></value>-->
+ <!--</option>-->
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>membershipAttributeName</name>
+ <value>member</value>
+ </option>
+ <option>
+ <name>isMembershipAttributeDN</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>allowEmptyMemberships</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=groupOfNames</value>
+ </option>
+ </options>
+ </identity-object-type>
+ <identity-object-type>
+ <name>OFFICE</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=Offices,o=test,dc=portal,dc=example,dc=com</value>
+ </option>
+ <!--<option>-->
+ <!--<name>entrySearchFilter</name>-->
+ <!--<value></value>-->
+ <!--</option>-->
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>membershipAttributeName</name>
+ <value>member</value>
+ </option>
+ <option>
+ <name>isMembershipAttributeDN</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>allowEmptyMemberships</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=groupOfNames</value>
+ </option>
+ </options>
+ </identity-object-type>
+ </supported-identity-object-types>
+ <options>
+ <option>
+ <name>providerURL</name>
+ <value>ldap://localhost:10389</value>
+ </option>
+ <option>
+ <name>adminDN</name>
+ <value>cn=Directory Manager</value>
+ </option>
+ <option>
+ <name>adminPassword</name>
+ <value>password</value>
+ </option>
+ <option>
+ <name>searchTimeLimit</name>
+ <value>10000</value>
+ </option>
+ </options>
+ </identity-store>
+ </identity-stores>
+ </stores>
+</jboss-identity>
\ No newline at end of file
Copied: idm/trunk/idm-testsuite/src/test/resources/organization-test-jboss-unit-config.xml (from rev 482, idm/trunk/idm-core/src/test/resources/organization-test-jboss-unit-config.xml)
===================================================================
--- idm/trunk/idm-testsuite/src/test/resources/organization-test-jboss-unit-config.xml (rev 0)
+++ idm/trunk/idm-testsuite/src/test/resources/organization-test-jboss-unit-config.xml 2009-05-09 11:10:49 UTC (rev 485)
@@ -0,0 +1,792 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_alpha"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_alpha identity-config.xsd">
+ <realms>
+ <realm>
+ <id>realm://RedHat/DB</id>
+ <repository-id-ref>RedHat Repository DB</repository-id-ref>
+ <identity-type-mappings>
+ <user-mapping>USER</user-mapping>
+ </identity-type-mappings>
+ </realm>
+ <realm>
+ <id>realm://portal/SamplePortal/DB</id>
+ <repository-id-ref>Sample Portal Repository DB</repository-id-ref>
+ <identity-type-mappings>
+ <user-mapping>USER</user-mapping>
+ </identity-type-mappings>
+ </realm>
+ <realm>
+ <id>realm://RedHat/DB_LDAP</id>
+ <repository-id-ref>RedHat Repository DB+LDAP</repository-id-ref>
+ <identity-type-mappings>
+ <user-mapping>USER</user-mapping>
+ </identity-type-mappings>
+ </realm>
+ <realm>
+ <id>realm://portal/SamplePortal/DB_LDAP</id>
+ <repository-id-ref>Sample Portal Repository DB+LDAP</repository-id-ref>
+ <identity-type-mappings>
+ <user-mapping>USER</user-mapping>
+ </identity-type-mappings>
+ </realm>
+ </realms>
+ <repositories>
+ <repository>
+ <id>RedHat Repository DB</id>
+ <class>org.jboss.identity.idm.impl.repository.WrapperIdentityStoreRepository</class>
+ <external-config/>
+ <default-identity-store-id>Hibernate Identity Store</default-identity-store-id>
+ <default-attribute-store-id>Hibernate Identity Store</default-attribute-store-id>
+ <options>
+ <option>
+ <name>allowNotDefinedAttributes</name>
+ <value>true</value>
+ </option>
+ </options>
+ </repository>
+ <repository>
+ <id>Sample Portal Repository DB</id>
+ <class>org.jboss.identity.idm.impl.repository.WrapperIdentityStoreRepository</class>
+ <external-config/>
+ <default-identity-store-id>Hibernate Identity Store</default-identity-store-id>
+ <default-attribute-store-id>Hibernate Identity Store</default-attribute-store-id>
+ <options>
+ <option>
+ <name>allowNotDefinedAttributes</name>
+ <value>true</value>
+ </option>
+ </options>
+ </repository>
+ <repository>
+ <id>RedHat Repository DB+LDAP</id>
+ <class>org.jboss.identity.idm.impl.repository.FallbackIdentityStoreRepository</class>
+ <external-config/>
+ <default-identity-store-id>Hibernate Identity Store</default-identity-store-id>
+ <default-attribute-store-id>Hibernate Identity Store</default-attribute-store-id>
+ <identity-store-mappings>
+ <identity-store-mapping>
+ <identity-store-id>Hibernate Identity Store</identity-store-id>
+ <identity-object-types>
+ <identity-object-type>DIVISION</identity-object-type>
+ <identity-object-type>PROJECT</identity-object-type>
+ <identity-object-type>PEOPLE</identity-object-type>
+ </identity-object-types>
+ <options/>
+ </identity-store-mapping>
+ <identity-store-mapping>
+ <identity-store-id>LDAP Identity Store</identity-store-id>
+ <identity-object-types>
+ <identity-object-type>USER</identity-object-type>
+ <identity-object-type>ORGANIZATION</identity-object-type>
+ <identity-object-type>ORGANIZATION_UNIT</identity-object-type>
+ <identity-object-type>DEPARTMENT</identity-object-type>
+ </identity-object-types>
+ <options>
+ <option>
+ <name>cache</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>cache.config-file</name>
+ <value>jboss-cache-config.xml</value>
+ </option>
+ </options>
+ </identity-store-mapping>
+ </identity-store-mappings>
+ <options>
+ <option>
+ <name>allowNotDefinedAttributes</name>
+ <value>true</value>
+ </option>
+ </options>
+ </repository>
+ <repository>
+ <id>Sample Portal Repository DB+LDAP</id>
+ <class>org.jboss.identity.idm.impl.repository.FallbackIdentityStoreRepository</class>
+ <external-config/>
+ <default-identity-store-id>Hibernate Identity Store</default-identity-store-id>
+ <default-attribute-store-id>Hibernate Identity Store</default-attribute-store-id>
+ <identity-store-mappings>
+ <identity-store-mapping>
+ <identity-store-id>Hibernate Identity Store</identity-store-id>
+ <identity-object-types>
+ <identity-object-type>SYSTEM</identity-object-type>
+ <identity-object-type>ADMINISTRATION</identity-object-type>
+ <identity-object-type>COMMUNITY</identity-object-type>
+ <identity-object-type>DIVISION</identity-object-type>
+ <identity-object-type>SECURITY</identity-object-type>
+ <identity-object-type>PEOPLE</identity-object-type>
+ </identity-object-types>
+ <options/>
+ </identity-store-mapping>
+ <identity-store-mapping>
+ <identity-store-id>LDAP Identity Store</identity-store-id>
+ <identity-object-types>
+ <identity-object-type>USER</identity-object-type>
+ <identity-object-type>DEPARTMENT</identity-object-type>
+ <identity-object-type>ORGANIZATION</identity-object-type>
+ <identity-object-type>ORGANIZATION_UNIT</identity-object-type>
+ <identity-object-type>OFFICE</identity-object-type>
+ </identity-object-types>
+ <options>
+ <option>
+ <name>cache</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>cache.config-file</name>
+ <value>jboss-cache-config.xml</value>
+ </option>
+ </options>
+ </identity-store-mapping>
+ </identity-store-mappings>
+ <options>
+ <option>
+ <name>allowNotDefinedAttributes</name>
+ <value>true</value>
+ </option>
+ </options>
+ </repository>
+ </repositories>
+ <stores>
+ <attribute-stores/>
+ <identity-stores>
+ <identity-store>
+ <id>Hibernate Identity Store</id>
+ <class>org.jboss.identity.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>
+ <!--<relationship>-->
+ <!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
+ <!--<identity-object-type-ref>ORGANIZATION</identity-object-type-ref>-->
+ <!--</relationship>-->
+ <!--<relationship>-->
+ <!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
+ <!--<identity-object-type-ref>COMMUNITY</identity-object-type-ref>-->
+ <!--</relationship>-->
+ <!--<relationship>-->
+ <!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
+ <!--<identity-object-type-ref>OFFICE</identity-object-type-ref>-->
+ <!--</relationship>-->
+ <!--<relationship>-->
+ <!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
+ <!--<identity-object-type-ref>SECURITY</identity-object-type-ref>-->
+ <!--</relationship>-->
+ <!--<relationship>-->
+ <!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
+ <!--<identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>-->
+ <!--</relationship>-->
+ <!--<relationship>-->
+ <!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
+ <!--<identity-object-type-ref>PROJECT</identity-object-type-ref>-->
+ <!--</relationship>-->
+ <!--<relationship>-->
+ <!--<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>-->
+ <!--<identity-object-type-ref>PEOPLE</identity-object-type-ref>-->
+ <!--</relationship>-->
+ </relationships>
+ <credentials>
+ <credential-type>PASSWORD</credential-type>
+ </credentials>
+ <attributes>
+ <attribute>
+ <name>picture</name>
+ <mapping>user.picture</mapping>
+ <type>binary</type>
+ <isRequired>false</isRequired>
+ <isMultivalued>false</isMultivalued>
+ <isReadOnly>false</isReadOnly>
+ </attribute>
+ </attributes>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ORGANIZATION</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>DIVISION</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ORGANIZATION_UNIT</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>DIVISION</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>DEPARTMENT</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>OFFICE</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>PEOPLE</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>PROJECT</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>DIVISION</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>DEPARTMENT</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>DEPARTMENT</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>DEPARTMENT</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>PROJECT</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>PEOPLE</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ADMINISTRATION</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>COMMUNITY</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>OFFICE</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>SECURITY</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>SYSTEM</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>SECURITY</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>COMMUNITY</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ </supported-identity-object-types>
+ <options>
+ <!--<option>-->
+ <!--<name>hibernateConfiguration</name>-->
+ <!--<value>hibernate-jboss-identity.cfg.xml</value>-->
+ <!--</option>-->
+ <option>
+ <name>hibernateSessionFactoryJNDIName</name>
+ <value>java:/jbossidentity/HibernateStoreSessionFactory</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>
+ <option>
+ <name>allowNotDefinedAttributes</name>
+ <value>true</value>
+ </option>
+ </options>
+ </identity-store>
+ <identity-store>
+ <id>LDAP Identity Store</id>
+ <class>org.jboss.identity.idm.impl.store.ldap.LDAPIdentityStoreImpl</class>
+ <external-config/>
+ <supported-relationship-types>
+ <relationship-type>JBOSS_IDENTITY_MEMBERSHIP</relationship-type>
+ </supported-relationship-types>
+ <supported-identity-object-types>
+ <identity-object-type>
+ <name>USER</name>
+ <relationships/>
+ <credentials>
+ <credential-type>PASSWORD</credential-type>
+ </credentials>
+ <attributes>
+ <attribute>
+ <name>phone</name>
+ <mapping>telephoneNumber</mapping>
+ <type>text</type>
+ <isRequired>false</isRequired>
+ <isMultivalued>false</isMultivalued>
+ <isReadOnly>false</isReadOnly>
+ </attribute>
+ <attribute>
+ <name>description</name>
+ <mapping>description</mapping>
+ <type>text</type>
+ <isRequired>false</isRequired>
+ <isMultivalued>false</isMultivalued>
+ <isReadOnly>false</isReadOnly>
+ </attribute>
+ <attribute>
+ <name>carLicense</name>
+ <mapping>carLicense</mapping>
+ <type>text</type>
+ <isRequired>false</isRequired>
+ <isMultivalued>false</isMultivalued>
+ <isReadOnly>false</isReadOnly>
+ </attribute>
+ </attributes>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>uid</value>
+ </option>
+ <option>
+ <name>passwordAttributeName</name>
+ <value>userPassword</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=People,o=test,dc=portal,dc=example,dc=com</value>
+ </option>
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=inetOrgPerson</value>
+ <value>sn= </value>
+ <value>cn= </value>
+ </option>
+ </options>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ORGANIZATION</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>DEPARTMENT</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>OFFICE</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=Organizations,o=test,dc=portal,dc=example,dc=com</value>
+ </option>
+ <!--<option>-->
+ <!--<name>entrySearchFilter</name>-->
+ <!--<value></value>-->
+ <!--</option>-->
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>membershipAttributeName</name>
+ <value>member</value>
+ </option>
+ <option>
+ <name>isMembershipAttributeDN</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>allowEmptyMemberships</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=groupOfNames</value>
+ </option>
+ </options>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ORGANIZATION_UNIT</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>DEPARTMENT</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>OFFICE</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=OrganizationUnits,o=test,dc=portal,dc=example,dc=com</value>
+ </option>
+ <!--<option>-->
+ <!--<name>entrySearchFilter</name>-->
+ <!--<value></value>-->
+ <!--</option>-->
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>membershipAttributeName</name>
+ <value>member</value>
+ </option>
+ <option>
+ <name>isMembershipAttributeDN</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>allowEmptyMemberships</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=groupOfNames</value>
+ </option>
+ </options>
+ </identity-object-type>
+ <identity-object-type>
+ <name>DEPARTMENT</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>DEPARTMENT</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=Departments,o=test,dc=portal,dc=example,dc=com</value>
+ </option>
+ <!--<option>-->
+ <!--<name>entrySearchFilter</name>-->
+ <!--<value></value>-->
+ <!--</option>-->
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>membershipAttributeName</name>
+ <value>member</value>
+ </option>
+ <option>
+ <name>isMembershipAttributeDN</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>allowEmptyMemberships</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=groupOfNames</value>
+ </option>
+ </options>
+ </identity-object-type>
+ <identity-object-type>
+ <name>OFFICE</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=Offices,o=test,dc=portal,dc=example,dc=com</value>
+ </option>
+ <!--<option>-->
+ <!--<name>entrySearchFilter</name>-->
+ <!--<value></value>-->
+ <!--</option>-->
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>membershipAttributeName</name>
+ <value>member</value>
+ </option>
+ <option>
+ <name>isMembershipAttributeDN</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>allowEmptyMemberships</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=groupOfNames</value>
+ </option>
+ </options>
+ </identity-object-type>
+ </supported-identity-object-types>
+ <options>
+ <option>
+ <name>providerURL</name>
+ <value>ldap://localhost:10389</value>
+ </option>
+ <option>
+ <name>adminDN</name>
+ <value>cn=Directory Manager</value>
+ </option>
+ <option>
+ <name>adminPassword</name>
+ <value>password</value>
+ </option>
+ <option>
+ <name>searchTimeLimit</name>
+ <value>10000</value>
+ </option>
+ </options>
+ </identity-store>
+ </identity-stores>
+ </stores>
+</jboss-identity>
\ No newline at end of file
Copied: idm/trunk/idm-testsuite/src/test/resources/store-test-config.xml (from rev 482, idm/trunk/idm-core/src/test/resources/store-test-config.xml)
===================================================================
--- idm/trunk/idm-testsuite/src/test/resources/store-test-config.xml (rev 0)
+++ idm/trunk/idm-testsuite/src/test/resources/store-test-config.xml 2009-05-09 11:10:49 UTC (rev 485)
@@ -0,0 +1,373 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_alpha"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_alpha identity-config.xsd">
+ <realms>
+ <realm>
+ <id>realm://Dymmy</id>
+ <repository-id-ref>X</repository-id-ref>
+ <identity-type-mappings>
+ <user-mapping>USER</user-mapping>
+ </identity-type-mappings>
+ </realm>
+ </realms>
+ <repositories>
+ <repository>
+ <id>X</id>
+ <class>X</class>
+ <external-config/>
+ <default-identity-store-id>HibernateTestStore</default-identity-store-id>
+ <default-attribute-store-id>HibernateTestStore</default-attribute-store-id>
+ <!--<identity-store-mappings>-->
+ <!--<identity-store-mapping>-->
+ <!--<identity-store-id>HibernateTestStore</identity-store-id>-->
+ <!--<identity-object-types/>-->
+ <!--<options/>-->
+ <!--</identity-store-mapping>-->
+ <!--</identity-store-mappings>-->
+ </repository>
+ </repositories>
+ <stores>
+ <attribute-stores/>
+ <identity-stores>
+ <identity-store>
+ <id>HibernateTestStore</id>
+ <class>org.jboss.identity.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>
+ <credential-type>BINARY</credential-type>
+ </credentials>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>GROUP</name>
+ <relationships/>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ORGANIZATION</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ROLE</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>GROUP</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ROLE</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ </supported-identity-object-types>
+ <options>
+ <!--<option>-->
+ <!--<name>hibernateConfiguration</name>-->
+ <!--<value>hibernate-jboss-identity.cfg.xml</value>-->
+ <!--</option>-->
+ <option>
+ <name>hibernateSessionFactoryJNDIName</name>
+ <value>java:/jbossidentity/HibernateStoreSessionFactory</value>
+ </option>
+ <option>
+ <name>populateRelationshipTypes</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>populateIdentityObjectTypes</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>isRealmAware</name>
+ <value>false</value>
+ </option>
+ <option>
+ <name>allowNotDefinedAttributes</name>
+ <value>true</value>
+ </option>
+ </options>
+ </identity-store>
+ <identity-store>
+ <id>LDAPTestStore</id>
+ <class>org.jboss.identity.idm.impl.store.ldap.LDAPIdentityStoreImpl</class>
+ <external-config/>
+ <supported-relationship-types>
+ <relationship-type>JBOSS_IDENTITY_MEMBERSHIP</relationship-type>
+ </supported-relationship-types>
+ <supported-identity-object-types>
+ <identity-object-type>
+ <name>USER</name>
+ <relationships/>
+ <credentials>
+ <credential-type>PASSWORD</credential-type>
+ </credentials>
+ <attributes>
+ <attribute>
+ <name>phone</name>
+ <mapping>telephoneNumber</mapping>
+ <type>text</type>
+ <isRequired/>
+ <isMultivalued>true</isMultivalued>
+ <isReadOnly/>
+ </attribute>
+ <attribute>
+ <name>description</name>
+ <mapping>description</mapping>
+ <type>text</type>
+ <isRequired/>
+ <isMultivalued>true</isMultivalued>
+ <isReadOnly/>
+ </attribute>
+ <attribute>
+ <name>carLicense</name>
+ <mapping>carLicense</mapping>
+ <type>text</type>
+ <isRequired/>
+ <isMultivalued>true</isMultivalued>
+ <isReadOnly/>
+ </attribute>
+ </attributes>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>uid</value>
+ </option>
+ <option>
+ <name>passwordAttributeName</name>
+ <value>userPassword</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=People,o=test,dc=portal,dc=example,dc=com</value>
+ </option>
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=inetOrgPerson</value>
+ <value>sn= </value>
+ <value>cn= </value>
+ </option>
+ </options>
+ </identity-object-type>
+ <identity-object-type>
+ <name>GROUP</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ROLE</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>GROUP</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=Groups,o=test,dc=portal,dc=example,dc=com</value>
+ </option>
+ <!--<option>-->
+ <!--<name>entrySearchFilter</name>-->
+ <!--<value></value>-->
+ <!--</option>-->
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>membershipAttributeName</name>
+ <value>member</value>
+ </option>
+ <option>
+ <name>isMembershipAttributeDN</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>allowEmptyMemberships</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=groupOfNames</value>
+ </option>
+ </options>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ORGANIZATION</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ROLE</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>GROUP</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=Organizations,o=test,dc=portal,dc=example,dc=com</value>
+ </option>
+ <!--<option>-->
+ <!--<name>entrySearchFilter</name>-->
+ <!--<value></value>-->
+ <!--</option>-->
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>membershipAttributeName</name>
+ <value>member</value>
+ </option>
+ <option>
+ <name>isMembershipAttributeDN</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>allowEmptyMemberships</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=groupOfNames</value>
+ </option>
+ </options>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ROLE</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=Roles,o=test,dc=portal,dc=example,dc=com</value>
+ </option>
+ <!--<option>-->
+ <!--<name>entrySearchFilter</name>-->
+ <!--<value></value>-->
+ <!--</option>-->
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>membershipAttributeName</name>
+ <value>member</value>
+ </option>
+ <option>
+ <name>isMembershipAttributeDN</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>allowEmptyMemberships</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=groupOfNames</value>
+ </option>
+ </options>
+ </identity-object-type>
+ </supported-identity-object-types>
+ <options>
+ <option>
+ <name>providerURL</name>
+ <value>ldap://localhost:10389</value>
+ </option>
+ <option>
+ <name>adminDN</name>
+ <value>cn=Directory Manager</value>
+ </option>
+ <option>
+ <name>adminPassword</name>
+ <value>password</value>
+ </option>
+ <option>
+ <name>searchTimeLimit</name>
+ <value>10000</value>
+ </option>
+ </options>
+ </identity-store>
+ </identity-stores>
+ </stores>
+</jboss-identity>
\ No newline at end of file
Property changes on: idm/trunk/idm-testsuite/src/test/resources/store-test-config.xml
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: idm/trunk/pom.xml
===================================================================
--- idm/trunk/pom.xml 2009-05-09 10:22:47 UTC (rev 484)
+++ idm/trunk/pom.xml 2009-05-09 11:10:49 UTC (rev 485)
@@ -19,7 +19,11 @@
<module>idm-spi</module>
<module>idm-api</module>
<module>idm-core</module>
+ <module>idm-hibernate</module>
+ <module>idm-ldap</module>
+ <module>idm-cache</module>
<module>idm-auth</module>
+ <module>idm-testsuite</module>
<module>integration</module>
<module>assembly</module>
</modules>
15 years, 8 months
JBoss Identity SVN: r484 - idm/trunk.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-05-09 06:22:47 -0400 (Sat, 09 May 2009)
New Revision: 484
Removed:
idm/trunk/idm/
Log:
toto
15 years, 8 months
JBoss Identity SVN: r483 - idm/trunk/idm-core.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-05-09 06:21:42 -0400 (Sat, 09 May 2009)
New Revision: 483
Modified:
idm/trunk/idm-core/pom.xml
Log:
rename idm module
Modified: idm/trunk/idm-core/pom.xml
===================================================================
--- idm/trunk/idm-core/pom.xml 2009-05-09 10:18:57 UTC (rev 482)
+++ idm/trunk/idm-core/pom.xml 2009-05-09 10:21:42 UTC (rev 483)
@@ -8,7 +8,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>idm-core</artifactId>
<packaging>jar</packaging>
- <name>JBoss Identity IDM Implementation</name>
+ <name>JBoss Identity IDM Implemnentation</name>
<url>http://labs.jboss.org/portal/jbosssecurity/</url>
<description>JBoss Identity IDM IMPL contains the implementation of the API and the Identity Model.</description>
<licenses>
15 years, 8 months
JBoss Identity SVN: r481 - in idm/trunk: idm/src/main/java/org/jboss/identity/idm/impl/api/model and 24 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-05-09 05:51:45 -0400 (Sat, 09 May 2009)
New Revision: 481
Added:
idm/trunk/idm-auth/
idm/trunk/idm-auth/pom.xml
idm/trunk/idm-auth/src/
idm/trunk/idm-auth/src/main/
idm/trunk/idm-auth/src/main/java/
idm/trunk/idm-auth/src/main/java/org/
idm/trunk/idm-auth/src/main/java/org/jboss/
idm/trunk/idm-auth/src/main/java/org/jboss/identity/
idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/
idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/
idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/JBossIdentityIDMLoginModule.java
idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/UserPrincipal.java
idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/UserStatus.java
idm/trunk/idm-auth/src/main/resources/
idm/trunk/idm-auth/src/main/test/
idm/trunk/idm-auth/src/main/test/java/
idm/trunk/idm-auth/src/main/test/resources/
Modified:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/AttributesManager.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/PersistenceManager.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/Role.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/UserQueryBuilder.java
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStore.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleGroup.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleRole.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleRoleType.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleUser.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQueryBuilder.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryBuilderImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/PersistenceManagerImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/cache/IdentityStoreCacheSupport.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreWrapper.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/FallbackIdentityStoreRepository.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/WrapperIdentityStoreRepository.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/FeaturesMetaDataImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreImpl.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/PersistenceManagerTest.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RelationshipManagerTest.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RoleManagerTest.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/UserQueryTest.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/CommonIdentityStoreTest.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java
idm/trunk/pom.xml
Log:
some small corrections and placeholder auth module
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleGroup.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleGroup.java 2009-05-08 20:46:17 UTC (rev 480)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleGroup.java 2009-05-09 09:51:45 UTC (rev 481)
@@ -105,4 +105,14 @@
result = 31 * result + (groupType != null ? groupType.hashCode() : 0);
return result;
}
+
+ @Override
+ public String toString()
+ {
+ return "SimpleGroup{" +
+ "name='" + name + '\'' +
+ ", id='" + id + '\'' +
+ ", groupType='" + groupType + '\'' +
+ '}';
+ }
}
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleRole.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleRole.java 2009-05-08 20:46:17 UTC (rev 480)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleRole.java 2009-05-09 09:51:45 UTC (rev 481)
@@ -35,20 +35,20 @@
{
private final RoleType type;
- private final User identity;
+ private final User user;
private final Group group;
- public SimpleRole(RoleType type, User identity, Group group)
+ public SimpleRole(RoleType type, User user, Group group)
{
this.type = type;
- this.identity = identity;
+ this.user = user;
this.group = group;
}
- public User getIdentity()
+ public User getUser()
{
- return identity;
+ return user;
}
public Group getGroup()
@@ -79,7 +79,7 @@
{
return false;
}
- if (identity != null ? !identity.equals(that.identity) : that.identity != null)
+ if (user != null ? !user.equals(that.user) : that.user != null)
{
return false;
}
@@ -95,8 +95,18 @@
public int hashCode()
{
int result = type != null ? type.hashCode() : 0;
- result = 31 * result + (identity != null ? identity.hashCode() : 0);
+ result = 31 * result + (user != null ? user.hashCode() : 0);
result = 31 * result + (group != null ? group.hashCode() : 0);
return result;
}
+
+ @Override
+ public String toString()
+ {
+ return "SimpleRole{" +
+ "type=" + type +
+ ", identity=" + user +
+ ", group=" + group +
+ '}';
+ }
}
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleRoleType.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleRoleType.java 2009-05-08 20:46:17 UTC (rev 480)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleRoleType.java 2009-05-09 09:51:45 UTC (rev 481)
@@ -71,4 +71,12 @@
{
return (name != null ? name.hashCode() : 0);
}
+
+ @Override
+ public String toString()
+ {
+ return "SimpleRoleType{" +
+ "name='" + name + '\'' +
+ '}';
+ }
}
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleUser.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleUser.java 2009-05-08 20:46:17 UTC (rev 480)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleUser.java 2009-05-09 09:51:45 UTC (rev 481)
@@ -71,5 +71,11 @@
return id != null ? id.hashCode() : 0;
}
-
+ @Override
+ public String toString()
+ {
+ return "SimpleUser{" +
+ "id='" + id + '\'' +
+ '}';
+ }
}
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQueryBuilder.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQueryBuilder.java 2009-05-08 20:46:17 UTC (rev 480)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQueryBuilder.java 2009-05-09 09:51:45 UTC (rev 481)
@@ -97,7 +97,20 @@
return this;
}
+ public QueryBuilder idFilter(String idFilter) throws UnsupportedQueryCriterium
+ {
+ try
+ {
+ searchCriteria.idFilter(idFilter);
+ }
+ catch (UnsupportedCriterium unsupportedCriterium)
+ {
+ throw new UnsupportedQueryCriterium(unsupportedCriterium);
+ }
+ return this;
+ }
+
protected void checkNotNullArgument(Object arg, String name)
{
if (arg == null)
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryBuilderImpl.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryBuilderImpl.java 2009-05-08 20:46:17 UTC (rev 480)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryBuilderImpl.java 2009-05-09 09:51:45 UTC (rev 481)
@@ -25,6 +25,7 @@
import org.jboss.identity.idm.api.query.UserQueryBuilder;
import org.jboss.identity.idm.api.query.UserQuery;
import org.jboss.identity.idm.api.query.UnsupportedQueryCriterium;
+import org.jboss.identity.idm.api.query.QueryBuilder;
import org.jboss.identity.idm.api.Group;
import org.jboss.identity.idm.api.SortOrder;
import org.jboss.identity.idm.impl.api.IdentitySearchCriteriaImpl;
@@ -188,4 +189,9 @@
{
return (UserQueryBuilder)super.attributeValuesFilter(attributeName, attributeValue);
}
+
+ public UserQueryBuilder idFilter(String idFilter) throws UnsupportedQueryCriterium
+ {
+ return (UserQueryBuilder)super.idFilter(idFilter);
+ }
}
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java 2009-05-08 20:46:17 UTC (rev 480)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java 2009-05-09 09:51:45 UTC (rev 481)
@@ -118,11 +118,11 @@
}
}
- protected IdentityObject createIdentityObject(User identity)
+ protected IdentityObject createIdentityObject(User user)
{
IdentityObjectType iot = getSessionContext().getIdentityObjectTypeMapper().getIdentityObjectType();
- return new SimpleIdentityObject(identity.getId(), iot);
+ return new SimpleIdentityObject(user.getId(), iot);
}
protected IdentityObject createIdentityObjectForUserName(String userName)
@@ -184,20 +184,20 @@
return new SimpleGroup(new GroupId(id));
}
- protected IdentityObjectSearchCriteria convertSearchControls(IdentitySearchCriteria controls)
+ protected IdentityObjectSearchCriteria convertSearchControls(IdentitySearchCriteria criteria)
{
- if (controls == null)
+ if (criteria == null)
{
return null;
}
- if (controls instanceof IdentityObjectSearchCriteria)
+ if (criteria instanceof IdentityObjectSearchCriteria)
{
- return (IdentityObjectSearchCriteria)controls;
+ return (IdentityObjectSearchCriteria)criteria;
}
else
{
- throw new IllegalArgumentException("Not supported IdentitySearchConstraints implementation: " + controls.getClass());
+ throw new IllegalArgumentException("Not supported IdentitySearchCriteria implementation: " + criteria.getClass());
}
}
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java 2009-05-08 20:46:17 UTC (rev 480)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java 2009-05-09 09:51:45 UTC (rev 481)
@@ -34,7 +34,6 @@
import org.jboss.identity.idm.spi.model.IdentityObjectCredential;
import org.jboss.identity.idm.spi.model.IdentityObjectAttribute;
import org.jboss.identity.idm.spi.configuration.metadata.IdentityObjectAttributeMetaData;
-import org.jboss.identity.idm.impl.api.session.managers.AbstractManager;
import org.jboss.identity.idm.impl.api.attribute.IdentityObjectAttributeMetaDataImpl;
import org.jboss.identity.idm.impl.api.SimpleAttribute;
import org.jboss.identity.idm.impl.api.PasswordCredential;
@@ -146,11 +145,11 @@
return getSupportedAttributeNames(identityType);
}
- public Map<String, Attribute> getAttributes(IdentityType identity) throws IdentityException
+ public Map<String, Attribute> getAttributes(IdentityType identityType) throws IdentityException
{
- checkNotNullArgument(identity, "IdentityType");
+ checkNotNullArgument(identityType, "IdentityType");
- Map<String, IdentityObjectAttribute> map = getRepository().getAttributes(getInvocationContext(), createIdentityObject(identity));
+ Map<String, IdentityObjectAttribute> map = getRepository().getAttributes(getInvocationContext(), createIdentityObject(identityType));
Map<String, Attribute> newMap = new HashMap<String, Attribute>();
@@ -192,12 +191,12 @@
}
- public Attribute getAttribute(IdentityType identity, String attributeName) throws IdentityException
+ public Attribute getAttribute(IdentityType identityType, String attributeName) throws IdentityException
{
- checkNotNullArgument(identity, "IdentityType");
+ checkNotNullArgument(identityType, "IdentityType");
checkNotNullArgument(attributeName, "Attribute name");
- return getAttributes(identity).get(attributeName);
+ return getAttributes(identityType).get(attributeName);
}
public Attribute getAttribute(String id, String attributeName) throws IdentityException
@@ -210,15 +209,15 @@
return getAttribute(identityType, attributeName);
}
- public void addAttribute(IdentityType identity, String attributeName, Object[] values) throws IdentityException
+ public void addAttribute(IdentityType identityType, String attributeName, Object[] values) throws IdentityException
{
- checkNotNullArgument(identity, "IdentityType");
+ checkNotNullArgument(identityType, "IdentityType");
checkNotNullArgument(attributeName, "Attribute name");
checkNotNullArgument(values, "Attribute values");
Attribute[] attrs = new Attribute[]{new SimpleAttribute(attributeName, values)};
- addAttributes(identity, attrs);
+ addAttributes(identityType, attrs);
}
public void addAttributes(String id, Attribute[] attributes) throws IdentityException
@@ -232,16 +231,16 @@
}
- public void addAttribute(IdentityType identity, String attributeName, Object value) throws IdentityException
+ public void addAttribute(IdentityType identityType, String attributeName, Object value) throws IdentityException
{
- checkNotNullArgument(identity, "IdentityType");
+ checkNotNullArgument(identityType, "IdentityType");
checkNotNullArgument(attributeName, "Attribute name");
checkNotNullArgument(value, "Attribute value");
Attribute[] attrs = new Attribute[]{new SimpleAttribute(attributeName, value)};
- addAttributes(identity, attrs);
+ addAttributes(identityType, attrs);
}
@@ -269,20 +268,20 @@
}
- public void addAttributes(IdentityType identity, Attribute[] attributes) throws IdentityException
+ public void addAttributes(IdentityType identityType, Attribute[] attributes) throws IdentityException
{
- checkNotNullArgument(identity, "IdentityType");
+ checkNotNullArgument(identityType, "IdentityType");
checkNotNullArgument(attributes, "Attributes");
- getRepository().addAttributes(getInvocationContext(), createIdentityObject(identity), convertAttributes(attributes));
+ getRepository().addAttributes(getInvocationContext(), createIdentityObject(identityType), convertAttributes(attributes));
}
- public void removeAttributes(IdentityType identity, String[] attributeNames) throws IdentityException
+ public void removeAttributes(IdentityType identityType, String[] attributeNames) throws IdentityException
{
- checkNotNullArgument(identity, "IdentityType");
+ checkNotNullArgument(identityType, "IdentityType");
checkNotNullArgument(attributeNames, "Attribute names");
- getRepository().removeAttributes(getInvocationContext(), createIdentityObject(identity), attributeNames);
+ getRepository().removeAttributes(getInvocationContext(), createIdentityObject(identityType), attributeNames);
}
public void removeAttributes(String id, String[] attributeNames) throws IdentityException
@@ -296,24 +295,24 @@
}
- public boolean hasPassword(User identity) throws IdentityException
+ public boolean hasPassword(User user) throws IdentityException
{
- checkNotNullArgument(identity, "User");
- return getRepository().getSupportedFeatures().isCredentialSupported(createIdentityObject(identity).getIdentityType(), PasswordCredential.TYPE);
+ checkNotNullArgument(user, "User");
+ return getRepository().getSupportedFeatures().isCredentialSupported(createIdentityObject(user).getIdentityType(), PasswordCredential.TYPE);
}
- public boolean validatePassword(User identity, String password) throws IdentityException
+ public boolean validatePassword(User user, String password) throws IdentityException
{
- checkNotNullArgument(identity, "User");
+ checkNotNullArgument(user, "User");
checkNotNullArgument(password, "Password");
- return getRepository().validateCredential(getInvocationContext(), createIdentityObject(identity), new PasswordCredential(password));
+ return getRepository().validateCredential(getInvocationContext(), createIdentityObject(user), new PasswordCredential(password));
}
- public void updatePassword(User identity, String password) throws IdentityException
+ public void updatePassword(User user, String password) throws IdentityException
{
- checkNotNullArgument(identity, "User");
+ checkNotNullArgument(user, "User");
checkNotNullArgument(password, "Password");
- getRepository().updateCredential(getInvocationContext(), createIdentityObject(identity), new PasswordCredential(password));
+ getRepository().updateCredential(getInvocationContext(), createIdentityObject(user), new PasswordCredential(password));
}
public boolean isCredentialTypeSupported(CredentialType credentialType) throws IdentityException
@@ -323,9 +322,9 @@
return getRepository().getSupportedFeatures().isCredentialSupported(getUserObjectType(), new SimpleCredentialType(credentialType.getName()));
}
- public boolean validateCredentials(User identity, Credential[] credentials) throws IdentityException
+ public boolean validateCredentials(User user, Credential[] credentials) throws IdentityException
{
- checkNotNullArgument(identity, "User");
+ checkNotNullArgument(user, "User");
checkNotNullArgument(credentials, "Credentials");
for (Credential credential : credentials)
@@ -343,7 +342,7 @@
// All credentials must pass
- if (!getRepository().validateCredential(getInvocationContext(), createIdentityObject(identity), ioc))
+ if (!getRepository().validateCredential(getInvocationContext(), createIdentityObject(user), ioc))
{
return false;
}
@@ -352,14 +351,14 @@
return true;
}
- public void updateCredential(User identity, Credential credential) throws IdentityException
+ public void updateCredential(User user, Credential credential) throws IdentityException
{
- checkNotNullArgument(identity, "User");
+ checkNotNullArgument(user, "User");
checkNotNullArgument(credential, "Credential");
if (credential instanceof IdentityObjectCredential)
{
- getRepository().updateCredential(getInvocationContext(), createIdentityObject(identity), (IdentityObjectCredential)credential);
+ getRepository().updateCredential(getInvocationContext(), createIdentityObject(user), (IdentityObjectCredential)credential);
}
else
{
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/PersistenceManagerImpl.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/PersistenceManagerImpl.java 2009-05-08 20:46:17 UTC (rev 480)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/PersistenceManagerImpl.java 2009-05-09 09:51:45 UTC (rev 481)
@@ -202,11 +202,11 @@
return createUser(getRepository().findIdentityObject(getInvocationContext(), name, getUserObjectType()));
}
- public Collection<User> findUser(IdentitySearchCriteria controls) throws IdentityException
+ public Collection<User> findUser(IdentitySearchCriteria criteria) throws IdentityException
{
- Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), getUserObjectType(), convertSearchControls(controls));
+ Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), getUserObjectType(), convertSearchControls(criteria));
List<User> identities = new LinkedList<User>();
for (Iterator<IdentityObject> iterator = ios.iterator(); iterator.hasNext();)
@@ -232,11 +232,11 @@
return createGroup(getRepository().findIdentityObject(getInvocationContext(), id));
}
- public Collection<Group> findGroup(String groupType, IdentitySearchCriteria controls) throws IdentityException
+ public Collection<Group> findGroup(String groupType, IdentitySearchCriteria criteria) throws IdentityException
{
checkNotNullArgument(groupType, "Group type");
- Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), getIdentityObjectType(groupType), convertSearchControls(controls));
+ Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), getIdentityObjectType(groupType), convertSearchControls(criteria));
List<Group> groups = new LinkedList<Group>();
for (Iterator<IdentityObject> iterator = ios.iterator(); iterator.hasNext();)
@@ -255,7 +255,7 @@
return findGroup(groupType, (IdentitySearchCriteria) null);
}
-// public boolean isVirtual(User identity)
+// public boolean isVirtual(User user)
// {
// //TODO:NYI
// throw new NotYetImplementedException("Postponed");
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java 2009-05-08 20:46:17 UTC (rev 480)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java 2009-05-09 09:51:45 UTC (rev 481)
@@ -467,7 +467,7 @@
return true;
}
- public Collection<Group> findAssociatedGroups(Group group, String groupType, boolean parent, boolean cascade, IdentitySearchCriteria controls) throws IdentityException
+ public Collection<Group> findAssociatedGroups(Group group, String groupType, boolean parent, boolean cascade, IdentitySearchCriteria criteria) throws IdentityException
{
checkNotNullArgument(group, "Group");
@@ -483,7 +483,7 @@
throw new NotYetImplementedException("Support for 'cascade' argument is not yet implemented. Please use 'false' value for now");
}
- Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), MEMBER, parent, convertSearchControls(controls));
+ Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), MEMBER, parent, convertSearchControls(criteria));
for (IdentityObject io : ios)
{
@@ -497,14 +497,14 @@
}
- public Collection<Group> findAssociatedGroups(String groupId, String groupType, boolean parent, boolean cascade, IdentitySearchCriteria controls) throws IdentityException
+ public Collection<Group> findAssociatedGroups(String groupId, String groupType, boolean parent, boolean cascade, IdentitySearchCriteria criteria) throws IdentityException
{
checkNotNullArgument(groupId, "Group Id");
// checkNotNullArgument(groupType, "Group type");
Group group = createGroupFromId(groupId);
- return findAssociatedGroups(group, groupType, parent, cascade, controls);
+ return findAssociatedGroups(group, groupType, parent, cascade, criteria);
}
public Collection<Group> findAssociatedGroups(Group group, String groupType, boolean parent, boolean cascade) throws IdentityException
@@ -515,16 +515,16 @@
return findAssociatedGroups(group, groupType, parent, cascade, null);
}
- public Collection<Group> findAssociatedGroups(User identity, String groupType, IdentitySearchCriteria controls) throws IdentityException
+ public Collection<Group> findAssociatedGroups(User user, String groupType, IdentitySearchCriteria criteria) throws IdentityException
{
- checkNotNullArgument(identity, "User");
+ checkNotNullArgument(user, "User");
//checkNotNullArgument(groupType, "Group type");
List<Group> identities = new LinkedList<Group>();
IdentityObjectType iot = groupType != null ? getIdentityObjectType(groupType) : null;
- Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(identity), MEMBER, false, convertSearchControls(controls));
+ Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(user), MEMBER, false, convertSearchControls(criteria));
for (IdentityObject io : ios)
{
@@ -537,31 +537,31 @@
return identities;
}
- public Collection<Group> findAssociatedGroups(String userName, String groupType, IdentitySearchCriteria controls) throws IdentityException
+ public Collection<Group> findAssociatedGroups(String userName, String groupType, IdentitySearchCriteria criteria) throws IdentityException
{
checkNotNullArgument(userName, "User name");
//checkNotNullArgument(groupType, "Group type");
User user = createUserFromId(userName);
- return findAssociatedGroups(user, groupType, controls);
+ return findAssociatedGroups(user, groupType, criteria);
}
- public Collection<Group> findAssociatedGroups(User identity, String groupType) throws IdentityException
+ public Collection<Group> findAssociatedGroups(User user, String groupType) throws IdentityException
{
- checkNotNullArgument(identity, "User");
+ checkNotNullArgument(user, "User");
//checkNotNullArgument(groupType, "Group type");
- return findAssociatedGroups(identity, groupType, null);
+ return findAssociatedGroups(user, groupType, null);
}
- public Collection<Group> findAssociatedGroups(User identity, IdentitySearchCriteria controls) throws IdentityException
+ public Collection<Group> findAssociatedGroups(User user, IdentitySearchCriteria criteria) throws IdentityException
{
- checkNotNullArgument(identity, "User");
+ checkNotNullArgument(user, "User");
List<Group> identities = new LinkedList<Group>();
- Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(identity), MEMBER, false, convertSearchControls(controls));
+ Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(user), MEMBER, false, convertSearchControls(criteria));
String userTypeName = getUserObjectType().getName();
@@ -577,23 +577,23 @@
return identities;
}
- public Collection<Group> findAssociatedGroups(String userName, IdentitySearchCriteria controls) throws IdentityException
+ public Collection<Group> findAssociatedGroups(String userName, IdentitySearchCriteria criteria) throws IdentityException
{
checkNotNullArgument(userName, "User name");
User user = createUserFromId(userName);
- return findAssociatedGroups(user, controls);
+ return findAssociatedGroups(user, criteria);
}
- public Collection<Group> findAssociatedGroups(User identity) throws IdentityException
+ public Collection<Group> findAssociatedGroups(User user) throws IdentityException
{
- checkNotNullArgument(identity, "User");
+ checkNotNullArgument(user, "User");
- return findAssociatedGroups(identity, (IdentitySearchCriteria)null);
+ return findAssociatedGroups(user, (IdentitySearchCriteria)null);
}
- public Collection<User> findAssociatedUsers(Group group, boolean cascade, IdentitySearchCriteria controls) throws IdentityException
+ public Collection<User> findAssociatedUsers(Group group, boolean cascade, IdentitySearchCriteria criteria) throws IdentityException
{
checkNotNullArgument(group, "Group");
@@ -605,7 +605,7 @@
throw new NotYetImplementedException("Support for 'cascade' argument is not yet implemented. Please use 'false' value for now");
}
- Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), MEMBER, true, convertSearchControls(controls));
+ Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), MEMBER, true, convertSearchControls(criteria));
String userTypeName = getUserObjectType().getName();
@@ -621,13 +621,13 @@
return identities;
}
- public Collection<User> findAssociatedUsers(String groupId, boolean cascade, IdentitySearchCriteria controls) throws IdentityException
+ public Collection<User> findAssociatedUsers(String groupId, boolean cascade, IdentitySearchCriteria criteria) throws IdentityException
{
checkNotNullArgument(groupId, "Group Id");
Group group = createGroupFromId(groupId);
- return findAssociatedUsers(group, cascade, controls);
+ return findAssociatedUsers(group, cascade, criteria);
}
public Collection<User> findAssociatedUsers(Group group, boolean cascade) throws IdentityException
@@ -637,13 +637,13 @@
return findAssociatedUsers(group, cascade, null);
}
- public Collection<Group> findRelatedGroups(User user, String groupType, IdentitySearchCriteria controls) throws IdentityException
+ public Collection<Group> findRelatedGroups(User user, String groupType, IdentitySearchCriteria criteria) throws IdentityException
{
checkNotNullArgument(user, "User");
List<Group> identities = new LinkedList<Group>();
- Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(user), null, false, convertSearchControls(controls));
+ Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(user), null, false, convertSearchControls(criteria));
String userTypeName = getUserObjectType().getName();
@@ -658,22 +658,22 @@
return identities;
}
- public Collection<Group> findRelatedGroups(String userName, String groupType, IdentitySearchCriteria controls) throws IdentityException
+ public Collection<Group> findRelatedGroups(String userName, String groupType, IdentitySearchCriteria criteria) throws IdentityException
{
checkNotNullArgument(userName, "User name");
User user = createUserFromId(userName);
- return findRelatedGroups(user, groupType, controls);
+ return findRelatedGroups(user, groupType, criteria);
}
- public Collection<User> findRelatedUsers(Group group, IdentitySearchCriteria controls) throws IdentityException
+ public Collection<User> findRelatedUsers(Group group, IdentitySearchCriteria criteria) throws IdentityException
{
checkNotNullArgument(group, "Group");
List<User> identities = new LinkedList<User>();
- Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), null, true, convertSearchControls(controls));
+ Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), null, true, convertSearchControls(criteria));
String userTypeName = getUserObjectType().getName();
@@ -693,12 +693,12 @@
return identities;
}
- public Collection<User> findRelatedUsers(String groupId, IdentitySearchCriteria controls) throws IdentityException
+ public Collection<User> findRelatedUsers(String groupId, IdentitySearchCriteria criteria) throws IdentityException
{
checkNotNullArgument(groupId, "Group Id");
Group group = createGroupFromId(groupId);
- return findRelatedUsers(group, controls);
+ return findRelatedUsers(group, criteria);
}
}
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java 2009-05-08 20:46:17 UTC (rev 480)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java 2009-05-09 09:51:45 UTC (rev 481)
@@ -41,8 +41,6 @@
import org.jboss.identity.idm.spi.store.IdentityObjectSearchCriteriaType;
import org.jboss.identity.idm.impl.api.model.SimpleRoleType;
import org.jboss.identity.idm.impl.api.model.SimpleRole;
-import org.jboss.identity.idm.impl.api.model.SimpleUser;
-import org.jboss.identity.idm.impl.api.model.SimpleGroup;
import org.jboss.identity.idm.impl.types.SimpleIdentityObjectRelationship;
import java.util.Collection;
@@ -101,7 +99,7 @@
{
return new SimpleIdentityObjectRelationship(
createIdentityObject(role.getGroup()),
- createIdentityObject(role.getIdentity()),
+ createIdentityObject(role.getUser()),
role.getRoleType().getName(),
ROLE
);
@@ -172,13 +170,13 @@
return null;
}
- public Collection<RoleType> findRoleTypes(IdentitySearchCriteria controls) throws IdentityException
+ public Collection<RoleType> findRoleTypes(IdentitySearchCriteria criteria) throws IdentityException
{
try
{
- Set<String> names = getRepository().getRelationshipNames(getInvocationContext(), convertSearchControls(controls));
+ Set<String> names = getRepository().getRelationshipNames(getInvocationContext(), convertSearchControls(criteria));
Set<RoleType> types = new HashSet<RoleType>();
for (String name : names)
@@ -195,15 +193,20 @@
}
- public Role createRole(RoleType roleType, User identity, Group group) throws IdentityException
+ public Collection<RoleType> findRoleTypes() throws IdentityException
{
+ return findRoleTypes(null);
+ }
+
+ public Role createRole(RoleType roleType, User user, Group group) throws IdentityException
+ {
checkNotNullArgument(roleType, "RoleType");
- checkNotNullArgument(identity, "User");
+ checkNotNullArgument(user, "User");
checkNotNullArgument(group, "Group");
//TODO: add createRoleType switch to the API
- IdentityObjectRelationship rel = getRepository().createRelationship(getInvocationContext(), createIdentityObject(group), createIdentityObject(identity), ROLE, roleType.getName(), false);
+ IdentityObjectRelationship rel = getRepository().createRelationship(getInvocationContext(), createIdentityObject(group), createIdentityObject(user), ROLE, roleType.getName(), false);
//TODO: null id - IdentityObjectRelationship doesn't have id
return new SimpleRole(new SimpleRoleType(rel.getName()), createUser(rel.getToIdentityObject()), createGroup(rel.getFromIdentityObject()));
@@ -222,13 +225,13 @@
return createRole(new SimpleRoleType(roleTypeName), user, group);
}
- public void removeRole(RoleType roleType, User identity, Group group) throws IdentityException
+ public void removeRole(RoleType roleType, User user, Group group) throws IdentityException
{
checkNotNullArgument(roleType, "RoleType");
- checkNotNullArgument(identity, "User");
+ checkNotNullArgument(user, "User");
checkNotNullArgument(group, "Group");
- getRepository().removeRelationship(getInvocationContext(), createIdentityObject(group), createIdentityObject(identity), ROLE, roleType.getName());
+ getRepository().removeRelationship(getInvocationContext(), createIdentityObject(group), createIdentityObject(user), ROLE, roleType.getName());
}
public void removeRole(String roleTypeName, String userName, String groupId) throws IdentityException
@@ -247,18 +250,18 @@
{
checkNotNullArgument(role, "Role");
- getRepository().removeRelationship(getInvocationContext(), createIdentityObject(role.getGroup()), createIdentityObject(role.getIdentity()), ROLE, role.getRoleType().getName());
+ getRepository().removeRelationship(getInvocationContext(), createIdentityObject(role.getGroup()), createIdentityObject(role.getUser()), ROLE, role.getRoleType().getName());
}
- public boolean hasRole(User identity, Group group, RoleType roleType) throws IdentityException
+ public boolean hasRole(User user, Group group, RoleType roleType) throws IdentityException
{
checkNotNullArgument(roleType, "RoleType");
- checkNotNullArgument(identity, "User");
+ checkNotNullArgument(user, "User");
checkNotNullArgument(group, "Group");
//TODO: does separate hasRelationship method in IdentityStore makes sense?
- Set<IdentityObjectRelationship> rels = getRepository().resolveRelationships(getInvocationContext(), createIdentityObject(group), createIdentityObject(identity), ROLE);
+ Set<IdentityObjectRelationship> rels = getRepository().resolveRelationships(getInvocationContext(), createIdentityObject(group), createIdentityObject(user), ROLE);
for (IdentityObjectRelationship rel : rels)
{
@@ -328,21 +331,21 @@
return getRole(roleType, user, group);
}
- public Collection<RoleType> findRoleTypes(User identity, Group group) throws IdentityException
+ public Collection<RoleType> findRoleTypes(User user, Group group) throws IdentityException
{
- checkNotNullArgument(identity, "User");
+ checkNotNullArgument(user, "User");
checkNotNullArgument(group, "Group");
- return findRoleTypes(identity, group, null);
+ return findRoleTypes(user, group, null);
}
- public Collection<RoleType> findRoleTypes(User identity, Group group, IdentitySearchCriteria controls) throws IdentityException
+ public Collection<RoleType> findRoleTypes(User user, Group group, IdentitySearchCriteria criteria) throws IdentityException
{
- checkNotNullArgument(identity, "User");
+ checkNotNullArgument(user, "User");
checkNotNullArgument(group, "Group");
- Set<IdentityObjectRelationship> rels = getRepository().resolveRelationships(getInvocationContext(), createIdentityObject(group), createIdentityObject(identity), ROLE);
+ Set<IdentityObjectRelationship> rels = getRepository().resolveRelationships(getInvocationContext(), createIdentityObject(group), createIdentityObject(user), ROLE);
Set<RoleType> types = new HashSet<RoleType>();
for (IdentityObjectRelationship rel : rels)
@@ -355,7 +358,7 @@
}
- public Collection<RoleType> findRoleTypes(String userName, String groupId, IdentitySearchCriteria controls) throws IdentityException
+ public Collection<RoleType> findRoleTypes(String userName, String groupId, IdentitySearchCriteria criteria) throws IdentityException
{
checkNotNullArgument(userName, "User name");
checkNotNullArgument(groupId, "Group Id");
@@ -363,25 +366,25 @@
User user = createUserFromId(userName);
Group group = createGroupFromId(groupId);
- return findRoleTypes(user, group, controls);
+ return findRoleTypes(user, group, criteria);
}
- public Collection<RoleType> findUserRoleTypes(User identity) throws IdentityException
+ public Collection<RoleType> findUserRoleTypes(User user) throws IdentityException
{
- checkNotNullArgument(identity, "User");
+ checkNotNullArgument(user, "User");
- return findUserRoleTypes(identity, null);
+ return findUserRoleTypes(user, null);
}
- public Collection<RoleType> findUserRoleTypes(User identity, IdentitySearchCriteria controls) throws IdentityException
+ public Collection<RoleType> findUserRoleTypes(User user, IdentitySearchCriteria criteria) throws IdentityException
{
- checkNotNullArgument(identity, "User");
+ checkNotNullArgument(user, "User");
Set<RoleType> types = new HashSet<RoleType>();
try
{
- Collection<String> names = getRepository().getRelationshipNames(getInvocationContext(), createIdentityObject(identity), convertSearchControls(controls));
+ Collection<String> names = getRepository().getRelationshipNames(getInvocationContext(), createIdentityObject(user), convertSearchControls(criteria));
for (String name : names)
{
@@ -398,13 +401,13 @@
}
- public Collection<RoleType> findUserRoleTypes(String userName, IdentitySearchCriteria controls) throws IdentityException
+ public Collection<RoleType> findUserRoleTypes(String userName, IdentitySearchCriteria criteria) throws IdentityException
{
checkNotNullArgument(userName, "User name");
User user = createUserFromId(userName);
- return findUserRoleTypes(user, controls);
+ return findUserRoleTypes(user, criteria);
}
public Collection<RoleType> findGroupRoleTypes(Group group) throws IdentityException
@@ -414,16 +417,16 @@
return findGroupRoleTypes(group, null);
}
- public Collection<RoleType> findGroupRoleTypes(String groupId, IdentitySearchCriteria controls) throws IdentityException
+ public Collection<RoleType> findGroupRoleTypes(String groupId, IdentitySearchCriteria criteria) throws IdentityException
{
checkNotNullArgument(groupId, "Group Id");
Group group = createGroupFromId(groupId);
- return findGroupRoleTypes(group, controls);
+ return findGroupRoleTypes(group, criteria);
}
- public Collection<RoleType> findGroupRoleTypes(Group group, IdentitySearchCriteria controls) throws IdentityException
+ public Collection<RoleType> findGroupRoleTypes(Group group, IdentitySearchCriteria criteria) throws IdentityException
{
checkNotNullArgument(group, "Group");
@@ -431,7 +434,7 @@
try
{
- Collection<String> names = getRepository().getRelationshipNames(getInvocationContext(), createIdentityObject(group), convertSearchControls(controls));
+ Collection<String> names = getRepository().getRelationshipNames(getInvocationContext(), createIdentityObject(group), convertSearchControls(criteria));
for (String name : names)
{
@@ -448,7 +451,7 @@
}
- public Collection<User> findUsersWithRelatedRole(Group group, IdentitySearchCriteria controls) throws IdentityException
+ public Collection<User> findUsersWithRelatedRole(Group group, IdentitySearchCriteria criteria) throws IdentityException
{
checkNotNullArgument(group, "Group");
@@ -457,7 +460,7 @@
Collection<IdentityObject> ios = null;
- ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), ROLE, true, convertSearchControls(controls));
+ ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), ROLE, true, convertSearchControls(criteria));
for (IdentityObject io : ios)
{
@@ -467,25 +470,25 @@
return identities;
}
- public Collection<User> findUsersWithRelatedRole(String groupId, IdentitySearchCriteria controls) throws IdentityException
+ public Collection<User> findUsersWithRelatedRole(String groupId, IdentitySearchCriteria criteria) throws IdentityException
{
checkNotNullArgument(groupId, "Group id");
Group group = createGroupFromId(groupId);
- return findUsersWithRelatedRole(group, controls);
+ return findUsersWithRelatedRole(group, criteria);
}
- public Collection<Group> findGroupsWithRelatedRole(User identity, IdentitySearchCriteria controls) throws IdentityException
+ public Collection<Group> findGroupsWithRelatedRole(User user, IdentitySearchCriteria criteria) throws IdentityException
{
- checkNotNullArgument(identity, "User");
+ checkNotNullArgument(user, "User");
List<Group> identities = new LinkedList<Group>();
Collection<IdentityObject> ios = null;
- ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(identity), ROLE, false, convertSearchControls(controls));
+ ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(user), ROLE, false, convertSearchControls(criteria));
for (IdentityObject io : ios)
{
@@ -496,25 +499,25 @@
return identities;
}
- public Collection<Group> findGroupsWithRelatedRole(String userName, IdentitySearchCriteria controls) throws IdentityException
+ public Collection<Group> findGroupsWithRelatedRole(String userName, IdentitySearchCriteria criteria) throws IdentityException
{
checkNotNullArgument(userName, "User name");
User user = createUserFromId(userName);
- return findGroupsWithRelatedRole(user, controls);
+ return findGroupsWithRelatedRole(user, criteria);
}
- public Collection<Group> findGroupsWithRelatedRole(User identity, String groupType, IdentitySearchCriteria controls) throws IdentityException
+ public Collection<Group> findGroupsWithRelatedRole(User user, String groupType, IdentitySearchCriteria criteria) throws IdentityException
{
- checkNotNullArgument(identity, "User");
+ checkNotNullArgument(user, "User");
// checkNotNullArgument(groupType, "Group type");
List<Group> identities = new LinkedList<Group>();
Collection<IdentityObject> ios = null;
- ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(identity), ROLE, false, convertSearchControls(controls));
+ ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(user), ROLE, false, convertSearchControls(criteria));
if (groupType != null)
{
@@ -540,7 +543,7 @@
return identities;
}
- public Collection<Group> findGroupsWithRelatedRole(String userName, String groupType, IdentitySearchCriteria controls) throws IdentityException
+ public Collection<Group> findGroupsWithRelatedRole(String userName, String groupType, IdentitySearchCriteria criteria) throws IdentityException
{
checkNotNullArgument(userName, "User name");
// checkNotNullArgument(groupType, "Group type");
@@ -548,7 +551,7 @@
User user = createUserFromId(userName);
- return findGroupsWithRelatedRole(user, groupType, controls);
+ return findGroupsWithRelatedRole(user, groupType, criteria);
}
public Collection<Role> findRoles(IdentityType identityType, RoleType roleType) throws IdentityException
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/cache/IdentityStoreCacheSupport.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/cache/IdentityStoreCacheSupport.java 2009-05-08 20:46:17 UTC (rev 480)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/cache/IdentityStoreCacheSupport.java 2009-05-09 09:51:45 UTC (rev 481)
@@ -456,10 +456,10 @@
}
protected void putIdentityObjectSearchIntoCache(IdentityObjectType identityType,
- IdentityObjectSearchCriteria controls,
+ IdentityObjectSearchCriteria criteria,
Collection<IdentityObject> results)
{
- Fqn nodeFqn = createIOTypeSearchNodeFQN(identityType, getControlsHash(controls));
+ Fqn nodeFqn = createIOTypeSearchNodeFQN(identityType, getControlsHash(criteria));
Node searchNode = getCache().getRoot().addChild(nodeFqn);
@@ -472,9 +472,9 @@
}
protected Collection<IdentityObject> getIdentityObjectSearchFromCache(IdentityObjectType identityType,
- IdentityObjectSearchCriteria controls)
+ IdentityObjectSearchCriteria criteria)
{
- Fqn nodeFqn = createIOTypeSearchNodeFQN(identityType, getControlsHash(controls));
+ Fqn nodeFqn = createIOTypeSearchNodeFQN(identityType, getControlsHash(criteria));
Node searchNode = getCache().getRoot().getChild(nodeFqn);
@@ -499,11 +499,11 @@
protected void putIdentityObjectSearchToCache(IdentityObject identity,
IdentityObjectRelationshipType relationshipType,
boolean parent,
- IdentityObjectSearchCriteria controls,
+ IdentityObjectSearchCriteria criteria,
Collection<IdentityObject> results)
{
- Fqn nodeFqn = createIOSearchNodeFQN(identity, relationshipType, parent, getControlsHash(controls));
+ Fqn nodeFqn = createIOSearchNodeFQN(identity, relationshipType, parent, getControlsHash(criteria));
Node searchNode = getCache().getRoot().addChild(nodeFqn);
@@ -521,10 +521,10 @@
protected Collection<IdentityObject> getIdentityObjectSearchFromCache(IdentityObject identity,
IdentityObjectRelationshipType relationshipType,
boolean parent,
- IdentityObjectSearchCriteria controls)
+ IdentityObjectSearchCriteria criteria)
{
- Fqn nodeFqn = createIOSearchNodeFQN(identity, relationshipType, parent, getControlsHash(controls));
+ Fqn nodeFqn = createIOSearchNodeFQN(identity, relationshipType, parent, getControlsHash(criteria));
Node searchNode = getCache().getRoot().getChild(nodeFqn);
@@ -811,10 +811,10 @@
- protected void putRelationshipNamesSearchIntoCache(IdentityObjectSearchCriteria controls, Set<String> results)
+ protected void putRelationshipNamesSearchIntoCache(IdentityObjectSearchCriteria criteria, Set<String> results)
{
- Fqn fqn = createRelationshipNamesAllSearchFqn(getControlsHash(controls));
+ Fqn fqn = createRelationshipNamesAllSearchFqn(getControlsHash(criteria));
Node node = getCache().getRoot().addChild(fqn);
@@ -822,16 +822,16 @@
if (getLog().isLoggable(Level.FINER))
{
- getLog().finer(this.toString() + "IdentityObjectRelationshipName search results invalidated in cache: controls hash=" +
- getControlsHash(controls)) ;
+ getLog().finer(this.toString() + "IdentityObjectRelationshipName search results invalidated in cache: criteria hash=" +
+ getControlsHash(criteria)) ;
}
}
- protected Set<String> getRelationshipNamesSearchFromCache(IdentityObjectSearchCriteria controls)
+ protected Set<String> getRelationshipNamesSearchFromCache(IdentityObjectSearchCriteria criteria)
{
- Fqn fqn = createRelationshipNamesAllSearchFqn(getControlsHash(controls));
+ Fqn fqn = createRelationshipNamesAllSearchFqn(getControlsHash(criteria));
Node node = getCache().getRoot().getChild(fqn);
@@ -841,8 +841,8 @@
if (results != null && getLog().isLoggable(Level.FINER))
{
- getLog().finer(this.toString() + "IdentityObjectRelationshipName search result found in cache: controls hash=" +
- getControlsHash(controls)) ;
+ getLog().finer(this.toString() + "IdentityObjectRelationshipName search result found in cache: criteria hash=" +
+ getControlsHash(criteria)) ;
}
return results;
@@ -853,11 +853,11 @@
}
protected void putRelationshipNamesSearchIntoCache(IdentityObject identity,
- IdentityObjectSearchCriteria controls,
+ IdentityObjectSearchCriteria criteria,
Set<String> results)
{
- Fqn fqn = createRelationshipNamesIdentityObjectSearchFqn(identity, getControlsHash(controls));
+ Fqn fqn = createRelationshipNamesIdentityObjectSearchFqn(identity, getControlsHash(criteria));
Node node = getCache().getRoot().addChild(fqn);
@@ -866,17 +866,17 @@
if (results != null && getLog().isLoggable(Level.FINER))
{
getLog().finer(this.toString() + "IdentityObjectRelationshipName search result stored in cache: " +
- "controls hash=" + getControlsHash(controls) +
+ "criteria hash=" + getControlsHash(criteria) +
"identity=" + identity.toString()) ;
}
}
- protected Set<String> getRelationshipNamesSearchFromCache(IdentityObject identity, IdentityObjectSearchCriteria controls)
+ protected Set<String> getRelationshipNamesSearchFromCache(IdentityObject identity, IdentityObjectSearchCriteria criteria)
{
- Fqn fqn = createRelationshipNamesIdentityObjectSearchFqn(identity, getControlsHash(controls));
+ Fqn fqn = createRelationshipNamesIdentityObjectSearchFqn(identity, getControlsHash(criteria));
Node node = getCache().getRoot().getChild(fqn);
@@ -887,7 +887,7 @@
if (results != null && getLog().isLoggable(Level.FINER))
{
getLog().finer(this.toString() + "IdentityObjectRelationshipName search result found in cache: " +
- "controls hash=" + getControlsHash(controls) +
+ "criteria hash=" + getControlsHash(criteria) +
"identity=" + identity.toString()) ;
}
@@ -896,14 +896,14 @@
return null;
}
- private int getControlsHash(IdentityObjectSearchCriteria controls)
+ private int getControlsHash(IdentityObjectSearchCriteria criteria)
{
- // Convert controls to Set to have the same hashcode regardles order of controls
+ // Convert criteria to Set to have the same hashcode regardles order of criteria
int hashcode = 0;
- if (controls != null)
+ if (criteria != null)
{
- hashcode = controls.hashCode();
+ hashcode = criteria.hashCode();
}
return hashcode;
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreWrapper.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreWrapper.java 2009-05-08 20:46:17 UTC (rev 480)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreWrapper.java 2009-05-09 09:51:45 UTC (rev 481)
@@ -191,16 +191,16 @@
public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCtx,
IdentityObjectType identityType,
- IdentityObjectSearchCriteria controls) throws IdentityException
+ IdentityObjectSearchCriteria criteria) throws IdentityException
{
- Collection<IdentityObject> results = getIdentityObjectSearchFromCache(identityType, controls);
+ Collection<IdentityObject> results = getIdentityObjectSearchFromCache(identityType, criteria);
if (results == null)
{
- results = identityStore.findIdentityObject(invocationCtx, identityType, controls);
+ results = identityStore.findIdentityObject(invocationCtx, identityType, criteria);
- putIdentityObjectSearchIntoCache(identityType, controls, results);
+ putIdentityObjectSearchIntoCache(identityType, criteria, results);
// Put all the results into cache separately
for (IdentityObject result : results)
@@ -221,16 +221,16 @@
IdentityObject identity,
IdentityObjectRelationshipType relationshipType,
boolean parent,
- IdentityObjectSearchCriteria controls) throws IdentityException
+ IdentityObjectSearchCriteria criteria) throws IdentityException
{
- Collection<IdentityObject> results = getIdentityObjectSearchFromCache(identity, relationshipType, parent, controls);
+ Collection<IdentityObject> results = getIdentityObjectSearchFromCache(identity, relationshipType, parent, criteria);
if (results == null)
{
- results = identityStore.findIdentityObject(invocationCtx, identity, relationshipType, parent, controls);
+ results = identityStore.findIdentityObject(invocationCtx, identity, relationshipType, parent, criteria);
- putIdentityObjectSearchToCache(identity, relationshipType,parent,controls, results);
+ putIdentityObjectSearchToCache(identity, relationshipType,parent,criteria, results);
for (IdentityObject result : results)
{
@@ -343,15 +343,15 @@
}
public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
- IdentityObjectSearchCriteria controls) throws IdentityException, OperationNotSupportedException
+ IdentityObjectSearchCriteria criteria) throws IdentityException, OperationNotSupportedException
{
- Set<String> results = getRelationshipNamesSearchFromCache(controls);
+ Set<String> results = getRelationshipNamesSearchFromCache(criteria);
if (results == null)
{
- results = identityStore.getRelationshipNames(ctx, controls);
+ results = identityStore.getRelationshipNames(ctx, criteria);
- putRelationshipNamesSearchIntoCache(controls, results);
+ putRelationshipNamesSearchIntoCache(criteria, results);
}
return results;
@@ -360,17 +360,17 @@
public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
IdentityObject identity,
- IdentityObjectSearchCriteria controls) throws IdentityException, OperationNotSupportedException
+ IdentityObjectSearchCriteria criteria) throws IdentityException, OperationNotSupportedException
{
- Set<String> results = getRelationshipNamesSearchFromCache(identity, controls);
+ Set<String> results = getRelationshipNamesSearchFromCache(identity, criteria);
if (results == null)
{
- results = identityStore.getRelationshipNames(ctx, identity, controls);
+ results = identityStore.getRelationshipNames(ctx, identity, criteria);
- putRelationshipNamesSearchIntoCache(identity, controls, results);
+ putRelationshipNamesSearchIntoCache(identity, criteria, results);
}
return results;
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/FallbackIdentityStoreRepository.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/FallbackIdentityStoreRepository.java 2009-05-08 20:46:17 UTC (rev 480)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/FallbackIdentityStoreRepository.java 2009-05-09 09:51:45 UTC (rev 481)
@@ -71,7 +71,7 @@
*/
public class FallbackIdentityStoreRepository extends AbstractIdentityStoreRepository
{
- //TODO: - filter out controls based on features MD before passing
+ //TODO: - filter out criteria based on features MD before passing
//TODO: - configuration option to store not mapped attributes in default store
//TODO: - configuration option to fallback named relationships to default store when not supported in mapped one
@@ -403,19 +403,19 @@
return defaultIdentityStore.findIdentityObject(invocationContext, id);
}
- public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObjectType identityType, IdentityObjectSearchCriteria controls) throws IdentityException
+ public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObjectType identityType, IdentityObjectSearchCriteria criteria) throws IdentityException
{
IdentityStore targetStore = resolveIdentityStore(identityType);
IdentityStoreInvocationContext targetCtx = resolveInvocationContext(targetStore, invocationCtx);
- return targetStore.findIdentityObject(targetCtx, identityType, controls);
+ return targetStore.findIdentityObject(targetCtx, identityType, criteria);
}
public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCxt,
IdentityObject identity,
IdentityObjectRelationshipType relationshipType,
boolean parent,
- IdentityObjectSearchCriteria constraints) throws IdentityException
+ IdentityObjectSearchCriteria criteria) throws IdentityException
{
// Check in the mapped store and merge with default
@@ -428,7 +428,7 @@
if (mappedStore == defaultIdentityStore)
{
- return defaultIdentityStore.findIdentityObject(defaultCtx, identity, relationshipType, parent, constraints);
+ return defaultIdentityStore.findIdentityObject(defaultCtx, identity, relationshipType, parent, criteria);
}
Collection<IdentityObject> results = new LinkedList<IdentityObject>();
@@ -436,7 +436,7 @@
if (relationshipType == null || !RoleManagerImpl.ROLE.getName().equals(relationshipType.getName()) ||
mappedStore.getSupportedFeatures().isNamedRelationshipsSupported())
{
- results = mappedStore.findIdentityObject(mappedCtx, identity, relationshipType, parent, constraints);
+ results = mappedStore.findIdentityObject(mappedCtx, identity, relationshipType, parent, criteria);
}
IdentityObject defaultStoreIdentityObject = null;
@@ -452,7 +452,7 @@
if (defaultStoreIdentityObject != null)
{
- Collection<IdentityObject> objects = defaultIdentityStore.findIdentityObject(defaultCtx, identity, relationshipType, parent, constraints);
+ Collection<IdentityObject> objects = defaultIdentityStore.findIdentityObject(defaultCtx, identity, relationshipType, parent, criteria);
// If default store contain related relationships merge and sort/page once more
if (objects != null && objects.size() != 0)
@@ -461,15 +461,15 @@
results.addAll(objects);
//TODO: hardcoded - expects List
- if (constraints != null && constraints.isPaged() && results instanceof List)
+ if (criteria != null && criteria.isPaged() && results instanceof List)
{
- results = cutPageFromResults((List<IdentityObject>)results, constraints);
+ results = cutPageFromResults((List<IdentityObject>)results, criteria);
}
//TODO: hardcoded - expects List
- if (constraints != null && constraints.isSorted() && results instanceof List)
+ if (criteria != null && criteria.isSorted() && results instanceof List)
{
- sortByName((List<IdentityObject>)results, constraints.isAscending());
+ sortByName((List<IdentityObject>)results, criteria.isAscending());
}
}
}
@@ -663,7 +663,7 @@
return name;
}
- public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObjectSearchCriteria controls) throws IdentityException, OperationNotSupportedException
+ public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObjectSearchCriteria criteria) throws IdentityException, OperationNotSupportedException
{
Set<String> results = new HashSet<String>();
@@ -673,7 +673,7 @@
if (identityStore.getSupportedFeatures().isNamedRelationshipsSupported())
{
IdentityStoreInvocationContext storeCtx = resolveInvocationContext(identityStore, ctx);
- results.addAll(identityStore.getRelationshipNames(storeCtx, controls));
+ results.addAll(identityStore.getRelationshipNames(storeCtx, criteria));
}
}
@@ -681,7 +681,7 @@
return results;
}
- public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObject identity, IdentityObjectSearchCriteria controls) throws IdentityException, OperationNotSupportedException
+ public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObject identity, IdentityObjectSearchCriteria criteria) throws IdentityException, OperationNotSupportedException
{
IdentityStore toStore = resolveIdentityStore(identity);
@@ -689,11 +689,11 @@
if (toStore.getSupportedFeatures().isNamedRelationshipsSupported())
{
- return toStore.getRelationshipNames(targetCtx, identity, controls);
+ return toStore.getRelationshipNames(targetCtx, identity, criteria);
}
IdentityStoreInvocationContext defaultCtx = resolveInvocationContext(defaultIdentityStore, ctx);
- return defaultIdentityStore.getRelationshipNames(defaultCtx, identity, controls);
+ return defaultIdentityStore.getRelationshipNames(defaultCtx, identity, criteria);
}
public Map<String, String> getRelationshipNameProperties(IdentityStoreInvocationContext ctx, String name) throws IdentityException, OperationNotSupportedException
@@ -1107,10 +1107,10 @@
}
//TODO: other way
- private List<IdentityObject> cutPageFromResults(List<IdentityObject> objects, IdentityObjectSearchCriteria constraints)
+ private List<IdentityObject> cutPageFromResults(List<IdentityObject> objects, IdentityObjectSearchCriteria criteria)
{
List<IdentityObject> results = new LinkedList<IdentityObject>();
- for (int i = constraints.getFirstResult(); i < constraints.getFirstResult() + constraints.getMaxResults(); i++)
+ for (int i = criteria.getFirstResult(); i < criteria.getFirstResult() + criteria.getMaxResults(); i++)
{
if (i < objects.size())
{
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/WrapperIdentityStoreRepository.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/WrapperIdentityStoreRepository.java 2009-05-08 20:46:17 UTC (rev 480)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/WrapperIdentityStoreRepository.java 2009-05-09 09:51:45 UTC (rev 481)
@@ -163,18 +163,18 @@
public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCtx,
IdentityObjectType identityType,
- IdentityObjectSearchCriteria controls) throws IdentityException
+ IdentityObjectSearchCriteria criteria) throws IdentityException
{
- return defaultIdentityStore.findIdentityObject(resolveIdentityStoreInvocationContext(invocationCtx), identityType, controls);
+ return defaultIdentityStore.findIdentityObject(resolveIdentityStoreInvocationContext(invocationCtx), identityType, criteria);
}
public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCtx,
IdentityObject identity,
IdentityObjectRelationshipType relationshipType,
boolean parent,
- IdentityObjectSearchCriteria controls) throws IdentityException
+ IdentityObjectSearchCriteria criteria) throws IdentityException
{
- return defaultIdentityStore.findIdentityObject(resolveIdentityStoreInvocationContext(invocationCtx), identity, relationshipType, parent, controls);
+ return defaultIdentityStore.findIdentityObject(resolveIdentityStoreInvocationContext(invocationCtx), identity, relationshipType, parent, criteria);
}
public IdentityObjectRelationship createRelationship(IdentityStoreInvocationContext invocationCxt,
@@ -237,16 +237,16 @@
}
public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
- IdentityObjectSearchCriteria controls) throws IdentityException, OperationNotSupportedException
+ IdentityObjectSearchCriteria criteria) throws IdentityException, OperationNotSupportedException
{
- return defaultIdentityStore.getRelationshipNames(resolveIdentityStoreInvocationContext(ctx), controls);
+ return defaultIdentityStore.getRelationshipNames(resolveIdentityStoreInvocationContext(ctx), criteria);
}
public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
IdentityObject identity,
- IdentityObjectSearchCriteria controls) throws IdentityException, OperationNotSupportedException
+ IdentityObjectSearchCriteria criteria) throws IdentityException, OperationNotSupportedException
{
- return defaultIdentityStore.getRelationshipNames(resolveIdentityStoreInvocationContext(ctx), identity, controls);
+ return defaultIdentityStore.getRelationshipNames(resolveIdentityStoreInvocationContext(ctx), identity, criteria);
}
public Map<String, String> getRelationshipNameProperties(IdentityStoreInvocationContext ctx, String name) throws IdentityException, OperationNotSupportedException
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/FeaturesMetaDataImpl.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/FeaturesMetaDataImpl.java 2009-05-08 20:46:17 UTC (rev 480)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/FeaturesMetaDataImpl.java 2009-05-09 09:51:45 UTC (rev 481)
@@ -62,7 +62,7 @@
public FeaturesMetaDataImpl(IdentityStoreConfigurationMetaData configurationMD,
- Set<IdentityObjectSearchCriteriaType> supportedControls,
+ Set<IdentityObjectSearchCriteriaType> supportedCriteria,
boolean relationshipPropertiesSupport,
boolean namedRelationshipsSupport,
Set<String> readOnlyObjectTypes)
@@ -90,7 +90,7 @@
this.supportedCredentials = Collections.unmodifiableMap(supportedCredentials);
- this.supportedSearchConstraintTypes = Collections.unmodifiableSet(supportedControls);
+ this.supportedSearchConstraintTypes = Collections.unmodifiableSet(supportedCriteria);
@@ -226,7 +226,7 @@
public boolean isRoleNameSearchCriteriaTypeSupported(IdentityObjectSearchCriteriaType constraint)
{
- // For now simple - use the same allowed controls list for everything
+ // For now simple - use the same allowed criteria list for everything
return isNamedRelationshipsSupported() && isSearchCriteriaTypeSupported(null, constraint);
}
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java 2009-05-08 20:46:17 UTC (rev 480)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java 2009-05-09 09:51:45 UTC (rev 481)
@@ -140,7 +140,7 @@
// TODO: rewrite this into some more handy object
private IdentityStoreConfigurationMetaData configurationMD;
- private static Set<IdentityObjectSearchCriteriaType> supportedIdentityObjectSearchControls =
+ private static Set<IdentityObjectSearchCriteriaType> supportedIdentityObjectSearchCriteria =
new HashSet<IdentityObjectSearchCriteriaType>();
private static Set<String> supportedCredentialTypes = new HashSet<String>();
@@ -155,12 +155,12 @@
private Map<String, Map<String, String>> reverseAttributeMappings = new HashMap<String, Map<String, String>>();
static {
- // List all supported controls classes
+ // List all supported criteria classes
- supportedIdentityObjectSearchControls.add(IdentityObjectSearchCriteriaType.ATTRIBUTE_FILTER);
- supportedIdentityObjectSearchControls.add(IdentityObjectSearchCriteriaType.NAME_FILTER);
- supportedIdentityObjectSearchControls.add(IdentityObjectSearchCriteriaType.PAGE);
- supportedIdentityObjectSearchControls.add(IdentityObjectSearchCriteriaType.SORT);
+ supportedIdentityObjectSearchCriteria.add(IdentityObjectSearchCriteriaType.ATTRIBUTE_FILTER);
+ supportedIdentityObjectSearchCriteria.add(IdentityObjectSearchCriteriaType.NAME_FILTER);
+ supportedIdentityObjectSearchCriteria.add(IdentityObjectSearchCriteriaType.PAGE);
+ supportedIdentityObjectSearchCriteria.add(IdentityObjectSearchCriteriaType.SORT);
// credential types supported by this impl
supportedCredentialTypes.add(CREDENTIAL_TYPE_PASSWORD);
@@ -179,7 +179,7 @@
id = configurationMD.getId();
- supportedFeatures = new FeaturesMetaDataImpl(configurationMD, supportedIdentityObjectSearchControls, true, true, new HashSet<String>());
+ supportedFeatures = new FeaturesMetaDataImpl(configurationMD, supportedIdentityObjectSearchCriteria, true, true, new HashSet<String>());
String populateMembershipTypes = configurationMD.getOptionSingleValue(POPULATE_MEMBERSHIP_TYPES);
@@ -603,7 +603,7 @@
@SuppressWarnings("unchecked")
public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext ctx,
IdentityObjectType identityType,
- IdentityObjectSearchCriteria constraints) throws IdentityException
+ IdentityObjectSearchCriteria criteria) throws IdentityException
{
checkIOType(identityType);
@@ -618,9 +618,9 @@
Query q = null;
- if (constraints != null && constraints.isSorted())
+ if (criteria != null && criteria.isSorted())
{
- if (constraints.isAscending())
+ if (criteria.isAscending())
{
q = hibernateSession.createQuery(HibernateIdentityObject.findIdentityObjectsByTypeOrderedByNameAsc);
}
@@ -634,22 +634,22 @@
q = hibernateSession.createQuery(HibernateIdentityObject.findIdentityObjectsByType);
}
- if (constraints != null && constraints.isPaged())
+ if (criteria != null && criteria.isPaged())
{
- if (constraints.getMaxResults() > 0)
+ if (criteria.getMaxResults() > 0)
{
- q.setMaxResults(constraints.getMaxResults());
+ q.setMaxResults(criteria.getMaxResults());
}
- q.setFirstResult(constraints.getFirstResult());
+ q.setFirstResult(criteria.getFirstResult());
}
q.setParameter("realm", getRealm(hibernateSession, ctx))
.setParameter("typeName", hibernateType.getName());
- if (constraints != null && constraints.getFilter() != null)
+ if (criteria != null && criteria.getFilter() != null)
{
- q.setParameter("nameFilter", constraints.getFilter().replaceAll("\\*", "%"));
+ q.setParameter("nameFilter", criteria.getFilter().replaceAll("\\*", "%"));
}
else
{
@@ -666,9 +666,9 @@
throw new IdentityException("Cannot find IdentityObjects with type '" + identityType.getName() + "'", e);
}
- if (constraints != null && constraints.isFiltered())
+ if (criteria != null && criteria.isFiltered())
{
- filterByAttributesValues(results, constraints.getValues());
+ filterByAttributesValues(results, criteria.getValues());
}
return results;
@@ -687,7 +687,7 @@
IdentityObject identity,
IdentityObjectRelationshipType relationshipType,
boolean parent,
- IdentityObjectSearchCriteria constraints) throws IdentityException
+ IdentityObjectSearchCriteria criteria) throws IdentityException
{
//TODO:test
@@ -698,10 +698,10 @@
boolean orderByName = false;
boolean ascending = true;
- if (constraints != null && constraints.isSorted())
+ if (criteria != null && criteria.isSorted())
{
orderByName = true;
- ascending = constraints.isAscending();
+ ascending = criteria.isAscending();
}
try
@@ -775,9 +775,9 @@
q.setParameter("relType", relationshipType.getName());
}
- if (constraints != null && constraints.getFilter() != null)
+ if (criteria != null && criteria.getFilter() != null)
{
- q.setParameter("nameFilter", constraints.getFilter().replaceAll("\\*", "%"));
+ q.setParameter("nameFilter", criteria.getFilter().replaceAll("\\*", "%"));
}
else
{
@@ -785,12 +785,12 @@
}
- if (constraints != null && constraints.isPaged())
+ if (criteria != null && criteria.isPaged())
{
- q.setFirstResult(constraints.getFirstResult());
- if (constraints.getMaxResults() > 0)
+ q.setFirstResult(criteria.getFirstResult());
+ if (criteria.getMaxResults() > 0)
{
- q.setMaxResults(constraints.getMaxResults());
+ q.setMaxResults(criteria.getMaxResults());
}
}
@@ -805,9 +805,9 @@
throw new IdentityException("Cannot find IdentityObjects", e);
}
- if (constraints != null && constraints.isFiltered())
+ if (criteria != null && criteria.isFiltered())
{
- filterByAttributesValues(results, constraints.getValues());
+ filterByAttributesValues(results, criteria.getValues());
}
return results;
@@ -1113,7 +1113,7 @@
return name;
}
- public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObjectSearchCriteria constraints) throws IdentityException, OperationNotSupportedException
+ public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObjectSearchCriteria criteria) throws IdentityException, OperationNotSupportedException
{
Set<String> names = null;
@@ -1124,9 +1124,9 @@
{
Query q = null;
- if (constraints != null && constraints.isSorted())
+ if (criteria != null && criteria.isSorted())
{
- if (constraints.isAscending())
+ if (criteria.isAscending())
{
q = em.createQuery(HibernateIdentityObjectRelationshipName.findIdentityObjectRelationshipNamesOrderedByNameAsc);
}
@@ -1142,9 +1142,9 @@
q.setParameter("realm", getRealm(em, ctx));
- if (constraints != null && constraints.getFilter() != null)
+ if (criteria != null && criteria.getFilter() != null)
{
- q.setParameter("nameFilter", constraints.getFilter().replaceAll("\\*", "%"));
+ q.setParameter("nameFilter", criteria.getFilter().replaceAll("\\*", "%"));
}
else
{
@@ -1152,12 +1152,12 @@
}
- if (constraints != null && constraints.isPaged())
+ if (criteria != null && criteria.isPaged())
{
- q.setFirstResult(constraints.getMaxResults());
- if (constraints.getFirstResult() > 0)
+ q.setFirstResult(criteria.getMaxResults());
+ if (criteria.getFirstResult() > 0)
{
- q.setMaxResults(constraints.getMaxResults());
+ q.setMaxResults(criteria.getMaxResults());
}
}
@@ -1179,7 +1179,7 @@
return getRelationshipNames(ctx, (IdentityObjectSearchCriteria)null);
}
- public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObject identity, IdentityObjectSearchCriteria constraints) throws IdentityException, OperationNotSupportedException
+ public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObject identity, IdentityObjectSearchCriteria criteria) throws IdentityException, OperationNotSupportedException
{
Set<String> names;
@@ -1192,9 +1192,9 @@
{
Query q = null;
- if (constraints != null)
+ if (criteria != null)
{
- if (constraints.isAscending())
+ if (criteria.isAscending())
{
q = em.createQuery(HibernateIdentityObjectRelationshipName.findIdentityObjectRelationshipNamesForIdentityObjectOrderedByNameAsc);
}
@@ -1210,12 +1210,12 @@
q.setParameter("identityObject", hibernateObject);
- if (constraints != null && constraints.isPaged())
+ if (criteria != null && criteria.isPaged())
{
- q.setFirstResult(constraints.getFirstResult());
- if (constraints.getMaxResults() > 0)
+ q.setFirstResult(criteria.getFirstResult());
+ if (criteria.getMaxResults() > 0)
{
- q.setMaxResults(constraints.getMaxResults());
+ q.setMaxResults(criteria.getMaxResults());
}
}
@@ -2291,20 +2291,6 @@
return isAllowNotDefinedAttributes;
}
-// private void checkControls(IdentityObjectSearchConstraints controls) throws IdentityException
-// {
-// if (controls != null)
-// {
-// for (IdentityObjectSearchControl control : controls)
-// {
-// if (!supportedIdentityObjectSearchControls.contains(control.getClass()))
-// {
-// throw new IdentityException("IdentityObjectSearchControl not supported by this IdentityStore: " + control.getClass());
-// }
-// }
-// }
-// }
-
/**
* Resolve store mapping for attribute name. If attribute is not mapped and store doesn't allow not defined
* attributes throw exception
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreImpl.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreImpl.java 2009-05-08 20:46:17 UTC (rev 480)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreImpl.java 2009-05-09 09:51:45 UTC (rev 481)
@@ -102,7 +102,7 @@
IdentityStoreConfigurationMetaData configurationMD;
- private static Set<IdentityObjectSearchCriteriaType> supportedSearchConstraintTypes =
+ private static Set<IdentityObjectSearchCriteriaType> supportedSearchCriteriaTypes =
new HashSet<IdentityObjectSearchCriteriaType>();
// <IdentityObjectType name, <Attribute name, MD>
@@ -112,9 +112,9 @@
// List all supported controls classes
//TODO: attribute filter
- supportedSearchConstraintTypes.add(IdentityObjectSearchCriteriaType.SORT);
- supportedSearchConstraintTypes.add(IdentityObjectSearchCriteriaType.PAGE);
- supportedSearchConstraintTypes.add(IdentityObjectSearchCriteriaType.NAME_FILTER);
+ supportedSearchCriteriaTypes.add(IdentityObjectSearchCriteriaType.SORT);
+ supportedSearchCriteriaTypes.add(IdentityObjectSearchCriteriaType.PAGE);
+ supportedSearchCriteriaTypes.add(IdentityObjectSearchCriteriaType.NAME_FILTER);
//supportedSearchControls.add(AttributeFilterSearchControl.class);
}
@@ -144,7 +144,7 @@
}
}
- supportedFeatures = new FeaturesMetaDataImpl(configurationMD, supportedSearchConstraintTypes, false, false, readOnlyObjectTypes);
+ supportedFeatures = new FeaturesMetaDataImpl(configurationMD, supportedSearchCriteriaTypes, false, false, readOnlyObjectTypes);
// Attribute mappings - helper structures
@@ -551,7 +551,7 @@
public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCtx,
IdentityObjectType type,
- IdentityObjectSearchCriteria constraints) throws IdentityException
+ IdentityObjectSearchCriteria criteria) throws IdentityException
{
//TODO: page control with LDAP request control
@@ -561,9 +561,9 @@
String nameFilter = "*";
//Filter by name
- if (constraints != null && constraints.getFilter() != null)
+ if (criteria != null && criteria.getFilter() != null)
{
- nameFilter = constraints.getFilter();
+ nameFilter = criteria.getFilter();
}
@@ -581,7 +581,7 @@
Control[] requestControls = null;
// Sort control
- if (constraints != null && constraints.isSorted())
+ if (criteria != null && criteria.isSorted())
{
//TODO: make criticallity optional
//TODO sort by attribute name
@@ -593,11 +593,11 @@
StringBuilder af = new StringBuilder();
// Filter by attribute values
- if (constraints != null && constraints.isFiltered())
+ if (criteria != null && criteria.isFiltered())
{
af.append("(&");
- for (Map.Entry<String, String[]> stringEntry : constraints.getValues().entrySet())
+ for (Map.Entry<String, String[]> stringEntry : criteria.getValues().entrySet())
{
for (String value : stringEntry.getValue())
{
@@ -644,11 +644,11 @@
{
ctx = (LdapContext)res.getObject();
String dn = ctx.getNameInNamespace();
- if (constraints != null && constraints.isSorted())
+ if (criteria != null && criteria.isSorted())
{
// It seams that the sort order is not configurable and
// sort control returns entries in descending order by default...
- if (!constraints.isAscending())
+ if (!criteria.isAscending())
{
objects.addFirst(createIdentityObjectInstance(invocationCtx, type, res.getAttributes(), dn));
}
@@ -690,9 +690,9 @@
}
}
- if (constraints != null && constraints.isPaged())
+ if (criteria != null && criteria.isPaged())
{
- objects = (LinkedList)cutPageFromResults(objects, constraints);
+ objects = (LinkedList)cutPageFromResults(objects, criteria);
}
return objects;
@@ -708,7 +708,7 @@
IdentityObject identity,
IdentityObjectRelationshipType relationshipType,
boolean parent,
- IdentityObjectSearchCriteria constraints) throws IdentityException
+ IdentityObjectSearchCriteria criteria) throws IdentityException
{
//TODO: relationshipType is ignored - maybe check and allow only MEMBERSHIP?
@@ -749,10 +749,10 @@
{
//TODO: use direct LDAP query instaed of other find method and add attributesFilter
- if (constraints != null && constraints.getFilter() != null)
+ if (criteria != null && criteria.getFilter() != null)
{
String name = Tools.stripDnToName(memberRef);
- String regex = Tools.wildcardToRegex(constraints.getFilter());
+ String regex = Tools.wildcardToRegex(criteria.getFilter());
if (Pattern.matches(regex, name))
{
@@ -798,9 +798,9 @@
String nameFilter = "*";
//Filter by name
- if (constraints != null && constraints.getFilter() != null)
+ if (criteria != null && criteria.getFilter() != null)
{
- nameFilter = constraints.getFilter();
+ nameFilter = criteria.getFilter();
}
Control[] requestControls = null;
@@ -808,11 +808,11 @@
StringBuilder af = new StringBuilder();
// Filter by attribute values
- if (constraints != null && constraints.isFiltered())
+ if (criteria != null && criteria.isFiltered())
{
af.append("(&");
- for (Map.Entry<String, String[]> stringEntry : constraints.getValues().entrySet())
+ for (Map.Entry<String, String[]> stringEntry : criteria.getValues().entrySet())
{
for (String value : stringEntry.getValue())
{
@@ -899,14 +899,14 @@
}
}
- if (constraints != null && constraints.isPaged())
+ if (criteria != null && criteria.isPaged())
{
- objects = cutPageFromResults(objects, constraints);
+ objects = cutPageFromResults(objects, criteria);
}
- if (constraints != null && constraints.isSorted())
+ if (criteria != null && criteria.isSorted())
{
- sortByName(objects, constraints.isAscending());
+ sortByName(objects, criteria.isAscending());
}
return objects;
@@ -1324,7 +1324,7 @@
throw new OperationNotSupportedException("Named relationships are not supported by this implementation of LDAP IdentityStore");
}
- public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObjectSearchCriteria controls) throws IdentityException, OperationNotSupportedException
+ public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObjectSearchCriteria criteria) throws IdentityException, OperationNotSupportedException
{
throw new OperationNotSupportedException("Named relationships are not supported by this implementation of LDAP IdentityStore");
}
@@ -1334,7 +1334,7 @@
throw new OperationNotSupportedException("Named relationships are not supported by this implementation of LDAP IdentityStore");
}
- public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObject identity, IdentityObjectSearchCriteria controls) throws IdentityException, OperationNotSupportedException
+ public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObject identity, IdentityObjectSearchCriteria criteria) throws IdentityException, OperationNotSupportedException
{
throw new OperationNotSupportedException("Named relationships are not supported by this implementation of LDAP IdentityStore");
@@ -2095,10 +2095,10 @@
}
//TODO: dummy and inefficient temporary workaround. Need to be implemented with ldap request control
- private List<IdentityObject> cutPageFromResults(List<IdentityObject> objects, IdentityObjectSearchCriteria constraints)
+ private List<IdentityObject> cutPageFromResults(List<IdentityObject> objects, IdentityObjectSearchCriteria criteria)
{
List<IdentityObject> results = new LinkedList<IdentityObject>();
- for (int i = constraints.getFirstResult(); i < constraints.getFirstResult() + constraints.getMaxResults(); i++)
+ for (int i = criteria.getFirstResult(); i < criteria.getFirstResult() + criteria.getMaxResults(); i++)
{
if (i < objects.size())
{
Modified: idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/PersistenceManagerTest.java
===================================================================
--- idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/PersistenceManagerTest.java 2009-05-08 20:46:17 UTC (rev 480)
+++ idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/PersistenceManagerTest.java 2009-05-09 09:51:45 UTC (rev 481)
@@ -40,7 +40,7 @@
//TODO:
//TODO: - force in removeGroup (NYI)
//TODO: - exception handling
- //TODO: - search controls
+ //TODO: - search criteria
//TODO: - features description
APITestContext ctx;
Modified: idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RelationshipManagerTest.java
===================================================================
--- idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RelationshipManagerTest.java 2009-05-08 20:46:17 UTC (rev 480)
+++ idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RelationshipManagerTest.java 2009-05-09 09:51:45 UTC (rev 481)
@@ -43,7 +43,7 @@
//TODO: - inheritence in find methods
//TODO: - creating forbidden associations
//TODO: - exception handling
- //TODO: - search controls
+ //TODO: - search criteria
//TODO: - features description
APITestContext ctx;
Modified: idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RoleManagerTest.java
===================================================================
--- idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RoleManagerTest.java 2009-05-08 20:46:17 UTC (rev 480)
+++ idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RoleManagerTest.java 2009-05-09 09:51:45 UTC (rev 481)
@@ -45,7 +45,7 @@
{
//TODO:
//TODO: - exception handling
- //TODO: - search controls
+ //TODO: - search criteria
//TODO: - features description
APITestContext ctx;
Modified: idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/UserQueryTest.java
===================================================================
--- idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/UserQueryTest.java 2009-05-08 20:46:17 UTC (rev 480)
+++ idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/UserQueryTest.java 2009-05-09 09:51:45 UTC (rev 481)
@@ -27,10 +27,13 @@
import org.jboss.identity.idm.api.Group;
import org.jboss.identity.idm.api.RoleType;
import org.jboss.identity.idm.api.Role;
+import org.jboss.identity.idm.api.SortOrder;
import org.jboss.identity.idm.api.query.UserQuery;
import org.jboss.identity.idm.api.query.UserQueryBuilder;
import junit.framework.Assert;
+import java.util.List;
+
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
@@ -62,6 +65,10 @@
User user2 = ids.getPersistenceManager().createUser("user2");
User user3 = ids.getPersistenceManager().createUser("user3");
User user4 = ids.getPersistenceManager().createUser("user4");
+ User testUser1 = ids.getPersistenceManager().createUser("testUser1");
+ User testUser2 = ids.getPersistenceManager().createUser("testUser2");
+ User testUser3 = ids.getPersistenceManager().createUser("testUser3");
+ User testUser4 = ids.getPersistenceManager().createUser("testUser4");
Group group1 = ids.getPersistenceManager().createGroup("group1", ORGANIZATION);
Group group2 = ids.getPersistenceManager().createGroup("group2", ORGANIZATION_UNIT);
@@ -151,9 +158,58 @@
//
qb.reset();
- assertEquals(4, ids.execute(qb.createQuery()).size());
+ assertEquals(8, ids.execute(qb.createQuery()).size());
+ // Criteria
+
+ // All users
+ qb.reset();
+
+ assertEquals(8, ids.execute(qb.createQuery()).size());
+
+ // All users sorted
+ qb.reset();
+ qb.sort(SortOrder.ASCENDING);
+
+ List<User> results = ids.list(qb.createQuery());
+
+ assertEquals(testUser1, results.get(0));
+ assertEquals(user4, results.get(7));
+
+ // All users sorted desc
+ qb.reset();
+ qb.sort(SortOrder.DESCENDING);
+
+ results = ids.list(qb.createQuery());
+
+ assertEquals(testUser1, results.get(7));
+ assertEquals(user4, results.get(0));
+
+ //
+ qb.reset();
+ qb.sort(SortOrder.DESCENDING);
+ qb.idFilter("test*");
+
+ results = ids.list(qb.createQuery());
+
+ assertEquals(4, results.size());
+ assertEquals(testUser1, results.get(3));
+ assertEquals(testUser4, results.get(0));
+
+ //
+ qb.reset();
+ qb.sort(SortOrder.ASCENDING);
+ qb.idFilter("user*");
+ qb.page(1, 2);
+ results = ids.list(qb.createQuery());
+
+ assertEquals(2, results.size());
+ assertEquals(user2, results.get(0));
+ assertEquals(user3, results.get(1));
+
+
+
ctx.commit();
}
Modified: idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/CommonIdentityStoreTest.java
===================================================================
--- idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/CommonIdentityStoreTest.java 2009-05-08 20:46:17 UTC (rev 480)
+++ idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/CommonIdentityStoreTest.java 2009-05-09 09:51:45 UTC (rev 481)
@@ -357,7 +357,7 @@
- public void testControls() throws Exception
+ public void testCriteria() throws Exception
{
testContext.begin();
@@ -371,7 +371,7 @@
IdentityObject group8 = testContext.getStore().createIdentityObject(testContext.getCtx(), "Entity3", IdentityTypeEnum.USER);
Collection<IdentityObject> results = null;
- IdentityObjectSearchCriteria constraints = null;
+ IdentityObjectSearchCriteria criteria = null;
// TODO: by RelationshipType
@@ -379,45 +379,45 @@
isSearchCriteriaTypeSupported(IdentityTypeEnum.USER, IdentityObjectSearchCriteriaType.NAME_FILTER))
{
- constraints = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().idFilter("*");
+ criteria = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().idFilter("*");
results = testContext.getStore().
- findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, constraints);
+ findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, criteria);
assertEquals(8, results.size());
- constraints = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().idFilter("D*");
+ criteria = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().idFilter("D*");
results = testContext.getStore().
- findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, constraints);
+ findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, criteria);
assertEquals(3, results.size());
- constraints = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().idFilter("*2");
+ criteria = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().idFilter("*2");
results = testContext.getStore().
- findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, constraints);
+ findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, criteria);
assertEquals(3, results.size());
- constraints = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().idFilter("*3");
+ criteria = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().idFilter("*3");
results = testContext.getStore().
- findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, constraints);
+ findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, criteria);
assertEquals(2, results.size());
- constraints = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().idFilter("Company1");
+ criteria = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().idFilter("Company1");
results = testContext.getStore().
- findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, constraints);
+ findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, criteria);
assertEquals(1, results.size());
- constraints = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().idFilter("Toronto");
+ criteria = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().idFilter("Toronto");
results = testContext.getStore().
- findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, constraints);
+ findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, criteria);
assertEquals(0, results.size());
}
@@ -427,18 +427,18 @@
isSearchCriteriaTypeSupported(IdentityTypeEnum.USER, IdentityObjectSearchCriteriaType.PAGE))
{
- constraints = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().page(0, 3);
+ criteria = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().page(0, 3);
results = testContext.getStore().
- findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, constraints);
+ findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, criteria);
assertEquals(3, results.size());
- constraints = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().page(2, 2);
+ criteria = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().page(2, 2);
results = testContext.getStore().
- findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, constraints);
+ findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, criteria);
assertEquals(2, results.size());
@@ -448,11 +448,11 @@
{
- constraints = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().sort(SortOrder.ASCENDING);
+ criteria = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().sort(SortOrder.ASCENDING);
results = testContext.getStore().
- findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, constraints);
+ findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, criteria);
assertEquals(8, results.size());
@@ -462,11 +462,11 @@
// And reverse order
- constraints = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().sort(SortOrder.DESCENDING);
+ criteria = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().sort(SortOrder.DESCENDING);
results = testContext.getStore().
- findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, constraints);
+ findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, criteria);
assertEquals(8, results.size());
@@ -478,26 +478,26 @@
- // Combine controls to check that the results are diffrent for pagination
+ // Combine criteria to check that the results are diffrent for pagination
if (testContext.getStore().getSupportedFeatures().
isSearchCriteriaTypeSupported(IdentityTypeEnum.USER, IdentityObjectSearchCriteriaType.PAGE))
{
- constraints = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().sort(SortOrder.ASCENDING).page(0,3);
+ criteria = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().sort(SortOrder.ASCENDING).page(0,3);
results = testContext.getStore().
- findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, constraints);
+ findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, criteria);
assertEquals(3, results.size());
assertEquals("Company1", ((List<IdentityObject>)results).get(0).getName());
assertEquals("Division1", ((List<IdentityObject>)results).get(2).getName());
- constraints = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().sort(SortOrder.ASCENDING).page(3,1);
+ criteria = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().sort(SortOrder.ASCENDING).page(3,1);
results = testContext.getStore().
- findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, constraints);
+ findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, criteria);
assertEquals(1, results.size());
@@ -517,14 +517,14 @@
testContext.getStore().addAttributes(testContext.getCtx(), group1, new IdentityObjectAttribute[]{phone, description});
- constraints = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl()
+ criteria = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl()
.attributeValuesFilter("phone", new String[] {"777 777 777"})
.attributeValuesFilter("description", new String[] {"sample desc"});
results = testContext.getStore().
- findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, constraints);
+ findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, criteria);
assertEquals(1, results.size());
@@ -534,5 +534,5 @@
}
-
+
}
\ No newline at end of file
Modified: idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java
===================================================================
--- idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java 2009-05-08 20:46:17 UTC (rev 480)
+++ idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java 2009-05-09 09:51:45 UTC (rev 481)
@@ -41,15 +41,12 @@
import org.jboss.identity.idm.impl.api.SimpleAttribute;
import org.jboss.identity.idm.impl.IdentityTestPOJO;
import org.jboss.identity.idm.exception.IdentityException;
-import org.jboss.identity.idm.api.cfg.IdentityConfiguration;
import org.jboss.unit.api.pojo.annotations.Create;
import org.jboss.unit.api.pojo.annotations.Test;
-import static org.jboss.unit.api.Assert.*;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import java.util.Map;
-import java.io.File;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -301,9 +298,9 @@
}
@Test
- public void testControls() throws Exception
+ public void testCriteria() throws Exception
{
- commonTest.testControls();
+ commonTest.testCriteria();
}
}
\ No newline at end of file
Modified: idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java
===================================================================
--- idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java 2009-05-08 20:46:17 UTC (rev 480)
+++ idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java 2009-05-09 09:51:45 UTC (rev 481)
@@ -22,8 +22,6 @@
package org.jboss.identity.idm.impl.store.ldap;
-import junit.framework.TestCase;
-import org.jboss.identity.idm.opends.OpenDSService;
import org.jboss.identity.idm.spi.store.IdentityStore;
import org.jboss.identity.idm.spi.store.IdentityStoreInvocationContext;
import org.jboss.identity.idm.spi.store.IdentityStoreSession;
@@ -45,19 +43,13 @@
import org.jboss.unit.api.pojo.annotations.Create;
import org.jboss.unit.api.pojo.annotations.Destroy;
import org.jboss.unit.api.pojo.annotations.Test;
-import org.opends.server.tools.LDAPModify;
import javax.naming.Context;
import javax.naming.NamingException;
-import javax.naming.NamingEnumeration;
-import javax.naming.Binding;
-import javax.naming.directory.DirContext;
import javax.naming.ldap.LdapContext;
import javax.naming.ldap.InitialLdapContext;
import java.util.Hashtable;
import java.util.Map;
-import java.io.File;
-import static org.jboss.unit.api.Assert.*;
/**
@@ -419,11 +411,11 @@
}
@Test
- public void testControls() throws Exception
+ public void testCriteria() throws Exception
{
populateClean();
- commonTest.testControls();
+ commonTest.testCriteria();
}
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/AttributesManager.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/AttributesManager.java 2009-05-08 20:46:17 UTC (rev 480)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/AttributesManager.java 2009-05-09 09:51:45 UTC (rev 481)
@@ -241,30 +241,30 @@
/**
* Check if given identity can be protected with text password
*
- * @param identity
+ * @param user
* @return
* @throws IdentityException
*/
- boolean hasPassword(User identity) throws IdentityException;
+ boolean hasPassword(User user) throws IdentityException;
/**
* Validate text password for a given identity
*
- * @param identity
+ * @param user
* @param password
* @return
* @throws IdentityException
*/
- boolean validatePassword(User identity, String password) throws IdentityException;
+ boolean validatePassword(User user, String password) throws IdentityException;
/**
* Update text password for a given identity
*
- * @param identity
+ * @param user
* @param password
* @throws IdentityException
*/
- void updatePassword(User identity, String password) throws IdentityException;
+ void updatePassword(User user, String password) throws IdentityException;
/**
* Check if user can be protected with a given credential type
@@ -276,18 +276,18 @@
/**
* Validate credential for a given identity
*
- * @param identity
+ * @param user
* @param credentials
* @return
*/
- boolean validateCredentials(User identity, Credential[] credentials) throws IdentityException;
+ boolean validateCredentials(User user, Credential[] credentials) throws IdentityException;
/**
* Update credential for a given identity
*
- * @param identity
+ * @param user
* @param credential
*/
- void updateCredential(User identity, Credential credential) throws IdentityException;
+ void updateCredential(User user, Credential credential) throws IdentityException;
}
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/PersistenceManager.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/PersistenceManager.java 2009-05-08 20:46:17 UTC (rev 480)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/PersistenceManager.java 2009-05-09 09:51:45 UTC (rev 481)
@@ -149,11 +149,11 @@
/**
*
- * @param controls
+ * @param criteria
* @return
* @throws IdentityException
*/
- Collection<User> findUser(IdentitySearchCriteria controls) throws IdentityException;
+ Collection<User> findUser(IdentitySearchCriteria criteria) throws IdentityException;
// Search Groups
@@ -180,11 +180,11 @@
/**
*
* @param groupType
- * @param controls
+ * @param criteria
* @return
* @throws IdentityException
*/
- Collection<Group> findGroup(String groupType, IdentitySearchCriteria controls) throws IdentityException;
+ Collection<Group> findGroup(String groupType, IdentitySearchCriteria criteria) throws IdentityException;
/**
*
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java 2009-05-08 20:46:17 UTC (rev 480)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java 2009-05-09 09:51:45 UTC (rev 481)
@@ -312,7 +312,7 @@
String groupType,
boolean parent,
boolean cascade,
- IdentitySearchCriteria controls) throws IdentityException;
+ IdentitySearchCriteria criteria) throws IdentityException;
/**
* Find groups that are associated with given group.
@@ -332,7 +332,7 @@
String groupType,
boolean parent,
boolean cascade,
- IdentitySearchCriteria controls) throws IdentityException;
+ IdentitySearchCriteria criteria) throws IdentityException;
/**
* Find all groups that given identity is associated with.
@@ -354,7 +354,7 @@
*/
Collection<Group> findAssociatedGroups(User user,
String groupType,
- IdentitySearchCriteria controls) throws IdentityException;
+ IdentitySearchCriteria criteria) throws IdentityException;
/**
* Find all groups that given identity is associated with.
@@ -366,7 +366,7 @@
*/
Collection<Group> findAssociatedGroups(String userId,
String groupType,
- IdentitySearchCriteria controls) throws IdentityException;
+ IdentitySearchCriteria criteria) throws IdentityException;
/**
* Find all groups that given identity is associated with.
@@ -376,7 +376,7 @@
* @throws org.jboss.identity.idm.exception.IdentityException
*/
Collection<Group> findAssociatedGroups(User user,
- IdentitySearchCriteria controls) throws IdentityException;
+ IdentitySearchCriteria criteria) throws IdentityException;
/**
* Find all groups that given identity is associated with.
@@ -386,7 +386,7 @@
* @throws org.jboss.identity.idm.exception.IdentityException
*/
Collection<Group> findAssociatedGroups(String userId,
- IdentitySearchCriteria controls) throws IdentityException;
+ IdentitySearchCriteria criteria) throws IdentityException;
/**
* Find all groups that given identity is associated with.
@@ -418,7 +418,7 @@
*/
Collection<User> findAssociatedUsers(Group group,
boolean cascade,
- IdentitySearchCriteria controls) throws IdentityException;
+ IdentitySearchCriteria criteria) throws IdentityException;
/**
* Find identities that have relationship with given parent group.
@@ -430,7 +430,7 @@
*/
Collection<User> findAssociatedUsers(String groupId,
boolean cascade,
- IdentitySearchCriteria controls) throws IdentityException;
+ IdentitySearchCriteria criteria) throws IdentityException;
/**
@@ -443,7 +443,7 @@
*/
Collection<Group> findRelatedGroups(User user,
String groupType,
- IdentitySearchCriteria controls) throws IdentityException;
+ IdentitySearchCriteria criteria) throws IdentityException;
/**
* Find all groups that given identity is associated with. Will return groups connected with a given user with a role
@@ -455,7 +455,7 @@
*/
Collection<Group> findRelatedGroups(String userId,
String groupType,
- IdentitySearchCriteria controls) throws IdentityException;
+ IdentitySearchCriteria criteria) throws IdentityException;
/**
* Find identities that have relationship with given parent group. Will return users connected with a given group with a role
@@ -464,7 +464,7 @@
* @return
* @throws org.jboss.identity.idm.exception.IdentityException
*/
- Collection<User> findRelatedUsers(Group group, IdentitySearchCriteria controls) throws IdentityException;
+ Collection<User> findRelatedUsers(Group group, IdentitySearchCriteria criteria) throws IdentityException;
/**
* Find identities that have relationship with given parent group. Will return users connected with a given group with a role
@@ -473,7 +473,7 @@
* @return
* @throws org.jboss.identity.idm.exception.IdentityException
*/
- Collection<User> findRelatedUsers(String groupId, IdentitySearchCriteria controls) throws IdentityException;
+ Collection<User> findRelatedUsers(String groupId, IdentitySearchCriteria criteria) throws IdentityException;
}
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/Role.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/Role.java 2009-05-08 20:46:17 UTC (rev 480)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/Role.java 2009-05-09 09:51:45 UTC (rev 481)
@@ -40,7 +40,7 @@
/**
* @return identity participating in this role
*/
- User getIdentity();
+ User getUser();
/**
* @return group associated with this role
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java 2009-05-08 20:46:17 UTC (rev 480)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java 2009-05-09 09:51:45 UTC (rev 481)
@@ -91,9 +91,16 @@
* @return
* @throws IdentityException
*/
- Collection<RoleType> findRoleTypes(IdentitySearchCriteria controls) throws IdentityException;
+ Collection<RoleType> findRoleTypes(IdentitySearchCriteria criteria) throws IdentityException;
+ /**
+ * Find all RoleType objects stored
+ * @return
+ * @throws IdentityException
+ */
+ Collection<RoleType> findRoleTypes() throws IdentityException;
+
// Role
/**
* Create role
@@ -188,7 +195,7 @@
* @throws IdentityException
*/
Collection<RoleType> findRoleTypes(User user, Group group,
- IdentitySearchCriteria controls) throws IdentityException;
+ IdentitySearchCriteria criteria) throws IdentityException;
/**
* Find RoleType objects for roles associated with a given User and Group
@@ -198,7 +205,7 @@
* @throws IdentityException
*/
Collection<RoleType> findRoleTypes(String userId, String groupId,
- IdentitySearchCriteria controls) throws IdentityException;
+ IdentitySearchCriteria criteria) throws IdentityException;
/**
* Find RoleType objects for roles associated with a given User and Group
@@ -223,7 +230,7 @@
* @return
* @throws IdentityException
*/
- Collection<RoleType> findUserRoleTypes(User user, IdentitySearchCriteria controls) throws IdentityException;
+ Collection<RoleType> findUserRoleTypes(User user, IdentitySearchCriteria criteria) throws IdentityException;
/**
* Find RoleType objects for roles associated with a given Identity
@@ -231,7 +238,7 @@
* @return
* @throws IdentityException
*/
- Collection<RoleType> findUserRoleTypes(String userId, IdentitySearchCriteria controls) throws IdentityException;
+ Collection<RoleType> findUserRoleTypes(String userId, IdentitySearchCriteria criteria) throws IdentityException;
/**
* Find RoleType objects for roles associated with a given Group
@@ -248,7 +255,7 @@
* @throws IdentityException
*/
Collection<RoleType> findGroupRoleTypes(Group group,
- IdentitySearchCriteria controls) throws IdentityException;
+ IdentitySearchCriteria criteria) throws IdentityException;
/**
* Find RoleType objects for roles associated with a given Group
@@ -257,76 +264,76 @@
* @throws IdentityException
*/
Collection<RoleType> findGroupRoleTypes(String groupId,
- IdentitySearchCriteria controls) throws IdentityException;
+ IdentitySearchCriteria criteria) throws IdentityException;
/**
* Find all Groups with which User has a Role association
*
* @param user
- * @param controls
+ * @param criteria
* @return
* @throws IdentityException
*/
Collection<Group> findGroupsWithRelatedRole(User user,
- IdentitySearchCriteria controls) throws IdentityException;
+ IdentitySearchCriteria criteria) throws IdentityException;
/**
* Find all Groups with which User has a Role association
*
* @param userId
- * @param controls
+ * @param criteria
* @return
* @throws IdentityException
*/
Collection<Group> findGroupsWithRelatedRole(String userId,
- IdentitySearchCriteria controls) throws IdentityException;
+ IdentitySearchCriteria criteria) throws IdentityException;
/**
* Find all Groups with which User has a Role association
*
* @param user
- * @param controls
+ * @param criteria
* @return
* @throws IdentityException
*/
Collection<Group> findGroupsWithRelatedRole(User user,
String groupType,
- IdentitySearchCriteria controls) throws IdentityException;
+ IdentitySearchCriteria criteria) throws IdentityException;
/**
* Find all Groups with which User has a Role association
*
* @param userId
- * @param controls
+ * @param criteria
* @return
* @throws IdentityException
*/
Collection<Group> findGroupsWithRelatedRole(String userId,
String groupType,
- IdentitySearchCriteria controls) throws IdentityException;
+ IdentitySearchCriteria criteria) throws IdentityException;
/**
* Find all Users with which Group has a Role association
*
* @param group
- * @param controls
+ * @param criteria
* @return
* @throws IdentityException
*/
Collection<User> findUsersWithRelatedRole(Group group,
- IdentitySearchCriteria controls) throws IdentityException;
+ IdentitySearchCriteria criteria) throws IdentityException;
/**
* Find all Users with which Group has a Role association
*
* @param groupId
- * @param controls
+ * @param criteria
* @return
* @throws IdentityException
*/
Collection<User> findUsersWithRelatedRole(String groupId,
- IdentitySearchCriteria controls) throws IdentityException;
+ IdentitySearchCriteria criteria) throws IdentityException;
/**
* Find Role objects with a given RoleType associated with a given IdentityType
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/UserQueryBuilder.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/UserQueryBuilder.java 2009-05-08 20:46:17 UTC (rev 480)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/UserQueryBuilder.java 2009-05-09 09:51:45 UTC (rev 481)
@@ -72,4 +72,6 @@
UserQueryBuilder attributeValuesFilter(String attributeName, String[] attributeValue) throws UnsupportedQueryCriterium;
+ UserQueryBuilder idFilter(String idFilter) throws UnsupportedQueryCriterium;
+
}
Added: idm/trunk/idm-auth/pom.xml
===================================================================
--- idm/trunk/idm-auth/pom.xml (rev 0)
+++ idm/trunk/idm-auth/pom.xml 2009-05-09 09:51:45 UTC (rev 481)
@@ -0,0 +1,86 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.identity</groupId>
+ <artifactId>idm-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../parent</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>idm-auth</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Identity IDM Auth</name>
+ <url>http://labs.jboss.org/portal/jbosssecurity/</url>
+ <description>JBoss Identity Auth</description>
+ <licenses>
+ <license>
+ <name>lgpl</name>
+ <url>http://repository.jboss.com/licenses/lgpl.txt</url>
+ </license>
+ </licenses>
+ <organization>
+ <name>JBoss Inc.</name>
+ <url>http://www.jboss.org</url>
+ </organization>
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossidentity/trunk</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/jbossidentity/trunk</developerConnection>
+ <url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossidentity/trunk</url>
+ </scm>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.identity</groupId>
+ <artifactId>idm-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.identity</groupId>
+ <artifactId>idm-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>jboss.jbossas.core-libs</groupId>
+ <artifactId>jbosssx</artifactId>
+ <version>4.0.4.GA</version>
+ </dependency>
+ <dependency>
+ <groupId>apache-tomcat</groupId>
+ <artifactId>catalina</artifactId>
+ <version>5.5.12</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <doclet>org.jboss.apiviz.APIviz</doclet>
+ <docletArtifact>
+ <groupId>org.jboss.apiviz</groupId>
+ <artifactId>apiviz</artifactId>
+ <version>1.2.5.GA</version>
+ </docletArtifact>
+ <additionalparam>
+ -charset UTF-8
+ -docencoding UTF-8
+ -version
+ -author
+ -breakiterator
+ -windowtitle "${project.name} ${project.version} API Reference"
+ -doctitle "${project.name} ${project.version} API Reference"
+ -bottom "Copyright © ${project.inceptionYear}-Present ${project.organization.name}. All Rights Reserved."
+ -link http://java.sun.com/javase/6/docs/api/
+ -sourceclasspath ${project.build.outputDirectory}
+ </additionalparam>
+ <encoding>UTF-8</encoding>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+</project>
Added: idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/JBossIdentityIDMLoginModule.java
===================================================================
--- idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/JBossIdentityIDMLoginModule.java (rev 0)
+++ idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/JBossIdentityIDMLoginModule.java 2009-05-09 09:51:45 UTC (rev 481)
@@ -0,0 +1,325 @@
+///*
+//* JBoss, a division of Red Hat
+//* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+//* by the @authors tag. See the copyright.txt in the distribution for a
+//* full listing of individual contributors.
+//*
+//* This is free software; you can redistribute it and/or modify it
+//* under the terms of the GNU Lesser General Public License as
+//* published by the Free Software Foundation; either version 2.1 of
+//* the License, or (at your option) any later version.
+//*
+//* This software is distributed in the hope that it will be useful,
+//* but WITHOUT ANY WARRANTY; without even the implied warranty of
+//* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+//* Lesser General Public License for more details.
+//*
+//* You should have received a copy of the GNU Lesser General Public
+//* License along with this software; if not, write to the Free
+//* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+//* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+//*/
+//
+//package org.jboss.identity.idm.auth;
+//
+//import org.jboss.security.SimpleGroup;
+//import org.jboss.security.auth.spi.UsernamePasswordLoginModule;
+//
+//import javax.security.auth.Subject;
+//import javax.security.auth.login.LoginException;
+//import javax.security.auth.callback.CallbackHandler;
+//import javax.naming.NamingException;
+//import javax.naming.InitialContext;
+//import java.util.Map;
+//import java.util.Set;
+//import java.util.Iterator;
+//import java.security.acl.Group;
+//import java.security.Principal;
+//
+///**
+// * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+// * @version : 0.1 $
+// */
+//public class JBossIdentityIDMLoginModule extends UsernamePasswordLoginModule
+//{
+//
+// protected String userModuleJNDIName;
+//
+// protected String roleModuleJNDIName;
+//
+// protected String userProfileModuleJNDIName;
+//
+// protected String membershipModuleJNDIName;
+//
+// protected String additionalRole;
+//
+// protected String havingRole;
+//
+// protected String validateUserNameCase;
+//
+// protected String userNameToLowerCase;
+//
+// public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options)
+// {
+// super.initialize(subject, callbackHandler, sharedState, options);
+//
+// // Get data
+// userModuleJNDIName = (String) options.get("userModuleJNDIName");
+// roleModuleJNDIName = (String) options.get("roleModuleJNDIName");
+// userProfileModuleJNDIName = (String) options
+// .get("userProfileModuleJNDIName");
+// membershipModuleJNDIName = (String) options
+// .get("membershipModuleJNDIName");
+// additionalRole = (String) options.get("additionalRole");
+// havingRole = (String) options.get("havingRole");
+// validateUserNameCase = (String) options.get("validateUserNameCase");
+// userNameToLowerCase = (String) options.get("userNameToLowerCase");
+//
+//// // Some info
+//// log.trace("userModuleJNDIName = " + userModuleJNDIName);
+//// log.trace("roleModuleJNDIName = " + roleModuleJNDIName);
+//// log.trace("userProfileModuleJNDIName = " + userProfileModuleJNDIName);
+//// log.trace("membershipModuleJNDIName = " + membershipModuleJNDIName);
+//// log.trace("additionalRole = " + additionalRole);
+//// log.trace("havingRole = " + havingRole);
+//// log.trace("validateUserNameCase = " + validateUserNameCase);
+//// log.trace("userNameToLowerCase = " + userNameToLowerCase);
+// }
+//
+// protected String getUsersPassword() throws LoginException
+// {
+// return "";
+// }
+//
+// protected boolean validatePassword(final String inputPassword, String expectedPassword)
+// {
+//
+// HttpServletRequest request = null;
+// try
+// {
+// request = (HttpServletRequest) PolicyContext.getContext("javax.servlet.http.HttpServletRequest");
+// }
+// catch(Exception e)
+// {
+// log.error(this,e);
+// throw new RuntimeException(e);
+// }
+//
+// Object ssoSuccess = request.getAttribute("ssoSuccess");
+// if(ssoSuccess != null)
+// {
+// return true;
+// }
+//
+// if (inputPassword != null)
+// {
+// try
+// {
+// try
+// {
+//
+// UserStatus userStatus = getUserStatus(inputPassword);
+//
+// // Set the user Status in the request so that the login page can show an error message accordingly
+// request.setAttribute("org.jboss.portal.userStatus", userStatus);
+//
+// if (userStatus == UserStatus.DISABLE)
+// {
+// request.setAttribute("org.jboss.portal.loginError", "Your account is disabled");
+// return false;
+// }
+// else if (userStatus == UserStatus.NOTASSIGNEDTOROLE)
+// {
+// request.setAttribute("org.jboss.portal.loginError", "The user doesn't have the correct role");
+// return false;
+// }
+// else if ((userStatus == UserStatus.UNEXISTING) || userStatus == UserStatus.WRONGPASSWORD)
+// {
+// request.setAttribute("org.jboss.portal.loginError", "The user doesn't exist or the password is incorrect");
+// return false;
+// }
+// else if (userStatus == UserStatus.OK)
+// {
+// return true;
+// }
+// else
+// {
+// log.error("Unexpected error while logging in");
+// return false;
+// } }
+// catch (Exception e)
+// {
+// log.error("Error when validating password", e);
+// }
+// }
+// catch (Exception e)
+// {
+// log.debug("Failed to validate password", e);
+// }
+// }
+// return false;
+// }
+//
+// protected UserStatus getUserStatus(final String inputPassword)
+// {
+// UserStatus result = UserStatus.OK;
+//
+//// try {
+//// TransactionManager tm = (TransactionManager)new InitialContext().lookup("java:/TransactionManager");
+//// UserStatus tmp = (UserStatus)Transactions.required(tm, new Transactions.Runnable()
+//// {
+//// public Object run() throws Exception
+//// {
+//// try
+//// {
+//// User user = getUserModule().findUserByUserName(getUsername());
+//// // in case module implementation doesn't throw proper
+//// // exception...
+//// if (user == null)
+//// {
+//// throw new NoSuchUserException("UserModule returned null user object");
+//// }
+////
+//// //This is because LDAP binds can be non case sensitive
+//// if (validateUserNameCase != null && validateUserNameCase.equalsIgnoreCase("true")
+//// && !getUsername().equals(user.getUserName()))
+//// {
+//// return UserStatus.UNEXISTING;
+//// }
+////
+//// boolean enabled = false;
+//// try {
+//// Object enabledS;
+//// enabledS = getUserProfileModule().getProperty(user,
+//// User.INFO_USER_ENABLED);
+//// if (enabledS != null) {
+//// enabled = new Boolean(enabledS.toString());
+//// }
+//// } catch (Exception e) {
+//// e.printStackTrace();
+//// }
+//// if (!enabled) {
+//// return UserStatus.DISABLE;
+//// }
+//// if (havingRole != null)
+//// {
+//// boolean hasTheRole = false;
+//// Set roles = getMembershipModule().getRoles(user);
+//// for (Iterator i = roles.iterator(); i.hasNext();)
+//// {
+//// Role role = (Role)i.next();
+//// if (havingRole.equals(role.getName()))
+//// {
+//// hasTheRole = true;
+//// break;
+//// }
+//// }
+//// if (!hasTheRole)
+//// {
+//// return UserStatus.NOTASSIGNEDTOROLE;
+//// }
+//// }
+//// if (!user.validatePassword(inputPassword))
+//// {
+//// return UserStatus.WRONGPASSWORD;
+//// }
+//// }
+//// catch (NoSuchUserException e1)
+//// {
+//// return UserStatus.UNEXISTING;
+//// }
+//// catch (Exception e)
+//// {
+//// throw new LoginException(e.toString());
+//// }
+//// return null;
+//// }
+//// });
+//// if (tmp != null)
+//// {
+//// result = tmp;
+//// }
+//// } catch (NamingException e1) {
+//// // TODO Auto-generated catch block
+//// e1.printStackTrace();
+//// }
+//// return result;
+// }
+//
+// protected Group[] getRoleSets() throws LoginException
+// {
+//// try {
+//// TransactionManager tm = (TransactionManager) new InitialContext()
+//// .lookup("java:/TransactionManager");
+//// return (Group[]) Transactions.required(tm, new Transactions.Runnable()
+//// {
+//// public Object run() throws Exception
+//// {
+//// Group rolesGroup = new SimpleGroup("Roles");
+////
+//// //
+//// if (additionalRole != null) {
+//// rolesGroup.addMember(createIdentity(additionalRole));
+//// }
+////
+//// try {
+//// User user = getUserModule().findUserByUserName(getUsername());
+//// Set roles = getMembershipModule().getRoles(user);
+////
+//// //
+////
+//// for (Iterator iterator = roles.iterator(); iterator.hasNext();) {
+//// Role role = (Role) iterator.next();
+//// String roleName = role.getName();
+//// try {
+//// Principal p = createIdentity(roleName);
+//// rolesGroup.addMember(p);
+//// } catch (Exception e) {
+//// log.debug("Failed to create principal " + roleName, e);
+//// }
+//// }
+////
+////
+//// } catch (Exception e) {
+//// throw new LoginException(e.toString());
+//// }
+//// //
+//// return new Group[] { rolesGroup };
+//// }
+//// });
+//// } catch (Exception e) {
+//// Throwable cause = e.getCause();
+//// throw new LoginException(cause.toString());
+//// }
+// }
+//
+// /** Subclass to use the PortalPrincipal to make the username easier to retrieve by the portal. */
+// protected Principal createIdentity(String username) throws Exception
+// {
+// return new UserPrincipal(username);
+// }
+//
+// protected String getUsername()
+// {
+// if (userNameToLowerCase != null && userNameToLowerCase.equalsIgnoreCase("true"))
+// {
+// return super.getUsername().toLowerCase();
+// }
+// return super.getUsername();
+// }
+//
+// protected String[] getUsernameAndPassword() throws LoginException
+// {
+// String[] names = super.getUsernameAndPassword();
+//
+// if (userNameToLowerCase != null && userNameToLowerCase.equalsIgnoreCase("true"))
+// {
+// if (names[0] != null)
+// {
+// names[0] = names[0].toLowerCase();
+// }
+// }
+// return names;
+//
+// }
+//}
Added: idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/UserPrincipal.java
===================================================================
--- idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/UserPrincipal.java (rev 0)
+++ idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/UserPrincipal.java 2009-05-09 09:51:45 UTC (rev 481)
@@ -0,0 +1,74 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.auth;
+
+import java.security.Principal;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class UserPrincipal implements Principal
+{
+
+ /** . */
+ private final String name;
+
+ public UserPrincipal(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException("No null principal name accepted");
+ }
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String toString()
+ {
+ return "PortalPrincipal[" + name + "]";
+ }
+
+ public boolean equals(Object o)
+ {
+ if (o == this)
+ {
+ return true;
+ }
+ if (o instanceof Principal)
+ {
+ Principal that = (Principal)o;
+ return name.equals(that.getName());
+ }
+ return false;
+ }
+
+ public int hashCode()
+ {
+ return name.hashCode();
+ }
+}
\ No newline at end of file
Added: idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/UserStatus.java
===================================================================
--- idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/UserStatus.java (rev 0)
+++ idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/UserStatus.java 2009-05-09 09:51:45 UTC (rev 481)
@@ -0,0 +1,45 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.auth;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision: 5907 $
+ */
+
+public class UserStatus {
+
+ public static UserStatus OK = new UserStatus(0);
+ public static UserStatus DISABLE = new UserStatus(1);
+ public static UserStatus UNEXISTING = new UserStatus(2);
+ public static UserStatus NOTASSIGNEDTOROLE = new UserStatus(3);
+ public static UserStatus WRONGPASSWORD = new UserStatus(4);
+
+ private int value;
+
+ private UserStatus(int value)
+ {
+ this.value = value;
+ }
+
+}
\ No newline at end of file
Modified: idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStore.java
===================================================================
--- idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStore.java 2009-05-08 20:46:17 UTC (rev 480)
+++ idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStore.java 2009-05-09 09:51:45 UTC (rev 481)
@@ -144,13 +144,13 @@
*
* @param invocationCtx
* @param identityType
- * @param controls
+ * @param criteria
* @return
* @throws IdentityException
*/
Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCtx,
IdentityObjectType identityType,
- IdentityObjectSearchCriteria controls) throws IdentityException;
+ IdentityObjectSearchCriteria criteria) throws IdentityException;
/**
* Find identites that have relationship with given identity. Relationships are directional (from parent to child).
*
@@ -159,14 +159,14 @@
* @param relationshipType
* @param parent defines if given identity is parent or child side in the
* relationship - default is true (parent)
- * @param controls
+ * @param criteria
* @return
* @throws IdentityException
*/
Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCxt, IdentityObject identity,
IdentityObjectRelationshipType relationshipType,
boolean parent,
- IdentityObjectSearchCriteria controls) throws IdentityException;
+ IdentityObjectSearchCriteria criteria) throws IdentityException;
@@ -341,27 +341,27 @@
/**
*
* @param ctx
- * @param controls
+ * @param criteria
* @return
* @throws IdentityException
* @throws OperationNotSupportedException
*/
Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
- IdentityObjectSearchCriteria controls) throws IdentityException, OperationNotSupportedException;
+ IdentityObjectSearchCriteria criteria) throws IdentityException, OperationNotSupportedException;
/**
*
* @param ctx
* @param identity
- * @param controls
+ * @param criteria
* @return
* @throws IdentityException
* @throws OperationNotSupportedException
*/
Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
IdentityObject identity,
- IdentityObjectSearchCriteria controls) throws IdentityException, OperationNotSupportedException;
+ IdentityObjectSearchCriteria criteria) throws IdentityException, OperationNotSupportedException;
// Credentials
Modified: idm/trunk/pom.xml
===================================================================
--- idm/trunk/pom.xml 2009-05-08 20:46:17 UTC (rev 480)
+++ idm/trunk/pom.xml 2009-05-09 09:51:45 UTC (rev 481)
@@ -19,6 +19,7 @@
<module>idm-spi</module>
<module>idm-api</module>
<module>idm</module>
+ <module>idm-auth</module>
<module>integration</module>
<module>assembly</module>
</modules>
15 years, 8 months
JBoss Identity SVN: r480 - in idm/trunk: idm/src/main/java/org/jboss/identity/idm/impl/api/query and 5 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-05-08 16:46:17 -0400 (Fri, 08 May 2009)
New Revision: 480
Added:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/GroupQueryBuilder.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/QueryBuilder.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/RoleQueryBuilder.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/UserQueryBuilder.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQueryBuilder.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQueryExecutor.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryBuilderImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryExecutorImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/RoleQueryBuilderImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/RoleQueryExecutorImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryBuilderImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryExecutorImpl.java
Modified:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/IdentitySession.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleType.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/GroupQuery.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/RoleQuery.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/UserQuery.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleRole.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleUser.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQuery.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/RoleQueryImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/IdentitySessionImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/APITestCase.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/GroupQueryTest.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RoleQueryTest.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/UserQueryTest.java
Log:
query api refactoring
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleRole.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleRole.java 2009-05-07 19:45:12 UTC (rev 479)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleRole.java 2009-05-08 20:46:17 UTC (rev 480)
@@ -56,13 +56,47 @@
return group;
}
- public String getDescription()
+ public RoleType getRoleType()
{
- return null;
+ return type;
}
- public RoleType getRoleType()
+ @Override
+ public boolean equals(Object o)
{
- return type;
+ if (this == o)
+ {
+ return true;
+ }
+ if (!(o instanceof SimpleRole))
+ {
+ return false;
+ }
+
+ SimpleRole that = (SimpleRole)o;
+
+ if (group != null ? !group.equals(that.group) : that.group != null)
+ {
+ return false;
+ }
+ if (identity != null ? !identity.equals(that.identity) : that.identity != null)
+ {
+ return false;
+ }
+ if (type != null ? !type.equals(that.type) : that.type != null)
+ {
+ return false;
+ }
+
+ return true;
}
+
+ @Override
+ public int hashCode()
+ {
+ int result = type != null ? type.hashCode() : 0;
+ result = 31 * result + (identity != null ? identity.hashCode() : 0);
+ result = 31 * result + (group != null ? group.hashCode() : 0);
+ return result;
+ }
}
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleUser.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleUser.java 2009-05-07 19:45:12 UTC (rev 479)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleUser.java 2009-05-08 20:46:17 UTC (rev 480)
@@ -70,4 +70,6 @@
{
return id != null ? id.hashCode() : 0;
}
+
+
}
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQuery.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQuery.java 2009-05-07 19:45:12 UTC (rev 479)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQuery.java 2009-05-08 20:46:17 UTC (rev 480)
@@ -46,175 +46,41 @@
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
-public class AbstractQuery implements Query
+public abstract class AbstractQuery implements Query
{
- //TODO: query should check criteria with features description
- protected IdentitySessionImpl identitySession;
-
protected IdentitySearchCriteriaImpl searchCriteria = new IdentitySearchCriteriaImpl();
- public AbstractQuery(IdentitySessionImpl identitySession)
+ public AbstractQuery(IdentitySearchCriteriaImpl searchCriteria)
{
- this.identitySession = identitySession;
+ this.searchCriteria = searchCriteria;
}
- public Query sort(SortOrder order) throws UnsupportedQueryCriterium
+ @Override
+ public boolean equals(Object o)
{
- try
+ if (this == o)
{
- searchCriteria.sort(order);
+ return true;
}
- catch (UnsupportedCriterium unsupportedCriterium)
+ if (!(o instanceof AbstractQuery))
{
- throw new UnsupportedQueryCriterium(unsupportedCriterium);
+ return false;
}
- return this;
- }
- public Query sortAttributeName(String name) throws UnsupportedQueryCriterium
- {
- try
- {
- searchCriteria.sortAttributeName(name);
- }
- catch (UnsupportedCriterium unsupportedCriterium)
- {
- throw new UnsupportedQueryCriterium(unsupportedCriterium);
- }
- return this;
- }
+ AbstractQuery that = (AbstractQuery)o;
- public Query page(int firstResult, int maxResults) throws UnsupportedQueryCriterium
- {
- try
+ if (!searchCriteria.equals(that.searchCriteria))
{
- searchCriteria.page(firstResult, maxResults);
+ return false;
}
- catch (UnsupportedCriterium unsupportedCriterium)
- {
- throw new UnsupportedQueryCriterium(unsupportedCriterium);
- }
- return this;
- }
- public Query attributeValuesFilter(String attributeName, String[] attributeValue) throws UnsupportedQueryCriterium
- {
- try
- {
- searchCriteria.attributeValuesFilter(attributeName, attributeValue);
- }
- catch (UnsupportedCriterium unsupportedCriterium)
- {
- throw new UnsupportedQueryCriterium(unsupportedCriterium);
- }
- return this;
+ return true;
}
-
- protected void checkNotNullArgument(Object arg, String name)
+ @Override
+ public int hashCode()
{
- if (arg == null)
- {
- throw new IllegalArgumentException(name + " cannot be null");
- }
+ return searchCriteria.hashCode();
}
-
- protected Group createGroupFromId(String id)
- {
- return new SimpleGroup(new GroupId(id));
- }
-
- protected IdentityType createIdentityTypeFromId(String id)
- {
- if (GroupId.validateId(id))
- {
- GroupId groupId = new GroupId(id);
-
- return new SimpleGroup(groupId);
- }
- else
- {
- return new SimpleUser(id);
- }
- }
-
- protected List<IdentityType> mergeIdentityTypeWithAND(List<IdentityType> first, List<IdentityType> second)
- {
- List<IdentityType> results = new LinkedList<IdentityType>();
-
- for (IdentityType identityType : first)
- {
- if (second.contains(identityType))
- {
- results.add(identityType);
- }
- }
-
- return results;
- }
-
- protected List<User> mergeUsersWithAND(List<User> first, List<User> second)
- {
- List<User> results = new LinkedList<User>();
-
- for (User user : first)
- {
- if (second.contains(user))
- {
- results.add(user);
- }
- }
-
- return results;
- }
-
- protected List<Group> mergeGroupsWithAND(List<Group> first, List<Group> second)
- {
- List<Group> results = new LinkedList<Group>();
-
- for (Group group : first)
- {
- if (second.contains(group))
- {
- results.add(group);
- }
- }
-
- return results;
- }
-
- protected List<User> applyCriteriaUsers(List<User> users)
- {
-// List<User> results = new LinkedList<User>();
-//
-// // First pass - filters
-// if(searchCriteria.isFiltered())
-// {
-// for (User user : users)
-// {
-// if (searchCriteria.getFilter() != null)
-// {
-//
-// }
-// }
-//
-// }
-
- return users;
- }
-
- protected List<Role> applyCriteriaRoles(List<Role> roles)
- {
- //TODO:
- return roles;
- }
-
- protected List<Group> applyCriteriaGroups(List<Group> roles)
- {
- //TODO:
- return roles;
- }
-
-
}
Added: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQueryBuilder.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQueryBuilder.java (rev 0)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQueryBuilder.java 2009-05-08 20:46:17 UTC (rev 480)
@@ -0,0 +1,128 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.api.query;
+
+import org.jboss.identity.idm.impl.api.IdentitySearchCriteriaImpl;
+import org.jboss.identity.idm.impl.api.model.SimpleGroup;
+import org.jboss.identity.idm.impl.api.model.GroupId;
+import org.jboss.identity.idm.impl.api.model.SimpleUser;
+import org.jboss.identity.idm.api.query.Query;
+import org.jboss.identity.idm.api.query.UnsupportedQueryCriterium;
+import org.jboss.identity.idm.api.query.QueryBuilder;
+import org.jboss.identity.idm.api.SortOrder;
+import org.jboss.identity.idm.api.UnsupportedCriterium;
+import org.jboss.identity.idm.api.Group;
+import org.jboss.identity.idm.api.IdentityType;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class AbstractQueryBuilder implements QueryBuilder
+{
+
+ //TODO: query should check criteria with features description
+
+ protected IdentitySearchCriteriaImpl searchCriteria = new IdentitySearchCriteriaImpl();
+
+ public QueryBuilder sort(SortOrder order) throws UnsupportedQueryCriterium
+ {
+ try
+ {
+ searchCriteria.sort(order);
+ }
+ catch (UnsupportedCriterium unsupportedCriterium)
+ {
+ throw new UnsupportedQueryCriterium(unsupportedCriterium);
+ }
+ return this;
+ }
+
+ public QueryBuilder sortAttributeName(String name) throws UnsupportedQueryCriterium
+ {
+ try
+ {
+ searchCriteria.sortAttributeName(name);
+ }
+ catch (UnsupportedCriterium unsupportedCriterium)
+ {
+ throw new UnsupportedQueryCriterium(unsupportedCriterium);
+ }
+ return this;
+ }
+
+ public QueryBuilder page(int firstResult, int maxResults) throws UnsupportedQueryCriterium
+ {
+ try
+ {
+ searchCriteria.page(firstResult, maxResults);
+ }
+ catch (UnsupportedCriterium unsupportedCriterium)
+ {
+ throw new UnsupportedQueryCriterium(unsupportedCriterium);
+ }
+ return this;
+ }
+
+ public QueryBuilder attributeValuesFilter(String attributeName, String[] attributeValue) throws UnsupportedQueryCriterium
+ {
+ try
+ {
+ searchCriteria.attributeValuesFilter(attributeName, attributeValue);
+ }
+ catch (UnsupportedCriterium unsupportedCriterium)
+ {
+ throw new UnsupportedQueryCriterium(unsupportedCriterium);
+ }
+ return this;
+ }
+
+
+ protected void checkNotNullArgument(Object arg, String name)
+ {
+ if (arg == null)
+ {
+ throw new IllegalArgumentException(name + " cannot be null");
+ }
+ }
+
+ protected Group createGroupFromId(String id)
+ {
+ return new SimpleGroup(new GroupId(id));
+ }
+
+ protected IdentityType createIdentityTypeFromId(String id)
+ {
+ if (GroupId.validateId(id))
+ {
+ GroupId groupId = new GroupId(id);
+
+ return new SimpleGroup(groupId);
+ }
+ else
+ {
+ return new SimpleUser(id);
+ }
+ }
+
+}
Added: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQueryExecutor.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQueryExecutor.java (rev 0)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQueryExecutor.java 2009-05-08 20:46:17 UTC (rev 480)
@@ -0,0 +1,323 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.api.query;
+
+import org.jboss.identity.idm.api.IdentityType;
+import org.jboss.identity.idm.api.User;
+import org.jboss.identity.idm.api.Group;
+import org.jboss.identity.idm.api.Role;
+import org.jboss.identity.idm.api.IdentitySession;
+import org.jboss.identity.idm.api.Attribute;
+import org.jboss.identity.idm.spi.search.IdentityObjectSearchCriteria;
+import org.jboss.identity.idm.spi.model.IdentityObject;
+import org.jboss.identity.idm.impl.helper.Tools;
+
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public abstract class AbstractQueryExecutor
+{
+
+ protected IdentitySession identitySession;
+
+ protected AbstractQueryExecutor(IdentitySession identitySession)
+ {
+ this.identitySession = identitySession;
+ }
+
+ protected <T extends IdentityType> List<T> mergeIdentityTypeWithAND(List<T> first, List<T> second)
+ {
+ List<T> results = new LinkedList<T>();
+
+ for (T identityType : first)
+ {
+ if (second.contains(identityType))
+ {
+ results.add(identityType);
+ }
+ }
+
+ return results;
+ }
+
+ protected <T extends IdentityType> void addAllPreservingDuplicates(Collection<T> first, Collection<T> second)
+ {
+ for (T t : second)
+ {
+ if (!first.contains(t))
+ {
+ first.add(t);
+ }
+ }
+ }
+
+
+ protected <T extends IdentityType> List<T> applyCriteria(IdentityObjectSearchCriteria criteria, List<T> types) throws Exception
+ {
+
+ // First pass - filters
+
+ if(criteria.isFiltered())
+ {
+ if (criteria.getFilter() != null)
+ {
+ filterByIdFilter(types, criteria.getFilter());
+ }
+
+ if (criteria.getValues() != null && criteria.getValues().size() > 0)
+ {
+ filterByAttributesValues(types, criteria.getValues());
+ }
+
+ }
+
+ // Second pass - sort
+
+ if (criteria.isSorted())
+ {
+ if (criteria.getSortAttributeName() != null)
+ {
+ sortByAttributeName(types, criteria.getSortAttributeName(), criteria.isAscending());
+ }
+ else
+ {
+ sortByName(types, criteria.isAscending());
+ }
+ }
+
+ List<T> results = types;
+
+ // Third pass - cut the page
+
+ if (criteria.isPaged())
+ {
+ results = cutPageFromResults(results, criteria);
+ }
+
+ return results;
+ }
+
+ protected List<Role> applyCriteriaRoles(IdentityObjectSearchCriteria criteria, List<Role> roles)
+ {
+ //TODO: No criteria in RoleQueryBuilder for now...
+
+ return roles;
+ }
+
+ //TODO: quick impl. should be reviewed
+ private void filterByAttributesValues(Collection<? extends IdentityType> types, Map<String, String[]> attrs) throws Exception
+ {
+ Set<IdentityType> toRemove = new HashSet<IdentityType>();
+
+ for (IdentityType type : types)
+ {
+ //TODO: AttributeManager should have .getAttributes(type, names) to improve and not obtain everything
+ Map<String, Attribute> presentAttrs = identitySession.getAttributesManager().getAttributes(type);
+
+ for (Map.Entry<String, String[]> entry : attrs.entrySet())
+ {
+ if (presentAttrs.containsKey(entry.getKey()))
+ {
+ Set<String> given = new HashSet<String>(Arrays.asList(entry.getValue()));
+ Attribute attr = presentAttrs.get(entry.getKey());
+
+ Collection present = null;
+
+ if (attr != null)
+ {
+ present = attr.getValues();
+ }
+ else
+ {
+ present = Collections.emptySet();
+ }
+
+ for (String s : given)
+ {
+ if (!present.contains(s))
+ {
+ toRemove.add(type);
+ break;
+ }
+ }
+
+ }
+ else
+ {
+ toRemove.add(type);
+ break;
+
+ }
+ }
+ }
+
+ for (IdentityType type : toRemove)
+ {
+ types.remove(type);
+ }
+
+ }
+
+ //TODO: quick impl. should be reviewed
+ private void filterByIdFilter(List<? extends IdentityType> types, String filter) throws Exception
+ {
+ Set<IdentityType> toRemove = new HashSet<IdentityType>();
+
+ String regex = Tools.wildcardToRegex(filter);
+
+
+ for (IdentityType type : types)
+ {
+ String id = null;
+
+ if (type instanceof User)
+ {
+ id = type.getId();
+ }
+ else if (type instanceof Group)
+ {
+ id = ((Group)type).getName();
+ }
+ else
+ {
+ // shouldn't happen
+ throw new IllegalStateException();
+ }
+
+ if (!id.matches(regex))
+ {
+ toRemove.add(type);
+ }
+ }
+
+ for (IdentityType type : toRemove)
+ {
+ types.remove(type);
+ }
+
+ }
+
+ private <T extends IdentityType> void sortByName(List<T> objects, final boolean ascending)
+ {
+ Collections.sort(objects, new Comparator<T>(){
+ public int compare(T o1, T o2)
+ {
+ if (o1 instanceof User && o2 instanceof User)
+ {
+ if (ascending)
+ {
+ return o1.getId().compareTo(o2.getId());
+ }
+ else
+ {
+ return o2.getId().compareTo(o1.getId());
+ }
+ }
+ else
+ {
+ Group g1 = (Group)o1;
+ Group g2 = (Group)o2;
+
+ if (ascending)
+ {
+ return g1.getName().compareTo(g2.getName());
+ }
+ else
+ {
+ return g2.getName().compareTo(g1.getName());
+ }
+
+ }
+ }
+ });
+ }
+
+ private <T extends IdentityType> void sortByAttributeName(List<T> objects, String attributeName, final boolean ascending)
+ throws Exception
+ {
+
+ //TODO: Check if attribute has "text" type and delegate to name sort if not
+
+ // Pre fetch attributes
+ final Map<T, String> attributes = new HashMap<T, String>();
+
+ for (T object : objects)
+ {
+ Attribute attr = identitySession.getAttributesManager().getAttribute(object, attributeName);
+
+ if (attr != null && attr.getValue() != null)
+ {
+ attributes.put(object, attr.getValue().toString());
+ }
+ else
+ {
+ attributes.put(object, "");
+ }
+ }
+
+
+
+ Collections.sort(objects, new Comparator<T>(){
+ public int compare(T o1, T o2)
+ {
+ String a1 = attributes.get(o1);
+ String a2 = attributes.get(o2);
+
+ if (ascending)
+ {
+ return a1.compareTo(a2);
+ }
+ else
+ {
+ return a2.compareTo(a1);
+ }
+ }
+ });
+ }
+
+ //TODO: dummy and inefficient...
+ private <T extends IdentityType> List<T> cutPageFromResults(List<T> objects, IdentityObjectSearchCriteria criteria)
+ {
+ List<T> results = new LinkedList<T>();
+ for (int i = criteria.getFirstResult(); i < criteria.getFirstResult() + criteria.getMaxResults(); i++)
+ {
+ if (i < objects.size())
+ {
+ results.add(objects.get(i));
+ }
+ }
+ return results;
+ }
+}
Added: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryBuilderImpl.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryBuilderImpl.java (rev 0)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryBuilderImpl.java 2009-05-08 20:46:17 UTC (rev 480)
@@ -0,0 +1,299 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.api.query;
+
+import org.jboss.identity.idm.api.query.GroupQueryBuilder;
+import org.jboss.identity.idm.api.query.QueryException;
+import org.jboss.identity.idm.api.query.GroupQuery;
+import org.jboss.identity.idm.api.query.UnsupportedQueryCriterium;
+import org.jboss.identity.idm.api.Group;
+import org.jboss.identity.idm.api.User;
+import org.jboss.identity.idm.api.SortOrder;
+import org.jboss.identity.idm.impl.api.model.GroupId;
+import org.jboss.identity.idm.impl.api.model.SimpleGroup;
+import org.jboss.identity.idm.impl.api.model.SimpleUser;
+import org.jboss.identity.idm.impl.api.IdentitySearchCriteriaImpl;
+import org.jboss.identity.idm.impl.NotYetImplementedException;
+
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class GroupQueryBuilderImpl extends AbstractQueryBuilder implements GroupQueryBuilder
+{
+ private GroupId groupId;
+
+ private String groupName;
+
+ private String groupType;
+
+ private Set<Group> associatedParentGroups = new HashSet<Group>();
+
+ private Set<Group> associatedChildGroups = new HashSet<Group>();
+
+ private Set<User> usersAssociated = new HashSet<User>();
+
+ private Set<User> usersRelated = new HashSet<User>();
+
+ private Set<User> usersConnectedByRole = new HashSet<User>();
+
+ private void prepare()
+ {
+ if (groupId == null && (groupName != null && groupType != null))
+ {
+ groupId = new GroupId(groupName, groupType);
+ }
+
+ }
+
+ public GroupQuery createQuery()
+ {
+ prepare();
+
+ return new GroupQueryImpl(
+ searchCriteria,
+ groupId,
+ groupName,
+ groupType,
+ associatedParentGroups,
+ associatedChildGroups,
+ usersAssociated,
+ usersRelated,
+ usersConnectedByRole);
+ }
+
+ public GroupQueryBuilder reset()
+ {
+ searchCriteria = new IdentitySearchCriteriaImpl();
+ groupId = null;
+ groupName = null;
+ groupType = null;
+ associatedParentGroups = new HashSet<Group>();
+ associatedChildGroups = new HashSet<Group>();
+ usersAssociated = new HashSet<User>();
+ usersRelated = new HashSet<User>();
+ usersConnectedByRole = new HashSet<User>();
+
+ return this;
+ }
+
+ public GroupQueryBuilder setId(String id)
+ {
+ groupId = new GroupId(id);
+ return this;
+ }
+
+ public GroupQueryBuilder setNameAndType(String name, String type)
+ {
+ groupId = new GroupId(name, type);
+ groupName = name;
+ groupType = type;
+
+ return this;
+ }
+
+ public GroupQueryBuilder setName(String name)
+ {
+ checkNotNullArgument(name, "Group name");
+ groupName = name;
+ return this;
+ }
+
+ public GroupQueryBuilder setType(String type)
+ {
+ checkNotNullArgument(type, "Group type");
+ groupType = type;
+ return this;
+ }
+
+ public GroupQueryBuilder addAssociatedGroup(Group group, boolean parent)
+ {
+ checkNotNullArgument(group, "Group");
+ if (parent)
+ {
+ associatedParentGroups.add(group);
+ }
+ else
+ {
+ associatedChildGroups.add(group);
+ }
+ return this;
+ }
+
+ public GroupQueryBuilder addAssociatedGroup(String id, boolean parent)
+ {
+ checkNotNullArgument(id, "Group id");
+
+ Group group = new SimpleGroup(new GroupId(id));
+
+ if (parent)
+ {
+ associatedParentGroups.add(group);
+ }
+ else
+ {
+ associatedChildGroups.add(group);
+ }
+
+
+ return this;
+ }
+
+ public GroupQueryBuilder addAssociatedGroups(Collection<Group> groups, boolean parent)
+ {
+ checkNotNullArgument(groups, "Groups");
+
+ if (parent)
+ {
+ associatedParentGroups.addAll(groups);
+ }
+ else
+ {
+ associatedChildGroups.addAll(groups);
+ }
+
+ return this;
+ }
+
+ public GroupQueryBuilder addAssociatedGroupsIds(Collection<String> ids, boolean parent)
+ {
+ checkNotNullArgument(ids, "Groups ids");
+ for (String groupId : ids)
+ {
+ Group group = new SimpleGroup(new GroupId(groupId));
+
+ if (parent)
+ {
+ associatedParentGroups.add(group);
+ }
+ else
+ {
+ associatedChildGroups.add(group);
+ }
+ }
+
+ return this;
+ }
+
+ public GroupQueryBuilder addAssociatedUser(User user)
+ {
+ checkNotNullArgument(user, "User");
+ usersAssociated.add(user);
+ return this;
+ }
+
+ public GroupQueryBuilder addAssociatedUser(String id)
+ {
+ checkNotNullArgument(id, "User id");
+ usersAssociated.add(new SimpleUser(id));
+ return this;
+ }
+
+ public GroupQueryBuilder addAssociatedUsers(Collection<User> users)
+ {
+ checkNotNullArgument(users, "Users");
+ usersAssociated.addAll(users);
+ return this;
+ }
+
+ public GroupQueryBuilder addAssociatedUsersIds(Collection<String> ids)
+ {
+ checkNotNullArgument(ids, "Users ids");
+ for (String id : ids)
+ {
+ usersAssociated.add(new SimpleUser(id));
+ }
+ return this;
+ }
+
+ public GroupQueryBuilder addUserConnectedByRole(User user)
+ {
+ checkNotNullArgument(user, "User");
+ usersConnectedByRole.add(user);
+ return this;
+ }
+
+ public GroupQueryBuilder addUserConnectedByRole(String id)
+ {
+ checkNotNullArgument(id, "User id");
+ usersConnectedByRole.add(new SimpleUser(id));
+ return this;
+ }
+
+ public GroupQueryBuilder addUsersConnectedByRole(Collection<User> users)
+ {
+ checkNotNullArgument(users, "Users");
+ usersConnectedByRole.addAll(users);
+ return this;
+ }
+
+ public GroupQueryBuilder addUsersIdsConnectedByRole(Collection<String> ids)
+ {
+ checkNotNullArgument(ids, "Users ids");
+ for (String id : ids)
+ {
+ usersConnectedByRole.add(new SimpleUser(id));
+ }
+ return this;
+ }
+
+ public GroupQueryBuilder addRelatedUser(User user)
+ {
+ checkNotNullArgument(user, "User");
+ usersRelated.add(user);
+ return this;
+ }
+
+ public GroupQueryBuilder addRelatedUser(String id)
+ {
+ checkNotNullArgument(id, "User id");
+ usersRelated.add(new SimpleUser(id));
+ return this;
+ }
+
+ public GroupQueryBuilder sort(SortOrder order) throws UnsupportedQueryCriterium
+ {
+ return (GroupQueryBuilder)super.sort(order);
+ }
+
+ public GroupQueryBuilder sortAttributeName(String name) throws UnsupportedQueryCriterium
+ {
+ return (GroupQueryBuilder)super.sortAttributeName(name);
+ }
+
+ public GroupQueryBuilder page(int firstResult, int maxResults) throws UnsupportedQueryCriterium
+ {
+ return (GroupQueryBuilder)super.page(firstResult, maxResults);
+ }
+
+ public GroupQueryBuilder attributeValuesFilter(String attributeName, String[] attributeValue) throws UnsupportedQueryCriterium
+ {
+ return (GroupQueryBuilder)super.attributeValuesFilter(attributeName, attributeValue);
+ }
+
+}
Added: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryExecutorImpl.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryExecutorImpl.java (rev 0)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryExecutorImpl.java 2009-05-08 20:46:17 UTC (rev 480)
@@ -0,0 +1,361 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.api.query;
+
+import org.jboss.identity.idm.api.Group;
+import org.jboss.identity.idm.api.User;
+import org.jboss.identity.idm.api.IdentitySession;
+import org.jboss.identity.idm.api.query.QueryException;
+import org.jboss.identity.idm.impl.NotYetImplementedException;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.LinkedList;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class GroupQueryExecutorImpl extends AbstractQueryExecutor
+{
+
+ public GroupQueryExecutorImpl(IdentitySession identitySession)
+ {
+ super(identitySession);
+ }
+
+ public Collection<Group> execute(GroupQueryImpl q) throws QueryException
+ {
+ List<Group> mainResults = new LinkedList<Group>();
+
+ try
+ {
+ Group uniqueResult = null;
+
+ List<Group> resultsAssociatedParentGroups = new LinkedList<Group>();
+ List<Group> resultsAssociatedChildGroups = new LinkedList<Group>();
+ List<Group> resultsUsersAssociated = new LinkedList<Group>();
+ List<Group> resultsUsersRelated = new LinkedList<Group>();
+ List<Group> resultsUsersConnectedByRole = new LinkedList<Group>();
+
+ // If no conditions
+
+ if (q.groupId == null &&
+ q.groupName == null &&
+ q.groupType == null &&
+ q.associatedParentGroups.size() == 0 &&
+ q.associatedChildGroups.size() == 0 &&
+ q.usersAssociated.size() == 0 &&
+ q.usersConnectedByRole.size() == 0 &&
+ q.usersRelated.size() == 0)
+ {
+ throw new QueryException("Not enought information to perform a query. Cannot query groups without at least " +
+ "group type");
+
+ //TODO: extend API for that maybe
+
+ }
+
+ if (q.groupId != null)
+ {
+ uniqueResult = identitySession.getPersistenceManager().
+ findGroup(q.groupId.getName(), q.groupId.getType());
+ }
+
+ // Process each condition
+
+ if (q.associatedParentGroups.size() > 0)
+ {
+ for (Group group : q.associatedParentGroups)
+ {
+ addAllPreservingDuplicates(resultsAssociatedParentGroups, identitySession.getRelationshipManager().findAssociatedGroups(
+ group, q.groupType, true, false, q.searchCriteria));
+ }
+ }
+
+ if (q.associatedChildGroups.size() > 0)
+ {
+ for (Group group : q.associatedChildGroups)
+ {
+ addAllPreservingDuplicates(resultsAssociatedChildGroups, identitySession.getRelationshipManager().findAssociatedGroups(
+ group, q.groupType, false, false, q.searchCriteria));
+ }
+ }
+
+
+ if (q.usersAssociated.size() > 0)
+ {
+ for (User user : q.usersAssociated)
+ {
+ addAllPreservingDuplicates(resultsUsersAssociated,identitySession.getRelationshipManager().findAssociatedGroups(
+ user, q.groupType, q.searchCriteria));
+ }
+ }
+
+ if (q.usersRelated.size() > 0)
+ {
+ for (User user : q.usersRelated)
+ {
+ addAllPreservingDuplicates(resultsUsersRelated, identitySession.getRelationshipManager().
+ findRelatedGroups(user, q.groupType, q.searchCriteria));
+ }
+ }
+
+ if (q.usersConnectedByRole.size() > 0)
+ {
+ for (User user : q.usersConnectedByRole)
+ {
+ addAllPreservingDuplicates(resultsUsersConnectedByRole, identitySession.getRoleManager().
+ findGroupsWithRelatedRole(user, q.groupType, q.searchCriteria));
+ }
+ }
+
+ // If only one search was performed then return it as search criteria are applied correctly
+
+ if (q.groupId == null &&
+ uniqueResult == null &&
+ q.associatedChildGroups.size() == 0 &&
+ resultsAssociatedChildGroups.size() == 0 &&
+ q.associatedParentGroups.size() == 0 &&
+ resultsAssociatedParentGroups.size() == 0 &&
+ q.usersAssociated.size() == 0 &&
+ resultsUsersAssociated.size() == 0 &&
+ q.usersConnectedByRole.size() == 0 &&
+ resultsUsersConnectedByRole.size() == 0 &&
+ q.usersRelated.size() == 0 &&
+ resultsUsersRelated.size() == 0)
+ {
+ return mainResults;
+
+ }
+ else if (q.groupId != null &&
+ uniqueResult != null &&
+ q.associatedChildGroups.size() == 0 &&
+ resultsAssociatedChildGroups.size() == 0 &&
+ q.associatedParentGroups.size() == 0 &&
+ resultsAssociatedParentGroups.size() == 0 &&
+ q.usersAssociated.size() == 0 &&
+ resultsUsersAssociated.size() == 0 &&
+ q.usersConnectedByRole.size() == 0 &&
+ resultsUsersConnectedByRole.size() == 0 &&
+ q.usersRelated.size() == 0 &&
+ resultsUsersRelated.size() == 0)
+ {
+
+ mainResults.add(uniqueResult);
+ applyCriteria(q.searchCriteria, mainResults);
+ return mainResults;
+ }
+ else if (q.groupId == null &&
+ uniqueResult == null &&
+ q.associatedChildGroups.size() != 0 &&
+ resultsAssociatedChildGroups.size() != 0 &&
+ q.associatedParentGroups.size() == 0 &&
+ resultsAssociatedParentGroups.size() == 0 &&
+ q.usersAssociated.size() == 0 &&
+ resultsUsersAssociated.size() == 0 &&
+ q.usersConnectedByRole.size() == 0 &&
+ resultsUsersConnectedByRole.size() == 0 &&
+ q.usersRelated.size() == 0 &&
+ resultsUsersRelated.size() == 0)
+ {
+ return resultsAssociatedChildGroups;
+
+ }
+ else if (q.groupId == null &&
+ uniqueResult == null &&
+ q.associatedChildGroups.size() == 0 &&
+ resultsAssociatedChildGroups.size() == 0 &&
+ q.associatedParentGroups.size() != 0 &&
+ resultsAssociatedParentGroups.size() != 0 &&
+ q.usersAssociated.size() == 0 &&
+ resultsUsersAssociated.size() == 0 &&
+ q.usersConnectedByRole.size() == 0 &&
+ resultsUsersConnectedByRole.size() == 0 &&
+ q.usersRelated.size() == 0 &&
+ resultsUsersRelated.size() == 0)
+ {
+ return resultsAssociatedParentGroups;
+ }
+ else if (q.groupId == null &&
+ uniqueResult == null &&
+ q.associatedChildGroups.size() == 0 &&
+ resultsAssociatedChildGroups.size() == 0 &&
+ q.associatedParentGroups.size() == 0 &&
+ resultsAssociatedParentGroups.size() == 0 &&
+ q.usersAssociated.size() != 0 &&
+ resultsUsersAssociated.size() != 0 &&
+ q.usersConnectedByRole.size() == 0 &&
+ resultsUsersConnectedByRole.size() == 0 &&
+ q.usersRelated.size() == 0 &&
+ resultsUsersRelated.size() == 0)
+ {
+ return resultsUsersAssociated;
+ }
+ else if (q.groupId == null &&
+ uniqueResult == null &&
+ q.associatedChildGroups.size() == 0 &&
+ resultsAssociatedChildGroups.size() == 0 &&
+ q.associatedParentGroups.size() == 0 &&
+ resultsAssociatedParentGroups.size() == 0 &&
+ q.usersAssociated.size() == 0 &&
+ resultsUsersAssociated.size() == 0 &&
+ q.usersConnectedByRole.size() != 0 &&
+ resultsUsersConnectedByRole.size() != 0 &&
+ q.usersRelated.size() == 0 &&
+ resultsUsersRelated.size() == 0)
+ {
+ return resultsUsersConnectedByRole;
+ }
+ else if (q.groupId == null &&
+ uniqueResult == null &&
+ q.associatedChildGroups.size() == 0 &&
+ resultsAssociatedChildGroups.size() == 0 &&
+ q.associatedParentGroups.size() == 0 &&
+ resultsAssociatedParentGroups.size() == 0 &&
+ q.usersAssociated.size() == 0 &&
+ resultsUsersAssociated.size() == 0 &&
+ q.usersConnectedByRole.size() == 0 &&
+ resultsUsersConnectedByRole.size() == 0 &&
+ q.usersRelated.size() != 0 &&
+ resultsUsersRelated.size() != 0)
+ {
+ return resultsUsersRelated;
+ }
+
+ // Merge with logical AND
+
+ boolean first = true;
+
+ if (q.groupId != null)
+ {
+ first = false;
+ mainResults.add(uniqueResult);
+ }
+
+ if (q.associatedChildGroups.size() > 0)
+ {
+ if (first)
+ {
+ first = false;
+ mainResults = resultsAssociatedChildGroups;
+ }
+ else
+ {
+ mainResults = mergeIdentityTypeWithAND(mainResults, resultsAssociatedChildGroups);
+ }
+ }
+
+ if (q.associatedParentGroups.size() > 0)
+ {
+ if (first)
+ {
+ first = false;
+ mainResults = resultsAssociatedParentGroups;
+ }
+ else
+ {
+ mainResults = mergeIdentityTypeWithAND(mainResults, resultsAssociatedParentGroups);
+ }
+ }
+
+ if (q.usersAssociated.size() > 0)
+ {
+ if (first)
+ {
+ first = false;
+ mainResults = resultsUsersAssociated;
+ }
+ else
+ {
+ mainResults = mergeIdentityTypeWithAND(mainResults, resultsUsersAssociated);
+ }
+ }
+
+ if (q.usersConnectedByRole.size() > 0)
+ {
+ if (first)
+ {
+ first = false;
+ mainResults = resultsUsersConnectedByRole;
+ }
+ else
+ {
+ mainResults = mergeIdentityTypeWithAND(mainResults, resultsUsersConnectedByRole);
+ }
+ }
+
+ if (q.usersRelated.size() > 0)
+ {
+ if (first)
+ {
+ first = false;
+ mainResults = resultsUsersRelated;
+ }
+ else
+ {
+ mainResults = mergeIdentityTypeWithAND(mainResults, resultsUsersRelated);
+ }
+ }
+
+ applyCriteria(q.searchCriteria, mainResults);
+ }
+ catch (Exception e)
+ {
+ throw new QueryException("Failed to execute query", e);
+ }
+
+ return mainResults;
+ }
+
+ public Group uniqueResult(GroupQueryImpl groupQuery) throws QueryException
+ {
+ Collection<Group> results = execute(groupQuery);
+
+ if (results.size() > 1)
+ {
+ throw new QueryException("More than one result returned");
+ }
+ else if (results.size() == 1)
+ {
+ return results.iterator().next();
+ }
+
+ return null;
+ }
+
+ public List<Group> list(GroupQueryImpl groupQuery) throws QueryException
+ {
+ Collection<Group> results = execute(groupQuery);
+
+ if (results instanceof List)
+ {
+ return (List<Group>)results;
+ }
+
+ //TODO:
+ throw new NotYetImplementedException();
+ }
+
+
+}
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryImpl.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryImpl.java 2009-05-07 19:45:12 UTC (rev 479)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryImpl.java 2009-05-08 20:46:17 UTC (rev 480)
@@ -34,6 +34,7 @@
import org.jboss.identity.idm.impl.api.model.GroupId;
import org.jboss.identity.idm.impl.api.model.SimpleGroup;
import org.jboss.identity.idm.impl.api.model.SimpleUser;
+import org.jboss.identity.idm.impl.api.IdentitySearchCriteriaImpl;
import org.jboss.identity.idm.exception.IdentityException;
import java.util.Collection;
@@ -41,6 +42,7 @@
import java.util.Set;
import java.util.HashSet;
import java.util.LinkedList;
+import java.util.Collections;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -48,438 +50,141 @@
*/
public class GroupQueryImpl extends AbstractQuery implements GroupQuery
{
- private GroupId groupId;
+ public final GroupId groupId;
- private String groupName;
+ public final String groupName;
- private String groupType;
+ public final String groupType;
- private Set<Group> associatedParentGroups = new HashSet<Group>();
+ public final Set<Group> associatedParentGroups;
- private Set<Group> associatedChildGroups = new HashSet<Group>();
+ public final Set<Group> associatedChildGroups;
- private Set<User> usersAssociated = new HashSet<User>();
+ public final Set<User> usersAssociated;
- private Set<User> usersRelated = new HashSet<User>();
+ public final Set<User> usersRelated;
- private Set<User> usersConnectedByRole = new HashSet<User>();
+ public final Set<User> usersConnectedByRole;
- public GroupQueryImpl(IdentitySessionImpl identitySession)
+ public GroupQueryImpl(IdentitySearchCriteriaImpl searchCriteria, GroupId groupId, String groupName, String groupType, Set<Group> associatedParentGroups, Set<Group> associatedChildGroups, Set<User> usersAssociated, Set<User> usersRelated, Set<User> usersConnectedByRole)
{
- super(identitySession);
- }
+ super(searchCriteria);
+ this.groupId = groupId;
+ this.groupName = groupName;
+ this.groupType = groupType;
- public Collection<Group> execute() throws QueryException
- {
- prepare();
-
- List<Group> mainResults = new LinkedList<Group>();
-
- try
+ if (associatedParentGroups != null)
{
- Group uniqueResult = null;
-
- List<Group> resultsAssociatedParentGroups = new LinkedList<Group>();
- List<Group> resultsAssociatedChildGroups = new LinkedList<Group>();
- List<Group> resultsUsersAssociated = new LinkedList<Group>();
- List<Group> resultsUsersRelated = new LinkedList<Group>();
- List<Group> resultsUsersConnectedByRole = new LinkedList<Group>();
-
- if (groupId != null)
- {
- uniqueResult = identitySession.getPersistenceManager().findGroup(groupId.getName(), groupId.getType());
- }
-
- // Process each condition
-
- if (associatedParentGroups.size() > 0)
- {
- for (Group group : associatedParentGroups)
- {
- resultsAssociatedParentGroups.addAll(identitySession.getRelationshipManager().findAssociatedGroups(
- group, groupType, true, false, searchCriteria));
- }
- }
-
- if (associatedChildGroups.size() > 0)
- {
- for (Group group : associatedChildGroups)
- {
- resultsAssociatedChildGroups.addAll(identitySession.getRelationshipManager().findAssociatedGroups(
- group, groupType, false, false, searchCriteria));
- }
- }
-
-
- if (usersAssociated.size() > 0)
- {
- for (User user : usersAssociated)
- {
- resultsUsersAssociated.addAll(identitySession.getRelationshipManager().findAssociatedGroups(
- user, groupType, searchCriteria));
- }
- }
-
- if (usersRelated.size() > 0)
- {
- for (User user : usersRelated)
- {
- resultsUsersRelated.addAll(identitySession.getRelationshipManager().findRelatedGroups(user, groupType, searchCriteria));
- }
- }
-
- if (usersConnectedByRole.size() > 0)
- {
- for (User user : usersConnectedByRole)
- {
- resultsUsersConnectedByRole.addAll(identitySession.getRoleManager().findGroupsWithRelatedRole(user, groupType, searchCriteria));
- }
- }
-
- // If only one search was performed then return it as search criteria are applied correctly
-
- if (uniqueResult == null &&
- resultsAssociatedChildGroups.size() == 0 &&
- resultsAssociatedParentGroups.size() == 0 &&
- resultsUsersAssociated.size() == 0 &&
- resultsUsersConnectedByRole.size() == 0 &&
- resultsUsersRelated.size() == 0)
- {
- return mainResults;
-
- }
- else if (uniqueResult != null &&
- resultsAssociatedChildGroups.size() == 0 &&
- resultsAssociatedParentGroups.size() == 0 &&
- resultsUsersAssociated.size() == 0 &&
- resultsUsersConnectedByRole.size() == 0 &&
- resultsUsersRelated.size() == 0)
- {
-
- mainResults.add(uniqueResult);
- //TODO: apply constraints...
- return mainResults;
- }
- else if (uniqueResult == null &&
- resultsAssociatedChildGroups.size() != 0 &&
- resultsAssociatedParentGroups.size() == 0 &&
- resultsUsersAssociated.size() == 0 &&
- resultsUsersConnectedByRole.size() == 0 &&
- resultsUsersRelated.size() == 0)
- {
- return resultsAssociatedChildGroups;
-
- }
- else if (uniqueResult == null &&
- resultsAssociatedChildGroups.size() == 0 &&
- resultsAssociatedParentGroups.size() != 0 &&
- resultsUsersAssociated.size() == 0 &&
- resultsUsersConnectedByRole.size() == 0 &&
- resultsUsersRelated.size() == 0)
- {
- return resultsAssociatedParentGroups;
- }
- else if (uniqueResult == null &&
- resultsAssociatedChildGroups.size() == 0 &&
- resultsAssociatedParentGroups.size() == 0 &&
- resultsUsersAssociated.size() != 0 &&
- resultsUsersConnectedByRole.size() == 0 &&
- resultsUsersRelated.size() == 0)
- {
- return resultsUsersAssociated;
- }
- else if (uniqueResult == null &&
- resultsAssociatedChildGroups.size() == 0 &&
- resultsAssociatedParentGroups.size() == 0 &&
- resultsUsersAssociated.size() == 0 &&
- resultsUsersConnectedByRole.size() != 0 &&
- resultsUsersRelated.size() == 0)
- {
- return resultsUsersConnectedByRole;
- }
- else if (uniqueResult == null &&
- resultsAssociatedChildGroups.size() == 0 &&
- resultsAssociatedParentGroups.size() == 0 &&
- resultsUsersAssociated.size() == 0 &&
- resultsUsersConnectedByRole.size() == 0 &&
- resultsUsersRelated.size() != 0)
- {
- return resultsUsersRelated;
- }
-
- // Merge with logical AND
-
- if (uniqueResult != null)
- {
- mainResults.add(uniqueResult);
- }
-
- if (resultsAssociatedChildGroups.size() > 0)
- {
- mainResults = mergeGroupsWithAND(mainResults, resultsAssociatedChildGroups);
- }
-
- if (resultsAssociatedParentGroups.size() > 0)
- {
- mainResults = mergeGroupsWithAND(mainResults, resultsAssociatedParentGroups);
- }
-
- if (resultsUsersAssociated.size() > 0)
- {
- mainResults = mergeGroupsWithAND(mainResults, resultsUsersAssociated);
- }
-
- if (resultsUsersConnectedByRole.size() > 0)
- {
- mainResults = mergeGroupsWithAND(mainResults, resultsUsersConnectedByRole);
- }
-
- if (resultsUsersRelated.size() > 0);
- {
- mainResults = mergeGroupsWithAND(mainResults, resultsUsersRelated);
- }
-
- mainResults = applyCriteriaGroups(mainResults);
+ this.associatedParentGroups = Collections.unmodifiableSet(associatedParentGroups);
}
- catch (Exception e)
+ else
{
- throw new QueryException("Failed to execute query", e);
+ this.associatedParentGroups = Collections.emptySet();
}
-
-
- return mainResults;
- }
-
- private void prepare()
- {
- if (groupId == null && (groupName != null && groupType != null))
+ if (associatedChildGroups != null)
{
- groupId = new GroupId(groupName, groupType);
+ this.associatedChildGroups = Collections.unmodifiableSet(associatedChildGroups);
}
-
- }
-
- public Group uniqueResult() throws QueryException
- {
- Collection<Group> results = execute();
-
- if (results.size() > 1)
+ else
{
- throw new QueryException("More than one result returned");
+ this.associatedChildGroups = Collections.emptySet();
}
- else if (results.size() == 1)
+
+ if (usersAssociated != null)
{
- return results.iterator().next();
+ this.usersAssociated = Collections.unmodifiableSet(usersAssociated);
}
-
- return null;
- }
-
- public List<Group> list() throws QueryException
- {
- Collection<Group> results = execute();
-
- if (results instanceof List)
+ else
{
- return (List<Group>)results;
+ this.usersAssociated = Collections.emptySet();
}
- //TODO:
- throw new NotYetImplementedException();
- }
-
- public GroupQuery setId(String id)
- {
- groupId = new GroupId(id);
- return this;
- }
-
- public GroupQuery setNameAndType(String name, String type)
- {
- groupId = new GroupId(name, type);
- groupName = name;
- groupType = type;
-
- return this;
- }
-
- public GroupQuery setName(String name)
- {
- checkNotNullArgument(name, "Group name");
- groupName = name;
- return this;
- }
-
- public GroupQuery setType(String type)
- {
- checkNotNullArgument(type, "Group type");
- groupType = type;
- return this;
- }
-
- public GroupQuery addAssociatedGroup(Group group, boolean parent)
- {
- checkNotNullArgument(group, "Group");
- if (parent)
+ if (usersRelated != null)
{
- associatedParentGroups.add(group);
+ this.usersRelated = Collections.unmodifiableSet(usersRelated);
}
else
{
- associatedChildGroups.add(group);
+ this.usersRelated = Collections.emptySet();
}
- return this;
- }
- public GroupQuery addAssociatedGroup(String id, boolean parent)
- {
- checkNotNullArgument(id, "Group id");
-
- Group group = new SimpleGroup(new GroupId(id));
-
- if (parent)
+ if (usersConnectedByRole != null)
{
- associatedParentGroups.add(group);
+ this.usersConnectedByRole = Collections.unmodifiableSet(usersConnectedByRole);
}
else
{
- associatedChildGroups.add(group);
+ this.usersConnectedByRole = Collections.emptySet();
}
-
-
- return this;
}
- public GroupQuery addAssociatedGroups(Collection<Group> groups, boolean parent)
+ @Override
+ public boolean equals(Object o)
{
- checkNotNullArgument(groups, "Groups");
-
- if (parent)
+ if (this == o)
{
- associatedParentGroups.addAll(groups);
+ return true;
}
- else
+ if (!(o instanceof GroupQueryImpl))
{
- associatedChildGroups.addAll(groups);
+ return false;
}
-
- return this;
- }
-
- public GroupQuery addAssociatedGroupsIds(Collection<String> ids, boolean parent)
- {
- checkNotNullArgument(ids, "Groups ids");
- for (String groupId : ids)
+ if (!super.equals(o))
{
- Group group = new SimpleGroup(new GroupId(groupId));
-
- if (parent)
- {
- associatedParentGroups.add(group);
- }
- else
- {
- associatedChildGroups.add(group);
- }
+ return false;
}
- return this;
- }
+ GroupQueryImpl that = (GroupQueryImpl)o;
- public GroupQuery addAssociatedUser(User user)
- {
- checkNotNullArgument(user, "User");
- usersAssociated.add(user);
- return this;
- }
-
- public GroupQuery addAssociatedUser(String id)
- {
- checkNotNullArgument(id, "User id");
- usersAssociated.add(new SimpleUser(id));
- return this;
- }
-
- public GroupQuery addAssociatedUsers(Collection<User> users)
- {
- checkNotNullArgument(users, "Users");
- usersAssociated.addAll(users);
- return this;
- }
-
- public GroupQuery addAssociatedUsersIds(Collection<String> ids)
- {
- checkNotNullArgument(ids, "Users ids");
- for (String id : ids)
+ if (!associatedChildGroups.equals(that.associatedChildGroups))
{
- usersAssociated.add(new SimpleUser(id));
+ return false;
}
- return this;
- }
-
- public GroupQuery addUserConnectedByRole(User user)
- {
- checkNotNullArgument(user, "User");
- usersConnectedByRole.add(user);
- return this;
- }
-
- public GroupQuery addUserConnectedByRole(String id)
- {
- checkNotNullArgument(id, "User id");
- usersConnectedByRole.add(new SimpleUser(id));
- return this;
- }
-
- public GroupQuery addUsersConnectedByRole(Collection<User> users)
- {
- checkNotNullArgument(users, "Users");
- usersConnectedByRole.addAll(users);
- return this;
- }
-
- public GroupQuery addUsersIdsConnectedByRole(Collection<String> ids)
- {
- checkNotNullArgument(ids, "Users ids");
- for (String id : ids)
+ if (!associatedParentGroups.equals(that.associatedParentGroups))
{
- usersConnectedByRole.add(new SimpleUser(id));
+ return false;
}
- return this;
- }
+ if (groupId != null ? !groupId.equals(that.groupId) : that.groupId != null)
+ {
+ return false;
+ }
+ if (groupName != null ? !groupName.equals(that.groupName) : that.groupName != null)
+ {
+ return false;
+ }
+ if (groupType != null ? !groupType.equals(that.groupType) : that.groupType != null)
+ {
+ return false;
+ }
+ if (!usersAssociated.equals(that.usersAssociated))
+ {
+ return false;
+ }
+ if (!usersConnectedByRole.equals(that.usersConnectedByRole))
+ {
+ return false;
+ }
+ if (!usersRelated.equals(that.usersRelated))
+ {
+ return false;
+ }
- public GroupQuery addRelatedUser(User user)
- {
- checkNotNullArgument(user, "User");
- usersRelated.add(user);
- return this;
+ return true;
}
- public GroupQuery addRelatedUser(String id)
+ @Override
+ public int hashCode()
{
- checkNotNullArgument(id, "User id");
- usersRelated.add(new SimpleUser(id));
- return this;
+ int result = super.hashCode();
+ result = 31 * result + (groupId != null ? groupId.hashCode() : 0);
+ result = 31 * result + (groupName != null ? groupName.hashCode() : 0);
+ result = 31 * result + (groupType != null ? groupType.hashCode() : 0);
+ result = 31 * result + associatedParentGroups.hashCode();
+ result = 31 * result + associatedChildGroups.hashCode();
+ result = 31 * result + usersAssociated.hashCode();
+ result = 31 * result + usersRelated.hashCode();
+ result = 31 * result + usersConnectedByRole.hashCode();
+ return result;
}
-
- public GroupQuery sort(SortOrder order) throws UnsupportedQueryCriterium
- {
- return (GroupQuery)super.sort(order);
- }
-
- public GroupQuery sortAttributeName(String name) throws UnsupportedQueryCriterium
- {
- return (GroupQuery)super.sortAttributeName(name);
- }
-
- public GroupQuery page(int firstResult, int maxResults) throws UnsupportedQueryCriterium
- {
- return (GroupQuery)super.page(firstResult, maxResults);
- }
-
- public GroupQuery attributeValuesFilter(String attributeName, String[] attributeValue) throws UnsupportedQueryCriterium
- {
- return (GroupQuery)super.attributeValuesFilter(attributeName, attributeValue);
- }
}
Added: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/RoleQueryBuilderImpl.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/RoleQueryBuilderImpl.java (rev 0)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/RoleQueryBuilderImpl.java 2009-05-08 20:46:17 UTC (rev 480)
@@ -0,0 +1,155 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.api.query;
+
+import org.jboss.identity.idm.api.query.RoleQueryBuilder;
+import org.jboss.identity.idm.api.query.RoleQuery;
+import org.jboss.identity.idm.api.query.UnsupportedQueryCriterium;
+import org.jboss.identity.idm.api.User;
+import org.jboss.identity.idm.api.Group;
+import org.jboss.identity.idm.api.RoleType;
+import org.jboss.identity.idm.api.IdentityType;
+import org.jboss.identity.idm.api.SortOrder;
+import org.jboss.identity.idm.impl.api.model.SimpleUser;
+import org.jboss.identity.idm.impl.api.model.SimpleGroup;
+import org.jboss.identity.idm.impl.api.model.GroupId;
+import org.jboss.identity.idm.impl.api.model.SimpleRoleType;
+import org.jboss.identity.idm.impl.api.IdentitySearchCriteriaImpl;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class RoleQueryBuilderImpl extends AbstractQueryBuilder implements RoleQueryBuilder
+{
+
+ private User user;
+
+ private Group group;
+
+ private RoleType roleType;
+
+ public RoleQuery createQuery()
+ {
+ return new RoleQueryImpl(
+ searchCriteria,
+ user,
+ group,
+ roleType
+ );
+ }
+
+ public RoleQueryBuilder reset()
+ {
+ searchCriteria = new IdentitySearchCriteriaImpl();
+ user = null;
+ group = null;
+ roleType = null;
+
+ return this;
+ }
+
+ public RoleQueryBuilder setUser(User user)
+ {
+ checkNotNullArgument(user, "User");
+ this.user = user;
+ return this;
+ }
+
+ public RoleQueryBuilder setUser(String id)
+ {
+ checkNotNullArgument(id, "User id");
+ this.user = new SimpleUser(id);
+ return this;
+ }
+
+ public RoleQueryBuilder setGroup(Group group)
+ {
+ checkNotNullArgument(group, "Group");
+ this.group = group;
+ return this;
+ }
+
+ public RoleQueryBuilder setGroup(String id)
+ {
+ checkNotNullArgument(id, "Group id");
+ this.group = new SimpleGroup(new GroupId(id));
+ return this;
+ }
+
+ public RoleQueryBuilder setRoleType(RoleType roleType)
+ {
+ checkNotNullArgument(roleType, "RoleType");
+ this.roleType = roleType;
+ return this;
+ }
+
+ public RoleQueryBuilder setRoleType(String roleTypeName)
+ {
+ checkNotNullArgument(roleTypeName, "RoleType name");
+ this.roleType = new SimpleRoleType(roleTypeName);
+ return this;
+ }
+
+ public RoleQueryBuilder setIdentityType(IdentityType identityType)
+ {
+ checkNotNullArgument(identityType, "IdentityType");
+ if (identityType instanceof User)
+ {
+ this.user = (User)identityType;
+ }
+ else
+ {
+ this.group = (Group)identityType;
+ }
+ return this;
+ }
+
+ public RoleQueryBuilder setIdentityTypeId(String id)
+ {
+ checkNotNullArgument(id, "IdentityType id");
+ IdentityType identityType = createIdentityTypeFromId(id);
+ return setIdentityType(identityType);
+ }
+
+ public RoleQueryBuilder sort(SortOrder order) throws UnsupportedQueryCriterium
+ {
+ return (RoleQueryBuilder)super.sort(order);
+ }
+
+ public RoleQueryBuilder sortAttributeName(String name) throws UnsupportedQueryCriterium
+ {
+ return (RoleQueryBuilder)super.sortAttributeName(name);
+ }
+
+ public RoleQueryBuilder page(int firstResult, int maxResults) throws UnsupportedQueryCriterium
+ {
+ return (RoleQueryBuilder)super.page(firstResult, maxResults);
+ }
+
+ public RoleQueryBuilder attributeValuesFilter(String attributeName, String[] attributeValue) throws UnsupportedQueryCriterium
+ {
+ return (RoleQueryBuilder)super.attributeValuesFilter(attributeName, attributeValue);
+ }
+
+}
Added: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/RoleQueryExecutorImpl.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/RoleQueryExecutorImpl.java (rev 0)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/RoleQueryExecutorImpl.java 2009-05-08 20:46:17 UTC (rev 480)
@@ -0,0 +1,159 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.api.query;
+
+import org.jboss.identity.idm.api.IdentitySession;
+import org.jboss.identity.idm.api.Role;
+import org.jboss.identity.idm.api.RoleType;
+import org.jboss.identity.idm.api.query.QueryException;
+import org.jboss.identity.idm.impl.api.model.SimpleRole;
+import org.jboss.identity.idm.impl.NotYetImplementedException;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.LinkedList;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class RoleQueryExecutorImpl extends AbstractQueryExecutor
+{
+ public RoleQueryExecutorImpl(IdentitySession identitySession)
+ {
+ super(identitySession);
+ }
+
+ public Collection<Role> execute(RoleQueryImpl roleQuery) throws QueryException
+ {
+ List<Role> mainResults = new LinkedList<Role>();
+
+
+ try
+ {
+ // Check all constraints combinations
+
+ if (roleQuery.user == null &&
+ roleQuery.group == null &&
+ roleQuery.roleType == null)
+ {
+ // TODO: return all roles
+
+ return mainResults;
+ }
+ else if (roleQuery.user != null &&
+ roleQuery.group != null &&
+ roleQuery.roleType != null)
+ {
+ Role role = identitySession.getRoleManager().getRole(roleQuery.roleType, roleQuery.user, roleQuery.group);
+ if (role != null)
+ {
+ mainResults.add(role);
+ }
+ return mainResults;
+
+ }
+ else if (roleQuery.user != null &&
+ roleQuery.group == null &&
+ roleQuery.roleType == null)
+ {
+ return identitySession.getRoleManager().findRoles(roleQuery.user, null);
+ }
+ else if (roleQuery.user != null &&
+ roleQuery.group == null &&
+ roleQuery.roleType != null)
+ {
+ return identitySession.getRoleManager().findRoles(roleQuery.user, roleQuery.roleType);
+ }
+ else if (roleQuery.user == null &&
+ roleQuery.group != null &&
+ roleQuery.roleType == null)
+ {
+ return identitySession.getRoleManager().findRoles(roleQuery.group, null);
+ }
+ else if (roleQuery.user == null &&
+ roleQuery.group != null &&
+ roleQuery.roleType != null)
+ {
+ return identitySession.getRoleManager().findRoles(roleQuery.group, roleQuery.roleType);
+ }
+ else if (roleQuery.user == null &&
+ roleQuery.group == null &&
+ roleQuery.roleType != null)
+ {
+ //TODO: reconsider if this should be supported
+ throw new QueryException("Not enought information to perform a query. Cannot query roles only with a given RoleType");
+ }
+ else if (roleQuery.user != null &&
+ roleQuery.group != null &&
+ roleQuery.roleType == null)
+ {
+ Collection<RoleType> roleTypes = identitySession.getRoleManager().
+ findRoleTypes(roleQuery.user, roleQuery.group, roleQuery.searchCriteria);
+ for (RoleType type : roleTypes)
+ {
+ mainResults.add(new SimpleRole(type, roleQuery.user, roleQuery.group));
+ }
+ return mainResults;
+ }
+ }
+ catch (Exception e)
+ {
+ throw new QueryException("Failed to execute query", e);
+ }
+
+ mainResults = applyCriteriaRoles(roleQuery.searchCriteria, mainResults);
+
+ return mainResults;
+
+ }
+
+ public Role uniqueResult(RoleQueryImpl roleQuery) throws QueryException
+ {
+ Collection<Role> results = execute(roleQuery);
+
+ if (results.size() > 1)
+ {
+ throw new QueryException("More than one result returned");
+ }
+ else if (results.size() == 1)
+ {
+ return results.iterator().next();
+ }
+
+ return null;
+ }
+
+ public List<Role> list(RoleQueryImpl roleQuery) throws QueryException
+ {
+ Collection<Role> results = execute(roleQuery);
+
+ if (results instanceof List)
+ {
+ return (List<Role>)results;
+ }
+
+ //TODO:
+ throw new NotYetImplementedException();
+ }
+}
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/RoleQueryImpl.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/RoleQueryImpl.java 2009-05-07 19:45:12 UTC (rev 479)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/RoleQueryImpl.java 2009-05-08 20:46:17 UTC (rev 480)
@@ -38,6 +38,7 @@
import org.jboss.identity.idm.impl.api.model.SimpleGroup;
import org.jboss.identity.idm.impl.api.model.SimpleRoleType;
import org.jboss.identity.idm.impl.api.model.SimpleRole;
+import org.jboss.identity.idm.impl.api.IdentitySearchCriteriaImpl;
import org.jboss.identity.idm.impl.NotYetImplementedException;
import org.jboss.identity.idm.exception.IdentityException;
import org.jboss.identity.idm.exception.FeatureNotSupportedException;
@@ -53,207 +54,61 @@
public class RoleQueryImpl extends AbstractQuery implements RoleQuery
{
- private User user;
+ public final User user;
- private Group group;
+ public final Group group;
- private RoleType roleType;
+ public final RoleType roleType;
- public RoleQueryImpl(IdentitySessionImpl identitySession)
+ public RoleQueryImpl(IdentitySearchCriteriaImpl searchCriteria, User user, Group group, RoleType roleType)
{
- super(identitySession);
+ super(searchCriteria);
+ this.user = user;
+ this.group = group;
+ this.roleType = roleType;
}
- public Collection<Role> execute() throws QueryException
+ @Override
+ public boolean equals(Object o)
{
- List<Role> mainResults = new LinkedList<Role>();
-
-
- try
+ if (this == o)
{
- // Check all constraints combinations
-
- if (user == null &&
- group == null &&
- roleType == null)
- {
- return mainResults;
- }
- else if (user != null &&
- group != null &&
- roleType != null)
- {
- Role role = identitySession.getRoleManager().getRole(roleType, user, group);
- if (role != null)
- {
- mainResults.add(role);
- }
- return mainResults;
-
- }
- else if (user != null &&
- group == null &&
- roleType == null)
- {
- return identitySession.getRoleManager().findRoles(user, null);
- }
- else if (user != null &&
- group == null &&
- roleType != null)
- {
- return identitySession.getRoleManager().findRoles(user, roleType);
- }
- else if (user == null &&
- group != null &&
- roleType == null)
- {
- return identitySession.getRoleManager().findRoles(group, null);
- }
- else if (user == null &&
- group != null &&
- roleType != null)
- {
- return identitySession.getRoleManager().findRoles(group, roleType);
- }
- else if (user == null &&
- group == null &&
- roleType != null)
- {
- //TODO: reconsider if this should be supported
- throw new QueryException("Not enought information to perform a query. Cannot query roles only with a given RoleType");
- }
- else if (user != null &&
- group != null &&
- roleType == null)
- {
- Collection<RoleType> roleTypes = identitySession.getRoleManager().findRoleTypes(user, group, searchCriteria);
- for (RoleType type : roleTypes)
- {
- mainResults.add(new SimpleRole(type, user, group));
- }
- return mainResults;
- }
+ return true;
}
- catch (Exception e)
+ if (!(o instanceof RoleQueryImpl))
{
- throw new QueryException("Failed to execute query", e);
+ return false;
}
-
- mainResults = applyCriteriaRoles(mainResults);
-
- return mainResults;
-
- }
-
- public Role uniqueResult() throws QueryException
- {
- Collection<Role> results = execute();
-
- if (results.size() > 1)
+ if (!super.equals(o))
{
- throw new QueryException("More than one result returned");
+ return false;
}
- else if (results.size() == 1)
- {
- return results.iterator().next();
- }
- return null;
- }
+ RoleQueryImpl roleQuery = (RoleQueryImpl)o;
- public List<Role> list() throws QueryException
- {
- Collection<Role> results = execute();
-
- if (results instanceof List)
+ if (group != null ? !group.equals(roleQuery.group) : roleQuery.group != null)
{
- return (List<Role>)results;
+ return false;
}
-
- //TODO:
- throw new NotYetImplementedException();
- }
-
- public RoleQuery setUser(User user)
- {
- checkNotNullArgument(user, "User");
- this.user = user;
- return this;
- }
-
- public RoleQuery setUser(String id)
- {
- checkNotNullArgument(id, "User id");
- this.user = new SimpleUser(id);
- return this;
- }
-
- public RoleQuery setGroup(Group group)
- {
- checkNotNullArgument(group, "Group");
- this.group = group;
- return this;
- }
-
- public RoleQuery setGroup(String id)
- {
- checkNotNullArgument(id, "Group id");
- this.group = new SimpleGroup(new GroupId(id));
- return this;
- }
-
- public RoleQuery setRoleType(RoleType roleType)
- {
- checkNotNullArgument(roleType, "RoleType");
- this.roleType = roleType;
- return this;
- }
-
- public RoleQuery setRoleType(String roleTypeName)
- {
- checkNotNullArgument(roleTypeName, "RoleType name");
- this.roleType = new SimpleRoleType(roleTypeName);
- return this;
- }
-
- public RoleQuery setIdentityType(IdentityType identityType)
- {
- checkNotNullArgument(identityType, "IdentityType");
- if (identityType instanceof User)
+ if (roleType != null ? !roleType.equals(roleQuery.roleType) : roleQuery.roleType != null)
{
- this.user = (User)identityType;
+ return false;
}
- else
+ if (user != null ? !user.equals(roleQuery.user) : roleQuery.user != null)
{
- this.group = (Group)identityType;
+ return false;
}
- return this;
- }
- public RoleQuery setIdentityTypeId(String id)
- {
- checkNotNullArgument(id, "IdentityType id");
- IdentityType identityType = createIdentityTypeFromId(id);
- return setIdentityType(identityType);
+ return true;
}
- public RoleQuery sort(SortOrder order) throws UnsupportedQueryCriterium
+ @Override
+ public int hashCode()
{
- return (RoleQuery)super.sort(order);
+ int result = super.hashCode();
+ result = 31 * result + (user != null ? user.hashCode() : 0);
+ result = 31 * result + (group != null ? group.hashCode() : 0);
+ result = 31 * result + (roleType != null ? roleType.hashCode() : 0);
+ return result;
}
-
- public RoleQuery sortAttributeName(String name) throws UnsupportedQueryCriterium
- {
- return (RoleQuery)super.sortAttributeName(name);
- }
-
- public RoleQuery page(int firstResult, int maxResults) throws UnsupportedQueryCriterium
- {
- return (RoleQuery)super.page(firstResult, maxResults);
- }
-
- public RoleQuery attributeValuesFilter(String attributeName, String[] attributeValue) throws UnsupportedQueryCriterium
- {
- return (RoleQuery)super.attributeValuesFilter(attributeName, attributeValue);
- }
}
Added: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryBuilderImpl.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryBuilderImpl.java (rev 0)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryBuilderImpl.java 2009-05-08 20:46:17 UTC (rev 480)
@@ -0,0 +1,191 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.api.query;
+
+import org.jboss.identity.idm.api.query.UserQueryBuilder;
+import org.jboss.identity.idm.api.query.UserQuery;
+import org.jboss.identity.idm.api.query.UnsupportedQueryCriterium;
+import org.jboss.identity.idm.api.Group;
+import org.jboss.identity.idm.api.SortOrder;
+import org.jboss.identity.idm.impl.api.IdentitySearchCriteriaImpl;
+
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class UserQueryBuilderImpl extends AbstractQueryBuilder implements UserQueryBuilder
+{
+ private String userId;
+
+ private Set<Group> groupsAssociatedWith = new HashSet<Group>();
+
+ private Set<Group> groupsConnectedWithRole = new HashSet<Group>();
+
+ private Set<Group> groupsRelated = new HashSet<Group>();
+
+ public UserQuery createQuery()
+ {
+ return new UserQueryImpl(
+ searchCriteria,
+ userId,
+ groupsAssociatedWith,
+ groupsConnectedWithRole,
+ groupsRelated
+ );
+ }
+
+ public UserQueryBuilder reset()
+ {
+ searchCriteria = new IdentitySearchCriteriaImpl();
+ userId = null;
+ groupsAssociatedWith = new HashSet<Group>();
+ groupsConnectedWithRole = new HashSet<Group>();
+ groupsRelated = new HashSet<Group>();
+
+ return this;
+ }
+
+ public UserQueryBuilder withUserId(String id)
+ {
+ checkNotNullArgument(id, "User id");
+ userId = id;
+ return this;
+ }
+
+ public UserQueryBuilder addAssociatedGroup(Group group)
+ {
+ checkNotNullArgument(group, "Group");
+ groupsAssociatedWith.add(group);
+ return this;
+ }
+
+ public UserQueryBuilder addAssociatedGroup(String id)
+ {
+ checkNotNullArgument(id, "Group id");
+ groupsAssociatedWith.add(createGroupFromId(id));
+ return this;
+ }
+
+ public UserQueryBuilder addAssociatedGroups(Collection<Group> groups)
+ {
+ checkNotNullArgument(groups, "Groups");
+ groupsAssociatedWith.addAll(groups);
+ return this;
+ }
+
+ public UserQueryBuilder addAssociatedGroupsIds(Collection<String> groups)
+ {
+ checkNotNullArgument(groups, "Groups");
+ for (String groupId : groups)
+ {
+ groupsAssociatedWith.add(createGroupFromId(groupId));
+ }
+ return this;
+ }
+
+ public UserQueryBuilder addGroupConnectedWithRole(Group group)
+ {
+ checkNotNullArgument(group, "Group");
+ groupsConnectedWithRole.add(group);
+ return this;
+ }
+
+ public UserQueryBuilder addGroupConnectedWithRole(String id)
+ {
+ checkNotNullArgument(id, "Group id");
+ groupsConnectedWithRole.add(createGroupFromId(id));
+ return this;
+ }
+
+ public UserQueryBuilder addGroupsConnectedWithRole(Collection<Group> groups)
+ {
+ checkNotNullArgument(groups, "Groups");
+ groupsConnectedWithRole.addAll(groups);
+ return this;
+ }
+
+ public UserQueryBuilder addGroupsIdsConnectedWithRole(Collection<String> groups)
+ {
+ checkNotNullArgument(groups, "Groups");
+ for (String groupId : groups)
+ {
+ groupsConnectedWithRole.add(createGroupFromId(groupId));
+ }
+ return this;
+ }
+
+ public UserQueryBuilder addRelatedGroup(Group group)
+ {
+ checkNotNullArgument(group, "Group");
+ groupsRelated.add(group);
+ return this;
+ }
+
+ public UserQueryBuilder addRelatedGroup(String id)
+ {
+ checkNotNullArgument(id, "Group id");
+ groupsRelated.add(createGroupFromId(id));
+ return this;
+ }
+
+ public UserQueryBuilder addRelatedGroups(Collection<Group> group)
+ {
+ checkNotNullArgument(group, "Group");
+ groupsRelated.addAll(group);
+ return this;
+ }
+
+ public UserQueryBuilder addRelatedGroupsIds(Collection<String> ids)
+ {
+ checkNotNullArgument(ids, "Groups ids");
+ for (String id : ids)
+ {
+ groupsRelated.add(createGroupFromId(id));
+ }
+ return this;
+ }
+
+ public UserQueryBuilder sort(SortOrder order) throws UnsupportedQueryCriterium
+ {
+ return (UserQueryBuilder)super.sort(order);
+ }
+
+ public UserQueryBuilder sortAttributeName(String name) throws UnsupportedQueryCriterium
+ {
+ return (UserQueryBuilder)super.sortAttributeName(name);
+ }
+
+ public UserQueryBuilder page(int firstResult, int maxResults) throws UnsupportedQueryCriterium
+ {
+ return (UserQueryBuilder)super.page(firstResult, maxResults);
+ }
+
+ public UserQueryBuilder attributeValuesFilter(String attributeName, String[] attributeValue) throws UnsupportedQueryCriterium
+ {
+ return (UserQueryBuilder)super.attributeValuesFilter(attributeName, attributeValue);
+ }
+}
Added: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryExecutorImpl.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryExecutorImpl.java (rev 0)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryExecutorImpl.java 2009-05-08 20:46:17 UTC (rev 480)
@@ -0,0 +1,247 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.api.query;
+
+import org.jboss.identity.idm.api.User;
+import org.jboss.identity.idm.api.Group;
+import org.jboss.identity.idm.api.IdentitySession;
+import org.jboss.identity.idm.api.query.QueryException;
+import org.jboss.identity.idm.impl.NotYetImplementedException;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.LinkedList;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class UserQueryExecutorImpl extends AbstractQueryExecutor
+{
+ public UserQueryExecutorImpl(IdentitySession identitySession)
+ {
+ super(identitySession);
+ }
+
+ public Collection<User> execute(UserQueryImpl q) throws QueryException
+ {
+
+ List<User> resultsMain = new LinkedList<User>();
+
+ try
+ {
+
+ User uniqueUser = null;
+ List<User> resultsAssociatedGroups = new LinkedList<User>();
+ List<User> resultsConnectedWithRoleGroups = new LinkedList<User>();
+ List<User> resultsRelatedGroups = new LinkedList<User>();
+
+ // if no conditions perform full search
+ if (q.userId == null &&
+ q.groupsAssociatedWith.size() == 0 &&
+ q.groupsConnectedWithRole.size() == 0 &&
+ q.groupsRelated.size() == 0)
+ {
+ return identitySession.getPersistenceManager().findUser(q.searchCriteria);
+ }
+
+ // Process each condition separately
+
+ if (q.userId != null)
+ {
+ uniqueUser = identitySession.getPersistenceManager().findUser(q.userId);
+ }
+
+ if (q.groupsAssociatedWith.size() > 0)
+ {
+ for (Group group : q.groupsAssociatedWith)
+ {
+ addAllPreservingDuplicates(resultsAssociatedGroups, identitySession.getRelationshipManager().
+ findAssociatedUsers(group, false, q.searchCriteria));
+ }
+ }
+
+ if (q.groupsConnectedWithRole.size() > 0)
+ {
+ for (Group group : q.groupsConnectedWithRole)
+ {
+ addAllPreservingDuplicates(resultsConnectedWithRoleGroups, identitySession.getRoleManager().
+ findUsersWithRelatedRole(group, q.searchCriteria));
+ }
+ }
+
+ if (q.groupsRelated.size() > 0)
+ {
+ for (Group group : q.groupsRelated)
+ {
+ addAllPreservingDuplicates(resultsRelatedGroups, identitySession.getRelationshipManager().
+ findRelatedUsers(group, q.searchCriteria));
+ }
+ }
+
+ // If only one condition was present just return it
+
+ if (q.userId != null &&
+ uniqueUser != null &&
+ q.groupsAssociatedWith.size() == 0 &&
+ resultsAssociatedGroups.size() == 0 &&
+ q.groupsConnectedWithRole.size() == 0 &&
+ resultsConnectedWithRoleGroups.size() == 0 &&
+ q.groupsRelated.size() == 0 &&
+ resultsRelatedGroups.size() == 0)
+ {
+ resultsMain.add(uniqueUser);
+ resultsMain = applyCriteria(q.searchCriteria, resultsMain);
+ return resultsMain;
+ }
+ else if (q.userId == null &&
+ uniqueUser == null &&
+ q.groupsAssociatedWith.size() > 0 &&
+ resultsAssociatedGroups.size() > 0 &&
+ q.groupsConnectedWithRole.size() == 0 &&
+ resultsConnectedWithRoleGroups.size() == 0 &&
+ q.groupsRelated.size() == 0 &&
+ resultsRelatedGroups.size() == 0)
+ {
+ return resultsAssociatedGroups;
+ }
+ else if (q.userId == null &&
+ uniqueUser == null &&
+ q.groupsAssociatedWith.size() == 0 &&
+ resultsAssociatedGroups.size() == 0 &&
+ q.groupsConnectedWithRole.size() > 0 &&
+ resultsConnectedWithRoleGroups.size() > 0 &&
+ q.groupsRelated.size() == 0 &&
+ resultsRelatedGroups.size() == 0)
+ {
+ return resultsConnectedWithRoleGroups;
+ }
+ else if (q.userId == null &&
+ uniqueUser == null &&
+ q.groupsAssociatedWith.size() == 0 &&
+ resultsAssociatedGroups.size() == 0 &&
+ q.groupsConnectedWithRole.size() == 0 &&
+ resultsConnectedWithRoleGroups.size() == 0 &&
+ q.groupsRelated.size() > 0 &&
+ resultsRelatedGroups.size() > 0)
+ {
+ return resultsRelatedGroups;
+ }
+
+
+ // Merge results with logical AND
+
+ boolean first = true;
+
+ if (q.userId != null && uniqueUser != null)
+ {
+ first = false;
+ resultsMain.add(uniqueUser);
+ }
+
+ if (q.groupsAssociatedWith.size() > 0)
+ {
+ if (first)
+ {
+ resultsMain = resultsAssociatedGroups;
+ first = false;
+
+ }
+ else
+ {
+ resultsMain = mergeIdentityTypeWithAND(resultsMain, resultsAssociatedGroups);
+ }
+ }
+
+ if (q.groupsConnectedWithRole.size() > 0)
+ {
+ if (first)
+ {
+ resultsMain = resultsConnectedWithRoleGroups;
+ first = false;
+
+ }
+ else
+ {
+ resultsMain = mergeIdentityTypeWithAND(resultsMain, resultsConnectedWithRoleGroups);
+ }
+ }
+
+ if (q.groupsRelated.size() > 0)
+ {
+ if (first)
+ {
+ resultsMain = resultsRelatedGroups;
+ first = false;
+ }
+ else
+ {
+ resultsMain = mergeIdentityTypeWithAND(resultsMain, resultsRelatedGroups);
+ }
+ }
+
+ // As results were merged criteria need to be applied separately
+ if (resultsMain.size() > 0)
+ {
+ resultsMain = applyCriteria(q.searchCriteria, resultsMain);
+ }
+
+ }
+ catch (Exception e)
+ {
+ throw new QueryException("Failed to execute query", e);
+ }
+
+ return resultsMain;
+ }
+
+ public User uniqueResult(UserQueryImpl userQuery) throws QueryException
+ {
+
+ Collection<User> results = execute(userQuery);
+
+ if (results.size() > 1)
+ {
+ throw new QueryException("More than one result returned");
+ }
+ else if (results.size() == 1)
+ {
+ return results.iterator().next();
+ }
+
+ return null;
+ }
+
+ public List<User> list(UserQueryImpl userQuery) throws QueryException
+ {
+ Collection<User> results = execute(userQuery);
+
+ if (results instanceof List)
+ {
+ return (List<User>)results;
+ }
+
+ //TODO:
+ throw new NotYetImplementedException();
+ }
+}
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryImpl.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryImpl.java 2009-05-07 19:45:12 UTC (rev 479)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryImpl.java 2009-05-08 20:46:17 UTC (rev 480)
@@ -29,6 +29,7 @@
import org.jboss.identity.idm.api.Group;
import org.jboss.identity.idm.api.SortOrder;
import org.jboss.identity.idm.impl.api.session.IdentitySessionImpl;
+import org.jboss.identity.idm.impl.api.IdentitySearchCriteriaImpl;
import org.jboss.identity.idm.impl.NotYetImplementedException;
import org.jboss.identity.idm.exception.IdentityException;
@@ -37,6 +38,7 @@
import java.util.Set;
import java.util.HashSet;
import java.util.LinkedList;
+import java.util.Collections;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -45,280 +47,93 @@
public class UserQueryImpl extends AbstractQuery implements UserQuery
{
- private String userId;
+ public final String userId;
- private Set<Group> groupsAssociatedWith = new HashSet<Group>();
+ public final Set<Group> groupsAssociatedWith;
- private Set<Group> groupsConnectedWithRole = new HashSet<Group>();
+ public final Set<Group> groupsConnectedWithRole;
- private Set<Group> groupsRelated = new HashSet<Group>();
+ public final Set<Group> groupsRelated;
- public UserQueryImpl(IdentitySessionImpl identitySession)
+ public UserQueryImpl(IdentitySearchCriteriaImpl searchCriteria, String userId, Set<Group> groupsAssociatedWith, Set<Group> groupsConnectedWithRole, Set<Group> groupsRelated)
{
- super(identitySession);
- }
+ super(searchCriteria);
+ this.userId = userId;
- public Collection<User> execute() throws QueryException
- {
-
- List<User> resultsMain = new LinkedList<User>();
-
- try
+ if (groupsAssociatedWith != null)
{
-
- User uniqueUser = null;
- List<User> resultsAssociatedGroups = new LinkedList<User>();
- List<User> resultsConnectedWithRoleGroups = new LinkedList<User>();
- List<User> resultsRelatedGroups = new LinkedList<User>();
-
- // Process each condition separately
-
- if (userId != null)
- {
- uniqueUser = identitySession.getPersistenceManager().findUser(userId);
- }
-
- if (groupsAssociatedWith.size() > 0)
- {
- for (Group group : groupsAssociatedWith)
- {
- resultsAssociatedGroups.addAll(identitySession.getRelationshipManager().findAssociatedUsers(group, false, searchCriteria));
- }
- }
-
- if (groupsConnectedWithRole.size() > 0)
- {
- for (Group group : groupsConnectedWithRole)
- {
- resultsConnectedWithRoleGroups.addAll(identitySession.getRoleManager().findUsersWithRelatedRole(group, searchCriteria));
- }
- }
-
- if (groupsRelated.size() > 0)
- {
- for (Group group : groupsRelated)
- {
- resultsRelatedGroups.addAll(identitySession.getRelationshipManager().findRelatedUsers(group, searchCriteria));
- }
- }
-
- // If only one condition was present just return it
-
- if (uniqueUser != null &&
- resultsAssociatedGroups.size() == 0 &&
- resultsConnectedWithRoleGroups.size() == 0 &&
- resultsRelatedGroups.size() == 0)
- {
- resultsMain.add(uniqueUser);
- //TODO: apply constraints...
- return resultsMain;
- }
- else if (uniqueUser == null &&
- resultsAssociatedGroups.size() > 0 &&
- resultsConnectedWithRoleGroups.size() == 0 &&
- resultsRelatedGroups.size() == 0)
- {
- return resultsAssociatedGroups;
- }
- else if (uniqueUser == null &&
- resultsAssociatedGroups.size() == 0 &&
- resultsConnectedWithRoleGroups.size() > 0 &&
- resultsRelatedGroups.size() == 0)
- {
- return resultsConnectedWithRoleGroups;
- }
- else if (uniqueUser == null &&
- resultsAssociatedGroups.size() == 0 &&
- resultsConnectedWithRoleGroups.size() == 0 &&
- resultsRelatedGroups.size() > 0)
- {
- return resultsRelatedGroups;
- }
-
- // Merge results with logical AND
-
- if (uniqueUser != null)
- {
- resultsMain.add(uniqueUser);
- }
-
- if (resultsAssociatedGroups.size() > 0)
- {
- resultsMain = mergeUsersWithAND(resultsMain, resultsAssociatedGroups);
- }
-
- if (resultsConnectedWithRoleGroups.size() > 0)
- {
- resultsMain = mergeUsersWithAND(resultsMain, resultsConnectedWithRoleGroups);
- }
-
- if (resultsRelatedGroups.size() > 0)
- {
- resultsMain = mergeUsersWithAND(resultsMain, resultsRelatedGroups);
- }
-
- // As results were merged criteria need to be applied separately
- if (resultsMain.size() > 0)
- {
- resultsMain = applyCriteriaUsers(resultsMain);
- }
-
+ this.groupsAssociatedWith = Collections.unmodifiableSet(groupsAssociatedWith);
}
- catch (Exception e)
+ else
{
- throw new QueryException("Failed to execute query", e);
+ this.groupsAssociatedWith = Collections.emptySet();
}
- return resultsMain;
- }
-
- public User uniqueResult() throws QueryException
- {
-
- Collection<User> results = execute();
-
- if (results.size() > 1)
+ if (groupsConnectedWithRole != null)
{
- throw new QueryException("More than one result returned");
+ this.groupsConnectedWithRole = Collections.unmodifiableSet(groupsConnectedWithRole);
}
- else if (results.size() == 1)
+ else
{
- return results.iterator().next();
+ this.groupsConnectedWithRole = Collections.emptySet();
}
- return null;
- }
-
- public List<User> list() throws QueryException
- {
- Collection<User> results = execute();
-
- if (results instanceof List)
+ if (groupsRelated != null)
{
- return (List<User>)results;
+ this.groupsRelated = Collections.unmodifiableSet(groupsRelated);
}
-
- //TODO:
- throw new NotYetImplementedException();
- }
-
- public UserQuery withUserId(String id)
- {
- checkNotNullArgument(id, "User id");
- userId = id;
- return this;
- }
-
- public UserQuery addAssociatedGroup(Group group)
- {
- checkNotNullArgument(group, "Group");
- groupsAssociatedWith.add(group);
- return this;
- }
-
- public UserQuery addAssociatedGroup(String id)
- {
- checkNotNullArgument(id, "Group id");
- groupsAssociatedWith.add(createGroupFromId(id));
- return this;
- }
-
- public UserQuery addAssociatedGroups(Collection<Group> groups)
- {
- checkNotNullArgument(groups, "Groups");
- groupsAssociatedWith.addAll(groups);
- return this;
- }
-
- public UserQuery addAssociatedGroupsIds(Collection<String> groups)
- {
- checkNotNullArgument(groups, "Groups");
- for (String groupId : groups)
+ else
{
- groupsAssociatedWith.add(createGroupFromId(groupId));
+ this.groupsRelated = Collections.emptySet();
}
- return this;
}
- public UserQuery addGroupConnectedWithRole(Group group)
+ @Override
+ public boolean equals(Object o)
{
- checkNotNullArgument(group, "Group");
- groupsConnectedWithRole.add(group);
- return this;
- }
-
- public UserQuery addGroupConnectedWithRole(String id)
- {
- checkNotNullArgument(id, "Group id");
- groupsConnectedWithRole.add(createGroupFromId(id));
- return this;
- }
-
- public UserQuery addGroupsConnectedWithRole(Collection<Group> groups)
- {
- checkNotNullArgument(groups, "Groups");
- groupsConnectedWithRole.addAll(groups);
- return this;
- }
-
- public UserQuery addGroupsIdsConnectedWithRole(Collection<String> groups)
- {
- checkNotNullArgument(groups, "Groups");
- for (String groupId : groups)
+ if (this == o)
{
- groupsConnectedWithRole.add(createGroupFromId(groupId));
+ return true;
}
- return this;
- }
+ if (!(o instanceof UserQueryImpl))
+ {
+ return false;
+ }
+ if (!super.equals(o))
+ {
+ return false;
+ }
- public UserQuery addRelatedGroup(Group group)
- {
- checkNotNullArgument(group, "Group");
- groupsRelated.add(group);
- return this;
- }
+ UserQueryImpl userQuery = (UserQueryImpl)o;
- public UserQuery addRelatedGroup(String id)
- {
- checkNotNullArgument(id, "Group id");
- groupsRelated.add(createGroupFromId(id));
- return this;
- }
-
- public UserQuery addRelatedGroups(Collection<Group> group)
- {
- checkNotNullArgument(group, "Group");
- groupsRelated.addAll(group);
- return this;
- }
-
- public UserQuery addRelatedGroupsIds(Collection<String> ids)
- {
- checkNotNullArgument(ids, "Groups ids");
- for (String id : ids)
+ if (!groupsAssociatedWith.equals(userQuery.groupsAssociatedWith))
{
- groupsRelated.add(createGroupFromId(id));
+ return false;
}
- return this;
- }
+ if (!groupsConnectedWithRole.equals(userQuery.groupsConnectedWithRole))
+ {
+ return false;
+ }
+ if (!groupsRelated.equals(userQuery.groupsRelated))
+ {
+ return false;
+ }
+ if (userId != null ? !userId.equals(userQuery.userId) : userQuery.userId != null)
+ {
+ return false;
+ }
- public UserQuery sort(SortOrder order) throws UnsupportedQueryCriterium
- {
- return (UserQuery)super.sort(order);
+ return true;
}
- public UserQuery sortAttributeName(String name) throws UnsupportedQueryCriterium
+ @Override
+ public int hashCode()
{
- return (UserQuery)super.sortAttributeName(name);
+ int result = super.hashCode();
+ result = 31 * result + (userId != null ? userId.hashCode() : 0);
+ result = 31 * result + groupsAssociatedWith.hashCode();
+ result = 31 * result + groupsConnectedWithRole.hashCode();
+ result = 31 * result + groupsRelated.hashCode();
+ return result;
}
-
- public UserQuery page(int firstResult, int maxResults) throws UnsupportedQueryCriterium
- {
- return (UserQuery)super.page(firstResult, maxResults);
- }
-
- public UserQuery attributeValuesFilter(String attributeName, String[] attributeValue) throws UnsupportedQueryCriterium
- {
- return (UserQuery)super.attributeValuesFilter(attributeName, attributeValue);
- }
}
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/IdentitySessionImpl.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/IdentitySessionImpl.java 2009-05-07 19:45:12 UTC (rev 479)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/IdentitySessionImpl.java 2009-05-08 20:46:17 UTC (rev 480)
@@ -23,6 +23,8 @@
package org.jboss.identity.idm.impl.api.session;
import java.io.Serializable;
+import java.util.Collection;
+import java.util.List;
import org.jboss.identity.idm.api.IdentitySession;
import org.jboss.identity.idm.api.Transaction;
@@ -30,9 +32,16 @@
import org.jboss.identity.idm.api.RelationshipManager;
import org.jboss.identity.idm.api.AttributesManager;
import org.jboss.identity.idm.api.RoleManager;
+import org.jboss.identity.idm.api.User;
+import org.jboss.identity.idm.api.Group;
+import org.jboss.identity.idm.api.Role;
import org.jboss.identity.idm.api.query.UserQuery;
import org.jboss.identity.idm.api.query.GroupQuery;
import org.jboss.identity.idm.api.query.RoleQuery;
+import org.jboss.identity.idm.api.query.UserQueryBuilder;
+import org.jboss.identity.idm.api.query.GroupQueryBuilder;
+import org.jboss.identity.idm.api.query.RoleQueryBuilder;
+import org.jboss.identity.idm.api.query.QueryException;
import org.jboss.identity.idm.exception.IdentityException;
import org.jboss.identity.idm.exception.FeatureNotSupportedException;
import org.jboss.identity.idm.spi.store.IdentityStoreSession;
@@ -51,6 +60,12 @@
import org.jboss.identity.idm.impl.api.query.UserQueryImpl;
import org.jboss.identity.idm.impl.api.query.GroupQueryImpl;
import org.jboss.identity.idm.impl.api.query.RoleQueryImpl;
+import org.jboss.identity.idm.impl.api.query.UserQueryExecutorImpl;
+import org.jboss.identity.idm.impl.api.query.GroupQueryExecutorImpl;
+import org.jboss.identity.idm.impl.api.query.RoleQueryExecutorImpl;
+import org.jboss.identity.idm.impl.api.query.UserQueryBuilderImpl;
+import org.jboss.identity.idm.impl.api.query.GroupQueryBuilderImpl;
+import org.jboss.identity.idm.impl.api.query.RoleQueryBuilderImpl;
import org.jboss.identity.idm.impl.NotYetImplementedException;
/**
@@ -74,6 +89,12 @@
private final RoleManager roleManager;
+ private final UserQueryExecutorImpl userQueryExecutor;
+
+ private final GroupQueryExecutorImpl groupQueryExecutor;
+
+ private final RoleQueryExecutorImpl roleQueryExecutor;
+
public IdentitySessionContext getSessionContext()
{
return sessionContext;
@@ -102,7 +123,11 @@
this.relationshipManager = new RelationshipManagerImpl(this);
this.profileManager = new AttributesManagerImpl(this);
this.roleManager = new RoleManagerImpl(this);
+ this.userQueryExecutor = new UserQueryExecutorImpl(this);
+ this.groupQueryExecutor = new GroupQueryExecutorImpl(this);
+ this.roleQueryExecutor = new RoleQueryExecutorImpl(this);
+
}
@@ -172,25 +197,70 @@
return roleManager;
}
- public UserQuery createUserQuery()
+ public UserQueryBuilder createUserQueryBuilder()
{
- return new UserQueryImpl(this);
+ return new UserQueryBuilderImpl();
}
- public GroupQuery createGroupQuery()
+ public GroupQueryBuilder createGroupQueryBuilder()
{
- return new GroupQueryImpl(this);
+ return new GroupQueryBuilderImpl();
}
- public RoleQuery createRoleQuery() throws FeatureNotSupportedException
+ public RoleQueryBuilder createRoleQueryBuilder() throws FeatureNotSupportedException
{
if (!getSessionContext().getIdentityStoreRepository().getSupportedFeatures().isNamedRelationshipsSupported())
{
throw new FeatureNotSupportedException("Role management not supported by underlaying configured identity stores");
}
- return new RoleQueryImpl(this);
+ return new RoleQueryBuilderImpl();
}
+
+ public Collection<User> execute(UserQuery userQuery) throws QueryException
+ {
+ return userQueryExecutor.execute((UserQueryImpl)userQuery);
+ }
+
+ public User uniqueResult(UserQuery userQuery) throws QueryException
+ {
+ return userQueryExecutor.uniqueResult((UserQueryImpl)userQuery);
+ }
+
+ public List<User> list(UserQuery userQuery) throws QueryException
+ {
+ return userQueryExecutor.list((UserQueryImpl)userQuery);
+ }
+
+ public Collection<Group> execute(GroupQuery groupQuery) throws QueryException
+ {
+ return groupQueryExecutor.execute((GroupQueryImpl)groupQuery);
+ }
+
+ public Group uniqueResult(GroupQuery groupQuery) throws QueryException
+ {
+ return groupQueryExecutor.uniqueResult((GroupQueryImpl)groupQuery);
+ }
+
+ public List<Group> list(GroupQuery groupQuery) throws QueryException
+ {
+ return groupQueryExecutor.list((GroupQueryImpl)groupQuery);
+ }
+
+ public Collection<Role> execute(RoleQuery roleQuery) throws QueryException
+ {
+ return roleQueryExecutor.execute((RoleQueryImpl)roleQuery);
+ }
+
+ public Role uniqueResult(RoleQuery roleQuery) throws QueryException
+ {
+ return roleQueryExecutor.uniqueResult((RoleQueryImpl)roleQuery);
+ }
+
+ public List<Role> list(RoleQuery roleQuery) throws QueryException
+ {
+ return roleQueryExecutor.list((RoleQueryImpl)roleQuery);
+ }
}
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java 2009-05-07 19:45:12 UTC (rev 479)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java 2009-05-08 20:46:17 UTC (rev 480)
@@ -467,7 +467,7 @@
return true;
}
- public Collection<Group> findAssociatedGroups(Group group, String groupType, boolean parent, boolean inherited, IdentitySearchCriteria controls) throws IdentityException
+ public Collection<Group> findAssociatedGroups(Group group, String groupType, boolean parent, boolean cascade, IdentitySearchCriteria controls) throws IdentityException
{
checkNotNullArgument(group, "Group");
@@ -477,10 +477,10 @@
IdentityObjectType iot = groupType != null ? getIdentityObjectType(groupType) : null;
- //TODO Handle inherited
- if (inherited)
+ //TODO Handle cascade
+ if (cascade)
{
- throw new NotYetImplementedException("Support for 'inherited' argument is not yet implemented. Please use 'false' value for now");
+ throw new NotYetImplementedException("Support for 'cascade' argument is not yet implemented. Please use 'false' value for now");
}
Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), MEMBER, parent, convertSearchControls(controls));
@@ -497,22 +497,22 @@
}
- public Collection<Group> findAssociatedGroups(String groupId, String groupType, boolean parent, boolean inherited, IdentitySearchCriteria controls) throws IdentityException
+ public Collection<Group> findAssociatedGroups(String groupId, String groupType, boolean parent, boolean cascade, IdentitySearchCriteria controls) throws IdentityException
{
checkNotNullArgument(groupId, "Group Id");
// checkNotNullArgument(groupType, "Group type");
Group group = createGroupFromId(groupId);
- return findAssociatedGroups(group, groupType, parent, inherited, controls);
+ return findAssociatedGroups(group, groupType, parent, cascade, controls);
}
- public Collection<Group> findAssociatedGroups(Group group, String groupType, boolean parent, boolean inherited) throws IdentityException
+ public Collection<Group> findAssociatedGroups(Group group, String groupType, boolean parent, boolean cascade) throws IdentityException
{
checkNotNullArgument(group, "Group");
// checkNotNullArgument(groupType, "Group type");
- return findAssociatedGroups(group, groupType, parent, inherited, null);
+ return findAssociatedGroups(group, groupType, parent, cascade, null);
}
public Collection<Group> findAssociatedGroups(User identity, String groupType, IdentitySearchCriteria controls) throws IdentityException
@@ -593,16 +593,16 @@
return findAssociatedGroups(identity, (IdentitySearchCriteria)null);
}
- public Collection<User> findAssociatedUsers(Group group, boolean inherited, IdentitySearchCriteria controls) throws IdentityException
+ public Collection<User> findAssociatedUsers(Group group, boolean cascade, IdentitySearchCriteria controls) throws IdentityException
{
checkNotNullArgument(group, "Group");
List<User> identities = new LinkedList<User>();
- //TODO Handle inherited
- if (inherited)
+ //TODO Handle cascade
+ if (cascade)
{
- throw new NotYetImplementedException("Support for 'inherited' argument is not yet implemented. Please use 'false' value for now");
+ throw new NotYetImplementedException("Support for 'cascade' argument is not yet implemented. Please use 'false' value for now");
}
Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), MEMBER, true, convertSearchControls(controls));
@@ -621,20 +621,20 @@
return identities;
}
- public Collection<User> findAssociatedUsers(String groupId, boolean inherited, IdentitySearchCriteria controls) throws IdentityException
+ public Collection<User> findAssociatedUsers(String groupId, boolean cascade, IdentitySearchCriteria controls) throws IdentityException
{
checkNotNullArgument(groupId, "Group Id");
Group group = createGroupFromId(groupId);
- return findAssociatedUsers(group, inherited, controls);
+ return findAssociatedUsers(group, cascade, controls);
}
- public Collection<User> findAssociatedUsers(Group group, boolean inherited) throws IdentityException
+ public Collection<User> findAssociatedUsers(Group group, boolean cascade) throws IdentityException
{
checkNotNullArgument(group, "Group");
- return findAssociatedUsers(group, inherited, null);
+ return findAssociatedUsers(group, cascade, null);
}
public Collection<Group> findRelatedGroups(User user, String groupType, IdentitySearchCriteria controls) throws IdentityException
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java 2009-05-07 19:45:12 UTC (rev 479)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java 2009-05-08 20:46:17 UTC (rev 480)
@@ -295,19 +295,22 @@
if (rels.size() == 0)
{
- throw new IdentityException("No such role present");
+ return null;
}
- if (rels.size() > 1)
+ for (IdentityObjectRelationship relationship : rels)
{
- throw new IdentityException("More than one role definition present - illegal state!");
+ if (roleType.getName().equals(relationship.getName()))
+ {
+ return new SimpleRole(new SimpleRoleType(relationship.getName()),
+ createUser(relationship.getToIdentityObject()),
+ createGroup(relationship.getFromIdentityObject()));
+ }
}
- IdentityObjectRelationship relationship = rels.iterator().next();
+ return null;
- return new SimpleRole(new SimpleRoleType(relationship.getType().getName()),
- createUser(relationship.getFromIdentityObject()),
- createGroup(relationship.getToIdentityObject()));
+
}
public Role getRole(String roleTypeName, String userId, String groupId) throws IdentityException
Modified: idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/APITestCase.java
===================================================================
--- idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/APITestCase.java 2009-05-07 19:45:12 UTC (rev 479)
+++ idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/APITestCase.java 2009-05-08 20:46:17 UTC (rev 480)
@@ -117,16 +117,19 @@
roleManagerTest.testMethods(getRealmName());
}
+ @Test
public void testUserQuery() throws Exception
{
userQueryTest.testQuery(getRealmName());
}
+ @Test
public void testGroupQuery() throws Exception
{
groupQueryTest.testQuery(getRealmName());
}
+ @Test
public void testRoleQuery() throws Exception
{
roleQueryTest.testQuery(getRealmName());
Modified: idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/GroupQueryTest.java
===================================================================
--- idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/GroupQueryTest.java 2009-05-07 19:45:12 UTC (rev 479)
+++ idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/GroupQueryTest.java 2009-05-08 20:46:17 UTC (rev 480)
@@ -22,14 +22,26 @@
package org.jboss.identity.idm.impl.api;
+import org.jboss.identity.idm.api.IdentitySession;
+import org.jboss.identity.idm.api.User;
+import org.jboss.identity.idm.api.Group;
+import org.jboss.identity.idm.api.RoleType;
+import org.jboss.identity.idm.api.Role;
+import org.jboss.identity.idm.api.query.GroupQueryBuilder;
+import junit.framework.Assert;
+
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
-public class GroupQueryTest
+public class GroupQueryTest extends Assert
{
private APITestContext ctx;
+ private String ORGANIZATION = "ORGANIZATION";
+ private String ORGANIZATION_UNIT = "ORGANIZATION_UNIT";
+ private String DEPARTMENT = "DEPARTMENT";
+
public GroupQueryTest(APITestContext testContext)
{
this.ctx = testContext;
@@ -39,8 +51,78 @@
{
ctx.begin();
+ IdentitySession ids = ctx.getIdentitySessionFactory().getCurrentIdentitySession(realmName);
+ // Create stuff
+ User user1 = ids.getPersistenceManager().createUser("user1");
+ User user2 = ids.getPersistenceManager().createUser("user2");
+ User user3 = ids.getPersistenceManager().createUser("user3");
+ User user4 = ids.getPersistenceManager().createUser("user4");
+
+ Group group1 = ids.getPersistenceManager().createGroup("group1", ORGANIZATION);
+ Group group2 = ids.getPersistenceManager().createGroup("group2", ORGANIZATION_UNIT);
+ Group group3 = ids.getPersistenceManager().createGroup("group3", ORGANIZATION_UNIT);
+ Group group4 = ids.getPersistenceManager().createGroup("group4", DEPARTMENT);
+ Group group5 = ids.getPersistenceManager().createGroup("group5", DEPARTMENT);
+
+ ids.getRelationshipManager().associateUser(group1, user1);
+ ids.getRelationshipManager().associateUser(group1, user2);
+ ids.getRelationshipManager().associateUser(group2, user3);
+ ids.getRelationshipManager().associateGroups(group2, group3);
+
+ RoleType rt1 = ids.getRoleManager().createRoleType("rt1");
+ RoleType rt2 = ids.getRoleManager().createRoleType("rt2");
+ RoleType rt3 = ids.getRoleManager().createRoleType("rt3");
+ RoleType rt4 = ids.getRoleManager().createRoleType("rt4");
+
+ Role role1 = ids.getRoleManager().createRole(rt1, user1, group1);
+ Role role2 = ids.getRoleManager().createRole(rt1, user1, group2);
+ Role role3 = ids.getRoleManager().createRole("rt2", user1.getId(), group1.getId());
+
+ // Assertions
+
+ GroupQueryBuilder qb = ids.createGroupQueryBuilder();
+
+ qb.addAssociatedUser(user1);
+
+ assertEquals(1, ids.execute(qb.createQuery()).size());
+ assertEquals(group1, ids.uniqueResult(qb.createQuery()));
+
+ //
+ qb.reset();
+
+ qb.addAssociatedUser(user1);
+ qb.addAssociatedUser(user2);
+
+ assertEquals(1, ids.execute(qb.createQuery()).size());
+
+ //
+ qb.reset();
+
+ qb.addAssociatedUser(user1);
+ qb.addRelatedUser(user2);
+
+ assertEquals(1, ids.execute(qb.createQuery()).size());
+
+ //
+ qb.reset();
+
+ qb.addAssociatedUser(user1);
+ qb.addRelatedUser(user4);
+
+ assertEquals(0, ids.execute(qb.createQuery()).size());
+
+ //
+ qb.reset();
+
+ qb.addAssociatedUser(user3);
+ qb.addAssociatedGroup(group3, false);
+
+ assertEquals(1, ids.execute(qb.createQuery()).size());
+ assertEquals(group2, ids.uniqueResult(qb.createQuery()));
+
+
ctx.commit();
}
}
Modified: idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RoleQueryTest.java
===================================================================
--- idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RoleQueryTest.java 2009-05-07 19:45:12 UTC (rev 479)
+++ idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RoleQueryTest.java 2009-05-08 20:46:17 UTC (rev 480)
@@ -22,14 +22,27 @@
package org.jboss.identity.idm.impl.api;
+import org.jboss.identity.idm.api.IdentitySession;
+import org.jboss.identity.idm.api.User;
+import org.jboss.identity.idm.api.Group;
+import org.jboss.identity.idm.api.RoleType;
+import org.jboss.identity.idm.api.Role;
+import org.jboss.identity.idm.api.query.RoleQueryBuilder;
+import org.jboss.identity.idm.api.query.RoleQuery;
+import junit.framework.Assert;
+
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
-public class RoleQueryTest
+public class RoleQueryTest extends Assert
{
private APITestContext ctx;
+ private String ORGANIZATION = "ORGANIZATION";
+ private String ORGANIZATION_UNIT = "ORGANIZATION_UNIT";
+ private String DEPARTMENT = "DEPARTMENT";
+
public RoleQueryTest(APITestContext testContext)
{
this.ctx = testContext;
@@ -39,8 +52,65 @@
{
ctx.begin();
+ IdentitySession ids = ctx.getIdentitySessionFactory().getCurrentIdentitySession(realmName);
+ // Create some stuff...
+ User user1 = ids.getPersistenceManager().createUser("user1");
+ User user2 = ids.getPersistenceManager().createUser("user2");
+ User user3 = ids.getPersistenceManager().createUser("user3");
+ User user4 = ids.getPersistenceManager().createUser("user4");
+
+ Group group1 = ids.getPersistenceManager().createGroup("group1", ORGANIZATION);
+ Group group2 = ids.getPersistenceManager().createGroup("group2", ORGANIZATION_UNIT);
+ Group group3 = ids.getPersistenceManager().createGroup("group3", ORGANIZATION_UNIT);
+ Group group4 = ids.getPersistenceManager().createGroup("group4", DEPARTMENT);
+ Group group5 = ids.getPersistenceManager().createGroup("group5", DEPARTMENT);
+
+ RoleType rt1 = ids.getRoleManager().createRoleType("rt1");
+ RoleType rt2 = ids.getRoleManager().createRoleType("rt2");
+ RoleType rt3 = ids.getRoleManager().createRoleType("rt3");
+ RoleType rt4 = ids.getRoleManager().createRoleType("rt4");
+
+ Role role1 = ids.getRoleManager().createRole(rt1, user1, group1);
+ Role role2 = ids.getRoleManager().createRole(rt1, user1, group2);
+ Role role3 = ids.getRoleManager().createRole("rt2", user1.getId(), group1.getId());
+
+ // Test Query
+
+ //
+ RoleQueryBuilder rqb = ids.createRoleQueryBuilder();
+
+ rqb.setUser("user1");
+
+ RoleQuery rq = rqb.createQuery();
+
+ assertEquals(3, ids.execute(rq).size());
+
+ //
+ rqb.setGroup(group1);
+ rq = rqb.createQuery();
+
+ assertEquals(2, ids.execute(rq).size());
+
+ //
+ rqb.setRoleType(rt2);
+ rq = rqb.createQuery();
+
+ assertEquals(1, ids.execute(rq).size());
+
+
+ //
+ rqb.reset();
+
+ rqb.setGroup(group2);
+ rqb.setRoleType(rt1);
+
+ rq = rqb.createQuery();
+
+ assertEquals(1, ids.execute(rq).size());
+ assertEquals(role2, ids.uniqueResult(rq));
+
ctx.commit();
}
}
Modified: idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/UserQueryTest.java
===================================================================
--- idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/UserQueryTest.java 2009-05-07 19:45:12 UTC (rev 479)
+++ idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/UserQueryTest.java 2009-05-08 20:46:17 UTC (rev 480)
@@ -23,7 +23,12 @@
package org.jboss.identity.idm.impl.api;
import org.jboss.identity.idm.api.IdentitySession;
+import org.jboss.identity.idm.api.User;
+import org.jboss.identity.idm.api.Group;
+import org.jboss.identity.idm.api.RoleType;
+import org.jboss.identity.idm.api.Role;
import org.jboss.identity.idm.api.query.UserQuery;
+import org.jboss.identity.idm.api.query.UserQueryBuilder;
import junit.framework.Assert;
/**
@@ -34,6 +39,12 @@
{
private APITestContext ctx;
+ private String ORGANIZATION = "ORGANIZATION";
+
+ private String ORGANIZATION_UNIT = "ORGANIZATION_UNIT";
+
+ private String DEPARTMENT = "DEPARTMENT";
+
public UserQueryTest(APITestContext testContext)
{
this.ctx = testContext;
@@ -45,18 +56,104 @@
IdentitySession ids = ctx.getIdentitySessionFactory().getCurrentIdentitySession(realmName);
- ids.getPersistenceManager().createUser("testUser");
- ids.getPersistenceManager().createUser("testUser2");
- ids.getPersistenceManager().createUser("testUser3");
+ // Create stuff
- UserQuery q = ids.createUserQuery();
+ User user1 = ids.getPersistenceManager().createUser("user1");
+ User user2 = ids.getPersistenceManager().createUser("user2");
+ User user3 = ids.getPersistenceManager().createUser("user3");
+ User user4 = ids.getPersistenceManager().createUser("user4");
- q.withUserId("testUser");
+ Group group1 = ids.getPersistenceManager().createGroup("group1", ORGANIZATION);
+ Group group2 = ids.getPersistenceManager().createGroup("group2", ORGANIZATION_UNIT);
+ Group group3 = ids.getPersistenceManager().createGroup("group3", ORGANIZATION_UNIT);
+ Group group4 = ids.getPersistenceManager().createGroup("group4", DEPARTMENT);
+ Group group5 = ids.getPersistenceManager().createGroup("group5", DEPARTMENT);
- assertEquals(1, q.execute().size());
- assertEquals(1, q.list().size());
- assertEquals("testUser", q.uniqueResult().getId());
+ ids.getRelationshipManager().associateUser(group1, user1);
+ ids.getRelationshipManager().associateUser(group1, user2);
+ RoleType rt1 = ids.getRoleManager().createRoleType("rt1");
+ RoleType rt2 = ids.getRoleManager().createRoleType("rt2");
+ RoleType rt3 = ids.getRoleManager().createRoleType("rt3");
+ RoleType rt4 = ids.getRoleManager().createRoleType("rt4");
+
+ Role role1 = ids.getRoleManager().createRole(rt1, user1, group1);
+ Role role2 = ids.getRoleManager().createRole(rt1, user1, group2);
+ Role role3 = ids.getRoleManager().createRole("rt2", user1.getId(), group1.getId());
+
+ // Asserts
+
+ //
+ UserQueryBuilder qb = ids.createUserQueryBuilder();
+
+ qb.withUserId("user1");
+ UserQuery q = qb.createQuery();
+
+ assertEquals(1, ids.execute(q).size());
+ assertEquals(1, ids.list(q).size());
+ assertEquals("user1", ids.uniqueResult(q).getId());
+
+ //
+ qb.reset();
+
+ qb.addAssociatedGroup(group2);
+
+ assertEquals(0, ids.execute(qb.createQuery()).size());
+
+ //
+ qb.reset();
+
+ qb.addAssociatedGroup(group1);
+
+ assertEquals(2, ids.execute(qb.createQuery()).size());
+
+ //
+ qb.reset();
+
+ qb.addAssociatedGroup(group1);
+ qb.withUserId(user1.getId());
+
+ assertEquals(1, ids.execute(qb.createQuery()).size());
+
+ //
+ qb.reset();
+
+ qb.addAssociatedGroup(group2);
+ qb.withUserId(user1.getId());
+
+ assertEquals(0, ids.execute(qb.createQuery()).size());
+
+ //
+ qb.reset();
+
+ qb.addAssociatedGroup(group1);
+ qb.addGroupConnectedWithRole(group2);
+
+ assertEquals(1, ids.execute(qb.createQuery()).size());
+ assertEquals(user1, ids.uniqueResult(qb.createQuery()));
+
+ //
+ qb.reset();
+
+ qb.addRelatedGroup(group1);
+
+ assertEquals(2, ids.execute(qb.createQuery()).size());
+
+ //
+ qb.reset();
+
+ qb.addRelatedGroup(group2);
+ qb.addAssociatedGroup(group1);
+
+ assertEquals(1, ids.execute(qb.createQuery()).size());
+ assertEquals(user1, ids.uniqueResult(qb.createQuery()));
+
+ //
+ qb.reset();
+
+ assertEquals(4, ids.execute(qb.createQuery()).size());
+
+
ctx.commit();
}
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/IdentitySession.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/IdentitySession.java 2009-05-07 19:45:12 UTC (rev 479)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/IdentitySession.java 2009-05-08 20:46:17 UTC (rev 480)
@@ -27,7 +27,14 @@
import org.jboss.identity.idm.api.query.RoleQuery;
import org.jboss.identity.idm.api.query.GroupQuery;
import org.jboss.identity.idm.api.query.UserQuery;
+import org.jboss.identity.idm.api.query.GroupQueryBuilder;
+import org.jboss.identity.idm.api.query.UserQueryBuilder;
+import org.jboss.identity.idm.api.query.RoleQueryBuilder;
+import org.jboss.identity.idm.api.query.QueryException;
+import java.util.Collection;
+import java.util.List;
+
/**
* Expose all identity management operations within a given realm
*
@@ -111,19 +118,92 @@
*
* @return
*/
- UserQuery createUserQuery();
+ UserQueryBuilder createUserQueryBuilder();
/**
*
* @return
*/
- GroupQuery createGroupQuery();
+ GroupQueryBuilder createGroupQueryBuilder();
/**
*
* @return
*/
- RoleQuery createRoleQuery() throws FeatureNotSupportedException;
+ RoleQueryBuilder createRoleQueryBuilder() throws FeatureNotSupportedException;
+ /**
+ *
+ * @param userQuery
+ * @return
+ * @throws QueryException
+ */
+ Collection<User> execute(UserQuery userQuery) throws QueryException;
+ /**
+ *
+ * @param userQuery
+ * @return
+ * @throws QueryException
+ */
+ User uniqueResult(UserQuery userQuery) throws QueryException;
+
+ /**
+ *
+ * @param userQuery
+ * @return
+ * @throws QueryException
+ */
+ List<User> list(UserQuery userQuery) throws QueryException;
+
+ /**
+ *
+ * @param groupQuery
+ * @return
+ * @throws QueryException
+ */
+ Collection<Group> execute(GroupQuery groupQuery) throws QueryException;
+
+ /**
+ *
+ * @param groupQuery
+ * @return
+ * @throws QueryException
+ */
+ Group uniqueResult(GroupQuery groupQuery) throws QueryException;
+
+ /**
+ *
+ * @param groupQuery
+ * @return
+ * @throws QueryException
+ */
+ List<Group> list(GroupQuery groupQuery) throws QueryException;
+
+ /**
+ *
+ * @param roleQuery
+ * @return
+ * @throws QueryException
+ */
+ Collection<Role> execute(RoleQuery roleQuery) throws QueryException;
+
+ /**
+ *
+ * @param roleQuery
+ * @return
+ * @throws QueryException
+ */
+ Role uniqueResult(RoleQuery roleQuery) throws QueryException;
+
+ /**
+ *
+ * @param roleQuery
+ * @return
+ * @throws QueryException
+ */
+ List<Role> list(RoleQuery roleQuery) throws QueryException;
+
+
+
}
\ No newline at end of file
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java 2009-05-07 19:45:12 UTC (rev 479)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java 2009-05-08 20:46:17 UTC (rev 480)
@@ -278,13 +278,13 @@
/**
* Find groups that are associated with given group.
* If 'parent' parameter is set to false, all parent group will be returned. If parent parameter is
- * set to true and 'inherited' is set to true all nested subgroubs will be returned.
+ * set to true and 'cascade' is set to true all nested subgroubs will be returned.
*
* @param group parent group
* @param groupType can be null
* @param parent defines if given identity is parent or child side in the
* relationship - default is true (parent)
- * @param inherited if true also identities from subgroubs will be retreived. Matters only when parent is set to true.
+ * @param cascade if true also identities from subgroubs will be retreived. Matters only when parent is set to true.
* Default is false
* @return
* @throws org.jboss.identity.idm.exception.IdentityException
@@ -292,18 +292,18 @@
Collection<Group> findAssociatedGroups(Group group,
String groupType,
boolean parent,
- boolean inherited) throws IdentityException;
+ boolean cascade) throws IdentityException;
/**
* Find groups that are associated with given group.
* If 'parent' parameter is set to false, all parent group will be returned. If parent parameter is
- * set to true and 'inherited' is set to true all nested subgroubs will be returned.
+ * set to true and 'cascade' is set to true all nested subgroubs will be returned.
*
* @param group parent group
* @param groupType can be null
* @param parent defines if given identity is parent or child side in the
* relationship - default is true (parent)
- * @param inherited if true also identities from subgroubs will be retreived. Matters only when parent is set to true.
+ * @param cascade if true also identities from subgroubs will be retreived. Matters only when parent is set to true.
* Default is false
* @return
* @throws org.jboss.identity.idm.exception.IdentityException
@@ -311,19 +311,19 @@
Collection<Group> findAssociatedGroups(Group group,
String groupType,
boolean parent,
- boolean inherited,
+ boolean cascade,
IdentitySearchCriteria controls) throws IdentityException;
/**
* Find groups that are associated with given group.
* If 'parent' parameter is set to false, all parent group will be returned. If parent parameter is
- * set to true and 'inherited' is set to true all nested subgroubs will be returned.
+ * set to true and 'cascade' is set to true all nested subgroubs will be returned.
*
* @param groupId Id of parent group
* @param groupType can be null
* @param parent defines if given identity is parent or child side in the
* relationship - default is true (parent)
- * @param inherited if true also identities from subgroubs will be retreived. Matters only when parent is set to true.
+ * @param cascade if true also identities from subgroubs will be retreived. Matters only when parent is set to true.
* Default is false
* @return
* @throws org.jboss.identity.idm.exception.IdentityException
@@ -331,7 +331,7 @@
Collection<Group> findAssociatedGroups(String groupId,
String groupType,
boolean parent,
- boolean inherited,
+ boolean cascade,
IdentitySearchCriteria controls) throws IdentityException;
/**
@@ -401,35 +401,35 @@
* Find identities that have relationship with given parent group.
*
* @param group parent group
- * @param inherited if true also identities from subgroubs will be retrieved. Default is false
+ * @param cascade if true also identities from subgroubs will be retrieved. Default is false
* @return
* @throws org.jboss.identity.idm.exception.IdentityException
*/
Collection<User> findAssociatedUsers(Group group,
- boolean inherited) throws IdentityException;
+ boolean cascade) throws IdentityException;
/**
* Find identities that have relationship with given parent group.
*
* @param group parent group
- * @param inherited if true also identities from subgroubs will be retrieved. Default is false
+ * @param cascade if true also identities from subgroubs will be retrieved. Default is false
* @return
* @throws org.jboss.identity.idm.exception.IdentityException
*/
Collection<User> findAssociatedUsers(Group group,
- boolean inherited,
+ boolean cascade,
IdentitySearchCriteria controls) throws IdentityException;
/**
* Find identities that have relationship with given parent group.
*
* @param groupId parent group id
- * @param inherited if true also identities from subgroubs will be retrieved. Default is false
+ * @param cascade if true also identities from subgroubs will be retrieved. Default is false
* @return
* @throws org.jboss.identity.idm.exception.IdentityException
*/
Collection<User> findAssociatedUsers(String groupId,
- boolean inherited,
+ boolean cascade,
IdentitySearchCriteria controls) throws IdentityException;
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleType.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleType.java 2009-05-07 19:45:12 UTC (rev 479)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleType.java 2009-05-08 20:46:17 UTC (rev 480)
@@ -37,4 +37,5 @@
*/
String getName();
+
}
\ No newline at end of file
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/GroupQuery.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/GroupQuery.java 2009-05-07 19:45:12 UTC (rev 479)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/GroupQuery.java 2009-05-08 20:46:17 UTC (rev 480)
@@ -36,56 +36,6 @@
public interface GroupQuery extends Query
{
- Collection<Group> execute() throws QueryException;
+
- Group uniqueResult() throws QueryException;
-
- List<Group> list() throws QueryException;
-
- GroupQuery setId(String id);
-
- GroupQuery setNameAndType(String name, String type);
-
- GroupQuery setName(String name);
-
- GroupQuery setType(String type);
-
- GroupQuery addAssociatedGroup(Group group, boolean parent);
-
- GroupQuery addAssociatedGroup(String id, boolean parent);
-
- GroupQuery addAssociatedGroups(Collection<Group> groups, boolean parent);
-
- GroupQuery addAssociatedGroupsIds(Collection<String> ids, boolean parent);
-
- GroupQuery addAssociatedUser(User user);
-
- GroupQuery addAssociatedUser(String id);
-
- GroupQuery addAssociatedUsers(Collection<User> users);
-
- GroupQuery addAssociatedUsersIds(Collection<String> ids);
-
- GroupQuery addUserConnectedByRole(User user);
-
- GroupQuery addUserConnectedByRole(String id);
-
- GroupQuery addUsersConnectedByRole(Collection<User> users);
-
- GroupQuery addUsersIdsConnectedByRole(Collection<String> ids);
-
- GroupQuery addRelatedUser(User user);
-
- GroupQuery addRelatedUser(String id);
-
- GroupQuery sort(SortOrder order) throws UnsupportedQueryCriterium;
-
- GroupQuery sortAttributeName(String name) throws UnsupportedQueryCriterium;
-
- GroupQuery page(int firstResult, int maxResults) throws UnsupportedQueryCriterium;
-
- GroupQuery attributeValuesFilter(String attributeName, String[] attributeValue) throws UnsupportedQueryCriterium;
-
-
-
}
Added: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/GroupQueryBuilder.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/GroupQueryBuilder.java (rev 0)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/GroupQueryBuilder.java 2009-05-08 20:46:17 UTC (rev 480)
@@ -0,0 +1,85 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.api.query;
+
+import org.jboss.identity.idm.api.Group;
+import org.jboss.identity.idm.api.User;
+import org.jboss.identity.idm.api.SortOrder;
+
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface GroupQueryBuilder extends QueryBuilder
+{
+ GroupQuery createQuery();
+
+ GroupQueryBuilder reset();
+
+ GroupQueryBuilder setId(String id);
+
+ GroupQueryBuilder setNameAndType(String name, String type);
+
+ GroupQueryBuilder setName(String name);
+
+ GroupQueryBuilder setType(String type);
+
+ GroupQueryBuilder addAssociatedGroup(Group group, boolean parent);
+
+ GroupQueryBuilder addAssociatedGroup(String id, boolean parent);
+
+ GroupQueryBuilder addAssociatedGroups(Collection<Group> groups, boolean parent);
+
+ GroupQueryBuilder addAssociatedGroupsIds(Collection<String> ids, boolean parent);
+
+ GroupQueryBuilder addAssociatedUser(User user);
+
+ GroupQueryBuilder addAssociatedUser(String id);
+
+ GroupQueryBuilder addAssociatedUsers(Collection<User> users);
+
+ GroupQueryBuilder addAssociatedUsersIds(Collection<String> ids);
+
+ GroupQueryBuilder addUserConnectedByRole(User user);
+
+ GroupQueryBuilder addUserConnectedByRole(String id);
+
+ GroupQueryBuilder addUsersConnectedByRole(Collection<User> users);
+
+ GroupQueryBuilder addUsersIdsConnectedByRole(Collection<String> ids);
+
+ GroupQueryBuilder addRelatedUser(User user);
+
+ GroupQueryBuilder addRelatedUser(String id);
+
+ GroupQueryBuilder sort(SortOrder order) throws UnsupportedQueryCriterium;
+
+ GroupQueryBuilder sortAttributeName(String name) throws UnsupportedQueryCriterium;
+
+ GroupQueryBuilder page(int firstResult, int maxResults) throws UnsupportedQueryCriterium;
+
+ GroupQueryBuilder attributeValuesFilter(String attributeName, String[] attributeValue) throws UnsupportedQueryCriterium;
+
+}
Added: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/QueryBuilder.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/QueryBuilder.java (rev 0)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/QueryBuilder.java 2009-05-08 20:46:17 UTC (rev 480)
@@ -0,0 +1,31 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.api.query;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface QueryBuilder
+{
+}
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/RoleQuery.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/RoleQuery.java 2009-05-07 19:45:12 UTC (rev 479)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/RoleQuery.java 2009-05-08 20:46:17 UTC (rev 480)
@@ -38,26 +38,8 @@
public interface RoleQuery extends Query
{
- Collection<Role> execute() throws QueryException;
+
- Role uniqueResult() throws QueryException;
+
- List<Role> list() throws QueryException;
-
- RoleQuery setUser(User user);
-
- RoleQuery setUser(String id);
-
- RoleQuery setGroup(Group group);
-
- RoleQuery setGroup(String id);
-
- RoleQuery setRoleType(RoleType roleType);
-
- RoleQuery setRoleType(String string);
-
- RoleQuery setIdentityType(IdentityType identityType);
-
- RoleQuery setIdentityTypeId(String id);
-
}
Added: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/RoleQueryBuilder.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/RoleQueryBuilder.java (rev 0)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/RoleQueryBuilder.java 2009-05-08 20:46:17 UTC (rev 480)
@@ -0,0 +1,56 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.api.query;
+
+import org.jboss.identity.idm.api.User;
+import org.jboss.identity.idm.api.Group;
+import org.jboss.identity.idm.api.RoleType;
+import org.jboss.identity.idm.api.IdentityType;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface RoleQueryBuilder extends QueryBuilder
+{
+ RoleQuery createQuery();
+
+ RoleQueryBuilder reset();
+
+ RoleQueryBuilder setUser(User user);
+
+ RoleQueryBuilder setUser(String id);
+
+ RoleQueryBuilder setGroup(Group group);
+
+ RoleQueryBuilder setGroup(String id);
+
+ RoleQueryBuilder setRoleType(RoleType roleType);
+
+ RoleQueryBuilder setRoleType(String string);
+
+ RoleQueryBuilder setIdentityType(IdentityType identityType);
+
+ RoleQueryBuilder setIdentityTypeId(String id);
+
+}
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/UserQuery.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/UserQuery.java 2009-05-07 19:45:12 UTC (rev 479)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/UserQuery.java 2009-05-08 20:46:17 UTC (rev 480)
@@ -35,44 +35,8 @@
*/
public interface UserQuery extends Query
{
- Collection<User> execute() throws QueryException;
+
- User uniqueResult() throws QueryException;
+
- List<User> list() throws QueryException;
-
- UserQuery withUserId(String id);
-
- UserQuery addAssociatedGroup(Group group);
-
- UserQuery addAssociatedGroup(String id);
-
- UserQuery addAssociatedGroups(Collection<Group> groups);
-
- UserQuery addAssociatedGroupsIds(Collection<String> groups);
-
- UserQuery addGroupConnectedWithRole(Group group);
-
- UserQuery addGroupConnectedWithRole(String id);
-
- UserQuery addGroupsConnectedWithRole(Collection<Group> groups);
-
- UserQuery addGroupsIdsConnectedWithRole(Collection<String> groups);
-
- UserQuery addRelatedGroup(Group group);
-
- UserQuery addRelatedGroup(String id);
-
- UserQuery addRelatedGroups(Collection<Group> group);
-
- UserQuery addRelatedGroupsIds(Collection<String> ids);
-
- UserQuery sort(SortOrder order) throws UnsupportedQueryCriterium;
-
- UserQuery sortAttributeName(String name) throws UnsupportedQueryCriterium;
-
- UserQuery page(int firstResult, int maxResults) throws UnsupportedQueryCriterium;
-
- UserQuery attributeValuesFilter(String attributeName, String[] attributeValue) throws UnsupportedQueryCriterium;
-
}
Added: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/UserQueryBuilder.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/UserQueryBuilder.java (rev 0)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/UserQueryBuilder.java 2009-05-08 20:46:17 UTC (rev 480)
@@ -0,0 +1,75 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.api.query;
+
+import org.jboss.identity.idm.api.Group;
+import org.jboss.identity.idm.api.SortOrder;
+
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface UserQueryBuilder extends QueryBuilder
+{
+
+ UserQuery createQuery();
+
+ UserQueryBuilder reset();
+
+ UserQueryBuilder withUserId(String id);
+
+ UserQueryBuilder addAssociatedGroup(Group group);
+
+ UserQueryBuilder addAssociatedGroup(String id);
+
+ UserQueryBuilder addAssociatedGroups(Collection<Group> groups);
+
+ UserQueryBuilder addAssociatedGroupsIds(Collection<String> groups);
+
+ UserQueryBuilder addGroupConnectedWithRole(Group group);
+
+ UserQueryBuilder addGroupConnectedWithRole(String id);
+
+ UserQueryBuilder addGroupsConnectedWithRole(Collection<Group> groups);
+
+ UserQueryBuilder addGroupsIdsConnectedWithRole(Collection<String> groups);
+
+ UserQueryBuilder addRelatedGroup(Group group);
+
+ UserQueryBuilder addRelatedGroup(String id);
+
+ UserQueryBuilder addRelatedGroups(Collection<Group> group);
+
+ UserQueryBuilder addRelatedGroupsIds(Collection<String> ids);
+
+ UserQueryBuilder sort(SortOrder order) throws UnsupportedQueryCriterium;
+
+ UserQueryBuilder sortAttributeName(String name) throws UnsupportedQueryCriterium;
+
+ UserQueryBuilder page(int firstResult, int maxResults) throws UnsupportedQueryCriterium;
+
+ UserQueryBuilder attributeValuesFilter(String attributeName, String[] attributeValue) throws UnsupportedQueryCriterium;
+
+}
15 years, 8 months
JBoss Identity SVN: r479 - in idm/trunk/idm/src/test: resources/datasources and 1 other directory.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-05-07 15:45:12 -0400 (Thu, 07 May 2009)
New Revision: 479
Modified:
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java
idm/trunk/idm/src/test/resources/datasources/datasources.xml
idm/trunk/idm/src/test/resources/datasources/hibernates.xml
Log:
switch to jtds driver for sybase
Modified: idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java
===================================================================
--- idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java 2009-05-05 15:58:02 UTC (rev 478)
+++ idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java 2009-05-07 19:45:12 UTC (rev 479)
@@ -290,9 +290,13 @@
}
@Test
- public void testCredentials() throws Exception
+ public void testPasswordCredentials() throws Exception
{
commonTest.testPasswordCredential();
+ }
+
+ public void testBinaryCredentials() throws Exception
+ {
commonTest.testBinaryCredential();
}
Modified: idm/trunk/idm/src/test/resources/datasources/datasources.xml
===================================================================
--- idm/trunk/idm/src/test/resources/datasources/datasources.xml 2009-05-05 15:58:02 UTC (rev 478)
+++ idm/trunk/idm/src/test/resources/datasources/datasources.xml 2009-05-07 19:45:12 UTC (rev 479)
@@ -23,10 +23,17 @@
<datasources>
+ <!--<datasource>-->
+ <!--<datasource-name>sybase152</datasource-name>-->
+ <!--<connection-url>jdbc:sybase:Tds:dev77.qa.atl2.redhat.com:4100/jbidentity</connection-url>-->
+ <!--<driver-class>com.sybase.jdbc3.jdbc.SybDriver</driver-class>-->
+ <!--<user-name>jbidentity</user-name>-->
+ <!--<password>jbidentity</password>-->
+ <!--</datasource>-->
<datasource>
<datasource-name>sybase152</datasource-name>
- <connection-url>jdbc:sybase:Tds:dev77.qa.atl2.redhat.com:4100/jbidentity</connection-url>
- <driver-class>com.sybase.jdbc3.jdbc.SybDriver</driver-class>
+ <connection-url>jdbc:jtds:sybase://dev77.qa.atl2.redhat.com:4100/jbidentity</connection-url>
+ <driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class>
<user-name>jbidentity</user-name>
<password>jbidentity</password>
</datasource>
Modified: idm/trunk/idm/src/test/resources/datasources/hibernates.xml
===================================================================
--- idm/trunk/idm/src/test/resources/datasources/hibernates.xml 2009-05-05 15:58:02 UTC (rev 478)
+++ idm/trunk/idm/src/test/resources/datasources/hibernates.xml 2009-05-07 19:45:12 UTC (rev 479)
@@ -4,6 +4,10 @@
<configuration-name>default</configuration-name>
<properties>
<property>
+ <name>hibernate.hbm2ddl.auto</name>
+ <value>create-drop</value>
+ </property>
+ <property>
<name>hibernate.show_sql</name>
<value>true</value>
</property>
15 years, 8 months
JBoss Identity SVN: r478 - idm/trunk/idm.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-05-05 11:58:02 -0400 (Tue, 05 May 2009)
New Revision: 478
Modified:
idm/trunk/idm/pom.xml
Log:
allow additional jar (for hudson setup)
Modified: idm/trunk/idm/pom.xml
===================================================================
--- idm/trunk/idm/pom.xml 2009-05-05 13:48:43 UTC (rev 477)
+++ idm/trunk/idm/pom.xml 2009-05-05 15:58:02 UTC (rev 478)
@@ -295,6 +295,18 @@
</dependency>
</dependencies>
</profile>
+ <profile>
+ <id>provided-jdbc-driver2</id>
+ <dependencies>
+ <dependency>
+ <groupId>privided</groupId>
+ <artifactId>jdbc-driver2</artifactId>
+ <version>NA</version>
+ <scope>system</scope>
+ <systemPath>${provided.jdbc.driver.path2}</systemPath>
+ </dependency>
+ </dependencies>
+ </profile>
<!--<profile>-->
<!--<id>oracle-provided-jdbc-drivers</id>-->
<!--<dependencies>-->
15 years, 9 months
JBoss Identity SVN: r477 - in idm/trunk: idm/src/main/java/org/jboss/identity/idm/impl/api/query and 6 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-05-05 09:48:43 -0400 (Tue, 05 May 2009)
New Revision: 477
Added:
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/GroupQueryTest.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RoleQueryTest.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/UserQueryTest.java
idm/trunk/idm/src/test/resources/log4j.xml
Modified:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java
idm/trunk/idm/pom.xml
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQuery.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/RoleQueryImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObject.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectBinaryAttributeValue.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectCredential.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationship.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationshipName.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateRealm.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/APILDAPTestCase.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/APITestCase.java
idm/trunk/idm/src/test/resources/datasources/datasources.xml
idm/trunk/idm/src/test/resources/datasources/hibernates.xml
Log:
partial commit for sybase and db2 testing and some db fixes.
Modified: idm/trunk/idm/pom.xml
===================================================================
--- idm/trunk/idm/pom.xml 2009-05-04 18:16:51 UTC (rev 476)
+++ idm/trunk/idm/pom.xml 2009-05-05 13:48:43 UTC (rev 477)
@@ -284,14 +284,14 @@
<profiles>
<profile>
- <id>oracle-provided-jdbc-driver</id>
+ <id>provided-jdbc-driver</id>
<dependencies>
<dependency>
- <groupId>oracle</groupId>
+ <groupId>privided</groupId>
<artifactId>jdbc-driver</artifactId>
<version>NA</version>
<scope>system</scope>
- <systemPath>${oracle.jdbc.driver.path}</systemPath>
+ <systemPath>${provided.jdbc.driver.path}</systemPath>
</dependency>
</dependencies>
</profile>
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQuery.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQuery.java 2009-05-04 18:16:51 UTC (rev 476)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQuery.java 2009-05-05 13:48:43 UTC (rev 477)
@@ -28,6 +28,8 @@
import org.jboss.identity.idm.api.IdentitySession;
import org.jboss.identity.idm.api.Group;
import org.jboss.identity.idm.api.IdentityType;
+import org.jboss.identity.idm.api.User;
+import org.jboss.identity.idm.api.Role;
import org.jboss.identity.idm.api.query.UserQuery;
import org.jboss.identity.idm.api.query.UnsupportedQueryCriterium;
import org.jboss.identity.idm.api.query.Query;
@@ -37,6 +39,9 @@
import org.jboss.identity.idm.impl.api.model.SimpleUser;
import org.jboss.identity.idm.impl.api.session.IdentitySessionImpl;
+import java.util.List;
+import java.util.LinkedList;
+
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
@@ -133,4 +138,83 @@
return new SimpleUser(id);
}
}
+
+ protected List<IdentityType> mergeIdentityTypeWithAND(List<IdentityType> first, List<IdentityType> second)
+ {
+ List<IdentityType> results = new LinkedList<IdentityType>();
+
+ for (IdentityType identityType : first)
+ {
+ if (second.contains(identityType))
+ {
+ results.add(identityType);
+ }
+ }
+
+ return results;
+ }
+
+ protected List<User> mergeUsersWithAND(List<User> first, List<User> second)
+ {
+ List<User> results = new LinkedList<User>();
+
+ for (User user : first)
+ {
+ if (second.contains(user))
+ {
+ results.add(user);
+ }
+ }
+
+ return results;
+ }
+
+ protected List<Group> mergeGroupsWithAND(List<Group> first, List<Group> second)
+ {
+ List<Group> results = new LinkedList<Group>();
+
+ for (Group group : first)
+ {
+ if (second.contains(group))
+ {
+ results.add(group);
+ }
+ }
+
+ return results;
+ }
+
+ protected List<User> applyCriteriaUsers(List<User> users)
+ {
+// List<User> results = new LinkedList<User>();
+//
+// // First pass - filters
+// if(searchCriteria.isFiltered())
+// {
+// for (User user : users)
+// {
+// if (searchCriteria.getFilter() != null)
+// {
+//
+// }
+// }
+//
+// }
+
+ return users;
+ }
+
+ protected List<Role> applyCriteriaRoles(List<Role> roles)
+ {
+ //TODO:
+ return roles;
+ }
+
+ protected List<Group> applyCriteriaGroups(List<Group> roles)
+ {
+ //TODO:
+ return roles;
+ }
+
+
}
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryImpl.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryImpl.java 2009-05-04 18:16:51 UTC (rev 476)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryImpl.java 2009-05-05 13:48:43 UTC (rev 477)
@@ -28,16 +28,19 @@
import org.jboss.identity.idm.api.SortOrder;
import org.jboss.identity.idm.api.Group;
import org.jboss.identity.idm.api.User;
+import org.jboss.identity.idm.api.Role;
import org.jboss.identity.idm.impl.NotYetImplementedException;
import org.jboss.identity.idm.impl.api.session.IdentitySessionImpl;
import org.jboss.identity.idm.impl.api.model.GroupId;
import org.jboss.identity.idm.impl.api.model.SimpleGroup;
import org.jboss.identity.idm.impl.api.model.SimpleUser;
+import org.jboss.identity.idm.exception.IdentityException;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import java.util.HashSet;
+import java.util.LinkedList;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -69,7 +72,183 @@
public Collection<Group> execute() throws QueryException
{
prepare();
- throw new NotYetImplementedException();
+
+ List<Group> mainResults = new LinkedList<Group>();
+
+ try
+ {
+ Group uniqueResult = null;
+
+ List<Group> resultsAssociatedParentGroups = new LinkedList<Group>();
+ List<Group> resultsAssociatedChildGroups = new LinkedList<Group>();
+ List<Group> resultsUsersAssociated = new LinkedList<Group>();
+ List<Group> resultsUsersRelated = new LinkedList<Group>();
+ List<Group> resultsUsersConnectedByRole = new LinkedList<Group>();
+
+ if (groupId != null)
+ {
+ uniqueResult = identitySession.getPersistenceManager().findGroup(groupId.getName(), groupId.getType());
+ }
+
+ // Process each condition
+
+ if (associatedParentGroups.size() > 0)
+ {
+ for (Group group : associatedParentGroups)
+ {
+ resultsAssociatedParentGroups.addAll(identitySession.getRelationshipManager().findAssociatedGroups(
+ group, groupType, true, false, searchCriteria));
+ }
+ }
+
+ if (associatedChildGroups.size() > 0)
+ {
+ for (Group group : associatedChildGroups)
+ {
+ resultsAssociatedChildGroups.addAll(identitySession.getRelationshipManager().findAssociatedGroups(
+ group, groupType, false, false, searchCriteria));
+ }
+ }
+
+
+ if (usersAssociated.size() > 0)
+ {
+ for (User user : usersAssociated)
+ {
+ resultsUsersAssociated.addAll(identitySession.getRelationshipManager().findAssociatedGroups(
+ user, groupType, searchCriteria));
+ }
+ }
+
+ if (usersRelated.size() > 0)
+ {
+ for (User user : usersRelated)
+ {
+ resultsUsersRelated.addAll(identitySession.getRelationshipManager().findRelatedGroups(user, groupType, searchCriteria));
+ }
+ }
+
+ if (usersConnectedByRole.size() > 0)
+ {
+ for (User user : usersConnectedByRole)
+ {
+ resultsUsersConnectedByRole.addAll(identitySession.getRoleManager().findGroupsWithRelatedRole(user, groupType, searchCriteria));
+ }
+ }
+
+ // If only one search was performed then return it as search criteria are applied correctly
+
+ if (uniqueResult == null &&
+ resultsAssociatedChildGroups.size() == 0 &&
+ resultsAssociatedParentGroups.size() == 0 &&
+ resultsUsersAssociated.size() == 0 &&
+ resultsUsersConnectedByRole.size() == 0 &&
+ resultsUsersRelated.size() == 0)
+ {
+ return mainResults;
+
+ }
+ else if (uniqueResult != null &&
+ resultsAssociatedChildGroups.size() == 0 &&
+ resultsAssociatedParentGroups.size() == 0 &&
+ resultsUsersAssociated.size() == 0 &&
+ resultsUsersConnectedByRole.size() == 0 &&
+ resultsUsersRelated.size() == 0)
+ {
+
+ mainResults.add(uniqueResult);
+ //TODO: apply constraints...
+ return mainResults;
+ }
+ else if (uniqueResult == null &&
+ resultsAssociatedChildGroups.size() != 0 &&
+ resultsAssociatedParentGroups.size() == 0 &&
+ resultsUsersAssociated.size() == 0 &&
+ resultsUsersConnectedByRole.size() == 0 &&
+ resultsUsersRelated.size() == 0)
+ {
+ return resultsAssociatedChildGroups;
+
+ }
+ else if (uniqueResult == null &&
+ resultsAssociatedChildGroups.size() == 0 &&
+ resultsAssociatedParentGroups.size() != 0 &&
+ resultsUsersAssociated.size() == 0 &&
+ resultsUsersConnectedByRole.size() == 0 &&
+ resultsUsersRelated.size() == 0)
+ {
+ return resultsAssociatedParentGroups;
+ }
+ else if (uniqueResult == null &&
+ resultsAssociatedChildGroups.size() == 0 &&
+ resultsAssociatedParentGroups.size() == 0 &&
+ resultsUsersAssociated.size() != 0 &&
+ resultsUsersConnectedByRole.size() == 0 &&
+ resultsUsersRelated.size() == 0)
+ {
+ return resultsUsersAssociated;
+ }
+ else if (uniqueResult == null &&
+ resultsAssociatedChildGroups.size() == 0 &&
+ resultsAssociatedParentGroups.size() == 0 &&
+ resultsUsersAssociated.size() == 0 &&
+ resultsUsersConnectedByRole.size() != 0 &&
+ resultsUsersRelated.size() == 0)
+ {
+ return resultsUsersConnectedByRole;
+ }
+ else if (uniqueResult == null &&
+ resultsAssociatedChildGroups.size() == 0 &&
+ resultsAssociatedParentGroups.size() == 0 &&
+ resultsUsersAssociated.size() == 0 &&
+ resultsUsersConnectedByRole.size() == 0 &&
+ resultsUsersRelated.size() != 0)
+ {
+ return resultsUsersRelated;
+ }
+
+ // Merge with logical AND
+
+ if (uniqueResult != null)
+ {
+ mainResults.add(uniqueResult);
+ }
+
+ if (resultsAssociatedChildGroups.size() > 0)
+ {
+ mainResults = mergeGroupsWithAND(mainResults, resultsAssociatedChildGroups);
+ }
+
+ if (resultsAssociatedParentGroups.size() > 0)
+ {
+ mainResults = mergeGroupsWithAND(mainResults, resultsAssociatedParentGroups);
+ }
+
+ if (resultsUsersAssociated.size() > 0)
+ {
+ mainResults = mergeGroupsWithAND(mainResults, resultsUsersAssociated);
+ }
+
+ if (resultsUsersConnectedByRole.size() > 0)
+ {
+ mainResults = mergeGroupsWithAND(mainResults, resultsUsersConnectedByRole);
+ }
+
+ if (resultsUsersRelated.size() > 0);
+ {
+ mainResults = mergeGroupsWithAND(mainResults, resultsUsersRelated);
+ }
+
+ mainResults = applyCriteriaGroups(mainResults);
+ }
+ catch (Exception e)
+ {
+ throw new QueryException("Failed to execute query", e);
+ }
+
+
+
+ return mainResults;
}
private void prepare()
@@ -78,15 +257,35 @@
{
groupId = new GroupId(groupName, groupType);
}
+
}
public Group uniqueResult() throws QueryException
{
- throw new NotYetImplementedException();
+ Collection<Group> results = execute();
+
+ if (results.size() > 1)
+ {
+ throw new QueryException("More than one result returned");
+ }
+ else if (results.size() == 1)
+ {
+ return results.iterator().next();
+ }
+
+ return null;
}
public List<Group> list() throws QueryException
{
+ Collection<Group> results = execute();
+
+ if (results instanceof List)
+ {
+ return (List<Group>)results;
+ }
+
+ //TODO:
throw new NotYetImplementedException();
}
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/RoleQueryImpl.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/RoleQueryImpl.java 2009-05-04 18:16:51 UTC (rev 476)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/RoleQueryImpl.java 2009-05-05 13:48:43 UTC (rev 477)
@@ -37,10 +37,14 @@
import org.jboss.identity.idm.impl.api.model.GroupId;
import org.jboss.identity.idm.impl.api.model.SimpleGroup;
import org.jboss.identity.idm.impl.api.model.SimpleRoleType;
+import org.jboss.identity.idm.impl.api.model.SimpleRole;
import org.jboss.identity.idm.impl.NotYetImplementedException;
+import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.exception.FeatureNotSupportedException;
import java.util.Collection;
import java.util.List;
+import java.util.LinkedList;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -62,17 +66,111 @@
public Collection<Role> execute() throws QueryException
{
- throw new NotYetImplementedException();
+ List<Role> mainResults = new LinkedList<Role>();
+
+ try
+ {
+ // Check all constraints combinations
+
+ if (user == null &&
+ group == null &&
+ roleType == null)
+ {
+ return mainResults;
+ }
+ else if (user != null &&
+ group != null &&
+ roleType != null)
+ {
+ Role role = identitySession.getRoleManager().getRole(roleType, user, group);
+ if (role != null)
+ {
+ mainResults.add(role);
+ }
+ return mainResults;
+
+ }
+ else if (user != null &&
+ group == null &&
+ roleType == null)
+ {
+ return identitySession.getRoleManager().findRoles(user, null);
+ }
+ else if (user != null &&
+ group == null &&
+ roleType != null)
+ {
+ return identitySession.getRoleManager().findRoles(user, roleType);
+ }
+ else if (user == null &&
+ group != null &&
+ roleType == null)
+ {
+ return identitySession.getRoleManager().findRoles(group, null);
+ }
+ else if (user == null &&
+ group != null &&
+ roleType != null)
+ {
+ return identitySession.getRoleManager().findRoles(group, roleType);
+ }
+ else if (user == null &&
+ group == null &&
+ roleType != null)
+ {
+ //TODO: reconsider if this should be supported
+ throw new QueryException("Not enought information to perform a query. Cannot query roles only with a given RoleType");
+ }
+ else if (user != null &&
+ group != null &&
+ roleType == null)
+ {
+ Collection<RoleType> roleTypes = identitySession.getRoleManager().findRoleTypes(user, group, searchCriteria);
+ for (RoleType type : roleTypes)
+ {
+ mainResults.add(new SimpleRole(type, user, group));
+ }
+ return mainResults;
+ }
+ }
+ catch (Exception e)
+ {
+ throw new QueryException("Failed to execute query", e);
+ }
+
+ mainResults = applyCriteriaRoles(mainResults);
+
+ return mainResults;
+
}
public Role uniqueResult() throws QueryException
{
- throw new NotYetImplementedException();
+ Collection<Role> results = execute();
+
+ if (results.size() > 1)
+ {
+ throw new QueryException("More than one result returned");
+ }
+ else if (results.size() == 1)
+ {
+ return results.iterator().next();
+ }
+
+ return null;
}
public List<Role> list() throws QueryException
{
+ Collection<Role> results = execute();
+
+ if (results instanceof List)
+ {
+ return (List<Role>)results;
+ }
+
+ //TODO:
throw new NotYetImplementedException();
}
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryImpl.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryImpl.java 2009-05-04 18:16:51 UTC (rev 476)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryImpl.java 2009-05-05 13:48:43 UTC (rev 477)
@@ -30,11 +30,13 @@
import org.jboss.identity.idm.api.SortOrder;
import org.jboss.identity.idm.impl.api.session.IdentitySessionImpl;
import org.jboss.identity.idm.impl.NotYetImplementedException;
+import org.jboss.identity.idm.exception.IdentityException;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import java.util.HashSet;
+import java.util.LinkedList;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -58,16 +60,145 @@
public Collection<User> execute() throws QueryException
{
- throw new NotYetImplementedException();
+
+ List<User> resultsMain = new LinkedList<User>();
+
+ try
+ {
+
+ User uniqueUser = null;
+ List<User> resultsAssociatedGroups = new LinkedList<User>();
+ List<User> resultsConnectedWithRoleGroups = new LinkedList<User>();
+ List<User> resultsRelatedGroups = new LinkedList<User>();
+
+ // Process each condition separately
+
+ if (userId != null)
+ {
+ uniqueUser = identitySession.getPersistenceManager().findUser(userId);
+ }
+
+ if (groupsAssociatedWith.size() > 0)
+ {
+ for (Group group : groupsAssociatedWith)
+ {
+ resultsAssociatedGroups.addAll(identitySession.getRelationshipManager().findAssociatedUsers(group, false, searchCriteria));
+ }
+ }
+
+ if (groupsConnectedWithRole.size() > 0)
+ {
+ for (Group group : groupsConnectedWithRole)
+ {
+ resultsConnectedWithRoleGroups.addAll(identitySession.getRoleManager().findUsersWithRelatedRole(group, searchCriteria));
+ }
+ }
+
+ if (groupsRelated.size() > 0)
+ {
+ for (Group group : groupsRelated)
+ {
+ resultsRelatedGroups.addAll(identitySession.getRelationshipManager().findRelatedUsers(group, searchCriteria));
+ }
+ }
+
+ // If only one condition was present just return it
+
+ if (uniqueUser != null &&
+ resultsAssociatedGroups.size() == 0 &&
+ resultsConnectedWithRoleGroups.size() == 0 &&
+ resultsRelatedGroups.size() == 0)
+ {
+ resultsMain.add(uniqueUser);
+ //TODO: apply constraints...
+ return resultsMain;
+ }
+ else if (uniqueUser == null &&
+ resultsAssociatedGroups.size() > 0 &&
+ resultsConnectedWithRoleGroups.size() == 0 &&
+ resultsRelatedGroups.size() == 0)
+ {
+ return resultsAssociatedGroups;
+ }
+ else if (uniqueUser == null &&
+ resultsAssociatedGroups.size() == 0 &&
+ resultsConnectedWithRoleGroups.size() > 0 &&
+ resultsRelatedGroups.size() == 0)
+ {
+ return resultsConnectedWithRoleGroups;
+ }
+ else if (uniqueUser == null &&
+ resultsAssociatedGroups.size() == 0 &&
+ resultsConnectedWithRoleGroups.size() == 0 &&
+ resultsRelatedGroups.size() > 0)
+ {
+ return resultsRelatedGroups;
+ }
+
+ // Merge results with logical AND
+
+ if (uniqueUser != null)
+ {
+ resultsMain.add(uniqueUser);
+ }
+
+ if (resultsAssociatedGroups.size() > 0)
+ {
+ resultsMain = mergeUsersWithAND(resultsMain, resultsAssociatedGroups);
+ }
+
+ if (resultsConnectedWithRoleGroups.size() > 0)
+ {
+ resultsMain = mergeUsersWithAND(resultsMain, resultsConnectedWithRoleGroups);
+ }
+
+ if (resultsRelatedGroups.size() > 0)
+ {
+ resultsMain = mergeUsersWithAND(resultsMain, resultsRelatedGroups);
+ }
+
+ // As results were merged criteria need to be applied separately
+ if (resultsMain.size() > 0)
+ {
+ resultsMain = applyCriteriaUsers(resultsMain);
+ }
+
+ }
+ catch (Exception e)
+ {
+ throw new QueryException("Failed to execute query", e);
+ }
+
+ return resultsMain;
}
public User uniqueResult() throws QueryException
{
- throw new NotYetImplementedException();
+
+ Collection<User> results = execute();
+
+ if (results.size() > 1)
+ {
+ throw new QueryException("More than one result returned");
+ }
+ else if (results.size() == 1)
+ {
+ return results.iterator().next();
+ }
+
+ return null;
}
public List<User> list() throws QueryException
{
+ Collection<User> results = execute();
+
+ if (results instanceof List)
+ {
+ return (List<User>)results;
+ }
+
+ //TODO:
throw new NotYetImplementedException();
}
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java 2009-05-04 18:16:51 UTC (rev 476)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java 2009-05-05 13:48:43 UTC (rev 477)
@@ -445,6 +445,34 @@
}
+ public Collection<User> findUsersWithRelatedRole(Group group, IdentitySearchCriteria controls) throws IdentityException
+ {
+ checkNotNullArgument(group, "Group");
+
+ List<User> identities = new LinkedList<User>();
+
+
+ Collection<IdentityObject> ios = null;
+
+ ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), ROLE, true, convertSearchControls(controls));
+
+ for (IdentityObject io : ios)
+ {
+ identities.add(createUser(io));
+ }
+
+ return identities;
+ }
+
+ public Collection<User> findUsersWithRelatedRole(String groupId, IdentitySearchCriteria controls) throws IdentityException
+ {
+ checkNotNullArgument(groupId, "Group id");
+
+ Group group = createGroupFromId(groupId);
+
+ return findUsersWithRelatedRole(group, controls);
+ }
+
public Collection<Group> findGroupsWithRelatedRole(User identity, IdentitySearchCriteria controls) throws IdentityException
{
checkNotNullArgument(identity, "User");
@@ -477,31 +505,42 @@
public Collection<Group> findGroupsWithRelatedRole(User identity, String groupType, IdentitySearchCriteria controls) throws IdentityException
{
checkNotNullArgument(identity, "User");
- checkNotNullArgument(groupType, "Group type");
+// checkNotNullArgument(groupType, "Group type");
List<Group> identities = new LinkedList<Group>();
- IdentityObjectType iot = getIdentityObjectType(groupType);
-
Collection<IdentityObject> ios = null;
ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(identity), ROLE, false, convertSearchControls(controls));
- for (IdentityObject io : ios)
+ if (groupType != null)
{
- if (io.getIdentityType().getName().equals(iot.getName()))
+ IdentityObjectType iot = getIdentityObjectType(groupType);
+
+ for (IdentityObject io : ios)
{
+ if (io.getIdentityType().getName().equals(iot.getName()))
+ {
+ identities.add(createGroup(io));
+ }
+ }
+ }
+ else
+ {
+ for (IdentityObject io : ios)
+ {
identities.add(createGroup(io));
}
}
+
return identities;
}
public Collection<Group> findGroupsWithRelatedRole(String userName, String groupType, IdentitySearchCriteria controls) throws IdentityException
{
checkNotNullArgument(userName, "User name");
- checkNotNullArgument(groupType, "Group type");
+// checkNotNullArgument(groupType, "Group type");
User user = createUserFromId(userName);
@@ -512,7 +551,7 @@
public Collection<Role> findRoles(IdentityType identityType, RoleType roleType) throws IdentityException
{
checkNotNullArgument(identityType, "IdentityType");
- checkNotNullArgument(roleType, "RoleType");
+ //checkNotNullArgument(roleType, "RoleType");
Set<Role> roles = new HashSet<Role>();
@@ -531,8 +570,15 @@
for (IdentityObjectRelationship relationship : relationships)
{
- if (roleType.getName().equals(relationship.getName()))
+ if (roleType != null)
{
+ if (roleType.getName().equals(relationship.getName()))
+ {
+ roles.add(new SimpleRole(new SimpleRoleType(relationship.getName()), createUser(relationship.getToIdentityObject()), createGroup(relationship.getFromIdentityObject())));
+ }
+ }
+ else
+ {
roles.add(new SimpleRole(new SimpleRoleType(relationship.getName()), createUser(relationship.getToIdentityObject()), createGroup(relationship.getFromIdentityObject())));
}
}
@@ -544,9 +590,10 @@
public Collection<Role> findRoles(String id, String roleTypeName) throws IdentityException
{
checkNotNullArgument(id, "Group id or User name");
- checkNotNullArgument(roleTypeName, "RoleType name");
+// checkNotNullArgument(roleTypeName, "RoleType name");
- return findRoles(createIdentityTypeFromId(id), new SimpleRoleType(roleTypeName));
+ RoleType roleType = roleTypeName != null ? new SimpleRoleType(roleTypeName) : null;
+ return findRoles(createIdentityTypeFromId(id), roleType);
}
public Map<String, String> getProperties(RoleType roleType) throws IdentityException
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObject.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObject.java 2009-05-04 18:16:51 UTC (rev 476)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObject.java 2009-05-05 13:48:43 UTC (rev 477)
@@ -101,7 +101,8 @@
private Set<HibernateIdentityObjectAttribute> attributes = new HashSet<HibernateIdentityObjectAttribute>();
@CollectionOfElements
- @JoinTable(name = "identity_obj_properties", joinColumns = @JoinColumn(name = "IDENTITY_OBJ_ID"))
+ @JoinTable(name = "identity_obj_properties", joinColumns = @JoinColumn(name = "IDENTITY_OBJ_ID", nullable=false))
+ @org.hibernate.annotations.MapKey(columns = @Column(name = "prop_key", nullable=false))
@Column(name = "PROPERTY")
private Map<String, String> properties = new HashMap<String, String>();
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectBinaryAttributeValue.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectBinaryAttributeValue.java 2009-05-04 18:16:51 UTC (rev 476)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectBinaryAttributeValue.java 2009-05-05 13:48:43 UTC (rev 477)
@@ -32,6 +32,7 @@
import javax.persistence.JoinColumn;
import javax.persistence.Id;
import javax.persistence.GeneratedValue;
+import javax.persistence.Lob;
import java.util.Set;
import java.util.HashSet;
import java.util.Collections;
@@ -51,7 +52,7 @@
@GeneratedValue
private Long id;
-
+ @Lob
@Column(length = 10240000)
private byte[] value;
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectCredential.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectCredential.java 2009-05-04 18:16:51 UTC (rev 476)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectCredential.java 2009-05-05 13:48:43 UTC (rev 477)
@@ -68,11 +68,13 @@
@Column(name= "TEXT", nullable = true)
private String textValue;
+ @Lob
@Column(name= "BINARY_VALUE", nullable = true, length = 10240000)
private byte[] binaryValue;
@CollectionOfElements
- @JoinTable(name = "jbid_io_creden_props", joinColumns = @JoinColumn(name = "CREDENTIAL_ID"))
+ @JoinTable(name = "jbid_io_creden_props", joinColumns = @JoinColumn(name = "CREDENTIAL_ID", nullable = false))
+ @org.hibernate.annotations.MapKey(columns = @Column(name = "prop_key", nullable=false))
@Column(name = "PROPERTY")
private Map<String, String> properties = new HashMap<String, String>();
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationship.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationship.java 2009-05-04 18:16:51 UTC (rev 476)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationship.java 2009-05-05 13:48:43 UTC (rev 477)
@@ -80,7 +80,8 @@
private HibernateIdentityObject toIdentityObject;
@CollectionOfElements
- @JoinTable(name = "jbid_io_rel_props", joinColumns = @JoinColumn(name = "REALATIONSHIP_ID"))
+ @JoinTable(name = "jbid_io_rel_props", joinColumns = @JoinColumn(name = "REALATIONSHIP_ID", nullable=false))
+ @org.hibernate.annotations.MapKey(columns = @Column(name = "prop_key", nullable=false))
@Column(name = "PROPERTY")
private Map<String, String> properties = new HashMap<String, String>();
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationshipName.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationshipName.java 2009-05-04 18:16:51 UTC (rev 476)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationshipName.java 2009-05-05 13:48:43 UTC (rev 477)
@@ -89,7 +89,8 @@
private HibernateRealm realm;
@CollectionOfElements
- @JoinTable(name = "jbid_io_rel_name_props", joinColumns = @JoinColumn(name = "REALATIONSHIP_NAME_ID"))
+ @JoinTable(name = "jbid_io_rel_name_props", joinColumns = @JoinColumn(name = "REALATIONSHIP_NAME_ID", nullable=false))
+ @org.hibernate.annotations.MapKey(columns = @Column(name = "prop_key", nullable=false))
@Column(name = "PROPERTY")
private Map<String, String> properties = new HashMap<String, String>();
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateRealm.java
===================================================================
--- idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateRealm.java 2009-05-04 18:16:51 UTC (rev 476)
+++ idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateRealm.java 2009-05-05 13:48:43 UTC (rev 477)
@@ -34,6 +34,8 @@
import javax.persistence.NamedQuery;
import javax.persistence.JoinTable;
import javax.persistence.JoinColumn;
+import javax.persistence.AttributeOverride;
+import javax.persistence.MapKey;
import java.util.Map;
import java.util.HashMap;
@@ -57,8 +59,9 @@
private String name;
@CollectionOfElements
- @JoinTable(name = "jbid_io_realm_props", joinColumns = @JoinColumn(name = "REALM_ID"))
+ @JoinTable(name = "jbid_io_realm_props", joinColumns = @JoinColumn(name = "REALM_ID", nullable=false))
@Column(name = "PROPERTY")
+ @org.hibernate.annotations.MapKey(columns = @Column(name = "prop_key", nullable=false))
private Map<String, String> properties = new HashMap<String, String>();
public HibernateRealm()
Modified: idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/APILDAPTestCase.java
===================================================================
--- idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/APILDAPTestCase.java 2009-05-04 18:16:51 UTC (rev 476)
+++ idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/APILDAPTestCase.java 2009-05-05 13:48:43 UTC (rev 477)
@@ -56,6 +56,12 @@
RoleManagerTest roleManagerTest;
+ UserQueryTest userQueryTest;
+
+ GroupQueryTest groupQueryTest;
+
+ RoleQueryTest roleQueryTest;
+
IdentitySessionFactory identitySessionFactory;
@Create
@@ -66,6 +72,10 @@
relationshipManagerTest = new RelationshipManagerTest(this);
roleManagerTest = new RoleManagerTest(this);
+ userQueryTest = new UserQueryTest(this);
+ groupQueryTest = new GroupQueryTest(this);
+ roleQueryTest = new RoleQueryTest(this);
+
setRealmName("realm://RedHat/DB_LDAP");
populateClean();
@@ -109,4 +119,19 @@
{
roleManagerTest.testMethods(getRealmName());
}
+
+ public void testUserQuery() throws Exception
+ {
+ userQueryTest.testQuery(getRealmName());
+ }
+
+ public void testGroupQuery() throws Exception
+ {
+ groupQueryTest.testQuery(getRealmName());
+ }
+
+ public void testRoleQuery() throws Exception
+ {
+ roleQueryTest.testQuery(getRealmName());
+ }
}
\ No newline at end of file
Modified: idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/APITestCase.java
===================================================================
--- idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/APITestCase.java 2009-05-04 18:16:51 UTC (rev 476)
+++ idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/APITestCase.java 2009-05-05 13:48:43 UTC (rev 477)
@@ -55,6 +55,12 @@
RoleManagerTest roleManagerTest;
+ UserQueryTest userQueryTest;
+
+ GroupQueryTest groupQueryTest;
+
+ RoleQueryTest roleQueryTest;
+
IdentitySessionFactory identitySessionFactory;
@Create
@@ -65,6 +71,10 @@
relationshipManagerTest = new RelationshipManagerTest(this);
roleManagerTest = new RoleManagerTest(this);
+ userQueryTest = new UserQueryTest(this);
+ groupQueryTest = new GroupQueryTest(this);
+ roleQueryTest = new RoleQueryTest(this);
+
setRealmName("realm://RedHat/DB");
@@ -106,4 +116,20 @@
{
roleManagerTest.testMethods(getRealmName());
}
+
+ public void testUserQuery() throws Exception
+ {
+ userQueryTest.testQuery(getRealmName());
+ }
+
+ public void testGroupQuery() throws Exception
+ {
+ groupQueryTest.testQuery(getRealmName());
+ }
+
+ public void testRoleQuery() throws Exception
+ {
+ roleQueryTest.testQuery(getRealmName());
+ }
+
}
\ No newline at end of file
Added: idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/GroupQueryTest.java
===================================================================
--- idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/GroupQueryTest.java (rev 0)
+++ idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/GroupQueryTest.java 2009-05-05 13:48:43 UTC (rev 477)
@@ -0,0 +1,46 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.api;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class GroupQueryTest
+{
+ private APITestContext ctx;
+
+ public GroupQueryTest(APITestContext testContext)
+ {
+ this.ctx = testContext;
+ }
+
+ public void testQuery(String realmName) throws Exception
+ {
+ ctx.begin();
+
+
+
+ ctx.commit();
+ }
+}
Added: idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RoleQueryTest.java
===================================================================
--- idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RoleQueryTest.java (rev 0)
+++ idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RoleQueryTest.java 2009-05-05 13:48:43 UTC (rev 477)
@@ -0,0 +1,46 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.api;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class RoleQueryTest
+{
+ private APITestContext ctx;
+
+ public RoleQueryTest(APITestContext testContext)
+ {
+ this.ctx = testContext;
+ }
+
+ public void testQuery(String realmName) throws Exception
+ {
+ ctx.begin();
+
+
+
+ ctx.commit();
+ }
+}
Added: idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/UserQueryTest.java
===================================================================
--- idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/UserQueryTest.java (rev 0)
+++ idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/UserQueryTest.java 2009-05-05 13:48:43 UTC (rev 477)
@@ -0,0 +1,65 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.api;
+
+import org.jboss.identity.idm.api.IdentitySession;
+import org.jboss.identity.idm.api.query.UserQuery;
+import junit.framework.Assert;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class UserQueryTest extends Assert
+{
+ private APITestContext ctx;
+
+ public UserQueryTest(APITestContext testContext)
+ {
+ this.ctx = testContext;
+ }
+
+ public void testQuery(String realmName) throws Exception
+ {
+ ctx.begin();
+
+ IdentitySession ids = ctx.getIdentitySessionFactory().getCurrentIdentitySession(realmName);
+
+ ids.getPersistenceManager().createUser("testUser");
+ ids.getPersistenceManager().createUser("testUser2");
+ ids.getPersistenceManager().createUser("testUser3");
+
+ UserQuery q = ids.createUserQuery();
+
+ q.withUserId("testUser");
+
+ assertEquals(1, q.execute().size());
+ assertEquals(1, q.list().size());
+ assertEquals("testUser", q.uniqueResult().getId());
+
+ ctx.commit();
+ }
+
+
+
+}
Modified: idm/trunk/idm/src/test/resources/datasources/datasources.xml
===================================================================
--- idm/trunk/idm/src/test/resources/datasources/datasources.xml 2009-05-04 18:16:51 UTC (rev 476)
+++ idm/trunk/idm/src/test/resources/datasources/datasources.xml 2009-05-05 13:48:43 UTC (rev 477)
@@ -24,6 +24,22 @@
<datasources>
<datasource>
+ <datasource-name>sybase152</datasource-name>
+ <connection-url>jdbc:sybase:Tds:dev77.qa.atl2.redhat.com:4100/jbidentity</connection-url>
+ <driver-class>com.sybase.jdbc3.jdbc.SybDriver</driver-class>
+ <user-name>jbidentity</user-name>
+ <password>jbidentity</password>
+ </datasource>
+
+ <datasource>
+ <datasource-name>db291</datasource-name>
+ <connection-url>jdbc:db2://dev67.qa.atl.jboss.com:50000/jbossqa</connection-url>
+ <driver-class>com.ibm.db2.jcc.DB2Driver</driver-class>
+ <user-name>identity</user-name>
+ <password>identity</password>
+ </datasource>
+
+ <datasource>
<datasource-name>oracle10g-local</datasource-name>
<connection-url>jdbc:oracle:thin:@192.168.1.101:1521:XE</connection-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
Modified: idm/trunk/idm/src/test/resources/datasources/hibernates.xml
===================================================================
--- idm/trunk/idm/src/test/resources/datasources/hibernates.xml 2009-05-04 18:16:51 UTC (rev 476)
+++ idm/trunk/idm/src/test/resources/datasources/hibernates.xml 2009-05-05 13:48:43 UTC (rev 477)
@@ -176,4 +176,22 @@
</property>
</properties>
</configuration>
+ <configuration>
+ <configuration-name>sybase152</configuration-name>
+ <properties>
+ <property>
+ <name>hibernate.dialect</name>
+ <value>org.hibernate.dialect.SybaseDialect</value>
+ </property>
+ </properties>
+ </configuration>
+ <configuration>
+ <configuration-name>db291</configuration-name>
+ <properties>
+ <property>
+ <name>hibernate.dialect</name>
+ <value>org.hibernate.dialect.DB2Dialect</value>
+ </property>
+ </properties>
+ </configuration>
</configurations>
Added: idm/trunk/idm/src/test/resources/log4j.xml
===================================================================
--- idm/trunk/idm/src/test/resources/log4j.xml (rev 0)
+++ idm/trunk/idm/src/test/resources/log4j.xml 2009-05-05 13:48:43 UTC (rev 477)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern"
+ value="[%d{dd/MM/yy hh:mm:ss:sss z}] %5p %c{2}: %m%n" />
+ </layout>
+ </appender>
+
+ <appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
+ <appender-ref ref="CONSOLE"/>
+ <appender-ref ref="FILE"/>
+ </appender>
+
+ <appender name="FILE" class="org.apache.log4j.RollingFileAppender">
+ <param name="File" value="log4j-output.log"/>
+ <param name="MaxFileSize" value="1MB"/>
+ <param name="MaxBackupIndex" value="100"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern"
+ value="[%d{dd/MM/yy hh:mm:ss:sss z}] %5p %c{2}: %m%n" />
+ </layout>
+ </appender>
+
+ <root>
+ <priority value="info"/>
+ <appender-ref ref="CONSOLE"/>
+ <!--<appender-ref ref="ASYNC"/>-->
+ </root>
+</log4j:configuration>
\ No newline at end of file
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java 2009-05-04 18:16:51 UTC (rev 476)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java 2009-05-05 13:48:43 UTC (rev 477)
@@ -307,6 +307,28 @@
IdentitySearchCriteria controls) throws IdentityException;
/**
+ * Find all Users with which Group has a Role association
+ *
+ * @param group
+ * @param controls
+ * @return
+ * @throws IdentityException
+ */
+ Collection<User> findUsersWithRelatedRole(Group group,
+ IdentitySearchCriteria controls) throws IdentityException;
+
+ /**
+ * Find all Users with which Group has a Role association
+ *
+ * @param groupId
+ * @param controls
+ * @return
+ * @throws IdentityException
+ */
+ Collection<User> findUsersWithRelatedRole(String groupId,
+ IdentitySearchCriteria controls) throws IdentityException;
+
+ /**
* Find Role objects with a given RoleType associated with a given IdentityType
* @param identityType
* @param roleType
15 years, 9 months
JBoss Identity SVN: r476 - in identity-federation/trunk/jboss-identity-samples/circleoftrust: resources and 2 other directories.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-05-04 14:16:51 -0400 (Mon, 04 May 2009)
New Revision: 476
Added:
identity-federation/trunk/jboss-identity-samples/circleoftrust/resources/idp.jsp
identity-federation/trunk/jboss-identity-samples/circleoftrust/resources/idpTrustedProviders.jsp
identity-federation/trunk/jboss-identity-samples/circleoftrust/resources/spTrustedProviders.jsp
identity-federation/trunk/jboss-identity-samples/circleoftrust/resources/trustedproviders.jsp
Modified:
identity-federation/trunk/jboss-identity-samples/circleoftrust/
identity-federation/trunk/jboss-identity-samples/circleoftrust/pom.xml
identity-federation/trunk/jboss-identity-samples/circleoftrust/resources/
identity-federation/trunk/jboss-identity-samples/circleoftrust/resources/META-INF/
identity-federation/trunk/jboss-identity-samples/circleoftrust/resources/WEB-INF/
identity-federation/trunk/jboss-identity-samples/circleoftrust/resources/addedIDP.jsp
identity-federation/trunk/jboss-identity-samples/circleoftrust/resources/index.jsp
identity-federation/trunk/jboss-identity-samples/circleoftrust/resources/sp.jsp
Log:
more jsp
Property changes on: identity-federation/trunk/jboss-identity-samples/circleoftrust
___________________________________________________________________
Name: svn:ignore
+ target
.metadata
.settings
target-eclipse
Modified: identity-federation/trunk/jboss-identity-samples/circleoftrust/pom.xml
===================================================================
--- identity-federation/trunk/jboss-identity-samples/circleoftrust/pom.xml 2009-05-03 21:30:15 UTC (rev 475)
+++ identity-federation/trunk/jboss-identity-samples/circleoftrust/pom.xml 2009-05-04 18:16:51 UTC (rev 476)
@@ -1,7 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.identity.federation</groupId>
- <artifactId>jboss-identity-samples-employee</artifactId>
+ <artifactId>jboss-identity-circleoftrust</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>JBoss Identity Federation Circle Of Trust</name>
Property changes on: identity-federation/trunk/jboss-identity-samples/circleoftrust/resources
___________________________________________________________________
Name: svn:ignore
+ target
.metadata
.settings
target-eclipse
Property changes on: identity-federation/trunk/jboss-identity-samples/circleoftrust/resources/META-INF
___________________________________________________________________
Name: svn:ignore
+ target
.metadata
.settings
target-eclipse
Property changes on: identity-federation/trunk/jboss-identity-samples/circleoftrust/resources/WEB-INF
___________________________________________________________________
Name: svn:ignore
+ target
.metadata
.settings
target-eclipse
Modified: identity-federation/trunk/jboss-identity-samples/circleoftrust/resources/addedIDP.jsp
===================================================================
--- identity-federation/trunk/jboss-identity-samples/circleoftrust/resources/addedIDP.jsp 2009-05-03 21:30:15 UTC (rev 475)
+++ identity-federation/trunk/jboss-identity-samples/circleoftrust/resources/addedIDP.jsp 2009-05-04 18:16:51 UTC (rev 476)
@@ -2,6 +2,9 @@
An IDP has been added as a trusted provider.<br/>
+<div align="center">
+
+
Information on the IDP: <br/>
<%
@@ -13,4 +16,5 @@
%>
<br/>
<br/>
+</div>
<a href="<%=request.getContextPath()%>/index.jsp">Back</a>
Added: identity-federation/trunk/jboss-identity-samples/circleoftrust/resources/idp.jsp
===================================================================
--- identity-federation/trunk/jboss-identity-samples/circleoftrust/resources/idp.jsp (rev 0)
+++ identity-federation/trunk/jboss-identity-samples/circleoftrust/resources/idp.jsp 2009-05-04 18:16:51 UTC (rev 476)
@@ -0,0 +1,16 @@
+Configure a Service Provider <br/>
+
+<form name="add_sp" action="/circleoftrust/COTServlet" method="post">
+<div align="center">
+
+Name of Identity Provider:
+<input type="text" name="idpname" value="ENTER IDP NAME" /> <br/>
+Name of the Service Provider:
+<input type="text" name="spname" value="ENTER SP NAME" /> <br/>
+Metadata URL of Service Provider:
+<input type="text" name="metadataURL" value="ENTER Metadata URL" /> <br/>
+<input type="hidden" name="type" value="sp" /> <br/>
+<input type="hidden" name="action" value="add" /> <br/>
+<input type="submit" value="Submit" /> <br/>
+</div>
+</form>
Added: identity-federation/trunk/jboss-identity-samples/circleoftrust/resources/idpTrustedProviders.jsp
===================================================================
--- identity-federation/trunk/jboss-identity-samples/circleoftrust/resources/idpTrustedProviders.jsp (rev 0)
+++ identity-federation/trunk/jboss-identity-samples/circleoftrust/resources/idpTrustedProviders.jsp 2009-05-04 18:16:51 UTC (rev 476)
@@ -0,0 +1,24 @@
+<%@ page import="java.util.*" %>
+
+<div align="center">
+Trusted Providers for the Identity Provider:<%=session.getAttribute("idpName")%> <br/>
+
+<%
+ HashMap<String,String> trustedProviders = (HashMap<String,String>)session.getAttribute("providers");
+ if(trustedProviders != null)
+ {
+ Set<String> keys = trustedProviders.keySet();
+ for(String key: keys)
+ {
+ out.println("TrustedProvider="+key);
+ }
+ }
+
+ //Remove the session attributes
+ session.removeAttribute("idpName");
+ session.removeAttribute("providers");
+%>
+<br/>
+<a href="<%=request.getContextPath()%>/index.jsp">Back</a>
+</div>
+</form>
Modified: identity-federation/trunk/jboss-identity-samples/circleoftrust/resources/index.jsp
===================================================================
--- identity-federation/trunk/jboss-identity-samples/circleoftrust/resources/index.jsp 2009-05-03 21:30:15 UTC (rev 475)
+++ identity-federation/trunk/jboss-identity-samples/circleoftrust/resources/index.jsp 2009-05-04 18:16:51 UTC (rev 476)
@@ -1,2 +1,6 @@
+<div align="center">
+Circle Of Trust <br/>
<a href="sp.jsp">Configure a SP</a> <br/>
-<a href="idp.jsp">Configure an IDP</a>
+<a href="idp.jsp">Configure an IDP</a> <br/>
+<a href="trustedproviders.jsp">Display trusted providers</a><br/>
+</div>
Modified: identity-federation/trunk/jboss-identity-samples/circleoftrust/resources/sp.jsp
===================================================================
--- identity-federation/trunk/jboss-identity-samples/circleoftrust/resources/sp.jsp 2009-05-03 21:30:15 UTC (rev 475)
+++ identity-federation/trunk/jboss-identity-samples/circleoftrust/resources/sp.jsp 2009-05-04 18:16:51 UTC (rev 476)
@@ -1,13 +1,16 @@
Configure a Service Provider <br/>
<form name="add_idp" action="/circleoftrust/COTServlet" method="post">
+<div align="center">
+
Name of the Service Provider:
<input type="text" name="spname" value="ENTER SP NAME" /> <br/>
IDPName:
<input type="text" name="idpname" value="ENTER IDP NAME" /> <br/>
-Metadata URL:
+Metadata URL of Identity Provider:
<input type="text" name="metadataURL" value="ENTER Metadata URL" /> <br/>
<input type="hidden" name="type" value="sp" /> <br/>
<input type="hidden" name="action" value="add" /> <br/>
<input type="submit" value="Submit" /> <br/>
+</div>
</form>
Added: identity-federation/trunk/jboss-identity-samples/circleoftrust/resources/spTrustedProviders.jsp
===================================================================
--- identity-federation/trunk/jboss-identity-samples/circleoftrust/resources/spTrustedProviders.jsp (rev 0)
+++ identity-federation/trunk/jboss-identity-samples/circleoftrust/resources/spTrustedProviders.jsp 2009-05-04 18:16:51 UTC (rev 476)
@@ -0,0 +1,24 @@
+<%@ page import="java.util.*" %>
+
+<div align="center">
+Trusted Providers for the Service Provider:<%=session.getAttribute("spName")%> <br/>
+
+<%
+ HashMap<String,String> trustedProviders = (HashMap<String,String>)session.getAttribute("providers");
+ if(trustedProviders != null)
+ {
+ Set<String> keys = trustedProviders.keySet();
+ for(String key: keys)
+ {
+ out.println("TrustedProvider="+key);
+ }
+ }
+
+ //Remove the session attributes
+ session.removeAttribute("spName");
+ session.removeAttribute("providers");
+%>
+<br/>
+<a href="<%=request.getContextPath()%>/index.jsp">Back</a>
+</div>
+</form>
Added: identity-federation/trunk/jboss-identity-samples/circleoftrust/resources/trustedproviders.jsp
===================================================================
--- identity-federation/trunk/jboss-identity-samples/circleoftrust/resources/trustedproviders.jsp (rev 0)
+++ identity-federation/trunk/jboss-identity-samples/circleoftrust/resources/trustedproviders.jsp 2009-05-04 18:16:51 UTC (rev 476)
@@ -0,0 +1,13 @@
+
+<form name="display_trusted_providers" action="/circleoftrust/COTServlet" method="post">
+<div align="center">
+Display Trusted Provider <br/>
+Choose Type:
+<input type="radio" name="type" value="sp"> Service Provider
+<input type="radio" name="type" value="idp" checked> Identity Provider<br>
+Name:
+<input type="text" name="name" value="ENTER NAME" /> <br/>
+<input type="hidden" name="action" value="display_trusted_providers" /> <br/>
+<input type="submit" value="Display Trusted Providers" /> <br/>
+</div>
+</form>
15 years, 9 months