JBoss Portal SVN: r6213 - trunk.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-02-12 10:10:03 -0500 (Mon, 12 Feb 2007)
New Revision: 6213
Added:
trunk/core-search/
Removed:
trunk/portal-search/
Log:
Renaming portal-search to core-search
Copied: trunk/core-search (from rev 6212, trunk/portal-search)
19 years, 2 months
JBoss Portal SVN: r6212 - in trunk: cms/src/main/org/jboss/portal/cms/impl/jcr/command and 10 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-02-12 10:01:24 -0500 (Mon, 12 Feb 2007)
New Revision: 6212
Added:
trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestSearch.java
trunk/portal-search/src/resources/portal-search-war/WEB-INF/web.xml
trunk/search/src/main/org/jboss/portal/search/test/ConverterTest.java
Modified:
trunk/cms/build.xml
trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/SearchCommand.java
trunk/cms/src/resources/test/jcr/fs-repository.xml
trunk/cms/src/resources/test/jcr/repository.xml
trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
trunk/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties
trunk/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource_fr.properties
trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/searchResults.jsp
trunk/portal-search/.project
trunk/portal-search/build.xml
trunk/search/src/main/org/jboss/portal/search/QueryConverter.java
trunk/search/src/main/org/jboss/portal/search/federated/jcr/JCRQueryConverter.java
Log:
- Adding test cases
- Adding language property key CMS_SEARCHNORESULT
- Renaming portal-search project -> core-search
Modified: trunk/cms/build.xml
===================================================================
--- trunk/cms/build.xml 2007-02-11 21:18:06 UTC (rev 6211)
+++ trunk/cms/build.xml 2007-02-12 15:01:24 UTC (rev 6212)
@@ -391,13 +391,13 @@
</x-sysproperty>
<x-test>
<!-- general cms setup related tests -->
- <test todir="${test.reports}" name="org.jboss.portal.test.cms.JackrabbitTestCase"/>
+ <!--test todir="${test.reports}" name="org.jboss.portal.test.cms.JackrabbitTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.TestRepositoryBootStrap"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.TestRegEx"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.cms.TestRepositoryUtil"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.cms.TestRepositoryUtil"/-->
<!-- cms file command tests -->
- <test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileCreate"/>
+ <!--test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileCreate"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileUpdate"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileArchiveUpload"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileGet"/>
@@ -405,14 +405,15 @@
<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileGetList"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileCopy"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileCreateFailed"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileDelete"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileDelete"/-->
+ <test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestSearch"/>
<!-- cms folder command tests -->
- <test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFolderCopy"/>
+ <!--test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFolderCopy"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFolderCreate"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFolderDelete"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFolderGet"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFolderUpdate"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFolderUpdate"/-->
<!-- cms fine grained security related tests -->
<!--test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestSecureFileGet"/-->
@@ -442,6 +443,7 @@
<path refid="cglib.cglib.classpath"/>
<path refid="jboss.portal-common.classpath"/>
<path refid="jboss.portal-test.classpath"/>
+ <path refid="jboss.portal-search.classpath"/>
<path refid="jboss.portal-server.classpath"/>
<path refid="jboss.portal-jems.classpath"/>
<pathelement location="${build.lib}/portal-cms-lib.jar"/>
@@ -451,6 +453,7 @@
<pathelement location="${jboss.portal-test.root}/etc"/>
<!-- jbosscachepersistence manager integration -->
<path refid="jackrabbit.jackrabbit.classpath"/>
+ <path refid="nekohtml.nekohtml.classpath"/>
<path refid="jboss.cache.classpath"/>
<path refid="jgroups.jgroups.classpath"/>
<!-- fine grained security integration -->
Modified: trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/SearchCommand.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/SearchCommand.java 2007-02-11 21:18:06 UTC (rev 6211)
+++ trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/SearchCommand.java 2007-02-12 15:01:24 UTC (rev 6212)
@@ -65,21 +65,26 @@
try
{
queryManager = workspace.getQueryManager();
- javax.jcr.query.Query jcrQuery = queryManager.createQuery(JCRQueryConverter.convert(query), javax.jcr.query.Query.XPATH);
- QueryResult queryResult=jcrQuery.execute();
- NodeIterator nodeIterator = queryResult.getNodes();
+ String queryString = JCRQueryConverter.convert(query);
- while (nodeIterator.hasNext())
+ if (! "".equals(queryString))
{
- Node node;
- node = nodeIterator.nextNode().getParent();
- File file = new FileImpl();
- file.setBasePath(node.getPath());
- file.setCreationDate(node.getProperty("jcr:created").getDate().getTime());
- file.setLastModified(node.getProperty("jcr:lastModified").getDate().getTime());
- file.setName(node.getName());
- files.add(file);
- }
+ javax.jcr.query.Query jcrQuery = queryManager.createQuery(queryString, javax.jcr.query.Query.XPATH);
+ QueryResult queryResult=jcrQuery.execute();
+ NodeIterator nodeIterator = queryResult.getNodes();
+
+ while (nodeIterator.hasNext())
+ {
+ Node node;
+ node = nodeIterator.nextNode().getParent();
+ File file = new FileImpl();
+ file.setBasePath(node.getPath());
+ file.setCreationDate(node.getProperty("jcr:created").getDate().getTime());
+ file.setLastModified(node.getProperty("jcr:lastModified").getDate().getTime());
+ file.setName(node.getName());
+ files.add(file);
+ }
+ }
}
catch (Exception e)
{
Added: trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestSearch.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestSearch.java (rev 0)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestSearch.java 2007-02-12 15:01:24 UTC (rev 6212)
@@ -0,0 +1,68 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.cms.commands;
+
+import junit.framework.TestSuite;
+import org.jboss.portal.cms.CMSException;
+import org.jboss.portal.cms.Command;
+import org.jboss.portal.cms.impl.ContentImpl;
+import org.jboss.portal.cms.impl.FileImpl;
+import org.jboss.portal.cms.model.Content;
+import org.jboss.portal.cms.model.File;
+import org.jboss.portal.search.query.Query;
+import org.jboss.portal.search.query.impl.KeywordQueryTerm;
+
+import java.util.List;
+import java.util.Locale;
+
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ */
+public class TestSearch extends AbstractCommandTestCase
+{
+
+ public TestSearch()
+ {
+ }
+
+ public static TestSuite suite() throws Exception
+ {
+ return createTestSuite(TestSearch.class);
+ }
+
+ /** Tests retrieval of the version labeled LIVE. */
+ public void testFileGet() throws CMSException
+ {
+ Query query = new Query();
+ query.addOptionalTerm(new KeywordQueryTerm("risks"));
+ Command searchCMD = service.getCommandFactory().createSearchCommand(query);
+ List list = (List)service.execute(searchCMD);
+
+ File file = (File)list.get(0);
+ assertEquals("/default/private/license.html", file.getBasePath());
+ file = (File)list.get(1);
+ assertEquals("/default/support.html", file.getBasePath());
+ }
+
+}
Modified: trunk/cms/src/resources/test/jcr/fs-repository.xml
===================================================================
--- trunk/cms/src/resources/test/jcr/fs-repository.xml 2007-02-11 21:18:06 UTC (rev 6211)
+++ trunk/cms/src/resources/test/jcr/fs-repository.xml 2007-02-12 15:01:24 UTC (rev 6212)
@@ -39,18 +39,27 @@
<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
<param name="path" value="${wsp.home}s"/>
</FileSystem>
- <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
- <param name="path" value="${wsp.home}/index"/>
- <param name="useCompoundFile" value="true"/>
- <param name="minMergeDocs" value="100"/>
- <param name="volatileIdleTime" value="3"/>
- <param name="maxMergeDocs" value="100000"/>
- <param name="mergeFactor" value="10"/>
- <param name="bufferSize" value="10"/>
- <param name="cacheSize" value="1000"/>
- <param name="forceConsistencyCheck" value="false"/>
- <param name="autoRepair" value="true"/>
- </SearchIndex>
+ <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+ <param name="path" value="${wsp.home}/index"/>
+ <param name="textFilterClasses" value="
+ org.apache.jackrabbit.core.query.MsExcelTextFilter,
+ org.apache.jackrabbit.core.query.MsPowerPointTextFilter,
+ org.apache.jackrabbit.core.query.MsWordTextFilter,
+ org.apache.jackrabbit.core.query.PdfTextFilter,
+ org.apache.jackrabbit.core.query.HTMLTextFilter,
+ org.apache.jackrabbit.core.query.XMLTextFilter,
+ org.apache.jackrabbit.core.query.RTFTextFilter,
+ org.apache.jackrabbit.core.query.OpenOfficeTextFilter" />
+ <param name="useCompoundFile" value="true"/>
+ <param name="minMergeDocs" value="100"/>
+ <param name="volatileIdleTime" value="3"/>
+ <param name="maxMergeDocs" value="100000"/>
+ <param name="mergeFactor" value="10"/>
+ <param name="bufferSize" value="10"/>
+ <param name="cacheSize" value="1000"/>
+ <param name="forceConsistencyCheck" value="false"/>
+ <param name="autoRepair" value="true"/>
+ </SearchIndex>
</Workspace>
<Versioning rootPath="${rep.home}/versions">
<PersistenceManager class="org.apache.jackrabbit.core.state.xml.XMLPersistenceManager"/>
Modified: trunk/cms/src/resources/test/jcr/repository.xml
===================================================================
--- trunk/cms/src/resources/test/jcr/repository.xml 2007-02-11 21:18:06 UTC (rev 6211)
+++ trunk/cms/src/resources/test/jcr/repository.xml 2007-02-12 15:01:24 UTC (rev 6212)
@@ -75,18 +75,27 @@
<!-- XMLPersistenceManager: uses FileSystem for storage -->
<!--<PersistenceManager class="org.apache.jackrabbit.core.state.xml.XMLPersistenceManager"/>-->
- <!--SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
- <param name="path" value="${wsp.home}/index"/>
- <param name="useCompoundFile" value="true"/>
- <param name="minMergeDocs" value="100"/>
- <param name="volatileIdleTime" value="3"/>
- <param name="maxMergeDocs" value="100000"/>
- <param name="mergeFactor" value="10"/>
- <param name="bufferSize" value="10"/>
- <param name="cacheSize" value="1000"/>
- <param name="forceConsistencyCheck" value="false"/>
- <param name="autoRepair" value="true"/>
- </SearchIndex-->
+ <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+ <param name="path" value="${wsp.home}/index"/>
+ <param name="textFilterClasses" value="
+ org.apache.jackrabbit.core.query.MsExcelTextFilter,
+ org.apache.jackrabbit.core.query.MsPowerPointTextFilter,
+ org.apache.jackrabbit.core.query.MsWordTextFilter,
+ org.apache.jackrabbit.core.query.PdfTextFilter,
+ org.apache.jackrabbit.core.query.HTMLTextFilter,
+ org.apache.jackrabbit.core.query.XMLTextFilter,
+ org.apache.jackrabbit.core.query.RTFTextFilter,
+ org.apache.jackrabbit.core.query.OpenOfficeTextFilter" />
+ <param name="useCompoundFile" value="true"/>
+ <param name="minMergeDocs" value="100"/>
+ <param name="volatileIdleTime" value="3"/>
+ <param name="maxMergeDocs" value="100000"/>
+ <param name="mergeFactor" value="10"/>
+ <param name="bufferSize" value="10"/>
+ <param name="cacheSize" value="1000"/>
+ <param name="forceConsistencyCheck" value="false"/>
+ <param name="autoRepair" value="true"/>
+ </SearchIndex>
</Workspace>
<Versioning rootPath="${rep.home}/versions">
<!--
Modified: trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
===================================================================
--- trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2007-02-11 21:18:06 UTC (rev 6211)
+++ trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2007-02-12 15:01:24 UTC (rev 6212)
@@ -25,6 +25,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashSet;
@@ -96,6 +97,7 @@
private MembershipModule membershipModule;
private ApprovePublish approvePublish;
private AuthorizationManager authorizationManager;
+
public void init() throws PortletException
{
@@ -309,10 +311,19 @@
String textQuery = rReq.getParameter("search");
Query query = QueryConverter.convert(textQuery);
- Command searchCommand = CMSService.getCommandFactory().createSearchCommand(query);
-
- List files = (List)CMSService.execute(searchCommand);
+ List files;
+ try
+ {
+ Command searchCommand = CMSService.getCommandFactory().createSearchCommand(query);
+ files = (List)CMSService.execute(searchCommand);
+ }
+ catch (CMSException e)
+ {
+ e.printStackTrace();
+ files = new ArrayList();
+ }
rReq.setAttribute("files", files);
+ rReq.setAttribute("textQuery", textQuery);
javax.portlet.PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher(CMSAdminConstants.CMS_JSP_PATH + "/searchResults.jsp");
prd.include(rReq, rRes);
Modified: trunk/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties
===================================================================
--- trunk/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties 2007-02-11 21:18:06 UTC (rev 6211)
+++ trunk/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties 2007-02-12 15:01:24 UTC (rev 6212)
@@ -36,6 +36,7 @@
TITLE_SECURECONFIRM=Secure Node
CMS_SEARCH=Search
+CMS_SEARCHNORESULT=No result for this search
CMS_MENU=Action Menu
CMS_ACTION=Action
CMS_NAME=Name
Modified: trunk/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource_fr.properties
===================================================================
--- trunk/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource_fr.properties 2007-02-11 21:18:06 UTC (rev 6211)
+++ trunk/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource_fr.properties 2007-02-12 15:01:24 UTC (rev 6212)
@@ -23,14 +23,15 @@
# CMS ADMIN PORTLET
TITLE_HEAD=Administration CMS
-TITLE_BROWSE=Navigation repertoires
+TITLE_BROWSE=Navigation r\u00E9pertoires
TITLE_DELETECONFIRM=Confirmer la suppression
-TITLE_CREATECOLLCONFIRM=Confirmer la creation de repertoire
+TITLE_CREATECOLLCONFIRM=Confirmer la cr\u00E9ation de r\u00E9pertoire
TITLE_COPYCONFIRM=Confirmer la copie de fichier
-TITLE_MOVECONFIRM=Confirmer le deplacement de fichier
-TITLE_VIEWFILE=Voir les proprietes du fichier
+TITLE_MOVECONFIRM=Confirmer le d\u00E9placement de fichier
+TITLE_VIEWFILE=Voir les propri\u00E9t\u00E9s du fichier
TITLE_EDIT=Editer le fichier
-TITLE_CREATE=Creer le fichier
+TITLE_CREATE=Cr\u00E9er le fichier
TITLE_UPLOAD=Charger le fichier
TITLE_SECURECONFIRM=S\u00E9curiser le noeud
CMS_SEARCH=Chercher
+CMS_SEARCHNORESULT=Aucun r\u00E9sultat pour cette recherche
\ No newline at end of file
Modified: trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/searchResults.jsp
===================================================================
--- trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/searchResults.jsp 2007-02-11 21:18:06 UTC (rev 6211)
+++ trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/searchResults.jsp 2007-02-12 15:01:24 UTC (rev 6212)
@@ -11,7 +11,23 @@
<portlet:defineObjects/>
-<table>
+<div align="right">
+
+<form method="post" action="<portlet:actionURL>
+ <portlet:param name="op" value="<%= CMSAdminConstants.OP_DOSEARCH %>"/>
+ </portlet:actionURL>">
+ <input type="text"
+ size="15"
+ maxlength="80"
+ name="search"
+ class="portlet-form-input-field"
+ value="<%= request.getAttribute("textQuery") %>"
+ />
+ <input type="submit" name="search" value="${n:i18n("CMS_SEARCH")}" class="portlet-form-button"/>
+</form>
+</div>
+
+
<%
List files = (List)request.getAttribute("files");
String createDate = "";
@@ -19,6 +35,9 @@
if (files.size() > 0)
{
+%>
+<table>
+<%
for (int i = 0; i < files.size(); i++)
{
File file = (File)files.get(i);
@@ -74,7 +93,14 @@
</tr>
<%
}
+%>
+</table>
+<%
}
+ else
+ {
+%>
+ <h2>${n:i18n("CMS_SEARCHNORESULT")}</h2>
+<%
+ }
%>
-</table>
-</form>
Modified: trunk/portal-search/.project
===================================================================
--- trunk/portal-search/.project 2007-02-11 21:18:06 UTC (rev 6211)
+++ trunk/portal-search/.project 2007-02-12 15:01:24 UTC (rev 6212)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>portal-search</name>
+ <name>core-search</name>
<comment></comment>
<projects>
</projects>
Modified: trunk/portal-search/build.xml
===================================================================
--- trunk/portal-search/build.xml 2007-02-11 21:18:06 UTC (rev 6211)
+++ trunk/portal-search/build.xml 2007-02-12 15:01:24 UTC (rev 6212)
@@ -219,8 +219,8 @@
<mkdir dir="${build.lib}"/>
- <!-- portal-jbp-search-lib.jar -->
- <jar jarfile="${build.lib}/portal-jbp-search-lib.jar">
+ <!-- portal-core-search-lib.jar -->
+ <jar jarfile="${build.lib}/portal-core-search-lib.jar">
<fileset dir="${build.classes}">
</fileset>
</jar>
@@ -231,7 +231,7 @@
<fileset dir="${build.resources}/portal-search-sar"/>
</copy>
<copy todir="${build.resources}/portal-search/lib">
- <fileset dir="${build.lib}" includes="portal-jbp-search-lib.jar"/>
+ <fileset dir="${build.lib}" includes="portal-core-search-lib.jar"/>
<fileset dir="${jboss.portal-search.root}/lib" includes="portal-search-lib.jar"/>
</copy>
Added: trunk/portal-search/src/resources/portal-search-war/WEB-INF/web.xml
===================================================================
--- trunk/portal-search/src/resources/portal-search-war/WEB-INF/web.xml (rev 0)
+++ trunk/portal-search/src/resources/portal-search-war/WEB-INF/web.xml 2007-02-12 15:01:24 UTC (rev 6212)
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+</web-app>
Property changes on: trunk/portal-search/src/resources/portal-search-war/WEB-INF/web.xml
___________________________________________________________________
Name: svn:executable
+ *
Modified: trunk/search/src/main/org/jboss/portal/search/QueryConverter.java
===================================================================
--- trunk/search/src/main/org/jboss/portal/search/QueryConverter.java 2007-02-11 21:18:06 UTC (rev 6211)
+++ trunk/search/src/main/org/jboss/portal/search/QueryConverter.java 2007-02-12 15:01:24 UTC (rev 6212)
@@ -32,7 +32,12 @@
public class QueryConverter
{
- // TODO: implemement this
+ // TODO: implemement this with something more sofisticated using JavaCC
+ // and a simple grammar probably
+ /**
+ * Convert a string into a Query object
+ * @return Query object for the text string
+ */
public static Query convert(String textQuery)
{
Query query = new Query();
Modified: trunk/search/src/main/org/jboss/portal/search/federated/jcr/JCRQueryConverter.java
===================================================================
--- trunk/search/src/main/org/jboss/portal/search/federated/jcr/JCRQueryConverter.java 2007-02-11 21:18:06 UTC (rev 6211)
+++ trunk/search/src/main/org/jboss/portal/search/federated/jcr/JCRQueryConverter.java 2007-02-12 15:01:24 UTC (rev 6212)
@@ -35,22 +35,25 @@
public class JCRQueryConverter
{
- //TODO, just for testing, would only work with at least one KeywordQueryTerm and nothing else
+ //TODO, just for testing, would only work with one or more optional KeywordQueryTerm and nothing else
public static String convert(Query query)
{
StringBuffer result = new StringBuffer();
List optional = query.getOptionalTerms();
- Iterator it = optional.iterator();
- result.append("//*[");
+ if (optional.size() != 0)
+ {
+ Iterator it = optional.iterator();
+ result.append("//*[");
- result.append("jcr:contains(., '" + ((KeywordQueryTerm)it.next()).getKeyWord() + "')");
+ result.append("jcr:contains(., '" + ((KeywordQueryTerm)it.next()).getKeyWord() + "')");
- while(it.hasNext())
- {
- result.append("or jcr:contains(., '" + ((KeywordQueryTerm)it.next()).getKeyWord() + "')");
+ while(it.hasNext())
+ {
+ result.append("or jcr:contains(., '" + ((KeywordQueryTerm)it.next()).getKeyWord() + "')");
+ }
+ result.append("]");
}
- result.append("]");
return result.toString();
}
Added: trunk/search/src/main/org/jboss/portal/search/test/ConverterTest.java
===================================================================
--- trunk/search/src/main/org/jboss/portal/search/test/ConverterTest.java (rev 0)
+++ trunk/search/src/main/org/jboss/portal/search/test/ConverterTest.java 2007-02-12 15:01:24 UTC (rev 6212)
@@ -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.portal.search.test;
+
+import org.jboss.portal.search.QueryConverter;
+import org.jboss.portal.search.query.Query;
+import org.jboss.portal.search.query.impl.KeywordQueryTerm;
+
+import junit.framework.TestCase;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class ConverterTest extends TestCase
+{
+
+ public void testOptionalKeyword()
+ {
+ Query query = QueryConverter.convert("test");
+ KeywordQueryTerm term = (KeywordQueryTerm)query.getOptionalTerms().get(0);
+ assertEquals("test", term.getKeyWord());
+ }
+
+
+}
19 years, 2 months
JBoss Portal SVN: r6211 - in trunk/identity: src/main/org/jboss/portal/identity/ldap and 1 other directories.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-02-11 16:18:06 -0500 (Sun, 11 Feb 2007)
New Revision: 6211
Modified:
trunk/identity/build.xml
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticGroupMembershipModuleImpl.java
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserImpl.java
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModule.java
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModuleImpl.java
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleUserModuleTestCase.java
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPUserProfileModuleTestCase.java
Log:
- change implementation to use LDAP DN as user ID instead of userName
Modified: trunk/identity/build.xml
===================================================================
--- trunk/identity/build.xml 2007-02-11 13:37:29 UTC (rev 6210)
+++ trunk/identity/build.xml 2007-02-11 21:18:06 UTC (rev 6211)
@@ -450,14 +450,12 @@
<x-test>
- <!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPIdentityTestCase"/>-->
- <!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.db.DBIdentityTestCase"/>-->
- <!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.UserProtoTestCase"/>-->
- <!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.ConfigurationTestCase"/>-->
- <!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPSimpleUserModuleTestCase"/>-->
- <!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPSimpleRoleModuleTestCase"/>-->
- <!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPStaticGroupMembershipModuleTestCase"/>-->
- <!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPStaticRoleMembershipModuleTestCase"/>-->
+ <test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPIdentityTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.identity.db.DBIdentityTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPSimpleUserModuleTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPSimpleRoleModuleTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPStaticGroupMembershipModuleTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPStaticRoleMembershipModuleTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPUserProfileModuleTestCase"/>
</x-test>
<x-classpath>
Modified: trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticGroupMembershipModuleImpl.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticGroupMembershipModuleImpl.java 2007-02-11 13:37:29 UTC (rev 6210)
+++ trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticGroupMembershipModuleImpl.java 2007-02-11 21:18:06 UTC (rev 6211)
@@ -84,7 +84,7 @@
}
else
{
- memberName = ldapUser.getId().toString();
+ memberName = ldapUser.getUserName();
}
@@ -250,7 +250,8 @@
}
else
{
- member.add(user.getId().toString());
+ //member.add(user.getId().toString());
+ member.add(user.getUserName());
}
}
catch (ClassCastException e)
@@ -312,7 +313,8 @@
}
else
{
- memberName = ldapUser.getId().toString();
+ //memberName = ldapUser.getId().toString();
+ memberName = ldapUser.getUserName();
}
Modified: trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserImpl.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserImpl.java 2007-02-11 13:37:29 UTC (rev 6210)
+++ trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserImpl.java 2007-02-11 21:18:06 UTC (rev 6211)
@@ -48,6 +48,8 @@
private String dn;
+ private String userName;
+
//In ldap implementation it acts as a userName
private String id;
@@ -60,10 +62,6 @@
/**
* internal
*/
- private String algorithm;
-
- private String encoding;
-
private LDAPUserImpl()
{
@@ -172,12 +170,12 @@
public String getUserName()
{
- return this.id;
+ return this.userName;
}
public void setUserName(String userName)
{
- this.id = userName;
+ this.userName = userName;
}
private IdentityConfiguration getIdentityConfiguration() throws IdentityException
Modified: trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModule.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModule.java 2007-02-11 13:37:29 UTC (rev 6210)
+++ trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModule.java 2007-02-11 21:18:06 UTC (rev 6211)
@@ -148,15 +148,18 @@
throw new IdentityException("LDAP entry doesn't contain proper attribute:" + getUidAttributeID());
}
- ldapu = new LDAPUserImpl(dn,getIdentityContext(), uida.get().toString());
+ //ldapu = new LDAPUserImpl(dn,getIdentityContext(), uida.get().toString());
+ //make DN as user ID
+ ldapu = new LDAPUserImpl(dn,getIdentityContext(), dn);
+ ldapu.setUserName(uida.get().toString());
log.debug("user uid: " + ldapu.getId());
log.debug("user dn: " + ldapu.getDn());
}
- catch (NamingException e)
+ catch (Exception e)
{
throw new IdentityException("Couldn't create LDAPUserImpl object from ldap entry (SearchResult)", e);
}
Modified: trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModuleImpl.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModuleImpl.java 2007-02-11 13:37:29 UTC (rev 6210)
+++ trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModuleImpl.java 2007-02-11 21:18:06 UTC (rev 6211)
@@ -109,13 +109,13 @@
{
throw new IdentityException("Only String id is suppoted");
}
- return findUserById((String)id);
+ return findUserByDN(id.toString());
}
public User findUserById(String id) throws IdentityException, IllegalArgumentException, NoSuchUserException
{
- return findUserByUserName(id);
+ return findUserByDN(id);
}
Modified: trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleUserModuleTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleUserModuleTestCase.java 2007-02-11 13:37:29 UTC (rev 6210)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleUserModuleTestCase.java 2007-02-11 21:18:06 UTC (rev 6211)
@@ -100,20 +100,20 @@
public void testFindUserByName() throws Exception
{
- LDAPUserImpl ldapu = (LDAPUserImpl)userModule.findUserById("jduke");
+ LDAPUserImpl ldapu = (LDAPUserImpl)userModule.findUserByUserName("jduke");
assertEquals(ldapu.getDn().toLowerCase(), (userPrefix + "=jduke,ou=People," + suffix).toLowerCase());
assertEquals(ldapu.getUserName(), "jduke");
}
public void testRemoveUser() throws Exception
{
- LDAPUserImpl ldapu = (LDAPUserImpl)userModule.findUserById("jduke");
+ LDAPUserImpl ldapu = (LDAPUserImpl)userModule.findUserByUserName("jduke");
assertNotNull(ldapu);
assertEquals(ldapu.getDn().toLowerCase(), (userPrefix + "=jduke,ou=People," + suffix).toLowerCase());
- userModule.removeUser("jduke");
+ userModule.removeUser(ldapu.getId());
try
{
- userModule.findUserById("jduke");
+ userModule.findUserByUserName("jduke");
fail();
}
catch (IdentityException e)
@@ -129,13 +129,13 @@
assertNotNull(ldapu);
assertEquals("testUser", ldapu.getUserName());
- ldapu = (LDAPUserImpl)userModule.findUserById("testUser");
+ ldapu = (LDAPUserImpl)userModule.findUserByUserName("testUser");
assertNotNull(ldapu);
- userModule.removeUser("testUser");
+ userModule.removeUser(ldapu.getId());
try
{
- ldapu = (LDAPUserImpl)userModule.findUserById("testUser");
+ ldapu = (LDAPUserImpl)userModule.findUserByUserName("testUser");
fail();
}
catch (IdentityException e)
@@ -148,7 +148,7 @@
public void testgetUserCount() throws Exception
{
- LDAPUserImpl ldapu = (LDAPUserImpl)userModule.findUserById("jduke");
+ LDAPUserImpl ldapu = (LDAPUserImpl)userModule.findUserByUserName("jduke");
assertEquals(ldapu.getDn().toLowerCase(),(userPrefix + "=jduke,ou=People," + suffix).toLowerCase());
assertEquals(ldapu.getUserName(), "jduke");
Modified: trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPUserProfileModuleTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPUserProfileModuleTestCase.java 2007-02-11 13:37:29 UTC (rev 6210)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPUserProfileModuleTestCase.java 2007-02-11 21:18:06 UTC (rev 6211)
@@ -79,7 +79,7 @@
public void testSetPropertyWithDB() throws Exception
{
begin();
- LDAPUserImpl ldapu = (LDAPUserImpl)userModule.findUserById("jduke");
+ LDAPUserImpl ldapu = (LDAPUserImpl)userModule.findUserByUserName("jduke");
assertEquals("email(a)email.com", userProfileModule.getProperty(ldapu, User.INFO_USER_EMAIL_REAL));
userProfileModule.setProperty(ldapu, User.INFO_USER_EMAIL_REAL, "toto(a)toto.com");
assertEquals("toto(a)toto.com", userProfileModule.getProperty(ldapu, User.INFO_USER_EMAIL_REAL));
19 years, 2 months
JBoss Portal SVN: r6210 - in trunk: identity/src/main/org/jboss/portal/identity and 8 other directories.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-02-11 08:37:29 -0500 (Sun, 11 Feb 2007)
New Revision: 6210
Added:
trunk/identity/src/main/org/jboss/portal/test/identity/IdentityTest.java
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPIdentityTestCase.java
trunk/identity/src/resources/test/config/identity/
trunk/identity/src/resources/test/config/identity/opends-config-staticrole.xml
trunk/identity/src/resources/test/config/identity/opends-config.xml
trunk/identity/src/resources/test/config/identity/openldap-config.xml
trunk/identity/src/resources/test/config/identity/rhds-config-staticrole.xml
trunk/identity/src/resources/test/config/identity/rhds-config.xml
trunk/identity/src/resources/test/config/staticrole/
trunk/identity/src/resources/test/config/staticrole/opends-config.xml
trunk/identity/src/resources/test/config/staticrole/rhds-config.xml
trunk/test/src/etc/directories-identity.xml
trunk/test/src/etc/directories-simplerolemodule.xml
trunk/test/src/etc/directories-simpleusermodule.xml
trunk/test/src/etc/directories-staticgroupmembership.xml
trunk/test/src/etc/directories-staticrolemembership.xml
trunk/test/src/etc/directories-userprofilemodule.xml
trunk/test/src/etc/ldap/ldif/initial-tests-notpopulated-openldap.ldif
trunk/test/src/etc/ldap/ldif/initial-tests-notpopulated.ldif
Modified:
trunk/identity/build.xml
trunk/identity/src/main/org/jboss/portal/identity/IdentityConfiguration.java
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPConnectionContext.java
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticGroupMembershipModuleImpl.java
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticRoleMembershipModuleImpl.java
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModule.java
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModuleImpl.java
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserProfileModuleImpl.java
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleRoleModuleTestCase.java
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleUserModuleTestCase.java
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticGroupMembershipModuleTestCase.java
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticRoleMembershipModuleTestCase.java
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPTestCase.java
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPUserProfileModuleTestCase.java
trunk/identity/src/resources/test/config/standardidentity-config.xml
trunk/test/src/etc/directories.xml
Log:
- reorganize identity testsuite to define server/configuration more flexibly
- make DB / LDAP run against common set of tests
- missing name filters in ldap user search
Modified: trunk/identity/build.xml
===================================================================
--- trunk/identity/build.xml 2007-02-11 13:25:59 UTC (rev 6209)
+++ trunk/identity/build.xml 2007-02-11 13:37:29 UTC (rev 6210)
@@ -388,7 +388,7 @@
<x-test>
- <!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.ConfigurationTestCasestCase"/>-->
+ <test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPIdentityTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPSimpleUserModuleTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPSimpleRoleModuleTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPStaticGroupMembershipModuleTestCase"/>
@@ -450,15 +450,15 @@
<x-test>
- <!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.db_old.DBUserTestCase"/>-->
+ <!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPIdentityTestCase"/>-->
<!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.db.DBIdentityTestCase"/>-->
<!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.UserProtoTestCase"/>-->
<!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.ConfigurationTestCase"/>-->
- <test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPSimpleUserModuleTestCase"/>
+ <!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPSimpleUserModuleTestCase"/>-->
<!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPSimpleRoleModuleTestCase"/>-->
<!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPStaticGroupMembershipModuleTestCase"/>-->
<!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPStaticRoleMembershipModuleTestCase"/>-->
- <!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPUserProfileModuleTestCase"/>-->
+ <test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPUserProfileModuleTestCase"/>
</x-test>
<x-classpath>
<pathelement location="${build.lib}/portal-identity-lib.jar"/>
Modified: trunk/identity/src/main/org/jboss/portal/identity/IdentityConfiguration.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/IdentityConfiguration.java 2007-02-11 13:25:59 UTC (rev 6209)
+++ trunk/identity/src/main/org/jboss/portal/identity/IdentityConfiguration.java 2007-02-11 13:37:29 UTC (rev 6210)
@@ -33,8 +33,6 @@
//TODO: isMembershipAttributeRequired
//TODO: memebershipAttributeEmptyValue
- //TODO: options for secured connection to ldap
- //TODO: let decide if has should be in hex or base64
public static final String GROUP_COMMON = "common";
Modified: trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPConnectionContext.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPConnectionContext.java 2007-02-11 13:25:59 UTC (rev 6209)
+++ trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPConnectionContext.java 2007-02-11 13:37:29 UTC (rev 6210)
@@ -124,7 +124,7 @@
}
catch (NamingException e)
{
- throw new IdentityException("Unable to create ConnectionContext: " + this, e);
+ throw new IdentityException("Unable to connect to LDAP: " + this, e);
//return null;
}
@@ -163,7 +163,8 @@
.append(", Port: ").append(getPort())
.append(", Context factory: ").append(getContextFactory())
.append(", Admin user: ").append(getAdminDN())
- .append(", Admin password: ").append(getAdminPassword())
+ //.append(", Admin password: ").append(getAdminPassword())
+ .append(", Admin password: ").append("***")
.append(", Authentication: ").append(getAuthentication())
.append(", Protocol: ").append(getProtocol());
return str.toString();
Modified: trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticGroupMembershipModuleImpl.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticGroupMembershipModuleImpl.java 2007-02-11 13:25:59 UTC (rev 6209)
+++ trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticGroupMembershipModuleImpl.java 2007-02-11 13:37:29 UTC (rev 6210)
@@ -116,6 +116,11 @@
public Set getUsers(Role role) throws IdentityException
{
+ return getUsers(role, null);
+ }
+
+ public Set getUsers(Role role, String userNameFilter) throws IdentityException
+ {
if (role == null)
{
throw new IllegalArgumentException("Role cannot be null");
@@ -161,6 +166,11 @@
String value = values.nextElement().toString();
String name = value;
+ if (userNameFilter != null && userNameFilter.length() != 0 && !name.matches(".*" + userNameFilter + ".*"))
+ {
+ continue;
+ }
+
try
{
//if user is pointed as DN get only it's name
@@ -386,7 +396,7 @@
//if exception was thrown - propagate it, if not....
if (role != null)
{
- return getUsers(role);
+ return getUsers(role, userNameFilter);
}
else
{
Modified: trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticRoleMembershipModuleImpl.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticRoleMembershipModuleImpl.java 2007-02-11 13:25:59 UTC (rev 6209)
+++ trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticRoleMembershipModuleImpl.java 2007-02-11 13:37:29 UTC (rev 6210)
@@ -135,6 +135,11 @@
public Set getUsers(Role role) throws IdentityException
{
+ return getUsers(role, null);
+ }
+
+ public Set getUsers(Role role, String userNameFilter) throws IdentityException
+ {
if (role == null)
{
throw new IllegalArgumentException("Role cannot be null");
@@ -183,7 +188,14 @@
{
SearchResult res = (SearchResult)iterator.next();
DirContext ctx = (DirContext)res.getObject();
- users.add(getUserModule().createUserInstance(res.getAttributes(),ctx.getNameInNamespace()));
+
+ //TODO: this part isn't efficient - check the condition without creating instance
+ User user = getUserModule().createUserInstance(res.getAttributes(),ctx.getNameInNamespace());
+ if (userNameFilter != null && userNameFilter.length() != 0 && !user.getUserName().matches(".*" + userNameFilter + ".*"))
+ {
+ continue;
+ }
+ users.add(user);
}
@@ -375,7 +387,7 @@
//if exception was thrown - propagate it, if not....
if (role != null)
{
- return getUsers(role);
+ return getUsers(role, userNameFilter);
}
else
{
Modified: trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModule.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModule.java 2007-02-11 13:25:59 UTC (rev 6209)
+++ trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModule.java 2007-02-11 13:37:29 UTC (rev 6210)
@@ -96,7 +96,7 @@
{
Hashtable env =getConnectionContext().getEnvironment();
- //will use user DN to bind checking the password
+ //will use user DN to bind checking the password by default
String principal = ldapu.getDn();
//if principalDNPreffix or principalDNSuffix is set will use them to construct principal name
@@ -148,12 +148,6 @@
throw new IdentityException("LDAP entry doesn't contain proper attribute:" + getUidAttributeID());
}
-// Attribute passwd = attrs.get(getPasswordAttributeId());
-// if (passwd == null)
-// {
-// throw new IdentityException("LDAP entry doesn't contain proper attribute:" + getPasswordAttributeId());
-// }
-
ldapu = new LDAPUserImpl(dn,getIdentityContext(), uida.get().toString());
Modified: trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModuleImpl.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModuleImpl.java 2007-02-11 13:25:59 UTC (rev 6209)
+++ trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModuleImpl.java 2007-02-11 13:37:29 UTC (rev 6210)
@@ -231,10 +231,27 @@
//TODO: and testcase this...
public Set findUsersFilteredByUserName(String filter, int offset, int limit) throws IdentityException, IllegalArgumentException
{
+ if (filter == null)
+ {
+ throw new IllegalArgumentException("Null user name filter");
+ }
+
log.info("Current implementation of findUsersFilteredByUserName returns all users and is not \"offset\" and \"limit\" sensitive ");
+
Set uf = new HashSet();
+
+
+ if (filter.length() == 0)
+ {
+ filter = "*";
+ }
+ else if (!(filter.length() == 1 && filter.equals("*")))
+ {
+ filter = "*" + filter + "*";
+ }
+
try
{
//search all entries containing "uid" attribute
Modified: trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserProfileModuleImpl.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserProfileModuleImpl.java 2007-02-11 13:25:59 UTC (rev 6209)
+++ trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserProfileModuleImpl.java 2007-02-11 13:37:29 UTC (rev 6210)
@@ -126,6 +126,8 @@
String attributeName = resolveAttributeName(propertyName);
+
+ //TODO: check the type and log.info that this can only be a String if not such
String propertyValue = property.toString();
if (attributeName == null)
Added: trunk/identity/src/main/org/jboss/portal/test/identity/IdentityTest.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/IdentityTest.java (rev 0)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/IdentityTest.java 2007-02-11 13:37:29 UTC (rev 6210)
@@ -0,0 +1,499 @@
+package org.jboss.portal.test.identity;
+
+import junit.framework.Assert;
+import org.jboss.portal.identity.UserModule;
+import org.jboss.portal.identity.RoleModule;
+import org.jboss.portal.identity.MembershipModule;
+import org.jboss.portal.identity.UserProfileModule;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.identity.Role;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.common.util.CollectionBuilder;
+import org.jboss.portal.common.p3p.P3PConstants;
+
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class IdentityTest extends Assert
+{
+
+ /** . */
+ private UserModule userModule;
+
+ /** . */
+ private RoleModule roleModule;
+
+ /** . */
+ private MembershipModule membershipModule;
+
+ /** . */
+ private UserProfileModule userProfileModule;
+
+
+ /** . */
+ private IdentityTest.Context ctx;
+
+ public void setUserModule(UserModule userModule)
+ {
+ this.userModule = userModule;
+ }
+
+ public void setRoleModule(RoleModule roleModule)
+ {
+ this.roleModule = roleModule;
+ }
+
+ public void setMembershipModule(MembershipModule membershipModule)
+ {
+ this.membershipModule = membershipModule;
+ }
+
+ public void setUserProfileModule(UserProfileModule userProfileModule)
+ {
+ this.userProfileModule = userProfileModule;
+ }
+
+ public void setContext(IdentityTest.Context ctx)
+ {
+ this.ctx = ctx;
+ }
+
+ public void testFindUsersUsingFilter() throws Exception
+ {
+ ctx.begin();
+ Set set1 = userModule.findUsersFilteredByUserName("user", 0, 10);
+ Set nameSet1 = new HashSet();
+ for (Iterator i = set1.iterator(); i.hasNext();)
+ {
+ User user = (User)i.next();
+ nameSet1.add(user.getUserName());
+ }
+ Set expectedNameSet1 = new HashSet();
+ expectedNameSet1.add("user1");
+ expectedNameSet1.add("user2");
+ assertEquals(expectedNameSet1, nameSet1);
+
+ //
+ Set set2 = userModule.findUsersFilteredByUserName("blah", 0, 10);
+ assertEquals(0, set2.size());
+
+ //
+ Set set3 = userModule.findUsersFilteredByUserName("", 0, 10);
+ Set nameSet3 = new HashSet();
+ for (Iterator i = set3.iterator(); i.hasNext();)
+ {
+ User user = (User)i.next();
+ nameSet3.add(user.getUserName());
+ }
+ Set expectedNameSet3 = new HashSet();
+ expectedNameSet3.add("user1");
+ expectedNameSet3.add("user2");
+ expectedNameSet3.add("admin");
+ assertEquals(expectedNameSet3, nameSet3);
+
+ //
+ Set set4 = userModule.findUsersFilteredByUserName("user1", 0, 10);
+ Set nameSet4 = new HashSet();
+ for (Iterator i = set4.iterator(); i.hasNext();)
+ {
+ User user = (User)i.next();
+ nameSet4.add(user.getUserName());
+ }
+ Set expectedNameSet4 = new HashSet();
+ expectedNameSet4.add("user1");
+ assertEquals(expectedNameSet4, nameSet4);
+ ctx.commit();
+ }
+
+ public void testFindUser1() throws Exception
+ {
+ ctx.begin();
+ User u1 = userModule.findUserByUserName("user1");
+ assertNotNull(u1);
+ Assert.assertEquals("user1", u1.getUserName());
+ assertNotNull(membershipModule.getRoles(u1));
+ Assert.assertEquals(1, membershipModule.getRoles(u1).size());
+ Assert.assertEquals("role1", ((Role)membershipModule.getRoles(u1).iterator().next()).getName());
+ Assert.assertEquals(u1.getId(), userModule.findUserById(u1.getId()).getId());
+ ctx.commit();
+ }
+
+ public void testFindUser2() throws Exception
+ {
+ ctx.begin();
+ Set roleNames = new HashSet(Arrays.asList(new Object[]{"role1", "role2"}));
+ User u2 = userModule.findUserByUserName("user2");
+ assertNotNull(u2);
+ Assert.assertEquals("user2", u2.getUserName());
+ assertNotNull(membershipModule.getRoles(u2));
+ Assert.assertEquals(2, membershipModule.getRoles(u2).size());
+ Iterator iterator = membershipModule.getRoles(u2).iterator();
+ assertTrue(roleNames.contains(((Role)iterator.next()).getName()));
+ assertTrue(roleNames.contains(((Role)iterator.next()).getName()));
+ Assert.assertEquals(u2.getId(), userModule.findUserById(u2.getId()).getId());
+ ctx.commit();
+ }
+
+ public void testFindUsers() throws Exception
+ {
+ ctx.begin();
+ Set c1 = userModule.findUsers(0, 1);
+ assertNotNull(c1);
+ assertEquals(1, c1.size());
+
+ Set c2 = userModule.findUsers(1, 1);
+ assertNotNull(c2);
+ assertEquals(1, c2.size());
+
+ Set c3 = userModule.findUsers(0, 2);
+ assertNotNull(c3);
+ assertEquals(2, c3.size());
+
+ Set s1 = new HashSet();
+ s1.add(((User)c1.iterator().next()).getUserName());
+ s1.add(((User)c2.iterator().next()).getUserName());
+ Set s2 = new HashSet();
+ Iterator iterator = c3.iterator();
+ s2.add(((User)iterator.next()).getUserName());
+ s2.add(((User)iterator.next()).getUserName());
+ assertEquals(s1, s2);
+ ctx.commit();
+ }
+
+ public void testCreateUser() throws Exception
+ {
+ ctx.begin();
+ User u3 = userModule.createUser("user3", "password");
+ Role g1 = roleModule.findRoleByName("role1");
+ membershipModule.assignRoles(u3, Collections.singleton(g1));
+ Assert.assertEquals("user3", u3.getUserName());
+ assertNotNull(membershipModule.getRoles(u3));
+ Assert.assertEquals(1, membershipModule.getRoles(u3).size());
+ Assert.assertEquals("role1", ((Role)membershipModule.getRoles(u3).iterator().next()).getName());
+ ctx.commit();
+
+ ctx.begin();
+ u3 = userModule.findUserByUserName("user3");
+ assertNotNull(u3);
+ Assert.assertEquals("user3", u3.getUserName());
+ assertNotNull(membershipModule.getRoles(u3));
+ Assert.assertEquals(1, membershipModule.getRoles(u3).size());
+ Assert.assertEquals("role1", ((Role)membershipModule.getRoles(u3).iterator().next()).getName());
+ ctx.commit();
+ }
+
+ // public void testCreateDuplicateUser() throws Exception
+ // {
+ // try
+ // {
+ // userModule.createUser("user1");
+ // fail("Expected exception on duplicate user");
+ // }
+ // catch (ModuleException expected)
+ // {
+ // }
+ // }
+
+ public void testCreateRole() throws Exception
+ {
+ ctx.begin();
+ Role g3 = roleModule.createRole("role3", "roleName");
+ Assert.assertEquals("role3", g3.getName());
+ ctx.commit();
+
+ ctx.begin();
+ g3 = roleModule.findRoleByName("role3");
+ assertNotNull(g3);
+ Assert.assertEquals("role3", g3.getName());
+ ctx.commit();
+ }
+
+ // public void testCreateDuplicateRole() throws Exception
+ // {
+ // try
+ // {
+ // roleModule.createRole("user1");
+ // fail("Expected exception on duplicate role");
+ // }
+ // catch (ModuleException expected)
+ // {
+ // }
+ // }
+
+ public void testCountUser() throws Exception
+ {
+ ctx.begin();
+ Assert.assertEquals(3, userModule.getUserCount());
+ ctx.commit();
+ }
+
+ public void testRemoveNonExistingRole() throws Exception
+ {
+ ctx.begin();
+ try
+ {
+ roleModule.removeRole(new Long(Long.MAX_VALUE));
+ fail("Expected exception");
+ }
+ catch (IdentityException expected)
+ {
+ }
+ ctx.commit();
+ }
+
+ public void testRemoveRole() throws Exception
+ {
+ ctx.begin();
+ Role g1 = roleModule.findRoleByName("role1");
+ Object id = g1.getId();
+ roleModule.removeRole(id);
+ try
+ {
+ roleModule.findRoleById(id);
+ fail("Expected exception");
+ }
+ catch (IdentityException expected)
+ {
+ }
+ ctx.commit();
+
+ ctx.begin();
+ try
+ {
+ roleModule.findRoleById(id);
+ fail("Expected exception");
+ }
+ catch (IdentityException expected)
+ {
+ }
+ User u1 = userModule.findUserByUserName("user1");
+ assertNotNull(u1);
+ Assert.assertEquals("user1", u1.getUserName());
+ ctx.commit();
+ }
+
+ public void testRemoveUser() throws Exception
+ {
+ ctx.begin();
+ User u1 = userModule.findUserByUserName("user1");
+ Object id = u1.getId();
+ userModule.removeUser(id);
+ try
+ {
+ userModule.findUserById(id);
+ fail("Expected exception");
+ }
+ catch (IdentityException expected)
+ {
+ }
+ ctx.commit();
+
+ ctx.begin();
+ try
+ {
+ userModule.findUserById(id);
+ fail("Expected exception");
+ }
+ catch (IdentityException expected)
+ {
+ }
+ Role g1 = roleModule.findRoleByName("role1");
+ assertNotNull(g1);
+ Assert.assertEquals("role1", g1.getName());
+ Role g2 = roleModule.findRoleByName("role2");
+ assertNotNull(g2);
+ Assert.assertEquals("role2", g2.getName());
+ ctx.commit();
+ }
+
+ public void testFindRoles() throws Exception
+ {
+ ctx.begin();
+ Set roleNames = new HashSet(Arrays.asList(new Object[]{"role1", "role2"}));
+ Set roles = roleModule.findRoles();
+
+ assertEquals(2, roles.size());
+ Iterator iterator = roles.iterator();
+ assertTrue(roleNames.contains(((Role)iterator.next()).getName()));
+ assertTrue(roleNames.contains(((Role)iterator.next()).getName()));
+ ctx.commit();
+ }
+
+ public void testFindRoleMembers() throws Exception
+ {
+ ctx.begin();
+ Set set1 = membershipModule.findRoleMembers("role1", 0, 10, "user");
+ Set nameSet1 = new HashSet();
+ for (Iterator i = set1.iterator(); i.hasNext();)
+ {
+ User user = (User)i.next();
+ nameSet1.add(user.getUserName());
+ }
+ Set expectedNameSet1 = new HashSet();
+ expectedNameSet1.add("user1");
+ expectedNameSet1.add("user2");
+ assertEquals(expectedNameSet1, nameSet1);
+
+ //
+ Set set2 = membershipModule.findRoleMembers("role1", 0, 10, "blah");
+ assertEquals(0, set2.size());
+
+ //
+ Set set3 = membershipModule.findRoleMembers("role1", 0, 10, "");
+ Set nameSet3 = new HashSet();
+ for (Iterator i = set3.iterator(); i.hasNext();)
+ {
+ User user = (User)i.next();
+ nameSet3.add(user.getUserName());
+ }
+ Set expectedNameSet3 = new HashSet();
+ expectedNameSet3.add("user1");
+ expectedNameSet3.add("user2");
+ expectedNameSet3.add("admin");
+ assertEquals(expectedNameSet3, nameSet3);
+
+ //
+ Set set4 = membershipModule.findRoleMembers("role1", 0, 10, "user1");
+ Set nameSet4 = new HashSet();
+ for (Iterator i = set4.iterator(); i.hasNext();)
+ {
+ User user = (User)i.next();
+ nameSet4.add(user.getUserName());
+ }
+ Set expectedNameSet4 = new HashSet();
+ expectedNameSet4.add("user1");
+ assertEquals(expectedNameSet4, nameSet4);
+ ctx.commit();
+ }
+
+ public void testDynamicProperty() throws Exception
+ {
+ ctx.begin();
+ User user = userModule.createUser("testname", "testpassword");
+ Map map = userProfileModule.getProperties(user);
+ assertNull(map.get("foo"));
+ //assertFalse(map.isReadOnly("foo"));
+ map.put("foo", "value");
+ assertEquals("value", map.get("foo"));
+ //assertFalse(map.isReadOnly("foo"));
+ ctx.commit();
+
+ ctx.begin();
+ user = userModule.findUserByUserName("testname");
+ map = userProfileModule.getProperties(user);
+ assertEquals("value", map.get("foo"));
+ //assertFalse(map.isReadOnly("foo"));
+ ctx.commit();
+ }
+
+ public void testStaticProperty() throws Exception
+ {
+ ctx.begin();
+
+ //
+ User user = userModule.createUser("testname", "testpassword");
+ Map map = userProfileModule.getProperties(user);
+ assertEquals("testname", map.get(P3PConstants.INFO_USER_NAME_NICKNAME));
+
+ // Test cannot remove a static property
+ try
+ {
+ map.remove(P3PConstants.INFO_USER_NAME_GIVEN);
+ fail("Should not be capable to remove static property");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ // Test read only property
+ //assertTrue(map.isReadOnly(P3PConstants.INFO_USER_NAME_NICKNAME));
+ try
+ {
+ map.put(P3PConstants.INFO_USER_NAME_NICKNAME, "anothername");
+ fail("Should not be capable to modify a read only static property");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ // Test non nullable and writable property
+ try
+ {
+ map.put(User.INFO_USER_VIEW_EMAIL_VIEW_REAL, null);
+ fail("Should not be capable to nullify a non nullable static property");
+ }
+ catch (NullPointerException expected)
+ {
+ }
+ map.put(User.INFO_USER_VIEW_EMAIL_VIEW_REAL, "true");
+ assertEquals("true", userProfileModule.getProperty(user, User.INFO_USER_VIEW_EMAIL_VIEW_REAL));
+
+ // Test boolean property
+ map.put(User.INFO_USER_VIEW_EMAIL_VIEW_REAL, "false");
+ assertEquals("false", map.get(User.INFO_USER_VIEW_EMAIL_VIEW_REAL));
+ assertEquals("false", userProfileModule.getProperty(user, User.INFO_USER_VIEW_EMAIL_VIEW_REAL));
+
+ map.put(User.INFO_USER_VIEW_EMAIL_VIEW_REAL, "true");
+ assertEquals("true", map.get(User.INFO_USER_VIEW_EMAIL_VIEW_REAL));
+ assertEquals("true", userProfileModule.getProperty(user, User.INFO_USER_VIEW_EMAIL_VIEW_REAL));
+
+ userProfileModule.setProperty(user, User.INFO_USER_VIEW_EMAIL_VIEW_REAL, "false");
+ assertEquals("false", map.get(User.INFO_USER_VIEW_EMAIL_VIEW_REAL));
+ assertEquals("false", userProfileModule.getProperty(user, User.INFO_USER_VIEW_EMAIL_VIEW_REAL));
+
+ userProfileModule.setProperty(user, User.INFO_USER_VIEW_EMAIL_VIEW_REAL, "true");
+ assertEquals("true", map.get(User.INFO_USER_VIEW_EMAIL_VIEW_REAL));
+ assertEquals("true", userProfileModule.getProperty(user, User.INFO_USER_VIEW_EMAIL_VIEW_REAL));
+ try
+ {
+ map.put(User.INFO_USER_VIEW_EMAIL_VIEW_REAL, "truee");
+ fail("Should not be capable to set a bad value to boolean property");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ // Test date
+ /*Date date = ((HibernateUserImpl)user).getRegistrationDate();
+ SimpleDateFormat sdf = new SimpleDateFormat();
+ assertEquals(sdf.format(date), map.get(User.INFO_USER_REGISTRATION_DATE));*/
+
+ ctx.commit();
+ }
+
+
+
+//
+ public void populate() throws Exception
+ {
+ ctx.begin();
+ User admin = userModule.createUser("admin", "");
+ User u1 = userModule.createUser("user1", "");
+ User u2 = userModule.createUser("user2", "");
+ Role g1 = roleModule.createRole("role1", "role1");
+ Role g2 = roleModule.createRole("role2", "role2");
+ membershipModule.assignRoles(u1, Collections.singleton(g1));
+ membershipModule.assignRoles(u2, new CollectionBuilder().add(g1).add(g2).toHashSet());
+ membershipModule.assignRoles(admin, new CollectionBuilder().add(g1).add(g2).toHashSet());
+ ctx.commit();
+ }
+
+
+
+
+
+ public interface Context
+ {
+ void begin();
+
+ void commit();
+ }
+}
Added: trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPIdentityTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPIdentityTestCase.java (rev 0)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPIdentityTestCase.java 2007-02-11 13:37:29 UTC (rev 6210)
@@ -0,0 +1,175 @@
+package org.jboss.portal.test.identity.ldap;
+
+import org.jboss.portal.test.identity.db.DBTestCase;
+import org.jboss.portal.test.identity.db.DBIdentityTestCase;
+import org.jboss.portal.test.identity.UserTest;
+import org.jboss.portal.test.identity.IdentityTest;
+import org.jboss.portal.identity.IdentityServiceControllerImpl;
+import org.jboss.portal.identity.IdentityContext;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.identity.ProfileMap;
+import org.jboss.portal.identity.UserModule;
+import org.jboss.portal.identity.RoleModule;
+import org.jboss.portal.identity.MembershipModule;
+import org.jboss.portal.identity.UserProfileModule;
+import org.jboss.portal.identity.db.HibernateUserImpl;
+import org.jboss.portal.identity.service.UserModuleService;
+import org.jboss.portal.identity.service.RoleModuleService;
+import org.jboss.portal.identity.service.MembershipModuleService;
+import org.jboss.portal.identity.service.UserProfileModuleService;
+import org.jboss.portal.common.p3p.P3PConstants;
+import org.apache.log4j.Appender;
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.SimpleLayout;
+import org.apache.log4j.Logger;
+import org.apache.log4j.Level;
+import junit.framework.TestSuite;
+
+import java.util.Date;
+import java.text.SimpleDateFormat;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5748 $
+ */
+public class LDAPIdentityTestCase extends LDAPTestCase implements IdentityTest.Context
+{
+ private static final org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(DBTestCase.class);
+
+ static
+ {
+ Appender appender = new ConsoleAppender(new SimpleLayout());
+ Logger.getRoot().addAppender(appender);
+ Logger.getRoot().setLevel(Level.INFO);
+ Logger.getLogger("org.jboss.portal.identity").setLevel(Level.INFO);
+ }
+
+ public static TestSuite suite() throws Exception
+ {
+ System.out.println("###");
+ return createTestSuite(LDAPIdentityTestCase.class, "directories-identity.xml", "datasources.xml");
+ }
+
+ private UserModule userModule;
+
+ private RoleModule roleModule;
+
+ private MembershipModule membershipModule;
+
+ private UserProfileModule userProfileModule;
+
+ private IdentityTest utc;
+
+
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+
+ //bootstrap identity modules
+ IdentityServiceControllerImpl controller = new IdentityServiceControllerImpl();
+ controller.setConfigFile(getDirectoryServerConfigParameter().getConfigFile());
+ controller.setDefaultConfigFile("test/config/standardidentity-config.xml");
+ controller.setRegisterMBeans(false);
+ controller.start();
+
+ identityContext = controller.getIdentityContext();
+
+ this.userModule = (UserModuleService)identityContext.getObject(IdentityContext.TYPE_USER_MODULE);
+ this.roleModule = (RoleModuleService)identityContext.getObject(IdentityContext.TYPE_ROLE_MODULE);
+ this.membershipModule = (MembershipModuleService)identityContext.getObject(IdentityContext.TYPE_MEMBERSHIP_MODULE);
+ this.userProfileModule = (UserProfileModuleService)identityContext.getObject(IdentityContext.TYPE_USER_PROFILE_MODULE);
+
+ populate();
+ //
+ utc = new IdentityTest();
+ utc.setUserModule(userModule);
+ utc.setRoleModule(roleModule);
+ utc.setMembershipModule(membershipModule);
+ utc.setUserProfileModule(userProfileModule);
+ utc.setContext(this);
+ utc.populate();
+ }
+
+
+
+
+
+
+ public void testWorking() throws Exception
+ {
+
+ }
+
+ //
+
+ public void testFindUsersUsingFilter() throws Exception
+ {
+ utc.testFindUsersUsingFilter();
+ }
+
+ public void testFindUser1() throws Exception
+ {
+ utc.testFindUser1();
+ }
+
+ public void testFindUser2() throws Exception
+ {
+ utc.testFindUser2();
+ }
+
+ public void testFindUsers() throws Exception
+ {
+ utc.testFindUsers();
+ }
+
+ public void testCreateUser() throws Exception
+ {
+ utc.testCreateUser();
+ }
+
+ public void testCreateRole() throws Exception
+ {
+ utc.testCreateRole();
+ }
+
+ public void testCountUser() throws Exception
+ {
+ utc.testCountUser();
+ }
+
+ public void testRemoveNonExistingRole() throws Exception
+ {
+ utc.testRemoveNonExistingRole();
+ }
+
+ public void testRemoveRole() throws Exception
+ {
+ utc.testRemoveRole();
+ }
+
+ public void testRemoveUser() throws Exception
+ {
+ utc.testRemoveUser();
+ }
+
+ public void testFindRoles() throws Exception
+ {
+ utc.testFindRoles();
+ }
+
+ public void testFindRoleMembers() throws Exception
+ {
+ utc.testFindRoleMembers();
+ }
+
+ /*public void testDynamicProperty() throws Exception
+ {
+ utc.testDynamicProperty();
+ }
+
+ public void testStaticProperty() throws Exception
+ {
+ utc.testStaticProperty();
+ }*/
+}
Modified: trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleRoleModuleTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleRoleModuleTestCase.java 2007-02-11 13:25:59 UTC (rev 6209)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleRoleModuleTestCase.java 2007-02-11 13:37:29 UTC (rev 6210)
@@ -45,7 +45,7 @@
public static TestSuite suite() throws Exception
{
- return createTestSuite(LDAPSimpleRoleModuleTestCase.class);
+ return createTestSuite(LDAPSimpleRoleModuleTestCase.class, "directories-simplerolemodule.xml", "datasources.xml");
}
RoleModule roleModule;
Modified: trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleUserModuleTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleUserModuleTestCase.java 2007-02-11 13:25:59 UTC (rev 6209)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleUserModuleTestCase.java 2007-02-11 13:37:29 UTC (rev 6210)
@@ -52,7 +52,7 @@
public static TestSuite suite() throws Exception
{
System.out.println("###");
- return createTestSuite(LDAPSimpleUserModuleTestCase.class);
+ return createTestSuite(LDAPSimpleUserModuleTestCase.class, "directories-simpleusermodule.xml", "datasources.xml");
}
UserModule userModule;
@@ -73,28 +73,6 @@
{
super.setUp();
- //IdentityContextImpl context = new IdentityContextImpl();
- //context.start();
- //identityContext = context;
-
- /*SimpleConfigurationImpl configuration = new SimpleConfigurationImpl();
- configuration.setIdentityContext(identityContext);
- configuration.setConfigFile(getDirectoryServerConfigParameter().getConfigFile());
- configuration.start();
-
- LDAPConnectionContext connection = new LDAPConnectionContext();
- connection.setIdentityContext(identityContext);
- connection.start();
-
- LDAPUserModuleImpl userModule = new LDAPUserModuleImpl();
- userModule.setIdentityContext(identityContext);
-
- //userModule.setContainerDN("ou=People,dc=jboss,dc=org");
- //userModule.setUidAttributeID("uid");
-
- userModule.start();
- this.userModule = userModule;*/
-
IdentityServiceControllerImpl controller = new IdentityServiceControllerImpl();
controller.setConfigFile(getDirectoryServerConfigParameter().getConfigFile());
controller.setDefaultConfigFile("test/config/standardidentity-config.xml");
Modified: trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticGroupMembershipModuleTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticGroupMembershipModuleTestCase.java 2007-02-11 13:25:59 UTC (rev 6209)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticGroupMembershipModuleTestCase.java 2007-02-11 13:37:29 UTC (rev 6210)
@@ -51,7 +51,7 @@
public static TestSuite suite() throws Exception
{
- return createTestSuite(LDAPStaticGroupMembershipModuleTestCase.class);
+ return createTestSuite(LDAPStaticGroupMembershipModuleTestCase.class, "directories-staticgroupmembership.xml", "datasources.xml");
}
private UserModule userModule;
Modified: trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticRoleMembershipModuleTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticRoleMembershipModuleTestCase.java 2007-02-11 13:25:59 UTC (rev 6209)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticRoleMembershipModuleTestCase.java 2007-02-11 13:37:29 UTC (rev 6210)
@@ -51,7 +51,7 @@
public static TestSuite suite() throws Exception
{
- return createTestSuite(LDAPStaticRoleMembershipModuleTestCase.class);
+ return createTestSuite(LDAPStaticRoleMembershipModuleTestCase.class, "directories-staticrolemembership.xml", "datasources.xml");
}
private UserModule userModule;
@@ -89,7 +89,7 @@
suffix = getDirectoryServerConfigParameter().getCleanUpDN();
- IdentityConfiguration configuration = (IdentityConfiguration)identityContext.getObject(IdentityContext.TYPE_IDENTITY_CONFIGURATION);
+ /*IdentityConfiguration configuration = (IdentityConfiguration)identityContext.getObject(IdentityContext.TYPE_IDENTITY_CONFIGURATION);
Set values = new HashSet();
values.add("ou=Roles,o=example2," + suffix);
configuration.setValues(IdentityConfiguration.GROUP_COMMON,IdentityConfiguration.ROLE_CONTAINER_DN, values);
@@ -98,7 +98,7 @@
configuration.setValues(IdentityConfiguration.GROUP_COMMON, IdentityConfiguration.USER_CONTAINER_DN, values);
values = new HashSet();
values.add("memberOf");
- configuration.setValues(IdentityConfiguration.GROUP_COMMON,IdentityConfiguration.MEMBERSHIP_ATTRIBUTE_ID, values);
+ configuration.setValues(IdentityConfiguration.GROUP_COMMON,IdentityConfiguration.MEMBERSHIP_ATTRIBUTE_ID, values);*/
prefix = ((IdentityConfiguration)identityContext.getObject(IdentityContext.TYPE_IDENTITY_CONFIGURATION)).getValue(IdentityConfiguration.USER_UID_ATTRIBUTE_ID);
Modified: trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPTestCase.java 2007-02-11 13:25:59 UTC (rev 6209)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPTestCase.java 2007-02-11 13:37:29 UTC (rev 6210)
@@ -66,13 +66,13 @@
Appender appender = new ConsoleAppender(new SimpleLayout());
Logger.getRoot().addAppender(appender);
Logger.getRoot().setLevel(Level.INFO);
- Logger.getLogger("org.jboss.portal.identity").setLevel(Level.DEBUG);
+ Logger.getLogger("org.jboss.portal.identity").setLevel(Level.INFO);
}
- public static TestSuite createTestSuite(Class clazz) throws Exception
+ public static TestSuite createTestSuite(Class clazz, String directories, String datasources) throws Exception
{
- URL directoriesURL = Thread.currentThread().getContextClassLoader().getResource("directories.xml");
- URL datasourcesURL = Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
+ URL directoriesURL = Thread.currentThread().getContextClassLoader().getResource(directories);
+ URL datasourcesURL = Thread.currentThread().getContextClassLoader().getResource(datasources);
Map parameterMap = new HashMap();
parameterMap.put("DirectoryServerConfig", DSConfig.fromXML2(directoriesURL));
parameterMap.put("DataSourceConfig", DataSourceSupport.Config.fromXML2(datasourcesURL));
@@ -83,6 +83,11 @@
return suite;
}
+ public static TestSuite createTestSuite(Class clazz) throws Exception
+ {
+ return createTestSuite(clazz, "directories.xml", "datasources.xml");
+ }
+
public LDAPTestCase()
{
Modified: trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPUserProfileModuleTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPUserProfileModuleTestCase.java 2007-02-11 13:25:59 UTC (rev 6209)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPUserProfileModuleTestCase.java 2007-02-11 13:37:29 UTC (rev 6210)
@@ -42,7 +42,7 @@
public static TestSuite suite() throws Exception
{
- return createTestSuite(LDAPUserProfileModuleTestCase.class);
+ return createTestSuite(LDAPUserProfileModuleTestCase.class, "directories-userprofilemodule.xml", "datasources.xml");
}
private UserModule userModule;
Added: trunk/identity/src/resources/test/config/identity/opends-config-staticrole.xml
===================================================================
--- trunk/identity/src/resources/test/config/identity/opends-config-staticrole.xml (rev 0)
+++ trunk/identity/src/resources/test/config/identity/opends-config-staticrole.xml 2007-02-11 13:37:29 UTC (rev 6210)
@@ -0,0 +1,148 @@
+<?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 identity-configuration PUBLIC
+ "-//JBoss Portal//DTD JBoss Identity Configuration 1.0//EN"
+ "http://www.jboss.org/portal/dtd/identity-config_1_0.dtd">-->
+
+<identity-configuration>
+ <datasources>
+ <datasource>
+ <name>LDAP</name>
+ <config>
+ <option>
+ <name>host</name>
+ <value>localhost</value>
+ </option>
+ <option>
+ <name>port</name>
+ <value>10389</value>
+ </option>
+ <option>
+ <name>adminDN</name>
+ <value>cn=Directory Manager</value>
+ </option>
+ <option>
+ <name>adminPassword</name>
+ <value>password</value>
+ </option>
+ </config>
+ </datasource>
+ </datasources>
+ <modules>
+ <module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>User</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+ <module>
+ <type>Role</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+ <module>
+ <type>Membership</type>
+ <implementation>LDAP</implementation>
+ <class>org.jboss.portal.identity.ldap.LDAPStaticRoleMembershipModuleImpl</class>
+ <config/>
+ </module>
+
+ <module>
+ <type>UserProfile</type>
+ <implementation>DELEGATING</implementation>
+ <config>
+ <option>
+ <name>profileConfigFile</name>
+ <value>test/config/profile-config.xml</value>
+ </option>
+ <option>
+ <name>ldapModuleJNDIName</name>
+ <value>java:/portal/LDAPUserProfileModule</value>
+ </option>
+ </config>
+ </module>
+ <module>
+ <type>DBDelegateUserProfile</type>
+ <implementation>DB</implementation>
+ <config/>
+ </module>
+ <module>
+ <type>LDAPDelegateUserProfile</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+ </modules>
+
+ <options>
+ <option-group>
+ <group-name>common</group-name>
+ <option>
+ <name>userContainerDN</name>
+ <value>ou=People,o=example2,dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</value>
+ </option>
+ <option>
+ <name>roleContainerDN</name>
+ <value>ou=Roles,o=example2,dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</value>
+ </option>
+ <option>
+ <name>membershipAttributeID</name>
+ <value>memberOf</value>
+ </option>
+ </option-group>
+ <option-group>
+ <group-name>userCreateAttibutes</group-name>
+ <option>
+ <name>objectClass</name>
+ <!--This objectclasses should work with Red Hat Directory-->
+ <value>top</value>
+ <value>person</value>
+ <value>inetOrgPerson</value>
+ <value>inetUser</value>
+ </option>
+ <!--Schema requires those to have initial value-->
+ <option>
+ <name>cn</name>
+ <value>none</value>
+ </option>
+ <option>
+ <name>sn</name>
+ <value>none</value>
+ </option>
+ </option-group>
+ <option-group>
+ <group-name>roleCreateAttibutes</group-name>
+ <!--Schema requires those to have initial value-->
+ <option>
+ <name>cn</name>
+ <value>none</value>
+ </option>
+ <option>
+ <name>objectClass</name>
+ <value>top</value>
+ <value>organizationalRole</value>
+ </option>
+ </option-group>
+ </options>
+</identity-configuration>
\ No newline at end of file
Added: trunk/identity/src/resources/test/config/identity/opends-config.xml
===================================================================
--- trunk/identity/src/resources/test/config/identity/opends-config.xml (rev 0)
+++ trunk/identity/src/resources/test/config/identity/opends-config.xml 2007-02-11 13:37:29 UTC (rev 6210)
@@ -0,0 +1,143 @@
+<?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 identity-configuration PUBLIC
+ "-//JBoss Portal//DTD JBoss Identity Configuration 1.0//EN"
+ "http://www.jboss.org/portal/dtd/identity-config_1_0.dtd">-->
+
+<identity-configuration>
+ <datasources>
+ <datasource>
+ <name>LDAP</name>
+ <config>
+ <option>
+ <name>host</name>
+ <value>localhost</value>
+ </option>
+ <option>
+ <name>port</name>
+ <value>10389</value>
+ </option>
+ <option>
+ <name>adminDN</name>
+ <value>cn=Directory Manager</value>
+ </option>
+ <option>
+ <name>adminPassword</name>
+ <value>password</value>
+ </option>
+ </config>
+ </datasource>
+ </datasources>
+ <modules>
+ <module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>User</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+ <module>
+ <type>Role</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+ <module>
+ <type>Membership</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+
+ <module>
+ <type>UserProfile</type>
+ <implementation>DELEGATING</implementation>
+ <config>
+ <option>
+ <name>profileConfigFile</name>
+ <value>test/config/profile-config.xml</value>
+ </option>
+ <option>
+ <name>ldapModuleJNDIName</name>
+ <value>java:/portal/LDAPUserProfileModule</value>
+ </option>
+ </config>
+ </module>
+ <module>
+ <type>DBDelegateUserProfile</type>
+ <implementation>DB</implementation>
+ <config/>
+ </module>
+ <module>
+ <type>LDAPDelegateUserProfile</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+ </modules>
+
+ <options>
+ <option-group>
+ <group-name>common</group-name>
+ <option>
+ <name>userContainerDN</name>
+ <value>ou=People,dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</value>
+ </option>
+ <option>
+ <name>roleContainerDN</name>
+ <value>ou=Roles,dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</value>
+ </option>
+ </option-group>
+ <option-group>
+ <group-name>userCreateAttibutes</group-name>
+ <option>
+ <name>objectClass</name>
+ <!--This objectclasses should work with Red Hat Directory-->
+ <value>top</value>
+ <value>person</value>
+ <value>inetOrgPerson</value>
+ </option>
+ <!--Schema requires those to have initial value-->
+ <option>
+ <name>cn</name>
+ <value>none</value>
+ </option>
+ <option>
+ <name>sn</name>
+ <value>none</value>
+ </option>
+ </option-group>
+ <option-group>
+ <group-name>roleCreateAttibutes</group-name>
+ <!--Schema requires those to have initial value-->
+ <option>
+ <name>cn</name>
+ <value>none</value>
+ </option>
+ <!--Some directory servers require this attribute to be valid DN-->
+ <!--For safety reasons point to the admin user here-->
+ <option>
+ <name>member</name>
+ <value>uid=admin,ou=People,dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</value>
+ </option>
+ </option-group>
+ </options>
+</identity-configuration>
\ No newline at end of file
Added: trunk/identity/src/resources/test/config/identity/openldap-config.xml
===================================================================
--- trunk/identity/src/resources/test/config/identity/openldap-config.xml (rev 0)
+++ trunk/identity/src/resources/test/config/identity/openldap-config.xml 2007-02-11 13:37:29 UTC (rev 6210)
@@ -0,0 +1,143 @@
+<?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 identity-configuration PUBLIC
+ "-//JBoss Portal//DTD JBoss Identity Configuration 1.0//EN"
+ "http://www.jboss.org/portal/dtd/identity-config_1_0.dtd">-->
+
+<identity-configuration>
+ <datasources>
+ <datasource>
+ <name>LDAP</name>
+ <config>
+ <option>
+ <name>host</name>
+ <value>dev09.qa.atl.jboss.com</value>
+ </option>
+ <option>
+ <name>port</name>
+ <value>389</value>
+ </option>
+ <option>
+ <name>adminDN</name>
+ <value>cn=Manager,dc=my-domain,dc=com</value>
+ </option>
+ <option>
+ <name>adminPassword</name>
+ <value>jbossqa</value>
+ </option>
+ </config>
+ </datasource>
+ </datasources>
+ <modules>
+ <module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>User</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+ <module>
+ <type>Role</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+ <module>
+ <type>Membership</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+
+ <module>
+ <type>UserProfile</type>
+ <implementation>DELEGATING</implementation>
+ <config>
+ <option>
+ <name>profileConfigFile</name>
+ <value>test/config/profile-config.xml</value>
+ </option>
+ <option>
+ <name>ldapModuleJNDIName</name>
+ <value>java:/portal/LDAPUserProfileModule</value>
+ </option>
+ </config>
+ </module>
+ <module>
+ <type>DBDelegateUserProfile</type>
+ <implementation>DB</implementation>
+ <config/>
+ </module>
+ <module>
+ <type>LDAPDelegateUserProfile</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+ </modules>
+
+ <options>
+ <option-group>
+ <group-name>common</group-name>
+ <option>
+ <name>userContainerDN</name>
+ <value>ou=People,dc=testsuite,dc=portal,dc=my-domain,dc=com</value>
+ </option>
+ <option>
+ <name>roleContainerDN</name>
+ <value>ou=Roles,dc=testsuite,dc=portal,dc=my-domain,dc=com</value>
+ </option>
+ </option-group>
+ <option-group>
+ <group-name>userCreateAttibutes</group-name>
+ <option>
+ <name>objectClass</name>
+ <!--This objectclasses should work with Red Hat Directory-->
+ <value>top</value>
+ <value>person</value>
+ <value>inetOrgPerson</value>
+ </option>
+ <!--Schema requires those to have initial value-->
+ <option>
+ <name>cn</name>
+ <value>none</value>
+ </option>
+ <option>
+ <name>sn</name>
+ <value>none</value>
+ </option>
+ </option-group>
+ <option-group>
+ <group-name>roleCreateAttibutes</group-name>
+ <!--Schema requires those to have initial value-->
+ <option>
+ <name>cn</name>
+ <value>none</value>
+ </option>
+ <!--Some directory servers require this attribute to be valid DN-->
+ <!--For safety reasons point to the admin user here-->
+ <option>
+ <name>member</name>
+ <value>uid=dummynonexistinguser,ou=People,dc=jboss,dc=org</value>
+ </option>
+ </option-group>
+ </options>
+</identity-configuration>
\ No newline at end of file
Added: trunk/identity/src/resources/test/config/identity/rhds-config-staticrole.xml
===================================================================
--- trunk/identity/src/resources/test/config/identity/rhds-config-staticrole.xml (rev 0)
+++ trunk/identity/src/resources/test/config/identity/rhds-config-staticrole.xml 2007-02-11 13:37:29 UTC (rev 6210)
@@ -0,0 +1,148 @@
+<?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 identity-configuration PUBLIC
+ "-//JBoss Portal//DTD JBoss Identity Configuration 1.0//EN"
+ "http://www.jboss.org/portal/dtd/identity-config_1_0.dtd">-->
+
+<identity-configuration>
+ <datasources>
+ <datasource>
+ <name>LDAP</name>
+ <config>
+ <option>
+ <name>host</name>
+ <value>dev39.qa.atl.jboss.com</value>
+ </option>
+ <option>
+ <name>port</name>
+ <value>10389</value>
+ </option>
+ <option>
+ <name>adminDN</name>
+ <value>cn=Directory Manager</value>
+ </option>
+ <option>
+ <name>adminPassword</name>
+ <value>qpq123qpq</value>
+ </option>
+ </config>
+ </datasource>
+ </datasources>
+ <modules>
+ <module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>User</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+ <module>
+ <type>Role</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+ <module>
+ <type>Membership</type>
+ <implementation>LDAP</implementation>
+ <class>org.jboss.portal.identity.ldap.LDAPStaticRoleMembershipModuleImpl</class>
+ <config/>
+ </module>
+
+ <module>
+ <type>UserProfile</type>
+ <implementation>DELEGATING</implementation>
+ <config>
+ <option>
+ <name>profileConfigFile</name>
+ <value>test/config/profile-config.xml</value>
+ </option>
+ <option>
+ <name>ldapModuleJNDIName</name>
+ <value>java:/portal/LDAPUserProfileModule</value>
+ </option>
+ </config>
+ </module>
+ <module>
+ <type>DBDelegateUserProfile</type>
+ <implementation>DB</implementation>
+ <config/>
+ </module>
+ <module>
+ <type>LDAPDelegateUserProfile</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+ </modules>
+
+ <options>
+ <option-group>
+ <group-name>common</group-name>
+ <option>
+ <name>userContainerDN</name>
+ <value>ou=People,o=example2,dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</value>
+ </option>
+ <option>
+ <name>roleContainerDN</name>
+ <value>ou=Roles,o=example2,dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</value>
+ </option>
+ <option>
+ <name>membershipAttributeID</name>
+ <value>memberOf</value>
+ </option>
+ </option-group>
+ <option-group>
+ <group-name>userCreateAttibutes</group-name>
+ <option>
+ <name>objectClass</name>
+ <!--This objectclasses should work with Red Hat Directory-->
+ <value>top</value>
+ <value>person</value>
+ <value>inetOrgPerson</value>
+ <value>inetUser</value>
+ </option>
+ <!--Schema requires those to have initial value-->
+ <option>
+ <name>cn</name>
+ <value>none</value>
+ </option>
+ <option>
+ <name>sn</name>
+ <value>none</value>
+ </option>
+ </option-group>
+ <option-group>
+ <group-name>roleCreateAttibutes</group-name>
+ <!--Schema requires those to have initial value-->
+ <option>
+ <name>cn</name>
+ <value>none</value>
+ </option>
+ <option>
+ <name>objectClass</name>
+ <value>top</value>
+ <value>organizationalRole</value>
+ </option>
+ </option-group>
+ </options>
+</identity-configuration>
\ No newline at end of file
Added: trunk/identity/src/resources/test/config/identity/rhds-config.xml
===================================================================
--- trunk/identity/src/resources/test/config/identity/rhds-config.xml (rev 0)
+++ trunk/identity/src/resources/test/config/identity/rhds-config.xml 2007-02-11 13:37:29 UTC (rev 6210)
@@ -0,0 +1,143 @@
+<?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 identity-configuration PUBLIC
+ "-//JBoss Portal//DTD JBoss Identity Configuration 1.0//EN"
+ "http://www.jboss.org/portal/dtd/identity-config_1_0.dtd">-->
+
+<identity-configuration>
+ <datasources>
+ <datasource>
+ <name>LDAP</name>
+ <config>
+ <option>
+ <name>host</name>
+ <value>dev39.qa.atl.jboss.com</value>
+ </option>
+ <option>
+ <name>port</name>
+ <value>10389</value>
+ </option>
+ <option>
+ <name>adminDN</name>
+ <value>cn=Directory Manager</value>
+ </option>
+ <option>
+ <name>adminPassword</name>
+ <value>qpq123qpq</value>
+ </option>
+ </config>
+ </datasource>
+ </datasources>
+ <modules>
+ <module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>User</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+ <module>
+ <type>Role</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+ <module>
+ <type>Membership</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+
+ <module>
+ <type>UserProfile</type>
+ <implementation>DELEGATING</implementation>
+ <config>
+ <option>
+ <name>profileConfigFile</name>
+ <value>test/config/profile-config.xml</value>
+ </option>
+ <option>
+ <name>ldapModuleJNDIName</name>
+ <value>java:/portal/LDAPUserProfileModule</value>
+ </option>
+ </config>
+ </module>
+ <module>
+ <type>DBDelegateUserProfile</type>
+ <implementation>DB</implementation>
+ <config/>
+ </module>
+ <module>
+ <type>LDAPDelegateUserProfile</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+ </modules>
+
+ <options>
+ <option-group>
+ <group-name>common</group-name>
+ <option>
+ <name>userContainerDN</name>
+ <value>ou=People,dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</value>
+ </option>
+ <option>
+ <name>roleContainerDN</name>
+ <value>ou=Roles,dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</value>
+ </option>
+ </option-group>
+ <option-group>
+ <group-name>userCreateAttibutes</group-name>
+ <option>
+ <name>objectClass</name>
+ <!--This objectclasses should work with Red Hat Directory-->
+ <value>top</value>
+ <value>person</value>
+ <value>inetOrgPerson</value>
+ </option>
+ <!--Schema requires those to have initial value-->
+ <option>
+ <name>cn</name>
+ <value>none</value>
+ </option>
+ <option>
+ <name>sn</name>
+ <value>none</value>
+ </option>
+ </option-group>
+ <option-group>
+ <group-name>roleCreateAttibutes</group-name>
+ <!--Schema requires those to have initial value-->
+ <option>
+ <name>cn</name>
+ <value>none</value>
+ </option>
+ <!--Some directory servers require this attribute to be valid DN-->
+ <!--For safety reasons point to the admin user here-->
+ <option>
+ <name>member</name>
+ <value>uid=dummynonexistinguser,ou=People,dc=jboss,dc=org</value>
+ </option>
+ </option-group>
+ </options>
+</identity-configuration>
\ No newline at end of file
Modified: trunk/identity/src/resources/test/config/standardidentity-config.xml
===================================================================
--- trunk/identity/src/resources/test/config/standardidentity-config.xml 2007-02-11 13:25:59 UTC (rev 6209)
+++ trunk/identity/src/resources/test/config/standardidentity-config.xml 2007-02-11 13:37:29 UTC (rev 6210)
@@ -210,7 +210,7 @@
<option>
<name>sessionFactoryJNDIName</name>
<value>java:/portal/IdentitySessionFactory</value>
- </option>
+ </option> opends-config.xml
<option>
<name>jndiName</name>
<value>java:/portal/DBUserProfileModule</value>
Added: trunk/identity/src/resources/test/config/staticrole/opends-config.xml
===================================================================
--- trunk/identity/src/resources/test/config/staticrole/opends-config.xml (rev 0)
+++ trunk/identity/src/resources/test/config/staticrole/opends-config.xml 2007-02-11 13:37:29 UTC (rev 6210)
@@ -0,0 +1,148 @@
+<?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 identity-configuration PUBLIC
+ "-//JBoss Portal//DTD JBoss Identity Configuration 1.0//EN"
+ "http://www.jboss.org/portal/dtd/identity-config_1_0.dtd">-->
+
+<identity-configuration>
+ <datasources>
+ <datasource>
+ <name>LDAP</name>
+ <config>
+ <option>
+ <name>host</name>
+ <value>localhost</value>
+ </option>
+ <option>
+ <name>port</name>
+ <value>10389</value>
+ </option>
+ <option>
+ <name>adminDN</name>
+ <value>cn=Directory Manager</value>
+ </option>
+ <option>
+ <name>adminPassword</name>
+ <value>password</value>
+ </option>
+ </config>
+ </datasource>
+ </datasources>
+ <modules>
+ <module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>User</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+ <module>
+ <type>Role</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+ <module>
+ <type>Membership</type>
+ <implementation>LDAP</implementation>
+ <class>org.jboss.portal.identity.ldap.LDAPStaticRoleMembershipModuleImpl</class>
+ <config/>
+ </module>
+
+ <module>
+ <type>UserProfile</type>
+ <implementation>DELEGATING</implementation>
+ <config>
+ <option>
+ <name>profileConfigFile</name>
+ <value>test/config/profile-config.xml</value>
+ </option>
+ <option>
+ <name>ldapModuleJNDIName</name>
+ <value>java:/portal/LDAPUserProfileModule</value>
+ </option>
+ </config>
+ </module>
+ <module>
+ <type>DBDelegateUserProfile</type>
+ <implementation>DB</implementation>
+ <config/>
+ </module>
+ <module>
+ <type>LDAPDelegateUserProfile</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+ </modules>
+
+ <options>
+ <option-group>
+ <group-name>common</group-name>
+ <option>
+ <name>userContainerDN</name>
+ <value>ou=People,o=example2,dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</value>
+ </option>
+ <option>
+ <name>roleContainerDN</name>
+ <value>ou=Roles,o=example2,dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</value>
+ </option>
+ <option>
+ <name>membershipAttributeID</name>
+ <value>memberOf</value>
+ </option>
+ </option-group>
+ <option-group>
+ <group-name>userCreateAttibutes</group-name>
+ <option>
+ <name>objectClass</name>
+ <!--This objectclasses should work with Red Hat Directory-->
+ <value>top</value>
+ <value>person</value>
+ <value>inetOrgPerson</value>
+ <value>inetUser</value>
+ </option>
+ <!--Schema requires those to have initial value-->
+ <option>
+ <name>cn</name>
+ <value>none</value>
+ </option>
+ <option>
+ <name>sn</name>
+ <value>none</value>
+ </option>
+ </option-group>
+ <option-group>
+ <group-name>roleCreateAttibutes</group-name>
+ <!--Schema requires those to have initial value-->
+ <option>
+ <name>cn</name>
+ <value>none</value>
+ </option>
+ <option>
+ <name>objectClass</name>
+ <value>top</value>
+ <value>organizationalRole</value>
+ </option>
+ </option-group>
+ </options>
+</identity-configuration>
\ No newline at end of file
Added: trunk/identity/src/resources/test/config/staticrole/rhds-config.xml
===================================================================
--- trunk/identity/src/resources/test/config/staticrole/rhds-config.xml (rev 0)
+++ trunk/identity/src/resources/test/config/staticrole/rhds-config.xml 2007-02-11 13:37:29 UTC (rev 6210)
@@ -0,0 +1,148 @@
+<?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 identity-configuration PUBLIC
+ "-//JBoss Portal//DTD JBoss Identity Configuration 1.0//EN"
+ "http://www.jboss.org/portal/dtd/identity-config_1_0.dtd">-->
+
+<identity-configuration>
+ <datasources>
+ <datasource>
+ <name>LDAP</name>
+ <config>
+ <option>
+ <name>host</name>
+ <value>dev39.qa.atl.jboss.com</value>
+ </option>
+ <option>
+ <name>port</name>
+ <value>10389</value>
+ </option>
+ <option>
+ <name>adminDN</name>
+ <value>cn=Directory Manager</value>
+ </option>
+ <option>
+ <name>adminPassword</name>
+ <value>qpq123qpq</value>
+ </option>
+ </config>
+ </datasource>
+ </datasources>
+ <modules>
+ <module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>User</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+ <module>
+ <type>Role</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+ <module>
+ <type>Membership</type>
+ <implementation>LDAP</implementation>
+ <class>org.jboss.portal.identity.ldap.LDAPStaticRoleMembershipModuleImpl</class>
+ <config/>
+ </module>
+
+ <module>
+ <type>UserProfile</type>
+ <implementation>DELEGATING</implementation>
+ <config>
+ <option>
+ <name>profileConfigFile</name>
+ <value>test/config/profile-config.xml</value>
+ </option>
+ <option>
+ <name>ldapModuleJNDIName</name>
+ <value>java:/portal/LDAPUserProfileModule</value>
+ </option>
+ </config>
+ </module>
+ <module>
+ <type>DBDelegateUserProfile</type>
+ <implementation>DB</implementation>
+ <config/>
+ </module>
+ <module>
+ <type>LDAPDelegateUserProfile</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+ </modules>
+
+ <options>
+ <option-group>
+ <group-name>common</group-name>
+ <option>
+ <name>userContainerDN</name>
+ <value>ou=People,o=example2,dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</value>
+ </option>
+ <option>
+ <name>roleContainerDN</name>
+ <value>ou=Roles,o=example2,dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</value>
+ </option>
+ <option>
+ <name>membershipAttributeID</name>
+ <value>memberOf</value>
+ </option>
+ </option-group>
+ <option-group>
+ <group-name>userCreateAttibutes</group-name>
+ <option>
+ <name>objectClass</name>
+ <!--This objectclasses should work with Red Hat Directory-->
+ <value>top</value>
+ <value>person</value>
+ <value>inetOrgPerson</value>
+ <value>inetUser</value>
+ </option>
+ <!--Schema requires those to have initial value-->
+ <option>
+ <name>cn</name>
+ <value>none</value>
+ </option>
+ <option>
+ <name>sn</name>
+ <value>none</value>
+ </option>
+ </option-group>
+ <option-group>
+ <group-name>roleCreateAttibutes</group-name>
+ <!--Schema requires those to have initial value-->
+ <option>
+ <name>cn</name>
+ <value>none</value>
+ </option>
+ <option>
+ <name>objectClass</name>
+ <value>top</value>
+ <value>organizationalRole</value>
+ </option>
+ </option-group>
+ </options>
+</identity-configuration>
\ No newline at end of file
Added: trunk/test/src/etc/directories-identity.xml
===================================================================
--- trunk/test/src/etc/directories-identity.xml (rev 0)
+++ trunk/test/src/etc/directories-identity.xml 2007-02-11 13:37:29 UTC (rev 6210)
@@ -0,0 +1,111 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<directories>
+ <directory>
+ <directory-name>OpenDS</directory-name>
+ <description>OpenDS service deployed on JBoss AS as an mbean -StaticGroupMembership config</description>
+
+ <config-file>test/config/identity/opends-config.xml</config-file>
+ <host>localhost</host>
+ <port>10389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>cn=Directory Manager</admin-dn>
+ <admin-password>password</admin-password>
+ <populate-ldif>ldap/ldif/initial-tests-notpopulated.ldif</populate-ldif>
+ <cleanup-dn>dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</cleanup-dn>
+ </directory>
+ <directory>
+ <directory-name>OpenDS - StaticRoleMembership</directory-name>
+ <description>OpenDS service deployed on JBoss AS as an mbean - StaticRoleMembership config</description>
+ <config-file>test/config/identity/opends-config-staticrole.xml</config-file>
+ <host>localhost</host>
+ <port>10389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>cn=Directory Manager</admin-dn>
+ <admin-password>password</admin-password>
+ <populate-ldif>ldap/ldif/initial-tests-notpopulated.ldif</populate-ldif>
+ <cleanup-dn>dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</cleanup-dn>
+ </directory>
+ <directory>
+ <directory-name>RedHatDS</directory-name>
+ <description>RedHat Directory in QA Labs (need vpn access) - StaticGroupMembership config</description>
+
+ <config-file>test/config/identity/rhds-config.xml</config-file>
+ <host>dev39.qa.atl.jboss.com</host>
+ <port>10389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>cn=Directory Manager</admin-dn>
+ <admin-password>qpq123qpq</admin-password>
+
+ <populate-ldif>ldap/ldif/initial-tests-notpopulated.ldif</populate-ldif>
+
+ <cleanup-dn>dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</cleanup-dn>
+ </directory>
+ <directory>
+ <directory-name>RedHatDS</directory-name>
+ <description>RedHat Directory in QA Labs (need vpn access) - StaticRoleMembership config</description>
+
+ <config-file>test/config/identity/rhds-config-staticrole.xml</config-file>
+ <host>dev39.qa.atl.jboss.com</host>
+ <port>10389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>cn=Directory Manager</admin-dn>
+ <admin-password>qpq123qpq</admin-password>
+
+ <populate-ldif>ldap/ldif/initial-tests-notpopulated.ldif</populate-ldif>
+
+ <cleanup-dn>dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</cleanup-dn>
+ </directory>
+
+ <directory>
+ <directory-name>OpenLDAP</directory-name>
+ <description>OpenLDAP Directory in QA Labs (need vpn access) - StaticGroupMembership config</description>
+
+ <config-file>test/config/identity/openldap-config.xml</config-file>
+ <host>dev09.qa.atl.jboss.com</host>
+ <port>389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>cn=Manager,dc=my-domain,dc=com</admin-dn>
+ <admin-password>jbossqa</admin-password>
+
+ <populate-ldif>ldap/ldif/initial-tests-notpopulated-openldap.ldif</populate-ldif>
+
+ <cleanup-dn>dc=testsuite,dc=portal,dc=my-domain,dc=com</cleanup-dn>
+ </directory>
+ <!--<directory>
+ <directory-name>MSAD</directory-name>
+ <description>Microsoft Active Directory in QA Labs (need vpn access)</description>
+
+ <config-file>test/config/msad-config.xml</config-file>
+ <host>dev44.qa.atl.jboss.com</host>
+ <port>389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>JBOSS\jbossqa</admin-dn>
+ <admin-password>jboss42</admin-password>
+
+ <populate-ldif>ldap/ldif/initial-tests-qa-msad.ldif</populate-ldif>
+
+ <cleanup-dn>ou=testsuite,ou=portal,dc=jboss,dc=test</cleanup-dn>
+ </directory>-->
+</directories>
Added: trunk/test/src/etc/directories-simplerolemodule.xml
===================================================================
--- trunk/test/src/etc/directories-simplerolemodule.xml (rev 0)
+++ trunk/test/src/etc/directories-simplerolemodule.xml 2007-02-11 13:37:29 UTC (rev 6210)
@@ -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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<directories>
+ <directory>
+ <directory-name>OpenDS</directory-name>
+ <description>OpenDS service deployed on JBoss AS as an mbean</description>
+ <!--identity configuration file-->
+ <config-file>test/config/opends-config.xml</config-file>
+ <host>localhost</host>
+ <port>10389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>cn=Directory Manager</admin-dn>
+ <admin-password>password</admin-password>
+ <!--ldif from which LDAP will be populated before each test-->
+ <populate-ldif>ldap/ldif/initial-tests-qa.ldif</populate-ldif>
+ <!--DN that will be removed to perform cleanup after each test-->
+ <cleanup-dn>dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</cleanup-dn>
+ </directory>
+ <directory>
+ <directory-name>RedHatDS</directory-name>
+ <description>RedHat Directory in QA Labs (need vpn access)</description>
+
+ <config-file>test/config/rhds-config.xml</config-file>
+ <host>dev39.qa.atl.jboss.com</host>
+ <port>10389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>cn=Directory Manager</admin-dn>
+ <admin-password>qpq123qpq</admin-password>
+
+ <populate-ldif>ldap/ldif/initial-tests-qa.ldif</populate-ldif>
+
+ <cleanup-dn>dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</cleanup-dn>
+ </directory>
+ <directory>
+ <directory-name>OpenLDAP</directory-name>
+ <description>OpenLDAP Directory in QA Labs (need vpn access)</description>
+
+ <config-file>test/config/openldap-config.xml</config-file>
+ <host>dev09.qa.atl.jboss.com</host>
+ <port>389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>cn=Manager,dc=my-domain,dc=com</admin-dn>
+ <admin-password>jbossqa</admin-password>
+
+ <populate-ldif>ldap/ldif/initial-tests-qa-openldap.ldif</populate-ldif>
+
+ <cleanup-dn>dc=testsuite,dc=portal,dc=my-domain,dc=com</cleanup-dn>
+ </directory>
+ <!--<directory>
+ <directory-name>MSAD</directory-name>
+ <description>Microsoft Active Directory in QA Labs (need vpn access)</description>
+
+ <config-file>test/config/msad-config.xml</config-file>
+ <host>dev44.qa.atl.jboss.com</host>
+ <port>389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>JBOSS\jbossqa</admin-dn>
+ <admin-password>jboss42</admin-password>
+
+ <populate-ldif>ldap/ldif/initial-tests-qa-msad.ldif</populate-ldif>
+
+ <cleanup-dn>ou=testsuite,ou=portal,dc=jboss,dc=test</cleanup-dn>
+ </directory>-->
+</directories>
Added: trunk/test/src/etc/directories-simpleusermodule.xml
===================================================================
--- trunk/test/src/etc/directories-simpleusermodule.xml (rev 0)
+++ trunk/test/src/etc/directories-simpleusermodule.xml 2007-02-11 13:37:29 UTC (rev 6210)
@@ -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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<directories>
+ <directory>
+ <directory-name>OpenDS</directory-name>
+ <description>OpenDS service deployed on JBoss AS as an mbean</description>
+ <!--identity configuration file-->
+ <config-file>test/config/opends-config.xml</config-file>
+ <host>localhost</host>
+ <port>10389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>cn=Directory Manager</admin-dn>
+ <admin-password>password</admin-password>
+ <!--ldif from which LDAP will be populated before each test-->
+ <populate-ldif>ldap/ldif/initial-tests-qa.ldif</populate-ldif>
+ <!--DN that will be removed to perform cleanup after each test-->
+ <cleanup-dn>dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</cleanup-dn>
+ </directory>
+ <directory>
+ <directory-name>RedHatDS</directory-name>
+ <description>RedHat Directory in QA Labs (need vpn access)</description>
+
+ <config-file>test/config/rhds-config.xml</config-file>
+ <host>dev39.qa.atl.jboss.com</host>
+ <port>10389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>cn=Directory Manager</admin-dn>
+ <admin-password>qpq123qpq</admin-password>
+
+ <populate-ldif>ldap/ldif/initial-tests-qa.ldif</populate-ldif>
+
+ <cleanup-dn>dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</cleanup-dn>
+ </directory>
+ <directory>
+ <directory-name>OpenLDAP</directory-name>
+ <description>OpenLDAP Directory in QA Labs (need vpn access)</description>
+
+ <config-file>test/config/openldap-config.xml</config-file>
+ <host>dev09.qa.atl.jboss.com</host>
+ <port>389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>cn=Manager,dc=my-domain,dc=com</admin-dn>
+ <admin-password>jbossqa</admin-password>
+
+ <populate-ldif>ldap/ldif/initial-tests-qa-openldap.ldif</populate-ldif>
+
+ <cleanup-dn>dc=testsuite,dc=portal,dc=my-domain,dc=com</cleanup-dn>
+ </directory>
+ <!--<directory>
+ <directory-name>MSAD</directory-name>
+ <description>Microsoft Active Directory in QA Labs (need vpn access)</description>
+
+ <config-file>test/config/msad-config.xml</config-file>
+ <host>dev44.qa.atl.jboss.com</host>
+ <port>389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>JBOSS\jbossqa</admin-dn>
+ <admin-password>jboss42</admin-password>
+
+ <populate-ldif>ldap/ldif/initial-tests-qa-msad.ldif</populate-ldif>
+
+ <cleanup-dn>ou=testsuite,ou=portal,dc=jboss,dc=test</cleanup-dn>
+ </directory>-->
+</directories>
Added: trunk/test/src/etc/directories-staticgroupmembership.xml
===================================================================
--- trunk/test/src/etc/directories-staticgroupmembership.xml (rev 0)
+++ trunk/test/src/etc/directories-staticgroupmembership.xml 2007-02-11 13:37:29 UTC (rev 6210)
@@ -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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<directories>
+ <directory>
+ <directory-name>OpenDS</directory-name>
+ <description>OpenDS service deployed on JBoss AS as an mbean</description>
+ <!--identity configuration file-->
+ <config-file>test/config/opends-config.xml</config-file>
+ <host>localhost</host>
+ <port>10389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>cn=Directory Manager</admin-dn>
+ <admin-password>password</admin-password>
+ <!--ldif from which LDAP will be populated before each test-->
+ <populate-ldif>ldap/ldif/initial-tests-qa.ldif</populate-ldif>
+ <!--DN that will be removed to perform cleanup after each test-->
+ <cleanup-dn>dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</cleanup-dn>
+ </directory>
+ <directory>
+ <directory-name>RedHatDS</directory-name>
+ <description>RedHat Directory in QA Labs (need vpn access)</description>
+
+ <config-file>test/config/rhds-config.xml</config-file>
+ <host>dev39.qa.atl.jboss.com</host>
+ <port>10389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>cn=Directory Manager</admin-dn>
+ <admin-password>qpq123qpq</admin-password>
+
+ <populate-ldif>ldap/ldif/initial-tests-qa.ldif</populate-ldif>
+
+ <cleanup-dn>dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</cleanup-dn>
+ </directory>
+ <directory>
+ <directory-name>OpenLDAP</directory-name>
+ <description>OpenLDAP Directory in QA Labs (need vpn access)</description>
+
+ <config-file>test/config/openldap-config.xml</config-file>
+ <host>dev09.qa.atl.jboss.com</host>
+ <port>389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>cn=Manager,dc=my-domain,dc=com</admin-dn>
+ <admin-password>jbossqa</admin-password>
+
+ <populate-ldif>ldap/ldif/initial-tests-qa-openldap.ldif</populate-ldif>
+
+ <cleanup-dn>dc=testsuite,dc=portal,dc=my-domain,dc=com</cleanup-dn>
+ </directory>
+ <!--<directory>
+ <directory-name>MSAD</directory-name>
+ <description>Microsoft Active Directory in QA Labs (need vpn access)</description>
+
+ <config-file>test/config/msad-config.xml</config-file>
+ <host>dev44.qa.atl.jboss.com</host>
+ <port>389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>JBOSS\jbossqa</admin-dn>
+ <admin-password>jboss42</admin-password>
+
+ <populate-ldif>ldap/ldif/initial-tests-qa-msad.ldif</populate-ldif>
+
+ <cleanup-dn>ou=testsuite,ou=portal,dc=jboss,dc=test</cleanup-dn>
+ </directory>-->
+</directories>
Added: trunk/test/src/etc/directories-staticrolemembership.xml
===================================================================
--- trunk/test/src/etc/directories-staticrolemembership.xml (rev 0)
+++ trunk/test/src/etc/directories-staticrolemembership.xml 2007-02-11 13:37:29 UTC (rev 6210)
@@ -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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<directories>
+ <directory>
+ <directory-name>OpenDS</directory-name>
+ <description>OpenDS service deployed on JBoss AS as an mbean</description>
+ <!--identity configuration file-->
+ <config-file>test/config/staticrole/opends-config.xml</config-file>
+ <host>localhost</host>
+ <port>10389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>cn=Directory Manager</admin-dn>
+ <admin-password>password</admin-password>
+ <!--ldif from which LDAP will be populated before each test-->
+ <populate-ldif>ldap/ldif/initial-tests-qa.ldif</populate-ldif>
+ <!--DN that will be removed to perform cleanup after each test-->
+ <cleanup-dn>dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</cleanup-dn>
+ </directory>
+ <directory>
+ <directory-name>RedHatDS</directory-name>
+ <description>RedHat Directory in QA Labs (need vpn access)</description>
+
+ <config-file>test/config/staticrole/rhds-config.xml</config-file>
+ <host>dev39.qa.atl.jboss.com</host>
+ <port>10389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>cn=Directory Manager</admin-dn>
+ <admin-password>qpq123qpq</admin-password>
+
+ <populate-ldif>ldap/ldif/initial-tests-qa.ldif</populate-ldif>
+
+ <cleanup-dn>dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</cleanup-dn>
+ </directory>
+ <!--<directory>
+ <directory-name>OpenLDAP</directory-name>
+ <description>OpenLDAP Directory in QA Labs (need vpn access)</description>
+
+ <config-file>test/config/openldap-config.xml</config-file>
+ <host>dev09.qa.atl.jboss.com</host>
+ <port>389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>cn=Manager,dc=my-domain,dc=com</admin-dn>
+ <admin-password>jbossqa</admin-password>
+
+ <populate-ldif>ldap/ldif/initial-tests-qa-openldap.ldif</populate-ldif>
+
+ <cleanup-dn>dc=testsuite,dc=portal,dc=my-domain,dc=com</cleanup-dn>
+ </directory>-->
+ <!--<directory>
+ <directory-name>MSAD</directory-name>
+ <description>Microsoft Active Directory in QA Labs (need vpn access)</description>
+
+ <config-file>test/config/msad-config.xml</config-file>
+ <host>dev44.qa.atl.jboss.com</host>
+ <port>389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>JBOSS\jbossqa</admin-dn>
+ <admin-password>jboss42</admin-password>
+
+ <populate-ldif>ldap/ldif/initial-tests-qa-msad.ldif</populate-ldif>
+
+ <cleanup-dn>ou=testsuite,ou=portal,dc=jboss,dc=test</cleanup-dn>
+ </directory>-->
+</directories>
Added: trunk/test/src/etc/directories-userprofilemodule.xml
===================================================================
--- trunk/test/src/etc/directories-userprofilemodule.xml (rev 0)
+++ trunk/test/src/etc/directories-userprofilemodule.xml 2007-02-11 13:37:29 UTC (rev 6210)
@@ -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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<directories>
+ <directory>
+ <directory-name>OpenDS</directory-name>
+ <description>OpenDS service deployed on JBoss AS as an mbean</description>
+ <!--identity configuration file-->
+ <config-file>test/config/opends-config.xml</config-file>
+ <host>localhost</host>
+ <port>10389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>cn=Directory Manager</admin-dn>
+ <admin-password>password</admin-password>
+ <!--ldif from which LDAP will be populated before each test-->
+ <populate-ldif>ldap/ldif/initial-tests-qa.ldif</populate-ldif>
+ <!--DN that will be removed to perform cleanup after each test-->
+ <cleanup-dn>dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</cleanup-dn>
+ </directory>
+ <directory>
+ <directory-name>RedHatDS</directory-name>
+ <description>RedHat Directory in QA Labs (need vpn access)</description>
+
+ <config-file>test/config/rhds-config.xml</config-file>
+ <host>dev39.qa.atl.jboss.com</host>
+ <port>10389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>cn=Directory Manager</admin-dn>
+ <admin-password>qpq123qpq</admin-password>
+
+ <populate-ldif>ldap/ldif/initial-tests-qa.ldif</populate-ldif>
+
+ <cleanup-dn>dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</cleanup-dn>
+ </directory>
+ <directory>
+ <directory-name>OpenLDAP</directory-name>
+ <description>OpenLDAP Directory in QA Labs (need vpn access)</description>
+
+ <config-file>test/config/openldap-config.xml</config-file>
+ <host>dev09.qa.atl.jboss.com</host>
+ <port>389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>cn=Manager,dc=my-domain,dc=com</admin-dn>
+ <admin-password>jbossqa</admin-password>
+
+ <populate-ldif>ldap/ldif/initial-tests-qa-openldap.ldif</populate-ldif>
+
+ <cleanup-dn>dc=testsuite,dc=portal,dc=my-domain,dc=com</cleanup-dn>
+ </directory>
+ <!--<directory>
+ <directory-name>MSAD</directory-name>
+ <description>Microsoft Active Directory in QA Labs (need vpn access)</description>
+
+ <config-file>test/config/msad-config.xml</config-file>
+ <host>dev44.qa.atl.jboss.com</host>
+ <port>389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>JBOSS\jbossqa</admin-dn>
+ <admin-password>jboss42</admin-password>
+
+ <populate-ldif>ldap/ldif/initial-tests-qa-msad.ldif</populate-ldif>
+
+ <cleanup-dn>ou=testsuite,ou=portal,dc=jboss,dc=test</cleanup-dn>
+ </directory>-->
+</directories>
Modified: trunk/test/src/etc/directories.xml
===================================================================
--- trunk/test/src/etc/directories.xml 2007-02-11 13:25:59 UTC (rev 6209)
+++ trunk/test/src/etc/directories.xml 2007-02-11 13:37:29 UTC (rev 6210)
@@ -37,7 +37,7 @@
<!--DN that will be removed to perform cleanup after each test-->
<cleanup-dn>dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</cleanup-dn>
</directory>
- <directory>
+ <!--<directory>
<directory-name>RedHatDS</directory-name>
<description>RedHat Directory in QA Labs (need vpn access)</description>
@@ -81,5 +81,5 @@
<populate-ldif>ldap/ldif/initial-tests-qa-openldap.ldif</populate-ldif>
<cleanup-dn>dc=testsuite,dc=portal,dc=my-domain,dc=com</cleanup-dn>
- </directory>
+ </directory>-->
</directories>
Added: trunk/test/src/etc/ldap/ldif/initial-tests-notpopulated-openldap.ldif
===================================================================
--- trunk/test/src/etc/ldap/ldif/initial-tests-notpopulated-openldap.ldif (rev 0)
+++ trunk/test/src/etc/ldap/ldif/initial-tests-notpopulated-openldap.ldif 2007-02-11 13:37:29 UTC (rev 6210)
@@ -0,0 +1,32 @@
+dn: dc=testsuite,dc=portal,dc=my-domain,dc=com
+objectclass: top
+objectclass: dcObject
+objectclass: organization
+dc: testsuite
+o: testsuite
+
+dn: ou=People,dc=testsuite,dc=portal,dc=my-domain,dc=com
+objectclass: top
+objectclass: organizationalUnit
+ou: People
+
+dn: ou=Roles,dc=testsuite,dc=portal,dc=my-domain,dc=com
+objectclass: top
+objectclass: organizationalUnit
+ou: Roles
+
+# tree2
+dn: o=example2,dc=testsuite,dc=portal,dc=my-domain,dc=com
+objectclass: top
+objectclass: organization
+o: example2
+
+dn: ou=People,o=example2,dc=testsuite,dc=portal,dc=my-domain,dc=com
+objectclass: top
+objectclass: organizationalUnit
+ou: People
+
+dn: ou=Roles,o=example2,dc=testsuite,dc=portal,dc=my-domain,dc=com
+objectclass: top
+objectclass: organizationalUnit
+ou: Roles
Added: trunk/test/src/etc/ldap/ldif/initial-tests-notpopulated.ldif
===================================================================
--- trunk/test/src/etc/ldap/ldif/initial-tests-notpopulated.ldif (rev 0)
+++ trunk/test/src/etc/ldap/ldif/initial-tests-notpopulated.ldif 2007-02-11 13:37:29 UTC (rev 6210)
@@ -0,0 +1,35 @@
+dn: dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com
+objectclass: top
+objectclass: dcObject
+objectclass: organization
+dc: testsuite
+o: testsuite
+
+dn: ou=People,dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com
+objectclass: top
+objectclass: organizationalUnit
+ou: People
+
+dn: ou=Roles,dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com
+objectclass: top
+objectclass: organizationalUnit
+ou: Roles
+
+# tree2
+dn: o=example2,dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com
+objectclass: top
+objectclass: organization
+o: example2
+
+dn: ou=People,o=example2,dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com
+objectclass: top
+objectclass: organizationalUnit
+ou: People
+
+dn: ou=Roles,o=example2,dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com
+objectclass: top
+objectclass: organizationalUnit
+ou: Roles
+
+
+
19 years, 2 months
JBoss Portal SVN: r6209 - trunk/tools/etc/buildfragments.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-02-11 08:25:59 -0500 (Sun, 11 Feb 2007)
New Revision: 6209
Modified:
trunk/tools/etc/buildfragments/defaults.ent
Log:
- increase default junit.timeout up to 30min
Modified: trunk/tools/etc/buildfragments/defaults.ent
===================================================================
--- trunk/tools/etc/buildfragments/defaults.ent 2007-02-11 00:39:20 UTC (rev 6208)
+++ trunk/tools/etc/buildfragments/defaults.ent 2007-02-11 13:25:59 UTC (rev 6209)
@@ -143,7 +143,7 @@
<property name="javadoc.packages" value="org.jboss.*"/>
<!-- Override JUnit defaults -->
- <property name="junit.timeout" value="600000"/> <!-- 10 minutes -->
+ <property name="junit.timeout" value="1800000"/> <!-- 30 minutes -->
<property name="junit.batchtest.todir" value="${build.reports}"/>
<property name="junit.jvm.options" value="-Ddummy"/>
19 years, 2 months
JBoss Portal SVN: r6208 - trunk/common/src/main/org/jboss/portal/common/markup.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-10 19:39:20 -0500 (Sat, 10 Feb 2007)
New Revision: 6208
Modified:
trunk/common/src/main/org/jboss/portal/common/markup/MarkupElement.java
Log:
- moved markup classes to common
- test case for markup classes
- removed obsolete x-www-url-formencoded encoder because it is duplicated by FastURLEncoder
- added UndeclaredIOException to prevent classes to have to throw IOException in their signature
Modified: trunk/common/src/main/org/jboss/portal/common/markup/MarkupElement.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/markup/MarkupElement.java 2007-02-11 00:38:43 UTC (rev 6207)
+++ trunk/common/src/main/org/jboss/portal/common/markup/MarkupElement.java 2007-02-11 00:39:20 UTC (rev 6208)
@@ -136,9 +136,9 @@
return null;
}
- public void write(String contextPath, Writer writer) throws UndeclaredIOException
+ public void write(String urlPrefix, Writer writer) throws UndeclaredIOException
{
- if (contextPath == null)
+ if (urlPrefix == null)
{
throw new IllegalArgumentException("No context path provided");
}
@@ -162,7 +162,7 @@
writer.write("=\"");
if (attribute.value.startsWith("/"))
{
- MarkupAttribute.Type.URI.encode(contextPath, writer);
+ MarkupAttribute.Type.URI.encode(urlPrefix, writer);
}
writer.write(attribute.encodedValue);
writer.write('"');
19 years, 2 months
JBoss Portal SVN: r6207 - trunk/common/src/main/org/jboss/portal/test/common.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-10 19:38:43 -0500 (Sat, 10 Feb 2007)
New Revision: 6207
Modified:
trunk/common/src/main/org/jboss/portal/test/common/MarkupTestCase.java
Log:
- moved markup classes to common
- test case for markup classes
- removed obsolete x-www-url-formencoded encoder because it is duplicated by FastURLEncoder
- added UndeclaredIOException to prevent classes to have to throw IOException in their signature
Modified: trunk/common/src/main/org/jboss/portal/test/common/MarkupTestCase.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/MarkupTestCase.java 2007-02-11 00:33:46 UTC (rev 6206)
+++ trunk/common/src/main/org/jboss/portal/test/common/MarkupTestCase.java 2007-02-11 00:38:43 UTC (rev 6207)
@@ -106,4 +106,10 @@
assertEquals(MarkupAttribute.Type.CDATA, attribute.getType());
assertEquals(null, element.getAttribute("someotherattributename"));
}
+
+ public void testAttributeURIEncoding()
+ {
+ MarkupAttribute attribute = new MarkupAttribute("name", "/-_.*ABCabc012# ", MarkupAttribute.Type.URI);
+ assertEquals("/-_.*ABCabc012%23+", attribute.getEncodedValue());
+ }
}
19 years, 2 months
JBoss Portal SVN: r6206 - trunk/common.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-10 19:33:46 -0500 (Sat, 10 Feb 2007)
New Revision: 6206
Modified:
trunk/common/build.xml
Log:
- moved markup classes to common
- test case for markup classes
- removed obsolete x-www-url-formencoded encoder because it is duplicated by FastURLEncoder
- added UndeclaredIOException to prevent classes to have to throw IOException in their signature
Modified: trunk/common/build.xml
===================================================================
--- trunk/common/build.xml 2007-02-11 00:32:15 UTC (rev 6205)
+++ trunk/common/build.xml 2007-02-11 00:33:46 UTC (rev 6206)
@@ -202,7 +202,6 @@
<x-test>
<test todir="${test.reports}" name="org.jboss.portal.test.common.MarkupTestCase"/>
-<!--
<test todir="${test.reports}" name="org.jboss.portal.test.common.TypedMapTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.test.InfoTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.test.TestParameterValueTestCase"/>
@@ -227,7 +226,6 @@
<test todir="${test.reports}" name="org.jboss.portal.test.common.BufferedStreamTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.CharBufferTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.CopyOnWriteRegistryTestCase"/>
--->
</x-test>
<x-classpath>
<pathelement location="${build.classes}"/>
19 years, 2 months
JBoss Portal SVN: r6205 - trunk/core/src/main/org/jboss/portal/core/util.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-10 19:32:15 -0500 (Sat, 10 Feb 2007)
New Revision: 6205
Removed:
trunk/core/src/main/org/jboss/portal/core/util/markup/
Log:
- moved markup classes to common
- test case for markup classes
- removed obsolete x-www-url-formencoded encoder because it is duplicated by FastURLEncoder
- added UndeclaredIOException to prevent classes to have to throw IOException in their signature
19 years, 2 months
JBoss Portal SVN: r6204 - in trunk: common/src/main/org/jboss/portal/common and 9 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-10 19:30:13 -0500 (Sat, 10 Feb 2007)
New Revision: 6204
Added:
trunk/common/src/main/org/jboss/portal/common/io/
trunk/common/src/main/org/jboss/portal/common/io/UndeclaredIOException.java
trunk/common/src/main/org/jboss/portal/common/markup/
trunk/common/src/main/org/jboss/portal/common/markup/MarkupAttribute.java
trunk/common/src/main/org/jboss/portal/common/markup/MarkupElement.java
trunk/common/src/main/org/jboss/portal/test/common/MarkupTestCase.java
Removed:
trunk/common/src/main/org/jboss/portal/common/net/Application_XWWWFormURLEncodedFormat.java
trunk/common/src/main/org/jboss/portal/test/common/Application_XWWWFormURLEncodedFormatTestCase.java
trunk/core/src/main/org/jboss/portal/core/util/markup/Attribute.java
trunk/core/src/main/org/jboss/portal/core/util/markup/Element.java
Modified:
trunk/common/build.xml
trunk/common/src/main/org/jboss/portal/common/text/FastURLEncoder.java
trunk/common/src/main/org/jboss/portal/test/common/FastURLEncoderTestCase.java
trunk/core/src/main/org/jboss/portal/core/aspects/portlet/HeaderInterceptor.java
trunk/core/src/main/org/jboss/portal/core/metadata/portlet/ElementMetaData.java
trunk/core/src/main/org/jboss/portal/core/metadata/portlet/LinkElementMetaData.java
trunk/core/src/main/org/jboss/portal/core/metadata/portlet/NamedMetaElementMetaData.java
trunk/core/src/main/org/jboss/portal/core/metadata/portlet/ScriptElementMetaData.java
trunk/core/src/main/org/jboss/portal/test/core/deployment/JBossApplicationMetaDataFactoryTestCase.java
Log:
- moved markup classes to common
- test case for markup classes
- removed obsolete x-www-url-formencoded encoder because it is duplicated by FastURLEncoder
- added UndeclaredIOException to prevent classes to have to throw IOException in their signature
Modified: trunk/common/build.xml
===================================================================
--- trunk/common/build.xml 2007-02-10 02:21:09 UTC (rev 6203)
+++ trunk/common/build.xml 2007-02-11 00:30:13 UTC (rev 6204)
@@ -201,6 +201,8 @@
-->
<x-test>
+ <test todir="${test.reports}" name="org.jboss.portal.test.common.MarkupTestCase"/>
+<!--
<test todir="${test.reports}" name="org.jboss.portal.test.common.TypedMapTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.test.InfoTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.test.TestParameterValueTestCase"/>
@@ -222,10 +224,10 @@
<test todir="${test.reports}" name="org.jboss.portal.test.common.ParameterMapTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.LocalizedStringTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.ImplodeTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.common.Application_XWWWFormURLEncodedFormatTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.BufferedStreamTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.CharBufferTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.CopyOnWriteRegistryTestCase"/>
+-->
</x-test>
<x-classpath>
<pathelement location="${build.classes}"/>
Added: trunk/common/src/main/org/jboss/portal/common/io/UndeclaredIOException.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/io/UndeclaredIOException.java (rev 0)
+++ trunk/common/src/main/org/jboss/portal/common/io/UndeclaredIOException.java 2007-02-11 00:30:13 UTC (rev 6204)
@@ -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.portal.common.io;
+
+import java.lang.reflect.UndeclaredThrowableException;
+import java.io.IOException;
+
+/**
+ * Avoid a method to declare an IOException in its signature when it is not necessary.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class UndeclaredIOException extends UndeclaredThrowableException
+{
+ public UndeclaredIOException(IOException undeclaredIOException)
+ {
+ super(undeclaredIOException);
+ }
+
+ public UndeclaredIOException(IOException undeclaredIOException, String s)
+ {
+ super(undeclaredIOException, s);
+ }
+}
Added: trunk/common/src/main/org/jboss/portal/common/markup/MarkupAttribute.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/markup/MarkupAttribute.java (rev 0)
+++ trunk/common/src/main/org/jboss/portal/common/markup/MarkupAttribute.java 2007-02-11 00:30:13 UTC (rev 6204)
@@ -0,0 +1,205 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.common.markup;
+
+import org.jboss.portal.common.text.FastURLEncoder;
+import org.jboss.portal.common.io.UndeclaredIOException;
+
+import java.io.Writer;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
+
+/**
+ * A markup attribute.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class MarkupAttribute
+{
+
+ /** . */
+ final String name;
+
+ /** . */
+ final String value;
+
+ /** . */
+ final Type type;
+
+ /** . */
+ final String encodedValue;
+
+ /**
+ * @param name the attribute name
+ * @param value the attribute value
+ * @param type the attribute type
+ */
+ public MarkupAttribute(String name, String value, Type type)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException("No null name accepted");
+ }
+ if (value == null)
+ {
+ throw new IllegalArgumentException("No null value accepted");
+ }
+ if (type == null)
+ {
+ throw new IllegalArgumentException("No null type accepted");
+ }
+ this.name = name;
+ this.value = value;
+ this.type = type;
+
+ //
+ StringWriter tmp = new StringWriter();
+ type.encode(value, tmp);
+ this.encodedValue = tmp.toString();
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public String getEncodedValue()
+ {
+ return encodedValue;
+ }
+
+ public Type getType()
+ {
+ return type;
+ }
+
+ /**
+ * The type of the attribute value.
+ */
+ public abstract static class Type
+ {
+
+ /**
+ * Encode the string in the proper format according to the type.
+ *
+ * @param string the string to encode
+ * @return the encoded string
+ */
+ public abstract void encode(String string, Writer writer) throws UndeclaredIOException;
+
+ private static class CDATAType extends Type
+ {
+ public void encode(String string, Writer writer)
+ {
+ try
+ {
+ writer.write(string);
+ }
+ catch (IOException e)
+ {
+ throw new UndeclaredIOException(e);
+ }
+ }
+ }
+
+ /**
+ * CDATA is a sequence of characters from the document character set and may include character entities.
+ * User agents should interpret attribute values as follows:
+ * <ul>
+ * <li>Replace character entities with characters,</li>
+ * <li>Ignore line feeds,</li>
+ * <li>Replace each carriage return or tab with a single space.</li>
+ * </ul>
+ */
+ public static final Type CDATA = new CDATAType();
+
+ /**
+ * NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]),
+ * hyphens ("-"), underscores ("_"), colons (":"), and periods (".").
+ */
+ public static final Type NAME = new CDATAType();
+
+ /**
+ * %ContentType required : CDATA -- media type, as per [RFC2045].
+ */
+ public static final Type CONTENT_TYPE = new CDATAType();
+
+ /**
+ * %URI : CDATA -- a Uniform Resource Identifier, see [URI].
+ */
+ public static final Type URI = new CDATAType()
+ {
+ {
+ try
+ {
+ // Patches the encoder to let '/' not being encoded
+ encoder = new FastURLEncoder("UTF-8", 0, 512)
+ {
+ {
+ table[(int)'/'] = "/".toCharArray();
+ }
+ };
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ throw new Error(e);
+ }
+ }
+
+ /** Our encoder for URI. */
+ final FastURLEncoder encoder;
+
+ public void encode(String string, Writer writer)
+ {
+ encoder.encode(string, writer);
+ }
+ };
+
+ /**
+ * %LinkTypes : CDATA -- space-separated list of link types.
+ */
+ public static final Type LINK_TYPES = new CDATAType();
+
+ /**
+ * %Text : CDATA : CDATA.
+ */
+ public static final Type TEXT = new CDATAType();
+
+ /**
+ * %MediaDesc : CDATA -- single or comma-separated list of media descriptors.
+ */
+ public static final Type MEDIA_DESC = new CDATAType();
+
+ /**
+ * %URI : CDATA -- a Uniform Resource Identifier, see [URI].
+ */
+ public static final Type HREF = new CDATAType();
+ }
+}
Added: trunk/common/src/main/org/jboss/portal/common/markup/MarkupElement.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/markup/MarkupElement.java (rev 0)
+++ trunk/common/src/main/org/jboss/portal/common/markup/MarkupElement.java 2007-02-11 00:30:13 UTC (rev 6204)
@@ -0,0 +1,211 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.common.markup;
+
+import org.jboss.portal.common.io.UndeclaredIOException;
+
+import java.util.Set;
+import java.util.HashSet;
+import java.io.Writer;
+import java.io.IOException;
+import java.io.StringWriter;
+
+/**
+ * An markup element.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class MarkupElement
+{
+
+ /** . */
+ final String name;
+
+ /** . */
+ final String bodyContent;
+
+ /**
+ * If true and the body content is null then output the start tag and
+ * the end tag instead of an empty tag. The use case is for the script element which
+ * when it is empty raise issues on IE, so it start element and end element have to be
+ * used.
+ */
+ final boolean neverEmpty;
+
+ /** . */
+ final MarkupAttribute[] attributes;
+
+ /**
+ * @param name the element name
+ * @param bodyContent the optional body content
+ * @param neverEmpty
+ * @param attributes
+ */
+ public MarkupElement(
+ String name,
+ String bodyContent,
+ boolean neverEmpty,
+ MarkupAttribute[] attributes)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException("No null name accepted");
+ }
+ if (attributes == null)
+ {
+ throw new IllegalArgumentException("No null attributes accepted");
+ }
+
+ //
+ Set tmp = new HashSet();
+ for (int i= 0;i < attributes.length;i++)
+ {
+ MarkupAttribute attribute = attributes[i];
+ if (attribute == null)
+ {
+ throw new IllegalArgumentException("Cannot have a null attribute");
+ }
+ if (tmp.add(attribute.name) == false)
+ {
+ throw new IllegalArgumentException("Cannot have two identical attributes " + attribute.name);
+ }
+ }
+
+ this.name = name;
+ this.bodyContent = bodyContent;
+ this.neverEmpty = neverEmpty;
+ this.attributes = (MarkupAttribute[])attributes.clone();
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getBodyContent()
+ {
+ return bodyContent;
+ }
+
+ public boolean isNeverEmpty()
+ {
+ return neverEmpty;
+ }
+
+ public int getAttributeSize()
+ {
+ return attributes.length;
+ }
+
+ public MarkupAttribute getAttribute(int index)
+ {
+ return attributes[index];
+ }
+
+ public MarkupAttribute getAttribute(String name)
+ {
+ for (int i = 0;i < attributes.length;i++)
+ {
+ MarkupAttribute attribute = attributes[i];
+ if (attribute.name.equals(name))
+ {
+ return attribute;
+ }
+ }
+ return null;
+ }
+
+ public void write(String contextPath, Writer writer) throws UndeclaredIOException
+ {
+ if (contextPath == null)
+ {
+ throw new IllegalArgumentException("No context path provided");
+ }
+ if (writer == null)
+ {
+ throw new IllegalArgumentException("No writer provided");
+ }
+ try
+ {
+ writer.write("<");
+ writer.write(name);
+ for (int i = 0;i < attributes.length;i++)
+ {
+ MarkupAttribute attribute = attributes[i];
+
+ // If it is an URI type we prepend the context path
+ if (attribute.type == MarkupAttribute.Type.URI)
+ {
+ writer.write(" ");
+ writer.write(attribute.name);
+ writer.write("=\"");
+ if (attribute.value.startsWith("/"))
+ {
+ MarkupAttribute.Type.URI.encode(contextPath, writer);
+ }
+ writer.write(attribute.encodedValue);
+ writer.write('"');
+ }
+ else
+ {
+ writer.write(" ");
+ writer.write(attribute.name);
+ writer.write("=\"");
+ writer.write(attribute.encodedValue);
+ writer.write('"');
+ }
+ }
+ if (bodyContent != null && bodyContent.length() > 0)
+ {
+ writer.write(">");
+ writer.write(bodyContent);
+ writer.write("</");
+ writer.write(name);
+ writer.write(">\n");
+ }
+ else if (neverEmpty)
+ {
+ writer.write(">");
+ writer.write("</");
+ writer.write(name);
+ writer.write(">\n");
+ }
+ else
+ {
+ writer.write("/>\n");
+ }
+ }
+ catch (IOException e)
+ {
+ throw new UndeclaredIOException(e);
+ }
+ }
+
+ public String toString(String contextPath)
+ {
+ StringWriter buffer = new StringWriter(64);
+ write(contextPath, buffer);
+ return buffer.toString();
+ }
+}
Deleted: trunk/common/src/main/org/jboss/portal/common/net/Application_XWWWFormURLEncodedFormat.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/net/Application_XWWWFormURLEncodedFormat.java 2007-02-10 02:21:09 UTC (rev 6203)
+++ trunk/common/src/main/org/jboss/portal/common/net/Application_XWWWFormURLEncodedFormat.java 2007-02-11 00:30:13 UTC (rev 6204)
@@ -1,136 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.common.net;
-
-import java.io.IOException;
-
-/**
- * Provide fast encoding to the application/x-www-form-urlencoded MIME format for a specified
- * charset.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class Application_XWWWFormURLEncodedFormat
-{
-
- public static final Application_XWWWFormURLEncodedFormat UTF_8 = safeCreate("UTF-8");
-
- private static Application_XWWWFormURLEncodedFormat safeCreate(String charset)
- {
- try
- {
- return new Application_XWWWFormURLEncodedFormat(charset);
- }
- catch (IOException e)
- {
- throw new Error(e);
- }
- }
-
- private final char[][] table;
-
- public Application_XWWWFormURLEncodedFormat(String charset) throws IOException
- {
- StringBuffer sb = new StringBuffer();
- table = new char[Character.MAX_VALUE + 1][0];
- for (int i = 0; i <= Character.MAX_VALUE; i++)
- {
- char c = (char)i;
- if (c >= 'a' && c <= 'z')
- {
- table[c] = new char[]{c};
- }
- else if (c >= 'A' && c <= 'Z')
- {
- table[c] = new char[]{c};
- }
- else if (c >= '0' && c <= '9')
- {
- table[c] = new char[]{c};
- }
- else if (c == '-' || c == '_' || c == '.' || c == '*')
- {
- table[c] = new char[]{c};
- }
- else if (c == ' ')
- {
- table[c] = new char[]{'+'};
- }
- else
- {
- String s = new String(new char[]{c});
- byte[] bytes = s.getBytes(charset);
- for (int j = 0; j < bytes.length; j++)
- {
- byte b = bytes[j];
- int bh = (b >> 4) & 0xF;
- int bl = b & 0xF;
- char ch = Character.toUpperCase(Character.forDigit(bh, 16));
- char cl = Character.toUpperCase(Character.forDigit(bl, 16));
- sb.append('%').append(ch).append(cl);
- }
- table[c] = new char[sb.length()];
- sb.getChars(0, sb.length(), table[c], 0);
- sb.setLength(0);
- }
- }
- }
-
- public void encode(char c, StringBuffer sb)
- {
- sb.append(table[c]);
- }
-
- public void encode(String s, StringBuffer sb)
- {
- encode(s, 0, s.length(), sb);
- }
-
- public void encode(String s, int from, int to, StringBuffer sb)
- {
- for (int i = from; i < to; i++)
- {
- char c = s.charAt(i);
- char[] chars = table[c];
- sb.append(chars);
- }
- }
-
- public String encode(char c)
- {
- return new String(table[c]);
- }
-
- public String encode(String s, int from, int to)
- {
- StringBuffer sb = new StringBuffer();
- encode(s, from, to, sb);
- return sb.toString();
- }
-
- public String encode(String s)
- {
- return encode(s, 0, s.length());
- }
-}
Modified: trunk/common/src/main/org/jboss/portal/common/text/FastURLEncoder.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/text/FastURLEncoder.java 2007-02-10 02:21:09 UTC (rev 6203)
+++ trunk/common/src/main/org/jboss/portal/common/text/FastURLEncoder.java 2007-02-11 00:30:13 UTC (rev 6204)
@@ -22,7 +22,11 @@
******************************************************************************/
package org.jboss.portal.common.text;
+import org.jboss.portal.common.io.UndeclaredIOException;
+
import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+import java.io.IOException;
import java.net.URLEncoder;
/**
@@ -112,6 +116,45 @@
}
}
+ public void encode(String s, Writer out) throws IllegalArgumentException, UndeclaredIOException
+ {
+ if (s == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (out == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ try
+ {
+ for (int i = 0;i < s.length();i++)
+ {
+ char c = s.charAt(i);
+ if (c >= from && c < to)
+ {
+ out.write(table[c - from]);
+ }
+ else
+ {
+ try
+ {
+ out.write(URLEncoder.encode(Character.toString(c), encoding));
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ // That should never happen has the encoding validity is check at construction time
+ throw new Error(e);
+ }
+ }
+ }
+ }
+ catch (IOException e)
+ {
+ throw new UndeclaredIOException(e);
+ }
+ }
+
public String toString()
{
return "FastURLEncoder[" + encoding + ",[" + from + "," + to + "]]";
Deleted: trunk/common/src/main/org/jboss/portal/test/common/Application_XWWWFormURLEncodedFormatTestCase.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/Application_XWWWFormURLEncodedFormatTestCase.java 2007-02-10 02:21:09 UTC (rev 6203)
+++ trunk/common/src/main/org/jboss/portal/test/common/Application_XWWWFormURLEncodedFormatTestCase.java 2007-02-11 00:30:13 UTC (rev 6204)
@@ -1,72 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.test.common;
-
-import junit.framework.TestCase;
-import org.jboss.portal.common.net.Application_XWWWFormURLEncodedFormat;
-
-import java.net.URLEncoder;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class Application_XWWWFormURLEncodedFormatTestCase extends TestCase
-{
-
- private Application_XWWWFormURLEncodedFormat format = Application_XWWWFormURLEncodedFormat.UTF_8;
-
- public Application_XWWWFormURLEncodedFormatTestCase(String name)
- {
- super(name);
- }
-
- private static final String INVARIANT_STRING = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-_*";
-
- public void testInvariant()
- {
- assertEquals(INVARIANT_STRING, format.encode(INVARIANT_STRING));
- for (int i = 0;i < INVARIANT_STRING.length();i++)
- {
- char c = INVARIANT_STRING.charAt(i);
- String s = format.encode(c);
- assertEquals(s + "!=" + c, s, "" + c);
- }
- }
-
- public void testSpace()
- {
- assertEquals("+", format.encode(' '));
- }
-
- public void testASCII() throws Exception
- {
- for (int i = 0;i < 50000 + 1;i++)
- {
- char c = (char)i;
- String expectedResult = URLEncoder.encode("" + c, "UTF-8");
- String result = format.encode(c);
- assertEquals("Comparing char=" + i + " was expecting " + expectedResult + " but got " + result, expectedResult, result);
- }
- }
-}
Modified: trunk/common/src/main/org/jboss/portal/test/common/FastURLEncoderTestCase.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/FastURLEncoderTestCase.java 2007-02-10 02:21:09 UTC (rev 6203)
+++ trunk/common/src/main/org/jboss/portal/test/common/FastURLEncoderTestCase.java 2007-02-11 00:30:13 UTC (rev 6204)
@@ -153,7 +153,7 @@
}
try
{
- encoder.encode("", null);
+ encoder.encode("", (StringBuffer)null);
fail();
}
catch (IllegalArgumentException expected)
Added: trunk/common/src/main/org/jboss/portal/test/common/MarkupTestCase.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/MarkupTestCase.java (rev 0)
+++ trunk/common/src/main/org/jboss/portal/test/common/MarkupTestCase.java 2007-02-11 00:30:13 UTC (rev 6204)
@@ -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.portal.test.common;
+
+import junit.framework.TestCase;
+import org.jboss.portal.common.markup.MarkupAttribute;
+import org.jboss.portal.common.markup.MarkupElement;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class MarkupTestCase extends TestCase
+{
+
+ public void testAttributeConstructor()
+ {
+ try
+ {
+ new MarkupAttribute(null, "value", MarkupAttribute.Type.CDATA);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ try
+ {
+ new MarkupAttribute("name", null, MarkupAttribute.Type.CDATA);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ try
+ {
+ new MarkupAttribute("name", "value", null);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ MarkupAttribute attribute = new MarkupAttribute("name", "value", MarkupAttribute.Type.CDATA);
+ assertEquals("name", attribute.getName());
+ assertEquals("value", attribute.getValue());
+ assertEquals(MarkupAttribute.Type.CDATA, attribute.getType());
+ }
+
+ public void testElementContructor()
+ {
+ try
+ {
+ new MarkupElement(null, "body", false, new MarkupAttribute[0]);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ try
+ {
+ new MarkupElement("name", "body", false, null);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ try
+ {
+ new MarkupElement("name", "body", false, new MarkupAttribute[]{null});
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ MarkupElement element = new MarkupElement("elementname", "body", false, new MarkupAttribute[]{new MarkupAttribute("attributename", "attributevalue", MarkupAttribute.Type.CDATA)});
+ assertEquals("elementname", element.getName());
+ assertEquals("body", element.getBodyContent());
+ assertEquals(false, element.isNeverEmpty());
+ assertEquals(1, element.getAttributeSize());
+ MarkupAttribute attribute = element.getAttribute(0);
+ assertEquals("attributename", attribute.getName());
+ assertEquals("attributevalue", attribute.getValue());
+ assertEquals(MarkupAttribute.Type.CDATA, attribute.getType());
+ attribute = element.getAttribute("attributename");
+ assertEquals("attributename", attribute.getName());
+ assertEquals("attributevalue", attribute.getValue());
+ assertEquals(MarkupAttribute.Type.CDATA, attribute.getType());
+ assertEquals(null, element.getAttribute("someotherattributename"));
+ }
+}
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/portlet/HeaderInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/portlet/HeaderInterceptor.java 2007-02-10 02:21:09 UTC (rev 6203)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/portlet/HeaderInterceptor.java 2007-02-11 00:30:13 UTC (rev 6204)
@@ -23,10 +23,10 @@
package org.jboss.portal.core.aspects.portlet;
import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.common.markup.MarkupElement;
import org.jboss.portal.core.metadata.portlet.HeaderContentMetaData;
import org.jboss.portal.core.metadata.portlet.JBossPortletMetaData;
import org.jboss.portal.core.metadata.portlet.ElementMetaData;
-import org.jboss.portal.core.util.markup.Element;
import org.jboss.portal.portlet.container.PortletContainer;
import org.jboss.portal.portlet.container.info.ContainerPortletInfo;
import org.jboss.portal.portlet.invocation.PortletInterceptor;
@@ -88,7 +88,7 @@
for (Iterator i = headerContent.getElements().iterator(); i.hasNext();)
{
ElementMetaData elementMD = (ElementMetaData)i.next();
- Element element = elementMD.getElement();
+ MarkupElement element = elementMD.getElement();
writer.write(element.toString(contextPath));
}
}
Modified: trunk/core/src/main/org/jboss/portal/core/metadata/portlet/ElementMetaData.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/metadata/portlet/ElementMetaData.java 2007-02-10 02:21:09 UTC (rev 6203)
+++ trunk/core/src/main/org/jboss/portal/core/metadata/portlet/ElementMetaData.java 2007-02-11 00:30:13 UTC (rev 6204)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.core.metadata.portlet;
-import org.jboss.portal.core.util.markup.Element;
+import org.jboss.portal.common.markup.MarkupElement;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -32,17 +32,13 @@
{
/** . */
- protected final String typeAttribute;
-
- /** . */
protected String bodyContent;
/** . */
- protected Element element;
+ protected MarkupElement element;
- protected ElementMetaData(String typeAttribute)
+ protected ElementMetaData()
{
- this.typeAttribute = typeAttribute;
}
public void init()
@@ -50,18 +46,13 @@
element = buildElement();
}
- protected abstract Element buildElement();
+ protected abstract MarkupElement buildElement();
- public Element getElement()
+ public MarkupElement getElement()
{
return element;
}
- public String getTypeAttribute()
- {
- return typeAttribute;
- }
-
public String getBodyContent()
{
return bodyContent;
@@ -75,7 +66,7 @@
/**
* Create a meta header element. <p>This element will create a meta tag.</p>
*
- * @param name name attribute of the meta element
+ * @param name name attribute of the meta element
* @param content content attribute of the meta element
* @return a new meta header element
*/
Modified: trunk/core/src/main/org/jboss/portal/core/metadata/portlet/LinkElementMetaData.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/metadata/portlet/LinkElementMetaData.java 2007-02-10 02:21:09 UTC (rev 6203)
+++ trunk/core/src/main/org/jboss/portal/core/metadata/portlet/LinkElementMetaData.java 2007-02-11 00:30:13 UTC (rev 6204)
@@ -22,8 +22,8 @@
******************************************************************************/
package org.jboss.portal.core.metadata.portlet;
-import org.jboss.portal.core.util.markup.Element;
-import org.jboss.portal.core.util.markup.Attribute;
+import org.jboss.portal.common.markup.MarkupElement;
+import org.jboss.portal.common.markup.MarkupAttribute;
import java.util.ArrayList;
@@ -34,55 +34,66 @@
public class LinkElementMetaData extends ElementMetaData
{
- /** . */
+ /** %ContentType required : CDATA -- media type, as per [RFC2045]. */
+ private String typeAttribute;
+
+ /** %LinkTypes : CDATA -- space-separated list of link types. */
private String relAttribute;
- /** . */
+ /** %URI : CDATA -- a Uniform Resource Identifier, see [URI]. */
private String hrefAttribute;
- /** . */
+ /** %Text : CDATA : CDATA. */
private String titleAttribute;
- /** . */
+ /** %MediaDesc : CDATA -- single or comma-separated list of media descriptors. */
private String mediaAttribute;
- public LinkElementMetaData(String rel, String type, String href, String title, String media)
+ public LinkElementMetaData(
+ String relAttribute,
+ String typeAttribute,
+ String hrefAttribute,
+ String titleAttribute,
+ String mediaAttribute)
{
- super(type);
-
- //
- this.relAttribute = rel;
- this.hrefAttribute = href;
- this.titleAttribute = title;
- this.mediaAttribute = media;
+ this.typeAttribute = typeAttribute;
+ this.relAttribute = relAttribute;
+ this.hrefAttribute = hrefAttribute;
+ this.titleAttribute = titleAttribute;
+ this.mediaAttribute = mediaAttribute;
}
- public Element buildElement()
+ public MarkupElement buildElement()
{
ArrayList attributes = new ArrayList(5);
if (typeAttribute != null && typeAttribute.length() > 0)
{
- attributes.add(new Attribute("type", typeAttribute, false));
+ attributes.add(new MarkupAttribute("type", typeAttribute, MarkupAttribute.Type.CONTENT_TYPE));
}
if (relAttribute != null && relAttribute.length() > 0)
{
- attributes.add(new Attribute("rel", relAttribute, false));
+ attributes.add(new MarkupAttribute("rel", relAttribute, MarkupAttribute.Type.LINK_TYPES));
}
if (hrefAttribute != null && hrefAttribute.length() > 0)
{
- attributes.add(new Attribute("href", hrefAttribute, true));
+ attributes.add(new MarkupAttribute("href", hrefAttribute, MarkupAttribute.Type.URI));
}
if (titleAttribute != null && titleAttribute.length() > 0)
{
- attributes.add(new Attribute("title", titleAttribute, false));
+ attributes.add(new MarkupAttribute("title", titleAttribute, MarkupAttribute.Type.TEXT));
}
if (mediaAttribute != null && mediaAttribute.length() > 0)
{
- attributes.add(new Attribute("media", mediaAttribute, false));
+ attributes.add(new MarkupAttribute("media", mediaAttribute, MarkupAttribute.Type.MEDIA_DESC));
}
- return new Element("link", null, true, (Attribute[])attributes.toArray(new Attribute[attributes.size()]));
+ return new MarkupElement("link", null, false, (MarkupAttribute[])attributes.toArray(new MarkupAttribute[attributes.size()]));
}
+ public String getTypeAttribute()
+ {
+ return typeAttribute;
+ }
+
public String getRelAttribute()
{
return relAttribute;
Modified: trunk/core/src/main/org/jboss/portal/core/metadata/portlet/NamedMetaElementMetaData.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/metadata/portlet/NamedMetaElementMetaData.java 2007-02-10 02:21:09 UTC (rev 6203)
+++ trunk/core/src/main/org/jboss/portal/core/metadata/portlet/NamedMetaElementMetaData.java 2007-02-11 00:30:13 UTC (rev 6204)
@@ -22,8 +22,8 @@
******************************************************************************/
package org.jboss.portal.core.metadata.portlet;
-import org.jboss.portal.core.util.markup.Element;
-import org.jboss.portal.core.util.markup.Attribute;
+import org.jboss.portal.common.markup.MarkupElement;
+import org.jboss.portal.common.markup.MarkupAttribute;
import java.util.ArrayList;
@@ -34,30 +34,27 @@
public class NamedMetaElementMetaData extends ElementMetaData
{
- /** . */
+ /** NAME. */
private String nameAttribute;
- /** . */
+ /** CDATA. */
private String contentAttribute;
- public NamedMetaElementMetaData(String name, String content)
+ public NamedMetaElementMetaData(String nameAttribute, String contentAttribute)
{
- super(null);
-
- //
- if (name == null)
+ if (nameAttribute == null)
{
throw new IllegalArgumentException("'name' attribute of meta element must NOT be null. http-equiv meta " +
"elements are not currently supported.");
}
- if (content == null)
+ if (contentAttribute == null)
{
- throw new IllegalArgumentException("Content attribute required for meta element: " + name);
+ throw new IllegalArgumentException("Content attribute required for meta element: " + nameAttribute);
}
//
- this.nameAttribute = name;
- this.contentAttribute = content;
+ this.nameAttribute = nameAttribute;
+ this.contentAttribute = contentAttribute;
}
public String getNameAttribute()
@@ -70,21 +67,17 @@
return contentAttribute;
}
- public Element buildElement()
+ public MarkupElement buildElement()
{
ArrayList attributes = new ArrayList(3);
- if (typeAttribute != null && typeAttribute.length() > 0)
- {
- attributes.add(new Attribute("type", typeAttribute, false));
- }
if (nameAttribute != null && nameAttribute.length() > 0)
{
- attributes.add(new Attribute("name", nameAttribute, false));
+ attributes.add(new MarkupAttribute("name", nameAttribute, MarkupAttribute.Type.NAME));
}
if (contentAttribute != null && contentAttribute.length() > 0)
{
- attributes.add(new Attribute("content", contentAttribute, false));
+ attributes.add(new MarkupAttribute("content", contentAttribute, MarkupAttribute.Type.CDATA));
}
- return new Element("meta", null, true, (Attribute[])attributes.toArray(new Attribute[attributes.size()]));
+ return new MarkupElement("meta", null, false, (MarkupAttribute[])attributes.toArray(new MarkupAttribute[attributes.size()]));
}
}
Modified: trunk/core/src/main/org/jboss/portal/core/metadata/portlet/ScriptElementMetaData.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/metadata/portlet/ScriptElementMetaData.java 2007-02-10 02:21:09 UTC (rev 6203)
+++ trunk/core/src/main/org/jboss/portal/core/metadata/portlet/ScriptElementMetaData.java 2007-02-11 00:30:13 UTC (rev 6204)
@@ -22,8 +22,8 @@
******************************************************************************/
package org.jboss.portal.core.metadata.portlet;
-import org.jboss.portal.core.util.markup.Element;
-import org.jboss.portal.core.util.markup.Attribute;
+import org.jboss.portal.common.markup.MarkupElement;
+import org.jboss.portal.common.markup.MarkupAttribute;
import java.util.ArrayList;
@@ -34,34 +34,35 @@
public class ScriptElementMetaData extends ElementMetaData
{
- /** . */
+ /** %ContentType required : CDATA -- media type, as per [RFC2045]. */
+ private String typeAttribute;
+
+ /** %URI : CDATA -- a Uniform Resource Identifier, see [URI]. */
private String srcAttribute;
- public ScriptElementMetaData(String type, String src)
+ public ScriptElementMetaData(String typeAttribute, String srcAttribute)
{
- super(type);
-
- //
- this.srcAttribute = src;
+ this.typeAttribute = typeAttribute;
+ this.srcAttribute = srcAttribute;
}
- protected String getElementValue()
+ public String getTypeAttribute()
{
- return "script";
+ return typeAttribute;
}
- public Element buildElement()
+ public MarkupElement buildElement()
{
ArrayList attributes = new ArrayList(2);
if (typeAttribute != null && typeAttribute.length() > 0)
{
- attributes.add(new Attribute("type", typeAttribute, false));
+ attributes.add(new MarkupAttribute("type", typeAttribute, MarkupAttribute.Type.CONTENT_TYPE));
}
if (srcAttribute != null && srcAttribute.length() > 0)
{
- attributes.add(new Attribute("src", srcAttribute, true));
+ attributes.add(new MarkupAttribute("src", srcAttribute, MarkupAttribute.Type.URI));
}
- return new Element("script", null, false, (Attribute[])attributes.toArray(new Attribute[attributes.size()]));
+ return new MarkupElement("script", null, true, (MarkupAttribute[])attributes.toArray(new MarkupAttribute[attributes.size()]));
}
public String getSrcAttribute()
Deleted: trunk/core/src/main/org/jboss/portal/core/util/markup/Attribute.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/util/markup/Attribute.java 2007-02-10 02:21:09 UTC (rev 6203)
+++ trunk/core/src/main/org/jboss/portal/core/util/markup/Attribute.java 2007-02-11 00:30:13 UTC (rev 6204)
@@ -1,47 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.util.markup;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class Attribute
-{
-
- /** . */
- final String name;
-
- /** . */
- final String value;
-
- /** . */
- final boolean location;
-
- public Attribute(String name, String value, boolean location)
- {
- this.name = name;
- this.value = value;
- this.location = location;
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/util/markup/Element.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/util/markup/Element.java 2007-02-10 02:21:09 UTC (rev 6203)
+++ trunk/core/src/main/org/jboss/portal/core/util/markup/Element.java 2007-02-11 00:30:13 UTC (rev 6204)
@@ -1,96 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.util.markup;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class Element
-{
-
- /** . */
- final String name;
-
- /** . */
- final String bodyContent;
-
- /**
- * If empty is false and the body content is null then we will output the start tag and
- * the end tag instead of an empty tag. The use case is for the script element which
- * when it is empty raise issues on IE, so it start element and end element have to be
- * used.
- */
- final boolean empty;
-
- /** . */
- final Attribute[] attributes;
-
- public Element(String name, String bodyContent, boolean empty, Attribute[] attributes)
- {
- this.name = name;
- this.bodyContent = bodyContent;
- this.empty = empty;
- this.attributes = attributes;
- }
-
- public String toString(String contextPath)
- {
- if (contextPath == null)
- {
- throw new IllegalArgumentException("No context path provided");
- }
- StringBuffer buffer = new StringBuffer(64);
- buffer.append("<").append(name);
- for (int i = 0;i < attributes.length;i++)
- {
- Attribute attribute = attributes[i];
- if (attribute.location)
- {
- buffer.append(" ").append(attribute.name).append("=\"");
- if (attribute.value.startsWith("/"))
- {
- buffer.append(contextPath);
- }
- buffer.append(attribute.value).append('"');
- }
- else
- {
- buffer.append(" ").append(attribute.name).append("=\"").append(attribute.value).append('"');
- }
- }
- if (bodyContent != null && bodyContent.length() > 0)
- {
- buffer.append(">").append(bodyContent).append("</").append(name).append(">\n");
- }
- else if (empty)
- {
- buffer.append("/>\n");
- }
- else
- {
- buffer.append(">").append("</").append(name).append(">\n");
- }
- return buffer.toString();
- }
-}
Modified: trunk/core/src/main/org/jboss/portal/test/core/deployment/JBossApplicationMetaDataFactoryTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/deployment/JBossApplicationMetaDataFactoryTestCase.java 2007-02-10 02:21:09 UTC (rev 6203)
+++ trunk/core/src/main/org/jboss/portal/test/core/deployment/JBossApplicationMetaDataFactoryTestCase.java 2007-02-11 00:30:13 UTC (rev 6204)
@@ -89,7 +89,6 @@
assertEquals("test.js", script.getSrcAttribute());
NamedMetaElementMetaData meta = (NamedMetaElementMetaData)elements.get(2);
- assertNull(meta.getTypeAttribute());
assertEquals("description", meta.getNameAttribute());
assertEquals("test content", meta.getContentAttribute());
}
19 years, 2 months