myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfreed...@apache.org
Subject svn commit: r1139084 - in /myfaces/portlet-bridge/tck/trunk_3.0.x: ./ src/main/java/org/apache/myfaces/portlet/faces/testsuite/beans/ src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/
Date Thu, 23 Jun 2011 21:47:23 GMT
Author: mfreedman
Date: Thu Jun 23 21:47:23 2011
New Revision: 1139084

URL: http://svn.apache.org/viewvc?rev=1139084&view=rev
Log:
Test changes merged forward from jsr329TCK that were result of fixing/addressing PORTLETBRIDGE-215

Modified:
    myfaces/portlet-bridge/tck/trunk_3.0.x/   (props changed)
    myfaces/portlet-bridge/tck/trunk_3.0.x/pom.xml
    myfaces/portlet-bridge/tck/trunk_3.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/beans/NonJSFViewBean.java
    myfaces/portlet-bridge/tck/trunk_3.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/NonFacesViewTestPortlet.java
    myfaces/portlet-bridge/tck/trunk_3.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/Tests.java

Propchange: myfaces/portlet-bridge/tck/trunk_3.0.x/
------------------------------------------------------------------------------
    svn:mergeinfo = /myfaces/portlet-bridge/tck/trunk_2.0.x:1139023

Modified: myfaces/portlet-bridge/tck/trunk_3.0.x/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/tck/trunk_3.0.x/pom.xml?rev=1139084&r1=1139083&r2=1139084&view=diff
==============================================================================
--- myfaces/portlet-bridge/tck/trunk_3.0.x/pom.xml (original)
+++ myfaces/portlet-bridge/tck/trunk_3.0.x/pom.xml Thu Jun 23 21:47:23 2011
@@ -51,25 +51,28 @@
     <jsp.version>2.1</jsp.version>
     
     <!-- Bridge Configurations -->
-    <portlet-bridge.version>3.0.0-alpha</portlet-bridge.version>
+    <portlet-bridge.version>3.0.0-SNAPSHOT</portlet-bridge.version>
     <portlet-bridge.groupId>${project.groupId}</portlet-bridge.groupId>
 
     <portlet-bridge.api.groupId>${portlet-bridge.groupId}</portlet-bridge.api.groupId>
     <portlet-bridge.api.artifactId>portlet-bridge-api</portlet-bridge.api.artifactId>
 
     <portlet-bridge.api.version>${portlet-bridge.version}</portlet-bridge.api.version>
+    <portlet-bridge.controller.api.groupId>${portlet-bridge.groupId}</portlet-bridge.controller.api.groupId>
+    <portlet-bridge.controller.api.artifactId>portlet-bridge-api</portlet-bridge.controller.api.artifactId>
 
+    <portlet-bridge.controller.api.version>${portlet-bridge.version}</portlet-bridge.controller.api.version>
     <portlet-bridge.impl.groupId>${portlet-bridge.groupId}</portlet-bridge.impl.groupId>
     <portlet-bridge.impl.artifactId>portlet-bridge-impl</portlet-bridge.impl.artifactId>
 
     <portlet-bridge.impl.version>${portlet-bridge.version}</portlet-bridge.impl.version>
     
     <!-- Faces Implementation Default Version Numbers -->
-    <mojarra.version>2.0.1</mojarra.version>
+    <mojarra.version>2.0.4-b09</mojarra.version>
     <myfaces.version>2.0.1</myfaces.version>
 
     <!-- Trinidad Ids -->
     <trinidad.groupId>org.apache.myfaces.trinidad</trinidad.groupId>
     <trinidad.api.artifactId>trinidad-api</trinidad.api.artifactId>
     <trinidad.impl.artifactId>trinidad-impl</trinidad.impl.artifactId>
-    <trinidad.version>2.0.0-beta-3-SNAPSHOT</trinidad.version>
+    <trinidad.version>2.0.0</trinidad.version>
     
     <!-- JSF Implementation in use -->
     <jsf.groupId>com.sun.faces</jsf.groupId>
@@ -97,7 +100,8 @@
     <!-- TCK Test Harness Configuration -->
     <bridge.tck.selenium.host>localhost</bridge.tck.selenium.host>
     <bridge.tck.selenium.port>4444</bridge.tck.selenium.port>
-    <bridge.tck.browser>*googlechrome</bridge.tck.browser>
+    <bridge.tck.browser>*firefox</bridge.tck.browser>
+    <!-- <bridge.tck.browser>*googlechrome</bridge.tck.browser> -->
     <bridge.tck.login-file />
 
     <bridge.tck.test.file.dir>${project.build.directory}/generated-resources/xml/xslt</bridge.tck.test.file.dir>
@@ -161,7 +165,12 @@
         <groupId>${portlet-bridge.api.groupId}</groupId>
         <artifactId>${portlet-bridge.api.artifactId}</artifactId>
         <version>${portlet-bridge.api.version}</version>
-        <scope>provided</scope>
+      </dependency>
+
+      <dependency>
+        <groupId>${portlet-bridge.controller.api.groupId}</groupId>
+        <artifactId>${portlet-bridge.controller.api.artifactId}</artifactId>
+        <version>${portlet-bridge.controller.api.version}</version>
       </dependency>
 
       <dependency>
@@ -268,12 +277,7 @@
       <artifactId>${jsf.api.artifactId}</artifactId>
     </dependency>
 
-                
-    <dependency>
-      <groupId>${portlet-bridge.api.groupId}</groupId>
-      <artifactId>${portlet-bridge.api.artifactId}</artifactId>
-    </dependency>
-    
+                    
     <dependency>
       <groupId>com.bekk.boss</groupId>
       <artifactId>maven-jetty-pluto-embedded</artifactId>

