JBoss Portal SVN: r9650 - modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-01-30 06:54:53 -0500 (Wed, 30 Jan 2008)
New Revision: 9650
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludeFromActionEventObjectsTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludeFromRenderObjectsTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludeFromResourceObjectsTestCase.java
Log:
Initial include dispatcher tests
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludeFromActionEventObjectsTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludeFromActionEventObjectsTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludeFromActionEventObjectsTestCase.java 2008-01-30 11:54:53 UTC (rev 9650)
@@ -0,0 +1,336 @@
+/*
+* 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.dispatcher;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.Assertion;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.unit.actions.ServletServiceTestAction;
+import org.jboss.portal.unit.actions.PortletActionTestAction;
+import org.jboss.portal.unit.actions.PortletEventTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.framework.UTS1;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.assertNotNull;
+import static org.jboss.unit.api.Assert.assertNull;
+import static org.jboss.unit.api.Assert.assertEquals;
+import static org.jboss.unit.api.Assert.assertTrue;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletURL;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Enumeration;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+
+@TestCase({
+ Assertion.JSR286_185,
+ Assertion.JSR286_186,
+ Assertion.JSR286_187,
+ Assertion.JSR286_188,
+ Assertion.JSR286_189,
+ Assertion.JSR286_190,
+ Assertion.JSR286_191,
+ Assertion.JSR286_192,
+ Assertion.JSR286_193,
+ Assertion.JSR286_194,
+ Assertion.JSR286_195,
+ Assertion.JSR286_196,
+ Assertion.JSR286_197,
+ Assertion.JSR286_198,
+ Assertion.JSR286_199,
+ Assertion.JSR286_200,
+ Assertion.JSR286_201,
+ Assertion.JSR286_202
+
+ })
+public class IncludeFromActionEventObjectsTestCase
+{
+ private int actionCount = 0;
+
+ private int eventCount = 0;
+
+ public IncludeFromActionEventObjectsTestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ PortletURL actionURL = response.createActionURL();
+ return new InvokeGetResponse(actionURL.toString());
+
+
+ }
+ });
+
+ seq.bindAction(1, UTP1.ACTION_JOIN_POINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ actionCount++;
+
+
+ //we dispatch to servlet and assertions will be done there
+ String queryString = "?key1=k1value1&key2=k2value1";
+ PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getRequestDispatcher("/universalServletA" + queryString);
+ dispatcher.include(request, response);
+
+ response.setEvent("Event",null);
+ }
+ });
+
+ seq.bindAction(1, UTP1.EVENT_JOIN_POINT, new PortletEventTestAction()
+ {
+ protected void run(Portlet portlet, EventRequest request, EventResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ eventCount++;
+
+ //we dispatch to servlet and assertions will be done there
+ String queryString = "?key1=k1value1&key2=k2value1";
+ PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getRequestDispatcher("/universalServletA" + queryString);
+ dispatcher.include(request, response);
+
+ }
+ });
+
+
+ seq.bindAction(1, UTS1.SERVICE_JOIN_POINT, new ServletServiceTestAction()
+ {
+ protected DriverResponse run(Servlet servlet, HttpServletRequest request, HttpServletResponse response, PortletTestContext context) throws ServletException, IOException
+ {
+ check(request, response);
+
+ //Only if both action and even was invoked
+ if (actionCount == 1 && eventCount == 1)
+ {
+ return new EndTestResponse();
+ }
+ else
+ {
+ return null;
+ }
+ }
+ });
+ }
+
+ public void check(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
+ {
+ //we get this object to assert some of it's method compare wieth http request methods
+ PortletRequest portletRequest = (PortletRequest)request.getAttribute("javax.portlet.request");
+ PortletResponse portletResponse = (PortletResponse)request.getAttribute("javax.portlet.response");
+
+ assertNotNull(portletRequest);
+ assertNotNull(portletResponse);
+
+ //SPEC:185
+ assertNull(request.getRemoteAddr());
+ assertNull(request.getRemoteHost());
+ assertNull(request.getRealPath("toto"));
+ assertNull(request.getLocalAddr());
+ assertNull(request.getLocalName());
+ assertNull(request.getRequestURL());
+
+ //SPEC:186
+ assertEquals(0, request.getRemotePort());
+ assertEquals(0, request.getLocalPort());
+
+ //SPEC:187
+
+ //TODO:getPathInfo
+ //assertEquals(null, request.getPathInfo());
+ //TODO:getPathTranslated
+ //assertEquals("",request.getPathTranslated());
+ assertEquals("key1=k1value1&key2=k2value1", request.getQueryString());
+ //TODO:getRequestURI
+ //assertEquals("/requestObjectServlet",request.getRequestURI());
+ assertEquals("/universalServletA", request.getServletPath());
+
+ //SPEC:188
+ assertEquals(portletRequest.getScheme(), request.getScheme());
+ assertEquals(portletRequest.getServerName(), request.getServerName());
+ assertEquals(portletRequest.getServerPort(), request.getServerPort());
+ //TODO:fail
+ //assertEquals(portletRequest.getAttributeNames(), request.getAttributeNames());
+
+ // getAttributeNames, setAttribute, getAttribute, removeAttribute
+ request.setAttribute("key1", "k1atrr1");
+ request.setAttribute("key2", "k2attr2");
+ List attrNames = new LinkedList();
+ Enumeration attrEnum = request.getAttributeNames();
+ while (attrEnum.hasMoreElements())
+ {
+ attrNames.add(attrEnum.nextElement());
+ }
+ assertNotNull(request.getAttribute("key1"));
+ assertNotNull(request.getAttribute("key2"));
+
+ assertTrue(attrNames.contains("key1"));
+ assertTrue(attrNames.contains("key2"));
+
+ request.removeAttribute("key1");
+ assertNull(request.getAttribute("key1"));
+ assertNotNull(request.getAttribute("key2"));
+
+ //getLocale, getLocales
+ assertEquals(portletRequest.getLocale(), request.getLocale());
+
+ List portletLocales = new LinkedList();
+ List servletLocales = new LinkedList();
+ Enumeration pl = portletRequest.getLocales();
+ while (pl.hasMoreElements())
+ {
+ portletLocales.add(pl.nextElement());
+ }
+ Enumeration sl = request.getLocales();
+ while (sl.hasMoreElements())
+ {
+ servletLocales.add(sl.nextElement());
+ }
+
+ assertTrue(portletLocales.equals(servletLocales));
+
+ assertEquals(portletRequest.isSecure(), request.isSecure());
+ assertEquals(portletRequest.getAuthType(), request.getAuthType());
+ assertEquals(portletRequest.getContextPath(), request.getContextPath());
+ assertEquals(portletRequest.getRemoteUser(), request.getRemoteUser());
+ assertEquals(portletRequest.getUserPrincipal(), request.getUserPrincipal());
+ assertEquals(portletRequest.getRequestedSessionId(), request.getRequestedSessionId());
+ assertEquals(portletRequest.isRequestedSessionIdValid(), request.isRequestedSessionIdValid());
+ assertEquals(portletRequest.getCookies(), request.getCookies());
+
+ //SPEC:189
+ //in this assertions we use parameters passed in query string of dispatcher
+ List paramNames = new LinkedList();
+ Enumeration paramEnum = request.getParameterNames();
+ while (paramEnum.hasMoreElements())
+ {
+ paramNames.add(paramEnum.nextElement());
+ }
+ assertTrue(paramNames.contains("key1"));
+ assertTrue(paramNames.contains("key2"));
+
+ assertEquals("k1value1", request.getParameter("key1"));
+ assertEquals(new String[]{"k1value1"}, request.getParameterValues("key1"));
+
+ Map paramNamesMap = request.getParameterMap();
+ assertTrue(paramNamesMap.containsKey("key1"));
+ assertTrue(paramNamesMap.containsKey("key2"));
+
+
+
+ //Action only
+ if (actionCount == 1 && eventCount == 0)
+ {
+ ActionRequest actionRequest = (ActionRequest)portletRequest;
+
+ //SPEC:190
+ //TODO:fail
+ //request.setCharacterEncoding("utf8");
+ assertEquals(actionRequest.getCharacterEncoding(), request.getCharacterEncoding());
+ assertEquals(actionRequest.getContentType(), request.getContentType());
+ //TODO:fail
+ //assertEquals(actionRequest.getPortletInputStream(), request.getInputStream());
+ assertEquals(actionRequest.getContentLength(), request.getContentLength());
+ assertEquals(actionRequest.getMethod(), request.getMethod());
+ assertEquals(actionRequest.getReader(), request.getReader());
+ }
+
+ //Event only
+ if (actionCount == 1 && eventCount == 1)
+ {
+ EventRequest eventRequest = (EventRequest)portletRequest;
+
+ //SPEC:191
+ request.setCharacterEncoding("utf8");
+ assertNull(request.getCharacterEncoding());
+ assertNull(request.getContentType());
+ assertNull(request.getInputStream());
+ assertNull(request.getReader());
+
+ //SPEC:192
+ assertEquals(0, request.getContentLength());
+
+ //SPEC:193
+ assertEquals(eventRequest.getMethod(), request.getMethod());
+ }
+
+ //SPEC:194
+ //TODO:
+
+ //SPEC:195
+ //TODO:
+
+ //SPEC:196
+ assertEquals("HTTP/1.1", request.getProtocol());
+
+ //SPEC:197
+ assertNull(response.encodeRedirectURL("lolo"));
+ assertNull(response.encodeRedirectUrl("bobo"));
+ assertNull(response.getCharacterEncoding());
+ assertNull(response.getContentType());
+ assertNull(response.getLocale());
+ //TODO:
+ //resetBuffer, reset
+
+ //SPEC:198
+ assertEquals(0, response.getBufferSize());
+
+ //SPEC:199
+ //TODO:
+
+ //SPEC:200
+ //TODO:
+
+ //SPEC:201
+ assertEquals(false, response.containsHeader("toto"));
+
+ //SPEC:202
+ assertEquals(true, response.isCommitted());
+
+ }
+}
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludeFromRenderObjectsTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludeFromRenderObjectsTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludeFromRenderObjectsTestCase.java 2008-01-30 11:54:53 UTC (rev 9650)
@@ -0,0 +1,254 @@
+/*
+* 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.dispatcher;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.Assertion;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.unit.actions.ServletServiceTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.framework.UTS1;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.assertNotNull;
+import static org.jboss.unit.api.Assert.assertNull;
+import static org.jboss.unit.api.Assert.assertEquals;
+import static org.jboss.unit.api.Assert.assertTrue;
+import org.jboss.unit.api.pojo.annotations.Test;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletResponse;
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Enumeration;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+
+@TestCase({
+ Assertion.JSR286_104,
+ Assertion.JSR286_105,
+ Assertion.JSR286_106,
+ Assertion.JSR286_107,
+ Assertion.JSR286_108,
+ Assertion.JSR286_109,
+ Assertion.JSR286_110,
+ Assertion.JSR286_111,
+ Assertion.JSR286_112,
+ Assertion.JSR286_113,
+ Assertion.JSR286_114,
+ Assertion.JSR286_115,
+ Assertion.JSR286_116,
+ Assertion.JSR286_117,
+ Assertion.JSR286_118
+ })
+public class IncludeFromRenderObjectsTestCase
+{
+
+ public IncludeFromRenderObjectsTestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ //we dispatch to servlet and assertions will be done there
+ String queryString = "?key1=k1value1&key2=k2value1";
+ PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getRequestDispatcher("/universalServletA" + queryString);
+ response.setContentType("text/html");
+ dispatcher.include(request, response);
+ return null;
+ }
+ });
+
+
+ seq.bindAction(0, UTS1.SERVICE_JOIN_POINT, new ServletServiceTestAction()
+ {
+ protected DriverResponse run(Servlet servlet, HttpServletRequest request, HttpServletResponse response, PortletTestContext context) throws ServletException, IOException
+ {
+ //we get this object to assert some of it's method compare wieth http request methods
+ RenderRequest portletRequest = (RenderRequest)request.getAttribute("javax.portlet.request");
+ RenderResponse portletResponse = (RenderResponse)request.getAttribute("javax.portlet.response");
+
+ assertNotNull(portletRequest);
+ assertNotNull(portletResponse);
+
+ //SPEC:104
+ assertNull(request.getRemoteAddr());
+ assertNull(request.getRemoteHost());
+ assertNull(request.getRealPath("toto"));
+ assertNull(request.getLocalAddr());
+ assertNull(request.getLocalName());
+ assertNull(request.getRequestURL());
+
+ //SPEC:105
+ assertEquals(0, request.getRemotePort());
+ assertEquals(0, request.getLocalPort());
+
+ //SPEC:106
+ //TODO:getPathInfo
+ //assertEquals(null, request.getPathInfo());
+ //TODO:getPathTranslated
+ //assertEquals("",request.getPathTranslated());
+ assertEquals("key1=k1value1&key2=k2value1", request.getQueryString());
+ //TODO:getRequestURI
+ //assertEquals("/requestObjectServlet",request.getRequestURI());
+ assertEquals("/universalServletA", request.getServletPath());
+
+
+ //SPEC:107
+ assertEquals(portletRequest.getScheme(), request.getScheme());
+ assertEquals(portletRequest.getServerName(), request.getServerName());
+ assertEquals(portletRequest.getServerPort(), request.getServerPort());
+ //TODO:fail
+ //assertEquals(portletRequest.getAttributeNames(), request.getAttributeNames());
+ // getAttributeNames, setAttribute, getAttribute, removeAttribute
+ request.setAttribute("key1", "k1atrr1");
+ request.setAttribute("key2", "k2attr2");
+ List attrNames = new LinkedList();
+ Enumeration attrEnum = request.getAttributeNames();
+ while (attrEnum.hasMoreElements())
+ {
+ attrNames.add(attrEnum.nextElement());
+ }
+ assertNotNull(request.getAttribute("key1"));
+ assertNotNull(request.getAttribute("key2"));
+
+ assertTrue(attrNames.contains("key1"));
+ assertTrue(attrNames.contains("key2"));
+
+ request.removeAttribute("key1");
+ assertNull(request.getAttribute("key1"));
+ assertNotNull(request.getAttribute("key2"));
+
+ //getLocale, getLocales
+ assertEquals(portletRequest.getLocale(), request.getLocale());
+
+ List portletLocales = new LinkedList();
+ List servletLocales = new LinkedList();
+ Enumeration pl = portletRequest.getLocales();
+ while (pl.hasMoreElements())
+ {
+ portletLocales.add(pl.nextElement());
+ }
+ Enumeration sl = request.getLocales();
+ while (sl.hasMoreElements())
+ {
+ servletLocales.add(sl.nextElement());
+ }
+
+ assertTrue(portletLocales.equals(servletLocales));
+
+ assertEquals(portletRequest.isSecure(), request.isSecure());
+ assertEquals(portletRequest.getAuthType(), request.getAuthType());
+ assertEquals(portletRequest.getContextPath(), request.getContextPath());
+ assertEquals(portletRequest.getRemoteUser(), request.getRemoteUser());
+ assertEquals(portletRequest.getUserPrincipal(), request.getUserPrincipal());
+ assertEquals(portletRequest.getRequestedSessionId(), request.getRequestedSessionId());
+ assertEquals(portletRequest.isRequestedSessionIdValid(), request.isRequestedSessionIdValid());
+ //TODO:fail
+ //assertEquals(portletRequest.getCookies(), request.getCookies());
+
+ //SPEC:108
+ //in this assertions we use parameters passed in query string of dispatcher
+ List paramNames = new LinkedList();
+ Enumeration paramEnum = request.getParameterNames();
+ while (paramEnum.hasMoreElements())
+ {
+ paramNames.add(paramEnum.nextElement());
+ }
+ assertTrue(paramNames.contains("key1"));
+ assertTrue(paramNames.contains("key2"));
+
+ assertEquals("k1value1", request.getParameter("key1"));
+ assertEquals(new String[]{"k1value1"}, request.getParameterValues("key1"));
+
+ Map paramNamesMap = request.getParameterMap();
+ assertTrue(paramNamesMap.containsKey("key1"));
+ assertTrue(paramNamesMap.containsKey("key2"));
+
+ //SPEC:109
+ request.setCharacterEncoding("utf8");
+ assertNull(request.getCharacterEncoding());
+ assertNull(request.getContentType());
+ assertNull(request.getInputStream());
+ assertNull(request.getReader());
+
+ //SPEC:110
+ assertEquals(0, request.getContentLength());
+
+ //SPEC:111
+ //TODO:
+
+ //SPEC:112
+ //TODO:
+
+ //SPEC:113
+ assertEquals("GET", request.getMethod());
+
+ //SPEC:114
+ //TODO:fail
+ //assertEquals("HTTP/1.1", request.getProtocol());
+
+ //SPEC:115
+ assertNull(response.encodeRedirectURL("lolo"));
+ assertNull(response.encodeRedirectUrl("blah"));
+
+ //SPEC:116
+ assertEquals(portletResponse.getCharacterEncoding(), response.getCharacterEncoding());
+ //TODO: setBufferSize, flushBuffer, resetBuffer, reset
+ assertEquals(portletResponse.getBufferSize(), response.getBufferSize());
+ assertEquals(portletResponse.isCommitted(), response.isCommitted());
+ //TODO:fail
+ //assertEquals(portletResponse.getPortletOutputStream(), response.getOutputStream());
+ assertEquals(portletResponse.getWriter(), response.getWriter());
+ //TODO: encodeURL, encodeUrl
+
+ //SPEC:117
+ //TODO:
+
+ //SPEC:118
+ assertEquals(false, response.containsHeader("blah"));
+
+ //SPEC:119
+ assertEquals(portletResponse.getLocale(), response.getLocale());
+
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludeFromResourceObjectsTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludeFromResourceObjectsTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludeFromResourceObjectsTestCase.java 2008-01-30 11:54:53 UTC (rev 9650)
@@ -0,0 +1,262 @@
+/*
+* 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.dispatcher;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.Assertion;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.unit.actions.ServletServiceTestAction;
+import org.jboss.portal.unit.actions.PortletResourceTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.framework.UTS1;
+import org.jboss.portal.test.portlet.framework.UTP3;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.assertNotNull;
+import static org.jboss.unit.api.Assert.assertNull;
+import static org.jboss.unit.api.Assert.assertEquals;
+import static org.jboss.unit.api.Assert.assertTrue;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.ResourceURL;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Enumeration;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+@TestCase({
+ Assertion.JSR286_220,
+ Assertion.JSR286_221,
+ Assertion.JSR286_222,
+ Assertion.JSR286_223,
+ Assertion.JSR286_224,
+ Assertion.JSR286_225,
+ Assertion.JSR286_226,
+ Assertion.JSR286_227,
+ Assertion.JSR286_228,
+ Assertion.JSR286_229,
+ Assertion.JSR286_230,
+ Assertion.JSR286_231,
+ Assertion.JSR286_232
+ })
+public class IncludeFromResourceObjectsTestCase
+{
+ private String blah;
+
+ public IncludeFromResourceObjectsTestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ blah = response.createRenderURL().toString();
+ ResourceURL resourceURL = response.createResourceURL();
+ return new InvokeGetResponse(resourceURL.toString());
+ }
+ });
+
+ seq.bindAction(1, UTP1.RESOURCE_JOIN_POINT, new PortletResourceTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, ResourceRequest request, ResourceResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ //we dispatch to servlet and assertions will be done there
+ String queryString = "?key1=k1value1&key2=k2value1";
+ PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getRequestDispatcher("/universalServletA" + queryString);
+ response.setContentType("text/html");
+ dispatcher.include(request, response);
+ return new InvokeGetResponse(blah);
+ }
+ });
+
+
+ seq.bindAction(1, UTS1.SERVICE_JOIN_POINT, new ServletServiceTestAction()
+ {
+ protected DriverResponse run(Servlet servlet, HttpServletRequest request, HttpServletResponse response, PortletTestContext context) throws ServletException, IOException
+ {
+ //we get this object to assert some of it's method compare wieth http request methods
+ ResourceRequest portletRequest = (ResourceRequest)request.getAttribute("javax.portlet.request");
+ ResourceResponse portletResponse = (ResourceResponse)request.getAttribute("javax.portlet.response");
+
+ assertNotNull(portletRequest);
+ assertNotNull(portletResponse);
+
+ //SPEC:220
+ assertNull(request.getRemoteAddr());
+ assertNull(request.getRemoteHost());
+ assertNull(request.getRealPath("toto"));
+ assertNull(request.getLocalAddr());
+ assertNull(request.getLocalName());
+ assertNull(request.getRequestURL());
+
+ //SPEC:221
+ assertEquals(0, request.getRemotePort());
+ assertEquals(0, request.getLocalPort());
+
+ //SPEC:222
+ //TODO:getPathInfo
+ //assertEquals(null, request.getPathInfo());
+ //TODO:getPathTranslated
+ //assertEquals("",request.getPathTranslated());
+ assertEquals("key1=k1value1&key2=k2value1", request.getQueryString());
+ //TODO:getRequestURI
+ //assertEquals("/requestObjectServlet",request.getRequestURI());
+ assertEquals("/universalServletA", request.getServletPath());
+
+
+ //SPEC:223
+ assertEquals(portletRequest.getScheme(), request.getScheme());
+ assertEquals(portletRequest.getServerName(), request.getServerName());
+ assertEquals(portletRequest.getServerPort(), request.getServerPort());
+ //TODO:fail
+ //assertEquals(portletRequest.getAttributeNames(), request.getAttributeNames());
+ // getAttributeNames, setAttribute, getAttribute, removeAttribute
+ request.setAttribute("key1", "k1atrr1");
+ request.setAttribute("key2", "k2attr2");
+ List attrNames = new LinkedList();
+ Enumeration attrEnum = request.getAttributeNames();
+ while (attrEnum.hasMoreElements())
+ {
+ attrNames.add(attrEnum.nextElement());
+ }
+ assertNotNull(request.getAttribute("key1"));
+ assertNotNull(request.getAttribute("key2"));
+
+ assertTrue(attrNames.contains("key1"));
+ assertTrue(attrNames.contains("key2"));
+
+ request.removeAttribute("key1");
+ assertNull(request.getAttribute("key1"));
+ assertNotNull(request.getAttribute("key2"));
+
+ //getLocale, getLocales
+ assertEquals(portletRequest.getLocale(), request.getLocale());
+
+ List portletLocales = new LinkedList();
+ List servletLocales = new LinkedList();
+ Enumeration pl = portletRequest.getLocales();
+ while (pl.hasMoreElements())
+ {
+ portletLocales.add(pl.nextElement());
+ }
+ Enumeration sl = request.getLocales();
+ while (sl.hasMoreElements())
+ {
+ servletLocales.add(sl.nextElement());
+ }
+
+ assertTrue(portletLocales.equals(servletLocales));
+
+ assertEquals(portletRequest.isSecure(), request.isSecure());
+ assertEquals(portletRequest.getAuthType(), request.getAuthType());
+ assertEquals(portletRequest.getContextPath(), request.getContextPath());
+ assertEquals(portletRequest.getRemoteUser(), request.getRemoteUser());
+ assertEquals(portletRequest.getUserPrincipal(), request.getUserPrincipal());
+ assertEquals(portletRequest.getRequestedSessionId(), request.getRequestedSessionId());
+ assertEquals(portletRequest.isRequestedSessionIdValid(), request.isRequestedSessionIdValid());
+ assertEquals(portletRequest.getCookies(), request.getCookies());
+
+ //SPEC:224
+ //TODO:
+
+ //SPEC:225
+ //in this assertions we use parameters passed in query string of dispatcher
+ List paramNames = new LinkedList();
+ Enumeration paramEnum = request.getParameterNames();
+ while (paramEnum.hasMoreElements())
+ {
+ paramNames.add(paramEnum.nextElement());
+ }
+ assertTrue(paramNames.contains("key1"));
+ assertTrue(paramNames.contains("key2"));
+
+ assertEquals("k1value1", request.getParameter("key1"));
+ assertEquals(new String[]{"k1value1"}, request.getParameterValues("key1"));
+
+ Map paramNamesMap = request.getParameterMap();
+ assertTrue(paramNamesMap.containsKey("key1"));
+ assertTrue(paramNamesMap.containsKey("key2"));
+
+ //SPEC:226
+ //TODO:
+
+ //SPEC:227
+ //TODO:
+
+ //SPEC:228
+ assertEquals("HTTP/1.1", request.getProtocol());
+
+ //SPEC:229
+ assertNull(response.encodeRedirectURL("lolo"));
+ assertNull(response.encodeRedirectUrl("blah"));
+
+
+ //SPEC:230
+ assertEquals(portletResponse.getCharacterEncoding(), response.getCharacterEncoding());
+ //TODO: setBufferSize, flushBuffer, resetBuffer, reset
+ assertEquals(portletResponse.getBufferSize(), response.getBufferSize());
+ assertEquals(portletResponse.isCommitted(), response.isCommitted());
+ //TODO:fail
+ //assertEquals(portletResponse.getPortletOutputStream(), response.getOutputStream());
+ assertEquals(portletResponse.getWriter(), response.getWriter());
+ assertEquals(portletResponse.getLocale(), response.getLocale());
+ //TODO: encodeURL, encodeUrl
+
+ //SPEC:231
+ //TODO:
+
+ //SPEC:232
+ assertEquals(false, response.containsHeader("blah"));
+
+ return null;
+ }
+ });
+
+ seq.bindAction(2, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ return new EndTestResponse();
+ }
+ });
+ }
+
+}
18 years, 3 months
JBoss Portal SVN: r9649 - modules/portlet/trunk/test/src/test/resources/jsr286/tck/dispatcher-war/WEB-INF.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-01-30 06:45:59 -0500 (Wed, 30 Jan 2008)
New Revision: 9649
Modified:
modules/portlet/trunk/test/src/test/resources/jsr286/tck/dispatcher-war/WEB-INF/web.xml
Log:
the hop servlet for now should not be enabled in the web.xml of test suite war
Modified: modules/portlet/trunk/test/src/test/resources/jsr286/tck/dispatcher-war/WEB-INF/web.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/tck/dispatcher-war/WEB-INF/web.xml 2008-01-30 11:22:38 UTC (rev 9648)
+++ modules/portlet/trunk/test/src/test/resources/jsr286/tck/dispatcher-war/WEB-INF/web.xml 2008-01-30 11:45:59 UTC (rev 9649)
@@ -51,10 +51,12 @@
<servlet-class>org.jboss.portal.test.portlet.framework.UTS4</servlet-class>
</servlet>
+<!--
<servlet>
<servlet-name>IncludeHopServlet</servlet-name>
<servlet-class>org.jboss.portal.test.portlet.jsr286.tck.dispatcher.IncludeHopServlet</servlet-class>
</servlet>
+-->
<servlet-mapping>
<servlet-name>UniversalServletA</servlet-name>
@@ -76,8 +78,10 @@
<url-pattern>/universalServletD/*</url-pattern>
</servlet-mapping>
+<!--
<servlet-mapping>
<servlet-name>IncludeHopServlet</servlet-name>
<url-pattern>/includeHopServlet/*</url-pattern>
</servlet-mapping>
+-->
</web-app>
18 years, 3 months
JBoss Portal SVN: r9648 - modules/portlet/trunk/test/src/test.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-01-30 06:22:38 -0500 (Wed, 30 Jan 2008)
New Revision: 9648
Modified:
modules/portlet/trunk/test/src/test/build.xml
Log:
fixed wrong packaging that was making a couple of tests to fail due to classloading issues
Modified: modules/portlet/trunk/test/src/test/build.xml
===================================================================
--- modules/portlet/trunk/test/src/test/build.xml 2008-01-30 09:46:12 UTC (rev 9647)
+++ modules/portlet/trunk/test/src/test/build.xml 2008-01-30 11:22:38 UTC (rev 9648)
@@ -109,7 +109,6 @@
<pathelement path="${dependency.jboss-kernel.jar}"/>
</path>
<path id="mc.portal-common">
- <!--<pathelement path="${dependency.portal-common.jar}"/>-->
<pathelement path="${dependency.portal-common-mc.jar}"/>
</path>
<path id="mc.jboss-unit">
@@ -371,7 +370,6 @@
<fileset dir="${test.temp.lib}" includes="portlet-test-lib.jar"/>
<path refid="mc.portal-common"/>
- <path refid="mc.portal-portlet"/>
<!-- Remote plugin -->
<path refid="mc.jboss-remoting"/>
@@ -404,7 +402,6 @@
<fileset dir="${test.temp.lib}" includes="portlet-test-lib.jar"/>
<path refid="mc.portal-common"/>
- <path refid="mc.portal-portlet"/>
<!-- Remote plugin -->
<path refid="mc.jboss-remoting"/>
18 years, 3 months
JBoss Portal SVN: r9647 - in modules/portlet/trunk: test/src/test/resources/jsr286/tck/dispatcher-war/WEB-INF and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-01-30 04:46:12 -0500 (Wed, 30 Jan 2008)
New Revision: 9647
Removed:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/ForwardedContainerAttributesTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludedContainerAttributesTestCase.java
Modified:
modules/portlet/trunk/test/src/test/resources/jsr286/tck/dispatcher-war/WEB-INF/web.xml
Log:
remove unused classses now
Deleted: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/ForwardedContainerAttributesTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/ForwardedContainerAttributesTestCase.java 2008-01-30 07:31:44 UTC (rev 9646)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/ForwardedContainerAttributesTestCase.java 2008-01-30 09:46:12 UTC (rev 9647)
@@ -1,62 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.test.portlet.jsr286.tck.dispatcher;
-
-import org.jboss.portal.unit.PortletTestCase;
-import org.jboss.portal.unit.Assertion;
-import org.jboss.portal.unit.annotations.TestCase;
-
-import javax.portlet.PortletRequestDispatcher;
-import javax.portlet.PortletRequest;
-import javax.portlet.PortletResponse;
-import javax.portlet.PortletException;
-import javax.portlet.PortletContext;
-import java.io.IOException;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-@TestCase
-public class ForwardedContainerAttributesTestCase extends DispatchedContainerAttributesTestCase
-{
- public ForwardedContainerAttributesTestCase(PortletTestCase seq)
- {
- super(seq, null);
- }
-
- protected void dispatch(PortletRequestDispatcher dispatcher, PortletRequest request, PortletResponse response) throws IOException, PortletException
- {
- dispatcher.forward(request, response);
- }
-
- protected String getDispatchType()
- {
- return "forward";
- }
-
- protected void dispatch(PortletRequest request, PortletResponse response, PortletContext portletContext) throws IOException, PortletException
- {
- //To change body of implemented methods use File | Settings | File Templates.
- }
-}
\ No newline at end of file
Deleted: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludedContainerAttributesTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludedContainerAttributesTestCase.java 2008-01-30 07:31:44 UTC (rev 9646)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludedContainerAttributesTestCase.java 2008-01-30 09:46:12 UTC (rev 9647)
@@ -1,62 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.test.portlet.jsr286.tck.dispatcher;
-
-import org.jboss.portal.unit.PortletTestCase;
-import org.jboss.portal.unit.Assertion;
-import org.jboss.portal.unit.annotations.TestCase;
-
-import javax.portlet.PortletRequestDispatcher;
-import javax.portlet.PortletRequest;
-import javax.portlet.PortletResponse;
-import javax.portlet.PortletException;
-import javax.portlet.PortletContext;
-import java.io.IOException;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-(a)TestCase({Assertion.JSR168_127})
-public class IncludedContainerAttributesTestCase extends DispatchedContainerAttributesTestCase
-{
- public IncludedContainerAttributesTestCase(PortletTestCase seq)
- {
- super(seq, null);
- }
-
- protected void dispatch(PortletRequestDispatcher dispatcher, PortletRequest request, PortletResponse response) throws IOException, PortletException
- {
- dispatcher.include(request, response);
- }
-
- protected String getDispatchType()
- {
- return "include";
- }
-
- protected void dispatch(PortletRequest request, PortletResponse response, PortletContext portletContext) throws IOException, PortletException
- {
- //To change body of implemented methods use File | Settings | File Templates.
- }
-}
Modified: modules/portlet/trunk/test/src/test/resources/jsr286/tck/dispatcher-war/WEB-INF/web.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/tck/dispatcher-war/WEB-INF/web.xml 2008-01-30 07:31:44 UTC (rev 9646)
+++ modules/portlet/trunk/test/src/test/resources/jsr286/tck/dispatcher-war/WEB-INF/web.xml 2008-01-30 09:46:12 UTC (rev 9647)
@@ -51,6 +51,11 @@
<servlet-class>org.jboss.portal.test.portlet.framework.UTS4</servlet-class>
</servlet>
+ <servlet>
+ <servlet-name>IncludeHopServlet</servlet-name>
+ <servlet-class>org.jboss.portal.test.portlet.jsr286.tck.dispatcher.IncludeHopServlet</servlet-class>
+ </servlet>
+
<servlet-mapping>
<servlet-name>UniversalServletA</servlet-name>
<url-pattern>/universalServletA/*</url-pattern>
@@ -70,4 +75,9 @@
<servlet-name>UniversalServletD</servlet-name>
<url-pattern>/universalServletD/*</url-pattern>
</servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>IncludeHopServlet</servlet-name>
+ <url-pattern>/includeHopServlet/*</url-pattern>
+ </servlet-mapping>
</web-app>
18 years, 3 months
JBoss Portal SVN: r9646 - docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: mmcallis
Date: 2008-01-30 02:31:44 -0500 (Wed, 30 Jan 2008)
New Revision: 9646
Modified:
docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/supported.xml
Log:
reprhasing, expanding acronyms
Modified: docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/supported.xml
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/supported.xml 2008-01-30 07:27:41 UTC (rev 9645)
+++ docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/supported.xml 2008-01-30 07:31:44 UTC (rev 9646)
@@ -12,10 +12,12 @@
</author>
</chapterinfo>
<title>System Requirements</title>
- <para>A list of tested versions or reported as working by users, before reporting a problem
- please make sure that you are using a compatible version.</para>
- <para>If you successfully installed JBoss Portal on versions not listed here please let us know
- so we can add it here.</para>
+ <para>
+ The following section details tested, or reported as working by users, hardware and software versions that are compatible with JBoss Portal. Before reporting a problem, make sure you are using compatible hardware and software.
+ </para>
+ <para>
+ If you successfully installed JBoss Portal on versions not listed here, please let us know so it can be added to this section.
+ </para>
<sect1>
<title>Minimum System Requirements</title>
<para>
@@ -29,15 +31,14 @@
</sect1>
<sect1>
<title>Supported Operating Systems</title>
- <para>JBoss Portal is 100% pure Java and therefore interoperable with most operating systems
- capable of running a Java Virtual Machine (JVM); including Linux, Windows, UNIX, MacOS X.
+ <para>JBoss Portal is 100% pure Java, and therefore it is interoperable with most Operating Systems
+ capable of running a Java Virtual Machine (JVM). These Operating Systems include but are not limited to: Linux, Microsoft Windows, UNIX, and Mac OS X.
</para>
</sect1>
<sect1>
<title>JBoss Application Server</title>
- <para>JBoss Portal 2.6.3 is tested with JBoss AS 4.2.1, JBoss AS 4.2.2 and JBoss EAP 4.2. It is
- highly recommended to use JBoss Portal 2.6.3 with JBoss Enterprise Application Platform 4.2 for
- customers who have access to it through the support portal and JBoss AS 4.2.2 for everybody else.</para>
+ <para>JBoss Portal 2.6.3 is tested with JBoss Application Server (AS) 4.2.1, JBoss AS 4.2.2, and JBoss Enterprise Application Platform (EAP) 4.2. It is highly recommended that customers who have access to the <ulink url="https://support.redhat.com/portal/login.html">JBoss Customer Support Portal (CSP)</ulink> use JBoss Portal 2.6.3 with JBoss Enterprise Application Platform 4.2. Customers who do not have access to the JBoss CSP should use <ulink url="http://labs.jboss.com/jbossas/">JBoss AS</ulink>.
+ </para>
<warning>
<para>4.0.x versions are not supported</para>
</warning>
18 years, 3 months
JBoss Portal SVN: r9645 - modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-01-30 02:27:41 -0500 (Wed, 30 Jan 2008)
New Revision: 9645
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/ForwardedContainerAttributesTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludedContainerAttributesTestCase.java
Log:
make it compile
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/ForwardedContainerAttributesTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/ForwardedContainerAttributesTestCase.java 2008-01-30 07:04:33 UTC (rev 9644)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/ForwardedContainerAttributesTestCase.java 2008-01-30 07:27:41 UTC (rev 9645)
@@ -30,6 +30,7 @@
import javax.portlet.PortletRequest;
import javax.portlet.PortletResponse;
import javax.portlet.PortletException;
+import javax.portlet.PortletContext;
import java.io.IOException;
/**
@@ -41,7 +42,7 @@
{
public ForwardedContainerAttributesTestCase(PortletTestCase seq)
{
- super(seq);
+ super(seq, null);
}
protected void dispatch(PortletRequestDispatcher dispatcher, PortletRequest request, PortletResponse response) throws IOException, PortletException
@@ -53,4 +54,9 @@
{
return "forward";
}
+
+ protected void dispatch(PortletRequest request, PortletResponse response, PortletContext portletContext) throws IOException, PortletException
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
}
\ No newline at end of file
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludedContainerAttributesTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludedContainerAttributesTestCase.java 2008-01-30 07:04:33 UTC (rev 9644)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludedContainerAttributesTestCase.java 2008-01-30 07:27:41 UTC (rev 9645)
@@ -30,6 +30,7 @@
import javax.portlet.PortletRequest;
import javax.portlet.PortletResponse;
import javax.portlet.PortletException;
+import javax.portlet.PortletContext;
import java.io.IOException;
/**
@@ -41,7 +42,7 @@
{
public IncludedContainerAttributesTestCase(PortletTestCase seq)
{
- super(seq);
+ super(seq, null);
}
protected void dispatch(PortletRequestDispatcher dispatcher, PortletRequest request, PortletResponse response) throws IOException, PortletException
@@ -53,4 +54,9 @@
{
return "include";
}
+
+ protected void dispatch(PortletRequest request, PortletResponse response, PortletContext portletContext) throws IOException, PortletException
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
}
18 years, 3 months
JBoss Portal SVN: r9644 - docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: mmcallis
Date: 2008-01-30 02:04:33 -0500 (Wed, 30 Jan 2008)
New Revision: 9644
Modified:
docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/target.xml
Log:
rewriting target audience section
Modified: docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/target.xml
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/target.xml 2008-01-30 01:10:46 UTC (rev 9643)
+++ docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/target.xml 2008-01-30 07:04:33 UTC (rev 9644)
@@ -1,10 +1,7 @@
<preface id="target" revision="1">
<title>Target Audience</title>
-
- <para>Portlet developers, Portal administrators, and those wishing to implement/extend the JBoss
- Portal framework.</para>
- <para>For end-user documentation, please download our User Guide from our
- <ulink url="http://labs.jboss.com/portal/jbossportal/docs/index.html">documentation page</ulink>
- .
- </para>
+ <para>
+ This guide is aimed towards Portlet developers, Portal administrators, and those wishing to
+ implement and extend the JBoss Portal framework. For end-user documentation, please refer to the JBoss Portal User Manual from the <ulink url="http://labs.jboss.com/portal/jbossportal/docs/index.html">JBoss Portal Documentation Library</ulink>
+ .</para>
</preface>
\ No newline at end of file
18 years, 3 months
JBoss Portal SVN: r9643 - modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-01-29 20:10:46 -0500 (Tue, 29 Jan 2008)
New Revision: 9643
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NamedForwardContainerAttributesTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NamedIncludeContainerAttributesTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RequestForwardContainerAttributesTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RequestIncludeContainerAttributesTestCase.java
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/DispatchedContainerAttributesTestCase.java
Log:
refactor the container attributes test cases in order to be able to support the double dispatch test cases (life is tough sometime)
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/DispatchedContainerAttributesTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/DispatchedContainerAttributesTestCase.java 2008-01-30 00:13:13 UTC (rev 9642)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/DispatchedContainerAttributesTestCase.java 2008-01-30 01:10:46 UTC (rev 9643)
@@ -32,7 +32,6 @@
import org.jboss.portal.unit.actions.PortletResourceTestAction;
import org.jboss.portal.test.portlet.framework.UTP1;
import org.jboss.portal.test.portlet.framework.UTS1;
-import org.jboss.portal.common.util.Tools;
import org.jboss.unit.driver.DriverResponse;
import org.jboss.unit.driver.response.EndTestResponse;
import static org.jboss.unit.api.Assert.assertEquals;
@@ -42,7 +41,6 @@
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import javax.portlet.PortletException;
-import javax.portlet.PortletRequestDispatcher;
import javax.portlet.PortletRequest;
import javax.portlet.PortletResponse;
import javax.portlet.ActionRequest;
@@ -51,12 +49,15 @@
import javax.portlet.EventResponse;
import javax.portlet.ResourceRequest;
import javax.portlet.ResourceResponse;
+import javax.portlet.PortletContext;
import javax.servlet.Servlet;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
-import java.util.List;
+import java.util.Map;
+import java.util.Collections;
+import java.util.HashMap;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -65,14 +66,73 @@
public abstract class DispatchedContainerAttributesTestCase
{
- private Object requestURI;
- private Object contextPath;
- private Object servletPath;
- private Object pathInfo;
- private Object queryString;
+ /** . */
+ public static final Map<String, String> EXPECTED_INCLUDE_ATTRIBUTES_SET = buildIncludedSetMap();
- public DispatchedContainerAttributesTestCase(PortletTestCase seq)
+ /** . */
+ public static final Map<String, String> EXPECTED_FORWARD_ATTRIBUTES_SET = buildForwardSetMap();
+
+ /** . */
+ public static final Map<String, String> EXPECTED_INCLUDE_ATTRIBUTES_NOT_SET = buildIncludedNotSetMap();
+
+ /** . */
+ public static final Map<String, String> EXPECTED_FORWARD_ATTRIBUTES_NOT_SET = buildForwardNotSetMap();
+
+ private static Map<String, String> buildIncludedSetMap()
{
+ Map<String, String> map = new HashMap<String, String>();
+ map.put("javax.servlet.include.request_uri", "/test-jsr286-tck-dispatcher/universalServletA/pathinfo");
+ map.put("javax.servlet.include.context_path", "/test-jsr286-tck-dispatcher");
+ map.put("javax.servlet.include.servlet_path", "/universalServletA");
+ map.put("javax.servlet.include.path_info", "/pathinfo");
+ map.put("javax.servlet.include.query_string", "foo=bar");
+ return Collections.unmodifiableMap(map);
+ }
+
+ private static Map<String, String> buildForwardSetMap()
+ {
+ Map<String, String> map = new HashMap<String, String>();
+ map.put("javax.servlet.forward.request_uri", "/test-jsr286-tck-dispatcher/universalServletA/pathinfo");
+ map.put("javax.servlet.forward.context_path", "/test-jsr286-tck-dispatcher");
+ map.put("javax.servlet.forward.servlet_path", "/universalServletA");
+ map.put("javax.servlet.forward.path_info", "/pathinfo");
+ map.put("javax.servlet.forward.query_string", "foo=bar");
+ return Collections.unmodifiableMap(map);
+ }
+
+ private static Map<String, String> buildIncludedNotSetMap()
+ {
+ Map<String, String> map = new HashMap<String, String>();
+ map.put("javax.servlet.include.request_uri", null);
+ map.put("javax.servlet.include.context_path", null);
+ map.put("javax.servlet.include.servlet_path", null);
+ map.put("javax.servlet.include.path_info", null);
+ map.put("javax.servlet.include.query_string", null);
+ return Collections.unmodifiableMap(map);
+ }
+
+ private static Map<String, String> buildForwardNotSetMap()
+ {
+ Map<String, String> map = new HashMap<String, String>();
+ map.put("javax.servlet.forward.request_uri", null);
+ map.put("javax.servlet.forward.context_path", null);
+ map.put("javax.servlet.forward.servlet_path", null);
+ map.put("javax.servlet.forward.path_info", null);
+ map.put("javax.servlet.forward.query_string", null);
+ return Collections.unmodifiableMap(map);
+ }
+
+ /** . */
+ private final Map<String, String> expectedAttributes;
+
+ /** . */
+ private final Map<String, Object> collectedAttributes;
+
+ public DispatchedContainerAttributesTestCase(PortletTestCase seq, Map<String, String> expectedAttributes)
+ {
+ this.expectedAttributes = expectedAttributes;
+ this.collectedAttributes = new HashMap<String, Object>();
+
seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
{
protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
@@ -121,10 +181,8 @@
seq.bindAction(2, UTS1.SERVICE_JOIN_POINT, service);
}
- protected abstract void dispatch(PortletRequestDispatcher dispatcher, PortletRequest request, PortletResponse response) throws IOException, PortletException;
+ protected abstract void dispatch(PortletRequest request, PortletResponse response, PortletContext portletContext) throws IOException, PortletException;
- protected abstract String getDispatchType();
-
private void checkAttributes(
Portlet portlet,
PortletRequest request,
@@ -133,65 +191,36 @@
//assert that servlet HAS access to specific request attributes
try
{
- PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getRequestDispatcher("/universalServletA/pathinfo?foo=bar");
+ PortletContext portletContext = ((AbstractUniversalTestPortlet)portlet).getPortletContext();
- //
- dispatch(dispatcher, request, response);
+ dispatch(request, response, portletContext);
//
- assertEquals("/test-jsr286-tck-dispatcher/universalServletA/pathinfo", requestURI);
- assertEquals("/test-jsr286-tck-dispatcher", contextPath);
- assertEquals("/universalServletA", servletPath);
- assertEquals("/pathinfo", pathInfo);
- assertEquals("foo=bar", queryString);
+ assertEquals(expectedAttributes.keySet(), collectedAttributes.keySet());
+ for (Map.Entry<String, String> entry : expectedAttributes.entrySet())
+ {
+ String key = entry.getKey();
+ String expectedValue = entry.getValue();
+ Object collectedValue = collectedAttributes.get(key);
+ assertEquals("Was expecting a value " + expectedValue + " for key " + key + " but had instead " + collectedValue, expectedValue, collectedValue);
+ }
}
finally
{
- requestURI = null;
- contextPath = null;
- servletPath = null;
- pathInfo = null;
- queryString = null;
+ collectedAttributes.clear();
}
-
- // Assert that servlet has NO access to specific request attributes
- // it shouldn't access that attributes because getNamedDispatcher was used
- try
- {
- PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getNamedDispatcher("UniversalServletA");
-
- //
- dispatch(dispatcher, request, response);
-
- //
- assertEquals(null, requestURI);
- assertEquals(null, contextPath);
- assertEquals(null, servletPath);
- assertEquals(null, pathInfo);
- assertEquals(null, queryString);
- }
- finally
- {
- requestURI = null;
- contextPath = null;
- servletPath = null;
- pathInfo = null;
- queryString = null;
- }
}
ServletServiceTestAction service = new ServletServiceTestAction()
{
protected DriverResponse run(Servlet servlet, HttpServletRequest request, HttpServletResponse response, PortletTestContext context) throws ServletException, IOException
{
- String dispatchType = getDispatchType();
+ for (String key : expectedAttributes.keySet())
+ {
+ Object value = request.getAttribute(key);
+ collectedAttributes.put(key, value);
+ }
- requestURI = request.getAttribute("javax.servlet." + dispatchType + ".request_uri");
- contextPath = request.getAttribute("javax.servlet." + dispatchType + ".context_path");
- servletPath = request.getAttribute("javax.servlet." + dispatchType + ".servlet_path");
- pathInfo = request.getAttribute("javax.servlet." + dispatchType + ".path_info");
- queryString = request.getAttribute("javax.servlet." + dispatchType + ".query_string");
-
//
return null;
}
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NamedForwardContainerAttributesTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NamedForwardContainerAttributesTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NamedForwardContainerAttributesTestCase.java 2008-01-30 01:10:46 UTC (rev 9643)
@@ -0,0 +1,54 @@
+/******************************************************************************
+ * 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.dispatcher;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.Assertion;
+import org.jboss.portal.unit.annotations.TestCase;
+
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletContext;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+@TestCase
+public class NamedForwardContainerAttributesTestCase extends DispatchedContainerAttributesTestCase
+{
+
+ public NamedForwardContainerAttributesTestCase(PortletTestCase seq)
+ {
+ super(seq, EXPECTED_FORWARD_ATTRIBUTES_NOT_SET);
+ }
+
+ protected void dispatch(PortletRequest request, PortletResponse response, PortletContext portletContext) throws IOException, PortletException
+ {
+ PortletRequestDispatcher dispatcher = portletContext.getNamedDispatcher("UniversalServletA");
+ dispatcher.forward(request, response);
+ }
+}
\ No newline at end of file
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NamedIncludeContainerAttributesTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NamedIncludeContainerAttributesTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NamedIncludeContainerAttributesTestCase.java 2008-01-30 01:10:46 UTC (rev 9643)
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * 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.dispatcher;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.Assertion;
+import org.jboss.portal.unit.annotations.TestCase;
+
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletContext;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+(a)TestCase({Assertion.JSR168_127})
+public class NamedIncludeContainerAttributesTestCase extends DispatchedContainerAttributesTestCase
+{
+ public NamedIncludeContainerAttributesTestCase(PortletTestCase seq)
+ {
+ super(seq, EXPECTED_INCLUDE_ATTRIBUTES_NOT_SET);
+ }
+
+ protected void dispatch(PortletRequest request, PortletResponse response, PortletContext portletContext) throws IOException, PortletException
+ {
+ PortletRequestDispatcher dispatcher = portletContext.getNamedDispatcher("UniversalServletA");
+ dispatcher.include(request, response);
+ }
+}
\ No newline at end of file
Copied: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RequestForwardContainerAttributesTestCase.java (from rev 9637, modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/ForwardedContainerAttributesTestCase.java)
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RequestForwardContainerAttributesTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RequestForwardContainerAttributesTestCase.java 2008-01-30 01:10:46 UTC (rev 9643)
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * 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.dispatcher;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.Assertion;
+import org.jboss.portal.unit.annotations.TestCase;
+
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletContext;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+@TestCase
+public class RequestForwardContainerAttributesTestCase extends DispatchedContainerAttributesTestCase
+{
+ public RequestForwardContainerAttributesTestCase(PortletTestCase seq)
+ {
+ super(seq, EXPECTED_FORWARD_ATTRIBUTES_SET);
+ }
+
+ protected void dispatch(PortletRequest request, PortletResponse response, PortletContext portletContext) throws IOException, PortletException
+ {
+ PortletRequestDispatcher dispatcher = portletContext.getRequestDispatcher("/universalServletA/pathinfo?foo=bar");
+ dispatcher.forward(request, response);
+ }
+}
\ No newline at end of file
Copied: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RequestIncludeContainerAttributesTestCase.java (from rev 9637, modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludedContainerAttributesTestCase.java)
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RequestIncludeContainerAttributesTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RequestIncludeContainerAttributesTestCase.java 2008-01-30 01:10:46 UTC (rev 9643)
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * 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.dispatcher;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.Assertion;
+import org.jboss.portal.unit.annotations.TestCase;
+
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletContext;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+(a)TestCase({Assertion.JSR168_127})
+public class RequestIncludeContainerAttributesTestCase extends DispatchedContainerAttributesTestCase
+{
+ public RequestIncludeContainerAttributesTestCase(PortletTestCase seq)
+ {
+ super(seq, EXPECTED_INCLUDE_ATTRIBUTES_SET);
+ }
+
+ protected void dispatch(PortletRequest request, PortletResponse response, PortletContext portletContext) throws IOException, PortletException
+ {
+ PortletRequestDispatcher dispatcher = portletContext.getRequestDispatcher("/universalServletA/pathinfo?foo=bar");
+ dispatcher.include(request, response);
+ }
+}
18 years, 3 months
JBoss Portal SVN: r9642 - modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-01-29 19:13:13 -0500 (Tue, 29 Jan 2008)
New Revision: 9642
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/GoogleClippingPortlet.java
Log:
- Doesn't need to be abstract.
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/GoogleClippingPortlet.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/GoogleClippingPortlet.java 2008-01-30 00:12:37 UTC (rev 9641)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/GoogleClippingPortlet.java 2008-01-30 00:13:13 UTC (rev 9642)
@@ -46,7 +46,7 @@
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
*/
-public abstract class GoogleClippingPortlet extends GenericPortlet
+public class GoogleClippingPortlet extends GenericPortlet
{
protected static final String A = "<a";
private static final String A_TARGET_BLANK = "<a target='_blank'";
18 years, 3 months
JBoss Portal SVN: r9641 - in modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple: samples and 1 other directory.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-01-29 19:12:37 -0500 (Tue, 29 Jan 2008)
New Revision: 9641
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/
modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/GoogleClippingPortlet.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/GoogleWeatherClippingPortlet.java
Log:
- Added simple map and weather portlets using Google search results and clipping to be used as samples. Need to package them and make them use public render params.
Added: modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/GoogleClippingPortlet.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/GoogleClippingPortlet.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/GoogleClippingPortlet.java 2008-01-30 00:12:37 UTC (rev 9641)
@@ -0,0 +1,170 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.simple.samples;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletPreferences;
+import javax.portlet.PortletURL;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.net.URL;
+import java.net.URLConnection;
+
+/**
+ * A simple portlet using Google's search services to extract interesting information (weather, map, ...) from first
+ * result.
+ *
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public abstract class GoogleClippingPortlet extends GenericPortlet
+{
+ protected static final String A = "<a";
+ private static final String A_TARGET_BLANK = "<a target='_blank'";
+ private static final String ZIP = "zip";
+ private static final String SAN_FRAN = "94102";
+ private static final String GOOGLE = "http://www.google.com/search?q=";
+
+ @Override
+ protected void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException
+ {
+ String zip = renderRequest.getParameter(ZIP);
+ if (zip == null)
+ {
+ zip = renderRequest.getPreferences().getValue(ZIP, SAN_FRAN);
+ }
+
+ String query = getQueryString(zip);
+
+ URL url = new URL(query);
+
+ URLConnection connection = url.openConnection();
+ connection.setRequestProperty("User-Agent", "Mozilla/5.0");
+
+ InputStream in = new BufferedInputStream(connection.getInputStream());
+ StringBuilder tmp = new StringBuilder(8192);
+ byte[] buffer = new byte[4096];
+ while (true)
+ {
+ int i = in.read(buffer);
+ if (i == 0)
+ {
+ continue;
+ }
+ if (i == -1)
+ {
+ break;
+ }
+ tmp.append(new String(buffer, "UTF-8"), 0, i);
+ }
+
+ String html = tmp.toString();
+ String beg = "<div class=e>";
+ String end = "</table>";
+ int begIndex = html.indexOf(beg);
+ if (begIndex != -1)
+ {
+ // extract table containing specific first result
+ int endIndex = html.indexOf(end, begIndex);
+ html = html.substring(begIndex + beg.length(), endIndex + end.length());
+
+ html = postProcessHTML(html);
+
+ renderResponse.setContentType("text/html");
+ PrintWriter printWriter = renderResponse.getWriter();
+ printWriter.print(html);
+
+ PortletURL edit = renderResponse.createRenderURL();
+ edit.setPortletMode(PortletMode.EDIT);
+ printWriter.print("<p><a href='" + edit + "'>Change location</a></p>");
+ }
+ }
+
+ @Override
+ protected void doEdit(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException
+ {
+ renderResponse.setContentType("text/html");
+ renderResponse.getWriter().print(
+ "<div align='center'>\n" +
+ " <br/>\n" +
+ " <font class='portlet-font'>Change Location:</font>\n" +
+ "\n" +
+ " <form method='post' action='" + renderResponse.createActionURL() + "'\n" +
+ " <font class='portlet-font'>Zip Code:</font><br/>\n" +
+ " <input class='portlet-form-input-field' type='text' value='' size='12' name='zip'>\n" +
+ " <br/>\n" +
+ " <input class='portlet-form-input-field' type='submit' name='submit' value='submit'>\n" +
+ " </form>\n" +
+ "</div>");
+ }
+
+ @Override
+ public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws PortletException, IOException
+ {
+ String zip = actionRequest.getParameter(ZIP);
+
+ if (null != zip)
+ {
+ PortletPreferences prefs = actionRequest.getPreferences();
+ prefs.setValue(ZIP, zip);
+ prefs.store();
+ }
+
+ // set zip as render parameter
+ actionResponse.setRenderParameter(ZIP, zip);
+
+ // request view
+ actionResponse.setPortletMode(PortletMode.VIEW);
+ }
+
+ protected String postProcessHTML(String html)
+ {
+ String tmp = new String(html);
+
+ // links should open in new windows
+ tmp = tmp.replaceAll(A, A_TARGET_BLANK);
+
+ // src attributes should be absolute
+ tmp = tmp.replaceAll("src=/", "src=http://google.com/");
+ tmp = tmp.replaceAll("src=\"/", "src=\"http://google.com/");
+
+ // forms should open in new windows and have an absolute action URL
+ tmp = tmp.replaceAll("action=\"/", "target='_blank' action=\"http://google.com/");
+
+ return tmp;
+ }
+
+ protected String getQueryString(String zip)
+ {
+ return GOOGLE + zip;
+ }
+}
Property changes on: modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/GoogleClippingPortlet.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/GoogleWeatherClippingPortlet.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/GoogleWeatherClippingPortlet.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/GoogleWeatherClippingPortlet.java 2008-01-30 00:12:37 UTC (rev 9641)
@@ -0,0 +1,57 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.simple.samples;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class GoogleWeatherClippingPortlet extends GoogleClippingPortlet
+{
+ private final static String WEATHER_URL = "http://www.google.com/search?q=weather+";
+ private static final String A_END = "</a";
+
+ protected String getQueryString(String zip)
+ {
+ return WEATHER_URL + zip;
+ }
+
+ protected String postProcessHTML(String html)
+ {
+ int begIndex;
+ int endIndex;
+
+ String tmp = new String(html);
+
+ // remove add to iGoogle link
+ begIndex = html.indexOf(A);
+ if (begIndex != -1)
+ {
+ endIndex = html.indexOf(A_END, begIndex);
+ tmp = tmp.substring(0, begIndex) + html.substring(endIndex);
+ }
+
+ return tmp;
+ }
+}
Property changes on: modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/GoogleWeatherClippingPortlet.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
18 years, 3 months