You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by so...@apache.org on 2009/10/09 06:11:35 UTC
svn commit: r823399 - in /myfaces/portlet-bridge/testsuite/trunk: ./
src/main/java/org/apache/myfaces/portlet/faces/testsuite/driver/
src/main/webapp/WEB-INF/
Author: sobryan
Date: Fri Oct 9 04:11:35 2009
New Revision: 823399
URL: http://svn.apache.org/viewvc?rev=823399&view=rev
Log:
Added code to run tests from Maven
Added:
myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/driver/
myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/driver/PlutoPortalDriverFilter.java
Removed:
myfaces/portlet-bridge/testsuite/trunk/src/main/webapp/WEB-INF/pluto1.0_web.xml
Modified:
myfaces/portlet-bridge/testsuite/trunk/ (props changed)
myfaces/portlet-bridge/testsuite/trunk/pom.xml
myfaces/portlet-bridge/testsuite/trunk/src/main/webapp/WEB-INF/jetty-pluto-web-default.xml
Propchange: myfaces/portlet-bridge/testsuite/trunk/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Oct 9 04:11:35 2009
@@ -0,0 +1,2 @@
+target
+*.jpr
Modified: myfaces/portlet-bridge/testsuite/trunk/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/testsuite/trunk/pom.xml?rev=823399&r1=823398&r2=823399&view=diff
==============================================================================
--- myfaces/portlet-bridge/testsuite/trunk/pom.xml (original)
+++ myfaces/portlet-bridge/testsuite/trunk/pom.xml Fri Oct 9 04:11:35 2009
@@ -23,7 +23,7 @@
</parent>
<properties>
- <servlet.version>2.4</servlet.version>
+ <servlet.version>2.5</servlet.version>
<jsp.version>2.1</jsp.version>
<portlet.version>1.0</portlet.version>
<bridge.version>1.0.0-SNAPSHOT</bridge.version>
@@ -158,6 +158,7 @@
<groupId>com.bekk.boss</groupId>
<artifactId>maven-jetty-pluto-embedded</artifactId>
<version>${pluto-embedded.version}</version>
+ <scope>compile</scope>
</dependency>
</dependencies>
@@ -248,7 +249,7 @@
<configuration>
<transformationSets>
<transformationSet>
- <dir>${project.build.sourceDirectory}/main/webapp/WEB-INF</dir>
+ <dir>${basedir}/src/main/webapp/WEB-INF</dir>
<includes>
<include>portlet.xml</include>
</includes>
@@ -257,10 +258,10 @@
<targetName>test.xml</targetName>
</fileMapper>
</fileMappers>
- <stylesheet>src/test/resources/test.xsl</stylesheet>
+ <stylesheet>${basedir}/src/test/resources/test.xsl</stylesheet>
</transformationSet>
<transformationSet>
- <dir>${project.build.sourceDirectory}/main/webapp/WEB-INF</dir>
+ <dir>${basedir}/src/main/webapp/WEB-INF</dir>
<includes>
<include>portlet.xml</include>
</includes>
@@ -276,7 +277,7 @@
</parameter>
</parameters>
<outputDir>${project.build.directory}/${project.artifactId}-${project.version}/WEB-INF</outputDir>
- <stylesheet>${project.build.sourceDirectory}/test/resources/pluto-portal-driver-config.xsl</stylesheet>
+ <stylesheet>${basedir}/src/test/resources/pluto-portal-driver-config.xsl</stylesheet>
</transformationSet>
</transformationSets>
</configuration>
@@ -287,13 +288,13 @@
<artifactId>maven-jetty-plugin</artifactId>
<version>${jetty.version}</version>
<configuration>
- <webDefaultXml>${project.build.sourceDirectory}/main/webapp/WEB-INF/jetty-pluto-web-default.xml</webDefaultXml>
+ <webDefaultXml>${basedir}/src/main/webapp/WEB-INF/jetty-pluto-web-default.xml</webDefaultXml>
<webXml>${project.build.directory}/pluto-resources/web.xml</webXml>
<!-- see http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin systemPropertiesFile -->
- <!-- systemProperties>
+ <!--systemProperties>
<systemProperty>
<name>org.apache.pluto.embedded.portletIds</name>
- <value>chapter3Tests-bridgeVersionTest-portlet,chapter6Tests-facesContextFactoryServiceProviderTest-portlet</value>
+ <value>chapter6Tests-wrappedFacesContextTest-portlet</value>
</systemProperty>
</systemProperties-->
</configuration>
Added: myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/driver/PlutoPortalDriverFilter.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/driver/PlutoPortalDriverFilter.java?rev=823399&view=auto
==============================================================================
--- myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/driver/PlutoPortalDriverFilter.java (added)
+++ myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/driver/PlutoPortalDriverFilter.java Fri Oct 9 04:11:35 2009
@@ -0,0 +1,94 @@
+/* Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.myfaces.portlet.faces.testsuite.driver;
+
+import java.io.IOException;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.pluto.driver.PortalDriverFilter;
+
+/**
+ * This is a small class to work around an issue with the
+ * PlutoPortletDriverFilter in the pluto embedded plugin environment for maven.
+ */
+public class PlutoPortalDriverFilter
+ implements Filter
+{
+ public PlutoPortalDriverFilter()
+ {
+ }
+
+ public void init(FilterConfig filterConfig)
+ throws ServletException
+ {
+ _portalDriver.init(filterConfig);
+ _config = filterConfig;
+ }
+
+ public void doFilter(ServletRequest request,
+ ServletResponse response,
+ FilterChain chain)
+ throws IOException, ServletException
+ {
+ HttpServletRequest req = (HttpServletRequest)request;
+ String[] portletId = request.getParameterValues("portlet");
+
+ if(portletId != null)
+ {
+ req.getSession().setAttribute("org_apache_pluto_embedded_portletIds", portletId);
+ }
+
+ request.setAttribute("org_apache_pluto_embedded_portletIds", _encodePortletIds((String[])req.getSession().getAttribute("org_apache_pluto_embedded_portletIds")));
+ _portalDriver.doFilter(request, response, chain);
+
+ }
+
+ public void destroy()
+ {
+ _portalDriver.destroy();
+ }
+
+ private String[] _encodePortletIds(String... rawIds)
+ {
+ String[] ids = new String[rawIds.length];
+ String contextPath = _config.getServletContext().getContextPath();
+ StringBuffer tempId = new StringBuffer();
+ if (!contextPath.startsWith("/"))
+ {
+ tempId.append("/");
+ }
+ for(int i = 0; i < rawIds.length; i++)
+ {
+ ids[i] = contextPath + "." + rawIds[i] + "!";
+ }
+ return ids;
+ }
+
+ private final Filter _portalDriver = new PortalDriverFilter();
+ private FilterConfig _config;
+}
Modified: myfaces/portlet-bridge/testsuite/trunk/src/main/webapp/WEB-INF/jetty-pluto-web-default.xml
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/testsuite/trunk/src/main/webapp/WEB-INF/jetty-pluto-web-default.xml?rev=823399&r1=823398&r2=823399&view=diff
==============================================================================
--- myfaces/portlet-bridge/testsuite/trunk/src/main/webapp/WEB-INF/jetty-pluto-web-default.xml (original)
+++ myfaces/portlet-bridge/testsuite/trunk/src/main/webapp/WEB-INF/jetty-pluto-web-default.xml Fri Oct 9 04:11:35 2009
@@ -54,7 +54,7 @@
<filter>
<filter-name>plutoPortalDriver</filter-name>
<!--filter-class>com.bekk.boss.pluto.embedded.util.PlutoPortalDriverFilter</filter-class-->
- <filter-class>org.apache.pluto.driver.PortalDriverFilter</filter-class>
+ <filter-class>org.apache.myfaces.portlet.faces.testsuite.driver.PlutoPortalDriverFilter</filter-class>
</filter>
<filter-mapping>
@@ -69,8 +69,6 @@
<filter-name>plutoPortalDriver</filter-name>
<url-pattern>/pluto/index.jsp</url-pattern>
<url-pattern>/pluto/index.jsp/*</url-pattern>
- <url-pattern>/pluto/*</url-pattern>
- <url-pattern>/pluto</url-pattern>
</filter-mapping>
<!-- Servlets and Mappings -->