myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfreed...@apache.org
Subject svn commit: r1225665 - in /myfaces/portlet-bridge/tck/branches/2.0.0-branch: portlet-bridge-tck-main/src/main/webapp/WEB-INF/portlet.xml src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/Tests.java
Date Thu, 29 Dec 2011 21:45:58 GMT
Author: mfreedman
Date: Thu Dec 29 21:45:58 2011
New Revision: 1225665

URL: http://svn.apache.org/viewvc?rev=1225665&view=rev
Log:
Added 2 tests to verify that encodeActionURL of a nonFaces target returns the properly encoded
URL in both the default/standard case and the new configuration that asks it to encode the
URL as a portlet resource.  

Modified:
    myfaces/portlet-bridge/tck/branches/2.0.0-branch/portlet-bridge-tck-main/src/main/webapp/WEB-INF/portlet.xml
    myfaces/portlet-bridge/tck/branches/2.0.0-branch/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/Tests.java

Modified: myfaces/portlet-bridge/tck/branches/2.0.0-branch/portlet-bridge-tck-main/src/main/webapp/WEB-INF/portlet.xml
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/tck/branches/2.0.0-branch/portlet-bridge-tck-main/src/main/webapp/WEB-INF/portlet.xml?rev=1225665&r1=1225664&r2=1225665&view=diff
==============================================================================
--- myfaces/portlet-bridge/tck/branches/2.0.0-branch/portlet-bridge-tck-main/src/main/webapp/WEB-INF/portlet.xml
(original)
+++ myfaces/portlet-bridge/tck/branches/2.0.0-branch/portlet-bridge-tck-main/src/main/webapp/WEB-INF/portlet.xml
Thu Dec 29 21:45:58 2011
@@ -1965,6 +1965,49 @@
     </portlet>
     
     <portlet>
+        <portlet-name>chapter6_1_3_1Tests-encodeActionURLNonFacesURLTest-portlet</portlet-name>
+        <portlet-class>org.apache.myfaces.portlet.faces.testsuite.common.portlet.GenericFacesTestSuitePortlet</portlet-class>
+        
+        <init-param>
+          <name>javax.portlet.faces.defaultViewId.view</name>
+          <value>/tests/SingleRequestTest.jsp</value>
+        </init-param>
+
+        <expiration-cache>0</expiration-cache>
+        
+       <supports>
+         <mime-type>text/html</mime-type>
+       </supports>
+        <portlet-info>
+                <title>chapter6_1_3_1Tests-encodeActionURLNonFacesURLTest-portlet</title>
+        </portlet-info>
+    </portlet>
+    
+    <portlet>
+        <portlet-name>chapter6_1_3_1Tests-encodeActionURLNonFacesURLAsResourceTest-portlet</portlet-name>
+        <portlet-class>org.apache.myfaces.portlet.faces.testsuite.common.portlet.GenericFacesTestSuitePortlet</portlet-class>
+        
+        <init-param>
+          <name>javax.portlet.faces.defaultViewId.view</name>
+          <value>/tests/SingleRequestTest.jsp</value>
+        </init-param>
+        
+        <init-param>
+          <name>org.apache.myfaces.portlet.faces.encodeNonFacesActionAsResource</name>
+          <value>true</value>
+        </init-param>
+
+        <expiration-cache>0</expiration-cache>
+        
+       <supports>
+         <mime-type>text/html</mime-type>
+       </supports>
+        <portlet-info>
+                <title>chapter6_1_3_1Tests-encodeActionURLNonFacesURLAsResourceTest-portlet</title>
+        </portlet-info>
+    </portlet>
+    
+    <portlet>
         <portlet-name>chapter6_1_3_1Tests-encodeActionURLAbsoluteURLTest-portlet</portlet-name>
         <portlet-class>org.apache.myfaces.portlet.faces.testsuite.common.portlet.GenericFacesTestSuitePortlet</portlet-class>
         

Modified: myfaces/portlet-bridge/tck/branches/2.0.0-branch/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/branches/2.0.0-branch/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/Tests.java?rev=1225665&r1=1225664&r2=1225665&view=diff
==============================================================================
--- myfaces/portlet-bridge/tck/branches/2.0.0-branch/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/Tests.java
(original)
+++ myfaces/portlet-bridge/tck/branches/2.0.0-branch/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/Tests.java
Thu Dec 29 21:45:58 2011
@@ -145,6 +145,72 @@ public class Tests
   }
 
   // Test is SingleRequest -- Render only
+
+
+  @BridgeTest(test = "encodeActionURLNonFacesURLTest")
+  public String encodeActionURLNonFacesURLTest(TestRunnerBean testRunner)
+  {
+    testRunner.setTestComplete(true);
+
+    final String NONFACES_URL_STRING = "/portletView/view.plt";
+    FacesContext ctx = FacesContext.getCurrentInstance();
+    ExternalContext extCtx = ctx.getExternalContext();
+    RenderResponse res = (RenderResponse) extCtx.getResponse();
+    
+    PortletURL pUrl = res.createRenderURL();
+    pUrl.setParameter(Bridge.NONFACES_TARGET_PATH_PARAMETER, NONFACES_URL_STRING);
+    String testString = pUrl.toString();
+
+    if (extCtx.encodeActionURL(NONFACES_URL_STRING).equals(testString))
+    {
+      testRunner.setTestResult(true, 
+                               "encodeActionURL correctly encoded a NonFaces target as a
portlet renderURL: " + testString);
+      return Constants.TEST_SUCCESS;
+    }
+    else
+    {
+      testRunner.setTestResult(false, 
+                               "encodeActionURL didn't properly encoded a NonFaces target
as a portlet renderURL.  Expected: " +
+                               testString +
+                               " and encodeActionURL returned: " + 
+                               extCtx.encodeActionURL(NONFACES_URL_STRING));
+      return Constants.TEST_FAILED;
+    }
+  }
+
+  // Test is SingleRequest -- Render only
+
+
+  @BridgeTest(test = "encodeActionURLNonFacesURLAsResourceTest")
+  public String encodeActionURLNonFacesURLAsResourceTest(TestRunnerBean testRunner)
+  {
+    testRunner.setTestComplete(true);
+
+    final String NONFACES_URL_STRING = "/portletView/view.plt";
+    FacesContext ctx = FacesContext.getCurrentInstance();
+    ExternalContext extCtx = ctx.getExternalContext();
+    RenderResponse res = (RenderResponse) extCtx.getResponse();
+
+    String testString = new StringBuffer(extCtx.getRequestContextPath()).append(res.encodeURL(NONFACES_URL_STRING)).toString();
+
+    if (extCtx.encodeActionURL(NONFACES_URL_STRING).equals(testString))
+    {
+      testRunner.setTestResult(true, 
+                               "encodeActionURL correctly encoded a NonFaces target as a
resource: " + testString);
+      return Constants.TEST_SUCCESS;
+    }
+    else
+    {
+      testRunner.setTestResult(false, 
+                               "encodeActionURL didn't properly encoded a NonFaces target
as a resource.  Expected: " + 
+                               testString + 
+                               " and encodeActionURL returned: " + 
+                               extCtx.encodeActionURL(NONFACES_URL_STRING));
+      return Constants.TEST_FAILED;
+    }
+  }
+
+  // Test is SingleRequest -- Render only
   // Test #6.5
   @BridgeTest(test = "encodeActionURLAbsoluteURLTest")
   public String encodeActionURLAbsoluteURLTest(TestRunnerBean testRunner)



Mime
View raw message