[jboss-svn-commits] JBoss Portal SVN: r5616 - in branches/JBoss_Portal_Branch_2_4/portlet: . src/main/org/jboss/portal/portlet/aspects/portlet src/main/org/jboss/portal/test/framework/portlet/components src/main/org/jboss/portal/test/portlet/jsr168/ext src/main/org/jboss/portal/test/portlet/jsr168/ext/expiringcache src/main/org/jboss/portal/test/portlet/jsr168/ext/nocache src/resources/test/jsr168/ext src/resources/test/jsr168/ext/expiringcache-war src/resources/test/jsr168/ext/expiringcache-war/WEB-INF src/resources/test/jsr168/ext/nocache-war src/resources/test/jsr168/ext/nocache-war/WEB-INF
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Nov 9 17:54:04 EST 2006
Author: julien at jboss.com
Date: 2006-11-09 17:53:53 -0500 (Thu, 09 Nov 2006)
New Revision: 5616
Added:
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/expiringcache/
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/expiringcache/ExpiringCacheSequenceBuilder.java
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/expiringcache/ExpiringCacheTestSuite.java
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/nocache/
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/nocache/NoCacheSequenceBuilder.java
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/nocache/NoCacheTestSuite.java
branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test/jsr168/ext/expiringcache-war/
branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test/jsr168/ext/expiringcache-war/WEB-INF/
branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test/jsr168/ext/expiringcache-war/WEB-INF/portlet.xml
branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test/jsr168/ext/expiringcache-war/WEB-INF/web.xml
branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test/jsr168/ext/nocache-war/
branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test/jsr168/ext/nocache-war/WEB-INF/
branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test/jsr168/ext/nocache-war/WEB-INF/portlet.xml
branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test/jsr168/ext/nocache-war/WEB-INF/web.xml
Modified:
branches/JBoss_Portal_Branch_2_4/portlet/build.xml
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ProducerCacheInterceptor.java
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/framework/portlet/components/AbstractUniversalTestPortlet.java
Log:
JBPORTAL-1104 : setting expiration cache has no effect + test cases
Modified: branches/JBoss_Portal_Branch_2_4/portlet/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_4/portlet/build.xml 2006-11-09 18:12:42 UTC (rev 5615)
+++ branches/JBoss_Portal_Branch_2_4/portlet/build.xml 2006-11-09 22:53:53 UTC (rev 5616)
@@ -370,6 +370,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"/>
@@ -601,9 +603,9 @@
<!--<test todir="${test.reports}" name="org.jboss.portal.test.portlet.PortletRequestDecoderTestCase"/>-->
<!--<test todir="${test.reports}" name="org.jboss.portal.test.portlet.state.StatefulPortletInvokerTestCase"/>-->
<test todir="${test.reports}"
- name="org.jboss.portal.test.portlet.jsr168.ext.portletrequests.PortletRequestTestSuite"/>
+ name="org.jboss.portal.test.portlet.jsr168.ext.nocache.NoCacheTestSuite"/>
<test todir="${test.reports}"
- name="org.jboss.portal.test.portlet.jsr168.ext.dispatcher.DispatcherTestSuite"/>
+ name="org.jboss.portal.test.portlet.jsr168.ext.expiringcache.ExpiringCacheTestSuite"/>
</x-test>
<x-classpath>
<path refid="oswego.concurrent.classpath"/>
Modified: branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java 2006-11-09 18:12:42 UTC (rev 5615)
+++ branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java 2006-11-09 22:53:53 UTC (rev 5616)
@@ -22,11 +22,9 @@
******************************************************************************/
package org.jboss.portal.portlet.aspects.portlet;
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.invocation.ActionInvocation;
+import org.jboss.portal.portlet.ParametersStateString;
import org.jboss.portal.portlet.invocation.PortletInterceptor;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.RenderInvocation;
@@ -35,6 +33,7 @@
import org.jboss.portal.portlet.result.cache.StrongTimedContent;
import org.jboss.portal.portlet.result.cache.TimedContent;
import org.jboss.portal.portlet.spi.InvocationContext;
+import org.jboss.portal.portlet.spi.RenderContext;
import java.io.Serializable;
@@ -44,23 +43,22 @@
*/
public class ConsumerCacheInterceptor extends PortletInterceptor
{
+
protected void invoke(PortletInvocation invocation) throws Exception, InvocationException
{
- InvocationContext invocationCtx = invocation.getContext();
+ // Compute the cache key
String scopeKey = "cached_markup." + invocation.getWindowContext().getId();
//
- if (invocation instanceof ActionInvocation)
+ if (invocation instanceof RenderInvocation)
{
+ RenderContext renderCtx = (RenderContext)invocation.getContext();
+
//
- invocationCtx.setAttribute(InvocationContext.PRINCIPAL_SCOPE, scopeKey, null);
+ StateString navState = renderCtx.getNavigationalState();
- // Invoke
- invocation.invokeNext();
- }
- else if (invocation instanceof RenderInvocation)
- {
- CacheEntry cachedEntry = (CacheEntry)invocationCtx.getAttribute(InvocationContext.PRINCIPAL_SCOPE, scopeKey);
+ //
+ CacheEntry cachedEntry = (CacheEntry)invocation.getContext().getAttribute(InvocationContext.PRINCIPAL_SCOPE, scopeKey);
//
FragmentResult fragment = null;
@@ -69,31 +67,55 @@
long currentTimeMillis = System.currentTimeMillis();
// Check time validity for fragment
+ boolean useEntry = false;
if (currentTimeMillis < cachedEntry.getExpirationTimeMillis())
{
- CacheKey cacheKey = new CacheKey(invocationCtx.getNavigationalState(), invocationCtx.getWindowState(), invocationCtx.getMode());
+ StateString entryNavState = cachedEntry.getNavigationalState();
- // Check state validity for fragment
- if (cachedEntry.getKey().equals(cacheKey))
+ // Then check nav state equality
+ if (navState == null)
{
- fragment = cachedEntry.getContent();
+ 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);
+ }
}
- // Remove the cached fragment
+ // Use the entry
+ if (useEntry)
+ {
+ fragment = cachedEntry.getContent();
+ }
+
+ // Clean if it is null
if (fragment == null)
{
- invocationCtx.setAttribute(InvocationContext.PRINCIPAL_SCOPE, scopeKey, null);
+ invocation.getContext().setAttribute(InvocationContext.PRINCIPAL_SCOPE, scopeKey, null);
}
}
- //
+ // If no fragment we must invoke
if (fragment == null)
{
// Invoke
invocation.invokeNext();
-
- // Get result
Result result = invocation.getResult();
// Try to cache any fragment result
@@ -101,7 +123,7 @@
{
FragmentResult renderResult = (FragmentResult)result;
- // Compute expiration time
+ // Compute expiration time, i.e when it will expire
long expirationTimeMillis = 0;
if (renderResult.getExpirationSecs() == -1)
{
@@ -112,12 +134,11 @@
expirationTimeMillis = System.currentTimeMillis() + renderResult.getExpirationSecs() * 1000;
}
- // Cache if required
+ // Cache if we can
if (expirationTimeMillis > 0)
{
- CacheKey cacheKey = new CacheKey(invocationCtx.getNavigationalState(), invocationCtx.getWindowState(), invocationCtx.getMode());
- CacheEntry cacheEntry = new CacheEntry(renderResult, cacheKey, expirationTimeMillis);
- invocationCtx.setAttribute(InvocationContext.PRINCIPAL_SCOPE, scopeKey, cacheEntry);
+ CacheEntry cacheEntry = new CacheEntry(navState, renderResult, expirationTimeMillis);
+ invocation.getContext().setAttribute(InvocationContext.PRINCIPAL_SCOPE, scopeKey, cacheEntry);
}
}
}
@@ -127,31 +148,41 @@
invocation.setResult(fragment);
}
}
+ else
+ {
+ // Invalidate
+ invocation.getContext().setAttribute(InvocationContext.PRINCIPAL_SCOPE, scopeKey, null);
+
+ // Invoke
+ invocation.invokeNext();
+ }
}
- /** Encapsulate cache information. */
+ /**
+ * Encapsulate cache information.
+ */
public static class CacheEntry implements Serializable
{
+ /** The entry navigational state. */
+ private final StateString navigationalState;
+
/** The timed content. */
private final TimedContent cachedResult;
- /** The navigational state. */
- private final CacheKey key;
-
- public CacheEntry(FragmentResult result, CacheKey key, long expirationTimeMillis)
+ public CacheEntry(StateString navigationalState, FragmentResult result, long expirationTimeMillis)
{
if (expirationTimeMillis <= 0)
{
throw new IllegalArgumentException();
}
+ this.navigationalState = navigationalState;
this.cachedResult = new StrongTimedContent(result, expirationTimeMillis);
- this.key = key;
}
- public CacheKey getKey()
+ public StateString getNavigationalState()
{
- return key;
+ return navigationalState;
}
public long getExpirationTimeMillis()
@@ -164,61 +195,4 @@
return cachedResult.getContent();
}
}
-
- public static class CacheKey implements Serializable
- {
-
- /** The navigational state. */
- private final StateString navigationalState;
-
- /** The window state. */
- private final WindowState windowState;
-
- /** The mode. */
- private final Mode mode;
-
- public CacheKey(StateString navigationalState, WindowState windowState, Mode mode)
- {
- this.navigationalState = navigationalState;
- if (windowState == null)
- {
- throw new IllegalArgumentException("No null window state accepted");
- }
- if (mode == null)
- {
- throw new IllegalArgumentException("No null mode accepted");
- }
- this.windowState = windowState;
- this.mode = mode;
- }
-
- public boolean equals(Object o)
- {
- if (o == this)
- {
- return true;
- }
- if (o instanceof CacheKey)
- {
- CacheKey that = (CacheKey)o;
- if (navigationalState == null)
- {
- if (that.navigationalState != null)
- {
- return false;
- }
- }
- else if (navigationalState.equals(that.navigationalState) == false)
- {
- return false;
- }
- if (windowState.equals(that.windowState) == false)
- {
- return false;
- }
- return mode.equals(that.mode);
- }
- return false;
- }
- }
}
Modified: branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ProducerCacheInterceptor.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ProducerCacheInterceptor.java 2006-11-09 18:12:42 UTC (rev 5615)
+++ branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ProducerCacheInterceptor.java 2006-11-09 22:53:53 UTC (rev 5616)
@@ -62,6 +62,22 @@
// Update the fragment cache info
fragmentResult.setExpirationSecs(cacheInfo.getExpirationSecs());
+
+ // Override with value provided by portlet if any
+ String portletValue = fragmentResult.getProperties().getProperty("portlet.expiration-cache");
+ if (portletValue != null)
+ {
+ try
+ {
+ int expirationSecs = Integer.parseInt(portletValue);
+ fragmentResult.setExpirationSecs(expirationSecs);
+ }
+ catch (NumberFormatException e)
+ {
+ log.warn("Portlet " + invocation.getAttribute(PortletInvocation.PORTLET_ID_ATTRIBUTE) +
+ " set a non integer cache value override during render " + portletValue, e);
+ }
+ }
}
}
else
Modified: branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/framework/portlet/components/AbstractUniversalTestPortlet.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/framework/portlet/components/AbstractUniversalTestPortlet.java 2006-11-09 18:12:42 UTC (rev 5615)
+++ branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/framework/portlet/components/AbstractUniversalTestPortlet.java 2006-11-09 22:53:53 UTC (rev 5616)
@@ -198,29 +198,32 @@
reset();
}
- // Get the sequence
+ // Get the action
+ TestAction action = null;
Sequence sequence = getSequence();
+ if (sequence != null)
+ {
+ action = sequence.getAction(ctx.getRequestCount(), NodeId.locate(), renderJoinpoint);
+ }
//
- if (sequence != null)
+ if (action != null && action instanceof PortletRenderTestAction)
{
- TestAction action = sequence.getAction(ctx.getRequestCount(), NodeId.locate(), renderJoinpoint);
+ log.debug("Found action for jointpoint " + renderJoinpoint + " : " + action);
- //
- if (action != null && action instanceof PortletRenderTestAction)
+ // Get the result
+ Result sr = ((PortletRenderTestAction)action).execute(this, req, resp);
+
+ // 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
- Result sr = ((PortletRenderTestAction)action).execute(this, req, resp);
-
- // If we have one result it is meant to be returned to the client
- if (sr != null)
- {
- ctx.setResult(sr);
- }
+ ctx.setResult(sr);
}
}
+ else
+ {
+ resp.setProperty(RenderResponse.EXPIRATION_CACHE, "0");
+ }
}
public void destroy()
Added: branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/expiringcache/ExpiringCacheSequenceBuilder.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/expiringcache/ExpiringCacheSequenceBuilder.java 2006-11-09 18:12:42 UTC (rev 5615)
+++ branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/expiringcache/ExpiringCacheSequenceBuilder.java 2006-11-09 22:53:53 UTC (rev 5616)
@@ -0,0 +1,546 @@
+/******************************************************************************
+ * 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.Joinpoint;
+import org.jboss.portal.test.framework.portlet.Sequence;
+import org.jboss.portal.test.framework.portlet.universal.UTP6;
+import org.jboss.portal.test.framework.portlet.universal.UTP1;
+import org.jboss.portal.test.framework.portlet.universal.UTP2;
+import org.jboss.portal.test.framework.portlet.universal.UTP7;
+import org.jboss.portal.test.framework.portlet.universal.UTP5;
+import org.jboss.portal.test.framework.portlet.universal.UTP4;
+import org.jboss.portal.test.framework.portlet.universal.UTP8;
+import org.jboss.portal.test.framework.portlet.universal.UTP9;
+import org.jboss.portal.test.framework.portlet.universal.UTP10;
+import org.jboss.portal.test.framework.portlet.universal.UTP3;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.framework.container.result.Result;
+import org.jboss.portal.test.framework.container.result.InvokeGetResult;
+import org.jboss.portal.test.framework.container.result.EndTestResult;
+import org.jboss.portal.test.framework.container.result.AssertResult;
+import org.jboss.portal.test.framework.container.result.FailureResult;
+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 javax.portlet.PortletSecurityException;
+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 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 Result run(Portlet portlet, RenderRequest request, RenderResponse response) throws IOException, PortletException
+ {
+ //
+ calls.add("0");
+ response.setProperty(RenderResponse.EXPIRATION_CACHE, "0");
+
+ // Refresh
+ String url = response.createRenderURL().toString();
+ return new InvokeGetResult(url);
+ }
+ });
+
+ //
+ seq.addAction(1, renderjp, new PortletRenderTestAction()
+ {
+ protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) throws IOException, PortletException
+ {
+ //
+ calls.add("1");
+ response.setProperty(RenderResponse.EXPIRATION_CACHE, "0");
+
+ // Refresh
+ String url = response.createActionURL().toString();
+ return new InvokeGetResult(url);
+ }
+ });
+
+ //
+ seq.addAction(2, actionjp, new PortletActionTestAction()
+ {
+ protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws PortletException, IOException
+ {
+ //
+ calls.add("2_action");
+ return null;
+ }
+ });
+ seq.addAction(2, renderjp, new PortletRenderTestAction()
+ {
+ protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) 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 EndTestResult();
+ }
+ });
+ }
+
+ /**
+ * 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 Result run(Portlet portlet, RenderRequest request, RenderResponse response) throws IOException, PortletException
+ {
+ // Content is not cached
+ calls.add("0");
+
+ // Refresh
+ url[0] = response.createRenderURL().toString();
+ return new InvokeGetResult(url[0]);
+ }
+ });
+
+ //
+ seq.addAction(1, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) throws IOException, PortletException
+ {
+ // Should not be called
+ calls.add("1");
+ return null;
+ }
+ });
+ seq.addAction(1, UTP3.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) throws IOException, PortletException
+ {
+ // Refresh
+ return new InvokeGetResult(url[0]);
+ }
+ });
+
+ //
+ seq.addAction(2, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) 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 Result run(Portlet portlet, RenderRequest request, RenderResponse response) 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 InvokeGetResult(url[0]);
+ }
+ catch (InterruptedException e)
+ {
+ return new FailureResult();
+ }
+ }
+ });
+
+ //
+ seq.addAction(3, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) 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 InvokeGetResult(url[0]);
+ }
+ });
+
+ //
+ seq.addAction(4, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) throws IOException, PortletException
+ {
+ // Should be called
+ calls.add("4");
+
+ // Refresh
+ return new InvokeGetResult(url[0]);
+ }
+ });
+
+ //
+ seq.addAction(5, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) throws IOException, PortletException
+ {
+ // Should not be called
+ calls.add("5");
+ return null;
+ }
+ });
+ seq.addAction(5, UTP3.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) throws IOException, PortletException
+ {
+ // Refresh
+ return new InvokeGetResult(url[0]);
+ }
+ });
+
+ //
+ seq.addAction(6, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) 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 Result run(Portlet portlet, RenderRequest request, RenderResponse response) 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 InvokeGetResult(url[0]);
+ }
+ catch (InterruptedException e)
+ {
+ return new FailureResult();
+ }
+ }
+ });
+
+ //
+ seq.addAction(7, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) 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 EndTestResult();
+ }
+ });
+ }
+
+ /**
+ * 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 Result run(Portlet portlet, RenderRequest request, RenderResponse response) 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 InvokeGetResult(response.createRenderURL().toString());
+ }
+ });
+
+ //
+ seq.addAction(1, UTP9.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) throws IOException, PortletException
+ {
+ // Should not be called
+ calls.add("1");
+ return null;
+ }
+ });
+ seq.addAction(1, UTP10.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) throws IOException, PortletException
+ {
+ // Invalidate with action
+ return new InvokeGetResult(url[0]);
+ }
+ });
+
+ //
+ seq.addAction(2, UTP9.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws PortletException, IOException
+ {
+ calls.add("2_action");
+ return null;
+ }
+ });
+ seq.addAction(2, UTP9.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) 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 InvokeGetResult(url.toString());
+ }
+ });
+
+ //
+ seq.addAction(3, UTP9.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) 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 InvokeGetResult(url.toString());
+ }
+ });
+
+ //
+ seq.addAction(4, UTP9.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) throws IOException, PortletException
+ {
+ // Should not be called
+ calls.add("4");
+ return null;
+ }
+ });
+ seq.addAction(4, UTP10.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) throws IOException, PortletException
+ {
+ // Invalidate with action
+ return new InvokeGetResult(url[0]);
+ }
+ });
+
+ //
+ seq.addAction(5, UTP9.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws PortletException, IOException
+ {
+ calls.add("5_action");
+ response.setRenderParameter("abc", "fed");
+ return null;
+ }
+ });
+ seq.addAction(5, UTP9.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) throws IOException, PortletException
+ {
+ // Should be called
+ calls.add("5_render");
+
+ // Refresh with different render parameters
+ PortletURL url = response.createRenderURL();
+ return new InvokeGetResult(url.toString());
+ }
+ });
+
+ //
+ seq.addAction(6, UTP9.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) 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 EndTestResult();
+ }
+ });
+ }
+
+ 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 Result run(Portlet portlet, RenderRequest request, RenderResponse response) throws IOException, PortletException
+ {
+ // Content is not cached
+ calls.add("0");
+
+ // Refresh
+ url[0] = response.createActionURL().toString();
+ return new InvokeGetResult(response.createRenderURL().toString());
+ }
+ });
+
+ //
+ seq.addAction(1, p1renderjp, new PortletRenderTestAction()
+ {
+ protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) throws IOException, PortletException
+ {
+ // Should no be called
+ calls.add("1");
+ return null;
+ }
+ });
+ seq.addAction(1, p2renderjp, new PortletRenderTestAction()
+ {
+ protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) throws IOException, PortletException
+ {
+ // Invalidate
+ return new InvokeGetResult(url[0]);
+ }
+ });
+
+ //
+ seq.addAction(2, p1actionjp, new PortletActionTestAction()
+ {
+ protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws PortletException, PortletSecurityException, IOException
+ {
+ //
+ calls.add("2_action");
+ return null;
+ }
+ });
+ seq.addAction(2, p1renderjp, new PortletRenderTestAction()
+ {
+ protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) 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 EndTestResult();
+ }
+ });
+ }
+
+}
Added: branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/expiringcache/ExpiringCacheTestSuite.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/expiringcache/ExpiringCacheTestSuite.java 2006-11-09 18:12:42 UTC (rev 5615)
+++ branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/expiringcache/ExpiringCacheTestSuite.java 2006-11-09 22:53:53 UTC (rev 5616)
@@ -0,0 +1,46 @@
+/******************************************************************************
+ * 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 junit.framework.Test;
+import org.jboss.portal.test.framework.container.client.TestSuite;
+import org.jboss.portal.test.framework.container.client.TestCase;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5450 $
+ */
+public class ExpiringCacheTestSuite
+{
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite("test-jsr168-ext-expiringcache.war");
+ suite.addTest(new TestCase("DisableDuringRenderExpiringCache"));
+ suite.addTest(new TestCase("DisableDuringRenderNeverExpiringCache"));
+ suite.addTest(new TestCase("ExpiringCache"));
+ suite.addTest(new TestCase("NeverExpiringCache"));
+ suite.addTest(new TestCase("ActionInvalidatesExpiringCache"));
+ suite.addTest(new TestCase("ActionInvalidatesNeverExpiringCache"));
+ return suite;
+ }
+}
Added: branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/nocache/NoCacheSequenceBuilder.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/nocache/NoCacheSequenceBuilder.java 2006-11-09 18:12:42 UTC (rev 5615)
+++ branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/nocache/NoCacheSequenceBuilder.java 2006-11-09 22:53:53 UTC (rev 5616)
@@ -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.Joinpoint;
+import org.jboss.portal.test.framework.portlet.Sequence;
+import org.jboss.portal.test.framework.portlet.universal.UTP1;
+import org.jboss.portal.test.framework.portlet.universal.UTP2;
+import org.jboss.portal.test.framework.portlet.universal.UTP4;
+import org.jboss.portal.test.framework.portlet.universal.UTP3;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.framework.container.result.Result;
+import org.jboss.portal.test.framework.container.result.AssertResult;
+import org.jboss.portal.test.framework.container.result.InvokeGetResult;
+import org.jboss.portal.test.framework.container.result.FailureResult;
+import org.jboss.portal.test.framework.container.result.EndTestResult;
+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.PortletSecurityException;
+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 Result run(Portlet portlet, RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException
+ {
+ // Should be called
+ calls.add("0");
+
+ // Refresh
+ url[0] = response.createRenderURL().toString();
+ return new InvokeGetResult(url[0]);
+ }
+ });
+
+ //
+ seq.addAction(1, p1renderjp, new PortletRenderTestAction()
+ {
+ protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException
+ {
+ // Should be called
+ calls.add("1");
+ response.setProperty(RenderResponse.EXPIRATION_CACHE, "0");
+
+ // Refresh
+ return new InvokeGetResult(url[0]);
+ }
+ });
+
+ //
+ seq.addAction(2, p1renderjp, new PortletRenderTestAction()
+ {
+ protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException
+ {
+ // Should be called
+ calls.add("2");
+ response.setProperty(RenderResponse.EXPIRATION_CACHE, "5");
+
+ // Refresh
+ return new InvokeGetResult(url[0]);
+ }
+ });
+
+ //
+ seq.addAction(3, p1renderjp, new PortletRenderTestAction()
+ {
+ protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException
+ {
+ // Should not be called
+ calls.add("3");
+ return null;
+ }
+ });
+ seq.addAction(3, p2renderjp, new PortletRenderTestAction()
+ {
+ protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException
+ {
+ // Refresh
+ return new InvokeGetResult(url[0]);
+ }
+ });
+
+ //
+ seq.addAction(4, p1renderjp, new PortletRenderTestAction()
+ {
+ protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException
+ {
+ // Could be called or not depending on the page rendering ordre
+ return null;
+ }
+ });
+ seq.addAction(4, p2renderjp, new PortletRenderTestAction()
+ {
+ protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException
+ {
+ try
+ {
+ // Wait 5 seconds for the cache entry to be invalid
+ Thread.sleep(5 * 1000);
+
+ // Refresh
+ return new InvokeGetResult(url[0]);
+ }
+ catch (InterruptedException e)
+ {
+ return new FailureResult();
+ }
+ }
+ });
+
+ //
+ seq.addAction(5, p1renderjp, new PortletRenderTestAction()
+ {
+ protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException
+ {
+ // Should be called
+ calls.add("5");
+ response.setProperty(RenderResponse.EXPIRATION_CACHE, "5");
+ url[0] = response.createActionURL().toString();
+ return new InvokeGetResult(url[0]);
+ }
+ });
+
+ //
+ seq.addAction(6, p1actionjp, new PortletActionTestAction()
+ {
+ protected AssertResult run(Portlet portlet, ActionRequest request, ActionResponse response) throws PortletException, PortletSecurityException, IOException
+ {
+ // Should be called
+ calls.add("6_action");
+ return null;
+ }
+ });
+ seq.addAction(6, p1renderjp, new PortletRenderTestAction()
+ {
+ protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException
+ {
+ // Should be called
+ calls.add("6_render");
+ return new InvokeGetResult(response.createRenderURL().toString());
+ }
+ });
+
+ //
+ seq.addAction(7, p1renderjp, new PortletRenderTestAction()
+ {
+ protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException
+ {
+ //
+ return null;
+ }
+ });
+ seq.addAction(7, p2renderjp, new PortletRenderTestAction()
+ {
+ protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException
+ {
+ //
+ 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 EndTestResult();
+ }
+ });
+ }
+}
Added: branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/nocache/NoCacheTestSuite.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/nocache/NoCacheTestSuite.java 2006-11-09 18:12:42 UTC (rev 5615)
+++ branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/nocache/NoCacheTestSuite.java 2006-11-09 22:53:53 UTC (rev 5616)
@@ -0,0 +1,42 @@
+/******************************************************************************
+ * 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 junit.framework.Test;
+import org.jboss.portal.test.framework.container.client.TestSuite;
+import org.jboss.portal.test.framework.container.client.TestCase;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5450 $
+ */
+public class NoCacheTestSuite
+{
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite("test-jsr168-ext-nocache.war");
+ suite.addTest(new TestCase("ExplicitNoCache"));
+ suite.addTest(new TestCase("ImplicitNoCache"));
+ return suite;
+ }
+}
Added: branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test/jsr168/ext/expiringcache-war/WEB-INF/portlet.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test/jsr168/ext/expiringcache-war/WEB-INF/portlet.xml 2006-11-09 18:12:42 UTC (rev 5615)
+++ branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test/jsr168/ext/expiringcache-war/WEB-INF/portlet.xml 2006-11-09 22:53:53 UTC (rev 5616)
@@ -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.framework.portlet.universal.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.framework.portlet.universal.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.framework.portlet.universal.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.framework.portlet.universal.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.framework.portlet.universal.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.framework.portlet.universal.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.framework.portlet.universal.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.framework.portlet.universal.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.framework.portlet.universal.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.framework.portlet.universal.UTP10</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title></title>
+ </portlet-info>
+ </portlet>
+</portlet-app>
Added: branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test/jsr168/ext/expiringcache-war/WEB-INF/web.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test/jsr168/ext/expiringcache-war/WEB-INF/web.xml 2006-11-09 18:12:42 UTC (rev 5615)
+++ branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test/jsr168/ext/expiringcache-war/WEB-INF/web.xml 2006-11-09 22:53:53 UTC (rev 5616)
@@ -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: branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test/jsr168/ext/nocache-war/WEB-INF/portlet.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test/jsr168/ext/nocache-war/WEB-INF/portlet.xml 2006-11-09 18:12:42 UTC (rev 5615)
+++ branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test/jsr168/ext/nocache-war/WEB-INF/portlet.xml 2006-11-09 22:53:53 UTC (rev 5616)
@@ -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.framework.portlet.universal.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.framework.portlet.universal.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.framework.portlet.universal.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.framework.portlet.universal.UTP4</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title></title>
+ </portlet-info>
+ </portlet>
+
+</portlet-app>
Added: branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test/jsr168/ext/nocache-war/WEB-INF/web.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test/jsr168/ext/nocache-war/WEB-INF/web.xml 2006-11-09 18:12:42 UTC (rev 5615)
+++ branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test/jsr168/ext/nocache-war/WEB-INF/web.xml 2006-11-09 22:53:53 UTC (rev 5616)
@@ -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>
More information about the jboss-svn-commits
mailing list