[jboss-cvs] Picketlink SVN: r800 - in idm/trunk: picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration and 16 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Mar 9 04:22:33 EST 2011


Author: bdaw
Date: 2011-03-09 04:22:33 -0500 (Wed, 09 Mar 2011)
New Revision: 800

Added:
   idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/stax/
   idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/stax/ParserUtil.java
   idm/trunk/picketlink-idm-core/src/test/java/org/picketlink/idm/impl/configuration/stax/
   idm/trunk/picketlink-idm-core/src/test/java/org/picketlink/idm/impl/configuration/stax/ParserUtilTestCase.java
   idm/trunk/picketlink-idm-core/src/test/resources/config/
   idm/trunk/picketlink-idm-core/src/test/resources/config/parse-attributes.xml
   idm/trunk/picketlink-idm-core/src/test/resources/config/parse-options.xml
   idm/trunk/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/configuration/
   idm/trunk/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/configuration/ldap/
   idm/trunk/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/configuration/ldap/metadata/
   idm/trunk/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/configuration/ldap/metadata/LDAPGroupMetaDataImpl.java
   idm/trunk/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/configuration/ldap/metadata/LDAPIdentityObjectTypeMetaDataImpl.java
   idm/trunk/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/configuration/ldap/metadata/LDAPStoreMetaDataImpl.java
   idm/trunk/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/configuration/ldap/metadata/LDAPUserMetaDataImpl.java
   idm/trunk/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/configuration/ldap/template/
   idm/trunk/picketlink-idm-ldap/src/test/java/org/picketlink/idm/impl/configuration/
   idm/trunk/picketlink-idm-ldap/src/test/java/org/picketlink/idm/impl/configuration/ldap/
   idm/trunk/picketlink-idm-ldap/src/test/java/org/picketlink/idm/impl/configuration/ldap/LDAPConfigTestCase.java
   idm/trunk/picketlink-idm-ldap/src/test/resources/config/
   idm/trunk/picketlink-idm-ldap/src/test/resources/config/ldap/
   idm/trunk/picketlink-idm-ldap/src/test/resources/config/ldap/ldap-config.xml
Modified:
   idm/trunk/picketlink-idm-core/pom.xml
   idm/trunk/picketlink-idm-ldap/pom.xml
Log:
- start for simpler config and stax

Modified: idm/trunk/picketlink-idm-core/pom.xml
===================================================================
--- idm/trunk/picketlink-idm-core/pom.xml	2011-03-08 22:42:15 UTC (rev 799)
+++ idm/trunk/picketlink-idm-core/pom.xml	2011-03-09 09:22:33 UTC (rev 800)
@@ -61,6 +61,11 @@
       <version>3.2.76</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>staxnav</groupId>
+      <artifactId>staxnav</artifactId>
+      <version>1.1-SNAPSHOT</version>
+    </dependency>
 
   </dependencies>
 