Modified: myfaces/portlet-bridge/tck/trunk_3.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/beans/NonJSFViewBean.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/tck/trunk_3.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/beans/NonJSFViewBean.java?rev=1139084&r1=1139083&r2=1139084&view=diff
==============================================================================
--- myfaces/portlet-bridge/tck/trunk_3.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/beans/NonJSFViewBean.java
(original)
+++ myfaces/portlet-bridge/tck/trunk_3.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/beans/NonJSFViewBean.java
Thu Jun 23 21:47:23 2011
@@ -21,11 +21,13 @@ package org.apache.myfaces.portlet.faces
 
 import java.util.Map;
 
+import javax.faces.application.ViewHandler;
 import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
 
 
 import org.apache.myfaces.portlet.faces.testsuite.common.Constants;
+import org.apache.myfaces.portlet.faces.testsuite.tests.chapter_6.section_6_1_3_1.NonFacesViewTestPortlet;
 
 
 public class NonJSFViewBean
@@ -47,27 +49,27 @@ public class NonJSFViewBean
     
     if (testName.equals("encodeActionURLNonJSFViewRenderTest") || testName.equals("encodeActionURLNonJSFViewResourceTest"))
     {
-      return "/NonFacesViewTestPortlet.ptlt?javax.portlet.faces.ViewLink=true&amp;invokeTest=true";
+      return extCtx.getRequestContextPath() + "/NonFacesViewTestPortlet.ptlt?javax.portlet.faces.ViewLink=true&amp;invokeTest=true";
     }
     else if (testName.equals("encodeActionURLNonJSFViewWithParamRenderTest") || testName.equals("encodeActionURLNonJSFViewWithParamResourceTest"))
     {
-      return "/NonFacesViewTestPortlet.ptlt?javax.portlet.faces.ViewLink=true&amp;invokeTest=true&amp;param1=testValue";
+      return extCtx.getRequestContextPath() + "/NonFacesViewTestPortlet.ptlt?javax.portlet.faces.ViewLink=true&amp;invokeTest=true&amp;param1=testValue";
     }
     else if (testName.equals("encodeActionURLNonJSFViewWithModeRenderTest") || testName.equals("encodeActionURLNonJSFViewWithModeResourceTest"))
     {
-      return "/NonFacesViewTestPortlet.ptlt?javax.portlet.faces.ViewLink=true&amp;invokeTest=true&amp;javax.portlet.faces.PortletMode=edit&amp;param1=testValue";
+      return extCtx.getRequestContextPath() + "/NonFacesViewTestPortlet.ptlt?javax.portlet.faces.ViewLink=true&amp;invokeTest=true&amp;javax.portlet.faces.PortletMode=edit&amp;param1=testValue";
     }
     else if (testName.equals("encodeActionURLNonJSFViewWithInvalidModeRenderTest") || testName.equals("encodeActionURLNonJSFViewWithInvalidModeResourceTest"))
     {
-      return "/NonFacesViewTestPortlet.ptlt?javax.portlet.faces.ViewLink=true&amp;invokeTest=true&amp;javax.portlet.faces.PortletMode=blue&amp;param1=testValue";
+      return extCtx.getRequestContextPath() + "/NonFacesViewTestPortlet.ptlt?javax.portlet.faces.ViewLink=true&amp;invokeTest=true&amp;javax.portlet.faces.PortletMode=blue&amp;param1=testValue";
     }
     else if (testName.equals("encodeActionURLNonJSFViewWithWindowStateRenderTest") || testName.equals("encodeActionURLNonJSFViewWithWindowStateResourceTest"))
     {
-      return "/NonFacesViewTestPortlet.ptlt?javax.portlet.faces.ViewLink=true&amp;invokeTest=true&amp;javax.portlet.faces.WindowState=maximized&amp;param1=testValue";
+      return extCtx.getRequestContextPath() + "/NonFacesViewTestPortlet.ptlt?javax.portlet.faces.ViewLink=true&amp;invokeTest=true&amp;javax.portlet.faces.WindowState=maximized&amp;param1=testValue";
     }
     else if (testName.equals("encodeActionURLNonJSFViewWithInvalidWindowStateRenderTest")
|| testName.equals("encodeActionURLNonJSFViewWithInvalidWindowStateResourceTest"))
     {
-      return "/NonFacesViewTestPortlet.ptlt?javax.portlet.faces.ViewLink=true&amp;invokeTest=true&amp;javax.portlet.faces.WindowState=blue&amp;param1=testValue";
+      return extCtx.getRequestContextPath() + "/NonFacesViewTestPortlet.ptlt?javax.portlet.faces.ViewLink=true&amp;invokeTest=true&amp;javax.portlet.faces.WindowState=blue&amp;param1=testValue";
     }
 
     return null;

