JBoss Portal SVN: r10143 - in modules/portlet/trunk: portlet/src/main/java/org/jboss/portal/portlet/invocation and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-27 18:33:14 -0500 (Wed, 27 Feb 2008)
New Revision: 10143
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/MimeResponseImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/PortletInvocation.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/TestPortletInvocationContext.java
Log:
remove legacy request/response properties in PortletInvocation
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/MimeResponseImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/MimeResponseImpl.java 2008-02-27 23:27:11 UTC (rev 10142)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/MimeResponseImpl.java 2008-02-27 23:33:14 UTC (rev 10143)
@@ -186,7 +186,9 @@
resetBuffer();
// And properties
- invocation.getContext().getAttributeResolver(PortletInvocation.RESPONSE_PROPERTIES_SCOPE).getKeys().clear();
+ getProperties().getTransportHeaders().clear();
+ getProperties().getMarkupHeaders().clear();
+ getProperties().getCookies().clear();
}
public boolean isCommitted()
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/PortletInvocation.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/PortletInvocation.java 2008-02-27 23:27:11 UTC (rev 10142)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/PortletInvocation.java 2008-02-27 23:33:14 UTC (rev 10143)
@@ -60,12 +60,6 @@
/** The request scope. */
public static final Scope INVOCATION_SCOPE = Scope.INVOCATION_SCOPE;
- /** The request properties . */
- public static final Scope REQUEST_PROPERTIES_SCOPE = new Scope("request_properties");
-
- /** The response properties. */
- public static final Scope RESPONSE_PROPERTIES_SCOPE = new Scope("response_properties");
-
/** . */
protected StateString navigationalState;
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/TestPortletInvocationContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/TestPortletInvocationContext.java 2008-02-27 23:27:11 UTC (rev 10142)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/TestPortletInvocationContext.java 2008-02-27 23:33:14 UTC (rev 10143)
@@ -75,8 +75,6 @@
//
addResolver(PortletInvocation.PRINCIPAL_SCOPE, new PrincipalAttributeResolver(clientRequest));
addResolver(PortletInvocation.INVOCATION_SCOPE, new MapAttributeResolver());
- addResolver(PortletInvocation.REQUEST_PROPERTIES_SCOPE, new MapAttributeResolver());
- addResolver(PortletInvocation.RESPONSE_PROPERTIES_SCOPE, new MapAttributeResolver());
addResolver(PortletInvocation.REQUEST_SCOPE, new RequestAttributeResolver(clientRequest));
}
16 years, 2 months
JBoss Portal SVN: r10142 - modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/response.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-27 18:27:11 -0500 (Wed, 27 Feb 2008)
New Revision: 10142
Modified:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/response/PortletResponse.java
Log:
update javadoc
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/response/PortletResponse.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/response/PortletResponse.java 2008-02-27 23:06:44 UTC (rev 10141)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/response/PortletResponse.java 2008-02-27 23:27:11 UTC (rev 10142)
@@ -34,13 +34,13 @@
/** The event distribution was properly done. */
public static final int DISTRIBUTION_DONE = 0;
- /** The event distribution lead to a cycle. */
+ /** The event distribution was interruped by the event controller context. */
public static final int INTERRUPTED = 1;
- /** The event distribution did flood. */
+ /** The event distribution did flood with produced events. */
public static final int PRODUCED_EVENT_FLOODED = 2;
- /** The event distribution did flood. */
+ /** The event distribution did flood with consumed events. */
public static final int CONSUMED_EVENT_FLOODED = 3;
/** . */
16 years, 2 months
JBoss Portal SVN: r10141 - in modules/portlet/trunk: portlet and 8 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-27 18:06:44 -0500 (Wed, 27 Feb 2008)
New Revision: 10141
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/CCPPInterceptor.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletrequests/CCPPTestCase.java
Modified:
modules/portlet/trunk/build/pom.xml
modules/portlet/trunk/portlet/pom.xml
modules/portlet/trunk/test/pom.xml
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/TestPortletInvocationContext.java
modules/portlet/trunk/test/src/test/build.xml
modules/portlet/trunk/test/src/test/resources/portlet-tck-war/WEB-INF/jboss-beans.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
Log:
implement simple cc/pp attribute
Modified: modules/portlet/trunk/build/pom.xml
===================================================================
--- modules/portlet/trunk/build/pom.xml 2008-02-27 22:56:58 UTC (rev 10140)
+++ modules/portlet/trunk/build/pom.xml 2008-02-27 23:06:44 UTC (rev 10141)
@@ -45,6 +45,7 @@
<version.ant>1.7.0</version.ant>
<version.sun-jaxb>2.1.4</version.sun-jaxb>
<version.portlet-api>2.0-Draft32</version.portlet-api>
+ <version.ccpp-api>1.0</version.ccpp-api>
</properties>
<repositories>
@@ -174,6 +175,11 @@
<artifactId>jsp-api</artifactId>
<version>${version.javax.servlet.jsp}</version>
</dependency>
+ <dependency>
+ <groupId>javax.ccpp</groupId>
+ <artifactId>ccpp</artifactId>
+ <version>${version.ccpp-api}</version>
+ </dependency>
<dependency>
<groupId>concurrent</groupId>
Modified: modules/portlet/trunk/portlet/pom.xml
===================================================================
--- modules/portlet/trunk/portlet/pom.xml 2008-02-27 22:56:58 UTC (rev 10140)
+++ modules/portlet/trunk/portlet/pom.xml 2008-02-27 23:06:44 UTC (rev 10141)
@@ -39,6 +39,10 @@
<groupId>sun-jaxb</groupId>
<artifactId>jaxb-api</artifactId>
</dependency>
+ <dependency>
+ <groupId>javax.ccpp</groupId>
+ <artifactId>ccpp</artifactId>
+ </dependency>
<!--TEST SCOPE-->
<dependency>
Added: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/CCPPInterceptor.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/CCPPInterceptor.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/CCPPInterceptor.java 2008-02-27 23:06:44 UTC (rev 10141)
@@ -0,0 +1,122 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.common.invocation.InvocationException;
+
+import javax.ccpp.Profile;
+import javax.ccpp.Attribute;
+import javax.ccpp.Component;
+import javax.ccpp.ProfileDescription;
+import javax.ccpp.AttributeDescription;
+import javax.ccpp.ComponentDescription;
+import java.util.Set;
+import java.util.Collections;
+
+/**
+ * A simple implementation of CC/PP feature of JSR286.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class CCPPInterceptor extends PortletInterceptor
+{
+ protected Object invoke(PortletInvocation invocation) throws Exception, InvocationException
+ {
+ try
+ {
+ invocation.setAttribute(PortletInvocation.REQUEST_SCOPE, "javax.portlet.ccpp", SIMPLE_PROFILE);
+
+ //
+ return invocation.invokeNext();
+ }
+ finally
+ {
+ invocation.removeAttribute(PortletInvocation.REQUEST_SCOPE, "javax.portlet.ccpp");
+ }
+ }
+
+ /**
+ * A simple implementation of a profile.
+ */
+ private static final Profile SIMPLE_PROFILE = new Profile()
+ {
+ public Attribute getAttribute(String s)
+ {
+ return null;
+ }
+
+ public Set getAttributes()
+ {
+ return Collections.emptySet();
+ }
+
+ public Component getComponent(String s)
+ {
+ return null;
+ }
+
+ public Set getComponents()
+ {
+ return Collections.emptySet();
+ }
+
+ public ProfileDescription getDescription()
+ {
+ return SIMPLE_PROFILE_DESCRPTION;
+ }
+ };
+
+ /**
+ * A simple implementation of a profile description.
+ */
+ private static final ProfileDescription SIMPLE_PROFILE_DESCRPTION = new ProfileDescription()
+ {
+ public AttributeDescription getAttributeDescription(String s)
+ {
+ return null;
+ }
+
+ public Set getAttributeDescriptions()
+ {
+ return Collections.emptySet();
+ }
+
+ public ComponentDescription getComponentDescription(String s)
+ {
+ return null;
+ }
+
+ public Set getComponentDescriptions()
+ {
+ return Collections.emptySet();
+ }
+
+ public String getURI()
+ {
+ return null;
+ }
+ };
+}
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletrequests/CCPPTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletrequests/CCPPTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletrequests/CCPPTestCase.java 2008-02-27 23:06:44 UTC (rev 10141)
@@ -0,0 +1,62 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+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.PortletRequest;
+import javax.ccpp.Profile;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+(a)TestCase(Assertion.JSR286_89)
+public class CCPPTestCase
+{
+ public CCPPTestCase(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
+ {
+ Profile profile = (Profile)request.getAttribute(PortletRequest.CCPP_PROFILE);
+ assertNotNull(profile);
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Modified: modules/portlet/trunk/test/pom.xml
===================================================================
--- modules/portlet/trunk/test/pom.xml 2008-02-27 22:56:58 UTC (rev 10140)
+++ modules/portlet/trunk/test/pom.xml 2008-02-27 23:06:44 UTC (rev 10141)
@@ -160,6 +160,10 @@
<artifactId>web-web</artifactId>
<type>jar</type>
</dependency>
+ <dependency>
+ <groupId>javax.ccpp</groupId>
+ <artifactId>ccpp</artifactId>
+ </dependency>
<!--
<dependency>
<groupId>org.jboss.portal.portlet</groupId>
@@ -344,6 +348,8 @@
<!--<property name="dependency.jsr168api.jar" value="${maven.dependency.org.jboss.portal.portlet.portlet-jsr168api.jar.path}"/>-->
<property name="dependency.jsr168api.jar"
value="${maven.dependency.javax.portlet.portlet-api.jar.path}"/>
+ <property name="dependency.ccpp.jar"
+ value="${maven.dependency.javax.ccpp.ccpp.jar.path}"/>
<property name="dependency.portal-portlet.jar"
value="${maven.dependency.org.jboss.portal.portlet.portlet-portlet.jar.path}"/>
<property name="dependency.portal-portlet-controller.jar"
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/TestPortletInvocationContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/TestPortletInvocationContext.java 2008-02-27 22:56:58 UTC (rev 10140)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/TestPortletInvocationContext.java 2008-02-27 23:06:44 UTC (rev 10141)
@@ -25,6 +25,7 @@
import org.jboss.portal.common.invocation.resolver.MapAttributeResolver;
import org.jboss.portal.common.invocation.resolver.PrincipalAttributeResolver;
+import org.jboss.portal.common.invocation.resolver.RequestAttributeResolver;
import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.common.io.Serialization;
import org.jboss.portal.portlet.ContainerURL;
@@ -76,7 +77,7 @@
addResolver(PortletInvocation.INVOCATION_SCOPE, new MapAttributeResolver());
addResolver(PortletInvocation.REQUEST_PROPERTIES_SCOPE, new MapAttributeResolver());
addResolver(PortletInvocation.RESPONSE_PROPERTIES_SCOPE, new MapAttributeResolver());
- addResolver(PortletInvocation.REQUEST_SCOPE, new MapAttributeResolver());
+ addResolver(PortletInvocation.REQUEST_SCOPE, new RequestAttributeResolver(clientRequest));
}
public String getWindowId()
Modified: modules/portlet/trunk/test/src/test/build.xml
===================================================================
--- modules/portlet/trunk/test/src/test/build.xml 2008-02-27 22:56:58 UTC (rev 10140)
+++ modules/portlet/trunk/test/src/test/build.xml 2008-02-27 23:06:44 UTC (rev 10141)
@@ -500,6 +500,7 @@
<path location="${dependency.portal-portlet.jar}"/>
<path location="${dependency.portal-web.jar}"/>
<path location="${dependency.jsr168api.jar}"/>
+ <path location="${dependency.ccpp.jar}"/>
<path location="${dependency.jboss-unit.jar}"/>
<path location="${dependency.jboss-unit-remote.jar}"/>
@@ -614,6 +615,7 @@
<path location="${dependency.portal-portlet.jar}"/>
<path location="${dependency.portal-web.jar}"/>
<path location="${dependency.jsr168api.jar}"/>
+ <path location="${dependency.ccpp.jar}"/>
<path location="${dependency.jboss-unit.jar}"/>
<path location="${dependency.jboss-unit-remote.jar}"/>
@@ -703,6 +705,7 @@
<path location="${dependency.portal-portlet.jar}"/>
<path location="${dependency.portal-web.jar}"/>
<path location="${dependency.jsr168api.jar}"/>
+ <path location="${dependency.ccpp.jar}"/>
<path refid="mc.portal-portlet-controller"/>
</path>
</copy>
@@ -778,6 +781,7 @@
<path location="${dependency.portal-portlet.jar}"/>
<path location="${dependency.portal-web.jar}"/>
<path location="${dependency.jsr168api.jar}"/>
+ <path location="${dependency.ccpp.jar}"/>
<path location="${dependency.jaxb-api.jar}"/>
<path location="${dependency.jboss-unit.jar}"/>
@@ -845,6 +849,7 @@
<path location="${dependency.portal-portlet.jar}"/>
<path location="${dependency.portal-web.jar}"/>
<path location="${dependency.jsr168api.jar}"/>
+ <path location="${dependency.ccpp.jar}"/>
<path location="${dependency.jboss-unit.jar}"/>
<path location="${dependency.jboss-unit-remote.jar}"/>
Modified: modules/portlet/trunk/test/src/test/resources/portlet-tck-war/WEB-INF/jboss-beans.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/portlet-tck-war/WEB-INF/jboss-beans.xml 2008-02-27 22:56:58 UTC (rev 10140)
+++ modules/portlet/trunk/test/src/test/resources/portlet-tck-war/WEB-INF/jboss-beans.xml 2008-02-27 23:06:44 UTC (rev 10141)
@@ -80,6 +80,7 @@
<property name="servletContainerFactory"><inject bean="ServletContainerFactory"/></property>
</bean>
<bean name="ProducerCacheInterceptor" class="org.jboss.portal.portlet.aspects.portlet.ProducerCacheInterceptor"/>
+ <bean name="CCPPInterceptor" class="org.jboss.portal.portlet.aspects.portlet.CCPPInterceptor"/>
<bean name="RequestAttributeConversationInterceptor" class="org.jboss.portal.portlet.aspects.portlet.RequestAttributeConversationInterceptor"/>
<bean name="ContainerStackFactory" class="org.jboss.portal.portlet.test.InterceptorStackFactoryImpl">
<property name="interceptors">
@@ -88,6 +89,7 @@
<inject bean="SecureTransportInterceptor"/>
<inject bean="ContextDispatcherInterceptor"/>
<inject bean="ProducerCacheInterceptor"/>
+ <inject bean="CCPPInterceptor"/>
<inject bean="RequestAttributeConversationInterceptor"/>
</array>
</property>
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-27 22:56:58 UTC (rev 10140)
+++ modules/portlet/trunk/test/src/test/resources/portlet-test-war/WEB-INF/jboss-beans.xml 2008-02-27 23:06:44 UTC (rev 10141)
@@ -80,6 +80,7 @@
<property name="servletContainerFactory"><inject bean="ServletContainerFactory"/></property>
</bean>
<bean name="ProducerCacheInterceptor" class="org.jboss.portal.portlet.aspects.portlet.ProducerCacheInterceptor"/>
+ <bean name="CCPPInterceptor" class="org.jboss.portal.portlet.aspects.portlet.CCPPInterceptor"/>
<bean name="RequestAttributeConversationInterceptor" class="org.jboss.portal.portlet.aspects.portlet.RequestAttributeConversationInterceptor"/>
<bean name="ContainerStackFactory" class="org.jboss.portal.portlet.test.InterceptorStackFactoryImpl">
<property name="interceptors">
@@ -88,6 +89,7 @@
<inject bean="SecureTransportInterceptor"/>
<inject bean="ContextDispatcherInterceptor"/>
<inject bean="ProducerCacheInterceptor"/>
+ <inject bean="CCPPInterceptor"/>
<inject bean="RequestAttributeConversationInterceptor"/>
</array>
</property>
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-27 22:56:58 UTC (rev 10140)
+++ modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/jboss-beans.xml 2008-02-27 23:06:44 UTC (rev 10141)
@@ -65,6 +65,7 @@
<property name="servletContainerFactory"><inject bean="ServletContainerFactory"/></property>
</bean>
<bean name="ProducerCacheInterceptor" class="org.jboss.portal.portlet.aspects.portlet.ProducerCacheInterceptor"/>
+ <bean name="CCPPInterceptor" class="org.jboss.portal.portlet.aspects.portlet.CCPPInterceptor"/>
<bean name="RequestAttributeConversationInterceptor" class="org.jboss.portal.portlet.aspects.portlet.RequestAttributeConversationInterceptor"/>
<bean name="ContainerStackFactory" class="org.jboss.portal.portlet.test.InterceptorStackFactoryImpl">
<property name="interceptors">
@@ -73,6 +74,7 @@
<inject bean="SecureTransportInterceptor"/>
<inject bean="ContextDispatcherInterceptor"/>
<inject bean="ProducerCacheInterceptor"/>
+ <inject bean="CCPPInterceptor"/>
<inject bean="RequestAttributeConversationInterceptor"/>
</array>
</property>
16 years, 2 months
JBoss Portal SVN: r10140 - in modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit: reports and 1 other directory.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-02-27 17:56:58 -0500 (Wed, 27 Feb 2008)
New Revision: 10140
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/reports/ResultProducingListener.java
Log:
Improve a bit dummy test coverage reporting
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-02-27 22:06:45 UTC (rev 10139)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/Assertion.java 2008-02-27 22:56:58 UTC (rev 10140)
@@ -771,7 +771,7 @@
JSR286_130(new TCK(130, "PLT.13.1.7"), "Setting a cachability different from FULL must result in an " +
"IllegalStateException"),
JSR286_131(new TCK(131, "PLT.13.1.7"), "Attempts to create URLs that are not of type FULL or are not resource " +
- "URLs in the current or a downstream response must result in\n" +
+ "URLs in the current or a downstream response must result in" +
"an IllegalStateException"),
JSR286_132(new TCK(132, "PLT.13.1.7"), "Creating other URLs, e.g. resource URLs of type PAGE or action or render " +
"URLs, must result in an IllegalStateException"),
@@ -927,13 +927,13 @@
"getPathTranslated, getQueryString, getRequestURI and getServletPath."),
JSR286_188(new TCK(188, "PLT.19.3.3"), "The following methods of the HttpServletRequest must be equivalent " +
"to the methods of the PortletRequest of similar name: getScheme, getServerName, getServerPort, getAttribute, " +
- "getAttributeNames, setAttribute, removeAttribute, getLocale, getLocales, isSecure, getAuthType,\n" +
+ "getAttributeNames, setAttribute, removeAttribute, getLocale, getLocales, isSecure, getAuthType," +
"getContextPath, getRemoteUser, getUserPrincipal, getRequestedSessionId, isRequestedSessionIdValid, getCookies."),
JSR286_189(new TCK(189, "PLT.19.3.3"), "The following methods of the HttpServletRequest must be equivalent to " +
"the methods of the PortletRequest of similar name with the provision defined in PLT.19.1.1 Query Strings " +
"in Request Dispatcher Paths Section: getParameter, getParameterNames, getParameterValues and getParameterMap."),
JSR286_190(new TCK(190, "PLT.19.3.3"), "In case of an include from processAction, the following methods of the " +
- "HttpServletRequest must be based on the corresponding methods of the\n" +
+ "HttpServletRequest must be based on the corresponding methods of the" +
"ActionRequest: getCharacterEncoding, setCharacterEncoding, getContentType, getInputStream, getContentLength, " +
"getMethod and getReader."),
JSR286_191(new TCK(191, "PLT.19.3.3"), "In case of an include from processEvent, the following methods of the " +
@@ -960,7 +960,7 @@
"to the methods of the ActionResponse/EventResponse of similar name: encodeURL and encodeUrl."),
JSR286_201(new TCK(201, "PLT.19.3.3"), Status.specUntestable("impl"), "The following methods of the HttpServletResponse must perform no " +
"operations: setContentType, setCharacterEncoding, setContentLength, setLocale, addCookie, sendError, " +
- "sendRedirect, setDateHeader, addDateHeader, setHeader, addHeader, setIntHeader, addIntHeader, setStatus,\n" +
+ "sendRedirect, setDateHeader, addDateHeader, setHeader, addHeader, setIntHeader, addIntHeader, setStatus," +
"setBufferSize and flushBuffer."),
JSR286_202(new TCK(202, "PLT.19.3.3"), "The containsHeader method of the HttpServletResponse must return false."),
JSR286_203(new TCK(203, "PLT.19.3.3"), "The isCommitted method of the HttpServletResponse must return true."),
@@ -1013,7 +1013,7 @@
"getPathTranslated, getQueryString, getRequestURI and getServletPath."),
JSR286_223(new TCK(223, "PLT.19.3.5"), "The following methods of the HttpServletRequest must be equivalent " +
"to the methods of the PortletRequest of similar name: getScheme, getServerName, getServerPort, getAttribute, " +
- "getAttributeNames, setAttribute, removeAttribute, getLocale, getLocales, isSecure, getAuthType,\n" +
+ "getAttributeNames, setAttribute, removeAttribute, getLocale, getLocales, isSecure, getAuthType," +
"getContextPath, getRemoteUser, getUserPrincipal, getRequestedSessionId, isRequestedSessionIdValid, getCookies."),
JSR286_224(new TCK(224, "PLT.19.3.5"), "The following methods of the HttpServletRequest must be equivalent to " +
"the methods of the ResourceRequest of similar name: getCharacterEncoding, setCharacterEncoding, getContentType, " +
@@ -1080,7 +1080,7 @@
"methods of the PortletRequest of similar name with the provision defined in PLT.18.1.1 Query Strings in Request " +
"Dispatcher Paths Section: getParameter, getParameterNames, getParameterValues and getParameterMap."),
JSR286_248(new TCK(248, "PLT.19.4.3"), "In case of a forward from processAction, the following methods of the " +
- "HttpServletRequest must be based on the corresponding methods of the\n" +
+ "HttpServletRequest must be based on the corresponding methods of the" +
"ActionRequest: getCharacterEncoding, setCharacterEncoding, getContentType, getInputStream, getContentLength, " +
"getMethod and getReader."),
JSR286_249(new TCK(249, "PLT.19.4.3"), "In case of a forward from processEvent, the following methods of the " +
@@ -1104,7 +1104,7 @@
JSR286_257(new TCK(257, "PLT.19.4.3"), "The following methods of the HttpServletResponse must be equivalent " +
"to the methods of the ActionResponse/EventResponse of similar name: encodeURL and encodeUrl."),
JSR286_258(new TCK(258, "PLT.19.4.3"), Status.specUntestable("imp"), "The following methods of the HttpServletResponse must perform no " +
- "operations: resetBuffer, reset, setContentType, setContentLength,\n" +
+ "operations: resetBuffer, reset, setContentType, setContentLength," +
"setCharacterEncoding, setLocale, sendError, setDateHeader, addDateHeader, setHeader, addHeader, setIntHeader, " +
"addIntHeader, setStatus, setBufferSize and flushBuffer."),
JSR286_259(new TCK(259, "PLT.19.4.3"), Status.specUntestable("impl"), "The addCookie method of the HttpServletResponse must be based on " +
@@ -1161,7 +1161,7 @@
"getPathTranslated, getQueryString, getRequestURI and getServletPath."),
JSR286_281(new TCK(281, "PLT.19.4.5"), "The following methods of the HttpServletRequest must be equivalent " +
"to the methods of the PortletRequest of similar name: getScheme, getServerName, getServerPort, getAttribute, " +
- "getAttributeNames, setAttribute, removeAttribute, getLocale, getLocales, isSecure, getAuthType, \n" +
+ "getAttributeNames, setAttribute, removeAttribute, getLocale, getLocales, isSecure, getAuthType, " +
"getContextPath, getRemoteUser, getUserPrincipal, getRequestedSessionId, isRequestedSessionIdValid, getCookies."),
JSR286_282(new TCK(282, "PLT.19.4.5"), "The following methods of the HttpServletRequest must be equivalent to " +
"the methods of the ResourceRequest of similar name: getCharacterEncoding, setCharacterEncoding, getContentType, getMethod and getReader."),
@@ -1206,7 +1206,7 @@
"container, the portlet container must first call the destroy method on the filter to enable the filter to " +
"release any resources and perform other cleanup operations."),
JSR286_296(new TCK(296, "PLT.20.2.2"), "When a filter invokes the doFilter method on the portlet container’s " +
- "filter chain implementation, the container must ensure that the request and\n" +
+ "filter chain implementation, the container must ensure that the request and " +
"response object that it passes to the next component in the filter chain, or to the target portlet if the " +
"filter was the last in the chain, is the same object that was passed into the doFilter method by the calling " +
"filter or one of the above mentioned wrappers."),
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/reports/ResultProducingListener.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/reports/ResultProducingListener.java 2008-02-27 22:06:45 UTC (rev 10139)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/reports/ResultProducingListener.java 2008-02-27 22:56:58 UTC (rev 10140)
@@ -22,18 +22,15 @@
package org.jboss.portal.unit.reports;
+import com.sun.mirror.apt.RoundCompleteEvent;
import com.sun.mirror.apt.RoundCompleteListener;
-import com.sun.mirror.apt.RoundCompleteEvent;
+import org.jboss.portal.unit.Assertion;
import java.io.File;
+import java.io.FileWriter;
import java.io.Writer;
-import java.io.FileWriter;
+import java.util.Map;
import java.util.Set;
-import java.util.Map;
-import java.util.Collections;
-import java.util.SortedSet;
-import java.util.List;
-import java.util.LinkedList;
/**
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
@@ -86,12 +83,16 @@
for (int i = 1; i <= max; i++)
{
- String assertion = pre + i;
+ String assertionName = pre + i;
- writer.write(assertion + ",\n");
+ Set<String> testCases = map.get(assertionName);
- Set<String> testCases = map.get(assertion);
+ Assertion assertion = getAssertion(assertionName);
+ String description = assertion != null ? assertion.getDescription().replaceAll(",", " ").trim() : "";
+
+ writer.write(assertionName + ", " + description + '\n');
+
if (testCases != null)
{
for (String testCase : testCases)
@@ -99,9 +100,32 @@
writer.write(" ," + testCase + "\n");
}
}
+
+ writer.write(" ,\n");
}
writer.close();
+ }
+
+ private Assertion getAssertion(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException("name cannot be null");
+ }
+
+ Assertion[] assertions = Assertion.class.getEnumConstants();
+
+ for (Assertion assertion : assertions)
+ {
+ if (assertion.name().equals(name))
+ {
+ return assertion;
+ }
+ }
+
+
+ return null;
}
}
16 years, 2 months
JBoss Portal SVN: r10139 - in modules/portlet/trunk: controller/src/main/java/org/jboss/portal/portlet/controller/event and 6 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-27 17:06:45 -0500 (Wed, 27 Feb 2008)
New Revision: 10139
Added:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/EventPhaseSessionImpl.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventPhaseSession.java
Modified:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletController.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletRequestHandler.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventControllerContext.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/event/EventControllerContextImpl.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/response/PageUpdateResponse.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/response/PortletResponse.java
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/EventControllerContextSupport.java
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/PortletControllerContextSupport.java
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/PortletControllerTestCase.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalServlet.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PageEventControllerContext.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKRendererContext.java
Log:
JBPORTAL-1926 : Portlet event loop detection
Added: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/EventPhaseSessionImpl.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/EventPhaseSessionImpl.java (rev 0)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/EventPhaseSessionImpl.java 2008-02-27 22:06:45 UTC (rev 10139)
@@ -0,0 +1,103 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.controller;
+
+import org.jboss.portal.portlet.controller.event.EventPhaseSession;
+import org.jboss.portal.portlet.controller.event.Event;
+import org.apache.log4j.Logger;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+class EventPhaseSessionImpl implements EventPhaseSession
+{
+
+ /** . */
+ private final Logger log;
+
+ /** . */
+ LinkedList<Event> producedEventHistory;
+
+ /** . */
+ LinkedList<Event> consumedEventHistory;
+
+ /** . */
+ LinkedList<Event> producedEvents;
+
+ /** . */
+ LinkedList<Event> toConsumeEvents;
+
+ /** . */
+ boolean interruped;
+
+ EventPhaseSessionImpl(Logger log)
+ {
+ this.log = log;
+ this.producedEventHistory = new LinkedList<Event>();
+ this.consumedEventHistory = new LinkedList<Event>();
+ this.producedEvents = new LinkedList<Event>();
+ this.toConsumeEvents = new LinkedList<Event>();
+ this.interruped = false;
+ }
+
+ public Iterator<Event> browseProducedEventHistory()
+ {
+ return this.producedEventHistory.iterator();
+ }
+
+
+ public Iterator<Event> browseConsumedEventHistory()
+ {
+ return this.consumedEventHistory.iterator();
+ }
+
+ public void queueEvent(Event event)
+ {
+ if (interruped)
+ {
+ throw new IllegalStateException("The event phase is interruped");
+ }
+ if (event == null)
+ {
+ throw new IllegalArgumentException("No null event accepted");
+ }
+
+ //
+ log.trace("Queued event " + event + " in the session");
+
+ //
+ this.toConsumeEvents.addLast(event);
+ }
+
+ public void interrupt()
+ {
+ log.trace("Event delivery interruped");
+
+ //
+ this.interruped = true;
+ }
+}
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletController.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletController.java 2008-02-27 20:42:50 UTC (rev 10138)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletController.java 2008-02-27 22:06:45 UTC (rev 10139)
@@ -30,8 +30,12 @@
import org.jboss.portal.portlet.controller.response.ControllerResponse;
/**
- * The portlet controller which handles the page state management and the interactions between the action phase and the
- * event phase. It really only does that and not more.
+ * <p>The portlet controller which handles the page state management and the interactions between the action phase and the
+ * event phase. It really only does that and not more.</p>
+ *
+ * <p>The event distribution is based on a fifo policy.</p>
+ *
+ *
* <p/>
* 1/ introduce EventRequest so the portal can send events directly to a portlet
* <p/>
@@ -51,10 +55,18 @@
/** . */
private boolean distributeNonProduceableEvents;
+ /** . */
+ private int producedEventThreshold;
+
+ /** . */
+ private int consumedEventThreshold;
+
public PortletController()
{
distributeNonConsumableEvents = true;
distributeNonProduceableEvents = true;
+ producedEventThreshold = 32;
+ consumedEventThreshold = 64;
}
/**
@@ -91,6 +103,40 @@
this.distributeNonProduceableEvents = distributeNonProduceableEvents;
}
+ /**
+ * The option configures the maximum number of events that can be produced during one interaction.
+ * A negative value means that there is no limit to the number of events that can be produced
+ * during one interaction.
+ *
+ * @return the maximum number of produced events
+ */
+ public int getProducedEventThreshold()
+ {
+ return producedEventThreshold;
+ }
+
+ public void setProducedEventThreshold(int producedEventThreshold)
+ {
+ this.producedEventThreshold = producedEventThreshold;
+ }
+
+ /**
+ * The option configures the maximum number of events that can be consumed during one interaction.
+ * A negative value means that there is no limit to the number of events that can be consumed
+ * during one interaction.
+ *
+ * @return the maximum number of consumed events
+ */
+ public int getConsumedEventThreshold()
+ {
+ return consumedEventThreshold;
+ }
+
+ public void setConsumedEventThreshold(int consumedEventThreshold)
+ {
+ this.consumedEventThreshold = consumedEventThreshold;
+ }
+
public ControllerResponse process(PortletControllerContext controllerContext, ControllerRequest controllerRequest) throws PortletInvokerException
{
if (controllerContext == null)
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletRequestHandler.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletRequestHandler.java 2008-02-27 20:42:50 UTC (rev 10138)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletRequestHandler.java 2008-02-27 22:06:45 UTC (rev 10139)
@@ -49,7 +49,6 @@
import org.jboss.portal.portlet.spi.PortletInvocationContext;
import javax.servlet.http.Cookie;
-import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -106,100 +105,140 @@
EventControllerContext eventCC = context.getEventControllerContext();
UpdateNavigationalStateResponse stateResponse = (UpdateNavigationalStateResponse)response;
- // Create event list and feed it with the events that may have been produced
- LinkedList<Event> srcEventQueue = new LinkedList<Event>();
+ //
+ EventPhaseSessionImpl session = new EventPhaseSessionImpl(log);
+
+ // Feed session it with the events that may have been produced
for (UpdateNavigationalStateResponse.Event portletEvent : stateResponse.getEvents())
{
- Event producedEvent = new Event(portletEvent.getName(), portletEvent.getPayload(), portletRequest.getWindowId());
- srcEventQueue.add(producedEvent);
+ session.producedEvents.add(new Event(portletEvent.getName(), portletEvent.getPayload(), portletRequest.getWindowId()));
}
+ //
+ int eventDistributionStatus = PortletResponse.DISTRIBUTION_DONE;
+
// Deliver events
- while (srcEventQueue.size() > 0)
+ while (session.producedEvents.size() > 0)
{
- Event srcEvent = srcEventQueue.removeFirst();
+ Event producedEvent = session.producedEvents.removeFirst();
//
- String srcId = srcEvent.getWindowId();
+ String producerId = producedEvent.getWindowId();
+ PortletInfo producerPortletInfo = context.getPortletInfo(producerId);
//
- PortletInfo srcPortletInfo = context.getPortletInfo(srcId);
-
- //
- if (srcPortletInfo == null)
+ if (producerPortletInfo == null)
{
- log.trace("Cannot deliver event " + srcEvent +" because the source does not have portlet info");
-
- //
+ log.trace("Cannot deliver event " + producedEvent +" because the producer does not have portlet info");
continue;
}
//
if (!controller.getDistributeNonProduceableEvents())
{
- if (!srcPortletInfo.getEventing().getProducedEvents().containsKey(srcEvent.getName()))
+ if (!producerPortletInfo.getEventing().getProducedEvents().containsKey(producedEvent.getName()))
{
- log.trace("Cannot deliver event " + srcEvent +" because the source of the event does not produce the event name");
-
- //
+ log.trace("Cannot deliver event " + producedEvent +" because the producer of the event does not produce the event name");
continue;
}
}
- //
- List<Event> dstEvents = eventCC.getConsumedEvents(srcEvent);
+ // Apply produced event quota if necessary
+ int producedEventThreshold = controller.getProducedEventThreshold();
+ if (producedEventThreshold >= 0)
+ {
+ if (session.producedEventHistory.size() + 1 > producedEventThreshold)
+ {
+ log.trace("Event distribution interrupted because the maximum number of produced event is reached");
+ eventDistributionStatus = PortletResponse.PRODUCED_EVENT_FLOODED;
+ break;
+ }
+ }
+ // Give control to the event context
+ try
+ {
+ eventCC.handleEvent(session, producedEvent);
+ }
+ catch (Exception e)
+ {
+ log.trace("Cannot deliver produced event " + producedEvent + " because the event controller context " +
+ "threw a runtime exception", e);
+ continue;
+ }
+
+ // Perform flow control
+ if (session.interruped)
+ {
+ log.trace("Event distribution interrupted by controller context");
+ eventDistributionStatus = PortletResponse.INTERRUPTED;
+ break;
+ }
+
//
- for (Event dstEvent : dstEvents)
+ while (session.toConsumeEvents.size() > 0)
{
- String dstId = dstEvent.getWindowId();
+ Event toConsumeEvent = session.toConsumeEvents.removeFirst();
//
- PortletInfo dstPortletInfo = context.getPortletInfo(dstId);
+ String consumedId = toConsumeEvent.getWindowId();
+ //
+ PortletInfo consumerPortletInfo = context.getPortletInfo(consumedId);
//
- if (dstPortletInfo == null)
+ if (consumerPortletInfo == null)
{
if (log.isTraceEnabled())
{
- log.trace("Cannot deliver event " + srcEvent +" because the target of the event does not have a portlet info");
+ log.trace("Cannot deliver event " + producedEvent +" because the consumer of the event does not have a portlet info");
}
-
- //
continue;
}
//
if (!controller.getDistributeNonConsumableEvents())
{
- if (!dstPortletInfo.getEventing().getConsumedEvents().containsKey(dstEvent.getName()))
+ if (!consumerPortletInfo.getEventing().getConsumedEvents().containsKey(toConsumeEvent.getName()))
{
if (log.isTraceEnabled())
{
- log.trace("Cannot deliver event " + srcEvent +" because the target of the event does not accept the event name");
+ log.trace("Cannot deliver event " + producedEvent +" because the consumer of the event does not accept the event name");
}
-
- //
continue;
}
}
+ // Apply consumed event quota if necessary
+ int consumedEventThreshold = controller.getConsumedEventThreshold();
+ if (consumedEventThreshold >= 0)
+ {
+ if (session.consumedEventHistory.size() + 1 > consumedEventThreshold)
+ {
+ log.trace("Event distribution interrupted because the maximum number of consumed event is reached");
+ eventDistributionStatus = PortletResponse.CONSUMED_EVENT_FLOODED;
+ break;
+ }
+ }
+
//
- PortletInvocationResponse eventResponse = deliverEvent(context, dstEvent, pageState, requestProperties.getCookies());
+ PortletInvocationResponse eventResponse = deliverEvent(context, toConsumeEvent, pageState, requestProperties.getCookies());
+ // Now it is consumed we add it to the history
+ session.consumedEventHistory.addFirst(toConsumeEvent);
+
//
if (eventResponse instanceof UpdateNavigationalStateResponse)
{
UpdateNavigationalStateResponse eventStateResponse = (UpdateNavigationalStateResponse)eventResponse;
// Update ns
- updateNavigationalState(context, dstEvent.getWindowId(), eventStateResponse, pageState);
+ updateNavigationalState(context, toConsumeEvent.getWindowId(), eventStateResponse, pageState);
// Add events to source event queue
for (UpdateNavigationalStateResponse.Event portletEvent : eventStateResponse.getEvents())
{
- srcEventQueue.add(new Event(portletEvent.getName(), portletEvent.getPayload(), dstEvent.getWindowId()));
+ session.producedEvents.add(new Event(portletEvent.getName(), portletEvent.getPayload(), toConsumeEvent.getWindowId()));
}
//
@@ -218,14 +257,17 @@
// Do something here !!!!
}
}
+
+ // We archive the consumed event in the history
+ session.producedEventHistory.addFirst(producedEvent);
}
//
- return new PageUpdateResponse(updateResponse, requestProperties, pageState);
+ return new PageUpdateResponse(updateResponse, requestProperties, pageState, eventDistributionStatus);
}
else
{
- return new PortletResponse(response);
+ return new PortletResponse(response, PortletResponse.DISTRIBUTION_DONE);
}
}
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventControllerContext.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventControllerContext.java 2008-02-27 20:42:50 UTC (rev 10138)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventControllerContext.java 2008-02-27 22:06:45 UTC (rev 10139)
@@ -22,8 +22,6 @@
******************************************************************************/
package org.jboss.portal.portlet.controller.event;
-import java.util.List;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
@@ -32,11 +30,22 @@
{
/**
- * Obtain a list of consumed event for a produced event.
+ * <p>Give control to the context when an event is produced. The session
+ * argument gives to the context the capability to queue events in response
+ * of the produced event or to interrupt the session. It has also access
+ * to the full history of distributed events in order to provide advanced
+ * implementation of event cycle detection.</p>
*
+ * <p>During the invocation of this method, any runtime exception thrown will signal
+ * a failure and the produced event will be discarded although the event
+ * distribution will continue.</p>
+ *
+ * <p>During the invocation of this method, any error thrown will be propagated
+ * to the portlet controller invoker.</p>
+ *
+ * @param session the session
* @param producedEvent the produced event
- * @return the list of event to be consumed
*/
- List<Event> getConsumedEvents(Event producedEvent);
+ void handleEvent(EventPhaseSession session, Event producedEvent);
}
Added: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventPhaseSession.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventPhaseSession.java (rev 0)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventPhaseSession.java 2008-02-27 22:06:45 UTC (rev 10139)
@@ -0,0 +1,64 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.controller.event;
+
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface EventPhaseSession
+{
+
+ /**
+ * Returns an iterator for browsing the history of the produced events.
+ * The iterator returns the produced events from the most recent to the oldest.
+ *
+ * @return all the events produced during the session
+ */
+ Iterator<Event> browseProducedEventHistory();
+
+ /**
+ * Returns an iterator for browsing the history of the consumed events.
+ * The iterator returns the consumed events from the most recent to the oldest.
+ *
+ * @return all the events consumed during the session
+ */
+ Iterator<Event> browseConsumedEventHistory();
+
+ /**
+ * Queue an event for consumption. The queue is a FIFO queue.
+ *
+ * @param event an event
+ * @throws IllegalArgumentException if the event is null
+ * @throws IllegalStateException if the event phase is interrupted
+ */
+ void queueEvent(Event event) throws IllegalArgumentException, IllegalStateException;
+
+ /**
+ * Stop processing of all events and returns from the controller.
+ */
+ void interrupt();
+
+}
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/event/EventControllerContextImpl.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/event/EventControllerContextImpl.java 2008-02-27 20:42:50 UTC (rev 10138)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/event/EventControllerContextImpl.java 2008-02-27 22:06:45 UTC (rev 10139)
@@ -27,12 +27,9 @@
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.controller.event.Event;
import org.jboss.portal.portlet.controller.event.EventControllerContext;
+import org.jboss.portal.portlet.controller.event.EventPhaseSession;
import org.jboss.portal.portlet.info.PortletInfo;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
@@ -48,28 +45,24 @@
this.invoker = invoker;
}
- public List<Event> getConsumedEvents(Event producedEvent)
+ public void handleEvent(EventPhaseSession session, Event producedEvent)
{
try
{
- ArrayList<Event> consumedEvents = new ArrayList<Event>();
for (Portlet portlet : invoker.getPortlets())
{
PortletInfo portletInfo = portlet.getInfo();
if (portletInfo.getEventing().getConsumedEvents().containsKey(producedEvent.getName()))
{
Event consumedEvent = new Event(producedEvent.getName(), producedEvent.getPayload(), portlet.getContext().getId());
- consumedEvents.add(consumedEvent);
+ session.queueEvent(consumedEvent);
}
}
- return consumedEvents;
}
catch (PortletInvokerException e)
{
System.out.println("e = " + e);
-
- //
- return Collections.emptyList();
+ session.interrupt();
}
}
}
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/response/PageUpdateResponse.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/response/PageUpdateResponse.java 2008-02-27 20:42:50 UTC (rev 10138)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/response/PageUpdateResponse.java 2008-02-27 22:06:45 UTC (rev 10139)
@@ -42,9 +42,10 @@
public PageUpdateResponse(
UpdateNavigationalStateResponse update,
ResponseProperties properties,
- PageNavigationalState pageState)
+ PageNavigationalState pageState,
+ int eventCycleStatus)
{
- super(update);
+ super(update, eventCycleStatus);
//
this.properties = properties;
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/response/PortletResponse.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/response/PortletResponse.java 2008-02-27 20:42:50 UTC (rev 10138)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/response/PortletResponse.java 2008-02-27 22:06:45 UTC (rev 10139)
@@ -31,11 +31,32 @@
public class PortletResponse extends ControllerResponse
{
+ /** The event distribution was properly done. */
+ public static final int DISTRIBUTION_DONE = 0;
+
+ /** The event distribution lead to a cycle. */
+ public static final int INTERRUPTED = 1;
+
+ /** The event distribution did flood. */
+ public static final int PRODUCED_EVENT_FLOODED = 2;
+
+ /** The event distribution did flood. */
+ public static final int CONSUMED_EVENT_FLOODED = 3;
+
/** . */
public final PortletInvocationResponse response;
- public PortletResponse(PortletInvocationResponse response)
+ /** . */
+ private final int eventDistributionStatus;
+
+ public PortletResponse(PortletInvocationResponse response, int eventDistributionStatus)
{
this.response = response;
+ this.eventDistributionStatus = eventDistributionStatus;
}
+
+ public int getEventDistributionStatus()
+ {
+ return eventDistributionStatus;
+ }
}
Modified: modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/EventControllerContextSupport.java
===================================================================
--- modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/EventControllerContextSupport.java 2008-02-27 20:42:50 UTC (rev 10138)
+++ modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/EventControllerContextSupport.java 2008-02-27 22:06:45 UTC (rev 10139)
@@ -24,12 +24,12 @@
import org.jboss.portal.portlet.controller.event.EventControllerContext;
import org.jboss.portal.portlet.controller.event.Event;
+import org.jboss.portal.portlet.controller.event.EventPhaseSession;
import javax.xml.namespace.QName;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.HashMap;
/**
@@ -42,22 +42,18 @@
/** . */
private final Map<Point, List<Point>> wires = new HashMap<Point, List<Point>>();
- public List<Event> getConsumedEvents(Event producedEvent)
+ public void handleEvent(EventPhaseSession session, Event producedEvent)
{
List<Point> dsts = wires.get(new Point(producedEvent.getName(), producedEvent.getWindowId()));
//
- List<Event> consumedEvents = new ArrayList<Event>();
if (dsts != null)
{
for (Point dst : dsts)
{
- consumedEvents.add(new Event(dst.name, producedEvent.getPayload(), dst.windowId));
+ session.queueEvent(new Event(dst.name, producedEvent.getPayload(), dst.windowId));
}
}
-
- //
- return Collections.unmodifiableList(consumedEvents);
}
public void createWire(QName srcName, String srcWindowId, QName dstName, String dstWindowId)
Modified: modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/PortletControllerContextSupport.java
===================================================================
--- modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/PortletControllerContextSupport.java 2008-02-27 20:42:50 UTC (rev 10138)
+++ modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/PortletControllerContextSupport.java 2008-02-27 22:06:45 UTC (rev 10139)
@@ -27,6 +27,7 @@
import org.jboss.portal.portlet.controller.state.PageNavigationalState;
import org.jboss.portal.portlet.controller.state.StateControllerContext;
import org.jboss.portal.portlet.controller.impl.state.StateControllerContextImpl;
+import org.jboss.portal.portlet.controller.event.EventControllerContext;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.invocation.EventInvocation;
@@ -51,7 +52,7 @@
private final StateControllerContext stateControllerContext = new StateControllerContextImpl(this);
/** . */
- private final EventControllerContextSupport eventControllerContext = new EventControllerContextSupport();
+ private EventControllerContext eventControllerContext;
/** . */
private final PortletInvokerSupport invoker = new PortletInvokerSupport();
@@ -116,11 +117,16 @@
return invoke((PortletInvocation)resourceInvocation);
}
- public EventControllerContextSupport getEventControllerContext()
+ public EventControllerContext getEventControllerContext()
{
return eventControllerContext;
}
+ public void setEventControllerContext(EventControllerContext eventControllerContext)
+ {
+ this.eventControllerContext = eventControllerContext;
+ }
+
public StateControllerContext getStateControllerContext()
{
return stateControllerContext;
Modified: modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/PortletControllerTestCase.java
===================================================================
--- modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/PortletControllerTestCase.java 2008-02-27 20:42:50 UTC (rev 10138)
+++ modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/PortletControllerTestCase.java 2008-02-27 22:06:45 UTC (rev 10139)
@@ -28,6 +28,10 @@
import org.jboss.portal.portlet.controller.state.PageNavigationalState;
import org.jboss.portal.portlet.controller.response.ControllerResponse;
import org.jboss.portal.portlet.controller.response.PageUpdateResponse;
+import org.jboss.portal.portlet.controller.response.PortletResponse;
+import org.jboss.portal.portlet.controller.event.EventControllerContext;
+import org.jboss.portal.portlet.controller.event.EventPhaseSession;
+import org.jboss.portal.portlet.controller.event.Event;
import org.jboss.portal.portlet.OpaqueStateString;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.support.PortletSupport;
@@ -40,6 +44,7 @@
import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.common.util.Tools;
import org.jboss.unit.api.pojo.annotations.Test;
+import org.jboss.unit.api.pojo.annotations.Create;
import static org.jboss.unit.api.Assert.*;
import javax.xml.namespace.QName;
@@ -60,8 +65,17 @@
PortletControllerContextSupport context = new PortletControllerContextSupport();
/** . */
+ EventControllerContextSupport eventControllerContext = new EventControllerContextSupport();
+
+ /** . */
PortletInvokerSupport invoker = context.getInvoker();
+ @Create
+ public void create()
+ {
+ context.setEventControllerContext(eventControllerContext);
+ }
+
@Test
public void testActionReturnsUpdateNavigationalState() throws PortletInvokerException
{
@@ -139,11 +153,11 @@
PortletSupport barPortlet = invoker.addPortlet("bar");
//
- EventProducerAction eventProducer = new EventProducerAction(srcName);
+ EventProducerActionHandler eventProducerHandler = new EventProducerActionHandler(srcName);
NoOpEventProcessor eventConsumer = new NoOpEventProcessor();
// Create wire
- context.getEventControllerContext().createWire(srcName, "foo", dstName, "bar");
+ eventControllerContext.createWire(srcName, "foo", dstName, "bar");
//
ControllerRequest request = new PortletActionRequest(
@@ -157,7 +171,7 @@
//
controller.setDistributeNonProduceableEvents(true);
controller.setDistributeNonConsumableEvents(true);
- fooPortlet.addHandler(eventProducer);
+ fooPortlet.addHandler(eventProducerHandler);
barPortlet.addHandler(eventConsumer);
controller.process(context, request);
fooPortlet.assertInvocationCountIs(1);
@@ -166,7 +180,7 @@
//
controller.setDistributeNonProduceableEvents(true);
controller.setDistributeNonConsumableEvents(false);
- fooPortlet.addHandler(eventProducer);
+ fooPortlet.addHandler(eventProducerHandler);
controller.process(context, request);
fooPortlet.assertInvocationCountIs(2);
barPortlet.assertInvocationCountIs(1);
@@ -177,7 +191,7 @@
//
controller.setDistributeNonProduceableEvents(true);
controller.setDistributeNonConsumableEvents(true);
- fooPortlet.addHandler(eventProducer);
+ fooPortlet.addHandler(eventProducerHandler);
barPortlet.addHandler(eventConsumer);
controller.process(context, request);
fooPortlet.assertInvocationCountIs(3);
@@ -186,7 +200,7 @@
//
controller.setDistributeNonProduceableEvents(true);
controller.setDistributeNonConsumableEvents(false);
- fooPortlet.addHandler(eventProducer);
+ fooPortlet.addHandler(eventProducerHandler);
barPortlet.addHandler(eventConsumer);
controller.process(context, request);
fooPortlet.assertInvocationCountIs(4);
@@ -195,7 +209,7 @@
//
controller.setDistributeNonProduceableEvents(false);
controller.setDistributeNonConsumableEvents(true);
- fooPortlet.addHandler(eventProducer);
+ fooPortlet.addHandler(eventProducerHandler);
controller.process(context, request);
fooPortlet.assertInvocationCountIs(5);
barPortlet.assertInvocationCountIs(3);
@@ -203,7 +217,7 @@
//
controller.setDistributeNonProduceableEvents(false);
controller.setDistributeNonConsumableEvents(false);
- fooPortlet.addHandler(eventProducer);
+ fooPortlet.addHandler(eventProducerHandler);
controller.process(context, request);
fooPortlet.assertInvocationCountIs(6);
barPortlet.assertInvocationCountIs(3);
@@ -214,7 +228,7 @@
//
controller.setDistributeNonProduceableEvents(false);
controller.setDistributeNonConsumableEvents(true);
- fooPortlet.addHandler(eventProducer);
+ fooPortlet.addHandler(eventProducerHandler);
barPortlet.addHandler(eventConsumer);
controller.process(context, request);
fooPortlet.assertInvocationCountIs(7);
@@ -223,20 +237,157 @@
//
controller.setDistributeNonProduceableEvents(false);
controller.setDistributeNonConsumableEvents(false);
- fooPortlet.addHandler(eventProducer);
+ fooPortlet.addHandler(eventProducerHandler);
barPortlet.addHandler(eventConsumer);
controller.process(context, request);
fooPortlet.assertInvocationCountIs(8);
barPortlet.assertInvocationCountIs(5);
}
- private static class EventProducerAction extends PortletSupport.ActionHandler
+ @Test
+ public void testEventFloodDetection() throws PortletInvokerException
{
+ QName srcName = new QName("juu", "foo");
+ //
+ PortletSupport fooPortlet = invoker.addPortlet("foo");
+
+ // Create wire
+ eventControllerContext.createWire(srcName, "foo", srcName, "foo");
+
+ ControllerRequest request = new PortletActionRequest(
+ "foo",
+ new OpaqueStateString(""),
+ new ParameterMap(),
+ new WindowNavigationalState(),
+ context.getStateControllerContext().createPageState(false)
+ );
+
+ EventProducerActionHandler eventProducerActionHandler = new EventProducerActionHandler(srcName);
+ EventProducerEventHandler eventProducerEventHandler = new EventProducerEventHandler(srcName);
+
+ //
+ controller.setConsumedEventThreshold(10);
+ controller.setProducedEventThreshold(1);
+ fooPortlet.addHandler(eventProducerActionHandler);
+ fooPortlet.addHandler(eventProducerEventHandler);
+ ControllerResponse response = controller.process(context, request);
+ PageUpdateResponse updateResponse = assertInstanceOf(response, PageUpdateResponse.class);
+ assertEquals(PortletResponse.PRODUCED_EVENT_FLOODED, updateResponse.getEventDistributionStatus());
+
+ //
+ controller.setConsumedEventThreshold(1);
+ controller.setProducedEventThreshold(10);
+ fooPortlet.addHandler(eventProducerActionHandler);
+ fooPortlet.addHandler(eventProducerEventHandler);
+ response = controller.process(context, request);
+ updateResponse = assertInstanceOf(response, PageUpdateResponse.class);
+ assertEquals(PortletResponse.CONSUMED_EVENT_FLOODED, updateResponse.getEventDistributionStatus());
+ }
+
+ @Test
+ public void testEventFloodInterruption() throws PortletInvokerException
+ {
+ QName srcName = new QName("juu", "foo");
+
+ //
+ PortletSupport fooPortlet = invoker.addPortlet("foo");
+
+ // Create wire
+ eventControllerContext.createWire(srcName, "foo", srcName, "foo");
+
+ ControllerRequest request = new PortletActionRequest(
+ "foo",
+ new OpaqueStateString(""),
+ new ParameterMap(),
+ new WindowNavigationalState(),
+ context.getStateControllerContext().createPageState(false)
+ );
+
+ //
+ EventProducerActionHandler eventProducerActionHandler = new EventProducerActionHandler(srcName);
+
+ //
+ controller.setConsumedEventThreshold(10);
+ controller.setProducedEventThreshold(10);
+ context.setEventControllerContext(new EventControllerContext()
+ {
+ public void handleEvent(EventPhaseSession session, Event producedEvent)
+ {
+ session.interrupt();
+ }
+ });
+ fooPortlet.addHandler(eventProducerActionHandler);
+ ControllerResponse response = controller.process(context, request);
+ PageUpdateResponse updateResponse = assertInstanceOf(response, PageUpdateResponse.class);
+ assertEquals(PortletResponse.INTERRUPTED, updateResponse.getEventDistributionStatus());
+ }
+
+ @Test
+ public void testEventControllerContextFails() throws PortletInvokerException
+ {
+ QName srcName = new QName("juu", "foo");
+
+ //
+ PortletSupport fooPortlet = invoker.addPortlet("foo");
+
+ // Create wire
+ eventControllerContext.createWire(srcName, "foo", srcName, "foo");
+
+ ControllerRequest request = new PortletActionRequest(
+ "foo",
+ new OpaqueStateString(""),
+ new ParameterMap(),
+ new WindowNavigationalState(),
+ context.getStateControllerContext().createPageState(false)
+ );
+
+ //
+ EventProducerActionHandler eventProducerActionHandler = new EventProducerActionHandler(srcName);
+
+ //
+ controller.setConsumedEventThreshold(10);
+ controller.setProducedEventThreshold(10);
+ context.setEventControllerContext(new EventControllerContext()
+ {
+ public void handleEvent(EventPhaseSession session, Event producedEvent)
+ {
+ throw new RuntimeException();
+ }
+ });
+ fooPortlet.addHandler(eventProducerActionHandler);
+ ControllerResponse response = controller.process(context, request);
+ PageUpdateResponse updateResponse = assertInstanceOf(response, PageUpdateResponse.class);
+ assertEquals(PortletResponse.DISTRIBUTION_DONE, updateResponse.getEventDistributionStatus());
+
+ //
+ final Error error = new Error();
+ context.setEventControllerContext(new EventControllerContext()
+ {
+ public void handleEvent(EventPhaseSession session, Event producedEvent)
+ {
+ throw error;
+ }
+ });
+ fooPortlet.addHandler(eventProducerActionHandler);
+ try
+ {
+ controller.process(context, request);
+ fail();
+ }
+ catch (Error ignore)
+ {
+ assertSame(error, ignore);
+ }
+ }
+
+ private static class EventProducerActionHandler extends PortletSupport.ActionHandler
+ {
+
/** . */
private final QName name;
- private EventProducerAction(QName name)
+ private EventProducerActionHandler(QName name)
{
this.name = name;
}
@@ -249,6 +400,25 @@
}
}
+ private static class EventProducerEventHandler extends PortletSupport.EventHandler
+ {
+
+ /** . */
+ private final QName name;
+
+ private EventProducerEventHandler(QName name)
+ {
+ this.name = name;
+ }
+
+ protected PortletInvocationResponse invoke(EventInvocation action) throws PortletInvokerException
+ {
+ UpdateNavigationalStateResponse update = new UpdateNavigationalStateResponse();
+ update.queueEvent(new UpdateNavigationalStateResponse.Event(name, null));
+ return update;
+ }
+ }
+
private static class NoOpEventProcessor extends PortletSupport.EventHandler
{
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalServlet.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalServlet.java 2008-02-27 20:42:50 UTC (rev 10138)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalServlet.java 2008-02-27 22:06:45 UTC (rev 10139)
@@ -31,7 +31,6 @@
import org.jboss.portal.portlet.test.controller.PageRenderer;
import org.jboss.portal.portlet.test.controller.PortletControllerContextImpl;
import org.jboss.portal.portlet.test.controller.Renderer;
-import org.jboss.portal.portlet.test.controller.AbstractRendererContext;
import org.jboss.portal.portlet.test.controller.RendererContextImpl;
import org.jboss.portal.web.WebRequest;
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PageEventControllerContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PageEventControllerContext.java 2008-02-27 20:42:50 UTC (rev 10138)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PageEventControllerContext.java 2008-02-27 22:06:45 UTC (rev 10139)
@@ -24,6 +24,7 @@
import org.jboss.portal.portlet.controller.event.EventControllerContext;
import org.jboss.portal.portlet.controller.event.Event;
+import org.jboss.portal.portlet.controller.event.EventPhaseSession;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.info.PortletInfo;
@@ -55,11 +56,8 @@
this.prepareResponse = prepareResponse;
}
- public List<Event> getConsumedEvents(Event producedEvent)
+ public void handleEvent(EventPhaseSession session, Event producedEvent)
{
- ArrayList<Event> consumedEvents = new ArrayList<Event>();
-
- //
for (String windowId : prepareResponse.getWindowIds())
{
try
@@ -74,18 +72,17 @@
//
if (portletInfo.getEventing().getConsumedEvents().containsKey(producedEvent.getName()))
{
- Event consumedEvent = new Event(producedEvent.getName(), producedEvent.getPayload(), windowId);
- consumedEvents.add(consumedEvent);
+ session.queueEvent(new Event(producedEvent.getName(), producedEvent.getPayload(), windowId));
}
}
}
catch (PortletInvokerException e)
{
e.printStackTrace();
+
+ //
+ session.interrupt();
}
}
-
- //
- return consumedEvents;
}
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKRendererContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKRendererContext.java 2008-02-27 20:42:50 UTC (rev 10138)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKRendererContext.java 2008-02-27 22:06:45 UTC (rev 10139)
@@ -25,6 +25,7 @@
import org.jboss.portal.portlet.test.controller.AbstractRendererContext;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.NoSuchPortletException;
import java.util.Collection;
import java.util.ArrayList;
@@ -53,8 +54,18 @@
{
for (String involvedPortletId : pageState.getInvolvedPortlets())
{
- Portlet involvedPortlet = portletControllerContext.getPortlet(involvedPortletId);
- involvedPortlets.add(involvedPortlet);
+ try
+ {
+ Portlet involvedPortlet = portletControllerContext.getPortlet(involvedPortletId);
+ involvedPortlets.add(involvedPortlet);
+ }
+ catch (NoSuchPortletException e)
+ {
+ // It happen when a portlet becomes unavailable and
+ // therefore is removed from the available portlet
+ // in that case it should not prevent the other portlets to be
+ // rendered
+ }
}
}
16 years, 2 months
JBoss Portal SVN: r10138 - in modules/portlet/trunk/portlet/src/test/java/org/jboss/portal: unit and 1 other directory.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-02-27 15:42:50 -0500 (Wed, 27 Feb 2008)
New Revision: 10138
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/TestConstants.java
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/api/portletcontext/VersionTestCase.java
Log:
- Renamed TestContants to TestConstants.
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/api/portletcontext/VersionTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/api/portletcontext/VersionTestCase.java 2008-02-27 16:39:53 UTC (rev 10137)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/api/portletcontext/VersionTestCase.java 2008-02-27 20:42:50 UTC (rev 10138)
@@ -22,18 +22,16 @@
******************************************************************************/
package org.jboss.portal.test.portlet.jsr168.api.portletcontext;
+import org.jboss.portal.test.portlet.framework.UTP1;
import org.jboss.portal.unit.PortletTestCase;
import org.jboss.portal.unit.PortletTestContext;
-import org.jboss.portal.unit.TestContants;
-import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.TestConstants;
import org.jboss.portal.unit.actions.PortletRenderTestAction;
-import org.jboss.portal.test.portlet.framework.UTP1;
import org.jboss.portal.unit.annotations.TestCase;
-import org.jboss.portal.unit.TestContants;
-import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import static org.jboss.unit.api.Assert.assertEquals;
import org.jboss.unit.driver.DriverResponse;
import org.jboss.unit.driver.response.EndTestResponse;
-import static org.jboss.unit.api.Assert.assertEquals;
import javax.portlet.Portlet;
import javax.portlet.RenderRequest;
@@ -54,8 +52,8 @@
{
AbstractUniversalTestPortlet aport = (AbstractUniversalTestPortlet)portlet;
- assertEquals(TestContants.MINOR_VERSION, aport.getPortletContext().getMinorVersion());
- assertEquals(TestContants.MAJOR_VERSION, aport.getPortletContext().getMajorVersion());
+ assertEquals(TestConstants.MINOR_VERSION, aport.getPortletContext().getMinorVersion());
+ assertEquals(TestConstants.MAJOR_VERSION, aport.getPortletContext().getMajorVersion());
return new EndTestResponse();
}
});
Copied: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/TestConstants.java (from rev 10137, modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/TestContants.java)
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/TestConstants.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/TestConstants.java 2008-02-27 20:42:50 UTC (rev 10138)
@@ -0,0 +1,43 @@
+/******************************************************************************
+ * 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.unit;
+
+/**
+ * Constants for test asserts
+ *
+ * @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 5510 $
+ */
+public final class TestConstants
+{
+
+ /** String from <code>PortletContext.getServerInfo()</code/>. */
+ public static final String SERVER_INVO = "JBossPortal/1.0";
+
+ /** int for <code>PortletContext.getMinorVersion()</code/>. */
+ public static final int MINOR_VERSION = 0;
+
+ /** int for <code>PortletContext.getMajorVersion()</code/>. */
+ public static final int MAJOR_VERSION = 2;
+
+}
Property changes on: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/TestConstants.java
___________________________________________________________________
Name: svn:executable
+
16 years, 2 months
JBoss Portal SVN: r10137 - branches/JBoss_Portal_Branch_2_7/server/src/main/org/jboss/portal/server.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-02-27 11:39:53 -0500 (Wed, 27 Feb 2008)
New Revision: 10137
Modified:
branches/JBoss_Portal_Branch_2_7/server/src/main/org/jboss/portal/server/PortalConstants.java
Log:
Feel like commiting something
Modified: branches/JBoss_Portal_Branch_2_7/server/src/main/org/jboss/portal/server/PortalConstants.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/server/src/main/org/jboss/portal/server/PortalConstants.java 2008-02-27 10:54:18 UTC (rev 10136)
+++ branches/JBoss_Portal_Branch_2_7/server/src/main/org/jboss/portal/server/PortalConstants.java 2008-02-27 16:39:53 UTC (rev 10137)
@@ -36,7 +36,7 @@
{
/** Current version. */
- public static final Version VERSION = new Version("JBoss Portal", 2, 6, 5, new Version.Qualifier(Version.Qualifier.Prefix.SNAPSHOT), "Ninja");
+ public static final Version VERSION = new Version("JBoss Portal", 2, 7, 0, new Version.Qualifier(Version.Qualifier.Prefix.SNAPSHOT), "Community");
/** The default portal name. */
public static final String DEFAULT_PORTAL_NAME = "default";
16 years, 2 months
JBoss Portal SVN: r10136 - in modules/portlet/trunk/portlet/src: test/java/org/jboss/portal/test/portlet/jsr168/ext/session and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-27 05:54:18 -0500 (Wed, 27 Feb 2008)
New Revision: 10136
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/session/PortletScopedAttributesAreApplicationScopedAttributesTestCase.java
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletSessionImpl.java
Log:
- fix a bug in portlet session and add test case for it
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletSessionImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletSessionImpl.java 2008-02-27 10:26:26 UTC (rev 10135)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletSessionImpl.java 2008-02-27 10:54:18 UTC (rev 10136)
@@ -83,49 +83,50 @@
public Enumeration<String> getAttributeNames(int scope)
{
- final boolean app = scope == APPLICATION_SCOPE;
- return new Enumeration<String>()
+ if (scope == APPLICATION_SCOPE)
{
- private Enumeration e;
- private String next;
-
+ return (Enumeration<String>)session.getAttributeNames();
+ }
+ else
+ {
+ return new Enumeration<String>()
{
- e = session.getAttributeNames();
- next = null;
- next();
- }
+ private Enumeration e;
+ private String next;
- public boolean hasMoreElements()
- {
- return next != null;
- }
+ {
+ e = session.getAttributeNames();
+ next = null;
+ next();
+ }
- public String nextElement()
- {
- String result = next;
- next = null;
- next();
- return result;
- }
+ public boolean hasMoreElements()
+ {
+ return next != null;
+ }
- private void next()
- {
- while (e.hasMoreElements())
+ public String nextElement()
{
- String attribute = (String)e.nextElement();
- if (app && !attribute.startsWith("javax.portlet."))
+ String result = next;
+ next = null;
+ next();
+ return result;
+ }
+
+ private void next()
+ {
+ while (e.hasMoreElements())
{
- next = attribute;
- break;
+ String attribute = (String)e.nextElement();
+ if (attribute.startsWith(prefix))
+ {
+ next = attribute.substring(prefix.length());
+ break;
+ }
}
- else if (!app && attribute.startsWith(prefix))
- {
- next = attribute.substring(prefix.length());
- break;
- }
}
- }
- };
+ };
+ }
}
public long getCreationTime()
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/session/PortletScopedAttributesAreApplicationScopedAttributesTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/session/PortletScopedAttributesAreApplicationScopedAttributesTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/session/PortletScopedAttributesAreApplicationScopedAttributesTestCase.java 2008-02-27 10:54:18 UTC (rev 10136)
@@ -0,0 +1,72 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.jsr168.ext.session;
+
+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.test.portlet.framework.UTP1;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+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.PortletSession;
+import javax.portlet.PortletSessionUtil;
+import java.io.IOException;
+import java.util.Enumeration;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+@TestCase
+public class PortletScopedAttributesAreApplicationScopedAttributesTestCase
+{
+
+ public PortletScopedAttributesAreApplicationScopedAttributesTestCase(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
+ {
+ PortletSession session = request.getPortletSession();
+ session.setAttribute("foo", "bar");
+ Enumeration e = session.getAttributeNames(PortletSession.APPLICATION_SCOPE);
+ assertNotNull(e);
+ assertTrue(e.hasMoreElements());
+ String scopedFoo = (String)e.nextElement();
+ assertNotNull(scopedFoo);
+ assertEquals("foo", PortletSessionUtil.decodeAttributeName(scopedFoo));
+ assertEquals(PortletSession.PORTLET_SCOPE, PortletSessionUtil.decodeScope(scopedFoo));
+ Object bar = session.getAttribute(scopedFoo, PortletSession.APPLICATION_SCOPE);
+ assertEquals("bar", bar);
+ return new EndTestResponse();
+ }
+ });
+ }
+}
16 years, 2 months
JBoss Portal SVN: r10135 - modules/portlet/trunk/test/src/test.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-02-27 05:26:26 -0500 (Wed, 27 Feb 2008)
New Revision: 10135
Modified:
modules/portlet/trunk/test/src/test/build.xml
Log:
make portlet api jar be addded to tck portal
Modified: modules/portlet/trunk/test/src/test/build.xml
===================================================================
--- modules/portlet/trunk/test/src/test/build.xml 2008-02-27 09:35:20 UTC (rev 10134)
+++ modules/portlet/trunk/test/src/test/build.xml 2008-02-27 10:26:26 UTC (rev 10135)
@@ -777,7 +777,7 @@
<path location="${dependency.portal-common-portal.jar}"/>
<path location="${dependency.portal-portlet.jar}"/>
<path location="${dependency.portal-web.jar}"/>
- <!--<path location="${dependency.jsr168api.jar}"/>-->
+ <path location="${dependency.jsr168api.jar}"/>
<path location="${dependency.jaxb-api.jar}"/>
<path location="${dependency.jboss-unit.jar}"/>
@@ -844,7 +844,7 @@
<path location="${dependency.portal-common-portal.jar}"/>
<path location="${dependency.portal-portlet.jar}"/>
<path location="${dependency.portal-web.jar}"/>
- <!--<path location="${dependency.jsr168api.jar}"/>-->
+ <path location="${dependency.jsr168api.jar}"/>
<path location="${dependency.jboss-unit.jar}"/>
<path location="${dependency.jboss-unit-remote.jar}"/>
16 years, 2 months
JBoss Portal SVN: r10134 - in modules/portlet/trunk: portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/taglib and 5 other directories.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-02-27 04:35:20 -0500 (Wed, 27 Feb 2008)
New Revision: 10134
Added:
modules/portlet/trunk/portlet/src/main/resources/META-INF/
modules/portlet/trunk/portlet/src/main/resources/META-INF/portlet.tld
modules/portlet/trunk/portlet/src/main/resources/META-INF/portlet_2_0.tld
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portleturl/PortletURLModeTestCase.java
Removed:
modules/portlet/trunk/portlet/src/main/resources/org/
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/taglib/GenerateURLTag.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/ActionURL286Tag.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/GenerateURL286Tag.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/RenderURL286Tag.java
modules/portlet/trunk/test/src/test/build.xml
Log:
- package taglib tlds in portlet jar
- fix state propagation after action
- fix taglib parameters
- make setting JBOSS_4_2_1_HOME and TOMCAT_6_0_HOME not nessesary when -Dmaven.test.skip=true is present
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java 2008-02-27 06:45:24 UTC (rev 10133)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java 2008-02-27 09:35:20 UTC (rev 10134)
@@ -358,10 +358,10 @@
protected PortletParameterMap navigationalState = new PortletParameterMap(preq.navigationInfo);
/** The new window state requested. */
- protected org.jboss.portal.WindowState windowState;
+ protected org.jboss.portal.WindowState windowState = new org.jboss.portal.WindowState(preq.getWindowState().toString());
/** The new mode requested. */
- protected Mode mode;
+ protected Mode mode = new Mode(preq.getPortletMode().toString());
protected PortletInvocationResponse getResponse()
{
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/taglib/GenerateURLTag.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/taglib/GenerateURLTag.java 2008-02-27 06:45:24 UTC (rev 10133)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/taglib/GenerateURLTag.java 2008-02-27 09:35:20 UTC (rev 10134)
@@ -141,7 +141,7 @@
*
* @return Returns the parameters.
*/
- private Map getURLParameters()
+ protected Map getURLParameters()
{
Map urlParameters = new HashMap(parameters.size());
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/ActionURL286Tag.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/ActionURL286Tag.java 2008-02-27 06:45:24 UTC (rev 10133)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/ActionURL286Tag.java 2008-02-27 09:35:20 UTC (rev 10134)
@@ -73,6 +73,8 @@
setCopyCurrentRenderParameters(newPortletURL);
+ removeTagParametersWithEmptyValue(newPortletURL);
+
setName(newPortletURL);
return newPortletURL;
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/GenerateURL286Tag.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/GenerateURL286Tag.java 2008-02-27 06:45:24 UTC (rev 10133)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/GenerateURL286Tag.java 2008-02-27 09:35:20 UTC (rev 10134)
@@ -34,6 +34,8 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Enumeration;
+import java.util.LinkedList;
+import java.util.Arrays;
import java.io.StringWriter;
/**
@@ -75,10 +77,62 @@
//default is false
if (copyCurrentRenderParameters != null && copyCurrentRenderParameters.equalsIgnoreCase("true"))
{
- portletURL.setParameters(getPortletRequest().getPrivateParameterMap());
+ // Parameters values specified in tag need to be pre-pended
+
+ Map<String, String[]> parameters = portletURL.getParameterMap();
+
+ Map<String, String[]> privateParams = getPortletRequest().getPrivateParameterMap();
+
+ for(String name : privateParams.keySet())
+ {
+
+ if (!parameters.containsKey(name))
+ {
+ parameters.put(name, privateParams.get(name));
+ }
+ else
+ {
+ String[] val1 = parameters.get(name);
+ String[] val2 = privateParams.get(name);
+ String[] newVal = new String[val1.length + val2.length];
+
+ for (int i = 0; i < val1.length; i++)
+ {
+ newVal[i] = val1[i];
+ }
+ for (int i = 0; i < val2.length; i++)
+ {
+ newVal[val1.length + i] = val2[i];
+ }
+ parameters.put(name, newVal);
+ }
+ }
+
+ portletURL.setParameters(parameters);
}
}
+ protected void removeTagParametersWithEmptyValue(PortletURL portletURL)
+ {
+ // Introduced in jsr 286 - the empty param tag value removes the parameter
+
+ Map<String, String[]> parameters = portletURL.getParameterMap();
+
+ Map<String, String[]> tagParams = getURLParameters();
+
+ for (String name : tagParams.keySet())
+ {
+ String[] values = tagParams.get(name);
+ if (values.length > 0 && values[values.length - 1].equals(""))
+ {
+ parameters.remove(name);
+ }
+ }
+
+ portletURL.setParameters(parameters);
+
+ }
+
protected boolean isEscapeXml()
{
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/RenderURL286Tag.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/RenderURL286Tag.java 2008-02-27 06:45:24 UTC (rev 10133)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/RenderURL286Tag.java 2008-02-27 09:35:20 UTC (rev 10134)
@@ -54,6 +54,8 @@
setCopyCurrentRenderParameters(newPortletURL);
+ removeTagParametersWithEmptyValue(newPortletURL);
+
return newPortletURL;
}
}
Copied: modules/portlet/trunk/portlet/src/main/resources/META-INF/portlet.tld (from rev 10119, modules/portlet/trunk/portlet/src/main/resources/org/jboss/portal/portlet/portlet.tld)
===================================================================
--- modules/portlet/trunk/portlet/src/main/resources/META-INF/portlet.tld (rev 0)
+++ modules/portlet/trunk/portlet/src/main/resources/META-INF/portlet.tld 2008-02-27 09:35:20 UTC (rev 10134)
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN" "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
+<taglib>
+
+ <tlib-version>1.0</tlib-version>
+ <jsp-version>1.2</jsp-version>
+ <short-name>portlet</short-name>
+
+ <uri>http://java.sun.com/portlet</uri>
+
+ <tag>
+
+ <name>param</name>
+ <tag-class>org.jboss.portal.portlet.impl.jsr168.taglib.URLParameterTag</tag-class>
+ <body-content>empty</body-content>
+
+ <attribute>
+ <name>name</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>value</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+
+ </tag>
+ <tag>
+
+ <name>renderURL</name>
+ <tag-class>org.jboss.portal.portlet.impl.jsr168.taglib.RenderURLTag</tag-class>
+ <tei-class>org.jboss.portal.portlet.impl.jsr168.taglib.GenerateURLTagTEI</tei-class>
+ <body-content>JSP</body-content>
+
+ <attribute>
+ <name>portletMode</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>secure</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>windowState</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+
+ </tag>
+ <tag>
+
+ <name>defineObjects</name>
+ <tag-class>org.jboss.portal.portlet.impl.jsr168.taglib.DefineObjectsTag</tag-class>
+ <tei-class>org.jboss.portal.portlet.impl.jsr168.taglib.DefineObjectsTagTEI</tei-class>
+ <body-content>empty</body-content>
+
+ </tag>
+ <tag>
+
+ <name>actionURL</name>
+ <tag-class>org.jboss.portal.portlet.impl.jsr168.taglib.ActionURLTag</tag-class>
+ <tei-class>org.jboss.portal.portlet.impl.jsr168.taglib.GenerateURLTagTEI</tei-class>
+ <body-content>JSP</body-content>
+
+ <attribute>
+ <name>portletMode</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>secure</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>windowState</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+
+ </tag>
+ <tag>
+
+ <name>namespace</name>
+ <tag-class>org.jboss.portal.portlet.impl.jsr168.taglib.NamespaceTag</tag-class>
+ <body-content>empty</body-content>
+
+ </tag>
+
+</taglib>
Copied: modules/portlet/trunk/portlet/src/main/resources/META-INF/portlet_2_0.tld (from rev 10119, modules/portlet/trunk/portlet/src/main/resources/org/jboss/portal/portlet/portlet_2_0.tld)
===================================================================
--- modules/portlet/trunk/portlet/src/main/resources/META-INF/portlet_2_0.tld (rev 0)
+++ modules/portlet/trunk/portlet/src/main/resources/META-INF/portlet_2_0.tld 2008-02-27 09:35:20 UTC (rev 10134)
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+ <taglib xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ version="2.0">
+
+ <description>Portlet 2.0 Tag Library</description>
+ <display-name>Portlet 2.0 Tags</display-name>
+ <tlib-version>2.0</tlib-version>
+ <short-name>portlet</short-name>
+ <uri>http://java.sun.com/portlet_2_0</uri>
+
+ <tag>
+
+ <name>param</name>
+ <tag-class>org.jboss.portal.portlet.impl.jsr286.taglib.URLParameter286Tag</tag-class>
+ <body-content>empty</body-content>
+
+ <attribute>
+ <name>name</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>value</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+
+ </tag>
+ <tag>
+
+ <name>property</name>
+ <tag-class>org.jboss.portal.portlet.impl.jsr286.taglib.URLProperty286Tag</tag-class>
+ <body-content>empty</body-content>
+
+ <attribute>
+ <name>name</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>value</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+
+ </tag>
+ <tag>
+
+ <name>renderURL</name>
+ <tag-class>org.jboss.portal.portlet.impl.jsr286.taglib.RenderURL286Tag</tag-class>
+ <tei-class>org.jboss.portal.portlet.impl.jsr286.taglib.GenerateURL286TagTEI</tei-class>
+ <body-content>JSP</body-content>
+
+ <attribute>
+ <name>portletMode</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>secure</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>windowState</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>escapeXml</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>copyCurrentRenderParameters</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+
+ </tag>
+ <tag>
+
+ <name>defineObjects</name>
+ <tag-class>org.jboss.portal.portlet.impl.jsr286.taglib.DefineObjects286Tag</tag-class>
+ <tei-class>org.jboss.portal.portlet.impl.jsr286.taglib.DefineObjects286TagTEI</tei-class>
+ <body-content>empty</body-content>
+
+ </tag>
+ <tag>
+
+ <name>actionURL</name>
+ <tag-class>org.jboss.portal.portlet.impl.jsr286.taglib.ActionURL286Tag</tag-class>
+ <tei-class>org.jboss.portal.portlet.impl.jsr286.taglib.GenerateURL286TagTEI</tei-class>
+ <body-content>JSP</body-content>
+
+ <attribute>
+ <name>portletMode</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>secure</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>windowState</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>escapeXml</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>copyCurrentRenderParameters</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>name</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+
+
+ </tag>
+ <tag>
+
+ <name>resourceURL</name>
+ <tag-class>org.jboss.portal.portlet.impl.jsr286.taglib.ResourceURL286Tag</tag-class>
+ <tei-class>org.jboss.portal.portlet.impl.jsr286.taglib.ResourceURL286TagTEI</tei-class>
+ <body-content>JSP</body-content>
+
+ <attribute>
+ <name>secure</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>escapeXml</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>cacheability</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>id</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+
+ </tag>
+ <tag>
+
+ <name>namespace</name>
+ <tag-class>org.jboss.portal.portlet.impl.jsr286.taglib.Namespace286Tag</tag-class>
+ <body-content>empty</body-content>
+
+ </tag>
+
+</taglib>
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portleturl/PortletURLModeTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portleturl/PortletURLModeTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portleturl/PortletURLModeTestCase.java 2008-02-27 09:35:20 UTC (rev 10134)
@@ -0,0 +1,100 @@
+/*
+* 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.portleturl;
+
+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.assertEquals;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletURL;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletModeException;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+@TestCase
+public class PortletURLModeTestCase
+{
+ private int actionCount = 0;
+
+ public PortletURLModeTestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
+ {
+ PortletURL url = response.createActionURL();
+
+ //set some render parameters to test
+ try
+ {
+ url.setPortletMode(PortletMode.EDIT);
+ }
+ catch (PortletModeException e)
+ {
+ throw new IllegalStateException("Edit mode in test not supported");
+ }
+
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ seq.bindAction(1, UTP1.ACTION_JOIN_POINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context)
+ {
+ assertEquals(request.getPortletMode(), PortletMode.EDIT);
+ actionCount++;
+ }
+ });
+
+ seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
+ {
+
+ assertEquals(request.getPortletMode(), PortletMode.EDIT);
+ assertEquals(1, actionCount);
+
+ return new EndTestResponse();
+ }
+ });
+
+
+ }
+}
+
Modified: modules/portlet/trunk/test/src/test/build.xml
===================================================================
--- modules/portlet/trunk/test/src/test/build.xml 2008-02-27 06:45:24 UTC (rev 10133)
+++ modules/portlet/trunk/test/src/test/build.xml 2008-02-27 09:35:20 UTC (rev 10134)
@@ -1,8 +1,12 @@
<?xml version="1.0"?>
<project name="portlet-integration-test">
- <target name="tests" depends="prepare_env, evaluate_properties" unless="maven.test.skip">
+ <target name="tests" unless="maven.test.skip">
+ <antcall target="__tests"/>
+ </target>
+ <target name="__tests" depends="prepare_env, evaluate_properties" >
+
<echo message="compile classpath: ${compile_classpath}"/>
<echo message="runtime classpath: ${runtime_classpath}"/>
<echo message="test classpath: ${test_classpath}"/>
@@ -302,11 +306,11 @@
<!-- JSR 168 TLD -->
<zipfileset
src="${dependency.portal-portlet.jar}"
- includes="org/jboss/portal/portlet/portlet.tld"
+ includes="META-INF/portlet.tld"
fullpath="META-INF/portlet.tld"/>
<zipfileset
src="${dependency.portal-portlet.jar}"
- includes="org/jboss/portal/portlet/portlet_2_0.tld"
+ includes="META-INF/portlet_2_0.tld"
fullpath="META-INF/portlet_2_0.tld"/>
</jar>
@@ -505,6 +509,7 @@
<configuration home="${test.jboss-4.2.tempdir}">
<property name="cargo.servlet.port" value="8080"/>
<property name="cargo.logging" value="high"/>
+ <!--<property name="cargo.jvmargs" value="-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y"/>-->
<deployable type="war" file="${test.temp.lib}/jboss-4.2/portlet-test.war"/>
</configuration>
</cargo>
@@ -712,11 +717,12 @@
<property name="tck" value="${target}/tck"/>
<property name="tck-jboss" value="${tck}/jboss42"/>
+ <property name="tck-tomcat" value="${tck}/tomcat6"/>
<mkdir dir="${tck}"/>
<mkdir dir="${tck-jboss}"/>
- <!--<mkdir dir="${tck}/jboss42"/>-->
+ <mkdir dir="${tck-tomcat}"/>
<!--<mkdir dir="${tck}/tomcat6"/>-->
@@ -771,7 +777,7 @@
<path location="${dependency.portal-common-portal.jar}"/>
<path location="${dependency.portal-portlet.jar}"/>
<path location="${dependency.portal-web.jar}"/>
- <path location="${dependency.jsr168api.jar}"/>
+ <!--<path location="${dependency.jsr168api.jar}"/>-->
<path location="${dependency.jaxb-api.jar}"/>
<path location="${dependency.jboss-unit.jar}"/>
@@ -781,6 +787,73 @@
</copy>
+ <!--TOMCAT-->
+
+ <copy todir="${tck-tomcat}/portlet-tck-war">
+ <fileset dir="${target}/test-classes/portlet-tck-war"/>
+ </copy>
+ <copy todir="${tck-tomcat}/portlet-tck-war">
+ <fileset dir="${target}/test-classes/tomcat-6.0/portlet-tck-war"/>
+ </copy>
+
+ <copy todir="${tck-tomcat}/portlet-tck-war/WEB-INF/lib" flatten="true">
+
+ <!-- -->
+ <fileset dir="${target}" includes="portlet-test-lib.jar"/>
+
+ <!-- -->
+ <path refid="mc.portal-common"/>
+
+ <path refid="mc.portal-portlet-controller"/>
+
+ <!-- Remote plugin -->
+ <path refid="mc.jboss-remoting"/>
+ <path refid="mc.portal-test-generic"/>
+
+ <!-- MC 2.0.0.Beta4 -->
+ <path refid="mc.trove"/>
+ <path refid="mc.xerces"/>
+ <path refid="mc.javassist"/>
+ <path refid="mc.jboss_common_core"/>
+ <path refid="mc.jboss_vfs"/>
+ <path refid="mc.jboss_xb"/>
+ <path refid="mc.jboss_aop"/>
+ <path refid="mc.jboss_microcontainer"/>
+
+
+ </copy>
+
+ <mkdir dir="${tck-tomcat}/tck-portal"/>
+
+ <jar jarfile="${tck-tomcat}/tck-portal/portlet-tck.war">
+ <fileset dir="${tck-tomcat}/portlet-tck-war"/>
+ </jar>
+
+ <copy todir="${tck-tomcat}/tck-portal" flatten="true">
+
+ <!--Stuff from shared classpath-->
+ <path location="${dependency.log4j.jar}"/>
+ <path location="${dependency.concurrent.jar}"/>
+ <path location="${dependency.activation.jar}"/>
+ <path location="${dependency.jaxb-api.jar}"/>
+
+ <path refid="mc.jboss_common_logging_spi"/>
+ <path refid="mc.jboss_common_logging_jdk"/>
+
+ <path location="${dependency.portal-common.jar}"/>
+ <path location="${dependency.portal-common-portal.jar}"/>
+ <path location="${dependency.portal-portlet.jar}"/>
+ <path location="${dependency.portal-web.jar}"/>
+ <!--<path location="${dependency.jsr168api.jar}"/>-->
+
+ <path location="${dependency.jboss-unit.jar}"/>
+ <path location="${dependency.jboss-unit-remote.jar}"/>
+ <path location="${dependency.portal-test.jar}"/>
+
+ </copy>
+
+
+
<delete file="${target}/portlet-test-lib.jar"/>
</target>
16 years, 2 months