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 2009/12/15 23:31:08 UTC
svn commit: r891042 - in /myfaces/portlet-bridge/testsuite/trunk/src/main:
java/org/apache/myfaces/portlet/faces/testsuite/common/portlet/
java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_4/
java/org/apache/myfaces/portlet/faces/testsuite/...
Author: mfreedman
Date: Tue Dec 15 22:31:07 2009
New Revision: 891042
URL: http://svn.apache.org/viewvc?rev=891042&view=rev
Log:
Added Chapter 4 tests.
Added:
myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_4/
myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_4/BridgeClassDefaultTestPortlet.java
myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_4/section_4_2_5/
myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_4/section_4_2_5/RequestProcessingNonFacesTestPortlet.java
myfaces/portlet-bridge/testsuite/trunk/src/main/webapp/tests/chapter4_2_5Result.jsp
Modified:
myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/portlet/GenericFacesTestSuitePortlet.java
myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_2/Tests.java
myfaces/portlet-bridge/testsuite/trunk/src/main/webapp/WEB-INF/faces-config.xml
myfaces/portlet-bridge/testsuite/trunk/src/main/webapp/WEB-INF/portlet.xml
Modified: myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/portlet/GenericFacesTestSuitePortlet.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/portlet/GenericFacesTestSuitePortlet.java?rev=891042&r1=891041&r2=891042&view=diff
==============================================================================
--- myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/portlet/GenericFacesTestSuitePortlet.java (original)
+++ myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/portlet/GenericFacesTestSuitePortlet.java Tue Dec 15 22:31:07 2009
@@ -76,7 +76,12 @@
initTestRequest(renderRequest);
super.doDispatch(renderRequest, renderResponse);
}
-
+
+ public String getTestName()
+ {
+ return mTestName;
+ }
+
private void initTestRequest(PortletRequest portletRequest)
{
portletRequest.setAttribute(Constants.TEST_BEAN_NAME, mTestBeanName);
Added: myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_4/BridgeClassDefaultTestPortlet.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_4/BridgeClassDefaultTestPortlet.java?rev=891042&view=auto
==============================================================================
--- myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_4/BridgeClassDefaultTestPortlet.java (added)
+++ myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_4/BridgeClassDefaultTestPortlet.java Tue Dec 15 22:31:07 2009
@@ -0,0 +1,66 @@
+/* Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.myfaces.portlet.faces.testsuite.tests.chapter_4;
+
+import javax.portlet.faces.GenericFacesPortlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import org.apache.myfaces.portlet.faces.testsuite.common.util.BridgeTCKResultWriter;
+
+
+/**
+ * Checks that a bridge implementation class name has been picked up from
+ * either:
+ * - A portlet context attribute, javax.portlet.faces.BridgeClassName
+ * - the resource META-INF/services/javax.portlet.faces.Bridge (default)
+ * bridge implementation jar.
+ */
+
+public class BridgeClassDefaultTestPortlet extends GenericFacesPortlet
+{
+ public static String TEST_NAME="bridgeClassDefaultTest";
+
+ public void render(RenderRequest request, RenderResponse response)
+ throws PortletException, IOException
+ {
+ String className = getBridgeClassName();
+ boolean pass = className != null && !(className.length() <= 0);
+ response.setContentType("text/html");
+ PrintWriter out = response.getWriter();
+ BridgeTCKResultWriter resultWriter = new BridgeTCKResultWriter(TEST_NAME);
+
+ if (pass)
+ {
+ resultWriter.setStatus(BridgeTCKResultWriter.PASS);
+ resultWriter.setDetail("Bridge class name is " + className);
+ }
+ else
+ {
+ resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
+ resultWriter.setDetail("No bridge class name found.");
+ }
+
+ out.println(resultWriter.toString());
+ }
+}
Added: myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_4/section_4_2_5/RequestProcessingNonFacesTestPortlet.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_4/section_4_2_5/RequestProcessingNonFacesTestPortlet.java?rev=891042&view=auto
==============================================================================
--- myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_4/section_4_2_5/RequestProcessingNonFacesTestPortlet.java (added)
+++ myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_4/section_4_2_5/RequestProcessingNonFacesTestPortlet.java Tue Dec 15 22:31:07 2009
@@ -0,0 +1,62 @@
+/* Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.myfaces.portlet.faces.testsuite.tests.chapter_4.section_4_2_5;
+
+import org.apache.myfaces.portlet.faces.testsuite.common.portlet.GenericFacesTestSuitePortlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletContext;
+import java.io.PrintWriter;
+import java.util.List;
+import java.util.Map;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.UnsupportedEncodingException;
+
+import org.apache.myfaces.portlet.faces.testsuite.common.util.BridgeTCKResultWriter;
+
+/**
+ * Non Faces request processing, section 4.2.5.
+ * Confirms that for a non Faces request, the response contentType is set, if
+ * not already set, using the preferred contentType expressed by the portlet container.
+ */
+
+public class RequestProcessingNonFacesTestPortlet extends GenericFacesTestSuitePortlet
+{
+ public void render(RenderRequest request, RenderResponse response)
+ throws PortletException, IOException
+ {
+ if ((response.getContentType() == null)
+ && (request.getParameter("_jsfBridgeNonFacesView") != null))
+ {
+ // Set an attribute to be read by the associated jsp view. The test
+ // is considered to have passed if the response content type is the
+ // same as the request content type.
+ request.setAttribute("org.apache.myfaces.portlet.faces.testsuite.4_2_5_nonFacesTest", "1");
+ }
+ super.render(request, response);
+ }
+}
Modified: myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_2/Tests.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_2/Tests.java?rev=891042&r1=891041&r2=891042&view=diff
==============================================================================
--- myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_2/Tests.java (original)
+++ myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_2/Tests.java Tue Dec 15 22:31:07 2009
@@ -29,6 +29,8 @@
import java.net.URLDecoder;
import java.net.URLEncoder;
+import java.security.Principal;
+
import java.util.Arrays;
import java.util.Enumeration;
import java.util.Iterator;
@@ -1001,6 +1003,41 @@
}
}
+
+ @BridgeTest(test = "getUserPrincipalTest")
+ public String getUserPrincipalTest(TestRunnerBean testRunner)
+ {
+ testRunner.setTestComplete(true);
+
+ FacesContext ctx = FacesContext.getCurrentInstance();
+ ExternalContext extCtx = ctx.getExternalContext();
+
+
+ PortletRequest request = (PortletRequest) extCtx.getRequest();
+
+ Principal extCtxUP = extCtx.getUserPrincipal();
+ Principal requestUP = request.getUserPrincipal();
+
+ if ((extCtxUP == null && requestUP == null) ||
+ (extCtxUP != null && requestUP != null && extCtxUP.equals(requestUP)))
+ {
+ testRunner.setTestResult(true,
+ "extCtx.getUserPrinicpal() correctly returned the same Principal as is in the underlying portlet request.");
+
+ return Constants.TEST_SUCCESS;
+ }
+ else
+ {
+ testRunner.setTestResult(false,
+ "extCtx.getUserPrinicpal() unexpectedly returned a different Principal than is in the underlying portlet request.");
+
+ return Constants.TEST_FAILED;
+ }
+ }
+
+// @BridgeTest(test = "isUserInRoleTest") -- Not testable
+// @BridgeTest(test = "logTest") -- Not testable
+
}
Modified: myfaces/portlet-bridge/testsuite/trunk/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/testsuite/trunk/src/main/webapp/WEB-INF/faces-config.xml?rev=891042&r1=891041&r2=891042&view=diff
==============================================================================
--- myfaces/portlet-bridge/testsuite/trunk/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/portlet-bridge/testsuite/trunk/src/main/webapp/WEB-INF/faces-config.xml Tue Dec 15 22:31:07 2009
@@ -21,6 +21,10 @@
<from-outcome>multiRequestTest</from-outcome>
<to-view-id>/tests/MultiRequestTestResultRenderCheck.jsp</to-view-id>
</navigation-case>
+ <navigation-case>
+ <from-outcome>requestProcessingNonFacesTest</from-outcome>
+ <to-view-id>/tests/MultiRequestTestResultRenderCheck.jsp?_jsfBridgeNonFacesView=/tests/chapter4_2_5Result.jsp</to-view-id>
+ </navigation-case>
</navigation-rule>
<!-- Chapter 6 Tests -->
<navigation-rule>
@@ -163,7 +167,11 @@
</navigation-case>
</navigation-rule>
-
+ <managed-bean>
+ <managed-bean-name>chapter4_2_5Tests</managed-bean-name>
+ <managed-bean-class>org.apache.myfaces.portlet.faces.testsuite.tests.chapter_4.section_4_2_5.Tests</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
<managed-bean>
<managed-bean-name>chapter6_1_1Tests</managed-bean-name>
<managed-bean-class>org.apache.myfaces.portlet.faces.testsuite.tests.chapter_6.section_6_1_1.Tests</managed-bean-class>
Modified: myfaces/portlet-bridge/testsuite/trunk/src/main/webapp/WEB-INF/portlet.xml
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/testsuite/trunk/src/main/webapp/WEB-INF/portlet.xml?rev=891042&r1=891041&r2=891042&view=diff
==============================================================================
--- myfaces/portlet-bridge/testsuite/trunk/src/main/webapp/WEB-INF/portlet.xml (original)
+++ myfaces/portlet-bridge/testsuite/trunk/src/main/webapp/WEB-INF/portlet.xml Tue Dec 15 22:31:07 2009
@@ -43,6 +43,256 @@
<!-- *************************************************************** -->
<!-- * * -->
+ <!-- * Tests: Chapter 4 * -->
+ <!-- * * -->
+ <!-- *************************************************************** -->
+ <!--<portlet>
+ <portlet-name>chapter4Tests-bridgeClassDefaultTest-portlet</portlet-name>
+ <portlet-class>org.apache.myfaces.portlet.faces.testsuite.tests.chapter_4.BridgeClassDefaultTestPortlet</portlet-class>
+ <expiration-cache>0</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>chapter4Tests-bridgeClassDefaultTest-portlet</title>
+ </portlet-info>
+ </portlet>-->
+
+ <portlet>
+ <portlet-name>chapter4_2_1Tests-initMethodTest-portlet</portlet-name>
+ <portlet-class>org.apache.myfaces.portlet.faces.testsuite.tests.chapter_4.section_4_2_1.InitMethodTestPortlet</portlet-class>
+ <init-param>
+ <name>javax.portlet.faces.defaultViewId.view</name>
+ <value>/tests/MultiRequestTest.jsp</value>
+ </init-param>
+ <init-param>
+ <name>javax.portlet.faces.defaultViewId.edit</name>
+ <value>/tests/MultiRequestTest.jsp</value>
+ </init-param>
+ <init-param>
+ <name>javax.portlet.faces.defaultViewId.help</name>
+ <value>/tests/MultiRequestTest.jsp</value>
+ </init-param>
+ <init-param>
+ <name>javax.portlet.faces.excludedRequestAttributes</name>
+ <value>exclude1,exclude2</value>
+ </init-param>
+ <init-param>
+ <name>javax.portlet.faces.preserveActionParams</name>
+ <value>true</value>
+ </init-param>
+ <expiration-cache>0</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>chapter4_2_1Tests-initMethodTest-portlet</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>chapter4_2_5Tests-requestProcessingNonFacesTest-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/MultiRequestTest.jsp</value>
+ </init-param>
+ <expiration-cache>0</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>chapter4_2_5Tests-requestProcessingNonFacesTest-portlet</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>chapter4_2_6Tests-getBridgeClassNameMethodTest-portlet</portlet-name>
+ <portlet-class>org.apache.myfaces.portlet.faces.testsuite.tests.chapter_4.section_4_2_6.GetBridgeClassNameMethodTestPortlet</portlet-class>
+ <expiration-cache>0</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>chapter4_2_6Tests-getBridgeClassNameMethodTest-portlet</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>chapter4_2_7Tests-getDefaultViewIdMapMethodTest-portlet</portlet-name>
+ <portlet-class>org.apache.myfaces.portlet.faces.testsuite.tests.chapter_4.section_4_2_7.GetDefaultViewIdMapMethodTestPortlet</portlet-class>
+ <init-param>
+ <name>javax.portlet.faces.defaultViewId.view</name>
+ <value>/tests/MultiRequestTest.jsp</value>
+ </init-param>
+ <init-param>
+ <name>javax.portlet.faces.defaultViewId.edit</name>
+ <value>/tests/MultiRequestTest.jsp</value>
+ </init-param>
+ <init-param>
+ <name>javax.portlet.faces.defaultViewId.help</name>
+ <value>/tests/MultiRequestTest.jsp</value>
+ </init-param>
+ <expiration-cache>0</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>chapter4_2_7Tests-getDefaultViewIdMapMethodTest-portlet</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>chapter4_2_8Tests-getExcludedRequestAttributesMethodSetListTest-portlet</portlet-name>
+ <portlet-class>org.apache.myfaces.portlet.faces.testsuite.tests.chapter_4.section_4_2_8.GetExcludedRequestAttributesMethodTestPortlet</portlet-class>
+ <init-param>
+ <name>javax.portlet.faces.excludedRequestAttributes</name>
+ <value>excludeListValue1,excludeListValue2</value>
+ </init-param>
+ <expiration-cache>0</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>chapter4_2_8Tests-getExcludedRequestAttributesMethodSetListTest-portlet</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>chapter4_2_8Tests-getExcludedRequestAttributesMethodSetSingleValueTest-portlet</portlet-name>
+ <portlet-class>org.apache.myfaces.portlet.faces.testsuite.tests.chapter_4.section_4_2_8.GetExcludedRequestAttributesMethodTestPortlet</portlet-class>
+ <init-param>
+ <name>javax.portlet.faces.excludedRequestAttributes</name>
+ <value>excludeSingleValue</value>
+ </init-param>
+ <expiration-cache>0</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>chapter4_2_8Tests-getExcludedRequestAttributesMethodSetSingleValueTest-portlet</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>chapter4_2_8Tests-getExcludedRequestAttributesMethodNotSetTest-portlet</portlet-name>
+ <portlet-class>org.apache.myfaces.portlet.faces.testsuite.tests.chapter_4.section_4_2_8.GetExcludedRequestAttributesMethodTestPortlet</portlet-class>
+ <expiration-cache>0</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>chapter4_2_8Tests-getExcludedRequestAttributesMethodNotSetTest-portlet</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>chapter4_2_9Tests-isPreserveActionParametersMethodSetTrueTest-portlet</portlet-name>
+ <portlet-class>org.apache.myfaces.portlet.faces.testsuite.tests.chapter_4.section_4_2_9.IsPreserveActionParametersMethodTestPortlet</portlet-class>
+ <init-param>
+ <name>javax.portlet.faces.preserveActionParams</name>
+ <value>true</value>
+ </init-param>
+ <expiration-cache>0</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>chapter4_2_9Tests-isPreserveActionParametersMethodSetTrueTest-portlet</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>chapter4_2_9Tests-isPreserveActionParametersMethodSetFalseTest-portlet</portlet-name>
+ <portlet-class>org.apache.myfaces.portlet.faces.testsuite.tests.chapter_4.section_4_2_9.IsPreserveActionParametersMethodTestPortlet</portlet-class>
+ <init-param>
+ <name>javax.portlet.faces.preserveActionParams</name>
+ <value>false</value>
+ </init-param>
+ <expiration-cache>0</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>chapter4_2_9Tests-isPreserveActionParametersMethodSetFalseTest-portlet</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>chapter4_2_9Tests-isPreserveActionParametersMethodNotSetTest-portlet</portlet-name>
+ <portlet-class>org.apache.myfaces.portlet.faces.testsuite.tests.chapter_4.section_4_2_9.IsPreserveActionParametersMethodTestPortlet</portlet-class>
+ <expiration-cache>0</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>chapter4_2_9Tests-isPreserveActionParametersMethodNotSetTest-portlet</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>chapter4_2_10Tests-getResponseContentTypeMethodSetTest-portlet</portlet-name>
+ <portlet-class>org.apache.myfaces.portlet.faces.testsuite.tests.chapter_4.section_4_2_10.GetResponseContentTypeMethodTestPortlet</portlet-class>
+ <init-param>
+ <name>javax.portlet.faces.defaultContentType</name>
+ <value>text/xml</value>
+ </init-param>
+ <expiration-cache>0</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <supports>
+ <mime-type>text/xml</mime-type>
+ </supports>
+ <portlet-info>
+ <title>chapter4_2_10Tests-getResponseContentTypeMethodSetTest-portlet</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>chapter4_2_10Tests-getResponseContentTypeMethodNotSetTest-portlet</portlet-name>
+ <portlet-class>org.apache.myfaces.portlet.faces.testsuite.tests.chapter_4.section_4_2_10.GetResponseContentTypeMethodTestPortlet</portlet-class>
+ <expiration-cache>0</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>chapter4_2_10Tests-getResponseContentTypeMethodNotSetTest-portlet</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>chapter4_2_11Tests-getResponseCharacterSetEncodingMethodSetTest-portlet</portlet-name>
+ <portlet-class>org.apache.myfaces.portlet.faces.testsuite.tests.chapter_4.section_4_2_11.GetResponseCharacterSetEncodingMethodTestPortlet</portlet-class>
+ <init-param>
+ <name>javax.portlet.faces.defaultCharacterSetEncoding</name>
+ <value>UTF-8</value>
+ </init-param>
+ <expiration-cache>0</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>chapter4_2_11Tests-getResponseContentTypeMethodSetTest-portlet</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>chapter4_2_11Tests-getResponseCharacterSetEncodingMethodNotSetTest-portlet</portlet-name>
+ <portlet-class>org.apache.myfaces.portlet.faces.testsuite.tests.chapter_4.section_4_2_11.GetResponseCharacterSetEncodingMethodTestPortlet</portlet-class>
+ <expiration-cache>0</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>chapter4_2_11Tests-getResponseContentTypeMethodNotSetTest-portlet</title>
+ </portlet-info>
+ </portlet>
+
+
+
+ <!-- *************************************************************** -->
+ <!-- * * -->
<!-- * Tests: Chapter 6 * -->
<!-- * * -->
<!-- *************************************************************** -->
Added: myfaces/portlet-bridge/testsuite/trunk/src/main/webapp/tests/chapter4_2_5Result.jsp
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/testsuite/trunk/src/main/webapp/tests/chapter4_2_5Result.jsp?rev=891042&view=auto
==============================================================================
--- myfaces/portlet-bridge/testsuite/trunk/src/main/webapp/tests/chapter4_2_5Result.jsp (added)
+++ myfaces/portlet-bridge/testsuite/trunk/src/main/webapp/tests/chapter4_2_5Result.jsp Tue Dec 15 22:31:07 2009
@@ -0,0 +1,63 @@
+<%@ page contentType = "text/html; charset=UTF-8"
+ pageEncoding = "UTF-8"
+ import = "javax.portlet.*, org.apache.myfaces.portlet.faces.testsuite.common.util.BridgeTCKResultWriter, org.apache.myfaces.portlet.faces.testsuite.common.Constants"%>
+<%@ taglib uri = "http://java.sun.com/portlet" prefix="portlet"%>
+
+ <html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+ <title>JSR 301 Non Faces Request TCK Test</title>
+ </head>
+ <body>
+
+ <portlet:defineObjects/>
+
+ <!-- Test pass if the response content type has been set to the same value
+ as the request.-->
+ <!-- Test pass if the jsp has been rendered using a portlet dispatcher.
+ This is indicated by the presence of portlet attributes being set
+ on the request. -->
+ <%
+ String testName = (String)renderRequest.getAttribute(Constants.TEST_NAME);
+ BridgeTCKResultWriter writer = new BridgeTCKResultWriter(testName);
+
+ String contentType = renderResponse.getContentType();
+ String contentTypeMsg = "Expected response content type is " + renderRequest.getResponseContentType() + ", actual value is " + contentType + ". ";
+
+ String[] dispatcherAttributes = {"javax.portlet.config",
+ "javax.portlet.request",
+ "javax.portlet.response"};
+
+ boolean dispatcherPass = true;
+ for (String attr: dispatcherAttributes)
+ {
+ if (request.getAttribute(attr) == null)
+ {
+ dispatcherPass = false;
+ break;
+ }
+ }
+ String dispatcherMsg = null;
+ if (dispatcherPass == true)
+ {
+ dispatcherMsg = " The request included valid dispatcher attributes.";
+ }
+ else
+ {
+ dispatcherMsg = " The request did not include valid attributes indicating that a portlet request dispatcher was not used.";
+ }
+
+ writer.setDetail(contentTypeMsg + dispatcherMsg);
+ if (contentType.equals(renderRequest.getResponseContentType()) && dispatcherPass)
+ {
+ writer.setStatus(true);
+ }
+ else
+ {
+ writer.setStatus(false);
+ }
+
+ %>
+ <%=writer.toString()%>
+ </body>
+ </html>