Author: julien(a)jboss.com
Date: 2006-12-16 07:28:47 -0500 (Sat, 16 Dec 2006)
New Revision: 5881
Added:
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/framework/portlet/universal/UTP11.java
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/common/
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/common/AbstractCacheSequenceBuilder.java
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/neverexpiringcache/
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/neverexpiringcache/NeverExpiringCacheSequenceBuilder.java
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/neverexpiringcache/NeverExpiringCacheTestSuite.java
branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test/jsr168/ext/neverexpiringcache-war/
branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test/jsr168/ext/neverexpiringcache-war/WEB-INF/
branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test/jsr168/ext/neverexpiringcache-war/WEB-INF/portlet.xml
branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test/jsr168/ext/neverexpiringcache-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/test/PortletController.java
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/resources/test/jsr168/ext/expiringcache-war/WEB-INF/portlet.xml
Log:
JBPORTAL-1163 : Portlet cache does not take in account window state and modes
Modified: branches/JBoss_Portal_Branch_2_4/portlet/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_4/portlet/build.xml 2006-12-16 01:44:37 UTC (rev 5880)
+++ branches/JBoss_Portal_Branch_2_4/portlet/build.xml 2006-12-16 12:28:47 UTC (rev 5881)
@@ -227,6 +227,7 @@
<sequential>
<mkdir
dir="${build.resources}/test/jsr168/ext/@{test}-war/WEB-INF/classes"/>
<copy
todir="${build.resources}/test/jsr168/ext/@{test}-war/WEB-INF/classes">
+ <fileset dir="${build.classes}"
includes="org/jboss/portal/test/portlet/jsr168/ext/common/**"/>
<fileset dir="${build.classes}"
includes="org/jboss/portal/test/portlet/jsr168/ext/@{test}/**"/>
<fileset dir="${build.classes}"
includes="org/jboss/portal/test/framework/portlet/**"/>
</copy>
@@ -372,6 +373,7 @@
<!-- Ext tests -->
<package-ext-test test="nocache"/>
<package-ext-test test="expiringcache"/>
+ <package-ext-test test="neverexpiringcache"/>
<package-ext-test test="preferences"/>
<package-ext-test test="session"/>
<package-ext-test test="portletresponses"/>
@@ -510,8 +512,10 @@
name="org.jboss.portal.test.portlet.jsr168.ext.nocache.NoCacheTestSuite"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.portlet.jsr168.ext.expiringcache.ExpiringCacheTestSuite"/>
+ <test todir="${test.reports}"
+
name="org.jboss.portal.test.portlet.jsr168.ext.neverexpiringcache.NeverExpiringCacheTestSuite"/>
<!--Misc Tests-->
- <test todir="${test.reports}"
name="org.jboss.portal.test.portlet.jsr168.misc.log4j.Log4jTestSuite"/>
+ <!--<test todir="${test.reports}"
name="org.jboss.portal.test.portlet.jsr168.misc.log4j.Log4jTestSuite"/>-->
</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-12-16
01:44:37 UTC (rev 5880)
+++
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java 2006-12-16
12:28:47 UTC (rev 5881)
@@ -34,6 +34,8 @@
import org.jboss.portal.portlet.result.cache.TimedContent;
import org.jboss.portal.portlet.spi.InvocationContext;
import org.jboss.portal.portlet.spi.RenderContext;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.Mode;
import java.io.Serializable;
@@ -56,6 +58,8 @@
//
StateString navState = renderCtx.getNavigationalState();
+ WindowState windowState = renderCtx.getWindowState();
+ Mode mode = renderCtx.getMode();
//
CacheEntry cachedEntry =
(CacheEntry)invocation.getContext().getAttribute(InvocationContext.PRINCIPAL_SCOPE,
scopeKey);
@@ -96,6 +100,12 @@
{
useEntry = navState.equals(entryNavState);
}
+
+ // Then check window state equality
+ useEntry &= windowState.equals(cachedEntry.getWindowState());
+
+ // Then check mode equality
+ useEntry &= mode.equals(cachedEntry.getMode());
}
// Use the entry
@@ -137,7 +147,7 @@
// Cache if we can
if (expirationTimeMillis > 0)
{
- CacheEntry cacheEntry = new CacheEntry(navState, renderResult,
expirationTimeMillis);
+ CacheEntry cacheEntry = new CacheEntry(navState, windowState, mode,
renderResult, expirationTimeMillis);
invocation.getContext().setAttribute(InvocationContext.PRINCIPAL_SCOPE,
scopeKey, cacheEntry);
}
}
@@ -170,16 +180,35 @@
/** The timed content. */
private final TimedContent cachedResult;
- public CacheEntry(StateString navigationalState, FragmentResult result, long
expirationTimeMillis)
+ /** . */
+ private WindowState windowState;
+
+ /** . */
+ private Mode mode;
+
+ public CacheEntry(StateString navigationalState, WindowState windowState, Mode
mode, FragmentResult result, long expirationTimeMillis)
{
if (expirationTimeMillis <= 0)
{
throw new IllegalArgumentException();
}
this.navigationalState = navigationalState;
+ this.windowState = windowState;
+ this.mode = mode;
this.cachedResult = new StrongTimedContent(result, expirationTimeMillis);
}
+
+ public WindowState getWindowState()
+ {
+ return windowState;
+ }
+
+ public Mode getMode()
+ {
+ return mode;
+ }
+
public StateString getNavigationalState()
{
return navigationalState;
Modified:
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/portlet/test/PortletController.java
===================================================================
---
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/portlet/test/PortletController.java 2006-12-16
01:44:37 UTC (rev 5880)
+++
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/portlet/test/PortletController.java 2006-12-16
12:28:47 UTC (rev 5881)
@@ -227,16 +227,20 @@
req.getNavigationContext().setNavigationalState(portlet.getId(),
decoder.getNavigationalstate());
//
- if (decoder.getMode() != null)
+ Mode mode = decoder.getMode();
+ if (mode == null)
{
- req.getNavigationContext().setNavigationalState(portlet.getId() +
"_mode", decoder.getMode());
+ mode = Mode.VIEW;
}
+ req.getNavigationContext().setNavigationalState(portlet.getId() +
"_mode", mode);
//
- if (decoder.getWindowState() != null)
+ WindowState windowState = decoder.getWindowState();
+ if (windowState == null)
{
- req.getNavigationContext().setNavigationalState(portlet.getId() +
"_windowstate", decoder.getWindowState());
+ windowState = WindowState.NORMAL;
}
+ req.getNavigationContext().setNavigationalState(portlet.getId() +
"_windowstate", windowState);
}
}
Added:
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/framework/portlet/universal/UTP11.java
===================================================================
---
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/framework/portlet/universal/UTP11.java 2006-12-16
01:44:37 UTC (rev 5880)
+++
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/framework/portlet/universal/UTP11.java 2006-12-16
12:28:47 UTC (rev 5881)
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * 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.framework.portlet.universal;
+
+import org.jboss.portal.test.framework.portlet.components.AbstractUniversalTestPortlet;
+import org.jboss.portal.test.framework.portlet.Joinpoint;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw
Dawidowicz</a>
+ * @version $Revision: 5450 $
+ */
+public class UTP11 extends AbstractUniversalTestPortlet
+{
+ public static ThreadLocal local = new ThreadLocal();
+
+ public static Object holder;
+
+ public static String NAME = "Portlet11";
+
+ public final static Joinpoint RENDER_JOINPOINT = new Joinpoint(NAME,
Joinpoint.PORTLET_RENDER);
+
+ public final static Joinpoint ACTION_JOINPOINT = new Joinpoint(NAME,
Joinpoint.PORTLET_ACTION);
+
+ protected String createComponentId()
+ {
+ return NAME;
+ }
+
+ /** Resets helper variables */
+ public void reset()
+ {
+ local = new ThreadLocal();
+ holder = null;
+ }
+}
Added:
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/common/AbstractCacheSequenceBuilder.java
===================================================================
---
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/common/AbstractCacheSequenceBuilder.java 2006-12-16
01:44:37 UTC (rev 5880)
+++
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/common/AbstractCacheSequenceBuilder.java 2006-12-16
12:28:47 UTC (rev 5881)
@@ -0,0 +1,394 @@
+/******************************************************************************
+ * 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.common;
+
+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.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.AssertResult;
+import org.jboss.portal.test.framework.container.result.EndTestResult;
+import org.jboss.portal.common.util.CollectionBuilder;
+
+import javax.portlet.PortletURL;
+import javax.portlet.RenderResponse;
+import javax.portlet.ActionResponse;
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.PortletException;
+import javax.portlet.ActionRequest;
+import javax.portlet.WindowState;
+import javax.portlet.WindowStateException;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletModeException;
+import java.util.Set;
+import java.util.HashSet;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class AbstractCacheSequenceBuilder extends SequenceRegistryBuilder
+{
+
+ protected final AbstractCacheSequenceBuilder.NavigationalStateConfigurator
renderParameterConfigurator = new
AbstractCacheSequenceBuilder.NavigationalStateConfigurator()
+ {
+ public PortletURL createPortletURL(RenderResponse resp)
+ {
+ PortletURL url = resp.createRenderURL();
+ url.setParameter("abc", "def");
+ return url;
+ }
+ public void configureNavigationalState(ActionResponse resp)
+ {
+ resp.setRenderParameter("abc", "fed");
+ }
+ };
+
+ protected final AbstractCacheSequenceBuilder.NavigationalStateConfigurator
windowStateConfigurator = new
AbstractCacheSequenceBuilder.NavigationalStateConfigurator()
+ {
+ public PortletURL createPortletURL(RenderResponse resp) throws
WindowStateException
+ {
+ PortletURL url = resp.createRenderURL();
+ url.setWindowState(WindowState.MAXIMIZED);
+ return url;
+ }
+ public void configureNavigationalState(ActionResponse resp) throws
WindowStateException
+ {
+ resp.setWindowState(WindowState.MAXIMIZED);
+ }
+ };
+
+ protected final AbstractCacheSequenceBuilder.NavigationalStateConfigurator
portletModeConfigurator = new
AbstractCacheSequenceBuilder.NavigationalStateConfigurator()
+ {
+ public PortletURL createPortletURL(RenderResponse resp) throws
PortletModeException
+ {
+ PortletURL url = resp.createRenderURL();
+ url.setPortletMode(PortletMode.EDIT);
+ return url;
+ }
+ public void configureNavigationalState(ActionResponse resp) throws
PortletModeException
+ {
+ resp.setPortletMode(PortletMode.EDIT);
+ }
+ };
+
+ /**
+ * Overriding the expiration cache to 0 disable the cache on a render or an
action/render.
+ */
+ protected 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();
+ }
+ });
+ }
+
+ protected interface NavigationalStateConfigurator
+ {
+ PortletURL createPortletURL(RenderResponse resp) throws PortletException;
+ void configureNavigationalState(ActionResponse resp) throws PortletException;
+ }
+
+ /**
+ * Calling render on the portlet with different render parameters invalidates the
cache
+ */
+ protected void createCacheMarkup(
+ String testName,
+ SequenceRegistry registry,
+ Joinpoint p1renderjp,
+ Joinpoint p1actionjp,
+ Joinpoint p2renderjp,
+ final AbstractCacheSequenceBuilder.NavigationalStateConfigurator configurator)
+ {
+ 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");
+
+ // Create invalidating action url for later use
+ url[0] = response.createActionURL().toString();
+
+ // Refresh
+ 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 not 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 with action
+ return new InvokeGetResult(url[0]);
+ }
+ });
+
+ //
+ seq.addAction(2, p1actionjp, new PortletActionTestAction()
+ {
+ protected AssertResult run(Portlet portlet, ActionRequest request,
ActionResponse response) throws PortletException, 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
+ {
+ // Should be called
+ calls.add("2_render");
+
+ // Refresh with different URL
+ PortletURL url = configurator.createPortletURL(response);
+ return new InvokeGetResult(url.toString());
+ }
+ });
+
+ //
+ seq.addAction(3, p1renderjp, new PortletRenderTestAction()
+ {
+ protected Result run(Portlet portlet, RenderRequest request, RenderResponse
response) throws IOException, PortletException
+ {
+ // Should be called
+ calls.add("3");
+
+ // Invoke with same different URL
+ PortletURL url = configurator.createPortletURL(response);
+ return new InvokeGetResult(url.toString());
+ }
+ });
+
+ //
+ seq.addAction(4, p1renderjp, 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, p2renderjp, 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, p1actionjp, new PortletActionTestAction()
+ {
+ protected AssertResult run(Portlet portlet, ActionRequest request,
ActionResponse response) throws PortletException, IOException
+ {
+ calls.add("5_action");
+
+ // Configure the navitional state
+ configurator.configureNavigationalState(response);
+ return null;
+ }
+ });
+ seq.addAction(5, p1renderjp, new PortletRenderTestAction()
+ {
+ protected Result run(Portlet portlet, RenderRequest request, RenderResponse
response) throws IOException, PortletException
+ {
+ // Should be called
+ calls.add("5_render");
+
+ // Refresh with different navigational state to check it will be called in
the next render phase
+ PortletURL url = response.createRenderURL();
+ return new InvokeGetResult(url.toString());
+ }
+ });
+
+ //
+ seq.addAction(6, p1renderjp, 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();
+ }
+ });
+ }
+
+ /**
+ * Calling action on the portlet invalidates the cache.
+ */
+ protected 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, 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();
+ }
+ });
+ }
+
+
+}
Modified:
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-12-16
01:44:37 UTC (rev 5880)
+++
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/expiringcache/ExpiringCacheSequenceBuilder.java 2006-12-16
12:28:47 UTC (rev 5881)
@@ -22,46 +22,41 @@
******************************************************************************/
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.UTP9;
+import org.jboss.portal.test.framework.portlet.universal.UTP8;
import org.jboss.portal.test.framework.portlet.universal.UTP2;
+import org.jboss.portal.test.framework.portlet.universal.UTP1;
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.UTP5;
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.universal.UTP11;
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.test.portlet.jsr168.ext.common.AbstractCacheSequenceBuilder;
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;
+import java.util.HashSet;
+import java.util.Set;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class ExpiringCacheSequenceBuilder extends SequenceRegistryBuilder
+public class ExpiringCacheSequenceBuilder extends AbstractCacheSequenceBuilder
{
public void createDisableDuringRenderExpiringCache(SequenceRegistry registry)
@@ -69,80 +64,28 @@
createDisableDuringRender("DisableDuringRenderExpiringCache", registry,
UTP1.RENDER_JOINPOINT, UTP1.ACTION_JOINPOINT);
}
- public void createDisableDuringRenderNeverExpiringCache(SequenceRegistry registry)
+ public void createActionInvalidatesExpiringCache(SequenceRegistry registry)
{
- createDisableDuringRender("DisableDuringRenderNeverExpiringCache",
registry, UTP6.RENDER_JOINPOINT, UTP6.ACTION_JOINPOINT);
+ createActionInvalidates("ActionInvalidatesExpiringCache", registry,
UTP2.RENDER_JOINPOINT, UTP2.ACTION_JOINPOINT, UTP3.RENDER_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)
+ public void createExpiringCacheWithRenderParameters(SequenceRegistry registry)
{
- final Set calls = new HashSet();
- Sequence seq = new Sequence();
- registry.addSequence(testName, seq);
+ createCacheMarkup("ExpiringCacheWithRenderParameters", registry,
UTP4.RENDER_JOINPOINT, UTP4.ACTION_JOINPOINT, UTP5.RENDER_JOINPOINT,
renderParameterConfigurator);
+ }
- //
- 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");
+ public void createExpiringCacheWithWindowState(SequenceRegistry registry)
+ {
+ createCacheMarkup("ExpiringCacheWithWindowState", registry,
UTP6.RENDER_JOINPOINT, UTP6.ACTION_JOINPOINT, UTP7.RENDER_JOINPOINT,
windowStateConfigurator);
+ }
- // 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();
- }
- });
+ public void createExpiringCacheWithPortletMode(SequenceRegistry registry)
+ {
+ createCacheMarkup("ExpiringCacheWithPortletMode", registry,
UTP8.RENDER_JOINPOINT, UTP8.ACTION_JOINPOINT, UTP9.RENDER_JOINPOINT,
portletModeConfigurator);
}
/**
- * 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
+ * Check that content is cached for at most 5 seconds in various situations.
*/
public void createExpiringCache(SequenceRegistry registry)
{
@@ -152,7 +95,7 @@
registry.addSequence("ExpiringCache", seq);
//
- seq.addAction(0, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+ seq.addAction(0, UTP10.RENDER_JOINPOINT, new PortletRenderTestAction()
{
protected Result run(Portlet portlet, RenderRequest request, RenderResponse
response) throws IOException, PortletException
{
@@ -166,7 +109,7 @@
});
//
- seq.addAction(1, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+ seq.addAction(1, UTP10.RENDER_JOINPOINT, new PortletRenderTestAction()
{
protected Result run(Portlet portlet, RenderRequest request, RenderResponse
response) throws IOException, PortletException
{
@@ -175,7 +118,7 @@
return null;
}
});
- seq.addAction(1, UTP3.RENDER_JOINPOINT, new PortletRenderTestAction()
+ seq.addAction(1, UTP11.RENDER_JOINPOINT, new PortletRenderTestAction()
{
protected Result run(Portlet portlet, RenderRequest request, RenderResponse
response) throws IOException, PortletException
{
@@ -185,7 +128,7 @@
});
//
- seq.addAction(2, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+ seq.addAction(2, UTP10.RENDER_JOINPOINT, new PortletRenderTestAction()
{
protected Result run(Portlet portlet, RenderRequest request, RenderResponse
response) throws IOException, PortletException
{
@@ -197,7 +140,7 @@
return null;
}
});
- seq.addAction(2, UTP3.RENDER_JOINPOINT, new PortletRenderTestAction()
+ seq.addAction(2, UTP11.RENDER_JOINPOINT, new PortletRenderTestAction()
{
protected Result run(Portlet portlet, RenderRequest request, RenderResponse
response) throws IOException, PortletException
{
@@ -219,7 +162,7 @@
});
//
- seq.addAction(3, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+ seq.addAction(3, UTP10.RENDER_JOINPOINT, new PortletRenderTestAction()
{
protected Result run(Portlet portlet, RenderRequest request, RenderResponse
response) throws IOException, PortletException
{
@@ -235,7 +178,7 @@
});
//
- seq.addAction(4, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+ seq.addAction(4, UTP10.RENDER_JOINPOINT, new PortletRenderTestAction()
{
protected Result run(Portlet portlet, RenderRequest request, RenderResponse
response) throws IOException, PortletException
{
@@ -248,7 +191,7 @@
});
//
- seq.addAction(5, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+ seq.addAction(5, UTP10.RENDER_JOINPOINT, new PortletRenderTestAction()
{
protected Result run(Portlet portlet, RenderRequest request, RenderResponse
response) throws IOException, PortletException
{
@@ -257,7 +200,7 @@
return null;
}
});
- seq.addAction(5, UTP3.RENDER_JOINPOINT, new PortletRenderTestAction()
+ seq.addAction(5, UTP11.RENDER_JOINPOINT, new PortletRenderTestAction()
{
protected Result run(Portlet portlet, RenderRequest request, RenderResponse
response) throws IOException, PortletException
{
@@ -267,7 +210,7 @@
});
//
- seq.addAction(6, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+ seq.addAction(6, UTP10.RENDER_JOINPOINT, new PortletRenderTestAction()
{
protected Result run(Portlet portlet, RenderRequest request, RenderResponse
response) throws IOException, PortletException
{
@@ -279,7 +222,7 @@
return null;
}
});
- seq.addAction(6, UTP3.RENDER_JOINPOINT, new PortletRenderTestAction()
+ seq.addAction(6, UTP11.RENDER_JOINPOINT, new PortletRenderTestAction()
{
protected Result run(Portlet portlet, RenderRequest request, RenderResponse
response) throws IOException, PortletException
{
@@ -301,7 +244,7 @@
});
//
- seq.addAction(7, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+ seq.addAction(7, UTP10.RENDER_JOINPOINT, new PortletRenderTestAction()
{
protected Result run(Portlet portlet, RenderRequest request, RenderResponse
response) throws IOException, PortletException
{
@@ -318,229 +261,4 @@
});
}
- /**
- * 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();
- }
- });
- }
-
}
Modified:
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-12-16
01:44:37 UTC (rev 5880)
+++
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/expiringcache/ExpiringCacheTestSuite.java 2006-12-16
12:28:47 UTC (rev 5881)
@@ -36,11 +36,11 @@
{
TestSuite suite = new TestSuite("test-jsr168-ext-expiringcache.war");
suite.addTest(new TestCase("DisableDuringRenderExpiringCache"));
- suite.addTest(new TestCase("DisableDuringRenderNeverExpiringCache"));
+ suite.addTest(new TestCase("ActionInvalidatesExpiringCache"));
+ suite.addTest(new TestCase("ExpiringCacheWithRenderParameters"));
+ suite.addTest(new TestCase("ExpiringCacheWithWindowState"));
+ suite.addTest(new TestCase("ExpiringCacheWithPortletMode"));
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/neverexpiringcache/NeverExpiringCacheSequenceBuilder.java
===================================================================
---
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/neverexpiringcache/NeverExpiringCacheSequenceBuilder.java 2006-12-16
01:44:37 UTC (rev 5880)
+++
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/neverexpiringcache/NeverExpiringCacheSequenceBuilder.java 2006-12-16
12:28:47 UTC (rev 5881)
@@ -0,0 +1,68 @@
+/******************************************************************************
+ * 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.neverexpiringcache;
+
+import org.jboss.portal.test.portlet.jsr168.ext.common.AbstractCacheSequenceBuilder;
+import org.jboss.portal.test.framework.portlet.SequenceRegistry;
+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.UTP4;
+import org.jboss.portal.test.framework.portlet.universal.UTP8;
+import org.jboss.portal.test.framework.portlet.universal.UTP2;
+import org.jboss.portal.test.framework.portlet.universal.UTP9;
+import org.jboss.portal.test.framework.portlet.universal.UTP5;
+import org.jboss.portal.test.framework.portlet.universal.UTP7;
+import org.jboss.portal.test.framework.portlet.universal.UTP3;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class NeverExpiringCacheSequenceBuilder extends AbstractCacheSequenceBuilder
+{
+
+ public void createDisableDuringRenderNeverExpiringCache(SequenceRegistry registry)
+ {
+ createDisableDuringRender("DisableDuringRenderNeverExpiringCache",
registry, UTP1.RENDER_JOINPOINT, UTP1.ACTION_JOINPOINT);
+ }
+
+ public void createActionInvalidatesNeverExpiringCache(SequenceRegistry registry)
+ {
+ createActionInvalidates("ActionInvalidatesNeverExpiringCache", registry,
UTP2.RENDER_JOINPOINT, UTP2.ACTION_JOINPOINT, UTP3.RENDER_JOINPOINT);
+ }
+
+ public void createNeverExpiringCacheWithRenderParameters(SequenceRegistry registry)
+ {
+ createCacheMarkup("NeverExpiringCacheWithRenderParameters", registry,
UTP4.RENDER_JOINPOINT, UTP4.ACTION_JOINPOINT, UTP5.RENDER_JOINPOINT,
renderParameterConfigurator);
+ }
+
+ public void createNeverExpiringCacheWithWindowState(SequenceRegistry registry)
+ {
+ createCacheMarkup("NeverExpiringCacheWithWindowState", registry,
UTP6.RENDER_JOINPOINT, UTP6.ACTION_JOINPOINT, UTP7.RENDER_JOINPOINT,
windowStateConfigurator);
+ }
+
+ public void createNeverExpiringCacheWithPortletMode(SequenceRegistry registry)
+ {
+ createCacheMarkup("NeverExpiringCacheWithPortletMode", registry,
UTP8.RENDER_JOINPOINT, UTP8.ACTION_JOINPOINT, UTP9.RENDER_JOINPOINT,
portletModeConfigurator);
+ }
+}
Added:
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/neverexpiringcache/NeverExpiringCacheTestSuite.java
===================================================================
---
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/neverexpiringcache/NeverExpiringCacheTestSuite.java 2006-12-16
01:44:37 UTC (rev 5880)
+++
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/neverexpiringcache/NeverExpiringCacheTestSuite.java 2006-12-16
12:28:47 UTC (rev 5881)
@@ -0,0 +1,45 @@
+/******************************************************************************
+ * 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.neverexpiringcache;
+
+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@jboss.org">Julien Viet</a>
+ * @version $Revision: 5450 $
+ */
+public class NeverExpiringCacheTestSuite
+{
+ public static Test suite()
+ {
+ TestSuite suite = new
TestSuite("test-jsr168-ext-neverexpiringcache.war");
+ suite.addTest(new TestCase("DisableDuringRenderNeverExpiringCache"));
+ suite.addTest(new TestCase("ActionInvalidatesNeverExpiringCache"));
+ suite.addTest(new TestCase("NeverExpiringCacheWithRenderParameters"));
+ suite.addTest(new TestCase("NeverExpiringCacheWithWindowState"));
+ suite.addTest(new TestCase("NeverExpiringCacheWithPortletMode"));
+ return suite;
+ }
+}
Modified:
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-12-16
01:44:37 UTC (rev 5880)
+++
branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test/jsr168/ext/expiringcache-war/WEB-INF/portlet.xml 2006-12-16
12:28:47 UTC (rev 5881)
@@ -88,7 +88,7 @@
<portlet>
<portlet-name>TestUniversalPortletF</portlet-name>
<portlet-class>org.jboss.portal.test.framework.portlet.universal.UTP6</portlet-class>
- <expiration-cache>-1</expiration-cache>
+ <expiration-cache>5</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
</supports>
@@ -100,7 +100,6 @@
<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>
@@ -112,8 +111,10 @@
<portlet>
<portlet-name>TestUniversalPortletH</portlet-name>
<portlet-class>org.jboss.portal.test.framework.portlet.universal.UTP8</portlet-class>
+ <expiration-cache>5</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
+ <portlet-mode>edit</portlet-mode>
</supports>
<portlet-info>
<title></title>
@@ -123,7 +124,6 @@
<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>
@@ -135,6 +135,7 @@
<portlet>
<portlet-name>TestUniversalPortletJ</portlet-name>
<portlet-class>org.jboss.portal.test.framework.portlet.universal.UTP10</portlet-class>
+ <expiration-cache>5</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
</supports>
@@ -142,4 +143,16 @@
<title></title>
</portlet-info>
</portlet>
+
+ <portlet>
+ <portlet-name>TestUniversalPortletK</portlet-name>
+
<portlet-class>org.jboss.portal.test.framework.portlet.universal.UTP11</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/neverexpiringcache-war/WEB-INF/portlet.xml
===================================================================
---
branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test/jsr168/ext/neverexpiringcache-war/WEB-INF/portlet.xml 2006-12-16
01:44:37 UTC (rev 5880)
+++
branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test/jsr168/ext/neverexpiringcache-war/WEB-INF/portlet.xml 2006-12-16
12:28:47 UTC (rev 5881)
@@ -0,0 +1,135 @@
+<?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...
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>-1</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>-1</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>-1</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>
+ <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>
+ <expiration-cache>-1</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>edit</portlet-mode>
+ </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>
+ <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/neverexpiringcache-war/WEB-INF/web.xml
===================================================================
---
branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test/jsr168/ext/neverexpiringcache-war/WEB-INF/web.xml 2006-12-16
01:44:37 UTC (rev 5880)
+++
branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test/jsr168/ext/neverexpiringcache-war/WEB-INF/web.xml 2006-12-16
12:28:47 UTC (rev 5881)
@@ -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.neverexpiringcache.NeverExpiringCacheSequenceBuilder</listener-class>
+ </listener>
+
+</web-app>