Author: julien(a)jboss.com
Date: 2008-01-22 07:30:44 -0500 (Tue, 22 Jan 2008)
New Revision: 9551
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/resourceserving/
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/resourceserving/ResourceServingTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/actions/PortletResourceTestAction.java
modules/portlet/trunk/test/src/test/resources/jsr286/tck/resourceserving-war/
modules/portlet/trunk/test/src/test/resources/jsr286/tck/resourceserving-war/WEB-INF/
modules/portlet/trunk/test/src/test/resources/jsr286/tck/resourceserving-war/WEB-INF/portlet.xml
modules/portlet/trunk/test/src/test/resources/jsr286/tck/resourceserving-war/WEB-INF/web.xml
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ProducerCacheInterceptor.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/MimeResponseImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ResourceURLImpl.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP1.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/JoinPointType.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/PortletTestContext.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/base/AbstractUniversalTestPortlet.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java
modules/portlet/trunk/test/src/test/build.xml
modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml
Log:
- added support for resource serving testing
- fixed a couple of bugs in resource serving preliminary impl
- added an initial test case for resource serving
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ProducerCacheInterceptor.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ProducerCacheInterceptor.java 2008-01-22
12:13:44 UTC (rev 9550)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ProducerCacheInterceptor.java 2008-01-22
12:30:44 UTC (rev 9551)
@@ -30,6 +30,7 @@
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.RenderInvocation;
import org.jboss.portal.portlet.invocation.EventInvocation;
+import org.jboss.portal.portlet.invocation.ResourceInvocation;
import org.jboss.portal.portlet.invocation.response.FragmentResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.container.PortletContainerInvoker;
@@ -58,6 +59,11 @@
// Invoke
return invocation.invokeNext();
}
+ else if (invocation instanceof ResourceInvocation)
+ {
+ // Invoke
+ return invocation.invokeNext();
+ }
else if (invocation instanceof RenderInvocation)
{
// Invoke
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java 2008-01-22
12:13:44 UTC (rev 9550)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java 2008-01-22
12:30:44 UTC (rev 9551)
@@ -363,9 +363,13 @@
{
return invokeEvent((EventInvocation)invocation);
}
+ else if (invocation instanceof ResourceInvocation)
+ {
+ return invokeResource((ResourceInvocation)invocation);
+ }
else
{
- throw new InvocationException("Unexpected invocation " +
invocation);
+ throw new InvocationException("Unexpected invocation " +
invocation);
}
}
catch (NoClassDefFoundError e)
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/MimeResponseImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/MimeResponseImpl.java 2008-01-22
12:13:44 UTC (rev 9550)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/MimeResponseImpl.java 2008-01-22
12:30:44 UTC (rev 9551)
@@ -176,7 +176,7 @@
public ResourceURL createResourceURL()
{
- throw new NotYetImplemented();
+ return ResourceURLImpl.createResourceURL(invocation, preq);
}
public CacheControl getCacheControl()
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ResourceURLImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ResourceURLImpl.java 2008-01-22
12:13:44 UTC (rev 9550)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ResourceURLImpl.java 2008-01-22
12:30:44 UTC (rev 9551)
@@ -79,7 +79,7 @@
//
if (invocation instanceof ResourceInvocation)
{
- url.constraint =
((ResourceInvocation)invocation).getContext().getCacheability();
+ url.parentCacheability =
((ResourceInvocation)invocation).getContext().getCacheability();
}
}
@@ -93,15 +93,9 @@
public String getCacheability()
{
- Cacheability cacheability = url.cacheability;
+ Cacheability cacheability = url.getCacheability();
//
- if (cacheability == null)
- {
- cacheability = url.constraint != null ? url.constraint : Cacheability.PAGE;
- }
-
- //
return typetoJSR168.get(cacheability);
}
@@ -112,13 +106,13 @@
//
if (cacheability != null)
{
- if (url.constraint == null)
+ if (url.parentCacheability == null)
{
url.cacheability = cacheability;
}
else
{
- switch (url.constraint)
+ switch (url.parentCacheability)
{
case FULL:
if (cacheability != Cacheability.FULL)
@@ -151,7 +145,7 @@
private String id;
/** The cacheability constraining the url cacheability. */
- private Cacheability constraint;
+ private Cacheability parentCacheability;
/** . */
private Cacheability cacheability;
@@ -173,7 +167,21 @@
public Cacheability getCacheability()
{
- return cacheability;
+ if (cacheability != null)
+ {
+ return cacheability;
+ }
+ else
+ {
+ if (parentCacheability != null)
+ {
+ return parentCacheability;
+ }
+ else
+ {
+ return Cacheability.PAGE;
+ }
+ }
}
}
}
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP1.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP1.java 2008-01-22
12:13:44 UTC (rev 9550)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/framework/UTP1.java 2008-01-22
12:30:44 UTC (rev 9551)
@@ -57,6 +57,8 @@
public final static JoinPoint ACTION_JOIN_POINT = new JoinPoint(NAME,
JoinPointType.PORTLET_ACTION);
+ public final static JoinPoint RESOURCE_JOIN_POINT = new JoinPoint(NAME,
JoinPointType.PORTLET_RESOURCE);
+
/** Resets helper variables */
public void reset()
{
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/resourceserving/ResourceServingTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/resourceserving/ResourceServingTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/resourceserving/ResourceServingTestCase.java 2008-01-22
12:30:44 UTC (rev 9551)
@@ -0,0 +1,120 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr286.tck.resourceserving;
+
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.Assertion;
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.unit.actions.PortletResourceTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.*;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ResourceURL;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import javax.portlet.PortletException;
+import java.io.IOException;
+import java.io.Serializable;
+import java.io.PrintWriter;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+(a)TestCase({Assertion.JSR168_1000})
+public class ResourceServingTestCase
+{
+
+ private String blah;
+
+ public ResourceServingTestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ blah = response.createRenderURL().toString();
+
+ ResourceURL resourceURL = response.createResourceURL();
+ resourceURL.setResourceID("blah");
+ resourceURL.setParameter("foo", "bar");
+ String s = resourceURL.toString();
+ return new InvokeGetResponse(s);
+ }
+ });
+ seq.bindAction(1, UTP1.RESOURCE_JOIN_POINT, new PortletResourceTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, ResourceRequest request,
ResourceResponse response, PortletTestContext context) throws PortletException,
IOException
+ {
+ assertEquals("blah", request.getResourceID());
+ assertEquals("bar", request.getParameter("foo"));
+ assertEquals(ResourceURL.PAGE, request.getCacheability());
+
+ response.setContentType("text/html");
+ PrintWriter writer = response.getWriter();
+ writer.print("foo");
+ writer.close();
+
+ return new InvokeGetResponse(blah);
+ }
+ });
+ seq.bindAction(2, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+
+ byte[] bytes =
(byte[])context.getPayload().get("http.response.body");
+ System.out.println("bytes.length = " + bytes.length);
+
+ for (Map.Entry<String, Serializable> entry :
context.getPayload().entrySet())
+ {
+
+
+ System.out.println("entry.getKey() = " + entry.getKey());
+ System.out.println("entry.getValue() = " + entry.getValue());
+ }
+
+ return new EndTestResponse();
+ }
+ });
+ }
+
+// entry.getKey() = http.response.body
+// entry.getValue() = [B@bdcd96
+// entry.getKey() = http.response.headers
+// entry.getValue() = Server: Apache-Coyote/1.1
+// Content-Length: 0
+// Date: Tue,22 Jan 2008 01:23:43 GMT
+//
+
+
+}
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/JoinPointType.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/JoinPointType.java 2008-01-22
12:13:44 UTC (rev 9550)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/JoinPointType.java 2008-01-22
12:30:44 UTC (rev 9551)
@@ -32,6 +32,7 @@
PORTLET_ACTION("portlet.action"),
PORTLET_EVENT("portlet.event"),
PORTLET_RENDER("portlet.render"),
+ PORTLET_RESOURCE("portlet.resource"),
SERVLET_SERVICE("servlet.service");
/** . */
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/PortletTestContext.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/PortletTestContext.java 2008-01-22
12:13:44 UTC (rev 9550)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/PortletTestContext.java 2008-01-22
12:30:44 UTC (rev 9551)
@@ -32,6 +32,7 @@
import java.net.MalformedURLException;
import java.io.Serializable;
import java.util.HashMap;
+import java.util.Map;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -102,4 +103,10 @@
}
return requestContext.getParametrization().get(parameterName);
}
+
+ public Map<String, Serializable> getPayload()
+ {
+ return requestContext.getPayload();
+ }
+
}
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/actions/PortletResourceTestAction.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/actions/PortletResourceTestAction.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/actions/PortletResourceTestAction.java 2008-01-22
12:30:44 UTC (rev 9551)
@@ -0,0 +1,69 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.unit.actions;
+
+import org.jboss.portal.unit.TestAction;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.FailureResponse;
+import org.jboss.unit.Failure;
+
+import javax.portlet.Portlet;
+import javax.portlet.PortletException;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw
Dawidowicz</a>
+ * @version $Revision: 7954 $
+ */
+public abstract class PortletResourceTestAction extends TestAction
+{
+
+ public DriverResponse execute(Portlet servlet, ResourceRequest request,
ResourceResponse response, PortletTestContext context) throws PortletException,
IOException
+ {
+ try
+ {
+ return run(servlet, request, response, context);
+ }
+ catch (Exception e)
+ {
+ if (e instanceof PortletException)
+ {
+ throw (PortletException)e;
+ }
+ if (e instanceof IOException)
+ {
+ throw (IOException)e;
+ }
+ return new FailureResponse(Failure.createAssertionFailure(e));
+ }
+ catch (AssertionError t)
+ {
+ return new FailureResponse(Failure.createFailure(t));
+ }
+ }
+
+ protected abstract DriverResponse run(Portlet portlet, ResourceRequest request,
ResourceResponse response, PortletTestContext context) throws PortletException,
IOException;
+}
\ No newline at end of file
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/base/AbstractUniversalTestPortlet.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/base/AbstractUniversalTestPortlet.java 2008-01-22
12:13:44 UTC (rev 9550)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/base/AbstractUniversalTestPortlet.java 2008-01-22
12:30:44 UTC (rev 9551)
@@ -28,6 +28,7 @@
import org.jboss.portal.unit.actions.PortletActionTestAction;
import org.jboss.portal.unit.actions.PortletRenderTestAction;
import org.jboss.portal.unit.actions.PortletEventTestAction;
+import org.jboss.portal.unit.actions.PortletResourceTestAction;
import org.jboss.portal.unit.TestAction;
import org.jboss.portal.unit.PortletTestContext;
import org.jboss.portal.test.framework.server.NodeId;
@@ -49,6 +50,9 @@
import javax.portlet.EventPortlet;
import javax.portlet.EventRequest;
import javax.portlet.EventResponse;
+import javax.portlet.ResourceServingPortlet;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
import java.io.IOException;
/**
@@ -57,7 +61,7 @@
* @author <a href="mailto:boleslaw.dawidowicz@jboss.com">Boleslaw
Dawidowicz</a>
* @version $Revision: 7954 $
*/
-public abstract class AbstractUniversalTestPortlet implements Portlet, EventPortlet
+public abstract class AbstractUniversalTestPortlet implements Portlet, EventPortlet,
ResourceServingPortlet
{
public static String getPortletName()
@@ -84,6 +88,9 @@
/** Joinpoint for action phase. */
private final JoinPoint actionJoinPoint = JoinPoint.createJoinPoint(getClass(),
JoinPointType.PORTLET_ACTION);
+ /** Joinpoint for resource serving. */
+ private final JoinPoint resourceJoinPoint = JoinPoint.createJoinPoint(getClass(),
JoinPointType.PORTLET_RESOURCE);
+
/** To keep PortletConfig for some tests*-. */
private PortletConfig config;
@@ -266,6 +273,45 @@
}
}
+ public void serveResource(ResourceRequest req, ResourceResponse resp) throws
PortletException, IOException
+ {
+ PortletTestContext ctx = PortletTestDriver.getPortletTestContext();
+
+ //
+ log.debug("JoinPoint '" + resourceJoinPoint + " invoked for
'"
+ + ctx.getTestName() + "' testId and '" +
+ +ctx.getRequestCount() + "' request count");
+
+ // Get the action
+ TestAction action = null;
+ PortletTestCase portletTestCase = getSequence(ctx.getTestName());
+ if (portletTestCase != null)
+ {
+ action = portletTestCase.getAction(ctx.getRequestCount(), NodeId.locate(),
resourceJoinPoint);
+
+ }
+
+ //
+ if (action == null)
+ {
+ ctx.setResponse(new FailureResponse(Failure.createAssertionFailure("No
action for " + ctx.getRequestCount() + " " + NodeId.locate() + "
" + resourceJoinPoint)));
+ }
+ else if (action instanceof PortletResourceTestAction == false)
+ {
+ ctx.setResponse(new FailureResponse(Failure.createAssertionFailure("Action
for " + ctx.getRequestCount() + " " + NodeId.locate() + " " +
resourceJoinPoint + " is not an instance of " +
PortletResourceTestAction.class.getName() + " but is " +
action.getClass().getName())));
+ }
+ else
+ {
+ log.debug("Found action for joinpoint " + resourceJoinPoint + " :
" + action);
+
+ // Get the result that must exist since it is the only joinpoint invoked during
this request
+ DriverResponse response = ((PortletResourceTestAction)action).execute(this, req,
resp, ctx);
+
+ //
+ ctx.setResponse(response);
+ }
+ }
+
public void destroy()
{
}
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java 2008-01-22
12:13:44 UTC (rev 9550)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java 2008-01-22
12:30:44 UTC (rev 9551)
@@ -42,6 +42,7 @@
import org.jboss.portal.portlet.invocation.response.HTTPRedirectionResponse;
import org.jboss.portal.portlet.invocation.response.ErrorResponse;
import org.jboss.portal.portlet.invocation.response.StateResponse;
+import org.jboss.portal.portlet.invocation.response.FragmentResponse;
import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.invocation.RenderInvocation;
import org.jboss.portal.portlet.invocation.EventInvocation;
@@ -50,16 +51,19 @@
import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.common.util.MediaType;
+import org.jboss.portal.common.io.IOTools;
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.apache.log4j.Logger;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletOutputStream;
import javax.xml.namespace.QName;
import java.io.UnsupportedEncodingException;
import java.io.PrintWriter;
import java.io.IOException;
+import java.io.Writer;
import java.util.List;
import java.util.ArrayList;
import java.util.LinkedList;
@@ -472,6 +476,57 @@
else if (containerRequest instanceof PortletResourceRequest)
{
PortletInvocationResponse response = handle(context, containerRequest);
+
+ //
+ if (response instanceof FragmentResponse)
+ {
+ FragmentResponse fragment = (FragmentResponse)response;
+
+ if (fragment.getType() == FragmentResponse.TYPE_EMPTY)
+ {
+ resp.setStatus(HttpServletResponse.SC_NO_CONTENT);
+ }
+ else
+ {
+ String contentType = fragment.getContentType();
+ if (contentType != null)
+ {
+ resp.setContentType(contentType);
+ }
+
+ //
+ if (fragment.getType() == FragmentResponse.TYPE_BYTES)
+ {
+ ServletOutputStream out = null;
+ try
+ {
+ out = resp.getOutputStream();
+ out.write(fragment.getBytes().toByteArray());
+ }
+ finally
+ {
+ IOTools.safeClose(out);
+ }
+ }
+ else
+ {
+ Writer writer = null;
+ try
+ {
+ writer = resp.getWriter();
+ writer.write(fragment.getChars().toString());
+ }
+ finally
+ {
+ writer.close();
+ }
+ }
+ }
+ }
+ else
+ {
+ // todo
+ }
}
}
Modified: modules/portlet/trunk/test/src/test/build.xml
===================================================================
--- modules/portlet/trunk/test/src/test/build.xml 2008-01-22 12:13:44 UTC (rev 9550)
+++ modules/portlet/trunk/test/src/test/build.xml 2008-01-22 12:30:44 UTC (rev 9551)
@@ -230,6 +230,7 @@
<package-jsr286-tck-test test="eventnonamespace"/>
<package-jsr286-tck-test test="stateawareresponse"/>
<package-jsr286-tck-test test="portletrequests"/>
+ <package-jsr286-tck-test test="resourceserving"/>
<package-jsr286-api-test test="event"/>
Copied:
modules/portlet/trunk/test/src/test/resources/jsr286/tck/resourceserving-war/WEB-INF/portlet.xml
(from rev 9546,
modules/portlet/trunk/test/src/test/resources/jsr286/tck/stateawareresponse-war/WEB-INF/portlet.xml)
===================================================================
---
modules/portlet/trunk/test/src/test/resources/jsr286/tck/resourceserving-war/WEB-INF/portlet.xml
(rev 0)
+++
modules/portlet/trunk/test/src/test/resources/jsr286/tck/resourceserving-war/WEB-INF/portlet.xml 2008-01-22
12:30:44 UTC (rev 9551)
@@ -0,0 +1,38 @@
+<?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>UniversalTestPortletA</portlet-name>
+
<portlet-class>org.jboss.portal.test.portlet.framework.UTP1</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ </portlet>
+
+</portlet-app>
Copied:
modules/portlet/trunk/test/src/test/resources/jsr286/tck/resourceserving-war/WEB-INF/web.xml
(from rev 9546,
modules/portlet/trunk/test/src/test/resources/jsr286/tck/stateawareresponse-war/WEB-INF/web.xml)
===================================================================
---
modules/portlet/trunk/test/src/test/resources/jsr286/tck/resourceserving-war/WEB-INF/web.xml
(rev 0)
+++
modules/portlet/trunk/test/src/test/resources/jsr286/tck/resourceserving-war/WEB-INF/web.xml 2008-01-22
12:30:44 UTC (rev 9551)
@@ -0,0 +1,32 @@
+<?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.unit.PortletTestSuite</listener-class>
+ </listener>
+</web-app>
Modified: modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml 2008-01-22
12:13:44 UTC (rev 9550)
+++ modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml 2008-01-22
12:30:44 UTC (rev 9551)
@@ -173,6 +173,10 @@
<class
name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId"
value="test-jsr286-tck-portletrequests.war"/>
</generic>
+ <generic>
+ <class
name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
+ <property name="archiveId"
value="test-jsr286-tck-resourceserving.war"/>
+ </generic>
<!--Spec API Assertions tests-->
<generic>