Added: idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/stax/ParserUtil.java
===================================================================
--- idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/stax/ParserUtil.java	                        (rev 0)
+++ idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/stax/ParserUtil.java	2011-03-09 09:22:33 UTC (rev 800)
@@ -0,0 +1,170 @@
+package org.picketlink.idm.impl.configuration.stax;
+/**
+ * JBoss, Home of Professional Open Source 
+ * Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @author tags. All rights reserved. 
+ * See the copyright.txt in the distribution for a 
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use, 
+ * modify, copy, or redistribute it subject to the terms and conditions 
+ * of the GNU Lesser General Public License, v. 2.1. 
+ * This program is distributed in the hope that it will be useful, but WITHOUT A 
+ * 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, 
+ * v.2.1 along with this distribution; if not, write to the Free Software 
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ */
+
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.picketlink.idm.impl.api.attribute.IdentityObjectAttributeMetaDataImpl;
+import org.picketlink.idm.spi.configuration.metadata.IdentityObjectAttributeMetaData;
+import org.staxnav.StaxNavigator;
+
+/**
+ * Helper class for parsing common parts of different config files
+ *
+ * @author Boleslaw Dawidowicz
+ */
+public class ParserUtil
+{
+
+   /**
+    * Parse content of <options> element.
+    *
+    * <options>
+    *    <option>
+    *       <name></name>
+    *       <value></value>
+    *       <value></value>
+    *    </option>
+    *    ...
+    *
+    * @param nav
+    * @return
+    */
+   static Map<String, List<String>> parseOptions(StaxNavigator<String> nav)
+   {
+      Map<String, List<String>> options = new HashMap<String, List<String>>();
+
+      for (StaxNavigator<String> fork : nav.fork("option"))
+      {
+         String name = null;
+         List<String> values = new LinkedList<String>();
+
+
+         while(fork.hasNext())
+         {
+            String tag = fork.next();
+
+            if (tag.equals("name"))
+            {
+               name = fork.getContent();
+            }
+            else if (tag.equals("value"))
+            {
+               values.add(fork.getContent());
+            }
+         }
+
+         if (name != null && name.length() > 0)
+         {
+            options.put(name, values);
+         }
+      }
+
+      return options;
+   }
+
+   /**
+    * Parse content of <attributes> element.
+    *   <attributes>
+    *    <attribute>
+    *     <name>picture</name>
+    *     <mapping>user.picture</mapping>
+    *     <type>binary</type>
+    *     <isRequired>false</isRequired>
+    *     <isMultivalued>false</isMultivalued>
+    *     <isReadOnly>false</isReadOnly>
+    *   </attribute>
+    *   ...
+    *
+    * @param nav
+    * @return
+    */
+   static List<IdentityObjectAttributeMetaData> parseAttributes(StaxNavigator<String> nav)
+   {
+
+
+      List<IdentityObjectAttributeMetaData> attributes = new LinkedList<IdentityObjectAttributeMetaData>();
+
+      for (StaxNavigator<String> fork : nav.fork("attribute"))
+      {
+
+         // Use some good defaults
+         String name = null;
+         String mapping = null;
+         String type = "text";
+         boolean isRequired = false;
+         boolean isMultivalued = false;
+         boolean isReadOnly = false;
+         boolean isUnique = false;
+
+         while(fork.hasNext())
+         {
+            String tag = fork.next();
+
+            if (tag.equals("name"))
+            {
+               name = fork.getContent();
+            }
+            else if (tag.equals("mapping"))
+            {
+               mapping = fork.getContent();
+            }
+            else if (tag.equals("type"))
+            {
+               type = fork.getContent();
+            }
+            else if (tag.equals("isRequired"))
+            {
+               isRequired = Boolean.valueOf(fork.getContent());
+            }
+            else if (tag.equals("isMultivalued"))
+            {
+               isMultivalued = Boolean.valueOf(fork.getContent());
+            }
+            else if (tag.equals("isReadOnly"))
+            {
+               isReadOnly = Boolean.valueOf(fork.getContent());
+            }
+            else if (tag.equals("isUnique"))
+            {
+               isUnique = Boolean.valueOf(fork.getContent());
+            }
+         }
+
+         if (name != null && name.length() > 0)
+         {
+            attributes.add(new
+               IdentityObjectAttributeMetaDataImpl(name, mapping, type, isReadOnly, isMultivalued, isRequired, isUnique));
+         }
+      }
+
+      return attributes;
+   }
+
+
+   public enum Element
+   {
+      NAME, VALUE;
+   }
+
+}

