Author: julien_viet
Date: 2011-02-14 18:02:54 -0500 (Mon, 14 Feb 2011)
New Revision: 5879
Added:
components/pc/trunk/test/core/src/main/packaging/jsr286/ext/cache-war/
components/pc/trunk/test/core/src/main/packaging/jsr286/ext/cache-war/WEB-INF/
components/pc/trunk/test/core/src/main/packaging/jsr286/ext/cache-war/WEB-INF/portlet.xml
components/pc/trunk/test/core/src/main/packaging/jsr286/ext/cache-war/WEB-INF/web.xml
components/pc/trunk/test/core/src/test/java/org/gatein/pc/test/portlet/jsr286/ext/cache/
components/pc/trunk/test/core/src/test/java/org/gatein/pc/test/portlet/jsr286/ext/cache/CacheValidationTestCase.java
Modified:
components/pc/trunk/api/src/main/java/org/gatein/pc/api/invocation/response/ContentResponse.java
components/pc/trunk/api/src/main/java/org/gatein/pc/api/invocation/response/FragmentResponse.java
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/aspects/ConsumerCacheInterceptor.java
components/pc/trunk/test/core/src/main/build.xml
components/pc/trunk/test/core/src/main/java/org/gatein/pc/test/unit/Assertion.java
components/pc/trunk/test/servers/jboss42/pom.xml
components/pc/trunk/test/servers/jboss42/src/test/resources/test/remote-jboss-unit.xml
components/pc/trunk/test/servers/jboss51/src/test/resources/test/remote-jboss-unit.xml
components/pc/trunk/test/servers/jboss6/src/test/resources/test/remote-jboss-unit.xml
components/pc/trunk/test/servers/jetty6/src/test/resources/test/remote-jboss-unit.xml
components/pc/trunk/test/servers/src/common/resources/common.xml
components/pc/trunk/test/servers/tomcat6/src/test/resources/test/remote-jboss-unit.xml
components/pc/trunk/test/servers/tomcat7/src/test/resources/test/remote-jboss-unit.xml
Log:
GTNPC-56 : ConsumerCacheInterceptor should not send RevalidateMarkupResponse back to its
previous interceptor
Modified:
components/pc/trunk/api/src/main/java/org/gatein/pc/api/invocation/response/ContentResponse.java
===================================================================
---
components/pc/trunk/api/src/main/java/org/gatein/pc/api/invocation/response/ContentResponse.java 2011-02-14
15:03:03 UTC (rev 5878)
+++
components/pc/trunk/api/src/main/java/org/gatein/pc/api/invocation/response/ContentResponse.java 2011-02-14
23:02:54 UTC (rev 5879)
@@ -78,6 +78,22 @@
this.cacheControl = cacheControl;
}
+ public ContentResponse(
+ ContentResponse that,
+ CacheControl cacheControl)
+ {
+ if (that == null)
+ {
+ throw new IllegalArgumentException("No null content response can be
provided for copy");
+ }
+ this.properties = that.properties;
+ this.attributes = that.attributes;
+ this.contentType = that.contentType;
+ this.bytes = that.bytes;
+ this.chars = that.chars;
+ this.cacheControl = cacheControl;
+ }
+
public ResponseProperties getProperties()
{
return properties;
Modified:
components/pc/trunk/api/src/main/java/org/gatein/pc/api/invocation/response/FragmentResponse.java
===================================================================
---
components/pc/trunk/api/src/main/java/org/gatein/pc/api/invocation/response/FragmentResponse.java 2011-02-14
15:03:03 UTC (rev 5878)
+++
components/pc/trunk/api/src/main/java/org/gatein/pc/api/invocation/response/FragmentResponse.java 2011-02-14
23:02:54 UTC (rev 5879)
@@ -60,6 +60,15 @@
this.nextModes = nextModes;
}
+ public FragmentResponse(FragmentResponse that, CacheControl cacheControl)
+ {
+ super(that, cacheControl);
+
+ //
+ this.title = that.title;
+ this.nextModes = that.nextModes;
+ }
+
/**
* Return the fragment title.
*
Modified:
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/aspects/ConsumerCacheInterceptor.java
===================================================================
---
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/aspects/ConsumerCacheInterceptor.java 2011-02-14
15:03:03 UTC (rev 5878)
+++
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/aspects/ConsumerCacheInterceptor.java 2011-02-14
23:02:54 UTC (rev 5879)
@@ -24,6 +24,7 @@
import org.gatein.pc.api.invocation.PortletInvocation;
import org.gatein.pc.api.invocation.RenderInvocation;
+import org.gatein.pc.api.invocation.response.FragmentResponse;
import org.gatein.pc.portlet.PortletInvokerInterceptor;
import org.gatein.pc.portlet.aspects.cache.ContentRef;
import org.gatein.pc.portlet.aspects.cache.StrongContentRef;
@@ -147,13 +148,15 @@
}
}
- ContentResponse fragment = cachedEntry != null ?
cachedEntry.contentRef.getContent() : null;
+ //
+ final ContentResponse cachedContent = cachedEntry != null ?
cachedEntry.contentRef.getContent() : null;
- // If no valid fragment we must invoke
- if (fragment == null || cachedEntry.expirationTimeMillis <
System.currentTimeMillis())
+ // If no valid content we must invoke
+ long now = System.currentTimeMillis();
+ if (cachedContent == null || cachedEntry.expirationTimeMillis < now)
{
- // Set validation token for revalidation only we have have a fragment
- if (fragment != null)
+ // Set validation token for revalidation only we have have a content
+ if (cachedContent != null)
{
renderInvocation.setValidationToken(cachedEntry.validationToken);
}
@@ -161,54 +164,69 @@
// Invoke
PortletInvocationResponse response = super.invoke(invocation);
- // Try to cache any fragment result
- CacheControl control = null;
- if (response instanceof ContentResponse)
+ // If we had a cached content that was revalidated we substitute
+ if (response instanceof RevalidateMarkupResponse && cachedContent !=
null)
{
- fragment = (ContentResponse)response;
- control = fragment.getCacheControl();
- }
- else if (response instanceof RevalidateMarkupResponse)
- {
+ // Normally we receive such response when the validation token was set
which implies we have an existing content
+ // We substitute with the appropriate content response
RevalidateMarkupResponse revalidate = (RevalidateMarkupResponse)response;
- control = revalidate.getCacheControl();
- }
-
- // Compute expiration time, i.e when it will expire
- long expirationTimeMillis = 0;
- String validationToken = null;
- if (control != null)
- {
- if (control.getExpirationSecs() == -1)
+ CacheControl control = revalidate.getCacheControl();
+ if (cachedContent instanceof FragmentResponse)
{
- expirationTimeMillis = Long.MAX_VALUE;
+ response = new FragmentResponse((FragmentResponse)cachedContent,
control);
}
- else if (control.getExpirationSecs() > 0)
+ else
{
- expirationTimeMillis = System.currentTimeMillis() +
control.getExpirationSecs() * 1000;
+ response = new ContentResponse(cachedContent, control);
}
- if (control.getValidationToken() != null)
- {
- validationToken = control.getValidationToken();
- }
- else if (cachedEntry != null)
- {
- validationToken = cachedEntry.validationToken;
- }
}
- // Cache if we can
- if (expirationTimeMillis > 0)
+ // If we have a content cache it whenever it is possible
+ if (response instanceof ContentResponse)
{
- CacheEntry cacheEntry = new CacheEntry(
- navigationalState,
- publicNavigationalState,
- windowState,
- mode,
- fragment,
- expirationTimeMillis,
- validationToken);
- userContext.setAttribute(scopeKey, cacheEntry);
+ ContentResponse contentResponse = (ContentResponse)response;
+ CacheControl control = contentResponse.getCacheControl();
+
+ //
+ if (control != null)
+ {
+ // Compute expiration time, i.e when it will expire
+ long expirationTimeMillis = 0;
+ if (control.getExpirationSecs() == -1)
+ {
+ expirationTimeMillis = Long.MAX_VALUE;
+ }
+ else if (control.getExpirationSecs() > 0)
+ {
+ expirationTimeMillis = System.currentTimeMillis() +
control.getExpirationSecs() * 1000;
+ }
+
+ // Cache if we can
+ if (expirationTimeMillis > 0)
+ {
+ // Use validation token if any
+ String validationToken = null;
+ if (control.getValidationToken() != null)
+ {
+ validationToken = control.getValidationToken();
+ }
+ else if (cachedEntry != null)
+ {
+ validationToken = cachedEntry.validationToken;
+ }
+
+ CacheEntry cacheEntry = new CacheEntry(
+ navigationalState,
+ publicNavigationalState,
+ windowState,
+ mode,
+ contentResponse,
+ expirationTimeMillis,
+ validationToken);
+ userContext.setAttribute(scopeKey, cacheEntry);
+ }
+
+ }
}
//
@@ -216,8 +234,8 @@
}
else
{
- // Use the cached fragment
- return fragment;
+ // Use the cached content
+ return cachedContent;
}
}
else
Modified: components/pc/trunk/test/core/src/main/build.xml
===================================================================
--- components/pc/trunk/test/core/src/main/build.xml 2011-02-14 15:03:03 UTC (rev 5878)
+++ components/pc/trunk/test/core/src/main/build.xml 2011-02-14 23:02:54 UTC (rev 5879)
@@ -178,6 +178,7 @@
<package-jsr286-ext-test test="event"/>
<package-jsr286-ext-test test="eventsupport"/>
<package-jsr286-ext-test test="portletmode"/>
+ <package-jsr286-ext-test test="cache"/>
</target>
Modified:
components/pc/trunk/test/core/src/main/java/org/gatein/pc/test/unit/Assertion.java
===================================================================
---
components/pc/trunk/test/core/src/main/java/org/gatein/pc/test/unit/Assertion.java 2011-02-14
15:03:03 UTC (rev 5878)
+++
components/pc/trunk/test/core/src/main/java/org/gatein/pc/test/unit/Assertion.java 2011-02-14
23:02:54 UTC (rev 5879)
@@ -1858,8 +1858,9 @@
EXT_NEVER_EXPIRING_CACHE_5(new EXT("Never expiring cache"), "Calling
portlet with different window state invalidates the cache"),
EXT_NO_CACHE_1(new EXT("No Cache"), "Caching behaviour with explicit no
cache setting in portlet.xml"),
- EXT_NO_CACHE_2(new EXT("No Cache"), "Caching behaviour with implicit no
cache setting in portlet.xml"),
+ EXT_CACHE_VALIDATION(new EXT("Cache revalidation"), "Cache
revalidation"),
+
EXT_PORTLET_CONFIG_1(new EXT("PortletConfig"), "Obtain resource bundle
during portlet init()"),
EXT_PORTLET_CONFIG_2(new EXT("PortletConfig"), "Portlet with no
resource bundle and empty <title></title> tag"),
EXT_PORTLET_CONFIG_3(new EXT("PortletConfig"), "Cascade and fallback
mechanisms for resource bundle"),
Added:
components/pc/trunk/test/core/src/main/packaging/jsr286/ext/cache-war/WEB-INF/portlet.xml
===================================================================
---
components/pc/trunk/test/core/src/main/packaging/jsr286/ext/cache-war/WEB-INF/portlet.xml
(rev 0)
+++
components/pc/trunk/test/core/src/main/packaging/jsr286/ext/cache-war/WEB-INF/portlet.xml 2011-02-14
23:02:54 UTC (rev 5879)
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<portlet-app
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2...
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0">
+
+
+ <portlet>
+ <portlet-name>TestUniversalPortletA</portlet-name>
+
<portlet-class>org.gatein.pc.test.portlet.framework.UTP1</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title></title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>TestUniversalPortletB</portlet-name>
+
<portlet-class>org.gatein.pc.test.portlet.framework.UTP2</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title></title>
+ </portlet-info>
+ </portlet>
+
+</portlet-app>
Added:
components/pc/trunk/test/core/src/main/packaging/jsr286/ext/cache-war/WEB-INF/web.xml
===================================================================
--- components/pc/trunk/test/core/src/main/packaging/jsr286/ext/cache-war/WEB-INF/web.xml
(rev 0)
+++
components/pc/trunk/test/core/src/main/packaging/jsr286/ext/cache-war/WEB-INF/web.xml 2011-02-14
23:02:54 UTC (rev 5879)
@@ -0,0 +1,35 @@
+<?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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<web-app
+
xmlns="http://java.sun.com/xml/ns/j2ee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+ version="2.4">
+
+ <listener>
+
<listener-class>org.gatein.pc.test.unit.PortletTestSuite</listener-class>
+ </listener>
+
+</web-app>
Added:
components/pc/trunk/test/core/src/test/java/org/gatein/pc/test/portlet/jsr286/ext/cache/CacheValidationTestCase.java
===================================================================
---
components/pc/trunk/test/core/src/test/java/org/gatein/pc/test/portlet/jsr286/ext/cache/CacheValidationTestCase.java
(rev 0)
+++
components/pc/trunk/test/core/src/test/java/org/gatein/pc/test/portlet/jsr286/ext/cache/CacheValidationTestCase.java 2011-02-14
23:02:54 UTC (rev 5879)
@@ -0,0 +1,191 @@
+/******************************************************************************
+ * 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.gatein.pc.test.portlet.jsr286.ext.cache;
+
+import org.gatein.pc.test.portlet.framework.UTP1;
+import org.gatein.pc.test.portlet.framework.UTP2;
+import org.gatein.pc.test.unit.Assertion;
+import org.gatein.pc.test.unit.PortletTestCase;
+import org.gatein.pc.test.unit.PortletTestContext;
+import org.gatein.pc.test.unit.actions.PortletRenderTestAction;
+import org.gatein.pc.test.unit.actions.PortletResourceTestAction;
+import org.gatein.pc.test.unit.annotations.TestCase;
+import org.jboss.unit.Failure;
+import org.jboss.unit.api.Assert;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.driver.response.FailureResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+
+import javax.portlet.Portlet;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * Calling render on the portlet with different render parameters invalidates the cache.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+@TestCase({
+ Assertion.EXT_CACHE_VALIDATION
+ })
+public class CacheValidationTestCase
+{
+
+ /** . */
+ private boolean cached;
+
+ /** . */
+ private String cachedMarkup;
+
+ public CacheValidationTestCase(PortletTestCase seq)
+ {
+ // Set two seconds of expiration
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ cached = true;
+
+ //
+ response.setContentType("text/html");
+ PrintWriter pw = response.getWriter();
+ pw.print("foocached");
+
+ // Set cache for two seconds with an etag
+ response.getCacheControl().setExpirationTime(2);
+ response.getCacheControl().setETag("footag");
+
+ // Refresh
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+
+ //
+ seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Set cached to false to make test fail later
+ cached = false;
+ return null;
+ }
+ });
+ seq.bindAction(1, UTP2.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Trigger a resource so we are sure that the cached portlet will not be part
of the whole request
+ // and we can make the 2 seconds pause without messing with the invalid entry
we want to revalidate
+ return new InvokeGetResponse(response.createResourceURL().toString());
+ }
+ });
+
+ //
+ seq.bindAction(2, UTP2.RESOURCE_JOIN_POINT, new PortletResourceTestAction()
+ {
+ @Override
+ protected DriverResponse run(Portlet portlet, ResourceRequest request,
ResourceResponse response, PortletTestContext context) throws PortletException,
IOException
+ {
+ // Check caching occurred
+ Assert.assertTrue(cached);
+
+ // Check it contains the cached content
+ byte[] bytes =
(byte[])context.getPayload().get("http.response.body");
+ String cachedMarkup = new String(bytes, "UTF-8");
+ Assert.assertTrue("Was expected " + cachedMarkup + " to
contain foocached", cachedMarkup.contains("foocached"));
+
+ // Wait at least 2 seconds so we are sure content will expire
+ try
+ {
+ Thread.sleep(2000);
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ catch (InterruptedException e)
+ {
+ return new FailureResponse(Failure.createFailure(e));
+ }
+ }
+ });
+
+ // Assert we have the etag and revalidate response for two seconds
+ seq.bindAction(3, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Check everything is as espected
+ Assert.assertEquals("footag", request.getETag());
+
+ // Revalidate markup for two seconds and invoke again
+ response.getCacheControl().setUseCachedContent(true);
+ response.getCacheControl().setExpirationTime(2);
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+
+ //
+ seq.bindAction(4, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Set cached to false to make test fail later
+ cached = false;
+ return null;
+ }
+ });
+ seq.bindAction(4, UTP2.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Trigger a resource so we are sure that the cached portlet will not be part
of the whole request
+ // and we can make the 2 seconds pause without messing with the invalid entry
we want to revalidate
+ return new InvokeGetResponse(response.createResourceURL().toString());
+ }
+ });
+
+ //
+ seq.bindAction(5, UTP2.RESOURCE_JOIN_POINT, new PortletResourceTestAction()
+ {
+ @Override
+ protected DriverResponse run(Portlet portlet, ResourceRequest request,
ResourceResponse response, PortletTestContext context) throws PortletException,
IOException
+ {
+ // Check caching occurred
+ Assert.assertTrue(cached);
+
+ // Check it contains the cached content
+ byte[] bytes =
(byte[])context.getPayload().get("http.response.body");
+ String cachedMarkup = new String(bytes, "UTF-8");
+ Assert.assertTrue("Was expected " + cachedMarkup + " to
contain foocached", cachedMarkup.contains("foocached"));
+
+ // We are done
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Modified: components/pc/trunk/test/servers/jboss42/pom.xml
===================================================================
--- components/pc/trunk/test/servers/jboss42/pom.xml 2011-02-14 15:03:03 UTC (rev 5878)
+++ components/pc/trunk/test/servers/jboss42/pom.xml 2011-02-14 23:02:54 UTC (rev 5879)
@@ -3,7 +3,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-test-servers</artifactId>
- <version>2.3.0-Alpha01-SNAPSHOT</version>
+ <version>2.3.0-Alpha02-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-test-jboss42</artifactId>
@@ -134,7 +134,7 @@
<dependency>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-test-core</artifactId>
- <version>2.3.0-Alpha01-SNAPSHOT</version>
+ <version>2.3.0-Alpha02-SNAPSHOT</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
Modified:
components/pc/trunk/test/servers/jboss42/src/test/resources/test/remote-jboss-unit.xml
===================================================================
---
components/pc/trunk/test/servers/jboss42/src/test/resources/test/remote-jboss-unit.xml 2011-02-14
15:03:03 UTC (rev 5878)
+++
components/pc/trunk/test/servers/jboss42/src/test/resources/test/remote-jboss-unit.xml 2011-02-14
23:02:54 UTC (rev 5879)
@@ -239,6 +239,10 @@
<class
name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId"
value="test-jsr286-ext-portletmode.war"/>
</generic>
+ <generic>
+ <class
name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
+ <property name="archiveId"
value="test-jsr286-ext-cache.war"/>
+ </generic>
<!--Misc Tests-->
<!--
Modified:
components/pc/trunk/test/servers/jboss51/src/test/resources/test/remote-jboss-unit.xml
===================================================================
---
components/pc/trunk/test/servers/jboss51/src/test/resources/test/remote-jboss-unit.xml 2011-02-14
15:03:03 UTC (rev 5878)
+++
components/pc/trunk/test/servers/jboss51/src/test/resources/test/remote-jboss-unit.xml 2011-02-14
23:02:54 UTC (rev 5879)
@@ -239,6 +239,10 @@
<class
name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId"
value="test-jsr286-ext-portletmode.war"/>
</generic>
+ <generic>
+ <class
name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
+ <property name="archiveId"
value="test-jsr286-ext-cache.war"/>
+ </generic>
<!--Misc Tests-->
<!--
Modified:
components/pc/trunk/test/servers/jboss6/src/test/resources/test/remote-jboss-unit.xml
===================================================================
---
components/pc/trunk/test/servers/jboss6/src/test/resources/test/remote-jboss-unit.xml 2011-02-14
15:03:03 UTC (rev 5878)
+++
components/pc/trunk/test/servers/jboss6/src/test/resources/test/remote-jboss-unit.xml 2011-02-14
23:02:54 UTC (rev 5879)
@@ -239,6 +239,10 @@
<class
name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId"
value="test-jsr286-ext-portletmode.war"/>
</generic>
+ <generic>
+ <class
name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
+ <property name="archiveId"
value="test-jsr286-ext-cache.war"/>
+ </generic>
<!--Misc Tests-->
<!--
Modified:
components/pc/trunk/test/servers/jetty6/src/test/resources/test/remote-jboss-unit.xml
===================================================================
---
components/pc/trunk/test/servers/jetty6/src/test/resources/test/remote-jboss-unit.xml 2011-02-14
15:03:03 UTC (rev 5878)
+++
components/pc/trunk/test/servers/jetty6/src/test/resources/test/remote-jboss-unit.xml 2011-02-14
23:02:54 UTC (rev 5879)
@@ -239,6 +239,10 @@
<class
name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId"
value="test-jsr286-ext-portletmode.war"/>
</generic>
+ <generic>
+ <class
name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
+ <property name="archiveId"
value="test-jsr286-ext-cache.war"/>
+ </generic>
<!--Misc Tests-->
<!--
Modified: components/pc/trunk/test/servers/src/common/resources/common.xml
===================================================================
--- components/pc/trunk/test/servers/src/common/resources/common.xml 2011-02-14 15:03:03
UTC (rev 5878)
+++ components/pc/trunk/test/servers/src/common/resources/common.xml 2011-02-14 23:02:54
UTC (rev 5879)
@@ -213,6 +213,7 @@
<package-jsr286-ext-test test="event"/>
<package-jsr286-ext-test test="eventsupport"/>
<package-jsr286-ext-test test="portletmode"/>
+ <package-jsr286-ext-test test="cache"/>
<!-- -->
<copy todir="${target}/test-classes/portlet-test-war/WEB-INF/lib"
flatten="true">
Modified:
components/pc/trunk/test/servers/tomcat6/src/test/resources/test/remote-jboss-unit.xml
===================================================================
---
components/pc/trunk/test/servers/tomcat6/src/test/resources/test/remote-jboss-unit.xml 2011-02-14
15:03:03 UTC (rev 5878)
+++
components/pc/trunk/test/servers/tomcat6/src/test/resources/test/remote-jboss-unit.xml 2011-02-14
23:02:54 UTC (rev 5879)
@@ -239,6 +239,10 @@
<class
name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId"
value="test-jsr286-ext-portletmode.war"/>
</generic>
+ <generic>
+ <class
name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
+ <property name="archiveId"
value="test-jsr286-ext-cache.war"/>
+ </generic>
<!--Misc Tests-->
<!--
Modified:
components/pc/trunk/test/servers/tomcat7/src/test/resources/test/remote-jboss-unit.xml
===================================================================
---
components/pc/trunk/test/servers/tomcat7/src/test/resources/test/remote-jboss-unit.xml 2011-02-14
15:03:03 UTC (rev 5878)
+++
components/pc/trunk/test/servers/tomcat7/src/test/resources/test/remote-jboss-unit.xml 2011-02-14
23:02:54 UTC (rev 5879)
@@ -239,6 +239,10 @@
<class
name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId"
value="test-jsr286-ext-portletmode.war"/>
</generic>
+ <generic>
+ <class
name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
+ <property name="archiveId"
value="test-jsr286-ext-cache.war"/>
+ </generic>
<!--Misc Tests-->
<!--