You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mf...@apache.org on 2010/11/11 01:24:34 UTC
svn commit: r1033783 - in /myfaces/portlet-bridge/tck/trunk_2.0.x:
portlet-bridge-tck-main/src/main/webapp/WEB-INF/
portlet-bridge-tck-main/src/main/webapp/tests/
src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/
s...
Author: mfreedman
Date: Thu Nov 11 00:24:33 2010
New Revision: 1033783
URL: http://svn.apache.org/viewvc?rev=1033783&view=rev
Log:
Added tests for NonFaces actionURL encoding -- encoded during either a render or resource request.
Added:
myfaces/portlet-bridge/tck/trunk_2.0.x/portlet-bridge-tck-main/src/main/webapp/tests/NonJSFViewResourceTest.jsp
myfaces/portlet-bridge/tck/trunk_2.0.x/portlet-bridge-tck-main/src/main/webapp/tests/NonJSFViewTest.jsp
myfaces/portlet-bridge/tck/trunk_2.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/NonFacesViewTestPortlet.java
Modified:
myfaces/portlet-bridge/tck/trunk_2.0.x/portlet-bridge-tck-main/src/main/webapp/WEB-INF/faces-config.xml
myfaces/portlet-bridge/tck/trunk_2.0.x/portlet-bridge-tck-main/src/main/webapp/WEB-INF/portlet.xml
myfaces/portlet-bridge/tck/trunk_2.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteViewHandlerImpl.java
myfaces/portlet-bridge/tck/trunk_2.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/TestEventHandler.java
myfaces/portlet-bridge/tck/trunk_2.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/Tests.java
Modified: myfaces/portlet-bridge/tck/trunk_2.0.x/portlet-bridge-tck-main/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/tck/trunk_2.0.x/portlet-bridge-tck-main/src/main/webapp/WEB-INF/faces-config.xml?rev=1033783&r1=1033782&r2=1033783&view=diff
==============================================================================
--- myfaces/portlet-bridge/tck/trunk_2.0.x/portlet-bridge-tck-main/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/portlet-bridge/tck/trunk_2.0.x/portlet-bridge-tck-main/src/main/webapp/WEB-INF/faces-config.xml Thu Nov 11 00:24:33 2010
@@ -177,6 +177,11 @@
<managed-bean-class>org.apache.myfaces.portlet.faces.testsuite.beans.TestRunnerBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
+ <managed-bean>
+ <managed-bean-name>nonJSFView</managed-bean-name>
+ <managed-bean-class>org.apache.myfaces.portlet.faces.testsuite.beans.NonJSFViewBean</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
<navigation-rule>
<from-view-id>/tests/*</from-view-id>
@@ -400,7 +405,7 @@
<navigation-case>
<from-outcome>encodeActionURLWithInvalidSecurityActionTest</from-outcome>
<to-view-id>/tests/MultiRequestTestResultRenderCheck.jsp?javax.portlet.faces.Secure=blue&param1=testValue</to-view-id>
- </navigation-case>
+ </navigation-case>
<navigation-case>
<from-outcome>encodeActionURLJSFViewEventTest</from-outcome>
<to-view-id>/tests/MultiRequestTestResultRenderCheck.jsp</to-view-id>
Modified: myfaces/portlet-bridge/tck/trunk_2.0.x/portlet-bridge-tck-main/src/main/webapp/WEB-INF/portlet.xml
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/tck/trunk_2.0.x/portlet-bridge-tck-main/src/main/webapp/WEB-INF/portlet.xml?rev=1033783&r1=1033782&r2=1033783&view=diff
==============================================================================
--- myfaces/portlet-bridge/tck/trunk_2.0.x/portlet-bridge-tck-main/src/main/webapp/WEB-INF/portlet.xml (original)
+++ myfaces/portlet-bridge/tck/trunk_2.0.x/portlet-bridge-tck-main/src/main/webapp/WEB-INF/portlet.xml Thu Nov 11 00:24:33 2010
@@ -2174,6 +2174,248 @@
-->
<portlet>
+ <portlet-name>chapter6_1_3_1Tests-encodeActionURLNonJSFViewRenderTest-portlet</portlet-name>
+ <portlet-class>org.apache.myfaces.portlet.faces.testsuite.tests.chapter_6.section_6_1_3_1.NonFacesViewTestPortlet</portlet-class>
+
+ <init-param>
+ <name>javax.portlet.faces.defaultViewId.view</name>
+ <value>/tests/NonJSFViewTest.jsp</value>
+ </init-param>
+
+ <expiration-cache>0</expiration-cache>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>chapter6_1_3_1Tests-encodeActionURLNonJSFViewRenderTest-portlet</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>chapter6_1_3_1Tests-encodeActionURLNonJSFViewWithParamRenderTest-portlet</portlet-name>
+ <portlet-class>org.apache.myfaces.portlet.faces.testsuite.tests.chapter_6.section_6_1_3_1.NonFacesViewTestPortlet</portlet-class>
+
+ <init-param>
+ <name>javax.portlet.faces.defaultViewId.view</name>
+ <value>/tests/NonJSFViewTest.jsp</value>
+ </init-param>
+
+ <expiration-cache>0</expiration-cache>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>chapter6_1_3_1Tests-encodeActionURLNonJSFViewWithParamRenderTest-portlet</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>chapter6_1_3_1Tests-encodeActionURLNonJSFViewWithModeRenderTest-portlet</portlet-name>
+ <portlet-class>org.apache.myfaces.portlet.faces.testsuite.tests.chapter_6.section_6_1_3_1.NonFacesViewTestPortlet</portlet-class>
+
+ <init-param>
+ <name>javax.portlet.faces.defaultViewId.view</name>
+ <value>/tests/NonJSFViewTest.jsp</value>
+ </init-param>
+
+ <init-param>
+ <name>javax.portlet.faces.defaultViewId.edit</name>
+ <value>/tests/MultiRequestTestResultRenderCheck.jsp</value>
+ </init-param>
+
+ <expiration-cache>0</expiration-cache>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ <portlet-mode>EDIT</portlet-mode>
+ </supports>
+ <portlet-info>
+ <title>chapter6_1_3_1Tests-encodeActionURLNonJSFViewWithModeRenderTest-portlet</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>chapter6_1_3_1Tests-encodeActionURLNonJSFViewWithInvalidModeRenderTest-portlet</portlet-name>
+ <portlet-class>org.apache.myfaces.portlet.faces.testsuite.tests.chapter_6.section_6_1_3_1.NonFacesViewTestPortlet</portlet-class>
+
+ <init-param>
+ <name>javax.portlet.faces.defaultViewId.view</name>
+ <value>/tests/NonJSFViewTest.jsp</value>
+ </init-param>
+
+ <expiration-cache>0</expiration-cache>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>chapter6_1_3_1Tests-encodeActionURLNonJSFViewWithInvalidModeRenderTest-portlet</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>chapter6_1_3_1Tests-encodeActionURLNonJSFViewWithWindowStateRenderTest-portlet</portlet-name>
+ <portlet-class>org.apache.myfaces.portlet.faces.testsuite.tests.chapter_6.section_6_1_3_1.NonFacesViewTestPortlet</portlet-class>
+
+ <init-param>
+ <name>javax.portlet.faces.defaultViewId.view</name>
+ <value>/tests/NonJSFViewTest.jsp</value>
+ </init-param>
+
+ <expiration-cache>0</expiration-cache>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>chapter6_1_3_1Tests-encodeActionURLNonJSFViewWithWindowStateRenderTest-portlet</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>chapter6_1_3_1Tests-encodeActionURLNonJSFViewWithInvalidWindowStateRenderTest-portlet</portlet-name>
+ <portlet-class>org.apache.myfaces.portlet.faces.testsuite.tests.chapter_6.section_6_1_3_1.NonFacesViewTestPortlet</portlet-class>
+
+ <init-param>
+ <name>javax.portlet.faces.defaultViewId.view</name>
+ <value>/tests/NonJSFViewTest.jsp</value>
+ </init-param>
+
+ <expiration-cache>0</expiration-cache>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>chapter6_1_3_1Tests-encodeActionURLNonJSFViewWithInvalidWindowStateRenderTest-portlet</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>chapter6_1_3_1Tests-encodeActionURLNonJSFViewResourceTest-portlet</portlet-name>
+ <portlet-class>org.apache.myfaces.portlet.faces.testsuite.tests.chapter_6.section_6_1_3_1.NonFacesViewTestPortlet</portlet-class>
+
+ <init-param>
+ <name>javax.portlet.faces.defaultViewId.view</name>
+ <value>/tests/NonJSFViewResourceTest.jsp</value>
+ </init-param>
+
+ <expiration-cache>0</expiration-cache>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>chapter6_1_3_1Tests-encodeActionURLNonJSFViewResourceTest-portlet</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>chapter6_1_3_1Tests-encodeActionURLNonJSFViewWithParamResourceTest-portlet</portlet-name>
+ <portlet-class>org.apache.myfaces.portlet.faces.testsuite.tests.chapter_6.section_6_1_3_1.NonFacesViewTestPortlet</portlet-class>
+
+ <init-param>
+ <name>javax.portlet.faces.defaultViewId.view</name>
+ <value>/tests/NonJSFViewResourceTest.jsp</value>
+ </init-param>
+
+ <expiration-cache>0</expiration-cache>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>chapter6_1_3_1Tests-encodeActionURLNonJSFViewWithParamResourceTest-portlet</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>chapter6_1_3_1Tests-encodeActionURLNonJSFViewWithModeResourceTest-portlet</portlet-name>
+ <portlet-class>org.apache.myfaces.portlet.faces.testsuite.tests.chapter_6.section_6_1_3_1.NonFacesViewTestPortlet</portlet-class>
+
+ <init-param>
+ <name>javax.portlet.faces.defaultViewId.view</name>
+ <value>/tests/NonJSFViewResourceTest.jsp</value>
+ </init-param>
+
+ <init-param>
+ <name>javax.portlet.faces.defaultViewId.edit</name>
+ <value>/tests/MultiRequestTestResultRenderCheck.jsp</value>
+ </init-param>
+
+ <expiration-cache>0</expiration-cache>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ <portlet-mode>EDIT</portlet-mode>
+ </supports>
+ <portlet-info>
+ <title>chapter6_1_3_1Tests-encodeActionURLNonJSFViewWithModeResourceTest-portlet</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>chapter6_1_3_1Tests-encodeActionURLNonJSFViewWithInvalidModeResourceTest-portlet</portlet-name>
+ <portlet-class>org.apache.myfaces.portlet.faces.testsuite.tests.chapter_6.section_6_1_3_1.NonFacesViewTestPortlet</portlet-class>
+
+ <init-param>
+ <name>javax.portlet.faces.defaultViewId.view</name>
+ <value>/tests/NonJSFViewResourceTest.jsp</value>
+ </init-param>
+
+ <expiration-cache>0</expiration-cache>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>chapter6_1_3_1Tests-encodeActionURLNonJSFViewWithInvalidModeResourceTest-portlet</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>chapter6_1_3_1Tests-encodeActionURLNonJSFViewWithWindowStateResourceTest-portlet</portlet-name>
+ <portlet-class>org.apache.myfaces.portlet.faces.testsuite.tests.chapter_6.section_6_1_3_1.NonFacesViewTestPortlet</portlet-class>
+
+ <init-param>
+ <name>javax.portlet.faces.defaultViewId.view</name>
+ <value>/tests/NonJSFViewResourceTest.jsp</value>
+ </init-param>
+
+ <expiration-cache>0</expiration-cache>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>chapter6_1_3_1Tests-encodeActionURLNonJSFViewWithWindowStateResourceTest-portlet</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>chapter6_1_3_1Tests-encodeActionURLNonJSFViewWithInvalidWindowStateResourceTest-portlet</portlet-name>
+ <portlet-class>org.apache.myfaces.portlet.faces.testsuite.tests.chapter_6.section_6_1_3_1.NonFacesViewTestPortlet</portlet-class>
+
+ <init-param>
+ <name>javax.portlet.faces.defaultViewId.view</name>
+ <value>/tests/NonJSFViewResourceTest.jsp</value>
+ </init-param>
+
+ <expiration-cache>0</expiration-cache>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>chapter6_1_3_1Tests-encodeActionURLNonJSFViewWithInvalidWindowStateResourceTest-portlet</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
<portlet-name>chapter6_1_3_1Tests-encodeActionURLJSFViewEventTest-portlet</portlet-name>
<portlet-class>org.apache.myfaces.portlet.faces.testsuite.common.portlet.GenericFacesTestSuitePortlet</portlet-class>
@@ -3000,6 +3242,54 @@
</portlet-info>
</portlet>
+ <portlet>
+ <portlet-name>chapter6_1_3_1Tests-encodeResourceURLWithModeTest-portlet</portlet-name>
+ <portlet-class>org.apache.myfaces.portlet.faces.testsuite.common.portlet.GenericFacesTestSuitePortlet</portlet-class>
+
+ <init-param>
+ <name>javax.portlet.faces.defaultViewId.view</name>
+ <value>/tests/ResourceTrinidadResult.jsp</value>
+ </init-param>
+
+ <init-param>
+ <name>javax.portlet.faces.defaultRenderKitId</name>
+ <value>org.apache.myfaces.trinidad.core</value>
+ </init-param>
+
+ <expiration-cache>0</expiration-cache>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>chapter6_1_3_1Tests-encodeResourceURLWithModeTest-portlet</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>chapter6_1_3_1Tests-encodeResourceURLWithWindowStateTest-portlet</portlet-name>
+ <portlet-class>org.apache.myfaces.portlet.faces.testsuite.common.portlet.GenericFacesTestSuitePortlet</portlet-class>
+
+ <init-param>
+ <name>javax.portlet.faces.defaultViewId.view</name>
+ <value>/tests/ResourceTrinidadResult.jsp</value>
+ </init-param>
+
+ <init-param>
+ <name>javax.portlet.faces.defaultRenderKitId</name>
+ <value>org.apache.myfaces.trinidad.core</value>
+ </init-param>
+
+ <expiration-cache>0</expiration-cache>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>chapter6_1_3_1Tests-encodeResourceURLWithWindowStateTest-portlet</title>
+ </portlet-info>
+ </portlet>
+
<!-- *************************************************************** -->
<!-- * * -->
<!-- * Portlet: getRequest and setRequest Test * -->
Added: myfaces/portlet-bridge/tck/trunk_2.0.x/portlet-bridge-tck-main/src/main/webapp/tests/NonJSFViewResourceTest.jsp
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/tck/trunk_2.0.x/portlet-bridge-tck-main/src/main/webapp/tests/NonJSFViewResourceTest.jsp?rev=1033783&view=auto
==============================================================================
--- myfaces/portlet-bridge/tck/trunk_2.0.x/portlet-bridge-tck-main/src/main/webapp/tests/NonJSFViewResourceTest.jsp (added)
+++ myfaces/portlet-bridge/tck/trunk_2.0.x/portlet-bridge-tck-main/src/main/webapp/tests/NonJSFViewResourceTest.jsp Thu Nov 11 00:24:33 2010
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+<%@ page contentType="text/html;charset=UTF-8"
+ isELIgnored="false"
+ import="javax.faces.context.*, javax.faces.application.*, java.lang.Boolean" %>
+
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+
+<f:view>
+ <html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+ <title>JSR 329 NonJSFResource Test</title>
+ </head>
+ <body>
+ <h:form>
+ <h:panelGrid columns="1">
+ <h:outputText value="Test result in iFrame."/>
+ </h:panelGrid>
+ </h:form>
+<%
+ ExternalContext extCtx = FacesContext.getCurrentInstance().getExternalContext();
+ String resource = extCtx.encodeActionURL("portlet:resource?_jsfBridgeViewId=/tests/NonJSFViewTest.jsp");
+ out.println("<iframe src=\"" + resource + "\" width=\"100%\" height=\"400px\"/>");
+%>
+ </body>
+ </html>
+</f:view>
Added: myfaces/portlet-bridge/tck/trunk_2.0.x/portlet-bridge-tck-main/src/main/webapp/tests/NonJSFViewTest.jsp
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/tck/trunk_2.0.x/portlet-bridge-tck-main/src/main/webapp/tests/NonJSFViewTest.jsp?rev=1033783&view=auto
==============================================================================
--- myfaces/portlet-bridge/tck/trunk_2.0.x/portlet-bridge-tck-main/src/main/webapp/tests/NonJSFViewTest.jsp (added)
+++ myfaces/portlet-bridge/tck/trunk_2.0.x/portlet-bridge-tck-main/src/main/webapp/tests/NonJSFViewTest.jsp Thu Nov 11 00:24:33 2010
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+<%@ page contentType="text/html;charset=UTF-8"%>
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+
+
+<f:view>
+ <html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+ <title>JSR 301 Single Request TCK Test</title>
+ </head>
+ <body>
+ <h:form>
+ <h:outputLink value="#{nonJSFView.url}" >
+ <h:outputText value="Run Test"/>
+ </h:outputLink>
+ </h:form>
+
+ </body>
+ </html>
+</f:view>
Modified: myfaces/portlet-bridge/tck/trunk_2.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteViewHandlerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/tck/trunk_2.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteViewHandlerImpl.java?rev=1033783&r1=1033782&r2=1033783&view=diff
==============================================================================
--- myfaces/portlet-bridge/tck/trunk_2.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteViewHandlerImpl.java (original)
+++ myfaces/portlet-bridge/tck/trunk_2.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteViewHandlerImpl.java Thu Nov 11 00:24:33 2010
@@ -262,11 +262,11 @@ public class TestSuiteViewHandlerImpl ex
if (testName == null) return resultURL;
if (testName.equals("encodeActionURLWithParamRenderTest"))
return appendQueryString(resultURL, "param1=testValue");
- else if (testName.equals("encodeActionURLWithModeRenderTest"))
+ else if (testName.equals("encodeActionURLWithModeRenderTest") || testName.equals("encodeResourceURLWithModeTest"))
return appendQueryString(resultURL, "javax.portlet.faces.PortletMode=edit¶m1=testValue");
else if (testName.equals("encodeActionURLWithInvalidModeRenderTest"))
return appendQueryString(resultURL, "javax.portlet.faces.PortletMode=blue¶m1=testValue");
- else if (testName.equals("encodeActionURLWithWindowStateRenderTest"))
+ else if (testName.equals("encodeActionURLWithWindowStateRenderTest") || testName.equals("encodeResourceURLWithWindowStateTest"))
return appendQueryString(resultURL, "javax.portlet.faces.WindowState=maximized¶m1=testValue");
else if (testName.equals("encodeActionURLWithInvalidWindowStateRenderTest"))
return appendQueryString(resultURL, "javax.portlet.faces.WindowState=blue¶m1=testValue");
Added: myfaces/portlet-bridge/tck/trunk_2.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/NonFacesViewTestPortlet.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/tck/trunk_2.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/NonFacesViewTestPortlet.java?rev=1033783&view=auto
==============================================================================
--- myfaces/portlet-bridge/tck/trunk_2.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/NonFacesViewTestPortlet.java (added)
+++ myfaces/portlet-bridge/tck/trunk_2.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/NonFacesViewTestPortlet.java Thu Nov 11 00:24:33 2010
@@ -0,0 +1,244 @@
+/* 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.tests.chapter_6.section_6_1_3_1;
+
+import java.io.IOException;
+
+import java.io.PrintWriter;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.portlet.PortletSession;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.WindowState;
+import javax.portlet.faces.Bridge;
+import javax.portlet.faces.BridgeInvalidViewPathException;
+import javax.portlet.faces.BridgeUninitializedException;
+import javax.portlet.faces.GenericFacesPortlet;
+
+import org.apache.myfaces.portlet.faces.testsuite.annotation.BridgeTest;
+import org.apache.myfaces.portlet.faces.testsuite.common.Constants;
+import org.apache.myfaces.portlet.faces.testsuite.common.portlet.GenericFacesTestSuitePortlet;
+import org.apache.myfaces.portlet.faces.testsuite.common.util.BridgeTCKResultWriter;
+
+public class NonFacesViewTestPortlet
+ extends GenericFacesTestSuitePortlet
+{
+
+
+ public void init(PortletConfig config)
+ throws PortletException
+ {
+ super.init(config);
+
+ }
+
+ public String runTest(RenderRequest request, RenderResponse response)
+ throws PortletException, IOException
+ {
+
+ String target = request.getParameter("_jsfBridgeNonFacesView");
+ if (target == null)
+ {
+ return outputTestResult(false, "_jsfBridgeNonFacesView parameter not (encoded in) nonFaces request.");
+ }
+ else if (!target.equalsIgnoreCase("/NonFacesViewTestPortlet.ptlt"))
+ {
+ return outputTestResult(false, "_jsfBridgeNonFacesView parameter (encoded in) nonFaces request but with unexpected value. Expected: 'NonFacesViewTestPortlet' but received: " +
+ target);
+ }
+
+ String testName = getTestName();
+ String paramResult = null;
+
+ if (testName.equals("encodeActionURLNonJSFViewRenderTest") || testName.equals("encodeActionURLNonJSFViewResourceTest"))
+ {
+ return outputTestResult(true, "Correctly encoded nonFaces URL as a renderURL using the _jsfBridgeNonFacesView parameter.");
+ }
+ else if (testName.equals("encodeActionURLNonJSFViewWithParamRenderTest") || testName.equals("encodeActionURLNonJSFViewWithParamResourceTest"))
+ {
+ paramResult = checkParameter(request, response);
+ if (paramResult.equals("true"))
+ {
+ return outputTestResult(true, "Correctly encoded nonFaces URL as a renderURL using the _jsfBridgeNonFacesView parameter along with the additional parameter.");
+ }
+ else
+ {
+ return paramResult;
+ }
+ }
+ else if (testName.equals("encodeActionURLNonJSFViewWithModeRenderTest") || testName.equals("encodeActionURLNonJSFViewWithModeResourceTest"))
+ {
+ // Parameter/Mode encoded in the faces-config.xml target
+ PortletMode mode = request.getPortletMode();
+ if (mode == null || !mode.toString().equalsIgnoreCase("edit"))
+ {
+ return outputTestResult(false,
+ "encodeActionURL incorrectly encoded the new portlet mode. The resulting request wasn't in the expected 'edit' mode.");
+ }
+ paramResult = checkParameter(request, response);
+ if (paramResult.equals("true"))
+ {
+ return outputTestResult(true, "Correctly encoded nonFaces URL as a renderURL using the _jsfBridgeNonFacesView parameter including a change in mode and with the additional parameter.");
+ }
+ else
+ {
+ return paramResult;
+ }
+ // otherwise error output in checkParameter
+ }
+ else if (testName.equals("encodeActionURLNonJSFViewWithInvalidModeRenderTest") || testName.equals("encodeActionURLNonJSFViewWithInvalidModeResourceTest"))
+ {
+ // Parameter/Mode encoded in the faces-config.xml target
+ PortletMode mode = request.getPortletMode();
+ if (mode == null || !mode.toString().equalsIgnoreCase("view"))
+ {
+ return outputTestResult(false,
+ "encodeActionURL incorrectly encoded an invalid portlet mode. The resulting request should have ignored the invalid mode and remained in 'view' mode.");
+ }
+ paramResult = checkParameter(request, response);
+ if (paramResult.equals("true"))
+ {
+ return outputTestResult(true, "Correctly encoded nonFaces URL as a renderURL using the _jsfBridgeNonFacesView parameter excluding the invalid mode and including the additional parameter.");
+ }
+ else
+ {
+ return paramResult;
+ }
+ }
+ else if (testName.equals("encodeActionURLNonJSFViewWithWindowStateRenderTest") || testName.equals("encodeActionURLNonJSFViewWithWindowStateResourceTest"))
+ {
+ // Parameter/Mode encoded in the faces-config.xml target
+ WindowState ws = request.getWindowState();
+ if (ws == null || !ws.toString().equalsIgnoreCase("maximized"))
+ {
+ return outputTestResult(false,
+ "encodeActionURL incorrectly encoded the new portlet window state. The resulting request wasn't in the expected 'maximized' mode.");
+ }
+ paramResult = checkParameter(request, response);
+ if (paramResult.equals("true"))
+ {
+ return outputTestResult(true, "Correctly encoded nonFaces URL as a renderURL using the _jsfBridgeNonFacesView parameter including a change in window state and with the additional parameter.");
+ }
+ else
+ {
+ return paramResult;
+ }
+
+ }
+ else if (testName.equals("encodeActionURLNonJSFViewWithInvalidWindowStateRenderTest") || testName.equals("encodeActionURLNonJSFViewWithInvalidWindowStateResourceTest"))
+ {
+ // Parameter/Mode encoded in the faces-config.xml target
+ WindowState ws = request.getWindowState();
+ if (ws == null || !ws.toString().equalsIgnoreCase("normal"))
+ {
+ return outputTestResult(false,
+ "encodeActionURL incorrectly encoded an invalid window state. The resulting request should have ignored the invalid window state and remained in 'normal' mode.");
+ }
+ paramResult = checkParameter(request, response);
+ if (paramResult.equals("true"))
+ {
+ return outputTestResult(true, "Correctly encoded nonFaces URL as a renderURL using the _jsfBridgeNonFacesView parameter excluding the invalid window state and with the additional parameter.");
+ }
+ else
+ {
+ return paramResult;
+ }
+ }
+ else
+ {
+ return outputTestResult(false, "Unexpected error -- should not have hit this arm in the conditional statement.");
+ }
+ }
+
+
+ public void doDispatch(RenderRequest renderRequest,
+ RenderResponse renderResponse)
+ throws PortletException, IOException
+ {
+ PortletSession s = renderRequest.getPortletSession(true);
+ Boolean rendered = (Boolean) s.getAttribute("org.apache.myfaces.portlet.faces.tck.nonJSFURLRendered");
+
+
+ if (rendered == null)
+ {
+
+ super.doDispatch(renderRequest, renderResponse);
+ return;
+ }
+ else
+ {
+ s.removeAttribute("org.apache.myfaces.portlet.faces.tck.nonJSFURLRendered");
+
+ renderResponse.setContentType("text/html");
+ PrintWriter out = renderResponse.getWriter();
+
+ out.println(runTest(renderRequest, renderResponse));
+ }
+
+ }
+
+ private String outputTestResult(boolean pass, String msg)
+ throws IOException
+ {
+ BridgeTCKResultWriter resultWriter =
+ new BridgeTCKResultWriter(getTestName());
+
+ if (pass)
+ {
+ resultWriter.setStatus(BridgeTCKResultWriter.PASS);
+ resultWriter.setDetail(msg);
+ }
+ else
+ {
+ resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
+ resultWriter.setDetail(msg);
+ }
+
+ return resultWriter.toString();
+
+ }
+
+ private String checkParameter(RenderRequest request, RenderResponse response) throws IOException
+ {
+ String pVal =
+ request.getParameter("param1");
+ if (pVal != null && pVal.equals("testValue"))
+ {
+ return "true";
+ }
+ else if (pVal == null)
+ {
+ outputTestResult(false, "Expected additional parameter 'param1' is missing.");
+ }
+ else if (!pVal.equals("testValue"))
+ {
+ outputTestResult(false, "Expected additional parameter 'param1' has unexpected value. Expected: 'param1' but received " +
+ pVal);
+ }
+ return "false";
+ }
+}
Modified: myfaces/portlet-bridge/tck/trunk_2.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/TestEventHandler.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/tck/trunk_2.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/TestEventHandler.java?rev=1033783&r1=1033782&r2=1033783&view=diff
==============================================================================
--- myfaces/portlet-bridge/tck/trunk_2.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/TestEventHandler.java (original)
+++ myfaces/portlet-bridge/tck/trunk_2.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/TestEventHandler.java Thu Nov 11 00:24:33 2010
@@ -59,8 +59,14 @@ public class TestEventHandler
public EventNavigationResult handleEvent(FacesContext context, Event event)
{
+ Map<String, Object> m = context.getExternalContext().getRequestMap();
+ String portletTestName = (String) m.get(Constants.TEST_NAME);
String testName = (String) event.getValue();
+ // Not our test so ignore this event (since we pass the same event to many portlets/test
+ if (testName == null || portletTestName == null ||!testName.equals(portletTestName))
+ return null;
+
if (testName.equalsIgnoreCase("getRequestHeaderMapEventTest"))
{
getRequestHeaderMapEventTest();
Modified: myfaces/portlet-bridge/tck/trunk_2.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/Tests.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/tck/trunk_2.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/Tests.java?rev=1033783&r1=1033782&r2=1033783&view=diff
==============================================================================
--- myfaces/portlet-bridge/tck/trunk_2.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/Tests.java (original)
+++ myfaces/portlet-bridge/tck/trunk_2.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/Tests.java Thu Nov 11 00:24:33 2010
@@ -793,6 +793,8 @@ public class Tests
}
}
+
+
// Test is MultiRequest -- Render/Action
// Test #6.103
@BridgeTest(test = "encodeActionURLJSFViewEventTest")
@@ -1386,6 +1388,8 @@ public class Tests
}
}
}
+
+
// Test is MultiRequest -- Render/Action
// Test #6.21
@@ -1617,6 +1621,7 @@ public class Tests
}
}
+
// Test Single Render followed by resource request
// Test #6.111
@@ -2405,6 +2410,122 @@ public class Tests
return Constants.TEST_FAILED;
}
}
+
+ // Test is MultiRequest -- Render/Action
+ // Test #6.136
+ @BridgeTest(test = "encodeResourceURLWithModeTest")
+ public String encodeResourceURLWithModeTest(TestRunnerBean testRunner)
+ {
+ // This tests that we can encode a new mode in an actionURL
+ // done by navigation rule.
+ if (BridgeUtil.getPortletRequestPhase() ==
+ Bridge.PortletPhase.RESOURCE_PHASE)
+ {
+ FacesContext ctx = FacesContext.getCurrentInstance();
+ PortletRequest pReq =
+ (PortletRequest) ctx.getExternalContext().getRequest();
+ // Parameter/Mode encoded in the faces-config.xml target
+ PortletMode mode = pReq.getPortletMode();
+ // Check that the parameter came along too
+ String pVal =
+ ctx.getExternalContext().getRequestParameterMap().get("param1");
+
+ if (mode == null || !mode.toString().equalsIgnoreCase("view"))
+ {
+ testRunner.setTestResult(false,
+ "encodeResourceURL incorrectly encoded the portlet mode. The resulting request should have ignored the mode and remained in 'view' mode.");
+ }
+ else if (pVal == null)
+ {
+ testRunner.setTestResult(false,
+ "encodeResourceURL incorrectly encoded the mode and parameter. The resulting request didn't contain the expected 'param1' parameter.");
+ }
+ else if (!pVal.equals("testValue"))
+ {
+ testRunner.setTestResult(false,
+ "encodeResourceURL incorrectly encoded the mode and parameter. The resulting request contained the wrong parameter value. Expected: testValue Received: " +
+ pVal);
+ }
+ else
+ {
+ testRunner.setTestResult(true,
+ "encodeResourceURL correctly encoded a URL by ignoring the mode and properly encoding the parameter.");
+ }
+
+ testRunner.setTestComplete(true);
+
+ if (testRunner.getTestStatus())
+ {
+ return Constants.TEST_SUCCESS;
+ }
+ else
+ {
+ return Constants.TEST_FAILED;
+ }
+ }
+ else
+ {
+ return "";
+ }
+ }
+
+ // Test is MultiRequest -- Render/Action
+ // Test #6.136 (b)
+ @BridgeTest(test = "encodeResourceURLWithWindowStateTest")
+ public String encodeResourceURLWithWindowStateTest(TestRunnerBean testRunner)
+ {
+ // This tests that we can encode a new mode in an actionURL
+ // done by navigation rule.
+ if (BridgeUtil.getPortletRequestPhase() ==
+ Bridge.PortletPhase.RESOURCE_PHASE)
+ {
+ FacesContext ctx = FacesContext.getCurrentInstance();
+ PortletRequest pReq =
+ (PortletRequest) ctx.getExternalContext().getRequest();
+ // Parameter/Mode encoded in the faces-config.xml target
+ WindowState ws = pReq.getWindowState();
+ // Check that the parameter came along too
+ String pVal =
+ ctx.getExternalContext().getRequestParameterMap().get("param1");
+
+ if (ws == null || !ws.toString().equalsIgnoreCase("normal"))
+ {
+ testRunner.setTestResult(false,
+ "encodeResourceURL incorrectly encoded the portlet window state. The resulting request should have ignored the invalid window state and remained in 'normal' mode.");
+ }
+ else if (pVal == null)
+ {
+ testRunner.setTestResult(false,
+ "encodeResourceURL incorrectly encoded the window state and parameter. The resulting request didn't contain the expected 'param1' parameter.");
+ }
+ else if (!pVal.equals("testValue"))
+ {
+ testRunner.setTestResult(false,
+ "encodeResourceURL incorrectly encoded the window state and parameter. The resulting request contained the wrong parameter value. Expected: testValue Received: " +
+ pVal);
+ }
+ else
+ {
+ testRunner.setTestResult(true,
+ "encodeResourceURL correctly encoded a URL by ignoring the window state and properly encoding the parameter.");
+ }
+
+ testRunner.setTestComplete(true);
+
+ if (testRunner.getTestStatus())
+ {
+ return Constants.TEST_SUCCESS;
+ }
+ else
+ {
+ return Constants.TEST_FAILED;
+ }
+ }
+ else
+ {
+ return "";
+ }
+ }
// Test is SingleRequest -- Render only
// Test #6.32