JBoss Portal SVN: r9567 - in modules/portlet/trunk: portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext and 7 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-01-22 16:11:06 -0500 (Tue, 22 Jan 2008)
New Revision: 9567
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletrequests/
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletrequests/RemovePublicRenderParameterOnStateAwareResponseTestCase.java
modules/portlet/trunk/test/src/test/resources/jsr286/ext/
modules/portlet/trunk/test/src/test/resources/jsr286/ext/portletrequests-war/
modules/portlet/trunk/test/src/test/resources/jsr286/ext/portletrequests-war/WEB-INF/
modules/portlet/trunk/test/src/test/resources/jsr286/ext/portletrequests-war/WEB-INF/portlet.xml
modules/portlet/trunk/test/src/test/resources/jsr286/ext/portletrequests-war/WEB-INF/web.xml
Modified:
modules/portlet/trunk/test/src/test/build.xml
modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml
Log:
added test case for public render parameter removal during action or event request
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletrequests/RemovePublicRenderParameterOnStateAwareResponseTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletrequests/RemovePublicRenderParameterOnStateAwareResponseTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletrequests/RemovePublicRenderParameterOnStateAwareResponseTestCase.java 2008-01-22 21:11:06 UTC (rev 9567)
@@ -0,0 +1,129 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr286.ext.portletrequests;
+
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.unit.actions.PortletActionTestAction;
+import org.jboss.portal.unit.actions.PortletEventTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.*;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletURL;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.HashMap;
+
+/**
+ * If a portlet wants to delete a public render parameter it needs to use the
+ * removePublic method on the or the PortletURL.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+@TestCase
+public class RemovePublicRenderParameterOnStateAwareResponseTestCase
+{
+ public RemovePublicRenderParameterOnStateAwareResponseTestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ PortletURL url = response.createRenderURL();
+ url.setParameter("foo", new String[]{"foo_value1","foo_value2"});
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+ seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+ seq.bindAction(2, UTP1.ACTION_JOIN_POINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ assertEquals(new String[]{"foo_value1","foo_value2"}, request.getParameterValues("foo"));
+ response.removePublicRenderParameter("foo");
+ }
+ });
+ seq.bindAction(2, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ assertParameterMap(new HashMap<String, String[]>(), request);
+ assertEquals(Collections.emptyMap(), request.getPublicParameterMap());
+ PortletURL url = response.createRenderURL();
+ url.setParameter("foo", new String[]{"foo_value1","foo_value2"});
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+ seq.bindAction(3, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+ seq.bindAction(4, UTP1.ACTION_JOIN_POINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ response.setEvent("Event", null);
+ }
+ });
+ seq.bindAction(4, UTP1.EVENT_JOIN_POINT, new PortletEventTestAction()
+ {
+ protected void run(Portlet portlet, EventRequest request, EventResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ assertEquals(new String[]{"foo_value1","foo_value2"}, request.getParameterValues("foo"));
+ response.removePublicRenderParameter("foo");
+ }
+ });
+ seq.bindAction(4, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ assertParameterMap(new HashMap<String, String[]>(), request);
+ assertEquals(Collections.emptyMap(), request.getPublicParameterMap());
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Modified: modules/portlet/trunk/test/src/test/build.xml
===================================================================
--- modules/portlet/trunk/test/src/test/build.xml 2008-01-22 20:17:41 UTC (rev 9566)
+++ modules/portlet/trunk/test/src/test/build.xml 2008-01-22 21:11:06 UTC (rev 9567)
@@ -141,6 +141,13 @@
</sequential>
</macrodef>
+ <macrodef name="package-jsr286-ext-test">
+ <attribute name="test"/>
+ <sequential>
+ <package-testsuite testsuiteversion="jsr286" testsuitetype="ext" testsuitename="@{test}"/>
+ </sequential>
+ </macrodef>
+
<macrodef name="package-testsuite">
<attribute name="testsuiteversion"/>
<attribute name="testsuitetype"/>
@@ -234,6 +241,8 @@
<package-jsr286-api-test test="event"/>
+ <package-jsr286-ext-test test="portletrequests"/>
+
<jar jarfile="${test.temp.lib}/portlet-test-lib.jar">
<fileset dir="${target}/test-classes"/>
<fileset dir="${target}/classes"/>
@@ -539,7 +548,7 @@
<configuration>
<property name="cargo.servlet.port" value="8080"/>
<property name="cargo.logging" value="high"/>
- <property name="cargo.jvmargs" value="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"/>
+ <!--<property name="cargo.jvmargs" value="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"/>-->
<deployable type="war" file="${test.temp.lib}/manager.war"/>
<deployable type="war" file="${test.temp.lib}/tomcat-6.0/portlet-test.war"/>
</configuration>
Added: modules/portlet/trunk/test/src/test/resources/jsr286/ext/portletrequests-war/WEB-INF/portlet.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/ext/portletrequests-war/WEB-INF/portlet.xml (rev 0)
+++ modules/portlet/trunk/test/src/test/resources/jsr286/ext/portletrequests-war/WEB-INF/portlet.xml 2008-01-22 21:11:06 UTC (rev 9567)
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0">
+
+ <portlet>
+ <portlet-name>UniversalTestPortletA</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP1</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <supported-processing-event>
+ <name>Event</name>
+ </supported-processing-event>
+ <supported-publishing-event>
+ <name>Event</name>
+ </supported-publishing-event>
+ <supported-public-render-parameter>foo</supported-public-render-parameter>
+ </portlet>
+
+ <event-definition>
+ <name>Event</name>
+ </event-definition>
+
+ <public-render-parameter>
+ <identifier>foo</identifier>
+ <name>Foo</name>
+ </public-render-parameter>
+
+</portlet-app>
Added: modules/portlet/trunk/test/src/test/resources/jsr286/ext/portletrequests-war/WEB-INF/web.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/ext/portletrequests-war/WEB-INF/web.xml (rev 0)
+++ modules/portlet/trunk/test/src/test/resources/jsr286/ext/portletrequests-war/WEB-INF/web.xml 2008-01-22 21:11:06 UTC (rev 9567)
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+ <listener>
+ <listener-class>org.jboss.portal.unit.PortletTestSuite</listener-class>
+ </listener>
+</web-app>
Modified: modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml 2008-01-22 20:17:41 UTC (rev 9566)
+++ modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml 2008-01-22 21:11:06 UTC (rev 9567)
@@ -184,6 +184,12 @@
<property name="archiveId" value="test-jsr286-api-event.war"/>
</generic>
+ <!--Ext Assertions tests-->
+ <generic>
+ <class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
+ <property name="archiveId" value="test-jsr286-ext-portletrequests.war"/>
+ </generic>
+
<!--Misc Tests-->
<!--
<generic>
18 years, 3 months
JBoss Portal SVN: r9566 - modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-01-22 15:17:41 -0500 (Tue, 22 Jan 2008)
New Revision: 9566
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/TestAction.java
Log:
Add javadoc to explain the purpose of the assertParameterMap method
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/TestAction.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/TestAction.java 2008-01-22 20:13:25 UTC (rev 9565)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/TestAction.java 2008-01-22 20:17:41 UTC (rev 9566)
@@ -38,7 +38,24 @@
public abstract class TestAction
{
- public final void assertParameterMap(Map<String, String[]> expectedMap, PortletRequest request)
+ /**
+ * Check that the parameter map contains the value expected. The check is done with the different
+ * ways that the <code>PortletRequest</code> API provides:
+ *
+ * <ul>
+ * <li><code>PortletRequest.getParameter(String)</li>
+ * <li><code>PortletRequest.getParameterValues(String)</li>
+ * <li><code>PortletRequest.getParameterNames()</li>
+ * <li><code>PortletRequest.getParameterMap()</li>
+ * </ul>
+ *
+ * This method allows a full coverage of the API.
+ *
+ * @param expectedMap the expected map
+ * @param request the actual portlet request
+ * @throws AssertionError if the provided request does not match the expected map state
+ */
+ public final void assertParameterMap(Map<String, String[]> expectedMap, PortletRequest request) throws AssertionError
{
assertNotNull(request);
18 years, 3 months
JBoss Portal SVN: r9565 - in modules/portlet/trunk: portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletrequests and 4 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-01-22 15:13:25 -0500 (Tue, 22 Jan 2008)
New Revision: 9565
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletrequests/PublicRenderParameterAvailableInLifeCycleMethodTestCase.java
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP5.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/TestAction.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/actions/PortletActionTestAction.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/actions/PortletEventTestAction.java
modules/portlet/trunk/test/src/test/build.xml
modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletrequests-war/WEB-INF/portlet.xml
Log:
test that public render parameters are available in all life cycle methods and that they are merged with action/resource parameters
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP5.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP5.java 2008-01-22 20:11:35 UTC (rev 9564)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP5.java 2008-01-22 20:13:25 UTC (rev 9565)
@@ -46,6 +46,8 @@
public final static JoinPoint ACTION_JOIN_POINT = new JoinPoint(NAME, JoinPointType.PORTLET_ACTION);
+ public final static JoinPoint RESOURCE_JOIN_POINT = new JoinPoint(NAME, JoinPointType.PORTLET_RESOURCE);
+
/** Resets helper variables */
public void reset()
{
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletrequests/PublicRenderParameterAvailableInLifeCycleMethodTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletrequests/PublicRenderParameterAvailableInLifeCycleMethodTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletrequests/PublicRenderParameterAvailableInLifeCycleMethodTestCase.java 2008-01-22 20:13:25 UTC (rev 9565)
@@ -0,0 +1,190 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr286.tck.portletrequests;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.Assertion;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.unit.actions.PortletActionTestAction;
+import org.jboss.portal.unit.actions.PortletEventTestAction;
+import org.jboss.portal.unit.actions.PortletResourceTestAction;
+import org.jboss.portal.test.portlet.framework.UTP5;
+import org.jboss.portal.common.http.HttpRequest;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokePostResponse;
+import static org.jboss.unit.api.Assert.*;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletURL;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import javax.portlet.ResourceURL;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import java.io.IOException;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
+
+/**
+ * A portlet can access the public render parameters in any lifecycle method via the
+ * getPublicParameterMap method of the portlet request. In addition the portlet can access
+ * public render parameters via the getParameter and getParameterMap methods. In the
+ * case of a processAction or serveResource call the public parameters are merged with
+ * the action / resource parameters set on the action / resource URL. If a action or resource
+ * parameter has the same name as a public render parameter the public render parameter
+ * values must be the last entries in the parameter value array.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+(a)TestCase({Assertion.JSR168_1000})
+public class PublicRenderParameterAvailableInLifeCycleMethodTestCase
+{
+
+ /** . */
+ private Map<String, String[]> expectedClientDataMap;
+
+ /** . */
+ private Map<String, String[]> expectedClientDataPrivateMap;
+
+ /** . */
+ private Map<String, String[]> expectedPublicMap;
+
+ public PublicRenderParameterAvailableInLifeCycleMethodTestCase(PortletTestCase seq)
+ {
+ expectedClientDataMap = new HashMap<String, String[]>();
+ expectedClientDataMap.put("foo",new String[]{"foo_value1","foo_value2"});
+ expectedClientDataMap.put("bar",new String[]{"is_bar_value1","is_bar_value2","bar_value1","bar_value2"});
+ expectedClientDataMap.put("juu",new String[]{"form_juu_value1","form_juu_value2","juu_value1","juu_value2"});
+ expectedClientDataMap.put("daa",new String[]{"is_daa_value1","is_daa_value2","form_daa_value1","form_daa_value2","daa_value1","daa_value2"});
+
+ //
+ expectedClientDataPrivateMap = new HashMap<String, String[]>();
+ expectedClientDataPrivateMap.put("bar",new String[]{"is_bar_value1","is_bar_value2"});
+ expectedClientDataPrivateMap.put("juu",new String[]{"form_juu_value1","form_juu_value2"});
+ expectedClientDataPrivateMap.put("daa",new String[]{"is_daa_value1","is_daa_value2","form_daa_value1","form_daa_value2"});
+
+ //
+ expectedPublicMap = new HashMap<String, String[]>();
+ expectedPublicMap.put("foo",new String[]{"foo_value1","foo_value2"});
+ expectedPublicMap.put("bar",new String[]{"bar_value1","bar_value2"});
+ expectedPublicMap.put("juu",new String[]{"juu_value1","juu_value2"});
+ expectedPublicMap.put("daa",new String[]{"daa_value1","daa_value2"});
+
+ //
+ seq.bindAction(0, UTP5.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
+ {
+ PortletURL renderURL = response.createRenderURL();
+ renderURL.setParameter("foo", new String[]{"foo_value1","foo_value2"});
+ renderURL.setParameter("bar", new String[]{"bar_value1","bar_value2"});
+ renderURL.setParameter("juu", new String[]{"juu_value1","juu_value2"});
+ renderURL.setParameter("daa", new String[]{"daa_value1","daa_value2"});
+ return new InvokeGetResponse(renderURL.toString());
+ }
+ });
+ seq.bindAction(1, UTP5.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
+ {
+ PortletURL actionURL = response.createActionURL();
+ actionURL.setParameter("bar", new String[]{"is_bar_value1","is_bar_value2"});
+ actionURL.setParameter("daa", new String[]{"is_daa_value1","is_daa_value2"});
+
+ //
+ InvokePostResponse post = new InvokePostResponse(actionURL.toString());
+ HttpRequest.Form form = new HttpRequest.Form();
+ form.addParameter("juu", new String[]{"form_juu_value1","form_juu_value2"});
+ form.addParameter("daa", new String[]{"form_daa_value1","form_daa_value2"});
+ post.setBody(form);
+
+ //
+ return post;
+ }
+ });
+ seq.bindAction(2, UTP5.ACTION_JOIN_POINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ assertParameterMap(expectedClientDataMap, request);
+ assertEquals(expectedClientDataPrivateMap, request.getPrivateParameterMap());
+ assertEquals(expectedPublicMap, request.getPublicParameterMap());
+ response.setEvent("Event", null);
+ }
+ });
+ seq.bindAction(2, UTP5.EVENT_JOIN_POINT, new PortletEventTestAction()
+ {
+ protected void run(Portlet portlet, EventRequest request, EventResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ assertParameterMap(expectedPublicMap, request);
+ assertEquals(Collections.emptyMap(), request.getPrivateParameterMap());
+ assertEquals(expectedPublicMap, request.getPublicParameterMap());
+ }
+ });
+ seq.bindAction(2, UTP5.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
+ {
+ assertParameterMap(expectedPublicMap, request);
+ assertEquals(Collections.emptyMap(), request.getPrivateParameterMap());
+ assertEquals(expectedPublicMap, request.getPublicParameterMap());
+
+ //
+ ResourceURL resourceURL = response.createResourceURL();
+ resourceURL.setParameter("bar", new String[]{"is_bar_value1","is_bar_value2"});
+ resourceURL.setParameter("daa", new String[]{"is_daa_value1","is_daa_value2"});
+
+ //
+ InvokePostResponse post = new InvokePostResponse(resourceURL.toString());
+ HttpRequest.Form form = new HttpRequest.Form();
+ form.addParameter("juu", new String[]{"form_juu_value1","form_juu_value2"});
+ form.addParameter("daa", new String[]{"form_daa_value1","form_daa_value2"});
+ post.setBody(form);
+
+ //
+ return post;
+ }
+ });
+ seq.bindAction(3, UTP5.RESOURCE_JOIN_POINT, new PortletResourceTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, ResourceRequest request, ResourceResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ assertParameterMap(expectedClientDataMap, request);
+ assertEquals(expectedClientDataPrivateMap, request.getPrivateParameterMap());
+ assertEquals(expectedPublicMap, request.getPublicParameterMap());
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/TestAction.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/TestAction.java 2008-01-22 20:11:35 UTC (rev 9564)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/TestAction.java 2008-01-22 20:13:25 UTC (rev 9565)
@@ -22,10 +22,55 @@
******************************************************************************/
package org.jboss.portal.unit;
+import javax.portlet.PortletRequest;
+import java.util.Map;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Collections;
+
+import static org.jboss.unit.api.Assert.*;
+import org.jboss.portal.common.util.Tools;
+
/**
* @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw Dawidowicz</a>
* @version $Revision: 7018 $
*/
public abstract class TestAction
{
+
+ public final void assertParameterMap(Map<String, String[]> expectedMap, PortletRequest request)
+ {
+ assertNotNull(request);
+
+ // Test getParameter(String name)
+ for (Map.Entry<String, String[]> entry : expectedMap.entrySet())
+ {
+ String expectedValue = entry.getValue()[0];
+ assertEquals(expectedValue, request.getParameter(entry.getKey()));
+ }
+
+ // Test getParameterValues(String name)
+ for (Map.Entry<String, String[]> entry : expectedMap.entrySet())
+ {
+ String[] expectedValues = entry.getValue();
+ assertEquals(expectedValues, request.getParameterValues(entry.getKey()));
+ }
+
+ // Test parameter names, we use list in order to catch eventually a wrong Enumeration returned by the request
+ List<String> names = Tools.toList(request.getParameterNames());
+ List<String> expectedNames = new ArrayList<String>(expectedMap.keySet());
+ Collections.sort(names);
+ Collections.sort(expectedNames);
+ assertEquals(expectedNames, names);
+
+ //
+ Map<String, String[]> map = request.getParameterMap();
+ assertNotNull(map);
+ assertEquals(expectedMap.size(), map.size());
+ for (Map.Entry<String, String[]> entry : expectedMap.entrySet())
+ {
+ String[] expectedValues = map.get(entry.getKey());
+ assertEquals(entry.getValue(), expectedValues);
+ }
+ }
}
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/actions/PortletActionTestAction.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/actions/PortletActionTestAction.java 2008-01-22 20:11:35 UTC (rev 9564)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/actions/PortletActionTestAction.java 2008-01-22 20:13:25 UTC (rev 9565)
@@ -41,15 +41,27 @@
public abstract class PortletActionTestAction extends TestAction
{
- public DriverResponse execute(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
+ public final DriverResponse execute(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
{
try
{
- run(portlet, request, response, context);
+ runWithRuntimeException(portlet, request, response, context);
//
return null;
}
+ catch (AssertionError t)
+ {
+ return new FailureResponse(Failure.createFailure(t));
+ }
+ }
+
+ protected void runWithRuntimeException(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ try
+ {
+ run(portlet, request, response, context);
+ }
catch (Exception e)
{
if (e instanceof PortletException)
@@ -60,12 +72,8 @@
{
throw (IOException)e;
}
- return new FailureResponse(Failure.createAssertionFailure(e));
+ throw new AssertionError(e);
}
- catch (AssertionError t)
- {
- return new FailureResponse(Failure.createFailure(t));
- }
}
protected abstract void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException;
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/actions/PortletEventTestAction.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/actions/PortletEventTestAction.java 2008-01-22 20:11:35 UTC (rev 9564)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/actions/PortletEventTestAction.java 2008-01-22 20:13:25 UTC (rev 9565)
@@ -41,7 +41,7 @@
public abstract class PortletEventTestAction extends TestAction
{
- public DriverResponse execute(Portlet portlet, EventRequest request, EventResponse response, PortletTestContext context) throws PortletException, IOException
+ public final DriverResponse execute(Portlet portlet, EventRequest request, EventResponse response, PortletTestContext context) throws PortletException, IOException
{
try
{
Modified: modules/portlet/trunk/test/src/test/build.xml
===================================================================
--- modules/portlet/trunk/test/src/test/build.xml 2008-01-22 20:11:35 UTC (rev 9564)
+++ modules/portlet/trunk/test/src/test/build.xml 2008-01-22 20:13:25 UTC (rev 9565)
@@ -539,7 +539,7 @@
<configuration>
<property name="cargo.servlet.port" value="8080"/>
<property name="cargo.logging" value="high"/>
- <!--<property name="cargo.jvmargs" value="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"/>-->
+ <property name="cargo.jvmargs" value="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"/>
<deployable type="war" file="${test.temp.lib}/manager.war"/>
<deployable type="war" file="${test.temp.lib}/tomcat-6.0/portlet-test.war"/>
</configuration>
Modified: modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletrequests-war/WEB-INF/portlet.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletrequests-war/WEB-INF/portlet.xml 2008-01-22 20:11:35 UTC (rev 9564)
+++ modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletrequests-war/WEB-INF/portlet.xml 2008-01-22 20:13:25 UTC (rev 9565)
@@ -64,6 +64,28 @@
<supported-public-render-parameter>foo</supported-public-render-parameter>
</portlet>
+ <portlet>
+ <portlet-name>UniversalTestPortletE</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP5</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <supported-processing-event>
+ <name>Event</name>
+ </supported-processing-event>
+ <supported-publishing-event>
+ <name>Event</name>
+ </supported-publishing-event>
+ <supported-public-render-parameter>foo</supported-public-render-parameter>
+ <supported-public-render-parameter>bar</supported-public-render-parameter>
+ <supported-public-render-parameter>juu</supported-public-render-parameter>
+ <supported-public-render-parameter>daa</supported-public-render-parameter>
+ </portlet>
+
+ <event-definition>
+ <name>Event</name>
+ </event-definition>
+
<public-render-parameter>
<identifier>foo</identifier>
<name>Foo</name>
@@ -74,4 +96,14 @@
<name>Bar</name>
</public-render-parameter>
+ <public-render-parameter>
+ <identifier>juu</identifier>
+ <name>Juu</name>
+ </public-render-parameter>
+
+ <public-render-parameter>
+ <identifier>daa</identifier>
+ <name>Daa</name>
+ </public-render-parameter>
+
</portlet-app>
18 years, 3 months
JBoss Portal SVN: r9564 - branches/JBoss_Portal_Branch_2_6/build.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-01-22 15:11:35 -0500 (Tue, 22 Jan 2008)
New Revision: 9564
Modified:
branches/JBoss_Portal_Branch_2_6/build/build-thirdparty.xml
Log:
Oups, adding tagsoup
Modified: branches/JBoss_Portal_Branch_2_6/build/build-thirdparty.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/build/build-thirdparty.xml 2008-01-22 20:09:50 UTC (rev 9563)
+++ branches/JBoss_Portal_Branch_2_6/build/build-thirdparty.xml 2008-01-22 20:11:35 UTC (rev 9564)
@@ -119,7 +119,9 @@
<componentref name="freemarker" version="2.3.9"/>
<componentref name="wutka-dtdparser" version="1.2.1"/>
<componentref name="portals-bridges" version="1.0.3"/>
+ <componentref name="tagsoup" version="1.2"/>
+
<!-- For the presentation branch only, not the mainstream branch -->
<componentref name="gwt" version="1.4.60"/>
<componentref name="mygwt" version="0.3.0"/>
18 years, 3 months
JBoss Portal SVN: r9563 - branches/JBoss_Portal_Branch_2_6/core.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-01-22 15:09:50 -0500 (Tue, 22 Jan 2008)
New Revision: 9563
Modified:
branches/JBoss_Portal_Branch_2_6/core/build.xml
Log:
Add tagsoup
Modified: branches/JBoss_Portal_Branch_2_6/core/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/build.xml 2008-01-22 20:07:44 UTC (rev 9562)
+++ branches/JBoss_Portal_Branch_2_6/core/build.xml 2008-01-22 20:09:50 UTC (rev 9563)
@@ -341,7 +341,8 @@
<fileset dir="${jakarta.io.lib}" includes="commons-io.jar"/>
<fileset dir="${freemarker.freemarker.lib}" includes="freemarker.jar"/>
<fileset dir="${portals.bridges.lib}" includes="portals-bridges-common.jar"/>
- <fileset dir="${jboss/backport.concurrent.lib}" includes="jboss-backport-concurrent.jar"/>
+ <fileset dir="${tagsoup.tagsoup.lib}" includes="tagsoup.jar"/>
+ <fileset dir="${jboss/backport.concurrent.lib}" includes="jboss-backport-concurrent.jar"/>
<fileset dir="${jbpm.jaronly.lib}" includes="jbpm.jar,jbpm-identity.jar"/>
</copy>
18 years, 3 months
JBoss Portal SVN: r9562 - in modules/portlet/branches/JBP_PORTLET_BRANCH_1_0: build and 1 other directory.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-01-22 15:07:44 -0500 (Tue, 22 Jan 2008)
New Revision: 9562
Modified:
modules/portlet/branches/JBP_PORTLET_BRANCH_1_0/bridge/build.xml
modules/portlet/branches/JBP_PORTLET_BRANCH_1_0/build/build-thirdparty.xml
Log:
Fix build
Modified: modules/portlet/branches/JBP_PORTLET_BRANCH_1_0/bridge/build.xml
===================================================================
--- modules/portlet/branches/JBP_PORTLET_BRANCH_1_0/bridge/build.xml 2008-01-22 18:05:39 UTC (rev 9561)
+++ modules/portlet/branches/JBP_PORTLET_BRANCH_1_0/bridge/build.xml 2008-01-22 20:07:44 UTC (rev 9562)
@@ -89,6 +89,8 @@
<path refid="apache.log4j.classpath"/>
<path refid="sun.servlet.classpath"/>
<path refid="portals.bridges.classpath"/>
+ <path refid="junit.junit.classpath"/>
+ <path refid="tagsoup.tagsoup.classpath"/>
</path>
<path id="javac.classpath">
Modified: modules/portlet/branches/JBP_PORTLET_BRANCH_1_0/build/build-thirdparty.xml
===================================================================
--- modules/portlet/branches/JBP_PORTLET_BRANCH_1_0/build/build-thirdparty.xml 2008-01-22 18:05:39 UTC (rev 9561)
+++ modules/portlet/branches/JBP_PORTLET_BRANCH_1_0/build/build-thirdparty.xml 2008-01-22 20:07:44 UTC (rev 9562)
@@ -46,7 +46,7 @@
are pushed to the http://repository.jboss.com site.
-->
- <componentref name="jboss-portal/modules/common" version="trunk-SNAPSHOT"/>
+ <componentref name="jboss-portal/modules/common" version="1.1.0"/>
<componentref name="jboss-portal/modules/web" version="trunk-SNAPSHOT"/>
<componentref name="jboss-portal/modules/test" version="1.0-SNAPSHOT"/>
<componentref name="sun-servlet" version="2.4"/>
@@ -57,6 +57,7 @@
<componentref name="apache-codec" version="1.3.0"/>
<componentref name="apache-httpclient" version="3.0.1"/>
<componentref name="apache-logging" version="1.1"/>
+ <componentref name="tagsoup" version="1.2"/>
<componentref name="portals-bridges" version="1.0.3"/>
18 years, 3 months
JBoss Portal SVN: r9561 - modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletrequests.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-01-22 13:05:39 -0500 (Tue, 22 Jan 2008)
New Revision: 9561
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletrequests/PortletDoesNotReceiveUnsupportedRenderParametersTestCase.java
Log:
update what the test case do test really
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletrequests/PortletDoesNotReceiveUnsupportedRenderParametersTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletrequests/PortletDoesNotReceiveUnsupportedRenderParametersTestCase.java 2008-01-22 17:09:32 UTC (rev 9560)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletrequests/PortletDoesNotReceiveUnsupportedRenderParametersTestCase.java 2008-01-22 18:05:39 UTC (rev 9561)
@@ -60,7 +60,14 @@
*
* The portlet container must only send those public render parameters to a portlet which the
* portlet has defined support for using supported-public-render-parameter element in the portlet.
- *
+ *
+ * The portlet container must only share those render parameters of a
+ * portlet which the portlet has declared as supported public render parameters using
+ * supported-public-render-parameter element in the portlet.xml
+ *
+ * If the portlet was the target of a render URL and this render URL has set a specific public
+ * render parameter the portlet must receive at least this render parameter
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
18 years, 3 months
JBoss Portal SVN: r9560 - in modules/portlet/trunk: portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api and 4 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-01-22 12:09:32 -0500 (Tue, 22 Jan 2008)
New Revision: 9560
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletrequests/PortletDoesNotReceiveUnsupportedRenderParametersTestCase.java
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/PortletURL.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/RenderURL.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletURLImpl.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletrequests/PublicRenderParameterTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/base/AbstractUniversalTestPortlet.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletControllerContextImpl.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletURLRenderer.java
modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletrequests-war/WEB-INF/portlet.xml
Log:
- test case for portlet that should not see public render parameter they don't declare
- implemented public parameter in render URLs
- fixed a bug where only one public parameter update change was taken in account and discarding the others
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/PortletURL.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/PortletURL.java 2008-01-22 15:33:59 UTC (rev 9559)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/PortletURL.java 2008-01-22 17:09:32 UTC (rev 9560)
@@ -46,11 +46,4 @@
* @return the window state
*/
WindowState getWindowState();
-
- /**
- * Returns the public navigational state changes.
- *
- * @return the public navigational state changes
- */
- Map<String, String[]> getPublicNavigationalStateChanges();
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/RenderURL.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/RenderURL.java 2008-01-22 15:33:59 UTC (rev 9559)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/RenderURL.java 2008-01-22 17:09:32 UTC (rev 9560)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.portlet;
+import java.util.Map;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 2748 $
@@ -34,4 +36,11 @@
* @return the navigational state
*/
StateString getNavigationalState();
+
+ /**
+ * Returns the public navigational state changes.
+ *
+ * @return the public navigational state changes
+ */
+ Map<String, String[]> getPublicNavigationalStateChanges();
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletURLImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletURLImpl.java 2008-01-22 15:33:59 UTC (rev 9559)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletURLImpl.java 2008-01-22 17:09:32 UTC (rev 9560)
@@ -170,11 +170,6 @@
return navigationalState;
}
- public Map<String, String[]> getPublicNavigationalStateChanges()
- {
- return Collections.emptyMap();
- }
-
protected void setParameter(String name, String value)
{
interactionState.setValue(name, value);
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletrequests/PortletDoesNotReceiveUnsupportedRenderParametersTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletrequests/PortletDoesNotReceiveUnsupportedRenderParametersTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletrequests/PortletDoesNotReceiveUnsupportedRenderParametersTestCase.java 2008-01-22 17:09:32 UTC (rev 9560)
@@ -0,0 +1,147 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr286.tck.portletrequests;
+
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.Assertion;
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.unit.actions.PortletActionTestAction;
+import org.jboss.portal.test.portlet.framework.UTP9;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.framework.UTP2;
+import org.jboss.portal.test.portlet.framework.UTP3;
+import org.jboss.portal.test.portlet.framework.UTP4;
+import org.jboss.portal.common.util.Tools;
+import static org.jboss.unit.api.Assert.*;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.driver.response.FailureResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import org.jboss.unit.Failure;
+
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.Portlet;
+import javax.portlet.PortletConfig;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletURL;
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.List;
+import java.util.HashSet;
+import java.io.IOException;
+
+/**
+ *
+ * The portlet container must only send those public render parameters to a portlet which the
+ * portlet has defined support for using supported-public-render-parameter element in the portlet.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+(a)TestCase({Assertion.JSR168_1000})
+public class PortletDoesNotReceiveUnsupportedRenderParametersTestCase
+{
+
+ public PortletDoesNotReceiveUnsupportedRenderParametersTestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP3.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
+ {
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+
+ // Test updates from an action
+ seq.bindAction(1, UTP3.ACTION_JOIN_POINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ response.setRenderParameter("foo", new String[]{"foo_value1", "foo_value2"});
+ response.setRenderParameter("bar", new String[]{"bar_value1", "bar_value2"});
+ }
+ });
+ seq.bindAction(1, UTP3.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
+ {
+ assertEquals(new String[]{"foo_value1","foo_value2"}, request.getParameterValues("foo"));
+ assertEquals(new String[]{"bar_value1","bar_value2"}, request.getParameterValues("bar"));
+ return null;
+ }
+ });
+ seq.bindAction(1, UTP4.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
+ {
+ String[] fooValues = request.getParameterValues("foo");
+ assertEquals(new String[]{"foo_value1","foo_value2"}, fooValues);
+ assertEquals(null, request.getParameterValues("bar"));
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+
+ // Test updates from a render URL
+ seq.bindAction(2, UTP3.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
+ {
+ PortletURL url = response.createRenderURL();
+ url.setParameter("foo", new String[]{"foo_value3", "foo_value4"});
+ url.setParameter("bar", new String[]{"bar_value3", "bar_value4"});
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+ seq.bindAction(3, UTP3.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
+ {
+ assertEquals(new String[]{"foo_value3","foo_value4"}, request.getParameterValues("foo"));
+ assertEquals(new String[]{"bar_value3","bar_value4"}, request.getParameterValues("bar"));
+ return null;
+ }
+ });
+ seq.bindAction(3, UTP4.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
+ {
+ String[] fooValues = request.getParameterValues("foo");
+ assertEquals(new String[]{"foo_value3","foo_value4"}, fooValues);
+ assertEquals(null, request.getParameterValues("bar"));
+ //
+// PortletURL renderURL = response.createRenderURL();
+// renderURL.setParameter("bar", "");
+ return new EndTestResponse();
+ }
+ });
+
+ // Test updates from an action with the portlet having a private render parameter
+
+ }
+}
\ No newline at end of file
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletrequests/PublicRenderParameterTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletrequests/PublicRenderParameterTestCase.java 2008-01-22 15:33:59 UTC (rev 9559)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletrequests/PublicRenderParameterTestCase.java 2008-01-22 17:09:32 UTC (rev 9560)
@@ -129,9 +129,7 @@
{
String foo = request.getParameter("foo");
assertEquals(null, foo);
- renderCount++;
- assertEquals(2, renderCount);
- return new EndTestResponse();
+ return ++renderCount == 2 ? new EndTestResponse() : null;
}
});
}
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/base/AbstractUniversalTestPortlet.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/base/AbstractUniversalTestPortlet.java 2008-01-22 15:33:59 UTC (rev 9559)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/base/AbstractUniversalTestPortlet.java 2008-01-22 17:09:32 UTC (rev 9560)
@@ -260,9 +260,20 @@
DriverResponse response = ((PortletRenderTestAction)action).execute(this, req, resp, ctx);
// If we have one result it is meant to be returned to the client
- if (ctx.getResponse() == null && response != null)
+ if (response != null)
{
- ctx.setResponse(response);
+ DriverResponse existingResponse = ctx.getResponse();
+
+ //
+ if (existingResponse instanceof FailureResponse)
+ {
+ // We keep the existing failure, since we want it reported
+ }
+ else if (response instanceof FailureResponse || existingResponse == null)
+ {
+ // We have a failure response and the context contains no response or a non failure response
+ ctx.setResponse(response);
+ }
}
}
else
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java 2008-01-22 15:33:59 UTC (rev 9559)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java 2008-01-22 17:09:32 UTC (rev 9560)
@@ -107,8 +107,10 @@
if (publicNavigationalState == null)
{
publicNavigationalState = new ParameterMap();
- publicNavigationalState.put(parameterId, parameterValue);
}
+
+ //
+ publicNavigationalState.put(parameterId, parameterValue);
}
}
return publicNavigationalState;
@@ -133,6 +135,9 @@
updateNavigationalState.setMode(portletRenderRequest.mode);
updateNavigationalState.setWindowState(portletRenderRequest.windowState);
updateNavigationalState.setNavigationalState(portletRenderRequest.navigationalState);
+ updateNavigationalState.setPublicNavigationalStateUpdates(portletRenderRequest.publicNavigationalStateChanges);
+
+ //
return updateNavigationalState;
}
else if (containerRequest instanceof PortletActionRequest)
@@ -786,9 +791,12 @@
/** . */
final StateString navigationalState;
+ final Map<String, String[]> publicNavigationalStateChanges;
+
public PortletRenderRequest(
String portletId,
StateString navigationalState,
+ Map<String, String[]> publicNavigationalStateChanges,
Mode mode,
WindowState windowState)
{
@@ -796,6 +804,7 @@
//
this.navigationalState = navigationalState;
+ this.publicNavigationalStateChanges = publicNavigationalStateChanges;
}
}
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletControllerContextImpl.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletControllerContextImpl.java 2008-01-22 15:33:59 UTC (rev 9559)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletControllerContextImpl.java 2008-01-22 17:09:32 UTC (rev 9560)
@@ -26,6 +26,7 @@
import org.jboss.portal.WindowState;
import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.common.io.IOTools;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletContext;
import org.jboss.portal.portlet.PortletInvoker;
@@ -44,6 +45,7 @@
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Collection;
+import java.util.Map;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -181,7 +183,10 @@
StateString navigationalState = ParametersStateString.create(req.getParameter("navigationalstate"));
//
- request = new PortletController.PortletRenderRequest(targetId, navigationalState, mode, windowState);
+ Map<String, String[]> publicNavigationalStateChanges = (Map<String, String[]>)IOTools.unserialize(Tools.fromHexString(req.getParameter("publicnavigationalstatechanges")));
+
+ //
+ request = new PortletController.PortletRenderRequest(targetId, navigationalState, publicNavigationalStateChanges, mode, windowState);
}
}
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletURLRenderer.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletURLRenderer.java 2008-01-22 15:33:59 UTC (rev 9559)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletURLRenderer.java 2008-01-22 17:09:32 UTC (rev 9560)
@@ -32,6 +32,7 @@
import org.jboss.portal.common.text.CharBuffer;
import org.jboss.portal.common.text.FastURLEncoder;
import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.common.io.IOTools;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -159,6 +160,20 @@
RenderURL renderURL = (RenderURL)containerURL;
//
+ try
+ {
+ Map<String, String[]> changes = renderURL.getPublicNavigationalStateChanges();
+ HashMap<String, String[]> serialiableChanges = new HashMap<String, String[]>(changes);
+ byte[] bytes = IOTools.serialize(serialiableChanges);
+ String ns = Tools.toHexString(bytes);
+ parameters.put("publicnavigationalstatechanges", ns);
+ }
+ catch (IOException e)
+ {
+ throw new Error(e);
+ }
+
+ //
StateString navigationalState = renderURL.getNavigationalState();
parameters.put("navigationalstate", navigationalState.getStringValue());
}
Modified: modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletrequests-war/WEB-INF/portlet.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletrequests-war/WEB-INF/portlet.xml 2008-01-22 15:33:59 UTC (rev 9559)
+++ modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletrequests-war/WEB-INF/portlet.xml 2008-01-22 17:09:32 UTC (rev 9560)
@@ -45,9 +45,33 @@
<supported-public-render-parameter>foo</supported-public-render-parameter>
</portlet>
+ <portlet>
+ <portlet-name>UniversalTestPortletC</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP3</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <supported-public-render-parameter>foo</supported-public-render-parameter>
+ <supported-public-render-parameter>bar</supported-public-render-parameter>
+ </portlet>
+
+ <portlet>
+ <portlet-name>UniversalTestPortletD</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP4</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <supported-public-render-parameter>foo</supported-public-render-parameter>
+ </portlet>
+
<public-render-parameter>
<identifier>foo</identifier>
<name>Foo</name>
</public-render-parameter>
+ <public-render-parameter>
+ <identifier>bar</identifier>
+ <name>Bar</name>
+ </public-render-parameter>
+
</portlet-app>
18 years, 3 months
JBoss Portal SVN: r9559 - in modules/test/trunk: remote/src/main/java/org/jboss/unit/remote and 5 other directories.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-01-22 10:33:59 -0500 (Tue, 22 Jan 2008)
New Revision: 9559
Added:
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/http/
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/http/HttpHeader.java
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/http/HttpHeaders.java
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/http/HttpRequest.java
Modified:
modules/test/trunk/remote/pom.xml
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/HTTPConversation.java
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/HTTPHandler.java
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/command/DoGetCommand.java
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/command/DoMethodCommand.java
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/command/DoPostCommand.java
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/response/InvokeMethodResponse.java
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/response/InvokePostResponse.java
modules/test/trunk/tooling/examples/maven2/pom.xml
Log:
Remove JBoss Unit dependency on portal common module
Modified: modules/test/trunk/remote/pom.xml
===================================================================
--- modules/test/trunk/remote/pom.xml 2008-01-22 15:18:20 UTC (rev 9558)
+++ modules/test/trunk/remote/pom.xml 2008-01-22 15:33:59 UTC (rev 9559)
@@ -22,10 +22,6 @@
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.jboss.portal.common</groupId>
- <artifactId>common-common</artifactId>
- </dependency>
- <dependency>
<groupId>apache-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
</dependency>
Modified: modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/HTTPConversation.java
===================================================================
--- modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/HTTPConversation.java 2008-01-22 15:18:20 UTC (rev 9558)
+++ modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/HTTPConversation.java 2008-01-22 15:33:59 UTC (rev 9559)
@@ -35,9 +35,9 @@
import org.apache.commons.httpclient.auth.AuthScope;
import org.apache.commons.httpclient.params.HttpMethodParams;
import org.apache.log4j.Logger;
-import org.jboss.portal.common.http.HttpRequest;
-import org.jboss.portal.common.http.HttpHeaders;
-import org.jboss.portal.common.http.HttpHeader;
+import org.jboss.unit.remote.http.HttpRequest;
+import org.jboss.unit.remote.http.HttpHeaders;
+import org.jboss.unit.remote.http.HttpHeader;
import org.jboss.portal.test.framework.server.Node;
import org.jboss.unit.remote.driver.handler.http.command.DoMethodCommand;
import org.jboss.unit.remote.driver.handler.http.command.DoPostCommand;
Modified: modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/HTTPHandler.java
===================================================================
--- modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/HTTPHandler.java 2008-01-22 15:18:20 UTC (rev 9558)
+++ modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/HTTPHandler.java 2008-01-22 15:33:59 UTC (rev 9559)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.unit.remote.driver.handler.http;
-import org.jboss.portal.common.http.HttpRequest;
+import org.jboss.unit.remote.http.HttpRequest;
import org.jboss.unit.remote.driver.RemoteDriverResponseContext;
import org.jboss.unit.remote.driver.RemoteDriverCommandContext;
import org.jboss.unit.remote.driver.ProtocolHandler;
Modified: modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/command/DoGetCommand.java
===================================================================
--- modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/command/DoGetCommand.java 2008-01-22 15:18:20 UTC (rev 9558)
+++ modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/command/DoGetCommand.java 2008-01-22 15:33:59 UTC (rev 9559)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.unit.remote.driver.handler.http.command;
-import org.jboss.portal.common.http.HttpHeaders;
+import org.jboss.unit.remote.http.HttpHeaders;
import java.net.URI;
Modified: modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/command/DoMethodCommand.java
===================================================================
--- modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/command/DoMethodCommand.java 2008-01-22 15:18:20 UTC (rev 9558)
+++ modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/command/DoMethodCommand.java 2008-01-22 15:33:59 UTC (rev 9559)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.unit.remote.driver.handler.http.command;
-import org.jboss.portal.common.http.HttpHeaders;
+import org.jboss.unit.remote.http.HttpHeaders;
import java.net.URI;
Modified: modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/command/DoPostCommand.java
===================================================================
--- modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/command/DoPostCommand.java 2008-01-22 15:18:20 UTC (rev 9558)
+++ modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/command/DoPostCommand.java 2008-01-22 15:33:59 UTC (rev 9559)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.unit.remote.driver.handler.http.command;
-import org.jboss.portal.common.http.HttpRequest;
+import org.jboss.unit.remote.http.HttpRequest;
import java.net.URI;
Modified: modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/response/InvokeMethodResponse.java
===================================================================
--- modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/response/InvokeMethodResponse.java 2008-01-22 15:18:20 UTC (rev 9558)
+++ modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/response/InvokeMethodResponse.java 2008-01-22 15:33:59 UTC (rev 9559)
@@ -22,8 +22,8 @@
******************************************************************************/
package org.jboss.unit.remote.driver.handler.http.response;
-import org.jboss.portal.common.http.HttpHeaders;
-import org.jboss.portal.common.http.HttpHeader;
+import org.jboss.unit.remote.http.HttpHeaders;
+import org.jboss.unit.remote.http.HttpHeader;
import java.net.URI;
import java.net.URISyntaxException;
Modified: modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/response/InvokePostResponse.java
===================================================================
--- modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/response/InvokePostResponse.java 2008-01-22 15:18:20 UTC (rev 9558)
+++ modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/response/InvokePostResponse.java 2008-01-22 15:33:59 UTC (rev 9559)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.unit.remote.driver.handler.http.response;
-import org.jboss.portal.common.http.HttpRequest;
+import org.jboss.unit.remote.http.HttpRequest;
import java.net.URI;
Added: modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/http/HttpHeader.java
===================================================================
--- modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/http/HttpHeader.java (rev 0)
+++ modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/http/HttpHeader.java 2008-01-22 15:33:59 UTC (rev 9559)
@@ -0,0 +1,243 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.unit.remote.http;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Modelize an http header structure.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 7228 $
+ */
+public class HttpHeader implements Serializable
+{
+
+ /** . */
+ private String name;
+
+ /** . */
+ private List elements = new ArrayList();
+
+ public HttpHeader(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public Element addElement(String name)
+ {
+ return addElement(new Element(name));
+ }
+
+ public Element addElement(String name, String value)
+ {
+ return addElement(new Element(name, value));
+ }
+
+ public Element addElement(Element element)
+ {
+ if (element == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ elements.add(element);
+ return element;
+ }
+
+ public Element getElement()
+ {
+ if (elements.size() > 0)
+ {
+ return (Element)elements.get(0);
+ }
+ return null;
+ }
+
+ public Iterator elements()
+ {
+ return elements.iterator();
+ }
+
+ /** An element of an header */
+ public static class Element implements Serializable
+ {
+ /** The mandatory name. */
+ private String name;
+
+ /** The optional value. */
+ private String value;
+
+ /** The params. */
+ private List params;
+
+ public Element(String name)
+ {
+ this(name, null);
+ }
+
+ public Element(String name, String value)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.name = name;
+ this.value = value;
+ this.params = new ArrayList();
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public Param addParam(String name)
+ {
+ return addParam(new Param(name));
+ }
+
+ public Param addParam(String name, String value)
+ {
+ return addParam(new Param(name, value));
+ }
+
+ public Param addParam(Param param)
+ {
+ if (param == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ params.add(param);
+ return param;
+ }
+
+ /**
+ * Return the first param of this element or null.
+ *
+ * @return the first param
+ */
+ public Param getParam()
+ {
+ if (params.size() > 0)
+ {
+ return (Param)params.get(0);
+ }
+ return null;
+ }
+
+ /**
+ * Returns an iterator over the params.
+ *
+ * @return a param iterator
+ */
+ public Iterator params()
+ {
+ return params.iterator();
+ }
+
+ /** A param of an element. */
+ public static class Param implements Serializable
+ {
+ /** The mandatory name. */
+ private String name;
+
+ /** The optional value. */
+ private String value;
+
+ public Param(String name)
+ {
+ this(name, null);
+ }
+
+ public Param(String name, String value)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.name = name;
+ this.value = value;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+ }
+ }
+
+ public String getValue()
+ {
+ StringBuffer buffer = new StringBuffer();
+ for (Iterator j = elements(); j.hasNext();)
+ {
+ HttpHeader.Element elt = (HttpHeader.Element)j.next();
+ buffer.append(elt.getName());
+ if (elt.getValue() != null)
+ {
+ buffer.append("=").append(elt.getValue());
+ }
+ for (Iterator k = elt.params(); k.hasNext();)
+ {
+ HttpHeader.Element.Param param = (HttpHeader.Element.Param)k.next();
+ buffer.append(";").append(param.getName());
+ if (param.getValue() != null)
+ {
+ buffer.append("=").append(param.getValue());
+ }
+ }
+ if (j.hasNext())
+ {
+ buffer.append(",");
+ }
+ }
+ return buffer.toString();
+ }
+
+ public String toString()
+ {
+ return name + ": " + getValue();
+ }
+}
+
Added: modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/http/HttpHeaders.java
===================================================================
--- modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/http/HttpHeaders.java (rev 0)
+++ modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/http/HttpHeaders.java 2008-01-22 15:33:59 UTC (rev 9559)
@@ -0,0 +1,90 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.unit.remote.http;
+import org.jboss.unit.remote.http.*;
+import org.jboss.unit.remote.http.HttpHeader;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 7228 $
+ */
+public class HttpHeaders implements Serializable
+{
+
+ /** . */
+ private List headers = new ArrayList();
+
+ public HttpHeader addHeader(String name)
+ {
+ return addHeader(new HttpHeader(name));
+ }
+
+ public HttpHeader addHeader(HttpHeader header)
+ {
+ if (header == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ headers.add(header);
+ return header;
+ }
+
+ public HttpHeader getHeader(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ for (Iterator i = headers.iterator(); i.hasNext();)
+ {
+ HttpHeader header = (HttpHeader)i.next();
+ if (header.getName().equals(name))
+ {
+ return header;
+ }
+ }
+ return null;
+ }
+
+ public Iterator headers()
+ {
+ return headers.iterator();
+ }
+
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer();
+ for (Iterator i = headers.iterator(); i.hasNext();)
+ {
+ HttpHeader header = (HttpHeader)i.next();
+ buffer.append(header.toString());
+ buffer.append("\n");
+ }
+ return buffer.toString();
+ }
+}
Added: modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/http/HttpRequest.java
===================================================================
--- modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/http/HttpRequest.java (rev 0)
+++ modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/http/HttpRequest.java 2008-01-22 15:33:59 UTC (rev 9559)
@@ -0,0 +1,112 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.unit.remote.http;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Just used to define the request body.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 7228 $
+ */
+public class HttpRequest implements Serializable
+{
+
+ public abstract static class Body implements Serializable
+ {
+ }
+
+ public static class Raw extends Body
+ {
+
+ /** . */
+ private byte[] bytes;
+
+ public byte[] getBytes()
+ {
+ return bytes;
+ }
+
+ public void setBytes(byte[] bytes)
+ {
+ this.bytes = bytes;
+ }
+ }
+
+ public static class Form extends Body
+ {
+
+ /** . */
+ private Map parameters = new HashMap();
+
+ public void addParameter(String name, String[] values)
+ {
+ if (name == null)
+ {
+ throw new IllegalStateException();
+ }
+ if (values == null)
+ {
+ throw new IllegalStateException();
+ }
+ for (int i = 0; i < values.length; i++)
+ {
+ String value = values[i];
+ if (value == null)
+ {
+ throw new IllegalStateException();
+ }
+ }
+ parameters.put(name, values.clone());
+ }
+
+ public void removeParameter(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalStateException();
+ }
+ parameters.remove(name);
+ }
+
+ public Set getParameterNames()
+ {
+ return Collections.unmodifiableSet(parameters.keySet());
+ }
+
+ public String[] getParameterValues(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalStateException();
+ }
+ String[] values = (String[])parameters.get(name);
+ return (String[])values.clone();
+ }
+ }
+}
Modified: modules/test/trunk/tooling/examples/maven2/pom.xml
===================================================================
--- modules/test/trunk/tooling/examples/maven2/pom.xml 2008-01-22 15:18:20 UTC (rev 9558)
+++ modules/test/trunk/tooling/examples/maven2/pom.xml 2008-01-22 15:33:59 UTC (rev 9559)
@@ -50,9 +50,12 @@
</executions>
<configuration>
- <jpda>true</jpda>
- <!--<jpdaPort>9000</jpdaPort>
- <jpdaSuspend>true</jpdaSuspend>-->
+ <!--Uncomment if needed-->
+ <!--<jpda>false</jpda>-->
+ <!--<jpdaPort>9000</jpdaPort>-->
+ <!--<jpdaSuspend>true</jpdaSuspend>-->
+ <!--<failOnError>false</failOnError>-->
+ <!--<assertions>true</assertions>-->
<testsuites>
<testsuite>
18 years, 3 months
JBoss Portal SVN: r9558 - modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-01-22 10:18:20 -0500 (Tue, 22 Jan 2008)
New Revision: 9558
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/Assertion.java
Log:
change order of stuff in Assertion
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/Assertion.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/Assertion.java 2008-01-22 15:13:40 UTC (rev 9557)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/Assertion.java 2008-01-22 15:18:20 UTC (rev 9558)
@@ -462,15 +462,15 @@
// PLT.11 Portlet Requests
- JSR286_67(new TCK(67), "PLT.11.1.1", "If a portlet receives a request from a client request targeted to the " +
+ JSR286_67(new TCK(67), JSR168_48, "PLT.11.1.1", "If a portlet receives a request from a client request targeted to the " +
"portlet itself, the parameters must be the string parameters encoded in the URL (added when creating the " +
- "PortletURL) and the string parameters sent by the client to the portlet as part of the client request.", JSR168_48),
- JSR286_68(new TCK(68), "PLT.11.1.1", "The parameters the request object returns must be \"x-www-formurlencoded\" " +
- "decoded.", JSR168_49),
- JSR286_69(new TCK(69), "PLT.11.1.1", "The value returned from the getParameter method must be the first value in " +
- "the array of String objects returned by getParameterValues", JSR168_55),
- JSR286_70(new TCK(70), "PLT.11.1.1", "If there is a single parameter value associated with a parameter name the " +
- "method must return is an array of size one containing the parameter value.", JSR168_56),
+ "PortletURL) and the string parameters sent by the client to the portlet as part of the client request."),
+ JSR286_68(new TCK(68), JSR168_49, "PLT.11.1.1", "The parameters the request object returns must be \"x-www-formurlencoded\" " +
+ "decoded."),
+ JSR286_69(new TCK(69), JSR168_55, "PLT.11.1.1", "The value returned from the getParameter method must be the first value in " +
+ "the array of String objects returned by getParameterValues"),
+ JSR286_70(new TCK(70), JSR168_56, "PLT.11.1.1", "If there is a single parameter value associated with a parameter name the " +
+ "method must return is an array of size one containing the parameter value."),
JSR286_71(new TCK(71), "PLT.11.1.1", "The getParameterMap method must return an unmodifiable Map object."),
JSR286_72(new TCK(72), "PLT.11.1.1", "If the request does not have any parameters, the getParameterMap must return " +
"an empty Map object"),
@@ -508,8 +508,8 @@
JSR286_86(new TCK(86), "PLT.11.1.2", "Portlets can access a merged set of public and private parameters via the " +
"getParameter methods on the PortletRequest or separated as maps of private parameters via the " +
"getPrivateParameterMap method and public parameters via the getPublicParameterMap method."),
- JSR286_87(new TCK(87), "PLT.11.1.3", "Extra parameters used by the portal/portlet-container must be invisible " +
- "to the portlets receiving the request.", JSR168_57),
+ JSR286_87(new TCK(87), JSR168_57, "PLT.11.1.3", "Extra parameters used by the portal/portlet-container must be invisible " +
+ "to the portlets receiving the request."),
JSR286_88(new TCK(88), "PLT.11.1.4.1", "The portlet can access a map with user information attributes via the " +
"request attribute PortletRequest.USER_INFO."),
JSR286_89(new TCK(89), "PLT.11.1.4.2", "The PortletRequest.CCPP_PROFILE request attribute must return a " +
@@ -519,14 +519,13 @@
"ACTION_PHASE if the current request is of type ActionRequest, EVENT_PHASE if the current request is of type " +
"EventRequest, RENDER_PHASE if the current request is of type RenderRequest, and RESOURCE_SERVING_PHASE if the " +
"current request is of type ResourceRequest."),
- JSR286_91(new TCK(91), "PLT.11.1.6", "If the portlet application is rooted at the base of the web server URL " +
- "namespace (also known as \"default\" context), this path must be an empty string.", JSR168_58),
- JSR286_92(new TCK(92), "PLT.11.1.6", "Otherwise, it must be the path the portlet application is rooted to, the " +
- "path must start with a '/' and it must not end with a '/' character.", JSR168_59),
- JSR286_93(new TCK(93), "PLT.11.1.7", "If the user is not authenticated the getAuthType method must return null. ",
- JSR168_60),
- JSR286_94(new TCK(94), "PLT.11.1.8", "The first element of the enumeration must be the same content type returned " +
- "by the getResponseContentType method.", JSR168_61),
+ JSR286_91(new TCK(91), JSR168_58, "PLT.11.1.6", "If the portlet application is rooted at the base of the web server URL " +
+ "namespace (also known as \"default\" context), this path must be an empty string."),
+ JSR286_92(new TCK(92), JSR168_59, "PLT.11.1.6", "Otherwise, it must be the path the portlet application is rooted to, the " +
+ "path must start with a '/' and it must not end with a '/' character."),
+ JSR286_93(new TCK(93), JSR168_60, "PLT.11.1.7", "If the user is not authenticated the getAuthType method must return null. "),
+ JSR286_94(new TCK(94), JSR168_61, "PLT.11.1.8", "The first element of the enumeration must be the same content type returned " +
+ "by the getResponseContentType method."),
JSR286_95(new TCK(95), "PLT.11.1.8", "If the getResponseContentType or getResponseContentTypes methods are exposed " +
"via an ActionRequest, EventRequest, or RenderRequest the following additional restrictions apply: The content " +
"type must only includes the MIME type, not the character set."),
@@ -536,10 +535,10 @@
"of the portlet."),
JSR286_97(new TCK(97), "PLT.11.1.12", "The portlet window ID retrieved with the getWindowID method must be the " +
"same as the one that is used by the portlet container for scoping the portlet-scope session attributes."),
- JSR286_98(new TCK(98), "PLT.11.2.1", "Only one of the two methods, getPortletInputStream or getReader, can be " +
+ JSR286_98(new TCK(98), JSR168_63, "PLT.11.2.1", "Only one of the two methods, getPortletInputStream or getReader, can be " +
"used during an action request. If the input stream is obtained, a call to the getReader must throw an " +
"IllegalStateException. Similarly, if the reader is obtained, a call to the getPortletInputStream must throw " +
- "an IllegalStateException.", JSR168_63),
+ "an IllegalStateException."),
JSR286_99(new TCK(99), "PLT.11.2.1", "If the user request HTTP POST data is of type " +
"application/x-www-form-urlencoded, this data has been already processed by the portal/portlet-container and " +
"is available as request parameters. The getPortletInputStream and getReader methods must throw an " +
@@ -771,9 +770,9 @@
this(ref, description, section, new Active());
}
- Assertion(Ref ref, String section, String description, Assertion assertion)
+ Assertion(Ref ref, Assertion assertion, String section, String description)
{
- this(ref, description, section, new Active(), assertion);
+ this(ref, assertion, description, section, new Active());
}
Assertion(Ref ref, String description, Status status)
@@ -792,7 +791,7 @@
this.status = status;
}
- Assertion(Ref ref, String section, String description, Status status, Assertion assertion)
+ Assertion(Ref ref, Assertion assertion, String section, String description, Status status)
{
this.ref = ref;
this.description = description;
18 years, 3 months