Author: julien(a)jboss.com
Date: 2008-02-04 11:04:08 -0500 (Mon, 04 Feb 2008)
New Revision: 9745
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/RequestAttributeConversationInterceptor.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletcontext/
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletcontext/ClearScopeTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletcontext/EventPhaseCreateNewScopeForRenderedScopesTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletcontext/RefreshScopedRenderPhaseTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletcontext/RenderURLCreateNewScopeTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletcontext/ScopePropagationToEventPhaseTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletcontext/ScopePropagationToRenderPhaseTestCase.java
modules/portlet/trunk/test/src/test/resources/jsr286/ext/portletcontext-war/
modules/portlet/trunk/test/src/test/resources/jsr286/ext/portletcontext-war/WEB-INF/
modules/portlet/trunk/test/src/test/resources/jsr286/ext/portletcontext-war/WEB-INF/portlet.xml
modules/portlet/trunk/test/src/test/resources/jsr286/ext/portletcontext-war/WEB-INF/web.xml
Modified:
modules/portlet/trunk/test/src/test/build.xml
modules/portlet/trunk/test/src/test/resources/portlet-test-war/WEB-INF/jboss-beans.xml
modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/jboss-beans.xml
modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml
Log:
implementation of request scoped action attributes
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/RequestAttributeConversationInterceptor.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/RequestAttributeConversationInterceptor.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/RequestAttributeConversationInterceptor.java 2008-02-04
16:04:08 UTC (rev 9745)
@@ -0,0 +1,314 @@
+/******************************************************************************
+ * 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.portlet.aspects.portlet;
+
+import org.jboss.portal.portlet.invocation.PortletInterceptor;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.ActionInvocation;
+import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.invocation.EventInvocation;
+import org.jboss.portal.portlet.invocation.ResourceInvocation;
+import org.jboss.portal.portlet.invocation.response.UpdateNavigationalStateResponse;
+import org.jboss.portal.portlet.container.PortletContainer;
+import org.jboss.portal.portlet.container.PortletContainerInvoker;
+import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
+import org.jboss.portal.portlet.impl.info.ContainerOptionInfo;
+import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.common.util.UUIDGenerator;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionBindingListener;
+import javax.servlet.http.HttpSessionBindingEvent;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class RequestAttributeConversationInterceptor extends PortletInterceptor
+{
+
+ /** . */
+ private static final UUIDGenerator generator = new UUIDGenerator();
+
+ protected Object invoke(PortletInvocation invocation) throws Exception,
InvocationException
+ {
+ PortletContainer container =
(PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PortletContainerInvoker.PORTLET_CONTAINER);
+ ContainerPortletInfo containerInfo = (ContainerPortletInfo)container.getInfo();
+
+ //
+ Map<String, ContainerOptionInfo> options = containerInfo.getOptions();
+ ContainerOptionInfo scopingOption =
options.get("javax.portlet.actionScopedRequestAttributes");
+
+ //
+ boolean active = scopingOption != null &&
"true".equals(scopingOption.getValues().get(0));
+
+ //
+ if (active)
+ {
+ if (invocation instanceof ActionInvocation)
+ {
+ return invoke((ActionInvocation)invocation);
+ }
+ else if (invocation instanceof EventInvocation)
+ {
+ return invoke((EventInvocation)invocation);
+ }
+ else if (invocation instanceof RenderInvocation)
+ {
+ return invoke((RenderInvocation)invocation);
+ }
+ else if (invocation instanceof ResourceInvocation)
+ {
+ return invoke((ResourceInvocation)invocation);
+ }
+ else
+ {
+ return invocation.invokeNext();
+ }
+ }
+ else
+ {
+ return invocation.invokeNext();
+ }
+ }
+
+ private Object invoke(ActionInvocation actionInvocation) throws Exception,
InvocationException
+ {
+ return invokeWithConversation(new Conversation(), actionInvocation);
+ }
+
+ private Object invoke(EventInvocation eventInvocation) throws Exception,
InvocationException
+ {
+ Conversation conversation = loadConversation(eventInvocation);
+
+ //
+ if (conversation == null || conversation.rendered)
+ {
+ conversation = new Conversation();
+ }
+
+ //
+ return invokeWithConversation(conversation, eventInvocation);
+ }
+
+ private Object invoke(RenderInvocation renderInvocation) throws Exception,
InvocationException
+ {
+ Conversation conversation = loadConversation(renderInvocation);
+
+ //
+ if (conversation != null)
+ {
+ conversation.rendered = true;
+
+ //
+ return invokeWithConversation(conversation, renderInvocation);
+ }
+ else
+ {
+ return renderInvocation.invokeNext();
+ }
+ }
+
+ private Object invoke(ResourceInvocation resourceInvocation) throws Exception,
InvocationException
+ {
+ return resourceInvocation.invokeNext();
+ }
+
+ private Conversation loadConversation(PortletInvocation invocation)
+ {
+ ParametersStateString parameters =
(ParametersStateString)invocation.getNavigationalState();
+
+ //
+ if (parameters != null)
+ {
+ String id = parameters.getValue("javax.portlet.as");
+
+ //
+ if (id != null)
+ {
+ // Get the http session
+ HttpServletRequest request = invocation.getDispatchedRequest();
+
+ // No need to create an unnecessary session
+ HttpSession session = request.getSession(false);
+
+ //
+ if (session != null)
+ {
+ // Generate key
+ String key = "org.jboss.portal.portlet.conversation." + id;
+
+ // Get attributes
+ return (Conversation)session.getAttribute(key);
+ }
+ }
+ }
+
+ //
+ return null;
+ }
+
+ private Object invokeWithConversation(Conversation conversation, PortletInvocation
invocation) throws Exception, InvocationException
+ {
+ invocation.setAttributes(conversation.getAttributes());
+
+ // Set the id parameter
+ ParametersStateString inNS =
(ParametersStateString)invocation.getNavigationalState();
+ if (inNS == null)
+ {
+ inNS = ParametersStateString.create();
+ invocation.setNavigationalState(inNS);
+ }
+ inNS.setValue("javax.portlet.as", conversation.id);
+
+ //
+ Object response = invocation.invokeNext();
+
+ //
+ if (response instanceof UpdateNavigationalStateResponse)
+ {
+ UpdateNavigationalStateResponse update =
(UpdateNavigationalStateResponse)response;
+
+ //
+ Map<String, Object> attributes = update.getAttributes();
+
+ //
+ if (attributes != null && attributes.size() > 0)
+ {
+ ParametersStateString outNS =
(ParametersStateString)update.getNavigationalState();
+ outNS.setValue("javax.portlet.as", conversation.id);
+
+ //
+ conversation.setAttributes(attributes);
+
+ //
+ if (!conversation.stored)
+ {
+ // Get the http session
+ HttpServletRequest request = invocation.getDispatchedRequest();
+
+ //
+ HttpSession session = request.getSession();
+
+ //
+ String key = "org.jboss.portal.portlet.conversation." +
conversation.id;
+
+ //
+ session.setAttribute(key, conversation);
+ }
+ }
+ else
+ {
+ if (conversation.stored)
+ {
+ // Get the http session
+ HttpServletRequest request = invocation.getDispatchedRequest();
+
+ //
+ HttpSession session = request.getSession();
+
+ //
+ String key = "org.jboss.portal.portlet.conversation." +
conversation.id;
+
+ //
+ session.removeAttribute(key);
+ }
+ }
+ }
+
+ //
+ return response;
+ }
+
+ private static class Conversation implements HttpSessionBindingListener
+ {
+
+ private static final Map<String, Object> EMPTY_ATTRIBUTES =
Collections.emptyMap();
+
+ /** . */
+ private final String id = generator.generateKey();
+
+ /** . */
+ private boolean rendered;
+
+ /** . */
+// private long lastModifiedMillis;
+
+ /** . */
+ private Map<String, Object> attributes;
+
+ /** . */
+ private Map<String, Object> unmodifiableAttributes;
+
+ /** . */
+ private boolean stored;
+
+ private Conversation()
+ {
+ this.rendered = false;
+ this.attributes = null;
+ this.unmodifiableAttributes = EMPTY_ATTRIBUTES;
+ }
+
+ private Conversation(Map<String, Object> attributes)
+ {
+ this.rendered = false;
+ this.attributes = new HashMap<String, Object>(attributes);
+ this.unmodifiableAttributes = Collections.unmodifiableMap(attributes);
+ }
+
+ public Map<String, Object> getAttributes()
+ {
+ return unmodifiableAttributes;
+ }
+
+ public void setAttributes(Map<String, Object> attributes)
+ {
+ if (this.attributes == null)
+ {
+ this.attributes = new HashMap<String, Object>(attributes);
+ this.unmodifiableAttributes = Collections.unmodifiableMap(this.attributes);
+ }
+ else
+ {
+ this.attributes.clear();
+ this.attributes.putAll(attributes);
+ }
+ }
+
+ public void valueBound(HttpSessionBindingEvent event)
+ {
+ this.stored = true;
+ }
+
+ public void valueUnbound(HttpSessionBindingEvent event)
+ {
+ this.stored = false;
+ }
+ }
+}
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletcontext/ClearScopeTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletcontext/ClearScopeTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletcontext/ClearScopeTestCase.java 2008-02-04
16:04:08 UTC (rev 9745)
@@ -0,0 +1,115 @@
+/******************************************************************************
+ * 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.portletcontext;
+
+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.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletRequest;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+@TestCase
+public class ClearScopeTestCase
+{
+ public ClearScopeTestCase(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
+ {
+ assertNull(request.getParameter(PortletRequest.ACTION_SCOPE_ID));
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+ seq.bindAction(1, UTP1.ACTION_JOIN_POINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws PortletException, IOException
+ {
+ assertNull(request.getParameter(PortletRequest.ACTION_SCOPE_ID));
+ request.setAttribute("foo", "foo");
+ request.removeAttribute("foo");
+ }
+ });
+ seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ assertEquals(null, request.getAttribute("foo"));
+ assertEquals(null, request.getParameter(PortletRequest.ACTION_SCOPE_ID));
+
+ //
+ 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
+ {
+ assertNull(request.getParameter(PortletRequest.ACTION_SCOPE_ID));
+ request.setAttribute("foo", "foo");
+ response.setEvent("Event", null);
+ }
+ });
+ seq.bindAction(2, UTP1.EVENT_JOIN_POINT, new PortletEventTestAction()
+ {
+ protected void run(Portlet portlet, EventRequest request, EventResponse
response, PortletTestContext context) throws PortletException, IOException
+ {
+ assertNotNull(request.getParameter(PortletRequest.ACTION_SCOPE_ID));
+ assertEquals("foo", request.getAttribute("foo"));
+ request.removeAttribute("foo");
+ }
+ });
+ seq.bindAction(2, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ assertEquals(null, request.getAttribute("foo"));
+ assertEquals(null, request.getParameter(PortletRequest.ACTION_SCOPE_ID));
+
+ //
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletcontext/EventPhaseCreateNewScopeForRenderedScopesTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletcontext/EventPhaseCreateNewScopeForRenderedScopesTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletcontext/EventPhaseCreateNewScopeForRenderedScopesTestCase.java 2008-02-04
16:04:08 UTC (rev 9745)
@@ -0,0 +1,133 @@
+/******************************************************************************
+ * 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.portletcontext;
+
+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.PortletTestContext;
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.framework.UTP2;
+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.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import javax.portlet.PortletRequest;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+@TestCase
+public class EventPhaseCreateNewScopeForRenderedScopesTestCase
+{
+
+ /** . */
+ private String scopedId1;
+
+ /** . */
+ private String scopedId2;
+
+ public EventPhaseCreateNewScopeForRenderedScopesTestCase(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
+ {
+ assertNull(request.getParameter(PortletRequest.ACTION_SCOPE_ID));
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+ seq.bindAction(1, UTP1.ACTION_JOIN_POINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws PortletException, IOException
+ {
+ assertNull(request.getParameter(PortletRequest.ACTION_SCOPE_ID));
+ request.setAttribute("foo", "foo_1");
+ }
+ });
+ seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ scopedId1 =
assertNotNull(request.getParameter(PortletRequest.ACTION_SCOPE_ID));
+ assertEquals("foo_1", request.getAttribute("foo"));
+
+ //
+ return null;
+ }
+ });
+ seq.bindAction(1, UTP2.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ assertNull(request.getParameter(PortletRequest.ACTION_SCOPE_ID));
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+ seq.bindAction(2, UTP2.ACTION_JOIN_POINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws PortletException, IOException
+ {
+ // Send an event to UTP1 which should create a new scope
+ assertNull(request.getParameter(PortletRequest.ACTION_SCOPE_ID));
+ response.setEvent("Event", null);
+ }
+ });
+ seq.bindAction(2, UTP1.EVENT_JOIN_POINT, new PortletEventTestAction()
+ {
+ protected void run(Portlet portlet, EventRequest request, EventResponse
response, PortletTestContext context) throws PortletException, IOException
+ {
+ scopedId2 =
assertNotNull(request.getParameter(PortletRequest.ACTION_SCOPE_ID));
+ assertNotEquals(scopedId1, scopedId2);
+ assertEquals(null, request.getAttribute("foo"));
+
+ //
+ request.setAttribute("foo", "foo_2");
+ }
+ });
+ seq.bindAction(2, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ assertEquals(scopedId2,
request.getParameter(PortletRequest.ACTION_SCOPE_ID));
+ assertEquals("foo_2", request.getAttribute("foo"));
+
+ //
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletcontext/RefreshScopedRenderPhaseTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletcontext/RefreshScopedRenderPhaseTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletcontext/RefreshScopedRenderPhaseTestCase.java 2008-02-04
16:04:08 UTC (rev 9745)
@@ -0,0 +1,161 @@
+/******************************************************************************
+ * 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.portletcontext;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+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.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.framework.UTP2;
+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.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import javax.portlet.PortletRequest;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+@TestCase
+public class RefreshScopedRenderPhaseTestCase
+{
+
+ /** . */
+ private String scopedId1;
+
+ /** . */
+ private String scopedId2;
+
+ /** . */
+ private String refresh1;
+
+ /** . */
+ private String refresh2;
+
+ public RefreshScopedRenderPhaseTestCase(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
+ {
+ assertNull(request.getParameter(PortletRequest.ACTION_SCOPE_ID));
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+ seq.bindAction(1, UTP1.ACTION_JOIN_POINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws PortletException, IOException
+ {
+ assertNull(request.getParameter(PortletRequest.ACTION_SCOPE_ID));
+ request.setAttribute("foo", "foo_1");
+ }
+ });
+ seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ scopedId1 =
assertNotNull(request.getParameter(PortletRequest.ACTION_SCOPE_ID));
+ assertEquals("foo_1", request.getAttribute("foo"));
+
+ //
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+ seq.bindAction(1, UTP2.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ refresh1 = response.createRenderURL().toString();
+
+ //
+ return null;
+ }
+ });
+ seq.bindAction(2, UTP1.ACTION_JOIN_POINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws PortletException, IOException
+ {
+ assertNull(request.getParameter(PortletRequest.ACTION_SCOPE_ID));
+ request.setAttribute("foo", "foo_2");
+ }
+ });
+ seq.bindAction(2, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ scopedId2 =
assertNotNull(request.getParameter(PortletRequest.ACTION_SCOPE_ID));
+ assertNotEquals(scopedId1, scopedId2);
+ assertEquals("foo_2", request.getAttribute("foo"));
+
+ //
+ return new InvokeGetResponse(refresh1);
+ }
+ });
+ seq.bindAction(2, UTP2.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ refresh2 = response.createRenderURL().toString();
+
+ //
+ return null;
+ }
+ });
+ seq.bindAction(3, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ assertEquals(scopedId1,
request.getParameter(PortletRequest.ACTION_SCOPE_ID));
+ assertEquals("foo_1", request.getAttribute("foo"));
+
+ //
+ return new InvokeGetResponse(refresh2);
+ }
+ });
+ seq.bindAction(4, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ assertEquals(scopedId2,
request.getParameter(PortletRequest.ACTION_SCOPE_ID));
+ assertEquals("foo_2", request.getAttribute("foo"));
+
+ //
+ return new EndTestResponse();
+ }
+ });
+ }
+}
\ No newline at end of file
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletcontext/RenderURLCreateNewScopeTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletcontext/RenderURLCreateNewScopeTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletcontext/RenderURLCreateNewScopeTestCase.java 2008-02-04
16:04:08 UTC (rev 9745)
@@ -0,0 +1,94 @@
+/******************************************************************************
+ * 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.portletcontext;
+
+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.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.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletRequest;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+@TestCase
+public class RenderURLCreateNewScopeTestCase
+{
+
+ public RenderURLCreateNewScopeTestCase(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
+ {
+ assertNull(request.getParameter(PortletRequest.ACTION_SCOPE_ID));
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+ seq.bindAction(1, UTP1.ACTION_JOIN_POINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws PortletException, IOException
+ {
+ assertNull(request.getParameter(PortletRequest.ACTION_SCOPE_ID));
+ request.setAttribute("foo", "foo_1");
+ }
+ });
+ seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ assertNotNull(request.getParameter(PortletRequest.ACTION_SCOPE_ID));
+ assertEquals("foo_1", request.getAttribute("foo"));
+
+ //
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+ seq.bindAction(2, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ assertNull(request.getParameter(PortletRequest.ACTION_SCOPE_ID));
+ assertEquals(null, request.getAttribute("foo"));
+
+ //
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletcontext/ScopePropagationToEventPhaseTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletcontext/ScopePropagationToEventPhaseTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletcontext/ScopePropagationToEventPhaseTestCase.java 2008-02-04
16:04:08 UTC (rev 9745)
@@ -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.portletcontext;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+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.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.framework.UTP2;
+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.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+@TestCase
+public class ScopePropagationToEventPhaseTestCase
+{
+ public ScopePropagationToEventPhaseTestCase(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
+ {
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+ seq.bindAction(1, UTP1.ACTION_JOIN_POINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws PortletException, IOException
+ {
+ request.setAttribute("action_attr1",
"action_attr1_action_value");
+ request.setAttribute("action_attr2",
"action_attr2_action_value");
+ request.setAttribute("action_attr3",
"action_attr3_action_value");
+ request.setAttribute("action_attr4",
"action_attr4_action_value");
+ response.setEvent("Event", null);
+ }
+ });
+ seq.bindAction(1, UTP1.EVENT_JOIN_POINT, new PortletEventTestAction()
+ {
+ protected void run(Portlet portlet, EventRequest request, EventResponse
response, PortletTestContext context) throws PortletException, IOException
+ {
+ if (request.getEvent().getValue() == null)
+ {
+ assertEquals("action_attr1_action_value",
request.getAttribute("action_attr1"));
+ assertEquals("action_attr2_action_value",
request.getAttribute("action_attr2"));
+ assertEquals("action_attr3_action_value",
request.getAttribute("action_attr3"));
+ assertEquals("action_attr4_action_value",
request.getAttribute("action_attr4"));
+
+ //
+ request.setAttribute("action_attr2",
"action_attr2_event0_value");
+ request.setAttribute("action_attr3",
"action_attr3_event0_value");
+ request.setAttribute("event_attr1",
"event_attr1_event0_value");
+ request.setAttribute("event_attr2",
"event_attr2_event0_value");
+
+ //
+ response.setEvent("Event", "this string is a non null
object");
+ }
+ else
+ {
+ assertEquals("action_attr1_action_value",
request.getAttribute("action_attr1"));
+ assertEquals("action_attr2_event0_value",
request.getAttribute("action_attr2"));
+ assertEquals("action_attr3_event0_value",
request.getAttribute("action_attr3"));
+ assertEquals("action_attr4_action_value",
request.getAttribute("action_attr4"));
+ assertEquals("event_attr1_event0_value",
request.getAttribute("event_attr1"));
+ assertEquals("event_attr2_event0_value",
request.getAttribute("event_attr2"));
+
+ //
+ request.setAttribute("action_attr3",
"action_attr3_event1_value");
+ request.setAttribute("action_attr4",
"action_attr3_event1_value");
+ request.setAttribute("event_attr2",
"event_attr2_event1_value");
+ request.setAttribute("event_attr3",
"event_attr3_event1_value");
+ }
+ }
+ });
+ seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ assertEquals("action_attr1_action_value",
request.getAttribute("action_attr1"));
+ assertEquals("action_attr2_event0_value",
request.getAttribute("action_attr2"));
+ assertEquals("action_attr3_event1_value",
request.getAttribute("action_attr3"));
+ assertEquals("action_attr3_event1_value",
request.getAttribute("action_attr4"));
+ assertEquals("event_attr1_event0_value",
request.getAttribute("event_attr1"));
+ assertEquals("event_attr2_event1_value",
request.getAttribute("event_attr2"));
+ assertEquals("event_attr3_event1_value",
request.getAttribute("event_attr3"));
+
+ //
+ return new EndTestResponse();
+ }
+ });
+ }
+}
\ No newline at end of file
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletcontext/ScopePropagationToRenderPhaseTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletcontext/ScopePropagationToRenderPhaseTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletcontext/ScopePropagationToRenderPhaseTestCase.java 2008-02-04
16:04:08 UTC (rev 9745)
@@ -0,0 +1,81 @@
+/******************************************************************************
+ * 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.portletcontext;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+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.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.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletRequest;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+@TestCase
+public class ScopePropagationToRenderPhaseTestCase
+{
+ public ScopePropagationToRenderPhaseTestCase(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
+ {
+ assertNull(request.getParameter(PortletRequest.ACTION_SCOPE_ID));
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+ seq.bindAction(1, UTP1.ACTION_JOIN_POINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws PortletException, IOException
+ {
+ assertNull(request.getParameter(PortletRequest.ACTION_SCOPE_ID));
+ request.setAttribute("foo", "bar");
+ }
+ });
+ seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ assertNotNull(request.getParameter(PortletRequest.ACTION_SCOPE_ID));
+ Object bar = request.getAttribute("foo");
+ assertEquals("bar", bar);
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Modified: modules/portlet/trunk/test/src/test/build.xml
===================================================================
--- modules/portlet/trunk/test/src/test/build.xml 2008-02-04 14:05:42 UTC (rev 9744)
+++ modules/portlet/trunk/test/src/test/build.xml 2008-02-04 16:04:08 UTC (rev 9745)
@@ -375,6 +375,7 @@
<package-jsr286-ext-test test="portletfilter"/>
<package-jsr286-ext-test test="portletresponses"/>
<package-jsr286-ext-test test="dispatcher"/>
+ <package-jsr286-ext-test test="portletcontext"/>
<!-- -->
<jar jarfile="${test.temp.lib}/portlet-test-lib.jar">
Added:
modules/portlet/trunk/test/src/test/resources/jsr286/ext/portletcontext-war/WEB-INF/portlet.xml
===================================================================
---
modules/portlet/trunk/test/src/test/resources/jsr286/ext/portletcontext-war/WEB-INF/portlet.xml
(rev 0)
+++
modules/portlet/trunk/test/src/test/resources/jsr286/ext/portletcontext-war/WEB-INF/portlet.xml 2008-02-04
16:04:08 UTC (rev 9745)
@@ -0,0 +1,63 @@
+<?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...
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>
+ <container-runtime-option>
+ <name>javax.portlet.actionScopedRequestAttributes</name>
+ <value>true</value>
+ </container-runtime-option>
+ </portlet>
+
+ <portlet>
+ <portlet-name>UniversalTestPortletB</portlet-name>
+
<portlet-class>org.jboss.portal.test.portlet.framework.UTP2</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <supported-publishing-event>
+ <name>Event</name>
+ </supported-publishing-event>
+ </portlet>
+
+ <event-definition>
+ <name>Event</name>
+ </event-definition>
+
+</portlet-app>
Added:
modules/portlet/trunk/test/src/test/resources/jsr286/ext/portletcontext-war/WEB-INF/web.xml
===================================================================
---
modules/portlet/trunk/test/src/test/resources/jsr286/ext/portletcontext-war/WEB-INF/web.xml
(rev 0)
+++
modules/portlet/trunk/test/src/test/resources/jsr286/ext/portletcontext-war/WEB-INF/web.xml 2008-02-04
16:04:08 UTC (rev 9745)
@@ -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/portlet-test-war/WEB-INF/jboss-beans.xml
===================================================================
---
modules/portlet/trunk/test/src/test/resources/portlet-test-war/WEB-INF/jboss-beans.xml 2008-02-04
14:05:42 UTC (rev 9744)
+++
modules/portlet/trunk/test/src/test/resources/portlet-test-war/WEB-INF/jboss-beans.xml 2008-02-04
16:04:08 UTC (rev 9745)
@@ -83,6 +83,7 @@
<property name="servletContainerFactory"><inject
bean="ServletContainerFactory"/></property>
</bean>
<bean name="ProducerCacheInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.ProducerCacheInterceptor"/>
+ <bean name="RequestAttributeConversationInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.RequestAttributeConversationInterceptor"/>
<bean name="ContainerStackFactory"
class="org.jboss.portal.portlet.test.InterceptorStackFactoryImpl">
<property name="interceptors">
<array>
@@ -90,6 +91,7 @@
<inject bean="SecureTransportInterceptor"/>
<inject bean="ContextDispatcherInterceptor"/>
<inject bean="ProducerCacheInterceptor"/>
+ <inject bean="RequestAttributeConversationInterceptor"/>
</array>
</property>
</bean>
Modified:
modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/jboss-beans.xml
===================================================================
---
modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/jboss-beans.xml 2008-02-04
14:05:42 UTC (rev 9744)
+++
modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/jboss-beans.xml 2008-02-04
16:04:08 UTC (rev 9745)
@@ -71,6 +71,7 @@
<property name="servletContainerFactory"><inject
bean="ServletContainerFactory"/></property>
</bean>
<bean name="ProducerCacheInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.ProducerCacheInterceptor"/>
+ <bean name="RequestAttributeConversationInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.RequestAttributeConversationInterceptor"/>
<bean name="ContainerStackFactory"
class="org.jboss.portal.portlet.test.InterceptorStackFactoryImpl">
<property name="interceptors">
<array>
@@ -78,6 +79,7 @@
<inject bean="SecureTransportInterceptor"/>
<inject bean="ContextDispatcherInterceptor"/>
<inject bean="ProducerCacheInterceptor"/>
+ <inject bean="RequestAttributeConversationInterceptor"/>
</array>
</property>
</bean>
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-02-04
14:05:42 UTC (rev 9744)
+++ modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml 2008-02-04
16:04:08 UTC (rev 9745)
@@ -215,6 +215,10 @@
<class
name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId"
value="test-jsr286-ext-portletfilter.war"/>
</generic>
+ <generic>
+ <class
name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
+ <property name="archiveId"
value="test-jsr286-ext-portletcontext.war"/>
+ </generic>
<!--Misc Tests-->
<!--