Added: idm/trunk/picketlink-idm-core/src/test/java/org/picketlink/idm/impl/configuration/stax/ParserUtilTestCase.java
===================================================================
--- idm/trunk/picketlink-idm-core/src/test/java/org/picketlink/idm/impl/configuration/stax/ParserUtilTestCase.java	                        (rev 0)
+++ idm/trunk/picketlink-idm-core/src/test/java/org/picketlink/idm/impl/configuration/stax/ParserUtilTestCase.java	2011-03-09 09:22:33 UTC (rev 800)
@@ -0,0 +1,101 @@
+package org.picketlink.idm.impl.configuration.stax;
+
+import java.io.InputStream;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+import org.picketlink.idm.spi.configuration.metadata.IdentityObjectAttributeMetaData;
+import org.staxnav.Naming;
+import org.staxnav.StaxNavigatorImpl;
+
+/**
+ * JBoss, Home of Professional Open Source 
+ * Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @author tags. All rights reserved. 
+ * See the copyright.txt in the distribution for a 
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use, 
+ * modify, copy, or redistribute it subject to the terms and conditions 
+ * of the GNU Lesser General Public License, v. 2.1. 
+ * This program is distributed in the hope that it will be useful, but WITHOUT A 
+ * 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, 
+ * v.2.1 along with this distribution; if not, write to the Free Software 
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ */
+public class ParserUtilTestCase extends TestCase
+{
+
+    /** . */
+   private StaxNavigatorImpl<String> navigator;
+
+   @Override
+   protected void setUp() throws Exception
+   {
+
+   }
+
+   public void testOptions() throws Exception
+   {
+      InputStream is = ClassLoader.getSystemClassLoader().getResourceAsStream("config/parse-options.xml");
+      XMLInputFactory factory = XMLInputFactory.newInstance();
+      XMLStreamReader stream = factory.createXMLStreamReader(is);
+
+      //
+      navigator = new StaxNavigatorImpl<String>(new Naming.Local(), stream);
+
+
+      assertTrue(navigator.child("options"));
+      Map<String, List<String>> options = ParserUtil.parseOptions(navigator);
+
+      assertEquals(3, options.size());
+      assertEquals(4, options.get("opt-c").size());
+
+
+
+
+   }
+
+   public void testAttributess() throws Exception
+   {
+
+      InputStream is = ClassLoader.getSystemClassLoader().getResourceAsStream("config/parse-attributes.xml");
+      XMLInputFactory factory = XMLInputFactory.newInstance();
+      XMLStreamReader stream = factory.createXMLStreamReader(is);
+
+      //
+      navigator = new StaxNavigatorImpl<String>(new Naming.Local(), stream);
+
+
+      assertTrue(navigator.child("attributes"));
+      List<IdentityObjectAttributeMetaData> attrs = ParserUtil.parseAttributes(navigator);
+
+      assertEquals(3, attrs.size());
+
+      IdentityObjectAttributeMetaData attr = attrs.get(0);
+      assertEquals("picture", attr.getName());
+      assertEquals("user.picture", attr.getStoreMapping());
+      assertEquals("binary", attr.getType());
+      assertEquals(false, attr.isReadonly());
+
+      attr = attrs.get(1);
+      assertEquals("email", attr.getName());
+      assertEquals("mail", attr.getStoreMapping());
+      assertEquals("text", attr.getType());
+      assertEquals(false, attr.isReadonly());
+
+      attr = attrs.get(2);
+      assertEquals("description", attr.getName());
+      assertEquals("description", attr.getStoreMapping());
+      assertEquals("text", attr.getType());
+      assertEquals(true, attr.isReadonly());
+
+   }
+}

Added: idm/trunk/picketlink-idm-core/src/test/resources/config/parse-attributes.xml
===================================================================
--- idm/trunk/picketlink-idm-core/src/test/resources/config/parse-attributes.xml	                        (rev 0)
+++ idm/trunk/picketlink-idm-core/src/test/resources/config/parse-attributes.xml	2011-03-09 09:22:33 UTC (rev 800)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<config>
+  <attributes>
+    <attribute>
+      <name>picture</name>
+      <mapping>user.picture</mapping>
+      <type>binary</type>
+      <isRequired>false</isRequired>
+      <isMultivalued>false</isMultivalued>
+      <isReadOnly>false</isReadOnly>
+    </attribute>
+    <attribute>
+      <name>email</name>
+      <mapping>mail</mapping>
+      <type>text</type>
+      <isRequired>false</isRequired>
+      <isMultivalued>false</isMultivalued>
+      <isReadOnly>false</isReadOnly>
+      <isUnique>true</isUnique>
+    </attribute>
+    <attribute>
+      <name>description</name>
+      <mapping>description</mapping>
+      <isReadOnly>true</isReadOnly>
+    </attribute>
+  </attributes>
+</config>
\ No newline at end of file

