[jboss-svn-commits] JBoss Portal SVN: r5611 - in trunk: common/src/main/org/jboss/portal/test/common core/src/main/org/jboss/portal/core/aspects/controller core/src/resources/portal-core-sar/META-INF portlet portlet/src/main/org/jboss/portal/portlet/aspects/portlet portlet/src/main/org/jboss/portal/portlet/impl/jsr168 portlet/src/main/org/jboss/portal/test/framework/portlet/components portlet/src/main/org/jboss/portal/test/portlet/jsr168/api/portletcontext portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/dispatcher portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/expiringcache portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/nocache portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/portletconfig portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/portletrequests portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/portletresponses portlet/src/main/org/jboss/portal/test/portlet/jsr16! 8/ext/preferences portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/session portlet/src/resources/test/jsr168/ext portlet/src/resources/test/jsr168/ext/expiringcache-war portlet/src/resources/test/jsr168/ext/expiringcache-war/WEB-INF portlet/src/resources/test/jsr168/ext/nocache-war portlet/src/resources/test/jsr168/ext/nocache-war/WEB-INF portlet/src/resources/test-sar/META-INF
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Nov 9 12:42:15 EST 2006
Author: julien at jboss.com
Date: 2006-11-09 12:41:48 -0500 (Thu, 09 Nov 2006)
New Revision: 5611
Added:
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java
trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/ExpiringCacheTestCase.java
trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/NoCacheTestCase.java
trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/expiringcache/
trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/expiringcache/ExpiringCacheSequenceBuilder.java
trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/nocache/
trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/nocache/NoCacheSequenceBuilder.java
trunk/portlet/src/resources/test/jsr168/ext/expiringcache-war/
trunk/portlet/src/resources/test/jsr168/ext/expiringcache-war/WEB-INF/
trunk/portlet/src/resources/test/jsr168/ext/expiringcache-war/WEB-INF/portlet.xml
trunk/portlet/src/resources/test/jsr168/ext/expiringcache-war/WEB-INF/web.xml
trunk/portlet/src/resources/test/jsr168/ext/nocache-war/
trunk/portlet/src/resources/test/jsr168/ext/nocache-war/WEB-INF/
trunk/portlet/src/resources/test/jsr168/ext/nocache-war/WEB-INF/portlet.xml
trunk/portlet/src/resources/test/jsr168/ext/nocache-war/WEB-INF/web.xml
Removed:
trunk/core/src/main/org/jboss/portal/core/aspects/controller/WindowCacheInterceptor.java
trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/dispatcher/DispatcherTestSuite.java
trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/portletconfig/PortletConfigTestSuite.java
trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/portletrequests/PortletRequestTestSuite.java
trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/portletresponses/PortletResponsesTestSuite.java
trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/preferences/PreferencesTestSuite.java
trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/session/SessionTestSuite.java
Modified:
trunk/common/src/main/org/jboss/portal/test/common/FastURLEncoderTestCase.java
trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
trunk/portlet/build.xml
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ProducerCacheInterceptor.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContextImpl.java
trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/components/AbstractUniversalTestPortlet.java
trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/api/portletcontext/PortletContextSequenceBuilder.java
trunk/portlet/src/resources/test-sar/META-INF/jboss-service.xml
Log:
JBPORTAL-1104 : setting expiration cache has no effect in trunk. Refactored the implementation to match JSR 286 semantics which are more precise than JSR 168. Added test cases as well.
Modified: trunk/common/src/main/org/jboss/portal/test/common/FastURLEncoderTestCase.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/FastURLEncoderTestCase.java 2006-11-09 16:27:28 UTC (rev 5610)
+++ trunk/common/src/main/org/jboss/portal/test/common/FastURLEncoderTestCase.java 2006-11-09 17:41:48 UTC (rev 5611)
@@ -92,7 +92,7 @@
{
try
{
- new FastURLEncoder(null, 0, 10);
+ FastURLEncoder.create(null, 0, 10);
fail();
}
catch (IllegalArgumentException expected)
@@ -100,7 +100,7 @@
}
try
{
- new FastURLEncoder("UTF8", -1, 10);
+ FastURLEncoder.create("UTF8", -1, 10);
fail();
}
catch (IllegalArgumentException expected)
@@ -108,7 +108,7 @@
}
try
{
- new FastURLEncoder("UTF8", -2, -1);
+ FastURLEncoder.create("UTF8", -2, -1);
fail();
}
catch (IllegalArgumentException expected)
@@ -116,7 +116,7 @@
}
try
{
- new FastURLEncoder("UTF8", 1, 0);
+ FastURLEncoder.create("UTF8", 1, 0);
fail();
}
catch (IllegalArgumentException expected)
@@ -124,7 +124,7 @@
}
try
{
- new FastURLEncoder("UTF8", 0, 0);
+ FastURLEncoder.create("UTF8", 0, 0);
fail();
}
catch (IllegalArgumentException expected)
@@ -132,7 +132,7 @@
}
try
{
- new FastURLEncoder("ABCDEF", 0, 10);
+ FastURLEncoder.create("ABCDEF", 0, 10);
fail();
}
catch (IllegalArgumentException expected)
Deleted: trunk/core/src/main/org/jboss/portal/core/aspects/controller/WindowCacheInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/WindowCacheInterceptor.java 2006-11-09 16:27:28 UTC (rev 5610)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/WindowCacheInterceptor.java 2006-11-09 17:41:48 UTC (rev 5611)
@@ -1,168 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.aspects.controller;
-
-import org.jboss.portal.common.invocation.InvocationContext;
-import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.controller.ControllerInterceptor;
-import org.jboss.portal.core.controller.command.InvokeWindowCommand;
-import org.jboss.portal.core.controller.command.RenderWindowCommand;
-import org.jboss.portal.core.controller.command.WindowCommand;
-import org.jboss.portal.core.controller.command.response.PortletResponse;
-import org.jboss.portal.portlet.invocation.response.FragmentResponse;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.invocation.response.cache.StrongTimedContent;
-import org.jboss.portal.portlet.invocation.response.cache.TimedContent;
-import org.jboss.portal.server.ServerInvocation;
-
-import java.io.Serializable;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class WindowCacheInterceptor extends ControllerInterceptor
-{
- public Object invoke(ControllerCommand cmd) throws Exception, InvocationException
- {
- if (cmd instanceof WindowCommand)
- {
- WindowCommand wc = (WindowCommand)cmd;
- InvocationContext invocationCtx = cmd.getContext();
- String scopeKey = "cached_markup." + wc.getTargetId();
-
- //
- if (cmd instanceof RenderWindowCommand)
- {
- RenderWindowCommand rwc = (RenderWindowCommand)cmd;
-
- //
- CacheEntry cachedEntry = (CacheEntry)invocationCtx.getAttribute(ServerInvocation.PRINCIPAL_SCOPE, scopeKey);
-
- //
- FragmentResponse fragment = null;
- if (cachedEntry != null)
- {
- long currentTimeMillis = System.currentTimeMillis();
-
- // Check time validity for fragment
- if (currentTimeMillis < cachedEntry.getExpirationTimeMillis())
- {
- fragment = cachedEntry.getContent();
- }
-
- // Remove the cached fragment
- if (fragment == null)
- {
- invocationCtx.removeAttribute(ServerInvocation.PRINCIPAL_SCOPE, scopeKey);
- }
- }
-
- //
- if (fragment == null)
- {
- // Invoke
- PortletResponse pr = (PortletResponse)cmd.invokeNext();
-
- // Get result
- PortletInvocationResponse response = pr.getResult();
-
- // Try to cache any fragment result
- if (response instanceof FragmentResponse)
- {
- FragmentResponse renderResult = (FragmentResponse)response;
-
- // Compute expiration time
- long expirationTimeMillis = 0;
- if (renderResult.getExpirationSecs() == -1)
- {
- expirationTimeMillis = Long.MAX_VALUE;
- }
- else if (renderResult.getExpirationSecs() > 0)
- {
- expirationTimeMillis = System.currentTimeMillis() + renderResult.getExpirationSecs() * 1000;
- }
-
- // Cache if required
- if (expirationTimeMillis > 0)
- {
- CacheEntry cacheEntry = new CacheEntry(renderResult, expirationTimeMillis);
- invocationCtx.setAttribute(ServerInvocation.PRINCIPAL_SCOPE, scopeKey, cacheEntry);
- }
- }
-
- //
- return pr;
- }
- else
- {
- // Use the cached fragment
- return new PortletResponse(rwc.getTargetId(), fragment);
- }
- }
- else if (cmd instanceof InvokeWindowCommand)
- {
- invocationCtx.removeAttribute(ServerInvocation.PRINCIPAL_SCOPE, scopeKey);
-
- //
- return cmd.invokeNext();
- }
- else
- {
- return cmd.invokeNext();
- }
- }
- else
- {
- return cmd.invokeNext();
- }
- }
-
- /** Encapsulate cache information. */
- public static class CacheEntry implements Serializable
- {
-
- /** The timed content. */
- private final TimedContent cachedResult;
-
- public CacheEntry(FragmentResponse result, long expirationTimeMillis)
- {
- if (expirationTimeMillis <= 0)
- {
- throw new IllegalArgumentException();
- }
- this.cachedResult = new StrongTimedContent(result, expirationTimeMillis);
- }
-
- public long getExpirationTimeMillis()
- {
- return cachedResult.getExpirationTimeMillis();
- }
-
- public FragmentResponse getContent()
- {
- return cachedResult.getContent();
- }
- }
-}
Modified: trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2006-11-09 16:27:28 UTC (rev 5610)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2006-11-09 17:41:48 UTC (rev 5611)
@@ -58,7 +58,7 @@
proxy-type="attribute">portal:service=PortletInvoker,type=Federating</depends>
<depends
optional-attribute-name="Interceptor"
- proxy-type="attribute">portal:service=ManagementInterceptor,type=Portlet,name=PortletContainer</depends>
+ proxy-type="attribute">portal:service=Interceptor,type=Portlet,name=PortletContainerManagement</depends>
<xmbean/>
</mbean>
@@ -209,13 +209,6 @@
proxy-type="attribute">portal:service=ListenerRegistry</depends>
</mbean>
<mbean
- code="org.jboss.portal.core.aspects.controller.WindowCacheInterceptor"
- name="portal:service=Interceptor,type=Command,name=WindowCache"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- </mbean>
- <mbean
code="org.jboss.portal.server.impl.invocation.JBossInterceptorStackFactory"
name="portal:service=InterceptorStackFactory,type=Command"
xmbean-dd=""
@@ -228,7 +221,6 @@
<depends-list-element>portal:service=Interceptor,type=Command,name=PageCustomizer</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Command,name=Ajax</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Command,name=EventBroadcaster</depends-list-element>
- <depends-list-element>portal:service=Interceptor,type=Command,name=WindowCache</depends-list-element>
</depends-list>
</mbean>
@@ -236,7 +228,7 @@
<!-- Management MBean, can be removed if management is not used -->
<mbean
code="org.jboss.portal.portlet.management.PortletContainerManagementInterceptorImpl"
- name="portal:service=ManagementInterceptor,type=Portlet,name=PortletContainer"
+ name="portal:service=Interceptor,type=Portlet,name=PortletContainerManagement"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
@@ -250,6 +242,13 @@
<depends optional-attribute-name="PortalAuthorizationManagerFactory" proxy-type="attribute">portal:service=PortalAuthorizationManagerFactory</depends>
</mbean>
<mbean
+ code="org.jboss.portal.portlet.aspects.portlet.ConsumerCacheInterceptor"
+ name="portal:service=Interceptor,type=Portlet,name=ConsumerCache"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ </mbean>
+ <mbean
code="org.jboss.portal.portlet.aspects.portlet.PortalSessionSynchronizationInterceptor"
name="portal:service=Interceptor,type=Portlet,name=PortalSessionSynchronization"
xmbean-dd=""
@@ -263,7 +262,8 @@
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
<depends-list optional-attribute-name="InterceptorNames">
- <depends-list-element>portal:service=ManagementInterceptor,type=Portlet,name=PortletContainer</depends-list-element>
+ <depends-list-element>portal:service=Interceptor,type=Portlet,name=PortletContainerManagement</depends-list-element>
+ <depends-list-element>portal:service=Interceptor,type=Portlet,name=ConsumerCache</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Portlet,name=InstanceSecurity</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Portlet,name=PortalSessionSynchronization</depends-list-element>
</depends-list>
Modified: trunk/portlet/build.xml
===================================================================
--- trunk/portlet/build.xml 2006-11-09 16:27:28 UTC (rev 5610)
+++ trunk/portlet/build.xml 2006-11-09 17:41:48 UTC (rev 5611)
@@ -376,6 +376,8 @@
<package-api-test test="renderresponse"/>
<!-- Ext tests -->
+ <package-ext-test test="nocache"/>
+ <package-ext-test test="expiringcache"/>
<package-ext-test test="preferences"/>
<package-ext-test test="session"/>
<package-ext-test test="portletresponses"/>
@@ -490,6 +492,8 @@
<test todir="${test.reports}" name="org.jboss.portal.test.portlet.jsr168.ext.PortletResponsesTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.portlet.jsr168.ext.PreferencesTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.portlet.jsr168.ext.SessionTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.portlet.jsr168.ext.ExpiringCacheTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.portlet.jsr168.ext.NoCacheTestCase"/>
<!--Misc Tests-->
<test todir="${test.reports}" name="org.jboss.portal.test.portlet.jsr168.misc.Log4jTestCase"/>
@@ -579,6 +583,7 @@
<sysproperty key="test.uri" value="/test/redirect/"/>
</x-sysproperty>
<x-test>
+
<!--test todir="${test.reports}" name="org.jboss.portal.test.portlet.ha.session.SessionTestSuite"/-->
<!--<test todir="${test.reports}" name="org.jboss.portal.test.portlet.info.InfoTestSuite"/>-->
<!--<test todir="${test.reports}" name="org.jboss.portal.test.portlet.session.SessionSynchronizationTestCase"/>-->
@@ -597,7 +602,7 @@
<!--<test todir="${test.reports}" name="org.jboss.portal.test.portlet.jsr168.ext.portletrequests.PortletRequestTestSuite"/>-->
<!--test todir="${test.reports}" name="org.jboss.portal.test.portlet.ParametersTestCase"/-->
- <test todir="${test.reports}" name="org.jboss.portal.test.portlet.state.StateConverterV0TestCase"/>
+ <!--<test todir="${test.reports}" name="org.jboss.portal.test.portlet.state.StateConverterV0TestCase"/>-->
</x-test>
<x-classpath>
Added: trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java 2006-11-09 16:27:28 UTC (rev 5610)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java 2006-11-09 17:41:48 UTC (rev 5611)
@@ -0,0 +1,209 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.aspects.portlet;
+
+import org.jboss.portal.portlet.invocation.PortletInterceptor;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.invocation.response.cache.TimedContent;
+import org.jboss.portal.portlet.invocation.response.cache.StrongTimedContent;
+import org.jboss.portal.portlet.invocation.response.FragmentResponse;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.PortletContext;
+import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.spi.RenderContext;
+import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.common.invocation.AttributeResolver;
+
+import java.io.Serializable;
+
+/**
+ * Cache markup on the portal.
+ *
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ConsumerCacheInterceptor extends PortletInterceptor
+{
+
+
+ protected Object invoke(PortletInvocation invocation) throws Exception, InvocationException
+ {
+ // Compute the cache key
+ PortletContext ctx = (PortletContext)invocation.getAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_CONTEXT_ATTRIBUTE);
+ String scopeKey = "cached_markup." + ctx.getId();
+
+ // We use the principal scope to avoid security issues like a user loggedout seeing a cached entry
+ // by a previous logged in user
+ AttributeResolver resolver = invocation.getContext().getAttributeResolver(PortletInvocation.PRINCIPAL_SCOPE);
+
+ //
+ if (invocation instanceof RenderInvocation)
+ {
+ RenderContext renderCtx = (RenderContext)invocation.getContext();
+
+ //
+ StateString navState = renderCtx.getNavigationalState();
+
+ //
+ CacheEntry cachedEntry = (CacheEntry)resolver.getAttribute(scopeKey);
+
+ //
+ FragmentResponse fragment = null;
+ if (cachedEntry != null)
+ {
+ long currentTimeMillis = System.currentTimeMillis();
+
+ // Check time validity for fragment
+ boolean useEntry = false;
+ if (currentTimeMillis < cachedEntry.getExpirationTimeMillis())
+ {
+ StateString entryNavState = cachedEntry.getNavigationalState();
+
+ // Then check nav state equality
+ if (navState == null)
+ {
+ if (entryNavState == null)
+ {
+ useEntry = true;
+ }
+ else if (entryNavState instanceof ParametersStateString)
+ {
+ // We consider a parameters state string empty equivalent to a null value
+ useEntry = ((ParametersStateString)entryNavState).getSize() == 0;
+ }
+ }
+ else if (entryNavState == null)
+ {
+ if (navState instanceof ParametersStateString)
+ {
+ useEntry = ((ParametersStateString)navState).getSize() == 0;
+ }
+ }
+ else
+ {
+ useEntry = navState.equals(entryNavState);
+ }
+ }
+
+ // Use the entry
+ if (useEntry)
+ {
+ fragment = cachedEntry.getContent();
+ }
+
+ // Clean if it is null
+ if (fragment == null)
+ {
+ resolver.setAttribute(scopeKey, null);
+ }
+ }
+
+ // If no fragment we must invoke
+ if (fragment == null)
+ {
+ // Invoke
+ PortletInvocationResponse response = (PortletInvocationResponse)invocation.invokeNext();
+
+ // Try to cache any fragment result
+ if (response instanceof FragmentResponse)
+ {
+ FragmentResponse renderResult = (FragmentResponse)response;
+
+ // Compute expiration time, i.e when it will expire
+ long expirationTimeMillis = 0;
+ if (renderResult.getExpirationSecs() == -1)
+ {
+ expirationTimeMillis = Long.MAX_VALUE;
+ }
+ else if (renderResult.getExpirationSecs() > 0)
+ {
+ expirationTimeMillis = System.currentTimeMillis() + renderResult.getExpirationSecs() * 1000;
+ }
+
+ // Cache if we can
+ if (expirationTimeMillis > 0)
+ {
+ CacheEntry cacheEntry = new CacheEntry(navState, renderResult, expirationTimeMillis);
+ resolver.setAttribute(scopeKey, cacheEntry);
+ }
+ }
+
+ //
+ return response;
+ }
+ else
+ {
+ // Use the cached fragment
+ return fragment;
+ }
+ }
+ else
+ {
+ // Invalidate
+ resolver.setAttribute(scopeKey, null);
+
+ // Invoke
+ return invocation.invokeNext();
+ }
+ }
+
+ /**
+ * Encapsulate cache information.
+ */
+ public static class CacheEntry implements Serializable
+ {
+
+ /** The entry navigational state. */
+ private final StateString navigationalState;
+
+ /** The timed content. */
+ private final TimedContent cachedResult;
+
+ public CacheEntry(StateString navigationalState, FragmentResponse result, long expirationTimeMillis)
+ {
+ if (expirationTimeMillis <= 0)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.navigationalState = navigationalState;
+ this.cachedResult = new StrongTimedContent(result, expirationTimeMillis);
+ }
+
+ public StateString getNavigationalState()
+ {
+ return navigationalState;
+ }
+
+ public long getExpirationTimeMillis()
+ {
+ return cachedResult.getExpirationTimeMillis();
+ }
+
+ public FragmentResponse getContent()
+ {
+ return cachedResult.getContent();
+ }
+ }
+}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ProducerCacheInterceptor.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ProducerCacheInterceptor.java 2006-11-09 16:27:28 UTC (rev 5610)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ProducerCacheInterceptor.java 2006-11-09 17:41:48 UTC (rev 5611)
@@ -59,8 +59,25 @@
PortletInfo info = invocation.getInfo();
CacheInfo cacheInfo = info.getCache();
- // Update the fragment cache info
+ // Update the fragment cache info from the meta info
fragmentResult.setExpirationSecs(cacheInfo.getExpirationSecs());
+
+ // Override with value provided by portlet if any
+ String portletValue = (String)invocation.getAttribute(PortletInvocation.RESPONSE_PROPERTIES_SCOPE, "portlet.expiration-cache");
+ if (portletValue != null)
+ {
+ try
+ {
+ int expirationSecs = Integer.parseInt(portletValue);
+ fragmentResult.setExpirationSecs(expirationSecs);
+ }
+ catch (NumberFormatException e)
+ {
+ log.warn("Portlet " + invocation.getAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_CONTEXT_ATTRIBUTE) +
+ " set a non integer cache value override during render " + portletValue, e);
+ }
+ }
+
}
//
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContextImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContextImpl.java 2006-11-09 16:27:28 UTC (rev 5610)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContextImpl.java 2006-11-09 17:41:48 UTC (rev 5611)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.portlet.impl.jsr168;
+import org.jboss.portal.server.PortalConstants;
+
import javax.portlet.PortletContext;
import javax.portlet.PortletRequestDispatcher;
import javax.servlet.RequestDispatcher;
@@ -48,7 +50,7 @@
public String getServerInfo()
{
- return "JBossPortal/1.0";
+ return "JBossPortal/" + PortalConstants.VERSION.getMajor() + "." + PortalConstants.VERSION.getMinor();
}
public PortletRequestDispatcher getRequestDispatcher(String path)
Modified: trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/components/AbstractUniversalTestPortlet.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/components/AbstractUniversalTestPortlet.java 2006-11-09 16:27:28 UTC (rev 5610)
+++ trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/components/AbstractUniversalTestPortlet.java 2006-11-09 17:41:48 UTC (rev 5611)
@@ -198,29 +198,36 @@
reset();
}
- // Get the sequence
+
+ // Get the action
+ TestAction action = null;
Sequence sequence = getSequence(ctx.getTestName());
+ if (sequence != null)
+ {
+ action = sequence.getAction(ctx.getRequestCount(), NodeId.locate(), renderJoinpoint);
+ }
+
//
- if (sequence != null)
+ if (action != null)
{
- TestAction action = sequence.getAction(ctx.getRequestCount(), NodeId.locate(), renderJoinpoint);
+ log.debug("Found action for jointpoint " + renderJoinpoint + " : " + action);
- //
- if (action != null)
+ // Get the result
+ DriverResponse sr = ((PortletRenderTestAction)action).execute(this, req, resp, ctx);
+
+ // If we have one result it is meant to be returned to the client
+ if (sr != null)
{
- log.debug("Found action for jointpoint " + renderJoinpoint + " : " + action);
-
- // Get the result
- DriverResponse sr = ((PortletRenderTestAction)action).execute(this, req, resp, ctx);
-
- // If we have one result it is meant to be returned to the client
- if (sr != null)
- {
- ctx.setResponse(sr);
- }
+ ctx.setResponse(sr);
}
}
+ else
+ {
+ // As we are not involved we don't want content to be cached that would prevent
+ // the test to run when it should be invoked
+ resp.setProperty(RenderResponse.EXPIRATION_CACHE, "0");
+ }
}
public void destroy()
Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/api/portletcontext/PortletContextSequenceBuilder.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/api/portletcontext/PortletContextSequenceBuilder.java 2006-11-09 16:27:28 UTC (rev 5610)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/api/portletcontext/PortletContextSequenceBuilder.java 2006-11-09 17:41:48 UTC (rev 5611)
@@ -38,6 +38,7 @@
import javax.portlet.RenderResponse;
import java.net.MalformedURLException;
import java.util.Set;
+import java.util.regex.Pattern;
/**
* @author <a href="mailto:boleslaw.dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
@@ -46,6 +47,12 @@
public class PortletContextSequenceBuilder extends SequenceRegistryBuilder
{
+ /** . */
+ private static final String VERSION_REGEX = "JBossPortal/[0-9]\\.[0-9]";
+
+ /** . */
+ private static final Pattern VERSION_PATTERN = Pattern.compile(VERSION_REGEX, Pattern.DOTALL | Pattern.CASE_INSENSITIVE);
+
/** PortletContext.getServerInfo() */
public void createServerInfoCase(SequenceRegistry registry)
{
@@ -56,7 +63,9 @@
protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
{
AbstractUniversalTestPortlet aport = (AbstractUniversalTestPortlet)portlet;
- assertEquals(TestContants.SERVER_INVO, aport.getPortletContext().getServerInfo());
+ String info = aport.getPortletContext().getServerInfo();
+ boolean matches = VERSION_PATTERN.matcher(info).matches();
+ assertTrue("Version " + info + " does not match the format", matches);
return new EndTestResponse();
}
});
Added: trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/ExpiringCacheTestCase.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/ExpiringCacheTestCase.java 2006-11-09 16:27:28 UTC (rev 5610)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/ExpiringCacheTestCase.java 2006-11-09 17:41:48 UTC (rev 5611)
@@ -0,0 +1,37 @@
+/******************************************************************************
+ * 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.jsr168.ext;
+
+import org.jboss.portal.test.framework.server.runner.ServerTestRunner;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ExpiringCacheTestCase extends ServerTestRunner
+{
+ public ExpiringCacheTestCase()
+ {
+ super("test-jsr168-ext-expiringcache.war");
+ }
+}
Added: trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/NoCacheTestCase.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/NoCacheTestCase.java 2006-11-09 16:27:28 UTC (rev 5610)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/NoCacheTestCase.java 2006-11-09 17:41:48 UTC (rev 5611)
@@ -0,0 +1,37 @@
+/******************************************************************************
+ * 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.jsr168.ext;
+
+import org.jboss.portal.test.framework.server.runner.ServerTestRunner;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class NoCacheTestCase extends ServerTestRunner
+{
+ public NoCacheTestCase()
+ {
+ super("test-jsr168-ext-nocache.war");
+ }
+}
Deleted: trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/dispatcher/DispatcherTestSuite.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/dispatcher/DispatcherTestSuite.java 2006-11-09 16:27:28 UTC (rev 5610)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/dispatcher/DispatcherTestSuite.java 2006-11-09 17:41:48 UTC (rev 5611)
@@ -1,42 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.test.portlet.jsr168.ext.dispatcher;
-
-import junit.framework.Test;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @author <a href="mailto:boleslaw.dawidowicz at jboss.com">Boleslaw Dawidowicz</a>
- * @version $Revision$
- */
-public class DispatcherTestSuite
-{
- public static Test suite()
- {
-// TestSuite suite = new TestSuite("test-jsr168-ext-dispatcher.war");
-// suite.addTest(new TestCase("GetRequestURI"));
-// suite.addTest(new TestCase("RequestHeaderAccess"));
-// return suite;
- return null;
- }
-}
Added: trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/expiringcache/ExpiringCacheSequenceBuilder.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/expiringcache/ExpiringCacheSequenceBuilder.java 2006-11-09 16:27:28 UTC (rev 5610)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/expiringcache/ExpiringCacheSequenceBuilder.java 2006-11-09 17:41:48 UTC (rev 5611)
@@ -0,0 +1,542 @@
+/******************************************************************************
+ * 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.jsr168.ext.expiringcache;
+
+import org.jboss.portal.test.framework.portlet.SequenceRegistryBuilder;
+import org.jboss.portal.test.framework.portlet.SequenceRegistry;
+import org.jboss.portal.test.framework.portlet.Sequence;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.Joinpoint;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.framework.driver.http.response.InvokeGetResponse;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.framework.UTP2;
+import org.jboss.portal.test.portlet.framework.UTP3;
+import org.jboss.portal.test.portlet.framework.UTP4;
+import org.jboss.portal.test.portlet.framework.UTP5;
+import org.jboss.portal.test.portlet.framework.UTP6;
+import org.jboss.portal.test.portlet.framework.UTP7;
+import org.jboss.portal.test.portlet.framework.UTP8;
+import org.jboss.portal.test.portlet.framework.UTP9;
+import org.jboss.portal.test.portlet.framework.UTP10;
+import org.jboss.portal.common.test.driver.DriverResponse;
+import org.jboss.portal.common.test.driver.response.EndTestResponse;
+import org.jboss.portal.common.test.driver.response.ErrorResponse;
+import org.jboss.portal.common.util.CollectionBuilder;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletURL;
+import java.io.IOException;
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ExpiringCacheSequenceBuilder extends SequenceRegistryBuilder
+{
+
+ public void createDisableDuringRenderExpiringCache(SequenceRegistry registry)
+ {
+ createDisableDuringRender("DisableDuringRenderExpiringCache", registry, UTP1.RENDER_JOINPOINT, UTP1.ACTION_JOINPOINT);
+ }
+
+ public void createDisableDuringRenderNeverExpiringCache(SequenceRegistry registry)
+ {
+ createDisableDuringRender("DisableDuringRenderNeverExpiringCache", registry, UTP6.RENDER_JOINPOINT, UTP6.ACTION_JOINPOINT);
+ }
+
+ /**
+ * Overriding the expiration cache to 0 disable the cache on a render or an action/render.
+ */
+ private void createDisableDuringRender(String testName, SequenceRegistry registry, Joinpoint renderjp, Joinpoint actionjp)
+ {
+ final Set calls = new HashSet();
+ Sequence seq = new Sequence();
+ registry.addSequence(testName, seq);
+
+ //
+ seq.addAction(0, renderjp, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ //
+ calls.add("0");
+ response.setProperty(RenderResponse.EXPIRATION_CACHE, "0");
+
+ // Refresh
+ String url = response.createRenderURL().toString();
+ return new InvokeGetResponse(url);
+ }
+ });
+
+ //
+ seq.addAction(1, renderjp, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ //
+ calls.add("1");
+ response.setProperty(RenderResponse.EXPIRATION_CACHE, "0");
+
+ // Refresh
+ String url = response.createActionURL().toString();
+ return new InvokeGetResponse(url);
+ }
+ });
+
+ //
+ seq.addAction(2, actionjp, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ //
+ calls.add("2_action");
+ }
+ });
+ seq.addAction(2, renderjp, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Content is not cached
+ calls.add("2_render");
+
+ //
+ Set expected = new CollectionBuilder().add("0").add("1").add("2_action").add("2_render").toHashSet();
+ assertEquals(expected, calls);
+
+ // End test
+ return new EndTestResponse();
+ }
+ });
+ }
+
+ /**
+ * Caching happens after a render with the same render parameters for at most 5 seconds
+ * Calling render on the portlet with different render parameters invalidates the cache
+ */
+ public void createExpiringCache(SequenceRegistry registry)
+ {
+ final Set calls = new HashSet();
+ final String[] url = new String[1];
+ Sequence seq = new Sequence();
+ registry.addSequence("ExpiringCache", seq);
+
+ //
+ seq.addAction(0, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Content is not cached
+ calls.add("0");
+
+ // Refresh
+ url[0] = response.createRenderURL().toString();
+ return new InvokeGetResponse(url[0]);
+ }
+ });
+
+ //
+ seq.addAction(1, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Should not be called
+ calls.add("1");
+ return null;
+ }
+ });
+ seq.addAction(1, UTP3.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Refresh
+ return new InvokeGetResponse(url[0]);
+ }
+ });
+
+ //
+ seq.addAction(2, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Could be called depending on whether the portal
+ // decides to invoke UTP2 or UTP3 first
+ // so if it's called we need to disable cache otherwise the next
+ // render will probably not be called
+ response.setProperty(RenderResponse.EXPIRATION_CACHE, "0");
+ return null;
+ }
+ });
+ seq.addAction(2, UTP3.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ try
+ {
+ assertFalse(calls.contains("1"));
+
+ // Wait 5 seconds for the cache entry to be invalid
+ Thread.sleep(5 * 1000);
+
+ // Refresh
+ return new InvokeGetResponse(url[0]);
+ }
+ catch (InterruptedException e)
+ {
+ return new ErrorResponse(e);
+ }
+ }
+ });
+
+ //
+ seq.addAction(3, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Should be called
+ calls.add("3");
+
+ // Invoke the same but with different render parameter
+ PortletURL tmp = response.createRenderURL();
+ tmp.setParameter("abc", "def");
+ url[0] = tmp.toString();
+ return new InvokeGetResponse(url[0]);
+ }
+ });
+
+ //
+ seq.addAction(4, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Should be called
+ calls.add("4");
+
+ // Refresh
+ return new InvokeGetResponse(url[0]);
+ }
+ });
+
+ //
+ seq.addAction(5, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Should not be called
+ calls.add("5");
+ return null;
+ }
+ });
+ seq.addAction(5, UTP3.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Refresh
+ return new InvokeGetResponse(url[0]);
+ }
+ });
+
+ //
+ seq.addAction(6, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Could be called depending on whether the portal
+ // decides to invoke UTP2 or UTP3 first
+ // so if it's called we need to disable cache otherwise the next
+ // render will probably not be called
+ response.setProperty(RenderResponse.EXPIRATION_CACHE, "0");
+ return null;
+ }
+ });
+ seq.addAction(6, UTP3.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ try
+ {
+ assertFalse(calls.contains("5"));
+
+ // Wait 5 seconds for the cache entry to be invalid
+ Thread.sleep(5 * 1000);
+
+ // Refresh
+ return new InvokeGetResponse(url[0]);
+ }
+ catch (InterruptedException e)
+ {
+ return new ErrorResponse(e);
+ }
+ }
+ });
+
+ //
+ seq.addAction(7, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Should be called
+ calls.add("7");
+
+ //
+ Set expected = new CollectionBuilder().add("0").add("3").add("4").add("7").toHashSet();
+ assertEquals(expected, calls);
+
+ // Refresh
+ return new EndTestResponse();
+ }
+ });
+ }
+
+ /**
+ * Caching happens after a render with the same render parameters for at most 5 seconds
+ * Calling render on the portlet with different render parameters invalidates the cache
+ */
+ public void createNeverExpiringCache(SequenceRegistry registry)
+ {
+ final Set calls = new HashSet();
+ final String[] url = new String[1];
+ Sequence seq = new Sequence();
+ registry.addSequence("NeverExpiringCache", seq);
+
+ //
+ seq.addAction(0, UTP9.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Content is not cached
+ calls.add("0");
+
+ // Create invalidating action url for later use
+ url[0] = response.createActionURL().toString();
+
+ // Refresh
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+
+ //
+ seq.addAction(1, UTP9.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Should not be called
+ calls.add("1");
+ return null;
+ }
+ });
+ seq.addAction(1, UTP10.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Invalidate with action
+ return new InvokeGetResponse(url[0]);
+ }
+ });
+
+ //
+ seq.addAction(2, UTP9.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ calls.add("2_action");
+ }
+ });
+ seq.addAction(2, UTP9.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Should be called
+ calls.add("2_render");
+
+ // Refresh with different render parameters
+ PortletURL url = response.createRenderURL();
+ url.setParameter("abc", "def");
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ //
+ seq.addAction(3, UTP9.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Should be called
+ calls.add("3");
+
+ // Invoke the with same render parameters
+ PortletURL url = response.createRenderURL();
+ url.setParameter("abc", "def");
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ //
+ seq.addAction(4, UTP9.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Should not be called
+ calls.add("4");
+ return null;
+ }
+ });
+ seq.addAction(4, UTP10.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Invalidate with action
+ return new InvokeGetResponse(url[0]);
+ }
+ });
+
+ //
+ seq.addAction(5, UTP9.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ calls.add("5_action");
+ response.setRenderParameter("abc", "fed");
+ }
+ });
+ seq.addAction(5, UTP9.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Should be called
+ calls.add("5_render");
+
+ // Refresh with different render parameters
+ PortletURL url = response.createRenderURL();
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ //
+ seq.addAction(6, UTP9.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ Set expected = new CollectionBuilder().add("0").add("2_action").add("2_render").add("3").add("5_action").add("5_render").toHashSet();
+ assertEquals(expected, calls);
+
+ // Refresh
+ return new EndTestResponse();
+ }
+ });
+ }
+
+ public void createActionInvalidatesExpiringCache(SequenceRegistry registry)
+ {
+ createActionInvalidates("ActionInvalidatesExpiringCache", registry, UTP4.RENDER_JOINPOINT, UTP4.ACTION_JOINPOINT, UTP5.RENDER_JOINPOINT);
+ }
+
+ public void createActionInvalidatesNeverExpiringCache(SequenceRegistry registry)
+ {
+ createActionInvalidates("ActionInvalidatesNeverExpiringCache", registry, UTP7.RENDER_JOINPOINT, UTP7.ACTION_JOINPOINT, UTP8.RENDER_JOINPOINT);
+ }
+
+ /**
+ * Calling action on the portlet invalidates the cache.
+ */
+ public void createActionInvalidates(
+ String testName,
+ SequenceRegistry registry,
+ Joinpoint p1renderjp,
+ Joinpoint p1actionjp,
+ Joinpoint p2renderjp)
+ {
+ final Set calls = new HashSet();
+ final String[] url = new String[1];
+ Sequence seq = new Sequence();
+ registry.addSequence(testName, seq);
+
+ //
+ seq.addAction(0, p1renderjp, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Content is not cached
+ calls.add("0");
+
+ // Refresh
+ url[0] = response.createActionURL().toString();
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+
+ //
+ seq.addAction(1, p1renderjp, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Should no be called
+ calls.add("1");
+ return null;
+ }
+ });
+ seq.addAction(1, p2renderjp, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Invalidate
+ return new InvokeGetResponse(url[0]);
+ }
+ });
+
+ //
+ seq.addAction(2, p1actionjp, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ //
+ calls.add("2_action");
+ }
+ });
+ seq.addAction(2, p1renderjp, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Content is not cached
+ calls.add("2_render");
+
+ //
+ Set expected = new CollectionBuilder().add("0").add("2_action").add("2_render").toHashSet();
+ assertEquals(expected, calls);
+
+ // End test
+ return new EndTestResponse();
+ }
+ });
+ }
+
+
+}
Added: trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/nocache/NoCacheSequenceBuilder.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/nocache/NoCacheSequenceBuilder.java 2006-11-09 16:27:28 UTC (rev 5610)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/nocache/NoCacheSequenceBuilder.java 2006-11-09 17:41:48 UTC (rev 5611)
@@ -0,0 +1,230 @@
+/******************************************************************************
+ * 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.jsr168.ext.nocache;
+
+import org.jboss.portal.test.framework.portlet.SequenceRegistryBuilder;
+import org.jboss.portal.test.framework.portlet.SequenceRegistry;
+import org.jboss.portal.test.framework.portlet.Sequence;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.Joinpoint;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.framework.driver.http.response.InvokeGetResponse;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.framework.UTP2;
+import org.jboss.portal.test.portlet.framework.UTP3;
+import org.jboss.portal.test.portlet.framework.UTP4;
+import org.jboss.portal.test.portlet.framework.UTP5;
+import org.jboss.portal.common.test.driver.DriverResponse;
+import org.jboss.portal.common.test.driver.response.EndTestResponse;
+import org.jboss.portal.common.test.driver.response.ErrorResponse;
+import org.jboss.portal.common.util.CollectionBuilder;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletURL;
+import java.util.Set;
+import java.util.HashSet;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class NoCacheSequenceBuilder extends SequenceRegistryBuilder
+{
+
+ public void createExplicitNoCache(SequenceRegistry registry)
+ {
+ create("ExplicitNoCache", registry, UTP1.RENDER_JOINPOINT, UTP1.ACTION_JOINPOINT, UTP2.RENDER_JOINPOINT);
+ }
+
+ public void createImplicitNoCache(SequenceRegistry registry)
+ {
+ create("ImplicitNoCache", registry, UTP3.RENDER_JOINPOINT, UTP3.ACTION_JOINPOINT, UTP4.RENDER_JOINPOINT);
+ }
+
+ /**
+ * Setting expiration cache value force caching for a certain amount of time and
+ * can be invalidated by an action or by time.
+ */
+ private void create(
+ String testName,
+ SequenceRegistry registry,
+ Joinpoint p1renderjp,
+ Joinpoint p1actionjp,
+ Joinpoint p2renderjp)
+ {
+ final Set calls = new HashSet();
+ final String[] url = new String[1];
+ Sequence seq = new Sequence();
+ registry.addSequence(testName, seq);
+
+ //
+ seq.addAction(0, p1renderjp, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Should be called
+ calls.add("0");
+
+ // Refresh
+ url[0] = response.createRenderURL().toString();
+ return new InvokeGetResponse(url[0]);
+ }
+ });
+
+ //
+ seq.addAction(1, p1renderjp, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Should be called
+ calls.add("1");
+ response.setProperty(RenderResponse.EXPIRATION_CACHE, "0");
+
+ // Refresh
+ return new InvokeGetResponse(url[0]);
+ }
+ });
+
+ //
+ seq.addAction(2, p1renderjp, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Should be called
+ calls.add("2");
+ response.setProperty(RenderResponse.EXPIRATION_CACHE, "5");
+
+ // Refresh
+ return new InvokeGetResponse(url[0]);
+ }
+ });
+
+ //
+ seq.addAction(3, p1renderjp, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Should not be called
+ calls.add("3");
+ return null;
+ }
+ });
+ seq.addAction(3, p2renderjp, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Refresh
+ return new InvokeGetResponse(url[0]);
+ }
+ });
+
+ //
+ seq.addAction(4, p1renderjp, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Could be called or not depending on the page rendering ordre
+ return null;
+ }
+ });
+ seq.addAction(4, p2renderjp, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ try
+ {
+ // Wait 5 seconds for the cache entry to be invalid
+ Thread.sleep(5 * 1000);
+
+ // Refresh
+ return new InvokeGetResponse(url[0]);
+ }
+ catch (InterruptedException e)
+ {
+ return new ErrorResponse(e);
+ }
+ }
+ });
+
+ //
+ seq.addAction(5, p1renderjp, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Should be called
+ calls.add("5");
+ response.setProperty(RenderResponse.EXPIRATION_CACHE, "5");
+ url[0] = response.createActionURL().toString();
+ return new InvokeGetResponse(url[0]);
+ }
+ });
+
+ //
+ seq.addAction(6, p1actionjp, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ // Should be called
+ calls.add("6_action");
+ }
+ });
+ seq.addAction(6, p1renderjp, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Should be called
+ calls.add("6_render");
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+
+ //
+ seq.addAction(7, p1renderjp, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ //
+ return null;
+ }
+ });
+ seq.addAction(7, p2renderjp, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ //
+ Set expected = new CollectionBuilder().add("0").add("1").add("2").add("5").add("6_render").add("6_action").toHashSet();
+ assertEquals(expected, calls);
+
+ // Refresh
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Deleted: trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/portletconfig/PortletConfigTestSuite.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/portletconfig/PortletConfigTestSuite.java 2006-11-09 16:27:28 UTC (rev 5610)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/portletconfig/PortletConfigTestSuite.java 2006-11-09 17:41:48 UTC (rev 5611)
@@ -1,45 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.test.portlet.jsr168.ext.portletconfig;
-
-import junit.framework.Test;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @author <a href="mailto:boleslaw.dawidowicz at jboss.com">Boleslaw Dawidowicz</a>
- * @version $Revision$
- */
-public class PortletConfigTestSuite
-{
-
- public static Test suite()
- {
-// TestSuite suite = new TestSuite("test-jsr168-ext-portletconfig.war");
-// suite.addTest(new TestCase("GetResourceBundleDuringInit"));
-// suite.addTest(new TestCase("ResourceBundleCascade"));
-// suite.addTest(new TestCase("ResourceBundle"));
-//
-// return suite;
- return null;
- }
-}
Deleted: trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/portletrequests/PortletRequestTestSuite.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/portletrequests/PortletRequestTestSuite.java 2006-11-09 16:27:28 UTC (rev 5610)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/portletrequests/PortletRequestTestSuite.java 2006-11-09 17:41:48 UTC (rev 5611)
@@ -1,48 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.test.portlet.jsr168.ext.portletrequests;
-
-import junit.framework.Test;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class PortletRequestTestSuite
-{
- public static Test suite()
- {
-// TestSuite suite = new TestSuite("test-jsr168-ext-portletrequests.war");
-// suite.addTest(new TestCase("ActionRequestUseForm"));
-// suite.addTest(new TestCase("ActionRequestUseInputStream"));
-// suite.addTest(new TestCase("ActionRequestUseReader"));
-// suite.addTest(new TestCase("RequestAttribute"));
-// suite.addTest(new TestCase("RequestAttributeScoping"));
-// suite.addTest(new TestCase("RequestParameter"));
-// suite.addTest(new TestCase("RequestHeaderAccess"));
-//
-//
-// return suite;
- return null;
- }
-}
Deleted: trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/portletresponses/PortletResponsesTestSuite.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/portletresponses/PortletResponsesTestSuite.java 2006-11-09 16:27:28 UTC (rev 5610)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/portletresponses/PortletResponsesTestSuite.java 2006-11-09 17:41:48 UTC (rev 5611)
@@ -1,45 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.test.portlet.jsr168.ext.portletresponses;
-
-import junit.framework.Test;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @author <a href="mailto:boleslaw.dawidowicz at jboss.com">Boleslaw Dawidowicz</a>
- * @version $Revision$
- */
-public class PortletResponsesTestSuite
-{
- public static Test suite()
- {
-// TestSuite suite = new TestSuite("test-jsr168-ext-portletresponses.war");
-// suite.addTest(new TestCase("ContentType"));
-//
-//
-// return suite;
- return null;
- }
-
-
-}
Deleted: trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/preferences/PreferencesTestSuite.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/preferences/PreferencesTestSuite.java 2006-11-09 16:27:28 UTC (rev 5610)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/preferences/PreferencesTestSuite.java 2006-11-09 17:41:48 UTC (rev 5611)
@@ -1,51 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.test.portlet.jsr168.ext.preferences;
-
-import junit.framework.Test;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at jboss.com">Boleslaw Dawidowicz</a>
- * @version $Revision$
- */
-public class PreferencesTestSuite
-{
-
- public static Test suite()
- {
-// TestSuite suite = new TestSuite("test-jsr168-ext-preferences.war");
-//
-// /**
-// * Tests if .isReadOnly() returns correct values during action and render phases
-// */
-// suite.addTest(new TestCase("IsReadOnly"));
-//
-//
-// suite.addTest(new TestCase("StoreMustPersistAllChanges"));
-// suite.addTest(new TestCase("Map"));
-//
-// //
-// return suite;
- return null;
- }
-}
Deleted: trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/session/SessionTestSuite.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/session/SessionTestSuite.java 2006-11-09 16:27:28 UTC (rev 5610)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/session/SessionTestSuite.java 2006-11-09 17:41:48 UTC (rev 5611)
@@ -1,42 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.test.portlet.jsr168.ext.session;
-
-import junit.framework.Test;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class SessionTestSuite
-{
- public static Test suite()
- {
-// TestSuite suite = new TestSuite("test-jsr168-ext-session.war");
-// suite.addTest(new TestCase("ObtainNonNullSessionUsingCreateEqualsFalse"));
-// suite.addTest(new TestCase("SessionDoesNotExistBeforeItIsRequested"));
-// suite.addTest(new TestCase("CrossContextSessionAttribute"));
-// return suite;
- return null;
- }
-}
Added: trunk/portlet/src/resources/test/jsr168/ext/expiringcache-war/WEB-INF/portlet.xml
===================================================================
--- trunk/portlet/src/resources/test/jsr168/ext/expiringcache-war/WEB-INF/portlet.xml 2006-11-09 16:27:28 UTC (rev 5610)
+++ trunk/portlet/src/resources/test/jsr168/ext/expiringcache-war/WEB-INF/portlet.xml 2006-11-09 17:41:48 UTC (rev 5611)
@@ -0,0 +1,145 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ version="1.0">
+
+ <portlet>
+ <portlet-name>TestUniversalPortletA</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP1</portlet-class>
+ <expiration-cache>5</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title></title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>TestUniversalPortletB</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP2</portlet-class>
+ <expiration-cache>5</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title></title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>TestUniversalPortletC</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP3</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title></title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>TestUniversalPortletD</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP4</portlet-class>
+ <expiration-cache>5</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title></title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>TestUniversalPortletE</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP5</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title></title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>TestUniversalPortletF</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP6</portlet-class>
+ <expiration-cache>-1</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title></title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>TestUniversalPortletG</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP7</portlet-class>
+ <expiration-cache>-1</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title></title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>TestUniversalPortletH</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP8</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title></title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>TestUniversalPortletI</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP9</portlet-class>
+ <expiration-cache>-1</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title></title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>TestUniversalPortletJ</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP10</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title></title>
+ </portlet-info>
+ </portlet>
+</portlet-app>
Added: trunk/portlet/src/resources/test/jsr168/ext/expiringcache-war/WEB-INF/web.xml
===================================================================
--- trunk/portlet/src/resources/test/jsr168/ext/expiringcache-war/WEB-INF/web.xml 2006-11-09 16:27:28 UTC (rev 5610)
+++ trunk/portlet/src/resources/test/jsr168/ext/expiringcache-war/WEB-INF/web.xml 2006-11-09 17:41:48 UTC (rev 5611)
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+
+ <listener>
+ <listener-class>org.jboss.portal.test.portlet.jsr168.ext.expiringcache.ExpiringCacheSequenceBuilder</listener-class>
+ </listener>
+
+</web-app>
Added: trunk/portlet/src/resources/test/jsr168/ext/nocache-war/WEB-INF/portlet.xml
===================================================================
--- trunk/portlet/src/resources/test/jsr168/ext/nocache-war/WEB-INF/portlet.xml 2006-11-09 16:27:28 UTC (rev 5610)
+++ trunk/portlet/src/resources/test/jsr168/ext/nocache-war/WEB-INF/portlet.xml 2006-11-09 17:41:48 UTC (rev 5611)
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ version="1.0">
+
+ <portlet>
+ <portlet-name>TestUniversalPortletA</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP1</portlet-class>
+ <expiration-cache>0</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title></title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>TestUniversalPortletB</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP2</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title></title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>TestUniversalPortletC</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP3</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title></title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>TestUniversalPortletD</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP4</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title></title>
+ </portlet-info>
+ </portlet>
+
+</portlet-app>
Added: trunk/portlet/src/resources/test/jsr168/ext/nocache-war/WEB-INF/web.xml
===================================================================
--- trunk/portlet/src/resources/test/jsr168/ext/nocache-war/WEB-INF/web.xml 2006-11-09 16:27:28 UTC (rev 5610)
+++ trunk/portlet/src/resources/test/jsr168/ext/nocache-war/WEB-INF/web.xml 2006-11-09 17:41:48 UTC (rev 5611)
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+
+ <listener>
+ <listener-class>org.jboss.portal.test.portlet.jsr168.ext.nocache.NoCacheSequenceBuilder</listener-class>
+ </listener>
+
+</web-app>
Modified: trunk/portlet/src/resources/test-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/portlet/src/resources/test-sar/META-INF/jboss-service.xml 2006-11-09 16:27:28 UTC (rev 5610)
+++ trunk/portlet/src/resources/test-sar/META-INF/jboss-service.xml 2006-11-09 17:41:48 UTC (rev 5611)
@@ -117,6 +117,13 @@
<xmbean/>
</mbean>
<mbean
+ code="org.jboss.portal.portlet.aspects.portlet.ConsumerCacheInterceptor"
+ name="portal:service=Interceptor,type=Portlet,name=ConsumerCache"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ </mbean>
+ <mbean
code="org.jboss.portal.portlet.aspects.portlet.SecureTransportInterceptor"
name="portal:service=Interceptor,type=Portlet,name=SecureTransport"
xmbean-dd=""
@@ -167,6 +174,7 @@
<depends-list optional-attribute-name="InterceptorNames">
<!--<depends-list-element>portal:service=Interceptor,type=Portlet,name=Security</depends-list-element>-->
<depends-list-element>portal:service=Interceptor,type=Portlet,name=Valve</depends-list-element>
+ <depends-list-element>portal:service=Interceptor,type=Portlet,name=ConsumerCache</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Portlet,name=SecureTransport</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Portlet,name=ContextDispatcher</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Portlet,name=PortletSessionSynchronization</depends-list-element>
More information about the jboss-svn-commits
mailing list