Author: mwringe
Date: 2007-08-10 18:50:33 -0400 (Fri, 10 Aug 2007)
New Revision: 7898
Added:
trunk/core-admin/src/main/org/jboss/portal/test/
trunk/core-admin/src/main/org/jboss/portal/test/core/
trunk/core-admin/src/main/org/jboss/portal/test/core/admin/
trunk/core-admin/src/main/org/jboss/portal/test/core/admin/SimpleTest.java
trunk/core-admin/src/main/org/jboss/portal/test/core/admin/bootstrap/
trunk/core-admin/src/main/org/jboss/portal/test/core/admin/bootstrap/PortalServletContextListener.java
trunk/core-admin/src/main/org/jboss/portal/test/core/admin/bootstrap/ServletContextAttributes.java
trunk/core-admin/src/main/org/jboss/portal/test/core/admin/bootstrap/ServletPortletViewHandler.java
trunk/core-admin/src/resources/portal-admin-test-sar/
trunk/core-admin/src/resources/portal-admin-test-sar/META-INF/
trunk/core-admin/src/resources/portal-admin-test-sar/META-INF/jboss-beans.xml
trunk/core-admin/src/resources/portal-admin-test-sar/lib/
trunk/core-admin/src/resources/portal-admin-test-war/
trunk/core-admin/src/resources/portal-admin-test-war/WEB-INF/
trunk/core-admin/src/resources/portal-admin-test-war/WEB-INF/classes/
trunk/core-admin/src/resources/portal-admin-test-war/WEB-INF/classes/datasources.xml
trunk/core-admin/src/resources/portal-admin-test-war/WEB-INF/classes/hibernates.xml
trunk/core-admin/src/resources/portal-admin-test-war/WEB-INF/jboss-web.xml
trunk/core-admin/src/resources/portal-admin-test-war/WEB-INF/web.xmlfragment
trunk/core-admin/src/resources/portal-admin-test-war/portalviewer.jsp
Modified:
trunk/build/build-thirdparty.xml
trunk/core-admin/.classpath
trunk/core-admin/build.xml
Log:
Initial checkin of portal-admin test framework
Modified: trunk/build/build-thirdparty.xml
===================================================================
--- trunk/build/build-thirdparty.xml 2007-08-10 15:00:02 UTC (rev 7897)
+++ trunk/build/build-thirdparty.xml 2007-08-10 22:50:33 UTC (rev 7898)
@@ -91,12 +91,14 @@
<componentref name="jboss/remoting" version="1.4.3.GA"/>
<componentref name="jboss/serialization"
version="1.0.1.GA"/>
<componentref name="jboss/test" version="1.0.0.CR1"/>
+ <componentref name="jboss-jsfunit"
version="1.0-snapshot"/>
<componentref name="jflex" version="1.4.0"/>
<componentref name="jwebunit" version="1.2"/>
<componentref name="jcr" version="1.0"/>
<componentref name="jetty" version="6.0"/>
<componentref name="jgroups" version="2.2.8"/>
<componentref name="jsunit" version="2.1"/>
+ <componentref name="jtidy" version="4aug2000r7"/>
<componentref name="junit" version="3.8.1"/>
<componentref name="odmg" version="3.0"/>
<componentref name="oswego-concurrent" version="1.3.4"/>
@@ -111,6 +113,7 @@
<componentref name="sun-opends" version="snapshot"/>
<componentref name="sun-servlet" version="2.4"/>
<componentref name="xdoclet" version="1.2.3"/>
+ <componentref name="xmltask" version="1.15.1"/>
<componentref name="jbpm/jaronly" version="3.1.2"/>
<componentref name="freemarker" version="2.3.9"/>
<componentref name="wutka-dtdparser" version="1.2.1"/>
Modified: trunk/core-admin/.classpath
===================================================================
--- trunk/core-admin/.classpath 2007-08-10 15:00:02 UTC (rev 7897)
+++ trunk/core-admin/.classpath 2007-08-10 22:50:33 UTC (rev 7898)
@@ -21,5 +21,11 @@
<classpathentry kind="lib"
path="/thirdparty/sun-servlet/lib/servlet-api.jar"/>
<classpathentry kind="lib"
path="/thirdparty/sun-servlet/lib/jsp-api.jar"/>
<classpathentry kind="lib"
path="/thirdparty/apache-log4j/lib/log4j.jar"/>
+ <classpathentry kind="lib"
path="/thirdparty/jboss-jsfunit/lib/jsfunit-ant.jar"/>
+ <classpathentry kind="lib"
path="/thirdparty/jboss-jsfunit/lib/jsfunit-core.jar"/>
+ <classpathentry kind="lib"
path="/thirdparty/jakarta-cactus/lib/cactus.jar"/>
+ <classpathentry kind="lib"
path="/thirdparty/jakarta-cactus/lib/cactus-ant.jar"/>
+ <classpathentry kind="lib"
path="/thirdparty/junit/lib/junit.jar"/>
+ <classpathentry combineaccessrules="false" kind="src"
path="/test"/>
<classpathentry kind="output" path="output/classes"/>
</classpath>
Modified: trunk/core-admin/build.xml
===================================================================
--- trunk/core-admin/build.xml 2007-08-10 15:00:02 UTC (rev 7897)
+++ trunk/core-admin/build.xml 2007-08-10 22:50:33 UTC (rev 7898)
@@ -66,6 +66,7 @@
| Initialize the build system. Must depend on '_buildmagic:init'.
| Other targets should depend on 'init' or things will mysteriously fail.
-->
+ <import file="../testsuite/imports/server-config.xml"/>
<target name="init" unless="init.disable"
depends="_buildmagic:init">
</target>
@@ -83,6 +84,8 @@
<property name="jboss-junit-configuration" value=""/>
<property name="junit.formatter.usefile" value="true"/>
+ <property name="test.reports"
value="${module.output}/tests"/>
+
<!-- Configure thirdparty libraries -->
&libraries;
@@ -96,6 +99,9 @@
<path refid="sun.servlet.classpath"/>
<path refid="facelets.facelets.classpath"/>
<path refid="el.el.classpath"/>
+ <path refid="jakarta.cactus.classpath"/>
+ <path refid="junit.junit.classpath"/>
+ <path refid="jboss.jsfunit.classpath"/>
<pathelement location="${source.etc}/sun-jsf/jsf-example.jar"/>
</path>
@@ -140,9 +146,42 @@
<taskdef name="implode"
classname="org.jboss.portal.common.ant.Implode"
classpathref="explode.task.classpath"/>
+ <taskdef name="xmltask"
+ classname="com.oopsconsultancy.xmltask.ant.XmlTask"
+ classpathref="xmltask.xmltask.classpath"/>
+ <taskdef name="jsfunitwar"
+ classname="org.jboss.jsfunit.ant.JSFUnitWarTask">
+ <classpath>
+ <fileset dir="${jboss.jsfunit.lib}"/>
+<!-- <fileset dir="${cargo.lib}"/> -->
+ <fileset dir="${jakarta.cactus.lib}"/>
+ <fileset dir="${aspectj.aspectj.lib}"/>
+ <fileset dir="${nekohtml.nekohtml.lib}"/>
+ <fileset dir="${httpunit.httpunit.lib}"/>
+ <fileset dir="${jtidy.jtidy.lib}"/>
+ <fileset dir="${project.tools}/lib">
+ <include name="*cargo**"/>
+ </fileset>
+ </classpath>
+ </taskdef>
</target>
-
+
+ <path id="portal.task.classpath">
+ <pathelement location="${project.tools}/lib/ant.jar"/>
+ <pathelement location="${project.tools}/lib/explode.jar"/>
+ <pathelement
location="${project.tools}/lib/cargo-core-uberjar-0.8.jar"/>
+ </path>
+ <taskdef
+ name="deploy"
+ classname="org.jboss.portal.common.ant.Deploy"
+ classpathref="portal.task.classpath"/>
+ <taskdef
+ name="undeploy"
+ classname="org.jboss.portal.common.ant.Undeploy"
+ classpathref="portal.task.classpath"/>
+
+
<target name="configure-explode">
<path id="explode.task.classpath">
<pathelement location="${project.tools}/lib/explode.jar"/>
@@ -186,7 +225,7 @@
<!-- portal-core-admin-lib.jar -->
<jar jarfile="${build.lib}/portal-core-admin-lib.jar">
- <fileset dir="${build.classes}"/>
+ <fileset dir="${build.classes}"
excludes="org/jboss/portal/test/**"/>
</jar>
<!-- portal-admin.war -->
@@ -279,7 +318,91 @@
<delete
file="${jboss.home}/server/${portal.deploy.dir}/portal-admin.sar"/>
</target>
- <target name="package-tests"/>
+ <target name="package-tests" depends="init, clean-tests">
+
+ <!-- create the jar to contain the test files -->
+ <jar jarfile="${build.lib}/portal-core-admin-test-lib.jar">
+ <fileset dir="${build.classes}"
includes="org/jboss/portal/test/**"/>
+ </jar>
+
+ <!-- portal-admin-test-temp.war -->
+ <copy todir="${build.resources}/portal-admin-test-temp.war">
+ <fileset dir="${build.resources}/portal-admin-war"/>
+ <fileset dir="${build.resources}/portal-admin-test-war"
excludes="**/*.xmlfragment"/>
+ </copy>
+
+ <!-- jsfunitwar _cannot_ be called later on since cargo gets confused on the more
complicated war -->
+ <jsfunitwar srcfile="${build.resources}/portal-admin-test-temp.war"
+ destfile="${build.resources}/portal-admin-test.war">
+ <TestRunner/>
+ </jsfunitwar>
+
+ <!-- Use xmltask to change the specifics of the xml descriptors that are different
for the tests -->
+ <xmltask
source="${build.resources}/portal-admin-test.war/WEB-INF/faces-config.xml"
+
dest="${build.resources}/portal-admin-test.war/WEB-INF/faces-config.xml">
+ <replace
path="//*[local-name()='faces-config']/:application/:view-handler/text()"
+
withText="org.jboss.portal.test.core.admin.bootstrap.ServletPortletViewHandler"/>
+ </xmltask>
+ <xmltask
source="${build.resources}/portal-admin-test.war/WEB-INF/web.xml"
+
dest="${build.resources}/portal-admin-test.war/WEB-INF/web.xml">
+ <insert path="//*[local-name()='web-app']"
+
file="${build.resources}/portal-admin-test-war/WEB-INF/web.xmlfragment"/>
+ <replace
path="//*[local-name()='web-app']/:servlet[:servlet-name/text() = 'Faces
Servlet']/:servlet-class/text()"
+ withText="javax.faces.webapp.FacesServlet"/>
+ </xmltask>
+
+ <copy todir="${build.resources}/portal-admin-test.sar">
+ <fileset dir="${build.resources}/portal-admin.sar"
excludes="portal-admin.war**"/>
+ <fileset dir="${build.resources}"
includes="portal-admin-test.war/**"/>
+ <fileset dir="${build.resources}/portal-admin-test-sar"/>
+ </copy>
+
+ <copy
todir="${build.resources}/portal-admin-test.sar/portal-admin-test.war/WEB-INF/lib2">
+ <fileset dir="${build.lib}"
includes="portal-core-admin-test-lib.jar"/>
+ <fileset dir="${jboss.portal-wsrp.lib}"
includes="portal-wsrp-lib.jar"/>
+ <fileset dir="${jboss.portal-test.lib}"
includes="portal-test-lib.jar"/>
+ </copy>
+
+ <!-- we want to use the lib directory since we are not using the custom portal
lib2 directory -->
+ <copy
todir="${build.resources}/portal-admin-test.sar/portal-admin-test.war/WEB-INF/lib">
+ <fileset
dir="${build.resources}/portal-admin-test.sar/portal-admin-test.war/WEB-INF/lib2"/>
+ </copy>
+ <!-- delete the lib2 directory since we don't use it for the tests -->
+ <delete
dir="${build.resources}/portal-admin-test.sar/portal-admin-test.war/WEB-INF/lib2"/>
+
+ <implode
+ dir="${build.resources}/portal-admin-test.sar"
+ tofile="${build.lib}/portal-admin-test.sar"/>
+
+ </target>
+
+ <target name="clean-tests" description="cleans the output from the
package-test command">
+ <delete dir="${build.resources}/portal-admin-test.sar"
failonerror="false"/>
+ <delete dir="${build.resources}/portal-admin-test-temp.war"
failonerror="false"/>
+ <delete dir="${build.resources}/portal-admin-test.war"
failonerror="false"/>
+ <delete dir="${build.lib}/portal-admin-test.sar"
failonerror="false"/>
+ </target>
+
+ <target name="tests" depends="init" description="Runs the
portal-admin tests">
+ <mkdir dir="${build.reports}"/>
+ <mkdir dir="${test.reports}"/>
+ <deploy file="${jboss.portal-core.lib}/jboss-portal.sar"
config="default"/>
+ <deploy file="${build.lib}/portal-admin-test.sar"
config="default"/>
+ <junit printsummary="true" haltonerror="false"
fork="true">
+ <jvmarg
value="-Dcactus.contextURL=http://localhost:8080/portal-admin-test"/>
+ <classpath>
+ <fileset
dir="${build.resources}/portal-admin-test.sar/portal-admin-test.war/WEB-INF/lib"/>
+ <fileset dir="${apache.httpclient.lib}"/>
+ <fileset dir="${apache.logging.lib}"/>
+ <fileset dir="${apache.codec.lib}"/>
+ </classpath>
+ <formatter type="xml"/>
+ <test todir="${test.reports}"
name="org.jboss.portal.test.core.admin.SimpleTest"/>
+ </junit>
+ <undeploy file="${jboss-portal-core.lib}/jboss-portal.sar"
config="default"/>
+ <undeploy file="${build.resources}/portal-admin-test.sar"
config="default"/>
+ </target>
+
<!--
Added: trunk/core-admin/src/main/org/jboss/portal/test/core/admin/SimpleTest.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/test/core/admin/SimpleTest.java
(rev 0)
+++ trunk/core-admin/src/main/org/jboss/portal/test/core/admin/SimpleTest.java 2007-08-10
22:50:33 UTC (rev 7898)
@@ -0,0 +1,35 @@
+package org.jboss.portal.test.core.admin;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+
+import org.apache.cactus.ServletTestCase;
+import org.apache.cactus.WebRequest;
+import org.apache.cactus.client.authentication.BasicAuthentication;
+import org.jboss.jsfunit.facade.ClientFacade;
+import org.jboss.jsfunit.facade.ServerFacade;
+import org.xml.sax.SAXException;
+
+public class SimpleTest extends ServletTestCase {
+
+ private ClientFacade clientFacade;
+
+ public void beginSomething (WebRequest theRequest)
+ {
+ theRequest.setAuthentication(new BasicAuthentication("admin",
"admin"));
+ }
+
+
+
+ public void setUp() throws MalformedURLException, IOException, SAXException
+ {
+ System.out.println("Starting setup");
+ }
+
+ public void testSomething() throws IOException, SAXException
+ {
+ this.clientFacade = new ClientFacade
("/portalviewer.jsp?view=/WEB-INF/jsf/objects.faces", "admin",
"admin");
+ ServerFacade serverFacade = new ServerFacade(clientFacade);
+ }
+
+}
Added:
trunk/core-admin/src/main/org/jboss/portal/test/core/admin/bootstrap/PortalServletContextListener.java
===================================================================
---
trunk/core-admin/src/main/org/jboss/portal/test/core/admin/bootstrap/PortalServletContextListener.java
(rev 0)
+++
trunk/core-admin/src/main/org/jboss/portal/test/core/admin/bootstrap/PortalServletContextListener.java 2007-08-10
22:50:33 UTC (rev 7898)
@@ -0,0 +1,74 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2007, 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.core.admin.bootstrap;
+
+import java.net.URL;
+
+import javax.faces.context.ExternalContext;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+import org.jboss.portal.core.impl.model.portal.PersistentPortalObjectContainer;
+import org.jboss.portal.security.impl.JBossAuthorizationDomainRegistryImpl;
+import org.jboss.portal.test.framework.TestRuntimeContext;
+import org.jboss.portal.test.framework.embedded.DataSourceSupport;
+import org.jboss.portal.test.framework.embedded.HibernateSupport;
+
+public class PortalServletContextListener implements ServletContextListener{
+
+
+ public void contextInitialized(ServletContextEvent event) {
+ try{
+
+ // Create wrapper that configures
+ ServletContext servletContext = event.getServletContext();
+ ServletContextAttributes attrs = new ServletContextAttributes(servletContext);
+
+ // Configure MC
+ TestRuntimeContext runtimeContext = new
TestRuntimeContext("META-INF/jboss-beans.xml");
+ runtimeContext.addBean("ServletContextAttributes", attrs);
+
+ PersistentPortalObjectContainer objectContainer = new
PersistentPortalObjectContainer();
+ objectContainer.setSessionFactoryJNDIName("java:/portal/PortalObjectSessionFactory");
+ objectContainer.setAuthorizationDomainRegistry(new
JBossAuthorizationDomainRegistryImpl());
+ objectContainer.start();
+ runtimeContext.addBean("PortalObjectContainer", objectContainer);
+
+ URL configsURL =
Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
+ DataSourceSupport.Config[] dataSourceConfigParameter =
DataSourceSupport.Config.fromXML(configsURL);
+
+ runtimeContext.addBean("DataSourceConfig", dataSourceConfigParameter[0]);
+ runtimeContext.addBean("HibernateConfig",
HibernateSupport.getConfig(dataSourceConfigParameter[0].getName()));
+
+ runtimeContext.start();
+ } catch (Exception e){
+ e.printStackTrace();
+ }
+ }
+
+ public void contextDestroyed(ServletContextEvent event) {
+ // do nothing right now
+ }
+
+}
\ No newline at end of file
Added:
trunk/core-admin/src/main/org/jboss/portal/test/core/admin/bootstrap/ServletContextAttributes.java
===================================================================
---
trunk/core-admin/src/main/org/jboss/portal/test/core/admin/bootstrap/ServletContextAttributes.java
(rev 0)
+++
trunk/core-admin/src/main/org/jboss/portal/test/core/admin/bootstrap/ServletContextAttributes.java 2007-08-10
22:50:33 UTC (rev 7898)
@@ -0,0 +1,46 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2007, 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.core.admin.bootstrap;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.servlet.ServletContext;
+
+public class ServletContextAttributes {
+ private ServletContext context;
+ public ServletContextAttributes(ServletContext context)
+ {
+ this.context = context;
+ }
+ public void setAttributes(Map attrs)
+ {
+ for (Iterator i = attrs.entrySet().iterator();i.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)i.next();
+ String name = (String)entry.getKey();
+ Object value = entry.getValue();
+ context.setAttribute(name, value);
+ }
+ }
+}
Added:
trunk/core-admin/src/main/org/jboss/portal/test/core/admin/bootstrap/ServletPortletViewHandler.java
===================================================================
---
trunk/core-admin/src/main/org/jboss/portal/test/core/admin/bootstrap/ServletPortletViewHandler.java
(rev 0)
+++
trunk/core-admin/src/main/org/jboss/portal/test/core/admin/bootstrap/ServletPortletViewHandler.java 2007-08-10
22:50:33 UTC (rev 7898)
@@ -0,0 +1,65 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2007, 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.core.admin.bootstrap;
+
+import java.io.IOException;
+import java.util.Locale;
+
+import javax.faces.FacesException;
+import javax.faces.application.ViewHandler;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+
+import com.sun.facelets.FaceletViewHandler;
+
+public class ServletPortletViewHandler extends FaceletViewHandler {
+
+ public ServletPortletViewHandler(ViewHandler viewHandler) {
+ super(viewHandler);
+ }
+
+ public String getActionURL(FacesContext context, String viewId) {
+ String actionURL = super.getActionURL(context, viewId);
+
+ // if the actionURL is trying to access an internal resource then
+ // we need to make it use the portalview jsp page.
+ // NOTE: this viewhandler should only be used for testing as it can access
+ // internal resources in WEB-INF
+ if (actionURL.contains("WEB-INF") &&
!actionURL.contains("portalviewer"))
+ {
+ String portalviewUrl = "/portalviewer.jsp?view=";
+
+ //for some reason // will sometimes appear in the actionurl which can cause problems
+ actionURL.replace("//", "/");
+
+ int endofWebappContext = actionURL.indexOf("/", 1);
+ String webappContext = actionURL.substring(0, endofWebappContext);
+ String internalPage = actionURL.substring(endofWebappContext);
+
+ System.out.println ( "NEW ACTIONURL : " + webappContext + portalviewUrl +
internalPage);
+ actionURL = webappContext +portalviewUrl + internalPage;
+ }
+
+ return actionURL;
+ }
+}
Added: trunk/core-admin/src/resources/portal-admin-test-sar/META-INF/jboss-beans.xml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-test-sar/META-INF/jboss-beans.xml
(rev 0)
+++
trunk/core-admin/src/resources/portal-admin-test-sar/META-INF/jboss-beans.xml 2007-08-10
22:50:33 UTC (rev 7898)
@@ -0,0 +1,167 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
+ xmlns="urn:jboss:bean-deployer">
+
+ <bean name="DataSourceConfig"
+ class="org.jboss.portal.test.framework.embedded.DataSourceSupport$Config">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory" />
+ <parameter>DataSourceConfig</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="HibernateConfig"
+ class="org.jboss.portal.test.framework.embedded.HibernateSupport$Config">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory" />
+ <parameter>HibernateConfig</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="JNDISupport"
+ class="org.jboss.portal.test.framework.embedded.JNDISupport" />
+
+ <bean name="TransactionManagerSupport"
+ class="org.jboss.portal.test.framework.embedded.TransactionManagerSupport"
/>
+
+ <bean name="ConnectionManagerSupport"
+ class="org.jboss.portal.test.framework.embedded.ConnectionManagerSupport">
+ <property name="transactionManager">
+ <inject bean="TransactionManagerSupport"
+ property="transactionManager" />
+ </property>
+ </bean>
+
+ <bean name="DataSourceSupport"
+ class="org.jboss.portal.test.framework.embedded.DataSourceSupport">
+ <property name="transactionManager">
+ <inject bean="TransactionManagerSupport"
+ property="transactionManager" />
+ </property>
+ <property name="connectionManagerReference">
+ <inject bean="ConnectionManagerSupport"
+ property="connectionManagerReference" />
+ </property>
+ <property name="config">
+ <inject bean="DataSourceConfig" />
+ </property>
+ </bean>
+
+ <bean name="InstanceHibernateSupport"
+ class="org.jboss.portal.test.framework.embedded.HibernateSupport">
+ <property name="config">
+ <inject bean="HibernateConfig" />
+ </property>
+ <property name="mappings">
+ <list elementClass="java.lang.String">
+ <value>conf/hibernate/instance/domain.hbm.xml</value>
+ </list>
+ </property>
+ <property name="jNDIName">
+ java:/portal/InstanceSessionFactory
+ </property>
+ </bean>
+
+ <bean name="PortalObjectContainer"
+ class="org.jboss.portal.core.impl.model.portal.PersistentPortalObjectContainer">
+ <property name="sessionFactoryJNDIName">
+ java:/portal/InstanceSessionFactory
+ </property>
+ <property name="authorizationDomainRegistry">
+ <inject bean="AuthorizationDomainRegistry" />
+ </property>
+ <property name="portalAuthorizationManagerFactory">
+ <inject bean="AuthorizationManagerFactory" />
+ </property>
+ </bean>
+
+ <bean name="ServletContextAttributes"
+ class="org.jboss.portal.test.core.admin.bootstrap.ServletContextAttributes">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory" />
+ <parameter>ServletContextAttributes</parameter>
+ </constructor>
+ <property name="attributes">
+ <map keyClass="java.lang.String">
+ <entry>
+ <key>InstanceHibernateSupport</key>
+ <value>
+ <inject bean="InstanceHibernateSupport" />
+ </value>
+ </entry>
+ <entry>
+ <key>PortalObjectContainer</key>
+ <value>
+ <inject bean="PortalObjectContainer" />
+ </value>
+ </entry>
+ </map>
+ </property>
+ </bean>
+
+ <bean name="ContainerContext"
+ class="org.jboss.portal.core.impl.model.instance.persistent.PersistentInstanceContainerContext">
+ <property name="sessionFactoryJNDIName">
+ java:/portal/InstanceSessionFactory
+ </property>
+ <property name="cacheNaturalId">true</property>
+ </bean>
+
+ <bean name="StackFactory"
+ class="org.jboss.portal.common.invocation.EmptyInterceptorStackFactory"
/>
+
+ <bean name="StateConverter"
+ class="org.jboss.portal.portlet.impl.state.StateConverterV0" />
+
+ <bean name="StateManagementPolicy"
+ class="org.jboss.portal.portlet.impl.state.StateManagementPolicyService"
/>
+
+ <bean name="PersistenceManager"
+ class="org.jboss.portal.core.impl.portlet.state.PersistentPortletStatePersistenceManager">
+ <property
name="sessionFactoryJNDIName">java:/portal/PortletSessionFactory</property>
+ </bean>
+ <bean name="PortletContainer"
+ class="org.jboss.portal.portlet.test.support.PortletInvokerSupport" />
+
+ <bean name="Producer"
+ class="org.jboss.portal.portlet.state.producer.ProducerPortletInvoker">
+ <property name="persistenceManager">
+ <inject bean="PersistenceManager" />
+ </property>
+ <property name="portletInvoker">
+ <inject bean="PortletContainer" />
+ </property>
+ <property name="stateManagementPolicy">
+ <inject bean="StateManagementPolicy" />
+ </property>
+ <property name="stateConverter">
+ <inject bean="StateConverter" />
+ </property>
+ </bean>
+
+ <bean name="InstanceContainer"
+ class="org.jboss.portal.core.impl.model.instance.InstanceContainerImpl">
+ <property name="portletInvoker">
+ <inject bean="Producer" />
+ </property>
+ <property name="containerContext">
+ <inject bean="ContainerContext" />
+ </property>
+ <property name="stackFactory">
+ <inject bean="StackFactory" />
+ </property>
+ </bean>
+
+ <bean name="AuthorizationDomainRegistry"
+ class="org.jboss.portal.security.impl.JBossAuthorizationDomainRegistryImpl"
/>
+
+ <bean name="AuthorizationManagerFactory"
+ class="org.jboss.portal.security.impl.jacc.JACCPortalAuthorizationManagerFactory">
+ <property name="authorizationDomainRegistry">
+ <inject bean="AuthorizationDomainRegistry" />
+ </property>
+ </bean>
+
+</deployment>
Added:
trunk/core-admin/src/resources/portal-admin-test-war/WEB-INF/classes/datasources.xml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-test-war/WEB-INF/classes/datasources.xml
(rev 0)
+++
trunk/core-admin/src/resources/portal-admin-test-war/WEB-INF/classes/datasources.xml 2007-08-10
22:50:33 UTC (rev 7898)
@@ -0,0 +1,60 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<datasources>
+ <!-- The hsqldb datasource -->
+ <datasource>
+ <datasource-name>hsqldb</datasource-name>
+ <connection-url>jdbc:hsqldb:file:test</connection-url>
+ <driver-class>org.hsqldb.jdbcDriver</driver-class>
+ <user-name>sa</user-name>
+ <password></password>
+ </datasource>
+<!--
+ <datasource>
+ <datasource-name>mysql5</datasource-name>
+
<connection-url>jdbc:mysql://localhost:3306/jbossportal?useServerPrepStmts=false&jdbcCompliantTruncation=false</connection-url>
+ <driver-class>com.mysql.jdbc.Driver</driver-class>
+ <user-name>portal</user-name>
+ <password>portalpassword</password>
+ </datasource>
+-->
+<!--
+ <datasource>
+ <datasource-name>oracle10g</datasource-name>
+
<connection-url>jdbc:oracle:thin:jbossportal/portalpassword@192.168.0.124:1521:orcl</connection-url>
+ <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
+ <user-name>jbossportal</user-name>
+ <password>portalpassword</password>
+ </datasource>
+-->
+<!--
+ <datasource>
+ <datasource-name>postgresql8</datasource-name>
+ <connection-url>jdbc:postgresql:jbossportal</connection-url>
+ <driver-class>org.postgresql.Driver</driver-class>
+ <user-name>portal</user-name>
+ <password>portalpassword</password>
+ </datasource>
+-->
+</datasources>
Added:
trunk/core-admin/src/resources/portal-admin-test-war/WEB-INF/classes/hibernates.xml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-test-war/WEB-INF/classes/hibernates.xml
(rev 0)
+++
trunk/core-admin/src/resources/portal-admin-test-war/WEB-INF/classes/hibernates.xml 2007-08-10
22:50:33 UTC (rev 7898)
@@ -0,0 +1,110 @@
+<configurations>
+ <!-- The default configuration that will apply everywhere -->
+ <configuration>
+ <configuration-name>default</configuration-name>
+ <properties>
+ <property>
+ <name>hibernate.show_sql</name>
+ <value>true</value>
+ </property>
+ <property>
+ <name>hibernate.auto_close_session</name>
+ <value>true</value>
+ </property>
+ <property>
+ <name>hibernate.transaction.flush_before_completion</name>
+ <value>true</value>
+ </property>
+ <property>
+ <name>hibernate.transaction.factory_class</name>
+ <value>org.hibernate.transaction.JTATransactionFactory</value>
+ </property>
+ <property>
+ <name>hibernate.transaction.manager_lookup_class</name>
+
<value>org.hibernate.transaction.JBossTransactionManagerLookup</value>
+ </property>
+ <property>
+ <name>hibernate.cache.provider_class</name>
+ <value>org.hibernate.cache.HashtableCacheProvider</value>
+ </property>
+ <property>
+ <name>hibernate.cache.use_second_level_cache</name>
+ <value>false</value>
+ </property>
+ <property>
+ <name>hibernate.cache.use_query_cache</name>
+ <value>false</value>
+ </property>
+ </properties>
+ </configuration>
+ <!-- The hsqldb configuration -->
+ <configuration>
+ <configuration-name>hsqldb</configuration-name>
+ <properties>
+ <property>
+ <name>hibernate.dialect</name>
+ <value>org.hibernate.dialect.HSQLDialect</value>
+ </property>
+ </properties>
+ </configuration>
+ <!-- The oracle 9i configuration -->
+ <configuration>
+ <configuration-name>oracle9i</configuration-name>
+ <properties>
+ <property>
+ <name>hibernate.dialect</name>
+ <value>org.hibernate.dialect.Oracle9Dialect</value>
+ </property>
+ </properties>
+ </configuration>
+ <!-- The oracle 10g configuration -->
+ <configuration>
+ <configuration-name>oracle10g</configuration-name>
+ <properties>
+ <property>
+ <name>hibernate.dialect</name>
+ <value>org.hibernate.dialect.Oracle9Dialect</value>
+ </property>
+ </properties>
+ </configuration>
+ <!-- The sqlserver configuration -->
+ <configuration>
+ <configuration-name>sqlserver</configuration-name>
+ <properties>
+ <property>
+ <name>hibernate.dialect</name>
+ <value>org.hibernate.dialect.SQLServerDialect</value>
+ </property>
+ </properties>
+ </configuration>
+ <!-- The mysql 4 configuration -->
+ <configuration>
+ <configuration-name>mysql4</configuration-name>
+ <properties>
+ <property>
+ <name>hibernate.dialect</name>
+ <value>org.hibernate.dialect.MySQLInnoDBDialect</value>
+ </property>
+ </properties>
+ </configuration>
+ <!-- The mysql 5 configuration -->
+ <configuration>
+ <configuration-name>mysql5</configuration-name>
+ <properties>
+ <property>
+ <name>hibernate.dialect</name>
+ <value>org.hibernate.dialect.MySQLInnoDBDialect</value>
+ </property>
+ </properties>
+ </configuration>
+ <!-- The postgresql 8 configuration -->
+ <configuration>
+ <configuration-name>postgresql8</configuration-name>
+ <properties>
+ <property>
+ <name>hibernate.dialect</name>
+ <value>org.hibernate.dialect.PostgreSQLDialect</value>
+ </property>
+ </properties>
+ </configuration>
+</configurations>
\ No newline at end of file
Added: trunk/core-admin/src/resources/portal-admin-test-war/WEB-INF/jboss-web.xml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-test-war/WEB-INF/jboss-web.xml
(rev 0)
+++ trunk/core-admin/src/resources/portal-admin-test-war/WEB-INF/jboss-web.xml 2007-08-10
22:50:33 UTC (rev 7898)
@@ -0,0 +1,31 @@
+<?xml version="1.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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<jboss-web>
+ <security-domain>java:jaas/portal</security-domain>
+ <resource-ref>
+ <res-ref-name>jdbc/PortalDS</res-ref-name>
+ <jndi-name>java:PortalDS</jndi-name>
+ </resource-ref>
+</jboss-web>
Added: trunk/core-admin/src/resources/portal-admin-test-war/WEB-INF/web.xmlfragment
===================================================================
--- trunk/core-admin/src/resources/portal-admin-test-war/WEB-INF/web.xmlfragment
(rev 0)
+++
trunk/core-admin/src/resources/portal-admin-test-war/WEB-INF/web.xmlfragment 2007-08-10
22:50:33 UTC (rev 7898)
@@ -0,0 +1,55 @@
+<!-- this section allows the porlet to be accessed in a servlet context for testing
purposes -->
+
+ <filter>
+ <filter-name>TransactionFilter</filter-name>
+
<filter-class>org.jboss.portal.wsrp.servlet.TransactionFilter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>TransactionFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <welcome-file-list>
+
<welcome-file>portalviewer.faces?view=/WEB-INF/jsf/objects.xhtml</welcome-file>
+ </welcome-file-list>
+
+ <listener>
+
<listener-class>org.jboss.portal.test.core.admin.bootstrap.PortalServletContextListener</listener-class>
+ </listener>
+
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.faces</url-pattern>
+ </servlet-mapping>
+
+
+ <resource-ref>
+ <res-ref-name>jdbc/PortalDS</res-ref-name>
+ <res-type>javax.sql.DataSource</res-type>
+ <res-auth>Container</res-auth>
+ <res-sharing-scope>Shareable</res-sharing-scope>
+ </resource-ref>
+
+ <login-config>
+ <auth-method>BASIC</auth-method>
+ <realm-name>JBoss Portal</realm-name>
+ </login-config>
+
+ <security-constraint>
+ <web-resource-collection>
+ <web-resource-name>Authenticated</web-resource-name>
+ <description></description>
+ <url-pattern>/*</url-pattern>
+ </web-resource-collection>
+ <auth-constraint>
+ <role-name>Authenticated</role-name>
+ </auth-constraint>
+ </security-constraint>
+
+
+
+ <security-role>
+ <role-name>Authenticated</role-name>
+ </security-role>
+
+<!-- end testing section -->
Added: trunk/core-admin/src/resources/portal-admin-test-war/portalviewer.jsp
===================================================================
--- trunk/core-admin/src/resources/portal-admin-test-war/portalviewer.jsp
(rev 0)
+++ trunk/core-admin/src/resources/portal-admin-test-war/portalviewer.jsp 2007-08-10
22:50:33 UTC (rev 7898)
@@ -0,0 +1,10 @@
+<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f" %>
+
+<!-- this jsp is a hack to get around that the portlet's jsf
+ pages exist under the WEB-INF directory, let jsf pages
+ with forms can't normally be access in the WEB-INF directory -->
+
+<% String view = request.getParameter("view");%>
+
+<jsp:forward page="<%= view %>"/>
\ No newline at end of file