Added: idm/trunk/picketlink-idm-core/src/test/resources/config/parse-options.xml
===================================================================
--- idm/trunk/picketlink-idm-core/src/test/resources/config/parse-options.xml	                        (rev 0)
+++ idm/trunk/picketlink-idm-core/src/test/resources/config/parse-options.xml	2011-03-09 09:22:33 UTC (rev 800)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<config>
+  <options>
+    <option>
+      <name>opt-a</name>
+      <value>value-a</value>
+    </option>
+    <option>
+      <name>opt-b</name>
+      <value>value-a</value>
+      <value>value-b</value>
+      <value>value-c</value>
+    </option>
+    <option>
+      <name>opt-c</name>
+      <value>value-a</value>
+      <value>value-b</value>
+      <value>value-c</value>
+      <value>value-d</value>
+    </option>
+  </options>
+</config>
\ No newline at end of file

Modified: idm/trunk/picketlink-idm-ldap/pom.xml
===================================================================
--- idm/trunk/picketlink-idm-ldap/pom.xml	2011-03-08 22:42:15 UTC (rev 799)
+++ idm/trunk/picketlink-idm-ldap/pom.xml	2011-03-09 09:22:33 UTC (rev 800)
@@ -37,6 +37,12 @@
     </dependency>
 
     <dependency>
+      <groupId>staxnav</groupId>
+      <artifactId>staxnav</artifactId>
+      <version>1.1-SNAPSHOT</version>
+    </dependency>
+
+    <dependency>
       <groupId>org.jboss.unit</groupId>
       <artifactId>jboss-unit</artifactId>
       <version>1.2.2</version>

Added: idm/trunk/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/configuration/ldap/metadata/LDAPGroupMetaDataImpl.java
===================================================================
--- idm/trunk/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/configuration/ldap/metadata/LDAPGroupMetaDataImpl.java	                        (rev 0)
+++ idm/trunk/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/configuration/ldap/metadata/LDAPGroupMetaDataImpl.java	2011-03-09 09:22:33 UTC (rev 800)
@@ -0,0 +1,23 @@
+package org.picketlink.idm.impl.configuration.ldap.metadata;
+
+/**
+ * JBoss, Home of Professional Open Source 
+ * Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @author tags. All rights reserved. 
+ * See the copyright.txt in the distribution for a 
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use, 
+ * modify, copy, or redistribute it subject to the terms and conditions 
+ * of the GNU Lesser General Public License, v. 2.1. 
+ * This program is distributed in the hope that it will be useful, but WITHOUT A 
+ * 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, 
+ * v.2.1 along with this distribution; if not, write to the Free Software 
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ */
+public class LDAPGroupMetaDataImpl
+{
+}

Added: idm/trunk/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/configuration/ldap/metadata/LDAPIdentityObjectTypeMetaDataImpl.java
===================================================================
--- idm/trunk/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/configuration/ldap/metadata/LDAPIdentityObjectTypeMetaDataImpl.java	                        (rev 0)
+++ idm/trunk/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/configuration/ldap/metadata/LDAPIdentityObjectTypeMetaDataImpl.java	2011-03-09 09:22:33 UTC (rev 800)
@@ -0,0 +1,23 @@
+package org.picketlink.idm.impl.configuration.ldap.metadata;
+
+/**
+ * JBoss, Home of Professional Open Source 
+ * Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @author tags. All rights reserved. 
+ * See the copyright.txt in the distribution for a 
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use, 
+ * modify, copy, or redistribute it subject to the terms and conditions 
+ * of the GNU Lesser General Public License, v. 2.1. 
+ * This program is distributed in the hope that it will be useful, but WITHOUT A 
+ * 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, 
+ * v.2.1 along with this distribution; if not, write to the Free Software 
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ */
+public class LDAPIdentityObjectTypeMetaDataImpl
+{
+}

