myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfreed...@apache.org
Subject svn commit: r1139023 - in /myfaces/portlet-bridge/tck/trunk_2.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 18:02:08 GMT
Author: mfreedman
Date: Thu Jun 23 18:02:08 2011
New Revision: 1139023

URL: http://svn.apache.org/viewvc?rev=1139023&view=rev
Log:
Updated test (that were) using /tests/zzz.yyy pathing to use full context path form when refering
to internal (within app) entity -- as fix for PORTLETBRIDGE-215 forced the change.

Modified:
    myfaces/portlet-bridge/tck/trunk_2.0.x/pom.xml
    myfaces/portlet-bridge/tck/trunk_2.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/beans/NonJSFViewBean.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/NonFacesViewTestPortlet.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/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/tck/trunk_2.0.x/pom.xml?rev=1139023&r1=1139022&r2=1139023&view=diff
==============================================================================
--- myfaces/portlet-bridge/tck/trunk_2.0.x/pom.xml (original)
+++ myfaces/portlet-bridge/tck/trunk_2.0.x/pom.xml Thu Jun 23 18:02:08 2011
@@ -30,7 +30,7 @@
     <jsp.version>2.1</jsp.version>
     
     <!-- Bridge Configurations -->
-    <portlet-bridge.version>2.0.0</portlet-bridge.version>
+    <portlet-bridge.version>2.0.1-SNAPSHOT</portlet-bridge.version>
     <portlet-bridge.groupId>${project.groupId}</portlet-bridge.groupId>
 
     <portlet-bridge.api.groupId>${portlet-bridge.groupId}</portlet-bridge.api.groupId>

Modified: myfaces/portlet-bridge/tck/trunk_2.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_2.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/beans/NonJSFViewBean.java?rev=1139023&r1=1139022&r2=1139023&view=diff
==============================================================================
--- myfaces/portlet-bridge/tck/trunk_2.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/beans/NonJSFViewBean.java
(original)
+++ myfaces/portlet-bridge/tck/trunk_2.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/beans/NonJSFViewBean.java
Thu Jun 23 18:02:08 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_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=1139023&r1=1139022&r2=1139023&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/NonFacesViewTestPortlet.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/NonFacesViewTestPortlet.java
Thu Jun 23 18:02:08 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_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=1139023&r1=1139022&r2=1139023&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 Jun 23 18:02:08 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;
     }
   }
@@ -792,8 +798,6 @@ public class Tests
       return Constants.TEST_SUCCESS;
     }
   }
-  
-
 
   // Test is MultiRequest -- Render/Action
   // Test #6.103
@@ -1644,6 +1648,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)
     {
@@ -1656,7 +1662,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");
@@ -1678,7 +1684,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);
@@ -1689,7 +1695,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 "";
   }
@@ -1715,6 +1721,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)
     {
@@ -1727,7 +1738,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");
@@ -1749,7 +1760,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);
@@ -1760,7 +1771,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 "";
 
@@ -1787,6 +1798,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)
     {
@@ -1799,7 +1813,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");
@@ -1821,7 +1835,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);
@@ -1832,7 +1846,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 "";
   }
@@ -1858,6 +1872,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)
     {
@@ -1870,7 +1887,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");
@@ -1892,7 +1909,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);
@@ -1903,7 +1920,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 "";
   }
@@ -1929,6 +1946,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)
     {
@@ -1941,7 +1961,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");
@@ -1963,7 +1983,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);
@@ -1974,7 +1994,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 "";
   }
@@ -2000,6 +2020,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)
     {
@@ -2012,7 +2036,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");
@@ -2034,7 +2058,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);
@@ -2045,7 +2069,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 "";
   }
@@ -2071,6 +2095,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)
     {
@@ -2083,7 +2110,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");
@@ -2105,7 +2132,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);
@@ -2116,7 +2143,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 "";
   }
@@ -2142,6 +2169,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)
     {
@@ -2154,7 +2184,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");
@@ -2176,7 +2206,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);
@@ -2187,7 +2217,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 "";
   }
@@ -2388,25 +2418,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;
     }
   }
@@ -2540,15 +2565,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)
@@ -2560,7 +2587,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.");
@@ -2572,7 +2599,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;
     }
   }
@@ -2592,8 +2619,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.");
@@ -2603,9 +2634,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;
     }
   }
@@ -2623,17 +2654,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)
     {
@@ -2642,7 +2675,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.");
@@ -2654,7 +2687,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;
     }
   }
@@ -5856,6 +5889,7 @@ public class Tests
   {
     FacesContext ctx = FacesContext.getCurrentInstance();
     ExternalContext extCtx = ctx.getExternalContext();
+    
 
     if (BridgeUtil.getPortletRequestPhase() ==
         Bridge.PortletPhase.ACTION_PHASE)
@@ -6030,8 +6064,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:
@@ -6215,7 +6248,7 @@ public class Tests
     {
       try
       {
-        extCtx.redirect("/tests/NonJSFView.portlet");
+        extCtx.redirect(ctx.getApplication().getViewHandler().getResourceURL(ctx, "/tests/NonJSFView.portlet"));
       }
       catch (IllegalStateException i)
       {
@@ -6254,42 +6287,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