Modified: myfaces/portlet-bridge/tck/trunk_3.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_3.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/NonFacesViewTestPortlet.java?rev=1139084&r1=1139083&r2=1139084&view=diff
==============================================================================
--- myfaces/portlet-bridge/tck/trunk_3.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/NonFacesViewTestPortlet.java
(original)
+++ myfaces/portlet-bridge/tck/trunk_3.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/NonFacesViewTestPortlet.java
Thu Jun 23 21:47:23 2011
@@ -66,9 +66,9 @@ public class NonFacesViewTestPortlet
     {
       return outputTestResult(false, "_jsfBridgeNonFacesView parameter not (encoded in) nonFaces
request.");
     }
-    else if (!target.equalsIgnoreCase("/NonFacesViewTestPortlet.ptlt"))
+    else if (!target.equalsIgnoreCase(request.getContextPath() + "/NonFacesViewTestPortlet.ptlt"))
     {
-      return outputTestResult(false, "_jsfBridgeNonFacesView parameter (encoded in) nonFaces
request but with unexpected value. Expected: 'NonFacesViewTestPortlet' but received: " +
+      return outputTestResult(false, "_jsfBridgeNonFacesView parameter (encoded in) nonFaces
request but with unexpected value. Expected: " + request.getContextPath() + "/NonFacesViewTestPortlet.ptlt"
+ "but received: " +
                        target);
     }
     

Modified: myfaces/portlet-bridge/tck/trunk_3.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_3.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/Tests.java?rev=1139084&r1=1139083&r2=1139084&view=diff
==============================================================================
--- myfaces/portlet-bridge/tck/trunk_3.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_3.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/Tests.java
Thu Jun 23 21:47:23 2011
@@ -183,18 +183,21 @@ public class Tests
       "/test.jsp?firstParam=value&javax.portlet.faces.DirectLink=true&anotherParam=value";
     FacesContext ctx = FacesContext.getCurrentInstance();
     ExternalContext extCtx = ctx.getExternalContext();
+    ViewHandler vh = ctx.getApplication().getViewHandler();
     PortletRequest r = (PortletRequest) extCtx.getRequest();
     
-    String s = new StringBuffer(DIRECTLINK_TRUE_TEST_STRING.length() + 20)
+    String testString = new StringBuffer(extCtx.getRequestContextPath()).append(DIRECTLINK_TRUE_TEST_STRING).toString();
+    
+    String s = new StringBuffer(testString.length() + 20)
                  .append(r.getScheme())
                  .append("://")
                  .append(r.getServerName())
                  .append(":")
                  .append(r.getServerPort())
-                 .append(DIRECTLINK_TRUE_TEST_STRING)
+                 .append(testString)
                  .toString();
     
-    if (extCtx.encodeActionURL(DIRECTLINK_TRUE_TEST_STRING).equalsIgnoreCase(s))
+    if (extCtx.encodeActionURL(testString).equalsIgnoreCase(s))
     {
       testRunner.setTestResult(true,
                                "encodeActionURL correctly returned an absolute URL representing
the DirectLink url and it correctly contains the javax.portlet.faces.DirectLink parameter
with a value of true.");
@@ -206,7 +209,7 @@ public class Tests
                                "encodeActionURL didn't return an absolute URL representing
the DirectLink url or it didn't contain the javax.portlet.faces.DirectLink parameter with
a value of true.  Expected: " +
                                s +
                                " and encodeActionURL returned: " +
-                               extCtx.encodeActionURL(DIRECTLINK_TRUE_TEST_STRING));
+                               extCtx.encodeActionURL(testString));
       return Constants.TEST_FAILED;
     }
   }
@@ -222,8 +225,11 @@ public class Tests
       "/test.jsp?firstParam=value&javax.portlet.faces.DirectLink=false&anotherParam=value";
     FacesContext ctx = FacesContext.getCurrentInstance();
     ExternalContext extCtx = ctx.getExternalContext();
+    ViewHandler vh = ctx.getApplication().getViewHandler();
+    
+    String testString = new StringBuffer(extCtx.getRequestContextPath()).append(DIRECTLINK_FALSE_TEST_STRING).toString();
     
-    if (!extCtx.encodeActionURL(DIRECTLINK_FALSE_TEST_STRING).contains("javax.portlet.faces.DirectLink"))
+    if (!extCtx.encodeActionURL(testString).contains("javax.portlet.faces.DirectLink"))
     {
       testRunner.setTestResult(true,
                                "encodeActionURL correctly returned an url string without
the javax.portlet.faces.DirectLink parameter when its value was false.");
@@ -233,9 +239,9 @@ public class Tests
     {
       testRunner.setTestResult(false,
                                "encodeActionURL didn't return an url string without the javax.portlet.faces.DirectLink
parameter when its value was false.  Test parameter: " +
-                               DIRECTLINK_FALSE_TEST_STRING +
+                               testString +
                                " and encodeActionURL returned: " +
-                               extCtx.encodeActionURL(DIRECTLINK_FALSE_TEST_STRING));
+                               extCtx.encodeActionURL(testString));
       return Constants.TEST_FAILED;
     }
   }
@@ -795,8 +801,6 @@ public class Tests
       return Constants.TEST_SUCCESS;
     }
   }
-  
-
 
   // Test is MultiRequest -- Render/Action
   // Test #6.103
@@ -1647,6 +1651,8 @@ public class Tests
     final String ENCODE_ACTIONURL_TEST_STRING =
       "/tests/viewLink.jsf";
     