Added: idm/trunk/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/configuration/ldap/metadata/LDAPStoreMetaDataImpl.java
===================================================================
--- idm/trunk/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/configuration/ldap/metadata/LDAPStoreMetaDataImpl.java	                        (rev 0)
+++ idm/trunk/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/configuration/ldap/metadata/LDAPStoreMetaDataImpl.java	2011-03-09 09:22:33 UTC (rev 800)
@@ -0,0 +1,30 @@
+package org.picketlink.idm.impl.configuration.ldap.metadata;
+
+/**
+ * JBoss, Home of Professional Open Source 
+ * Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @author tags. All rights reserved. 
+ * See the copyright.txt in the distribution for a 
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use, 
+ * modify, copy, or redistribute it subject to the terms and conditions 
+ * of the GNU Lesser General Public License, v. 2.1. 
+ * This program is distributed in the hope that it will be useful, but WITHOUT A 
+ * 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, 
+ * v.2.1 along with this distribution; if not, write to the Free Software 
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ */
+
+
+/**
+ * Simple MetaData to represent LDAP Identity Store configuration
+ */
+public class LDAPStoreMetaDataImpl
+{
+
+
+}

Added: idm/trunk/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/configuration/ldap/metadata/LDAPUserMetaDataImpl.java
===================================================================
--- idm/trunk/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/configuration/ldap/metadata/LDAPUserMetaDataImpl.java	                        (rev 0)
+++ idm/trunk/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/configuration/ldap/metadata/LDAPUserMetaDataImpl.java	2011-03-09 09:22:33 UTC (rev 800)
@@ -0,0 +1,23 @@
+package org.picketlink.idm.impl.configuration.ldap.metadata;
+
+/**
+ * JBoss, Home of Professional Open Source 
+ * Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @author tags. All rights reserved. 
+ * See the copyright.txt in the distribution for a 
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use, 
+ * modify, copy, or redistribute it subject to the terms and conditions 
+ * of the GNU Lesser General Public License, v. 2.1. 
+ * This program is distributed in the hope that it will be useful, but WITHOUT A 
+ * 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, 
+ * v.2.1 along with this distribution; if not, write to the Free Software 
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ */
+public class LDAPUserMetaDataImpl
+{
+}

Added: idm/trunk/picketlink-idm-ldap/src/test/java/org/picketlink/idm/impl/configuration/ldap/LDAPConfigTestCase.java
===================================================================
--- idm/trunk/picketlink-idm-ldap/src/test/java/org/picketlink/idm/impl/configuration/ldap/LDAPConfigTestCase.java	                        (rev 0)
+++ idm/trunk/picketlink-idm-ldap/src/test/java/org/picketlink/idm/impl/configuration/ldap/LDAPConfigTestCase.java	2011-03-09 09:22:33 UTC (rev 800)
@@ -0,0 +1,47 @@
+package org.picketlink.idm.impl.configuration.ldap;
+
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+import org.staxnav.Naming;
+import org.staxnav.StaxNavigatorImpl;
+
+/**
+ * JBoss, Home of Professional Open Source 
+ * Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @author tags. All rights reserved. 
+ * See the copyright.txt in the distribution for a 
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use, 
+ * modify, copy, or redistribute it subject to the terms and conditions 
+ * of the GNU Lesser General Public License, v. 2.1. 
+ * This program is distributed in the hope that it will be useful, but WITHOUT A 
+ * 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, 
+ * v.2.1 along with this distribution; if not, write to the Free Software 
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ */
+public class LDAPConfigTestCase extends TestCase
+{
+
+    /** . */
+   private StaxNavigatorImpl<String> navigator;
+
+   @Override
+   protected void setUp() throws Exception
+   {
+      InputStream is = ClassLoader.getSystemClassLoader().getResourceAsStream("portlet-application.xml");
+      XMLInputFactory factory = XMLInputFactory.newInstance();
+      XMLStreamReader stream = factory.createXMLStreamReader(is);
+
+      //
+      navigator = new StaxNavigatorImpl<String>(new Naming.Local(), stream);
+   }
+
+}

