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/06/04 19:52:49 UTC
svn commit: r951506 - in /myfaces/portlet-bridge/tck/trunk_2.0.x:
portlet-bridge-testsuite-main/src/main/webapp/WEB-INF/faces-config.xml
src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/Tests.java
Author: mfreedman
Date: Fri Jun 4 17:52:48 2010
New Revision: 951506
URL: http://svn.apache.org/viewvc?rev=951506&view=rev
Log:
Fixes following tests on WLP:
Test: restoredViewStateParameterTest -- missing info from faces-config
Test: encodeActionURLPortletActionTest -- uses url.write vs. toString
Test: encodeActionURLPortletRenderTest -- uses url.write vs. toString
Test: setsIsPostbackAttributeTest -- missing info from faces-config
Test: getRequestHeaderMapActionTest -- changed so okay if content-length excluded
Modified:
myfaces/portlet-bridge/tck/trunk_2.0.x/portlet-bridge-testsuite-main/src/main/webapp/WEB-INF/faces-config.xml
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-testsuite-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-testsuite-main/src/main/webapp/WEB-INF/faces-config.xml?rev=951506&r1=951505&r2=951506&view=diff
==============================================================================
--- myfaces/portlet-bridge/tck/trunk_2.0.x/portlet-bridge-testsuite-main/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/portlet-bridge/tck/trunk_2.0.x/portlet-bridge-testsuite-main/src/main/webapp/WEB-INF/faces-config.xml Fri Jun 4 17:52:48 2010
@@ -81,6 +81,11 @@
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
+ <managed-bean-name>chapter6_7Tests</managed-bean-name>
+ <managed-bean-class>org.apache.myfaces.portlet.faces.testsuite.tests.chapter_6.section_6_7.Tests</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
<managed-bean-name>predestroyBean1</managed-bean-name>
<managed-bean-class>org.apache.myfaces.portlet.faces.testsuite.beans.PreDestroyBean1</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
@@ -342,6 +347,14 @@
<navigation-case>
<from-outcome>portletNamingContainerClientIdConsistentTest</from-outcome>
<to-view-id>/tests/MultiRequestTestResultRenderCheck.jsp</to-view-id>
+ </navigation-case>
+ <navigation-case>
+ <from-outcome>restoredViewStateParameterTest</from-outcome>
+ <to-view-id>/tests/MultiRequestTestResultRenderCheck.jsp</to-view-id>
+ </navigation-case>
+ <navigation-case>
+ <from-outcome>setsIsPostbackAttributeTest</from-outcome>
+ <to-view-id>/tests/MultiRequestTestResultRenderCheck.jsp</to-view-id>
</navigation-case>
</navigation-rule>
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=951506&r1=951505&r2=951506&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 Fri Jun 4 17:52:48 2010
@@ -20,6 +20,8 @@
package org.apache.myfaces.portlet.faces.testsuite.tests.chapter_6.section_6_1_3_1;
+import java.io.BufferedReader;
+import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.util.Enumeration;
@@ -29,11 +31,6 @@ import java.util.Map;
import java.util.Set;
-import javax.el.ELContext;
-import javax.el.ExpressionFactory;
-
-import javax.el.ValueExpression;
-
import javax.faces.application.Application;
import javax.faces.application.FacesMessage;
import javax.faces.application.ViewHandler;
@@ -42,6 +39,7 @@ import javax.faces.context.FacesContext;
import javax.faces.render.ResponseStateManager;
import javax.portlet.ActionRequest;
+import javax.portlet.ClientDataRequest;
import javax.portlet.filter.ActionRequestWrapper;
import javax.portlet.PortletMode;
import javax.portlet.PortletRequest;
@@ -240,7 +238,15 @@ public class Tests
PortletURL portletURL = response.createRenderURL();
portletURL.setParameter("param1", "value1");
portletURL.setParameter("param2", "value2");
- String portletEncoded = portletURL.toString();
+ StringWriter sw = new StringWriter(50);
+ String portletEncoded = null;
+ try {
+ portletURL.write(sw, true);
+ portletEncoded = sw.toString();
+ } catch (Exception e)
+ {
+ portletEncoded = portletURL.toString();
+ }
// PortletContainers can return "URLs" with strict XML encoding -- as the bridge
// encoding depends on what is past in to it -- make sure we send in a string
@@ -293,7 +299,16 @@ public class Tests
PortletURL portletURL = response.createActionURL();
portletURL.setParameter("param1", "value1");
portletURL.setParameter("param2", "value2");
- String portletEncoded = portletURL.toString();
+ StringWriter sw = new StringWriter(50);
+ String portletEncoded = null;
+ try {
+ portletURL.write(sw, true);
+ portletEncoded = sw.toString();
+ } catch (Exception e)
+ {
+ portletEncoded = portletURL.toString();
+ }
+
// PortletContainers can return "URLs" with strict XML encoding -- as the bridge
// encoding depends on what is past in to it -- make sure we send in a string
@@ -1565,8 +1580,23 @@ public class Tests
{
String s = extCtx.getRequestCharacterEncoding();
String testEncoding = null;
- // read the parameters to ensure setting the encoding is invalid.
- Map m = ((PortletRequest) extCtx.getRequest()).getParameterMap();
+
+ // A number of container have trouble with this test --
+ // All one should have to do is get the parameters to cause the test state to be set
+ // but some containers require the reader be called -- issue is -- the spec also
+ // says you can't get a reader if its a form postback.
+ // Anyway -- first try to get a reader -- then to read the parameters to
+ // be most accomodative
+ try
+ {
+ BufferedReader b = ((ClientDataRequest) extCtx.getRequest()).getReader();
+ int i = 0;
+ }
+ catch (Exception e)
+ {
+ // container likely did the right thing -- but make sure by reading the parameters
+ Map m = ((PortletRequest) extCtx.getRequest()).getParameterMap();
+ }
if (s == null || (s != null && !s.equalsIgnoreCase(utf8)))
{
@@ -1884,12 +1914,20 @@ public class Tests
}
}
- // Now enumerate the requests property Enumeration and make sure all are in this Map (except Content-Type)
+ // Now enumerate the requests property Enumeration and make sure all are in this Map
while (propertyNames.hasMoreElements())
{
String prop = (String) propertyNames.nextElement();
if (!headerMap.containsKey(prop))
{
+ // Note: By spec Content-Length is only included if getContentLength() isn't -1
+ if (prop.equalsIgnoreCase("content-length"))
+ {
+ if (((ActionRequest)extCtx.getRequest()).getContentLength() == -1)
+ {
+ continue;
+ }
+ }
testRunner.setTestResult(false,
"Failed: The Map returned from getRequestHeaderMap didn't contain all the key/values from request.getProperties. Its missing: " +
prop);