+    String testString = new StringBuffer(extCtx.getRequestContextPath()).append(ENCODE_ACTIONURL_TEST_STRING).toString();
+    
     if (BridgeUtil.getPortletRequestPhase() ==
         Bridge.PortletPhase.RESOURCE_PHASE)
     {
@@ -1659,7 +1665,7 @@ public class Tests
       // 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
       // with the same encoding as compare string.
-      String resourceEncoded = extCtx.encodeActionURL(ENCODE_ACTIONURL_TEST_STRING);
+      String resourceEncoded = extCtx.encodeActionURL(testString);
       String otherPhaseEncoded = (String) s.get("org.apache.myfaces.portlet.faces.tck.encodedURL");
       // remove it for future/other tests
       s.remove("org.apache.myfaces.portlet.faces.tck.encodedURL");
@@ -1681,7 +1687,7 @@ public class Tests
       {
         testRunner.setTestResult(false,
                                  "encodeActionURL incorrectly encoded a JSF View url with
params as an actionURL during a resource request.  In encoding: " +
-                                 ENCODE_ACTIONURL_TEST_STRING +
+                                 testString +
                                  " the bridge returned: " + resourceEncoded +
                                  " but the corresponding portletURL encoding returned: "
+
                                  otherPhaseEncoded);
@@ -1692,7 +1698,7 @@ public class Tests
     // Otherwise -- no output
     if (s.get("org.apache.myfaces.portlet.faces.tck.encodedURL") == null)
     {
-      s.put("org.apache.myfaces.portlet.faces.tck.encodedURL", extCtx.encodeActionURL(ENCODE_ACTIONURL_TEST_STRING));
+      s.put("org.apache.myfaces.portlet.faces.tck.encodedURL", extCtx.encodeActionURL(testString));
     }
     return "";
   }
@@ -1718,6 +1724,11 @@ public class Tests
     final String ENCODE_ACTIONURL_TEST_STRING =
       "/tests/viewLink.jsf?param1=testValue";
     
+    // ensure this url is prefixed by the ContextPath as all encode routines expect this
for things starting with /
+    String testString = new StringBuffer(extCtx.getRequestContextPath()).append(ENCODE_ACTIONURL_TEST_STRING).toString();
+
+
+    
     if (BridgeUtil.getPortletRequestPhase() ==
         Bridge.PortletPhase.RESOURCE_PHASE)
     {
@@ -1730,7 +1741,7 @@ public class Tests
       // 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
       // with the same encoding as compare string.
-      String resourceEncoded = extCtx.encodeActionURL(ENCODE_ACTIONURL_TEST_STRING);
+      String resourceEncoded = extCtx.encodeActionURL(testString);
       String otherPhaseEncoded = (String) s.get("org.apache.myfaces.portlet.faces.tck.encodedURL");
       // remove it for future/other tests
       s.remove("org.apache.myfaces.portlet.faces.tck.encodedURL");
@@ -1752,7 +1763,7 @@ public class Tests
       {
         testRunner.setTestResult(false,
                                  "encodeActionURL incorrectly encoded a JSF View url with
params as an actionURL during a resource request.  In encoding: " +
-                                 ENCODE_ACTIONURL_TEST_STRING +
+                                 testString +
                                  " the bridge returned: " + resourceEncoded +
                                  " but the corresponding portletURL encoding returned: "
+
                                  otherPhaseEncoded);
@@ -1763,7 +1774,7 @@ public class Tests
     // Otherwise -- no output
     if (s.get("org.apache.myfaces.portlet.faces.tck.encodedURL") == null)
     {
-      s.put("org.apache.myfaces.portlet.faces.tck.encodedURL", extCtx.encodeActionURL(ENCODE_ACTIONURL_TEST_STRING));
+      s.put("org.apache.myfaces.portlet.faces.tck.encodedURL", extCtx.encodeActionURL(testString));
     }
     return "";
 
@@ -1790,6 +1801,9 @@ public class Tests
     final String ENCODE_ACTIONURL_TEST_STRING =
       "/tests/viewLink.jsf?javax.portlet.faces.PortletMode=edit&param1=testValue";
     
+    // ensure this url is prefixed by the ContextPath as all encode routines expect this
for things starting with /
+    String testString = new StringBuffer(extCtx.getRequestContextPath()).append(ENCODE_ACTIONURL_TEST_STRING).toString();
   
+    
     if (BridgeUtil.getPortletRequestPhase() ==
         Bridge.PortletPhase.RESOURCE_PHASE)
     {
@@ -1802,7 +1816,7 @@ public class Tests
       // 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
       // with the same encoding as compare string.
-      String resourceEncoded = extCtx.encodeActionURL(ENCODE_ACTIONURL_TEST_STRING);
+      String resourceEncoded = extCtx.encodeActionURL(testString);
       String otherPhaseEncoded = (String) s.get("org.apache.myfaces.portlet.faces.tck.encodedURL");
       // remove it for future/other tests
       s.remove("org.apache.myfaces.portlet.faces.tck.encodedURL");
@@ -1824,7 +1838,7 @@ public class Tests
       {
         testRunner.setTestResult(false,
                                  "encodeActionURL incorrectly encoded a JSF View url with
mode as an actionURL during a resource request.  In encoding: " +
-                                 ENCODE_ACTIONURL_TEST_STRING +
+                                 testString +
                                  " the bridge returned: " + resourceEncoded +
                                  " but the corresponding portletURL encoding returned: "
+
                                  otherPhaseEncoded);
@@ -1835,7 +1849,7 @@ public class Tests
     // Otherwise -- no output
     if (s.get("org.apache.myfaces.portlet.faces.tck.encodedURL") == null)
     {
-      s.put("org.apache.myfaces.portlet.faces.tck.encodedURL", extCtx.encodeActionURL(ENCODE_ACTIONURL_TEST_STRING));
+      s.put("org.apache.myfaces.portlet.faces.tck.encodedURL", extCtx.encodeActionURL(testString));
     }
     return "";
   }
@@ -1861,6 +1875,9 @@ public class Tests
     final String ENCODE_ACTIONURL_TEST_STRING =
       "/tests/viewLink.jsf?javax.portlet.faces.PortletMode=blue&param1=testValue";
     
+    // ensure this url is prefixed by the ContextPath as all encode routines expect this
for things starting with /
+    String testString = new StringBuffer(extCtx.getRequestContextPath()).append(ENCODE_ACTIONURL_TEST_STRING).toString();
+    
     if (BridgeUtil.getPortletRequestPhase() ==
         Bridge.PortletPhase.RESOURCE_PHASE)
     {
@@ -1873,7 +1890,7 @@ public class Tests
       // 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
       // with the same encoding as compare string.
-      String resourceEncoded = extCtx.encodeActionURL(ENCODE_ACTIONURL_TEST_STRING);
+      String resourceEncoded = extCtx.encodeActionURL(testString);
       String otherPhaseEncoded = (String) s.get("org.apache.myfaces.portlet.faces.tck.encodedURL");
       // remove it for future/other tests
       s.remove("org.apache.myfaces.portlet.faces.tck.encodedURL");
@@ -1895,7 +1912,7 @@ public class Tests
       {
         testRunner.setTestResult(false,
                                  "encodeActionURL incorrectly encoded a JSF View url with
invalid mode as an actionURL during a resource request.  In encoding: " +
-                                 ENCODE_ACTIONURL_TEST_STRING +
+                                 testString +
                                  " the bridge returned: " + resourceEncoded +
                                  " but the corresponding portletURL encoding returned: "
+
                                  otherPhaseEncoded);
@@ -1906,7 +1923,7 @@ public class Tests
     // Otherwise -- no output
     if (s.get("org.apache.myfaces.portlet.faces.tck.encodedURL") == null)
     {
-      s.put("org.apache.myfaces.portlet.faces.tck.encodedURL", extCtx.encodeActionURL(ENCODE_ACTIONURL_TEST_STRING));
+      s.put("org.apache.myfaces.portlet.faces.tck.encodedURL", extCtx.encodeActionURL(testString));
     }
     return "";
   }
@@ -1932,6 +1949,9 @@ public class Tests
     final String ENCODE_ACTIONURL_TEST_STRING =
       "/tests/viewLink.jsf?javax.portlet.faces.PortletMode=blue&param1=testValue";
     
+    // ensure this url is prefixed by the ContextPath as all encode routines expect this
for things starting with /
+    String testString = new StringBuffer(extCtx.getRequestContextPath()).append(ENCODE_ACTIONURL_TEST_STRING).toString();
+    
     if (BridgeUtil.getPortletRequestPhase() ==
         Bridge.PortletPhase.RESOURCE_PHASE)
     {
@@ -1944,7 +1964,7 @@ public class Tests
       // 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
       // with the same encoding as compare string.
-      String resourceEncoded = extCtx.encodeActionURL(ENCODE_ACTIONURL_TEST_STRING);
+      String resourceEncoded = extCtx.encodeActionURL(testString);
       String otherPhaseEncoded = (String) s.get("org.apache.myfaces.portlet.faces.tck.encodedURL");
       // remove it for future/other tests
       s.remove("org.apache.myfaces.portlet.faces.tck.encodedURL");
@@ -1966,7 +1986,7 @@ public class Tests
       {
         testRunner.setTestResult(false,
                                  "encodeActionURL incorrectly encoded a JSF View url with
window state as an actionURL during a resource request.  In encoding: " +
-                                 ENCODE_ACTIONURL_TEST_STRING +
+                                 testString +
                                  " the bridge returned: " + resourceEncoded +
                                  " but the corresponding portletURL encoding returned: "
+
                                  otherPhaseEncoded);
@@ -1977,7 +1997,7 @@ public class Tests
     // Otherwise -- no output
     if (s.get("org.apache.myfaces.portlet.faces.tck.encodedURL") == null)
     {
-      s.put("org.apache.myfaces.portlet.faces.tck.encodedURL", extCtx.encodeActionURL(ENCODE_ACTIONURL_TEST_STRING));
+      s.put("org.apache.myfaces.portlet.faces.tck.encodedURL", extCtx.encodeActionURL(testString));
     }
     return "";
   }
@@ -2003,6 +2023,10 @@ public class Tests
     final String ENCODE_ACTIONURL_TEST_STRING =
       "/tests/viewLink.jsf?javax.portlet.faces.PortletMode=blue&param1=testValue";
     
+    // ensure this url is prefixed by the ContextPath as all encode routines expect this
for things starting with /
+    String testString = new StringBuffer(extCtx.getRequestContextPath()).append(ENCODE_ACTIONURL_TEST_STRING).toString();
+    
+    
     if (BridgeUtil.getPortletRequestPhase() ==
         Bridge.PortletPhase.RESOURCE_PHASE)
     {
@@ -2015,7 +2039,7 @@ public class Tests
       // 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
       // with the same encoding as compare string.
-      String resourceEncoded = extCtx.encodeActionURL(ENCODE_ACTIONURL_TEST_STRING);
+      String resourceEncoded = extCtx.encodeActionURL(testString);
       String otherPhaseEncoded = (String) s.get("org.apache.myfaces.portlet.faces.tck.encodedURL");
       // remove it for future/other tests
       s.remove("org.apache.myfaces.portlet.faces.tck.encodedURL");
@@ -2037,7 +2061,7 @@ public class Tests
       {
         testRunner.setTestResult(false,
                                  "encodeActionURL incorrectly encoded a JSF View url with
invalid window state as an actionURL during a resource request.  In encoding: " +
-                                 ENCODE_ACTIONURL_TEST_STRING +
+                                 testString +
                                  " the bridge returned: " + resourceEncoded +
                                  " but the corresponding portletURL encoding returned: "
+
                                  otherPhaseEncoded);
@@ -2048,7 +2072,7 @@ public class Tests
     // Otherwise -- no output
     if (s.get("org.apache.myfaces.portlet.faces.tck.encodedURL") == null)
     {
-      s.put("org.apache.myfaces.portlet.faces.tck.encodedURL", extCtx.encodeActionURL(ENCODE_ACTIONURL_TEST_STRING));
+      s.put("org.apache.myfaces.portlet.faces.tck.encodedURL", extCtx.encodeActionURL(testString));
     }
     return "";
   }
@@ -2074,6 +2098,9 @@ public class Tests
     final String ENCODE_ACTIONURL_TEST_STRING =
       "/tests/viewLink.jsf?javax.portlet.faces.PortletMode=blue&param1=testValue";
     
+    // ensure this url is prefixed by the ContextPath as all encode routines expect this
for things starting with /
+    String testString = new StringBuffer(extCtx.getRequestContextPath()).append(ENCODE_ACTIONURL_TEST_STRING).toString();
+    
     if (BridgeUtil.getPortletRequestPhase() ==
         Bridge.PortletPhase.RESOURCE_PHASE)
     {
@@ -2086,7 +2113,7 @@ public class Tests
       // 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
       // with the same encoding as compare string.
-      String resourceEncoded = extCtx.encodeActionURL(ENCODE_ACTIONURL_TEST_STRING);
+      String resourceEncoded = extCtx.encodeActionURL(testString);
       String otherPhaseEncoded = (String) s.get("org.apache.myfaces.portlet.faces.tck.encodedURL");
       // remove it for future/other tests
       s.remove("org.apache.myfaces.portlet.faces.tck.encodedURL");
@@ -2108,7 +2135,7 @@ public class Tests
       {
         testRunner.setTestResult(false,
                                  "encodeActionURL incorrectly encoded a JSF View url with
security as an actionURL during a resource request.  In encoding: " +
-                                 ENCODE_ACTIONURL_TEST_STRING +
+                                 testString +
                                  " the bridge returned: " + resourceEncoded +
                                  " but the corresponding portletURL encoding returned: "
+
                                  otherPhaseEncoded);
@@ -2119,7 +2146,7 @@ public class Tests
     // Otherwise -- no output
     if (s.get("org.apache.myfaces.portlet.faces.tck.encodedURL") == null)
     {
-      s.put("org.apache.myfaces.portlet.faces.tck.encodedURL", extCtx.encodeActionURL(ENCODE_ACTIONURL_TEST_STRING));
+      s.put("org.apache.myfaces.portlet.faces.tck.encodedURL", extCtx.encodeActionURL(testString));
     }
     return "";
   }
@@ -2145,6 +2172,9 @@ public class Tests
     final String ENCODE_ACTIONURL_TEST_STRING =
       "/tests/viewLink.jsf?javax.portlet.faces.PortletMode=blue&param1=testValue";
     
+    // ensure this url is prefixed by the ContextPath as all encode routines expect this
for things starting with /
+    String testString = new StringBuffer(extCtx.getRequestContextPath()).append(ENCODE_ACTIONURL_TEST_STRING).toString();
+    
     if (BridgeUtil.getPortletRequestPhase() ==
         Bridge.PortletPhase.RESOURCE_PHASE)
     {
@@ -2157,7 +2187,7 @@ public class Tests
       // 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
       // with the same encoding as compare string.
-      String resourceEncoded = extCtx.encodeActionURL(ENCODE_ACTIONURL_TEST_STRING);
+      String resourceEncoded = extCtx.encodeActionURL(testString);
       String otherPhaseEncoded = (String) s.get("org.apache.myfaces.portlet.faces.tck.encodedURL");
       // remove it for future/other tests
       s.remove("org.apache.myfaces.portlet.faces.tck.encodedURL");
@@ -2179,7 +2209,7 @@ public class Tests
       {
         testRunner.setTestResult(false,
                                  "encodeActionURL incorrectly encoded a JSF View url with
invalid security as an actionURL during a resource request.  In encoding: " +
-                                 ENCODE_ACTIONURL_TEST_STRING +
+                                 testString +
                                  " the bridge returned: " + resourceEncoded +
                                  " but the corresponding portletURL encoding returned: "
+
                                  otherPhaseEncoded);
@@ -2190,7 +2220,7 @@ public class Tests
     // Otherwise -- no output
     if (s.get("org.apache.myfaces.portlet.faces.tck.encodedURL") == null)
     {
-      s.put("org.apache.myfaces.portlet.faces.tck.encodedURL", extCtx.encodeActionURL(ENCODE_ACTIONURL_TEST_STRING));
+      s.put("org.apache.myfaces.portlet.faces.tck.encodedURL", extCtx.encodeActionURL(testString));
     }
     return "";
   }
@@ -2391,25 +2421,20 @@ public class Tests
   {
     testRunner.setTestComplete(true);
 
-    final String URL_TEST_STRING = "/resources/myImage.jpg";
+    final String URL_TEST_STRING = "/myportal/resources/myImage.jpg";
     FacesContext ctx = FacesContext.getCurrentInstance();
     ExternalContext extCtx = ctx.getExternalContext();
 
-    if (extCtx.encodeResourceURL(URL_TEST_STRING).equals(((PortletResponse) extCtx.getResponse()).encodeURL(extCtx.getRequestContextPath()
+
-                                                                                        
                   URL_TEST_STRING).replace("&amp;", "&")))
+    if (extCtx.encodeResourceURL(URL_TEST_STRING).equals(((PortletResponse) extCtx.getResponse()).encodeURL(URL_TEST_STRING).replace("&amp;",
"&")))
     {
       testRunner.setTestResult(true,
-                               "encodeResourceURL correctly encoded a resource referenced
by a context path relative path.");
+                               "encodeResourceURL correctly encoded the resource as an external
(App) resource.");
       return Constants.TEST_SUCCESS;
     }
     else
     {
       testRunner.setTestResult(false,
-                               "encodeResourceURL incorrectly encoded a resource referenced
by a context path relative path.  Expected: " +
-                               ((PortletResponse) extCtx.getResponse()).encodeURL(extCtx.getRequestContextPath()
+
-                                                                                  URL_TEST_STRING)
+
-                               " and encodeResourceURL returned: " +
-                               extCtx.encodeResourceURL(URL_TEST_STRING));
+                               "encodeResourceURL incorrectly encoded a resource as if it
were a reference to a resource within this application.");
       return Constants.TEST_FAILED;
     }
   }
@@ -2543,15 +2568,17 @@ public class Tests
       "/resources/myImage.jpg?myBackLinkParam=";
     FacesContext ctx = FacesContext.getCurrentInstance();
     ExternalContext extCtx = ctx.getExternalContext();
+    ViewHandler vh = ctx.getApplication().getViewHandler();
+    
     // compute what the backLink should be
     String actionURL =
-      extCtx.encodeActionURL(ctx.getApplication().getViewHandler().getActionURL(ctx,
-                                                                                ctx.getViewRoot().getViewId()));
+      extCtx.encodeActionURL(vh.getActionURL(ctx, ctx.getViewRoot().getViewId()));
+    String testString = vh.getResourceURL(ctx, URL_BACKLINK_TEST_STRING);       
     String verifyString = null;
     try
     {
       verifyString =
-          extCtx.getRequestContextPath() + URL_BACKLINK_VERIFY_STRING +
+          vh.getResourceURL(ctx, URL_BACKLINK_VERIFY_STRING) +
           HTTPUtils.encode(actionURL, "UTF-8");
     }
     catch (UnsupportedEncodingException e)
@@ -2563,7 +2590,7 @@ public class Tests
 
     // According to bridge rules since string passed in isn't xml strict encoded the result
won't be as well
     // So ensure compares match by stripping from the one generated by the portlet container
(if it exists)
-    if (extCtx.encodeResourceURL(URL_BACKLINK_TEST_STRING).equals(((PortletResponse) extCtx.getResponse()).encodeURL(verifyString).replace("&amp;",
"&")))
+    if (extCtx.encodeResourceURL(testString).equals(((PortletResponse) extCtx.getResponse()).encodeURL(verifyString).replace("&amp;",
"&")))
     {
       testRunner.setTestResult(true,
                                "encodeResourceURL correctly encoded an URL with a backLink.");
@@ -2575,7 +2602,7 @@ public class Tests
                                "encodeResourceURL didn't correctly encoded an URL with a
backLink.  Expected: " +
                                ((PortletResponse) extCtx.getResponse()).encodeURL(verifyString)
+
                                " but encodeResourceURL returned: " +
-                               extCtx.encodeResourceURL(URL_BACKLINK_TEST_STRING));
+                               extCtx.encodeResourceURL(testString));
       return Constants.TEST_FAILED;
     }
   }
@@ -2595,8 +2622,12 @@ public class Tests
 
     FacesContext ctx = FacesContext.getCurrentInstance();
     ExternalContext extCtx = ctx.getExternalContext();
+    ViewHandler vh = ctx.getApplication().getViewHandler();
+    
+    String testString = vh.getResourceURL(ctx, URL_VIEWLINK_TEST_STRING);
+    String verifyString = vh.getResourceURL(ctx, URL_VIEWLINK_VERIFY_STRING);
 
-    if (extCtx.encodeResourceURL(URL_VIEWLINK_TEST_STRING).equals(extCtx.encodeActionURL(URL_VIEWLINK_VERIFY_STRING)))
+    if (extCtx.encodeResourceURL(testString).equals(extCtx.encodeActionURL(verifyString)))
     {
       testRunner.setTestResult(true,
                                "encodeResourceURL correctly encoded a viewLink.");
@@ -2606,9 +2637,9 @@ public class Tests
     {
       testRunner.setTestResult(false,
                                "encodeResourceURL incorrectly encoded a viewLink.  Expected:
" +
-                               extCtx.encodeActionURL(URL_VIEWLINK_VERIFY_STRING) +
+                               extCtx.encodeActionURL(verifyString) +
                                " but encodeResourceURL with the viewLink returned: " +
-                               extCtx.encodeResourceURL(URL_VIEWLINK_TEST_STRING));
+                               extCtx.encodeResourceURL(testString));
       return Constants.TEST_FAILED;
     }
   }
@@ -2626,17 +2657,19 @@ public class Tests
       "/tests/viewLink.jsf?param1=testValue&myBackLinkParam=";
     FacesContext ctx = FacesContext.getCurrentInstance();
     ExternalContext extCtx = ctx.getExternalContext();
+    ViewHandler vh = ctx.getApplication().getViewHandler();
 
     // compute what the backLink should be
     String actionURL =
       extCtx.encodeActionURL(ctx.getApplication().getViewHandler().getActionURL(ctx,
                                                                                 ctx.getViewRoot().getViewId()));
+    String testString = vh.getResourceURL(ctx, URL_VIEWLINK_BACKLINK_TEST_STRING);      

     String verifyString = null;
     try
     {
       verifyString =
-          URL_VIEWLINK_BACKLINK_VERIFY_STRING + HTTPUtils.encode(actionURL,
-                                                                  "UTF-8");
+          vh.getResourceURL(ctx, URL_VIEWLINK_BACKLINK_VERIFY_STRING + HTTPUtils.encode(actionURL,
+                                                                  "UTF-8"));
     }
     catch (UnsupportedEncodingException e)
     {
@@ -2645,7 +2678,7 @@ public class Tests
       return Constants.TEST_FAILED;
     }
     // Note:  as we are adding a URL as a parameter make sure its properly URLEncoded --
this causes it to be doubly encoded
-    if (extCtx.encodeResourceURL(URL_VIEWLINK_BACKLINK_TEST_STRING).equals(extCtx.encodeActionURL(verifyString)))
+    if (extCtx.encodeResourceURL(testString).equals(extCtx.encodeActionURL(verifyString)))
     {
       testRunner.setTestResult(true,
                                "encodeResourceURL correctly encoded a viewLink with a BackLink.");
@@ -2657,7 +2690,7 @@ public class Tests
                                "encodeResourceURL incorrectly encoded a viewLink.  Expected:
" +
                                extCtx.encodeActionURL(verifyString) +
                                " but encodeResourceURL with the viewLink returned: " +
-                               extCtx.encodeResourceURL(URL_VIEWLINK_BACKLINK_TEST_STRING));
+                               extCtx.encodeResourceURL(testString));
       return Constants.TEST_FAILED;
     }
   }
@@ -5859,6 +5892,7 @@ public class Tests
   {
     FacesContext ctx = FacesContext.getCurrentInstance();
     ExternalContext extCtx = ctx.getExternalContext();
+    
 
     if (BridgeUtil.getPortletRequestPhase() ==
         Bridge.PortletPhase.ACTION_PHASE)
@@ -6033,8 +6067,7 @@ public class Tests
   {
     FacesContext ctx = FacesContext.getCurrentInstance();
     ExternalContext extCtx = ctx.getExternalContext();
-
-    if (BridgeUtil.getPortletRequestPhase() ==
+        if (BridgeUtil.getPortletRequestPhase() ==
         Bridge.PortletPhase.ACTION_PHASE)
     {
       /* Test works as follows:
@@ -6218,7 +6251,7 @@ public class Tests
     {
       try
       {
-        extCtx.redirect("/tests/NonJSFView.portlet");
+        extCtx.redirect(ctx.getApplication().getViewHandler().getResourceURL(ctx, "/tests/NonJSFView.portlet"));
       }
       catch (IllegalStateException i)
       {
@@ -6257,42 +6290,44 @@ public class Tests
     ExternalContext extCtx = ctx.getExternalContext();
 
     // test encodeActionURL preserves the xml escape encoding in the url it returns
-    if (isStrictXhtmlEncoded(extCtx.encodeActionURL("/tests/SingleRequestTest.jsf?parm1=a&param2=b")))
+    if (isStrictXhtmlEncoded(extCtx.encodeActionURL(extCtx.getRequestContextPath() + "/tests/SingleRequestTest.jsf?parm1=a&param2=b")))
     {
       testRunner.setTestResult(false,
                                "EncodeActionURL incorrectly returned an url including xml
escaping when the input url wasn't escaped.");
       return Constants.TEST_FAILED;
     }
     
-    if (!isStrictXhtmlEncoded(extCtx.encodeActionURL("/tests/SingleRequestTest.jsf?parm1=a&amp;param2=b")))
+    if (!isStrictXhtmlEncoded(extCtx.encodeActionURL(extCtx.getRequestContextPath() + "/tests/SingleRequestTest.jsf?parm1=a&amp;param2=b")))
     {
       testRunner.setTestResult(false,
                                "EncodeActionURL incorrectly returned an url without xml escaping
when the input url was escaped.");
       return Constants.TEST_FAILED;
     }
     
-    if (isStrictXhtmlEncoded(extCtx.encodeActionURL("/tests/SingleRequestTest.jsf")))
+    if (isStrictXhtmlEncoded(extCtx.encodeActionURL(extCtx.getRequestContextPath() + "/tests/SingleRequestTest.jsf")))
     {
       testRunner.setTestResult(false,
                                "EncodeActionURL incorrectly returned an url including xml
escaping when the input url contained no indication (no query string).");
       return Constants.TEST_FAILED;
     }
     
-    if (isStrictXhtmlEncoded(extCtx.encodeResourceURL("/tests/SingleRequestTest.jsf?parm1=a&param2=b")))
+    ViewHandler vh = ctx.getApplication().getViewHandler();
+    
+    if (isStrictXhtmlEncoded(extCtx.encodeResourceURL(vh.getResourceURL(ctx, "/tests/SingleRequestTest.jsf?parm1=a&param2=b"))))
     {
       testRunner.setTestResult(false,
                                "EncodeResourceURL incorrectly returned an url including xml
escaping when the input url wasn't escaped.");
       return Constants.TEST_FAILED;
     }
     
-    if (!isStrictXhtmlEncoded(extCtx.encodeResourceURL("/tests/SingleRequestTest.jsf?parm1=a&amp;param2=b")))
+    if (!isStrictXhtmlEncoded(extCtx.encodeResourceURL(vh.getResourceURL(ctx, "/tests/SingleRequestTest.jsf?parm1=a&amp;param2=b"))))
     {
       testRunner.setTestResult(false,
                                "EncodeResourceURL incorrectly returned an url without xml
escaping when the input url was escaped.");
       return Constants.TEST_FAILED;
     }
-    
-    if (isStrictXhtmlEncoded(extCtx.encodeResourceURL("/tests/SingleRequestTest.jsf")))
+  
+    if (isStrictXhtmlEncoded(extCtx.encodeResourceURL(vh.getResourceURL(ctx, "/tests/SingleRequestTest.jsf"))))
 
     {
       testRunner.setTestResult(false,
                                "EncodeResourceURL incorrectly returned an url including xml
escaping when the input url contained no indication (no query string).");



Mime
View raw message