Added: idm/trunk/picketlink-idm-ldap/src/test/resources/config/ldap/ldap-config.xml
===================================================================
--- idm/trunk/picketlink-idm-ldap/src/test/resources/config/ldap/ldap-config.xml	                        (rev 0)
+++ idm/trunk/picketlink-idm-ldap/src/test/resources/config/ldap/ldap-config.xml	2011-03-09 09:22:33 UTC (rev 800)
@@ -0,0 +1,179 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<stores>
+  <ldap>
+    <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>
+      <option>
+        <name>createMissingContexts</name>
+        <value>true</value>
+      </option>
+      <option>
+        <name>cache.providerClass</name>
+        <value>org.picketlink.idm.impl.cache.JBossCacheIdentityStoreCacheProviderImpl</value>
+      </option>
+      <option>
+        <name>cache.configFile</name>
+        <value>jboss-cache.xml</value>
+      </option>
+      <option>
+        <name>pagedResultsExtensionSupported</name>
+        <value>true</value>
+      </option>
+      <option>
+        <name>pagedResultsExtensionSize</name>
+        <value>1</value>
+      </option>
+    </options>
+    <user>
+      <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>true</isReadOnly>
+        </attribute>
+        <attribute>
+          <name>carLicense</name>
+          <mapping>carLicense</mapping>
+          <type>text</type>
+          <isRequired>false</isRequired>
+          <isMultivalued>false</isMultivalued>
+          <isReadOnly>false</isReadOnly>
+        </attribute>
+        <attribute>
+          <name>email</name>
+          <mapping>mail</mapping>
+          <type>text</type>
+          <isRequired>false</isRequired>
+          <isMultivalued>false</isMultivalued>
+          <isReadOnly>false</isReadOnly>
+          <isUnique>true</isUnique>
+        </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,o=trunk,o=idm,o=jbid,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>
+    </user>
+    <groups>
+      <group>
+        <name>FOO</name>
+        <mapping></mapping>
+        <attributes/>
+        <options>
+          <option>
+            <name>idAttributeName</name>
+            <value>cn</value>
+          </option>
+          <option>
+            <name>ctxDNs</name>
+            <value>ou=Foo,o=test,o=trunk,o=idm,o=jbid,dc=example,dc=com</value>
+          </option>
+          <option>
+            <name>allowCreateEntry</name>
+            <value>true</value>
+          </option>
+          <option>
+            <name>parentMembershipAttributeName</name>
+            <value>member</value>
+          </option>
+          <option>
+            <name>isParentMembershipAttributeDN</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>
+      </group>
+      <group>
+        <name>BAR</name>
+        <mapping></mapping>
+        <attributes/>
+        <options>
+          <option>
+            <name>idAttributeName</name>
+            <value>cn</value>
+          </option>
+          <option>
+            <name>ctxDNs</name>
+            <value>ou=Bar,o=test,o=trunk,o=idm,o=jbid,dc=example,dc=com</value>
+          </option>
+          <option>
+            <name>allowCreateEntry</name>
+            <value>true</value>
+          </option>
+          <option>
+            <name>parentMembershipAttributeName</name>
+            <value>member</value>
+          </option>
+          <option>
+            <name>isParentMembershipAttributeDN</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>
+      </group>
+    </groups>
+  </ldap>
+</stores>



More information about the jboss-cvs-commits mailing list