JBoss Portal SVN: r9630 - modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-01-29 09:12:04 -0500 (Tue, 29 Jan 2008)
New Revision: 9630
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/Assertion.java
Log:
placeholders for assertions
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/Assertion.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/Assertion.java 2008-01-29 13:27:37 UTC (rev 9629)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/Assertion.java 2008-01-29 14:12:04 UTC (rev 9630)
@@ -429,6 +429,36 @@
// ******************************************************************************************************************
JSR168_1000(new TCK(1000), "todo ???"),
+ // PLT.2 Overview
+ JSR286_1(new TCK(1), "", ""),
+
+
+ // PLT.5 The Portlet Interface and Additional Life
+ JSR286_2(new TCK(2), "", ""),
+ JSR286_3(new TCK(3), "", ""),
+ JSR286_4(new TCK(4), "", ""),
+ JSR286_5(new TCK(5), "", ""),
+ JSR286_6(new TCK(6), "", ""),
+ JSR286_7(new TCK(7), "", ""),
+ JSR286_8(new TCK(8), "", ""),
+ JSR286_9(new TCK(9), "", ""),
+ JSR286_10(new TCK(10), "", ""),
+ JSR286_11(new TCK(11), "", ""),
+ JSR286_12(new TCK(12), "", ""),
+ JSR286_13(new TCK(13), "", ""),
+ JSR286_14(new TCK(14), "", ""),
+ JSR286_15(new TCK(15), "", ""),
+ JSR286_16(new TCK(16), "", ""),
+ JSR286_17(new TCK(17), "", ""),
+ JSR286_18(new TCK(18), "", ""),
+ JSR286_19(new TCK(19), "", ""),
+ JSR286_20(new TCK(20), "", ""),
+ JSR286_21(new TCK(21), "", ""),
+ JSR286_22(new TCK(22), "", ""),
+ JSR286_23(new TCK(23), "", ""),
+ JSR286_24(new TCK(24), "", ""),
+ JSR286_25(new TCK(25), "", ""),
+
// PLT.6 Portlet Config
JSR286_26(new TCK(26), "PLT.6.2", "If the root resource bundle does not contain the resources for these values and " +
"the values are defined inline, the portlet container must add the inline values as resources of the root " +
@@ -460,6 +490,36 @@
"supported locales found in the portlet definition in the deployment descriptor with the supported-locale " +
"element or an empty enumeration if no supported locales are defined for the current portlet definition."),
+ // PLT,7 Portlet URLs
+
+ JSR286_35(new TCK(35), "", ""),
+
+ //..
+
+ JSR286_51(new TCK(51), "", ""),
+
+ // PLT.8 Portlet Modes
+
+ JSR286_52(new TCK(52), "", ""),
+
+ //..
+
+ JSR286_55(new TCK(55), "", ""),
+
+ // PLT.9 Window States
+
+ JSR286_56(new TCK(56), "", ""),
+ JSR286_57(new TCK(57), "", ""),
+ JSR286_58(new TCK(58), "", ""),
+
+ // PLT.10 Portlet Context
+
+ JSR286_59(new TCK(59), "", ""),
+
+ //..
+
+ JSR286_66(new TCK(66), "", ""),
+
// PLT.11 Portlet Requests
JSR286_67(new TCK(67), JSR168_48, "PLT.11.1.1", "If a portlet receives a request from a client request targeted to the " +
@@ -546,12 +606,33 @@
// PLT.12 Portlet Responses
+ JSR286_100(new TCK(100), "", ""),
+
+ //..
+
JSR286_103(new TCK(103), "Using the setRenderParameter and setRenderParameters methods portlets may set " +
"render parameters. A call to any of the setRenderParameter methods must replace any " +
"parameter with the same name previously set."),
+ //..
+ JSR286_121(new TCK(121), "", ""),
+
+ // PLT.13 Resource Serving
+
+ JSR286_122(new TCK(122), "", ""),
+
+ //..
+
+ JSR286_132(new TCK(132), "", ""),
+
+
+ // PLT.14 Serving Fragments through Portlets
+
+ // NOTHING
+
// PLT.15 Coordination between portlets
+
JSR286_133(new TCK(133), "PLT.15.2.2", "The event must always have a name and may optionally have a value."),
JSR286_134(new TCK(134), "PLT.15.2.2", "If the event has a value it must be based on the type defined in the " +
"deployment descriptor." ),
@@ -581,8 +662,199 @@
" on the EventResponse must be ignored."),
JSR286_147(new TCK(147), "PLT.15.2.6", "If a permanent unavailability is indicated by the UnavailableException," +
" the portlet container must remove the portlet from service immediately, call the portlet’s destroy method," +
- " and release the portlet object.")
+ " and release the portlet object."),
+ // PLT.17 Portlet Preferences
+
+ JSR286_148(new TCK(148), "", ""),
+
+ //..
+
+ JSR286_161(new TCK(161), "", ""),
+
+
+ // PLT.18 Sessions
+
+ JSR286_162(new TCK(162), "", ""),
+
+ //..
+
+ JSR286_176(new TCK(176), "", ""),
+
+
+
+ // PLT.19 Dispatching Requests to Servlets and JSPs
+
+ JSR286_177(new TCK(177), "", ""),
+ JSR286_178(new TCK(178), "", ""),
+ JSR286_179(new TCK(179), "", ""),
+ JSR286_180(new TCK(180), "", ""),
+ JSR286_181(new TCK(181), "", ""),
+ JSR286_182(new TCK(182), "", ""),
+ JSR286_183(new TCK(183), "", ""),
+ JSR286_184(new TCK(184), "", ""),
+ JSR286_185(new TCK(185), "", ""),
+ JSR286_186(new TCK(186), "", ""),
+ JSR286_187(new TCK(187), "", ""),
+ JSR286_188(new TCK(188), "", ""),
+ JSR286_189(new TCK(189), "", ""),
+ JSR286_190(new TCK(190), "", ""),
+ JSR286_191(new TCK(191), "", ""),
+ JSR286_192(new TCK(192), "", ""),
+ JSR286_193(new TCK(193), "", ""),
+ JSR286_194(new TCK(194), "", ""),
+ JSR286_195(new TCK(195), "", ""),
+ JSR286_196(new TCK(196), "", ""),
+ JSR286_197(new TCK(197), "", ""),
+ JSR286_198(new TCK(198), "", ""),
+ JSR286_199(new TCK(199), "", ""),
+ JSR286_200(new TCK(200), "", ""),
+ JSR286_201(new TCK(201), "", ""),
+ JSR286_202(new TCK(202), "", ""),
+ JSR286_203(new TCK(203), "", ""),
+ JSR286_204(new TCK(204), "", ""),
+ JSR286_205(new TCK(205), "", ""),
+ JSR286_206(new TCK(206), "", ""),
+ JSR286_207(new TCK(207), "", ""),
+ JSR286_208(new TCK(208), "", ""),
+ JSR286_209(new TCK(209), "", ""),
+ JSR286_210(new TCK(210), "", ""),
+ JSR286_211(new TCK(211), "", ""),
+ JSR286_212(new TCK(212), "", ""),
+ JSR286_213(new TCK(213), "", ""),
+ JSR286_214(new TCK(214), "", ""),
+ JSR286_215(new TCK(215), "", ""),
+ JSR286_216(new TCK(216), "", ""),
+ JSR286_217(new TCK(217), "", ""),
+ JSR286_218(new TCK(218), "", ""),
+ JSR286_219(new TCK(219), "", ""),
+ JSR286_220(new TCK(220), "", ""),
+ JSR286_221(new TCK(221), "", ""),
+ JSR286_222(new TCK(222), "", ""),
+ JSR286_223(new TCK(223), "", ""),
+ JSR286_224(new TCK(224), "", ""),
+ JSR286_225(new TCK(225), "", ""),
+ JSR286_226(new TCK(226), "", ""),
+ JSR286_227(new TCK(227), "", ""),
+ JSR286_228(new TCK(228), "", ""),
+ JSR286_229(new TCK(229), "", ""),
+ JSR286_230(new TCK(230), "", ""),
+ JSR286_231(new TCK(231), "", ""),
+ JSR286_232(new TCK(232), "", ""),
+ JSR286_233(new TCK(233), "", ""),
+ JSR286_234(new TCK(234), "", ""),
+ JSR286_235(new TCK(235), "", ""),
+ JSR286_236(new TCK(236), "", ""),
+ JSR286_237(new TCK(237), "", ""),
+ JSR286_238(new TCK(238), "", ""),
+ JSR286_239(new TCK(239), "", ""),
+ JSR286_240(new TCK(240), "", ""),
+ JSR286_241(new TCK(241), "", ""),
+ JSR286_242(new TCK(242), "", ""),
+ JSR286_243(new TCK(243), "", ""),
+ JSR286_244(new TCK(244), "", ""),
+ JSR286_245(new TCK(245), "", ""),
+ JSR286_246(new TCK(246), "", ""),
+ JSR286_247(new TCK(247), "", ""),
+ JSR286_248(new TCK(248), "", ""),
+ JSR286_249(new TCK(249), "", ""),
+ JSR286_250(new TCK(250), "", ""),
+ JSR286_251(new TCK(251), "", ""),
+ JSR286_252(new TCK(252), "", ""),
+ JSR286_253(new TCK(253), "", ""),
+ JSR286_254(new TCK(254), "", ""),
+ JSR286_255(new TCK(255), "", ""),
+ JSR286_256(new TCK(256), "", ""),
+ JSR286_257(new TCK(257), "", ""),
+ JSR286_258(new TCK(258), "", ""),
+ JSR286_259(new TCK(259), "", ""),
+ JSR286_260(new TCK(260), "", ""),
+ JSR286_261(new TCK(261), "", ""),
+ JSR286_262(new TCK(262), "", ""),
+ JSR286_263(new TCK(263), "", ""),
+ JSR286_264(new TCK(264), "", ""),
+ JSR286_265(new TCK(265), "", ""),
+ JSR286_266(new TCK(266), "", ""),
+ JSR286_267(new TCK(267), "", ""),
+ JSR286_268(new TCK(268), "", ""),
+ JSR286_269(new TCK(269), "", ""),
+ JSR286_270(new TCK(270), "", ""),
+ JSR286_271(new TCK(271), "", ""),
+ JSR286_272(new TCK(272), "", ""),
+ JSR286_273(new TCK(273), "", ""),
+ JSR286_274(new TCK(274), "", ""),
+ JSR286_275(new TCK(275), "", ""),
+ JSR286_276(new TCK(276), "", ""),
+ JSR286_277(new TCK(277), "", ""),
+ JSR286_278(new TCK(278), "", ""),
+ JSR286_279(new TCK(279), "", ""),
+ JSR286_280(new TCK(280), "", ""),
+ JSR286_281(new TCK(281), "", ""),
+ JSR286_282(new TCK(282), "", ""),
+ JSR286_283(new TCK(283), "", ""),
+ JSR286_284(new TCK(284), "", ""),
+ JSR286_285(new TCK(285), "", ""),
+ JSR286_286(new TCK(286), "", ""),
+ JSR286_287(new TCK(287), "", ""),
+ JSR286_288(new TCK(288), "", ""),
+ JSR286_289(new TCK(289), "", ""),
+ JSR286_290(new TCK(290), "", ""),
+ JSR286_291(new TCK(291), "", ""),
+
+
+ // PLT.20 Portlet Filter
+
+ JSR286_292(new TCK(292), "", ""),
+
+ //..
+
+ JSR286_301(new TCK(301), "", ""),
+
+
+ // PLT.21 User Information
+
+ JSR286_302(new TCK(302), "", ""),
+
+
+ // PLT.22 Caching
+
+
+
+ // PLT.23 Portlet Applications
+
+ JSR286_303(new TCK(303), "", ""),
+
+ //..
+
+ JSR286_306(new TCK(306), "", ""),
+
+
+ // PLT.24 Security
+
+
+ JSR286_307(new TCK(307), "", ""),
+
+ //..
+
+ JSR286_311(new TCK(311), "", ""),
+
+
+
+ // PLT.25 Packaging and Deployment Descriptor
+
+ // PLT.26 Portlet Tag Library
+
+
+ JSR286_312(new TCK(312), "", ""),
+
+ //..
+
+ JSR286_350(new TCK(350), "", ""),
+
+
+
+
+
;
/**
18 years, 3 months
JBoss Portal SVN: r9629 - in modules/portlet/trunk/portlet/src/test/java/org/jboss/portal: unit/actions and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-01-29 08:27:37 -0500 (Tue, 29 Jan 2008)
New Revision: 9629
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/ErrorHandlingTestCase.java
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/actions/ServletServiceTestAction.java
Log:
- migrate error handling test case for request dispatching to 286
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/ErrorHandlingTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/ErrorHandlingTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/ErrorHandlingTestCase.java 2008-01-29 13:27:37 UTC (rev 9629)
@@ -0,0 +1,270 @@
+/******************************************************************************
+ * 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.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.unit.actions.PortletResourceTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.framework.UTS1;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.Assertion;
+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.fail;
+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.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+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;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TestCase({Assertion.JSR168_142, Assertion.JSR168_143})
+public class ErrorHandlingTestCase
+{
+
+ public ErrorHandlingTestCase(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
+ {
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+
+ //
+ seq.bindAction(1, UTP1.ACTION_JOIN_POINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ dispatchAndCatchRuntimeException(portlet, 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
+ {
+ dispatchAndCatchRuntimeException(portlet, request, response);
+ }
+ });
+ seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ dispatchAndCatchRuntimeException(portlet, request, response);
+ return new InvokeGetResponse(response.createResourceURL().toString());
+ }
+ });
+ seq.bindAction(1, UTS1.SERVICE_JOIN_POINT, throwRuntimeException);
+ seq.bindAction(2, UTP1.RESOURCE_JOIN_POINT, new PortletResourceTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, ResourceRequest request, ResourceResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ dispatchAndCatchRuntimeException(portlet, request, response);
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+ seq.bindAction(2, UTS1.SERVICE_JOIN_POINT, throwRuntimeException);
+
+ //
+ seq.bindAction(3, UTP1.ACTION_JOIN_POINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ dispatchAndCatchIOException(portlet, request, response);
+ response.setEvent("Event", null);
+ }
+ });
+ seq.bindAction(3, UTP1.EVENT_JOIN_POINT, new PortletEventTestAction()
+ {
+ protected void run(Portlet portlet, EventRequest request, EventResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ dispatchAndCatchIOException(portlet, request, response);
+ }
+ });
+ seq.bindAction(3, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ dispatchAndCatchIOException(portlet, request, response);
+ return new InvokeGetResponse(response.createResourceURL().toString());
+ }
+ });
+ seq.bindAction(3, UTS1.SERVICE_JOIN_POINT, throwIOException);
+ seq.bindAction(4, UTP1.RESOURCE_JOIN_POINT, new PortletResourceTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, ResourceRequest request, ResourceResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ dispatchAndCatchIOException(portlet, request, response);
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+ seq.bindAction(4, UTS1.SERVICE_JOIN_POINT, throwIOException);
+
+ //
+ seq.bindAction(5, UTP1.ACTION_JOIN_POINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ dispatchAndCatchServletException(portlet, request, response);
+ response.setEvent("Event", null);
+ }
+ });
+ seq.bindAction(5, UTP1.EVENT_JOIN_POINT, new PortletEventTestAction()
+ {
+ protected void run(Portlet portlet, EventRequest request, EventResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ dispatchAndCatchServletException(portlet, request, response);
+ }
+ });
+ seq.bindAction(5, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException
+ {
+ dispatchAndCatchServletException(portlet, request, response);
+ return new InvokeGetResponse(response.createResourceURL().toString());
+ }
+ });
+ seq.bindAction(5, UTS1.SERVICE_JOIN_POINT, throwServletException);
+ seq.bindAction(6, UTP1.RESOURCE_JOIN_POINT, new PortletResourceTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, ResourceRequest request, ResourceResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ dispatchAndCatchServletException(portlet, request, response);
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+ seq.bindAction(6, UTS1.SERVICE_JOIN_POINT, throwServletException);
+
+ //
+ seq.bindAction(7, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException
+ {
+ return new EndTestResponse();
+ }
+ });
+ }
+
+ private void dispatchAndCatchServletException(Portlet portlet, PortletRequest request, PortletResponse response) throws IOException
+ {
+ PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getNamedDispatcher("UniversalServletA");
+ assertNotNull(dispatcher);
+ try
+ {
+ dispatcher.include(request, response);
+ fail();
+ }
+ catch (PortletException e)
+ {
+ //expected
+ if (!(e.getCause() instanceof ServletException))
+ {
+ fail();
+ }
+ }
+ }
+
+ private void dispatchAndCatchRuntimeException(Portlet portlet, PortletRequest request, PortletResponse response) throws PortletException, IOException
+ {
+ PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getNamedDispatcher("UniversalServletA");
+ assertNotNull(dispatcher);
+ try
+ {
+ dispatcher.include(request, response);
+ fail();
+ }
+ catch (RuntimeException e)
+ {
+ //expected
+ }
+ }
+
+ private void dispatchAndCatchIOException(Portlet portlet, PortletRequest request, PortletResponse response) throws PortletException, IOException
+ {
+ PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getNamedDispatcher("UniversalServletA");
+ assertNotNull(dispatcher);
+ try
+ {
+ dispatcher.include(request, response);
+ fail();
+ }
+ catch (IOException e)
+ {
+ //expected
+ }
+ }
+
+ private ServletServiceTestAction throwRuntimeException = new ServletServiceTestAction()
+ {
+ public DriverResponse execute(Servlet servlet, HttpServletRequest request, HttpServletResponse response, PortletTestContext context) throws ServletException, IOException
+ {
+ //SPEC:142 - RuntimeException
+ throw new RuntimeException();
+ }
+ };
+
+ private static final ServletServiceTestAction throwIOException = new ServletServiceTestAction()
+ {
+ public DriverResponse execute(Servlet servlet, HttpServletRequest request, HttpServletResponse response, PortletTestContext context) throws ServletException, IOException
+ {
+ //SPEC:142 - checked exception of type IOException
+ throw new IOException();
+ }
+ };
+
+ private static final ServletServiceTestAction throwServletException = new ServletServiceTestAction()
+ {
+ public DriverResponse execute(Servlet servlet, HttpServletRequest request, HttpServletResponse response, PortletTestContext context) throws ServletException, IOException
+ {
+ //SPEC:143 - ServletException
+ throw new ServletException();
+ }
+ };
+}
\ No newline at end of file
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/actions/ServletServiceTestAction.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/actions/ServletServiceTestAction.java 2008-01-29 12:47:14 UTC (rev 9628)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/actions/ServletServiceTestAction.java 2008-01-29 13:27:37 UTC (rev 9629)
@@ -24,6 +24,7 @@
import org.jboss.portal.unit.TestAction;
import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.common.NotYetImplemented;
import org.jboss.unit.driver.DriverResponse;
import org.jboss.unit.driver.response.FailureResponse;
import org.jboss.unit.Failure;
@@ -40,7 +41,10 @@
*/
public abstract class ServletServiceTestAction extends TestAction
{
- protected abstract DriverResponse run(Servlet servlet, HttpServletRequest request, HttpServletResponse response, PortletTestContext context) throws ServletException, IOException;
+ protected DriverResponse run(Servlet servlet, HttpServletRequest request, HttpServletResponse response, PortletTestContext context) throws ServletException, IOException
+ {
+ throw new NotYetImplemented();
+ }
public DriverResponse execute(Servlet servlet, HttpServletRequest request, HttpServletResponse response, PortletTestContext context) throws ServletException, IOException
{
18 years, 3 months
JBoss Portal SVN: r9628 - in modules/portlet/trunk: portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api and 9 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-01-29 07:47:14 -0500 (Tue, 29 Jan 2008)
New Revision: 9628
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/ObtainingDispatcherTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/actions/PortletTestAction.java
modules/portlet/trunk/test/src/test/resources/jsr286/tck/dispatcher-war/
modules/portlet/trunk/test/src/test/resources/jsr286/tck/dispatcher-war/WEB-INF/
modules/portlet/trunk/test/src/test/resources/jsr286/tck/dispatcher-war/WEB-INF/portlet.xml
modules/portlet/trunk/test/src/test/resources/jsr286/tck/dispatcher-war/WEB-INF/web.xml
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletResponse.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestDispatcherImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletSessionImpl.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/actions/PortletRenderTestAction.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/base/AbstractUniversalTestPortlet.java
modules/portlet/trunk/test/src/test/build.xml
modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml
Log:
- start to migrate existing 168 dispatcher tck tests to 286
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java 2008-01-28 23:38:10 UTC (rev 9627)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java 2008-01-29 12:47:14 UTC (rev 9628)
@@ -26,6 +26,11 @@
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.portlet.impl.jsr168.api.RenderRequestImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.PortletRequestImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.ActionRequestImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.EventRequestImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.ResourceRequestImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.ClientDataRequestImpl;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletInputStream;
@@ -33,51 +38,72 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServletRequestWrapper;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
+import javax.portlet.PortletSession;
import java.security.Principal;
import java.util.Enumeration;
import java.util.Locale;
import java.util.Map;
+import java.io.UnsupportedEncodingException;
+import java.io.IOException;
+import java.io.BufferedReader;
+import java.io.InputStream;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 6903 $
*/
-public class DispatchedHttpServletRequest extends HttpServletRequestWrapper
+public abstract class DispatchedHttpServletRequest extends HttpServletRequestWrapper
{
/** . */
- private static final String REQUEST_URI = "javax.servlet.include.request_uri";
+ private static final int REQUEST_URI = 0;
/** . */
- private static final String CONTEXT_PATH = "javax.servlet.include.context_path";
+ private static final int SERVLET_PATH = 1;
/** . */
- private static final String SERVLET_PATH = "javax.servlet.include.servlet_path";
+ private static final int PATH_INFO = 2;
/** . */
- private static final String PATH_INFO = "javax.servlet.include.path_info";
+ private static final int QUERY_STRING = 3;
/** . */
- private static final String QUERY_STRING = "javax.servlet.include.query_string";
+ private static final String[] INCLUDE_KEYS = {
+ "javax.servlet.include.request_uri",
+ "javax.servlet.include.servlet_path",
+ "javax.servlet.include.path_info",
+ "javax.servlet.include.query_string"
+ };
/** . */
+ private static final String[] FORWARD_KEYS = {
+ "javax.servlet.forward.request_uri",
+ "javax.servlet.forward.servlet_path",
+ "javax.servlet.forward.path_info",
+ "javax.servlet.forward.query_string"
+ };
+
+ /** . */
final DispatchType dispatchType;
/** . */
- private RenderRequestImpl rreq;
+ private final PortletRequestImpl preq;
/** . */
- private HttpServletRequest dreq;
+ private final HttpServletRequest dreq;
/** . */
private final Map<String, String[]> parameters;
+ /** . */
+ private final String[] keys;
+
+ /** . */
+ private final int sessionScope = PortletSession.APPLICATION_SCOPE;
+
public DispatchedHttpServletRequest(
DispatchType dispatchType,
- RenderRequestImpl rreq,
+ PortletRequestImpl preq,
HttpServletRequest dreq,
String path)
{
@@ -85,8 +111,9 @@
//
this.dispatchType = dispatchType;
- this.rreq = rreq;
+ this.preq = preq;
this.dreq = dreq;
+ this.keys = dispatchType == DispatchType.INCLUDE ? INCLUDE_KEYS : FORWARD_KEYS;
//
if (path != null)
@@ -123,209 +150,181 @@
//
if (queryString.length() > 0)
{
- this.parameters = ParameterMap.clone(rreq.getParameterMap());
+ this.parameters = ParameterMap.clone(preq.getParameterMap());
this.parameters.putAll(QueryStringParser.getInstance().parseQueryString(queryString));
}
else
{
- this.parameters = rreq.getParameterMap();
+ this.parameters = preq.getParameterMap();
}
}
else
{
- this.parameters = rreq.getParameterMap();
+ this.parameters = preq.getParameterMap();
}
}
// Must return null
- public String getProtocol()
+ public final String getRemoteAddr()
{
return null;
}
- public String getRemoteAddr()
+ public final String getRemoteHost()
{
return null;
}
- public String getRemoteHost()
+ public final String getRealPath(String s)
{
return null;
}
- public String getRealPath(String s)
+ public final String getLocalAddr()
{
return null;
}
- public StringBuffer getRequestURL()
+ public final String getLocalName()
{
return null;
}
+ public final StringBuffer getRequestURL()
+ {
+ return null;
+ }
+
+ // Must return 0
+
+ public final int getRemotePort()
+ {
+ return 0;
+ }
+
+ public final int getLocalPort()
+ {
+ return 0;
+ }
+
// Must return the path and query string information used to obtain the PortletRequestDispatcher object
- public String getPathInfo()
+ public final String getPathInfo()
{
- return (String)getAttribute(PATH_INFO);
+ return (String)getAttribute(keys[PATH_INFO]);
}
- public String getQueryString()
+ public final String getPathTranslated()
{
- return (String)getAttribute(QUERY_STRING);
+ return "PathTranslated"; // todo
}
- public String getServletPath()
+ public final String getQueryString()
{
- return (String)getAttribute(SERVLET_PATH);
+ return (String)getAttribute(keys[QUERY_STRING]);
}
- public String getRequestURI()
+ public final String getRequestURI()
{
- return (String)getAttribute(REQUEST_URI);
+ return (String)getAttribute(keys[REQUEST_URI]);
}
- public String getPathTranslated()
+ public final String getServletPath()
{
- return "PathTranslated"; // todo
+ return (String)getAttribute(keys[SERVLET_PATH]);
}
// Must be equivalent to the method of the PortletRequest
- public String getScheme()
+ public final String getScheme()
{
- return rreq.getScheme();
+ return preq.getScheme();
}
- public String getServerName()
+ public final String getServerName()
{
- return rreq.getServerName();
+ return preq.getServerName();
}
- public int getServerPort()
+ public final int getServerPort()
{
- return rreq.getServerPort();
+ return preq.getServerPort();
}
- public Object getAttribute(String s)
+ public final Object getAttribute(String s)
{
- // First try the special values
-// Object value = attrs.get(s);
-// if (value != null)
-// {
-// return value;
-// }
-
- // Otherwise try the render request modified attributes
- return rreq.getAttributes().getAttribute(s, (HttpServletRequest)getRequest());
+ return preq.getAttributes().getAttribute(s, (HttpServletRequest)getRequest());
}
- public Enumeration getAttributeNames()
+ public final Enumeration getAttributeNames()
{
- return Tools.toEnumeration(rreq.getAttributes().getAttributeNames((HttpServletRequest)getRequest()));
-// return new Enumeration()
-// {
-// // The next element
-// Object next;
-//
-// {
-// next();
-// }
-//
-// public boolean hasMoreElements()
-// {
-// return next != null;
-// }
-//
-// public Object nextElement()
-// {
-// Object next = this.next;
-// next();
-// return next;
-// }
-//
-// private void next()
-// {
-// next = null;
-// while (true)
-// {
-// if (i.hasNext())
-// {
-// Object next = i.next();
-// if (attrs != null && !attrs.containsKey(next))
-// {
-// this.next = next;
-// break;
-// }
-// }
-// else
-// {
-// break;
-// }
-// }
-// }
-// };
+ return Tools.toEnumeration(preq.getAttributes().getAttributeNames((HttpServletRequest)getRequest()));
}
- public void setAttribute(String s, Object o)
+ public final void setAttribute(String s, Object o)
{
- rreq.getAttributes().setAttribute(s, o);
+ preq.getAttributes().setAttribute(s, o);
}
- public void removeAttribute(String s)
+ public final void removeAttribute(String s)
{
- rreq.getAttributes().removeAttribute(s);
+ preq.getAttributes().removeAttribute(s);
}
- public Locale getLocale()
+ public final Locale getLocale()
{
- return rreq.getLocale();
+ return preq.getLocale();
}
- public Enumeration getLocales()
+ public final Enumeration getLocales()
{
- return rreq.getLocales();
+ return preq.getLocales();
}
public boolean isSecure()
{
- return rreq.isSecure();
+ return preq.isSecure();
}
- public String getAuthType()
+ public final String getAuthType()
{
- return rreq.getAuthType();
+ return preq.getAuthType();
}
- public String getContextPath()
+ public final String getContextPath()
{
- return (String)getAttribute(CONTEXT_PATH);
+ return preq.getContextPath();
}
- public String getRemoteUser()
+ public final String getRemoteUser()
{
- return rreq.getRemoteUser();
+ return preq.getRemoteUser();
}
- public Principal getUserPrincipal()
+ public final Principal getUserPrincipal()
{
- return rreq.getUserPrincipal();
+ return preq.getUserPrincipal();
}
- public String getRequestedSessionId()
+ public final String getRequestedSessionId()
{
- return rreq.getRequestedSessionId();
+ return preq.getRequestedSessionId();
}
- public boolean isRequestedSessionIdValid()
+ public final boolean isRequestedSessionIdValid()
{
- return rreq.isRequestedSessionIdValid();
+ return preq.isRequestedSessionIdValid();
}
+ public final Cookie[] getCookies()
+ {
+ return preq.getCookies();
+ }
+
// Must be equivalent to the method of the PortletRequest with the provision defined in PLT.16.1.1
- public String getParameter(String name)
+ public final String getParameter(String name)
{
if (name == null)
{
@@ -343,12 +342,12 @@
return null;
}
- public Enumeration getParameterNames()
+ public final Enumeration getParameterNames()
{
return Tools.toEnumeration(parameters.keySet().iterator());
}
- public String[] getParameterValues(String name)
+ public final String[] getParameterValues(String name)
{
if (name == null)
{
@@ -366,136 +365,258 @@
return null;
}
- public Map getParameterMap()
+ public final Map getParameterMap()
{
return parameters;
}
- // Do not operate and return null or zero
+ // Defined by life cycle phase
- public String getCharacterEncoding()
+ public abstract String getCharacterEncoding();
+
+ public abstract void setCharacterEncoding(String s) throws UnsupportedEncodingException;
+
+ public abstract String getContentType();
+
+ public abstract ServletInputStream getInputStream() throws IOException;
+
+ public abstract BufferedReader getReader() throws IOException;
+
+ public abstract int getContentLength();
+
+ public abstract String getMethod();
+
+ // Must be based on properties provided by the getProperties method of the PortletRequest interface
+
+ public final String getHeader(String s)
{
- return null;
+ return preq.getProperty(s);
}
- public void setCharacterEncoding(String s) throws UnsupportedEncodingException
+ public final Enumeration getHeaders(String s)
{
+ return preq.getProperties(s);
}
- public int getContentLength()
+ public final Enumeration getHeaderNames()
{
- return 0;
+ return preq.getPropertyNames();
}
- public String getContentType()
+ public final long getDateHeader(String s)
{
- return null;
+ return 0; // WTF ????
}
- public ServletInputStream getInputStream() throws IOException
+ public final int getIntHeader(String s)
{
- return null;
+ return 0; // WTF ????
}
- public BufferedReader getReader() throws IOException
+ // Must provide the functionnalities provided by the servlet specification 2.3
+
+ public final RequestDispatcher getRequestDispatcher(String s)
{
- return null;
+ return dreq.getRequestDispatcher(s);
}
- // Must be based on properties provided by the getProperties method of the PortletRequest interface
-
- public String getHeader(String s)
+ public final boolean isUserInRole(String s)
{
- return rreq.getProperty(s);
+ return preq.isUserInRole(s);
}
- public Enumeration getHeaders(String s)
+ public final HttpSession getSession(boolean b)
{
- return rreq.getProperties(s);
+ return preq.getPortletSession(b).getHttpSession(PortletSession.APPLICATION_SCOPE);
}
- public Enumeration getHeaderNames()
+ public final HttpSession getSession()
{
- return rreq.getPropertyNames();
+ return preq.getPortletSession().getHttpSession(PortletSession.APPLICATION_SCOPE);
}
- public Cookie[] getCookies()
+ public final boolean isRequestedSessionIdFromCookie()
{
- return new Cookie[0];
+ return dreq.isRequestedSessionIdFromCookie();
}
- public long getDateHeader(String s)
+ public final boolean isRequestedSessionIdFromURL()
{
- return 0;
+ return dreq.isRequestedSessionIdFromURL();
}
- public int getIntHeader(String s)
+ public final boolean isRequestedSessionIdFromUrl()
{
- return 0;
+ return isRequestedSessionIdFromURL();
}
- // Must provide the functionnalities provided by the servlet specification 2.3
+ // The getProtocol method of the HttpServletRequest must always return �HTTP/1.1�
- public String getMethod()
+ public final String getProtocol()
{
- // The getMethod method of the HttpServletRequest must always return "GET"
- return "GET";
+ return "HTTP/1.1";
}
- public RequestDispatcher getRequestDispatcher(String s)
+ public static abstract class ClientData extends DispatchedHttpServletRequest
{
- return dreq.getRequestDispatcher(s);
+
+ /** . */
+ private PortletServletInputStream in;
+
+ /** . */
+ private final ClientDataRequestImpl cdreq;
+
+ public ClientData(DispatchType dispatchType, ClientDataRequestImpl cdreq, HttpServletRequest dreq, String path)
+ {
+ super(dispatchType, cdreq, dreq, path);
+
+ //
+ this.cdreq = cdreq;
+ }
+
+ public final String getCharacterEncoding()
+ {
+ return cdreq.getCharacterEncoding();
+ }
+
+ public final void setCharacterEncoding(String s) throws UnsupportedEncodingException
+ {
+ cdreq.setCharacterEncoding(s);
+ }
+
+ public final String getContentType()
+ {
+ return cdreq.getContentType();
+ }
+
+ public final ServletInputStream getInputStream() throws IOException
+ {
+ if (in == null)
+ {
+ in = new PortletServletInputStream(cdreq);
+ }
+ return in;
+ }
+
+ public final BufferedReader getReader() throws IOException
+ {
+ return cdreq.getReader();
+ }
+
+ public final int getContentLength()
+ {
+ return cdreq.getContentLength();
+ }
+
+ public final String getMethod()
+ {
+ return cdreq.getMethod();
+ }
+
+ private static final class PortletServletInputStream extends ServletInputStream
+ {
+
+ /** . */
+ private final InputStream in;
+
+ private PortletServletInputStream(ClientDataRequestImpl req) throws IOException
+ {
+ in = req.getPortletInputStream();
+ }
+
+ public final int read() throws IOException
+ {
+ return in.read();
+ }
+ }
}
- public boolean isUserInRole(String s)
+ public static final class Action extends ClientData
{
- return false;
+
+ public Action(DispatchType dispatchType, ActionRequestImpl areq, HttpServletRequest dreq, String path)
+ {
+ super(dispatchType, areq, dreq, path);
+ }
}
- public HttpSession getSession(boolean b)
+ public static final class Resource extends ClientData
{
- return dreq.getSession(b);
- }
- public HttpSession getSession()
- {
- return dreq.getSession();
+ public Resource(DispatchType dispatchType, ResourceRequestImpl rreq, HttpServletRequest dreq, String path)
+ {
+ super(dispatchType, rreq, dreq, path);
+ }
}
- public boolean isRequestedSessionIdFromCookie()
+ public static abstract class Mime extends DispatchedHttpServletRequest
{
- return false;
- }
+ public Mime(DispatchType dispatchType, PortletRequestImpl preq, HttpServletRequest dreq, String path)
+ {
+ super(dispatchType, preq, dreq, path);
+ }
- public boolean isRequestedSessionIdFromURL()
- {
- return false;
+ public final String getCharacterEncoding()
+ {
+ return null;
+ }
+
+ public final void setCharacterEncoding(String s) throws UnsupportedEncodingException
+ {
+ }
+
+ public final String getContentType()
+ {
+ return null;
+ }
+
+ public final ServletInputStream getInputStream() throws IOException
+ {
+ return null;
+ }
+
+ public final BufferedReader getReader() throws IOException
+ {
+ return null;
+ }
+
+ public final int getContentLength()
+ {
+ return 0;
+ }
}
- public boolean isRequestedSessionIdFromUrl()
+ public static final class Event extends Mime
{
- return false;
- }
- // Belongs to servlet 2.4 - not specified how it should behave yet
+ /** . */
+ private final EventRequestImpl ereq;
- public int getRemotePort()
- {
- throw new UnsupportedOperationException("Not specified by spec");
- }
+ public Event(DispatchType dispatchType, EventRequestImpl ereq, HttpServletRequest dreq, String path)
+ {
+ super(dispatchType, ereq, dreq, path);
- public String getLocalName()
- {
- throw new UnsupportedOperationException("Not specified by spec");
+ //
+ this.ereq = ereq;
+ }
+
+ public String getMethod()
+ {
+ return ereq.getMethod();
+ }
}
- public String getLocalAddr()
+ public static final class Render extends Mime
{
- throw new UnsupportedOperationException("Not specified by spec");
- }
- public int getLocalPort()
- {
- throw new UnsupportedOperationException("Not specified by spec");
+ public Render(DispatchType dispatchType, RenderRequestImpl rreq, HttpServletRequest dreq, String path)
+ {
+ super(dispatchType, rreq, dreq, path);
+ }
+
+ public String getMethod()
+ {
+ return "GET";
+ }
}
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletResponse.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletResponse.java 2008-01-28 23:38:10 UTC (rev 9627)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletResponse.java 2008-01-29 12:47:14 UTC (rev 9628)
@@ -22,236 +22,364 @@
******************************************************************************/
package org.jboss.portal.portlet.impl.jsr168;
-import javax.portlet.RenderResponse;
+import org.jboss.portal.portlet.impl.jsr168.api.MimeResponseImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.StateAwareResponseImpl;
+import org.jboss.portal.common.NotYetImplemented;
+
+import javax.portlet.PortletResponse;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.Writer;
import java.io.OutputStream;
-import java.io.PrintWriter;
import java.util.Locale;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 6639 $
*/
-public class DispatchedHttpServletResponse extends HttpServletResponseWrapper
+public abstract class DispatchedHttpServletResponse extends HttpServletResponseWrapper
{
/** . */
DispatchedHttpServletRequest req;
/** . */
- private RenderResponse rresp;
+ private PortletResponse presp;
- /** . */
- private ServletOutputStream sos;
-
public DispatchedHttpServletResponse(
DispatchedHttpServletRequest req,
- RenderResponse rresp,
+ PortletResponse presp,
HttpServletResponse dresp)
{
super(dresp);
//
-// switch (req.dispatchType)
-// {
-// case INCLUDE:
-// break;
-// case FORWARD:
-//
-// // Discard existing content
-// rresp.reset();
-//
-// //
-// break;
-// }
-
- //
this.req = req;
- this.rresp = rresp;
- this.sos = null;
+ this.presp = presp;
}
// Must return null
- public String encodeRedirectURL(String s)
+ public final String encodeRedirectURL(String s)
{
return null;
}
- public String encodeRedirectUrl(String s)
+ public final String encodeRedirectUrl(String s)
{
return null;
}
- // Must be equivalent to the methods of the RenderResponse
+ // Must be equivalent to the methods of the PortletResponse
- public String getCharacterEncoding()
+ public final String encodeURL(String s)
{
- return rresp.getCharacterEncoding();
+ return presp.encodeURL(s);
}
- public void setBufferSize(int i)
+ public final String encodeUrl(String s)
{
- rresp.setBufferSize(i);
+ return presp.encodeURL(s);
}
- public void flushBuffer() throws IOException
- {
- rresp.flushBuffer();
- }
+ // Must perform no operations
- public void resetBuffer()
+ public final void setContentType(String s)
{
- rresp.resetBuffer();
}
- public void reset()
+ public final void setContentLength(int i)
{
- rresp.reset();
}
- public int getBufferSize()
+ public final void setLocale(Locale locale)
{
- return rresp.getBufferSize();
}
- public boolean isCommitted()
+ public final void addCookie(Cookie cookie)
{
- return rresp.isCommitted();
}
- public ServletOutputStream getOutputStream() throws IOException
+ public final void sendError(int i) throws IOException
{
- if (sos == null)
- {
- sos = new ServletOutputStream()
- {
- /** . */
- private final OutputStream out = rresp.getPortletOutputStream();
-
- public void write(byte b[], int off, int len) throws IOException
- {
- out.write(b, off, len);
- }
-
- public void write(byte b[]) throws IOException
- {
- out.write(b);
- }
-
- public void write(int b) throws IOException
- {
- out.write(b);
- }
- };
- }
- return sos;
}
- public PrintWriter getWriter() throws IOException
+ public final void sendError(int i, String s) throws IOException
{
- return rresp.getWriter();
}
- public String encodeURL(String s)
+ public final void sendRedirect(String s) throws IOException
{
- return rresp.encodeURL(s);
}
- public String encodeUrl(String s)
+ public final void setDateHeader(String s, long l)
{
- return rresp.encodeURL(s);
}
- // Must perform no operations
-
- public void setContentType(String s)
+ public final void addDateHeader(String s, long l)
{
}
- public void setContentLength(int i)
+ public final void setHeader(String s, String s1)
{
}
- public void setLocale(Locale locale)
+ public final void addHeader(String s, String s1)
{
}
- public void addCookie(Cookie cookie)
+ public final void setIntHeader(String s, int i)
{
}
- public void sendError(int i) throws IOException
+ public final void addIntHeader(String s, int i)
{
}
- public void sendError(int i, String s) throws IOException
+ public final void setStatus(int i)
{
}
- public void sendRedirect(String s) throws IOException
+ public final void setStatus(int i, String s)
{
}
- public void setDateHeader(String s, long l)
- {
- }
- public void addDateHeader(String s, long l)
+ public final void setCharacterEncoding(String s)
{
+ throw new NotYetImplemented();
}
- public void setHeader(String s, String s1)
- {
- }
+ // Must return false
- public void addHeader(String s, String s1)
+ public boolean containsHeader(String s)
{
+ return false;
}
- public void setIntHeader(String s, int i)
- {
- }
+ // Defined by subclasses
- public void addIntHeader(String s, int i)
- {
- }
+ public abstract String getCharacterEncoding();
- public void setStatus(int i)
+ public abstract Locale getLocale();
+
+ public abstract void flushBuffer() throws IOException;
+
+ public abstract void resetBuffer();
+
+ public abstract void reset();
+
+ public abstract int getBufferSize();
+
+ public abstract boolean isCommitted();
+
+ public abstract ServletOutputStream getOutputStream() throws IOException;
+
+ public abstract String getContentType();
+
+ public abstract PrintWriter getWriter() throws IOException;
+
+ public abstract void setBufferSize(int i);
+
+ public static final class StateAware extends DispatchedHttpServletResponse
{
- }
- public void setStatus(int i, String s)
- {
+ /** . */
+ private final StateAwareResponseImpl mresp;
+
+ public StateAware(DispatchedHttpServletRequest req, StateAwareResponseImpl mresp, HttpServletResponse dresp)
+ {
+ super(req, mresp, dresp);
+
+ //
+ this.mresp = mresp;
+ }
+
+ // Must return null
+
+ public String getCharacterEncoding()
+ {
+ return null;
+ }
+
+ public String getContentType()
+ {
+ return null;
+ }
+
+ public Locale getLocale()
+ {
+ return null;
+ }
+
+ public void resetBuffer()
+ {
+ }
+
+ public void reset()
+ {
+ }
+
+ // Must return 0
+
+ public int getBufferSize()
+ {
+ return 0;
+ }
+
+ // Ignore
+
+ public ServletOutputStream getOutputStream() throws IOException
+ {
+ return new ServletOutputStream()
+ {
+ public void write(int b) throws IOException
+ {
+ // Ignore
+ }
+ };
+ }
+
+ public PrintWriter getWriter() throws IOException
+ {
+ return new PrintWriter(new Writer()
+ {
+ public void write(char cbuf[], int off, int len) throws IOException
+ {
+ // Ignore
+ }
+
+ public void flush() throws IOException
+ {
+ // Ignore
+ }
+
+ public void close() throws IOException
+ {
+ // Ignore
+ }
+ });
+ }
+
+ // Must No op
+
+ public void setBufferSize(int i)
+ {
+ }
+
+ public void flushBuffer() throws IOException
+ {
+ }
+
+ // Must return true
+
+ public boolean isCommitted()
+ {
+ return true;
+ }
}
- public boolean containsHeader(String s)
+ public static final class Mime extends DispatchedHttpServletResponse
{
- // Must return false
- return false;
- }
- // Must be based on the getLocale method of the RenderResponse
+ /** . */
+ private final MimeResponseImpl mresp;
- public Locale getLocale()
- {
- return rresp.getLocale();
- }
+ /** . */
+ private ServletOutputStream sos;
- // Belongs to servlet 2.4 - not specified how it should behave yet
+ public Mime(DispatchedHttpServletRequest req, MimeResponseImpl mresp, HttpServletResponse dresp)
+ {
+ super(req, mresp, dresp);
- public String getContentType()
- {
- throw new UnsupportedOperationException("Not specified by spec");
- }
+ //
+ this.mresp = mresp;
+ this.sos = null;
+ }
- public void setCharacterEncoding(String s)
- {
- throw new UnsupportedOperationException("Not specified by spec");
+ // Must be equivalent
+
+ public String getCharacterEncoding()
+ {
+ return mresp.getCharacterEncoding();
+ }
+
+ public void setBufferSize(int i)
+ {
+ mresp.setBufferSize(i);
+ }
+
+ public void flushBuffer() throws IOException
+ {
+ mresp.flushBuffer();
+ }
+
+ public void resetBuffer()
+ {
+ mresp.resetBuffer();
+ }
+
+ public void reset()
+ {
+ mresp.reset();
+ }
+
+ public int getBufferSize()
+ {
+ return mresp.getBufferSize();
+ }
+
+ public boolean isCommitted()
+ {
+ return mresp.isCommitted();
+ }
+
+ public ServletOutputStream getOutputStream() throws IOException
+ {
+ if (sos == null)
+ {
+ sos = new ServletOutputStream()
+ {
+ /** . */
+ private final OutputStream out = mresp.getPortletOutputStream();
+
+ public void write(byte b[], int off, int len) throws IOException
+ {
+ out.write(b, off, len);
+ }
+
+ public void write(byte b[]) throws IOException
+ {
+ out.write(b);
+ }
+
+ public void write(int b) throws IOException
+ {
+ out.write(b);
+ }
+ };
+ }
+ return sos;
+ }
+
+ public PrintWriter getWriter() throws IOException
+ {
+ return mresp.getWriter();
+ }
+
+ public Locale getLocale()
+ {
+ return mresp.getLocale();
+ }
+
+ public String getContentType()
+ {
+ return mresp.getContentType();
+ }
}
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestDispatcherImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestDispatcherImpl.java 2008-01-28 23:38:10 UTC (rev 9627)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestDispatcherImpl.java 2008-01-29 12:47:14 UTC (rev 9628)
@@ -24,12 +24,9 @@
import org.jboss.portal.portlet.aspects.portlet.ContextDispatcherInterceptor;
import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.impl.jsr168.APIConstants;
import org.jboss.portal.portlet.impl.jsr168.DispatchedHttpServletRequest;
import org.jboss.portal.portlet.impl.jsr168.DispatchedHttpServletResponse;
import org.jboss.portal.portlet.impl.jsr168.DispatchType;
-import org.jboss.portal.portlet.LifeCyclePhase;
-import org.jboss.portal.common.NotYetImplemented;
import javax.portlet.PortletException;
import javax.portlet.PortletRequestDispatcher;
@@ -39,7 +36,6 @@
import javax.portlet.PortletResponse;
import javax.portlet.ActionRequest;
import javax.portlet.EventRequest;
-import javax.portlet.ResourceRequest;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@@ -91,24 +87,6 @@
PortletRequest req,
PortletResponse resp) throws PortletException, IOException
{
- LifeCyclePhase phase;
- if (req instanceof ActionRequest)
- {
- phase = LifeCyclePhase.ACTION;
- }
- else if (req instanceof EventRequest)
- {
- phase = LifeCyclePhase.EVENT;
- }
- else if (req instanceof RenderRequest)
- {
- phase = LifeCyclePhase.RENDER;
- }
- else if (req instanceof ResourceRequest)
- {
- phase = LifeCyclePhase.RESOURCE;
- }
-
try
{
// Get the invocation that is still in the request
@@ -119,8 +97,28 @@
HttpServletResponse dresp = invocation.getDispatchedResponse();
//
- DispatchedHttpServletRequest direq = new DispatchedHttpServletRequest(type, (RenderRequestImpl)req, dreq, path);
- DispatchedHttpServletResponse diresp = new DispatchedHttpServletResponse(direq, (RenderResponse)resp, dresp);
+ DispatchedHttpServletRequest direq;
+ DispatchedHttpServletResponse diresp;
+ if (req instanceof ActionRequest)
+ {
+ direq = new DispatchedHttpServletRequest.Action(type, (ActionRequestImpl)req, dreq, path);
+ diresp = new DispatchedHttpServletResponse.StateAware(direq, (StateAwareResponseImpl)resp, dresp);
+ }
+ else if (req instanceof EventRequest)
+ {
+ direq = new DispatchedHttpServletRequest.Event(type, (EventRequestImpl)req, dreq, path);
+ diresp = new DispatchedHttpServletResponse.StateAware(direq, (StateAwareResponseImpl)resp, dresp);
+ }
+ else if (req instanceof RenderRequest)
+ {
+ direq = new DispatchedHttpServletRequest.Render(type, (RenderRequestImpl)req, dreq, path);
+ diresp = new DispatchedHttpServletResponse.Mime(direq, (MimeResponseImpl)resp, dresp);
+ }
+ else
+ {
+ direq = new DispatchedHttpServletRequest.Resource(type, (ResourceRequestImpl)req, dreq, path);
+ diresp = new DispatchedHttpServletResponse.Mime(direq, (MimeResponseImpl)resp, dresp);
+ }
//
switch (type)
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java 2008-01-28 23:38:10 UTC (rev 9627)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java 2008-01-29 12:47:14 UTC (rev 9628)
@@ -50,7 +50,6 @@
import javax.portlet.PortletMode;
import javax.portlet.PortletPreferences;
import javax.portlet.PortletRequest;
-import javax.portlet.PortletSession;
import javax.portlet.PreferencesValidator;
import javax.portlet.RenderRequest;
import javax.portlet.WindowState;
@@ -360,12 +359,12 @@
//
- public PortletSession getPortletSession()
+ public PortletSessionImpl getPortletSession()
{
return getPortletSession(true);
}
- public PortletSession getPortletSession(boolean create)
+ public PortletSessionImpl getPortletSession(boolean create)
{
//
if (create)
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletSessionImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletSessionImpl.java 2008-01-28 23:38:10 UTC (rev 9627)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletSessionImpl.java 2008-01-29 12:47:14 UTC (rev 9628)
@@ -27,8 +27,12 @@
import javax.portlet.PortletContext;
import javax.portlet.PortletSession;
import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionContext;
+import javax.servlet.ServletContext;
import java.util.Enumeration;
import java.util.Map;
+import java.util.Collections;
+import java.util.ArrayList;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -37,15 +41,28 @@
public class PortletSessionImpl implements PortletSession
{
+ /** . */
private HttpSession session;
+
+ /** . */
private String prefix;
+
+ /** . */
private PortletContext context;
+ /** . */
+ private HttpPortletSession applicationScopedHttpSession;
+
+ /** . */
+ private HttpPortletSession portletScopedHttpSession;
+
public PortletSessionImpl(HttpSession session, String id, PortletContext context)
{
this.session = session;
this.prefix = "javax.portlet.p." + id + "?";
this.context = context;
+ this.applicationScopedHttpSession = null;
+ this.portletScopedHttpSession = null;
}
public Object getAttribute(String s)
@@ -208,13 +225,40 @@
throw new NotYetImplemented();
}
- /** Return the underlying session. */
- HttpSession getHttpSession()
+ /**
+ * Returns the an implementation of <code>javax.servlet.http.HttpSession</code> that wraps this
+ * portlet session and use the specified scope for manipulating attributes. This session is used
+ * during the request dispatch to a servlet.
+ *
+ * @param scope the scope
+ * @return the wrapped session
+ */
+ public HttpSession getHttpSession(int scope)
{
- return session;
+ switch (scope)
+ {
+ case APPLICATION_SCOPE:
+ if (applicationScopedHttpSession == null)
+ {
+ applicationScopedHttpSession = new HttpPortletSession(this, APPLICATION_SCOPE);
+ }
+ return applicationScopedHttpSession;
+ case PORTLET_SCOPE:
+ if (portletScopedHttpSession == null)
+ {
+ portletScopedHttpSession = new HttpPortletSession(this, PORTLET_SCOPE);
+ }
+ return portletScopedHttpSession;
+ default:
+ throw new IllegalArgumentException("Unrecognzed session scope " + scope);
+ }
}
- /** Detect validity of the session based on the underlying session. */
+ /**
+ * Detect validity of the session based on the underlying session.
+ *
+ * @return true if the session is valid
+ */
boolean isValid()
{
try
@@ -228,4 +272,107 @@
}
}
+ private static class HttpPortletSession implements HttpSession
+ {
+
+ /** . */
+ private final PortletSessionImpl delegate;
+
+ /** . */
+ private final int scope;
+
+ private HttpPortletSession(PortletSessionImpl delegate, int scope)
+ {
+ this.delegate = delegate;
+ this.scope = scope;
+ }
+
+ public long getCreationTime()
+ {
+ return delegate.getCreationTime();
+ }
+
+ public String getId()
+ {
+ return delegate.getId();
+ }
+
+ public long getLastAccessedTime()
+ {
+ return delegate.getLastAccessedTime();
+ }
+
+ public ServletContext getServletContext()
+ {
+ return delegate.session.getServletContext();
+ }
+
+ public void setMaxInactiveInterval(int i)
+ {
+ delegate.setMaxInactiveInterval(i);
+ }
+
+ public int getMaxInactiveInterval()
+ {
+ return delegate.getMaxInactiveInterval();
+ }
+
+ public HttpSessionContext getSessionContext()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object getAttribute(String s)
+ {
+ return delegate.getAttribute(s, scope);
+ }
+
+ public Object getValue(String s)
+ {
+ return getAttribute(s);
+ }
+
+ public Enumeration getAttributeNames()
+ {
+ return delegate.getAttributeNames(scope);
+ }
+
+ public String[] getValueNames()
+ {
+ ArrayList<String> names = Collections.list(delegate.getAttributeNames());
+
+ //
+ return names.toArray(new String[names.size()]);
+ }
+
+ public void setAttribute(String s, Object o)
+ {
+ delegate.setAttribute(s, o, scope);
+ }
+
+ public void putValue(String s, Object o)
+ {
+ setAttribute(s, o);
+ }
+
+ public void removeAttribute(String s)
+ {
+ delegate.removeAttribute(s, scope);
+ }
+
+ public void removeValue(String s)
+ {
+ removeAttribute(s);
+ }
+
+ public void invalidate()
+ {
+ delegate.invalidate();
+ }
+
+ public boolean isNew()
+ {
+ return delegate.isNew();
+ }
+ }
}
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/ObtainingDispatcherTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/ObtainingDispatcherTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/ObtainingDispatcherTestCase.java 2008-01-29 12:47:14 UTC (rev 9628)
@@ -0,0 +1,147 @@
+/******************************************************************************
+ * 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.actions.PortletRenderTestAction;
+import org.jboss.portal.unit.actions.PortletActionTestAction;
+import org.jboss.portal.unit.actions.PortletEventTestAction;
+import org.jboss.portal.unit.actions.PortletResourceTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.Assertion;
+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 org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+
+import javax.portlet.Portlet;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TestCase({Assertion.JSR168_121, Assertion.JSR168_122})
+public class ObtainingDispatcherTestCase
+{
+ public ObtainingDispatcherTestCase(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
+ {
+ check(portlet);
+
+ //
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+ seq.bindAction(1, UTP1.ACTION_JOIN_POINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ check(portlet);
+
+ //
+ 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
+ {
+ check(portlet);
+ }
+ });
+ seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ return new InvokeGetResponse(response.createResourceURL().toString());
+ }
+ });
+ seq.bindAction(2, UTP1.RESOURCE_JOIN_POINT, new PortletResourceTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, ResourceRequest request, ResourceResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ check(portlet);
+
+ //
+ return new EndTestResponse();
+ }
+ });
+ }
+
+ private static void check(Portlet portlet)
+ {
+ UTP1 p = (UTP1)portlet;
+ //correct
+ PortletRequestDispatcher dispatcher = p.getPortletContext().getNamedDispatcher("UniversalServletA");
+ assertNotNull(dispatcher);
+
+ //incorrect
+ dispatcher = p.getPortletContext().getNamedDispatcher("FAKE_NAME_SERVLET");
+ assertNull(dispatcher);
+
+ //incorrect
+ dispatcher = p.getPortletContext().getNamedDispatcher("/");
+ assertNull(dispatcher);
+
+ //incorrect
+ dispatcher = p.getPortletContext().getNamedDispatcher("/universalServletA");
+ assertNull(dispatcher);
+
+ //incorrect
+ dispatcher = p.getPortletContext().getRequestDispatcher("UniversalServletA");
+ assertNull(dispatcher);
+
+ //incorrect
+ dispatcher = p.getPortletContext().getRequestDispatcher("universalServletA");
+ assertNull(dispatcher);
+
+ //incorrect
+ //dispatcher = getPortletContext().getRequestDispatcher("/UniversalServletA");
+ //assertNull(dispatcher);
+
+ //incorrect
+ //dispatcher = getPortletContext().getRequestDispatcher("/");
+ //assertNull(dispatcher);
+
+ //correct
+ dispatcher = p.getPortletContext().getRequestDispatcher("/universalServletA");
+ assertNotNull(dispatcher);
+ }
+}
\ No newline at end of file
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/actions/PortletRenderTestAction.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/actions/PortletRenderTestAction.java 2008-01-28 23:38:10 UTC (rev 9627)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/actions/PortletRenderTestAction.java 2008-01-29 12:47:14 UTC (rev 9628)
@@ -24,7 +24,6 @@
import org.jboss.portal.unit.TestAction;
import org.jboss.portal.unit.PortletTestContext;
-import org.jboss.portal.unit.PortletTestContext;
import org.jboss.portal.common.NotYetImplemented;
import org.jboss.unit.driver.DriverResponse;
import org.jboss.unit.driver.response.FailureResponse;
@@ -34,8 +33,6 @@
import javax.portlet.PortletException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
import java.io.IOException;
/**
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/actions/PortletTestAction.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/actions/PortletTestAction.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/actions/PortletTestAction.java 2008-01-29 12:47:14 UTC (rev 9628)
@@ -0,0 +1,84 @@
+/******************************************************************************
+ * 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.portal.common.NotYetImplemented;
+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.PortletRequest;
+import javax.portlet.PortletResponse;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 7954 $
+ */
+public abstract class PortletTestAction extends TestAction
+{
+
+ public final DriverResponse execute(Portlet portlet, PortletRequest request, PortletResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ try
+ {
+ return runWithRuntimeException(portlet, request, response, context);
+ }
+ catch (AssertionError t)
+ {
+ getLogger().error("The test case failed", t);
+
+ //
+ return new FailureResponse(Failure.createFailure(t));
+ }
+ }
+
+ protected DriverResponse runWithRuntimeException(Portlet portlet, PortletRequest request, PortletResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ try
+ {
+ return run(portlet, request, response, context);
+ }
+ catch (Exception e)
+ {
+ if (e instanceof PortletException)
+ {
+ throw (PortletException)e;
+ }
+ if (e instanceof IOException)
+ {
+ throw (IOException)e;
+ }
+ throw new AssertionError(e);
+ }
+ }
+
+ protected DriverResponse run(Portlet portlet, PortletRequest request, PortletResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ throw new NotYetImplemented();
+ }
+}
\ 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-28 23:38:10 UTC (rev 9627)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/base/AbstractUniversalTestPortlet.java 2008-01-29 12:47:14 UTC (rev 9628)
@@ -29,6 +29,7 @@
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.actions.PortletTestAction;
import org.jboss.portal.unit.TestAction;
import org.jboss.portal.unit.PortletTestContext;
import org.jboss.portal.test.framework.server.NodeId;
@@ -156,11 +157,17 @@
{
ctx.setResponse(new FailureResponse(Failure.createAssertionFailure("No action for " + ctx.getRequestCount() + " " + NodeId.locate() + " " + actionJoinPoint)));
}
- else if (action instanceof PortletActionTestAction == false)
+ if (action instanceof PortletTestAction)
{
- ctx.setResponse(new FailureResponse(Failure.createAssertionFailure("Action for " + ctx.getRequestCount() + " " + NodeId.locate() + " " + actionJoinPoint + " is not an instance of " + PortletActionTestAction.class.getName() + " but is " + action.getClass().getName())));
+ log.debug("Found action for jointpoint " + actionJoinPoint + " : " + action);
+
+ //
+ DriverResponse response = ((PortletTestAction)action).execute(this, req, resp, ctx);
+
+ //
+ ctx.setResponse(response);
}
- else
+ else if (action instanceof PortletActionTestAction)
{
log.debug("Found action for jointpoint " + actionJoinPoint + " : " + action);
@@ -170,6 +177,12 @@
//
ctx.setResponse(response);
}
+ else
+ {
+ ctx.setResponse(new FailureResponse(Failure.createAssertionFailure("Action for " + ctx.getRequestCount() +
+ " " + NodeId.locate() + " " + actionJoinPoint + " does not have the right type but has the type " +
+ action.getClass().getName())));
+ }
}
}
@@ -196,11 +209,17 @@
//
if (action != null)
{
- if (!(action instanceof PortletEventTestAction))
+ if (action instanceof PortletTestAction)
{
- ctx.setResponse(new FailureResponse(Failure.createAssertionFailure("Action for " + ctx.getRequestCount() + " " + NodeId.locate() + " " + actionJoinPoint + " is not an instance of " + PortletEventTestAction.class.getName() + " but is " + action.getClass().getName())));
+ log.debug("Found action for jointpoint " + eventJoinPoint + " : " + action);
+
+ //
+ DriverResponse response = ((PortletTestAction)action).execute(this, req, resp, ctx);
+
+ //
+ ctx.setResponse(response);
}
- else
+ if (action instanceof PortletEventTestAction)
{
log.debug("Found action for jointpoint " + eventJoinPoint + " : " + action);
@@ -210,6 +229,12 @@
//
ctx.setResponse(response);
}
+ else
+ {
+ ctx.setResponse(new FailureResponse(Failure.createAssertionFailure("Action for " + ctx.getRequestCount() +
+ " " + NodeId.locate() + " " + actionJoinPoint + " does not have the right type but has the type " +
+ action.getClass().getName())));
+ }
}
}
}
@@ -254,11 +279,29 @@
//
if (action != null)
{
- log.debug("Found action for joinpoint " + renderJoinPoint + " : " + action);
-
// Get the result
- DriverResponse response = ((PortletRenderTestAction)action).execute(this, req, resp, ctx);
+ DriverResponse response;
+ if (action instanceof PortletTestAction)
+ {
+ log.debug("Found action for joinpoint " + renderJoinPoint + " : " + action);
+ //
+ response = ((PortletTestAction)action).execute(this, req, resp, ctx);
+ }
+ else if (action instanceof PortletRenderTestAction)
+ {
+ log.debug("Found action for joinpoint " + renderJoinPoint + " : " + action);
+
+ //
+ response = ((PortletRenderTestAction)action).execute(this, req, resp, ctx);
+ }
+ else
+ {
+ response = new FailureResponse(Failure.createAssertionFailure("Action for " + ctx.getRequestCount() +
+ " " + NodeId.locate() + " " + resourceJoinPoint + " does not have the right type but has the type " +
+ action.getClass().getName()));
+ }
+
// If we have one result it is meant to be returned to the client
if (response != null)
{
@@ -303,16 +346,18 @@
}
//
- if (action == null)
+ if (action instanceof PortletTestAction)
{
- ctx.setResponse(new FailureResponse(Failure.createAssertionFailure("No action for " + ctx.getRequestCount() + " " + NodeId.locate() + " " + resourceJoinPoint)));
+ 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 = ((PortletTestAction)action).execute(this, req, resp, ctx);
+
+ //
+ ctx.setResponse(response);
}
- else if (action instanceof PortletResourceTestAction == false)
+ else if (action instanceof PortletResourceTestAction)
{
- 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
@@ -321,6 +366,12 @@
//
ctx.setResponse(response);
}
+ else
+ {
+ ctx.setResponse(new FailureResponse(Failure.createAssertionFailure("Action for " + ctx.getRequestCount() +
+ " " + NodeId.locate() + " " + resourceJoinPoint + " does not have the right type but has the type " +
+ action.getClass().getName())));
+ }
}
public void destroy()
Modified: modules/portlet/trunk/test/src/test/build.xml
===================================================================
--- modules/portlet/trunk/test/src/test/build.xml 2008-01-28 23:38:10 UTC (rev 9627)
+++ modules/portlet/trunk/test/src/test/build.xml 2008-01-29 12:47:14 UTC (rev 9628)
@@ -237,6 +237,7 @@
<package-misc-test test="log4j"/>
+ <package-jsr286-tck-test test="dispatcher"/>
<package-jsr286-tck-test test="portletconfig"/>
<package-jsr286-tck-test test="portletconfignonamespace"/>
<package-jsr286-tck-test test="event"/>
Added: modules/portlet/trunk/test/src/test/resources/jsr286/tck/dispatcher-war/WEB-INF/portlet.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/tck/dispatcher-war/WEB-INF/portlet.xml (rev 0)
+++ modules/portlet/trunk/test/src/test/resources/jsr286/tck/dispatcher-war/WEB-INF/portlet.xml 2008-01-29 12:47:14 UTC (rev 9628)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ version="1.0">
+
+
+ <portlet>
+ <portlet-name>TestUniversalPortletA</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP1</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <supported-processing-event>
+ <name>Event</name>
+ </supported-processing-event>
+ <supported-publishing-event>
+ <name>Event</name>
+ </supported-publishing-event>
+ </portlet>
+
+ <event-definition>
+ <name>Event</name>
+ </event-definition>
+
+</portlet-app>
Added: 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 (rev 0)
+++ modules/portlet/trunk/test/src/test/resources/jsr286/tck/dispatcher-war/WEB-INF/web.xml 2008-01-29 12:47:14 UTC (rev 9628)
@@ -0,0 +1,44 @@
+<?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>
+
+ <servlet>
+ <servlet-name>UniversalServletA</servlet-name>
+ <servlet-class>org.jboss.portal.test.portlet.framework.UTS1</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>UniversalServletA</servlet-name>
+ <url-pattern>/universalServletA/*</url-pattern>
+ </servlet-mapping>
+
+</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-28 23:38:10 UTC (rev 9627)
+++ modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml 2008-01-29 12:47:14 UTC (rev 9628)
@@ -149,6 +149,10 @@
<!--Spec TCK Assertions tests-->
<generic>
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
+ <property name="archiveId" value="test-jsr286-tck-dispatcher.war"/>
+ </generic>
+ <generic>
+ <class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr286-tck-portletconfig.war"/>
</generic>
<generic>
18 years, 3 months
JBoss Portal SVN: r9627 - modules/test/trunk/docs/user-guide/en/modules.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-01-28 18:38:10 -0500 (Mon, 28 Jan 2008)
New Revision: 9627
Modified:
modules/test/trunk/docs/user-guide/en/modules/tooling.xml
Log:
cleanup
Modified: modules/test/trunk/docs/user-guide/en/modules/tooling.xml
===================================================================
--- modules/test/trunk/docs/user-guide/en/modules/tooling.xml 2008-01-28 23:36:34 UTC (rev 9626)
+++ modules/test/trunk/docs/user-guide/en/modules/tooling.xml 2008-01-28 23:38:10 UTC (rev 9627)
@@ -718,7 +718,6 @@
<path id="jboss.unit.tooling.test.classpath">
<pathelement location="jboss-unit-tooling-ant.jar"/>
<pathelement location="jboss-unit-tooling-core.jar"/>
- <!-- ? -->
</path>
<taskdef name="jboss-unit" classname="org.jboss.unit.tooling.ant.JBossUnitTask" classpathref="jboss.unit.tooling.test.classpath"/>
18 years, 3 months
JBoss Portal SVN: r9626 - in modules/test/trunk/tooling/examples: ant and 7 other directories.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-01-28 18:36:34 -0500 (Mon, 28 Jan 2008)
New Revision: 9626
Added:
modules/test/trunk/tooling/examples/ant/
modules/test/trunk/tooling/examples/ant/build.xml
modules/test/trunk/tooling/examples/ant/jboss-unit.xml
modules/test/trunk/tooling/examples/ant/lib/
modules/test/trunk/tooling/examples/ant/lib/jboss-unit-tooling-ant.jar
modules/test/trunk/tooling/examples/ant/lib/jboss-unit-tooling-core.jar
modules/test/trunk/tooling/examples/ant/lib/jboss-unit.jar
modules/test/trunk/tooling/examples/ant/src/
modules/test/trunk/tooling/examples/ant/src/org/
modules/test/trunk/tooling/examples/ant/src/org/jboss/
modules/test/trunk/tooling/examples/ant/src/org/jboss/test/
modules/test/trunk/tooling/examples/ant/src/org/jboss/test/unit/
modules/test/trunk/tooling/examples/ant/src/org/jboss/test/unit/tooling/
modules/test/trunk/tooling/examples/ant/src/org/jboss/test/unit/tooling/TestSimple.java
Log:
dummy ant example
Added: modules/test/trunk/tooling/examples/ant/build.xml
===================================================================
--- modules/test/trunk/tooling/examples/ant/build.xml (rev 0)
+++ modules/test/trunk/tooling/examples/ant/build.xml 2008-01-28 23:36:34 UTC (rev 9626)
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<project name="portlet-integration-test">
+
+ <target name="prepare">
+
+ <path id="jboss-unit">
+ <pathelement location="./lib/jboss-unit.jar"/>
+ </path>
+
+ <path id="jboss-unit-tooling">
+ <pathelement location="./lib/jboss-unit-tooling-ant.jar"/>
+ <pathelement location="./lib/jboss-unit-tooling-core.jar"/>
+ </path>
+
+ </target>
+
+ <target name="compile" depends="prepare">
+ <mkdir dir="./output"/>
+
+ <javac srcdir="./src" destdir="./output">
+ <classpath>
+ <path refid="jboss-unit"/>
+ </classpath>
+ </javac>
+
+ </target>
+
+
+ <target name="test" depends="compile">
+
+ <taskdef name="jboss-unit" classname="org.jboss.unit.tooling.ant.JBossUnitTask" classpathref="jboss-unit-tooling"/>
+
+ <jboss-unit>
+ <tests config="./jboss-unit.xml"/>
+ <classpath>
+ <path refid="jboss-unit"/>
+ <pathelement location="./output"/>
+ </classpath>
+ </jboss-unit>
+
+ </target>
+
+ <target name="clean">
+ <delete dir="./output" />
+ </target>
+
+</project>
Added: modules/test/trunk/tooling/examples/ant/jboss-unit.xml
===================================================================
--- modules/test/trunk/tooling/examples/ant/jboss-unit.xml (rev 0)
+++ modules/test/trunk/tooling/examples/ant/jboss-unit.xml 2008-01-28 23:36:34 UTC (rev 9626)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jboss-unit
+ xmlns="urn:jboss:jboss-unit:1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:jboss-unit:1.0 jboss-unit_1_0.xsd">
+ <pojo>
+ <test>
+ <class name="org.jboss.test.unit.tooling.TestSimple"/>
+ </test>
+ </pojo>
+</jboss-unit>
\ No newline at end of file
Added: modules/test/trunk/tooling/examples/ant/lib/jboss-unit-tooling-ant.jar
===================================================================
(Binary files differ)
Property changes on: modules/test/trunk/tooling/examples/ant/lib/jboss-unit-tooling-ant.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/test/trunk/tooling/examples/ant/lib/jboss-unit-tooling-core.jar
===================================================================
(Binary files differ)
Property changes on: modules/test/trunk/tooling/examples/ant/lib/jboss-unit-tooling-core.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/test/trunk/tooling/examples/ant/lib/jboss-unit.jar
===================================================================
(Binary files differ)
Property changes on: modules/test/trunk/tooling/examples/ant/lib/jboss-unit.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/test/trunk/tooling/examples/ant/src/org/jboss/test/unit/tooling/TestSimple.java
===================================================================
--- modules/test/trunk/tooling/examples/ant/src/org/jboss/test/unit/tooling/TestSimple.java (rev 0)
+++ modules/test/trunk/tooling/examples/ant/src/org/jboss/test/unit/tooling/TestSimple.java 2008-01-28 23:36:34 UTC (rev 9626)
@@ -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.test.unit.tooling;
+
+import org.jboss.unit.api.Assert;
+import org.jboss.unit.api.pojo.annotations.Test;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class TestSimple
+{
+
+ @Test
+ public void testOne()
+ {
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void testTwo()
+ {
+ Assert.assertFalse(true);
+ }
+
+ @Test
+ public void testThree()
+ {
+ Assert.assertFalse(false);
+ }
+
+}
18 years, 3 months
JBoss Portal SVN: r9625 - modules/test/trunk/docs/user-guide/en/modules.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-01-28 18:35:52 -0500 (Mon, 28 Jan 2008)
New Revision: 9625
Modified:
modules/test/trunk/docs/user-guide/en/modules/tooling.xml
Log:
small update
Modified: modules/test/trunk/docs/user-guide/en/modules/tooling.xml
===================================================================
--- modules/test/trunk/docs/user-guide/en/modules/tooling.xml 2008-01-28 23:15:14 UTC (rev 9624)
+++ modules/test/trunk/docs/user-guide/en/modules/tooling.xml 2008-01-28 23:35:52 UTC (rev 9625)
@@ -17,15 +17,13 @@
<listitem>Maven plugin</listitem>
</itemizedlist>
<sect1>
- <title>Required dependencies</title>
- <para>TODO: Which jars are exactly needed</para>
- </sect1>
-
- <sect1>
<title>Commandline</title>
<para>JBoss Unit can be run directly from the command line. This is main and low level way to control testsuite
execution. In both ant and maven support all the configuration defined in build files is converted to proper
commandline java call.</para>
+
+ <para>To run simple JBoss Unit tests from command line only one jboss-unit jar is needed</para>
+
<example>
<programlisting>
<![CDATA[
@@ -1292,11 +1290,6 @@
<para></para>
</sect2>
- <!--<sect2>-->
- <!--<title>jboss.unit.logging</title>-->
- <!--<para></para>-->
- <!--</sect2>-->
-
</sect1>
18 years, 3 months
JBoss Portal SVN: r9624 - branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/weather.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-01-28 18:15:14 -0500 (Mon, 28 Jan 2008)
New Revision: 9624
Modified:
branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/weather/WeatherPortlet.java
Log:
- Typo.
Modified: branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/weather/WeatherPortlet.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/weather/WeatherPortlet.java 2008-01-28 16:34:41 UTC (rev 9623)
+++ branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/weather/WeatherPortlet.java 2008-01-28 23:15:14 UTC (rev 9624)
@@ -50,7 +50,7 @@
import java.net.URL;
/**
- * Simple weather portlet that redads Yahoo RSS Weather feeds and uses XSLT for presentation.
+ * Simple weather portlet that reads Yahoo RSS Weather feeds and uses XSLT for presentation.
*
* @author <a href="mailto:roy@jboss.org">Roy Russo</a>
*/
18 years, 3 months
JBoss Portal SVN: r9623 - in modules/test/trunk/docs/user-guide/en: modules and 1 other directory.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-01-28 11:34:41 -0500 (Mon, 28 Jan 2008)
New Revision: 9623
Added:
modules/test/trunk/docs/user-guide/en/modules/tooling.xml
Modified:
modules/test/trunk/docs/user-guide/en/master.xml
modules/test/trunk/docs/user-guide/en/modules/pojotesting.xml
Log:
initial draft of tooling documentation
Modified: modules/test/trunk/docs/user-guide/en/master.xml
===================================================================
--- modules/test/trunk/docs/user-guide/en/master.xml 2008-01-28 15:00:37 UTC (rev 9622)
+++ modules/test/trunk/docs/user-guide/en/master.xml 2008-01-28 16:34:41 UTC (rev 9623)
@@ -3,6 +3,7 @@
"../../docbook-support/support/docbook-dtd/docbookx.dtd" [
<!ENTITY introduction SYSTEM "modules/introduction.xml">
<!ENTITY pojotesting SYSTEM "modules/pojotesting.xml">
+ <!ENTITY tooling SYSTEM "modules/tooling.xml">
]>
<book lang="en">
<bookinfo>
@@ -18,5 +19,6 @@
<toc/>
<!-- Introduction --> &introduction;
<!-- POJO Testing --> &pojotesting;
+ <!-- Tools support --> &tooling;
</book>
Modified: modules/test/trunk/docs/user-guide/en/modules/pojotesting.xml
===================================================================
--- modules/test/trunk/docs/user-guide/en/modules/pojotesting.xml 2008-01-28 15:00:37 UTC (rev 9622)
+++ modules/test/trunk/docs/user-guide/en/modules/pojotesting.xml 2008-01-28 16:34:41 UTC (rev 9623)
@@ -19,7 +19,7 @@
that the test failed.</para>
<para>A class containing a serie of test cases is considered as a test suite.</para>
<example>
- <programlisting><![CDATA[
+ ka <programlisting><![CDATA[
import org.jboss.unit.api.pojo.annotations.Test;
public class MyTest
Added: modules/test/trunk/docs/user-guide/en/modules/tooling.xml
===================================================================
--- modules/test/trunk/docs/user-guide/en/modules/tooling.xml (rev 0)
+++ modules/test/trunk/docs/user-guide/en/modules/tooling.xml 2008-01-28 16:34:41 UTC (rev 9623)
@@ -0,0 +1,1306 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<chapter id="tooling">
+ <chapterinfo>
+ <author>
+ <firstname>Boleslaw</firstname>
+ <surname>Dawidowicz</surname>
+ <email>boleslaw.dawidowicz(a)redhat.com</email>
+ </author>
+ </chapterinfo>
+ <title>Tools support</title>
+ <para>JBoss Unit framework provide 3 methods to invoke tests:
+
+ </para>
+ <itemizedlist>
+ <listitem>Commandline</listitem>
+ <listitem>Ant task</listitem>
+ <listitem>Maven plugin</listitem>
+ </itemizedlist>
+ <sect1>
+ <title>Required dependencies</title>
+ <para>TODO: Which jars are exactly needed</para>
+ </sect1>
+
+ <sect1>
+ <title>Commandline</title>
+ <para>JBoss Unit can be run directly from the command line. This is main and low level way to control testsuite
+ execution. In both ant and maven support all the configuration defined in build files is converted to proper
+ commandline java call.</para>
+ <example>
+ <programlisting>
+ <![CDATA[
+# java [class_path] org.jboss.unit.tools.Main --config=config/jboss-unit.xml \
+ --ids=testOne,testTwo,testThree \
+ --keywords=APITests,TCK \
+ --property.name=value \
+ --property.name2=value2 \
+ --properties=[name3=value1,name3,value2] \
+ --parameter.name=[value1,value2,value3] \
+ --parameter.name2=value \
+ --parameters=[a=b,a=b2,c=d] \
+ ]]>
+ </programlisting>
+ </example>
+ <sect2>
+ <title>--config</title>
+ <para>JBoss Unit configuration file</para>
+ <example>
+ <programlisting>
+ <![CDATA[
+# java [class_path] org.jboss.unit.tools.Main --config=config/jboss-unit.xml \
+ ]]>
+ </programlisting>
+ </example>
+ </sect2>
+
+ <sect2>
+ <title>--id</title>
+ <para>Id of testcase to invoke</para>
+ <example>
+ <programlisting>
+ <![CDATA[
+# java [class_path] org.jboss.unit.tools.Main --config=config/jboss-unit.xml --id=testOne
+ ]]>
+ </programlisting>
+ </example>
+ </sect2>
+ <sect2>
+ <title>--ids</title>
+ <para>Coma separated list of testcase ids that should be executed</para>
+ <example>
+ <programlisting>
+ <![CDATA[
+# java [class_path] org.jboss.unit.tools.Main --config=config/jboss-unit.xml --ids=testOne,testTwo,testThree
+
+ ]]>
+ </programlisting>
+ </example>
+ </sect2>
+ <sect2>
+ <title>--keywords</title>
+ <para>Coma separated list of testcase keywords that should be executed</para>
+ <example>
+ <programlisting>
+ <![CDATA[
+# java [class_path] org.jboss.unit.tools.Main --config=config/jboss-unit.xml --keywords=APITests,TCK
+ ]]>
+ </programlisting>
+ </example>
+ </sect2>
+ <sect2>
+ <title>--ex_id</title>
+ <para>Id of testcase that should be excluded from execution</para>
+ <example>
+ <programlisting>
+ <![CDATA[
+# java [class_path] org.jboss.unit.tools.Main --config=config/jboss-unit.xml --ex_id=testOne
+ ]]>
+ </programlisting>
+ </example>
+ </sect2>
+ <sect2>
+ <title>--ex_ids</title>
+ <para>Coma separated list of testcase ids that should be excluded from execution</para>
+ <example>
+ <programlisting>
+ <![CDATA[
+# java [class_path] org.jboss.unit.tools.Main --config=config/jboss-unit.xml --ex_ids=testOne,testTwo,testThree
+ ]]>
+ </programlisting>
+ </example>
+ </sect2>
+ <sect2>
+ <title>--ex_keywords</title>
+ <para>Coma separated list of testcase keywords that should be excluded from execution</para>
+ <example>
+ <programlisting>
+ <![CDATA[
+# java [class_path] org.jboss.unit.tools.Main --config=config/jboss-unit.xml --ex_keywords=APITests,TCK
+ ]]>
+ </programlisting>
+ </example>
+ </sect2>
+ <sect2>
+ <title>--suite_name</title>
+ <para>Testsuite name. It will be used in reports generation</para>
+ <example>
+ <programlisting>
+ <![CDATA[
+# java [class_path] org.jboss.unit.tools.Main --config=config/jboss-unit.xml --suite_name=myTests
+
+ ]]>
+ </programlisting>
+ </example>
+ </sect2>
+ <sect2>
+ <title>--no_console</title>
+ <para>Output won't be present on the console</para>
+ <example>
+ <programlisting>
+ <![CDATA[
+# java [class_path] org.jboss.unit.tools.Main --config=config/jboss-unit.xml --no_console
+ ]]>
+ </programlisting>
+ </example>
+ </sect2>
+ <sect2>
+ <title>--xml_report_dir</title>
+ <para>Directory to which xml reports should be generated. Xml reports will be in JUnit format</para>
+ <example>
+ <programlisting>
+ <![CDATA[
+# java [class_path] org.jboss.unit.tools.Main --config=config/jboss-unit.xml --xml_report_dir=output/reports/xml
+ ]]>
+ </programlisting>
+ </example>
+ </sect2>
+ <sect2>
+ <title>--html_report_dir</title>
+ <para>Directory to which html reports should be generated.</para>
+ <example>
+ <programlisting>
+ <![CDATA[
+# java [class_path] org.jboss.unit.tools.Main --config=config/jboss-unit.xml --html_report_dir=output/reports/html
+ ]]>
+ </programlisting>
+ </example>
+ </sect2>
+ <sect2>
+ <title>--property</title>
+ <para>Single property value</para>
+ <example>
+ <programlisting>
+ <![CDATA[
+# java [class_path] org.jboss.unit.tools.Main --config=config/jboss-unit.xml --property.name=value --property.name2=value2
+ ]]>
+ </programlisting>
+ </example>
+ </sect2>
+ <sect2>
+ <title>--properties</title>
+ <para>Several name=value pairs for properties</para>
+ <example>
+ <programlisting>
+ <![CDATA[
+# java [class_path] org.jboss.unit.tools.Main --config=config/jboss-unit.xml --properties=[name3=value1,name3,value2]
+ ]]>
+ </programlisting>
+ </example>
+ </sect2>
+ <sect2>
+ <title>--parameter</title>
+ <para>Single parameter values</para>
+ <example>
+ <programlisting>
+ <![CDATA[
+# java [class_path] org.jboss.unit.tools.Main --config=config/jboss-unit.xml
+ --parameter.name=[value1,value2,value3] \
+ --parameter.name2=value
+ ]]>
+ </programlisting>
+ </example>
+ </sect2>
+ <sect2>
+ <title>--parameters</title>
+ <para>Several name=value paris for parameters. If single name is specified few times, sum of all provided values will be passed</para>
+ <example>
+ <programlisting>
+ <![CDATA[
+# java [class_path] org.jboss.unit.tools.Main --config=config/jboss-unit.xml --parameters=[a=b,a=b2,c=d]
+ ]]>
+ </programlisting>
+ </example>
+ </sect2>
+ <sect2>
+ <title>--failonerror</title>
+ <para></para>
+ <example>
+ <programlisting>
+ <![CDATA[
+# java [class_path] org.jboss.unit.tools.Main --config=config/jboss-unit.xml --failonerror
+ ]]>
+ </programlisting>
+ </example>
+ </sect2>
+ </sect1>
+ <sect1>
+ <title>Maven</title>
+ <para>
+ To use JBoss Unit maven plugin you need to configure JBoss maven repositories in your pom file:
+ </para>
+ <example>
+ <caption>JBoss maven repositories configuration</caption>
+ <programlisting>
+ <![CDATA[
+<pluginRepositories>
+ <pluginRepository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <layout>default</layout>
+ <url>http://repository.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </pluginRepository>
+ <pluginRepository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshots Repository</name>
+ <layout>default</layout>
+ <url>http://snapshots.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ </pluginRepository>
+</pluginRepositories>
+
+ ]]>
+ </programlisting>
+ </example>
+ <para>
+ JBoss Unit artifacts have <emphasis>org.jboss.unit</emphasis> maven groupId. The plugin has
+ <emphasis>jboss-unit-tooling-maven2</emphasis> maven artifactId. The simplest configuration requires only to
+ specify a single testsuite with a configuration file.
+ </para>
+ <example>
+ <caption>
+ <para>Simplest maven plugin configuration</para>
+ </caption>
+ <programlisting>
+ <![CDATA[
+<plugin>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>jboss-unit-tooling-maven2</artifactId>
+ <executions>
+ <execution>
+ <phase>test</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <testsuites>
+ <testsuite>
+ <config>local-jboss-unit.xml</config>
+ </testsuite>
+ </testsuites>
+ </configuration>
+</plugin>
+ ]]>
+ </programlisting>
+
+ </example>
+
+ <para>In maven plugin you specify <emphasis>testsuites</emphasis>. Each <emphasis>testsuite</emphasis> has single configuration file
+ and is eqivalent to signle JBoss Unit run. <emphasis>Testsuites</emphasis> are controled with additional constraints applied with
+ <emphasis>includes</emphasis> and <emphasis>excludes</emphasis>. In each you can describe testcase to include or exclude
+ from execution by specifying its <emphasis>id</emphasis> or <emphasis>keyword</emphasis>. Maven plugin also support
+ parameters and properties mechanisms. Reports generation can be configured either globally or per single testsuite</para>
+
+ <example>
+ <caption>
+ <para>Custom maven plugin configuration</para>
+ </caption>
+ <programlisting>
+ <![CDATA[
+<plugin>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>jboss-unit-tooling-maven2</artifactId>
+ <executions>
+ <execution>
+ <phase>test</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <jpda>false</jpda>
+ <jpdaPort>9000</jpdaPort>
+ <jpdaSuspend>true</jpdaSuspend>
+ <failOnError>false</failOnError>
+ <assertions>true</assertions>
+
+ <testsuites>
+ <testsuite>
+ <config>local-jboss-unit.xml</config>
+ <includes>
+ <include>
+ <ids>
+ <id>testOne</id>
+ <id>testTwo</id>
+ </ids>
+ <keywords>
+ <keyword>keyword1</keyword>
+ <keyword>keyword2</keyword>
+ </keywords>
+ </include>
+ </includes>
+ <excludes>
+ <exclude>
+ <ids>
+ <id>otherTestOne</id>
+ <id>otherTestTwo</id>
+ </ids>
+ <keywords>
+ <keyword>otherKeyword1</keyword>
+ <keyword>otherKeyword2</keyword>
+ </keywords>
+ </exclude>
+ </excludes>
+ <parameters>
+ <parameter>
+ <name>parameter1</name>
+ <values>
+ <value>value1</value>
+ <value>value2</value>
+ </values>
+ </parameter>
+ <parameter>
+ <name>parameter2</name>
+ <values>
+ <value>value3</value>
+ <value>value4</value>
+ </values>
+ </parameter>
+ </parameters>
+ <properties>
+ <property>
+ <name>sampleProperty</name>
+ <value>propertyValue</value>
+ </property>
+ </properties>
+ <reports>
+ <xml>target/tests1/reports/xml</xml>
+ <html>target/tests1/reports/html</html>
+ </reports>
+ </testsuite>
+ <testsuite>
+ <config>local-jboss-unit2.xml</config>
+ </testsuite>
+ </testsuites>
+ <reports>
+ <xml>target/tests/reports/xml</xml>
+ <html>target/tests/reports/html</html>
+ </reports>
+ </configuration>
+</plugin>
+ ]]>
+ </programlisting>
+
+ </example>
+
+ <sect2>
+ <title>configuration</title>
+ <table frame="all">
+ <title><configuration> element</title>
+ <para>Main configuration element of maven plugin</para>
+ <tgroup cols="3" align="left" colsep="1" rowset="1">
+ <colspec colname='c1'/>
+ <colspec colname='c2'/>
+ <colspec colname='c3'/>
+ <thead>
+ <row>
+ <entry align="center">Element</entry>
+ <entry align="center">Default</entry>
+ <entry align="left">Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><testsuites></entry>
+ <entry/>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><reports></entry>
+ <entry/>
+ <entry>Global reports configuration. It can be overwritten in single testsuite configuration</entry>
+ </row>
+ <row>
+ <entry><jpda></entry>
+ <entry>false</entry>
+ <entry>Remote debugging support (Java Platform Debugger Architecture)</entry>
+ </row>
+ <row>
+ <entry><jpdaPort></entry>
+ <entry>9000</entry>
+ <entry>JPDA port</entry>
+ </row>
+ <row>
+ <entry><jpdaSuspend></entry>
+ <entry>true</entry>
+ <entry>Remote debbugging (JPDA) suspend mode. If true it will suspend the VM and wait for the connection
+ </entry>
+ </row>
+ <row>
+ <entry><assertions></entry>
+ <entry>true</entry>
+ <entry>Enables Java Assertions</entry>
+ </row>
+ <row>
+ <entry><failOnError></entry>
+ <entry>fail</entry>
+ <entry>Any testcase failure will make the maven build fail</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </sect2>
+ <sect2>
+ <title>testsuite</title>
+ <table frame="all">
+ <title><testsuite> element</title>
+ <para>Configures single JBoss Unit run</para>
+ <tgroup cols="2" align="left" colsep="1" rowset="1">
+ <colspec colname='c1'/>
+ <colspec colname='c2'/>
+ <thead>
+ <row>
+ <entry align="center">Element</entry>
+ <entry align="center">Mandatory</entry>
+ <entry align="left">Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><config></entry>
+ <entry>Yes</entry>
+ <entry>JBoss Unit configuration file</entry>
+ </row>
+ <row>
+ <entry><includes></entry>
+ <entry>No</entry>
+ <entry>Test cases that will be included in testsuite execution. If defined only those tests will be
+ executed. Excludes check takes precedence.</entry>
+ </row>
+ <row>
+ <entry><excludes></entry>
+ <entry>No</entry>
+ <entry>Test cases that will be excluded from testsuite execution. If defined all testcases besides
+ specified will be executed. Excludes check takes precedence before includes.</entry>
+ </row>
+ <row>
+ <entry><parameters></entry>
+ <entry>No</entry>
+ <entry>Parameters that will be passed to testsuite run</entry>
+ </row>
+ <row>
+ <entry><properties></entry>
+ <entry>No</entry>
+ <entry>Properties that will be passed to testsuite run</entry>
+ </row>
+ <row>
+ <entry><reports></entry>
+ <entry>No</entry>
+ <entry>Reports generation configuration valid for single testsuite</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </sect2>
+ <sect2>
+ <title>include and exclude</title>
+ <para>Defines testcases to include or exclude from testsuite run</para>
+ <example>
+ <programlisting>
+ <![CDATA[
+<includes>
+ <include>
+ <ids>
+ <id>testOne</id>
+ <id>testTwo</id>
+ </ids>
+ <keywords>
+ <keyword>keyword1</keyword>
+ <keyword>keyword2</keyword>
+ </keywords>
+ </include>
+</includes>
+<excludes>
+ <exclude>
+ <ids>
+ <id>otherTestOne</id>
+ <id>otherTestTwo</id>
+ </ids>
+ <keywords>
+ <keyword>otherKeyword1</keyword>
+ <keyword>otherKeyword2</keyword>
+ </keywords>
+ </exclude>
+</excludes>
+ ]]>
+ </programlisting>
+ </example>
+ <table frame="all">
+ <title><include> and <exclude> elements</title>
+ <tgroup cols="2" align="left" colsep="1" rowset="1">
+ <colspec colname='c1'/>
+ <colspec colname='c2'/>
+ <thead>
+ <row>
+ <entry align="center">Element</entry>
+ <entry align="left">Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><ids></entry>
+ <entry>List of testcase ids</entry>
+ </row>
+ <row>
+ <entry><keywords></entry>
+ <entry>List of testcase keywords</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </sect2>
+ <sect2>
+ <title>id</title>
+ <para>Testcase id</para>
+ </sect2>
+ <sect2>
+ <title>keyword</title>
+ <para>Testcase keyword</para>
+ </sect2>
+ <sect2>
+ <title>parameter</title>
+ <para>
+ Multi value parameter that will be passed to testsuite execution
+ </para>
+ <example>
+ <programlisting>
+ <![CDATA[
+<parameters>
+ <parameter>
+ <name>parameter1</name>
+ <values>
+ <value>value1</value>
+ <value>value2</value>
+ </values>
+ </parameter>
+ <parameter>
+ <name>parameter2</name>
+ <values>
+ <value>value3</value>
+ <value>value4</value>
+ </values>
+ </parameter>
+</parameters>
+ ]]>
+ </programlisting>
+ </example>
+ <table frame="all">
+ <title><parameter> element</title>
+ <tgroup cols="2" align="left" colsep="1" rowset="1">
+ <colspec colname='c1'/>
+ <colspec colname='c2'/>
+ <thead>
+ <row>
+ <entry align="center">Element</entry>
+ <entry align="left">Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><name></entry>
+ <entry>Parameter name</entry>
+ </row>
+ <row>
+ <entry><values></entry>
+ <entry>List of parameter values</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </sect2>
+ <sect2>
+ <title>property</title>
+ <para>
+ Single value property that will be passed to testsuite execution
+ </para>
+ <example>
+ <programlisting>
+ <![CDATA[
+<properties>
+ <property>
+ <name>sampleProperty</name>
+ <value>propertyValue</value>
+ </property>
+ <property>
+ <name>sampleSecondProperty</name>
+ <value>propertyValue</value>
+ </property>
+</properties>
+
+ ]]>
+ </programlisting>
+ </example>
+ <table frame="all">
+ <title><property> element</title>
+ <tgroup cols="2" align="left" colsep="1" rowset="1">
+ <colspec colname='c1'/>
+ <colspec colname='c2'/>
+ <thead>
+ <row>
+ <entry align="center">Element</entry>
+ <entry align="left">Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><name></entry>
+ <entry>Property name</entry>
+ </row>
+ <row>
+ <entry><value></entry>
+ <entry>Property value</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </sect2>
+ <sect2>
+ <title>reports</title>
+ <para>Reports genration</para>
+ <example>
+ <programlisting>
+ <![CDATA[
+<reports>
+ <xml>target/tests/reports/xml</xml>
+ <html>target/tests/reports/html</html>
+</reports>
+ ]]>
+ </programlisting>
+ </example>
+ <table frame="all">
+ <title><reports> element</title>
+ <tgroup cols="3" align="left" colsep="1" rowset="1">
+ <colspec colname='c1'/>
+ <colspec colname='c2'/>
+ <colspec colname='c3'/>
+ <thead>
+ <row>
+ <entry align="center">Element</entry>
+ <entry align="center">Mandatory</entry>
+ <entry align="left">Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><xml></entry>
+ <entry>No</entry>
+ <entry>Directory to store xml reports in JUnit format</entry>
+ </row>
+ <row>
+ <entry><html></entry>
+ <entry>No</entry>
+ <entry>Directory to store html reports</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </sect2>
+
+
+ </sect1>
+ <sect1>
+ <title>Ant</title>
+ <para>To use JBoss Unit in ant proper task need to be defined</para>
+ <example>
+ <caption>
+ <para>JBoss Unit ant task definition</para>
+ </caption>
+ <programlisting>
+ <![CDATA[
+<path id="jboss.unit.tooling.test.classpath">
+ <pathelement location="jboss-unit-tooling-ant.jar"/>
+ <pathelement location="jboss-unit-tooling-core.jar"/>
+ <!-- ? -->
+</path>
+<taskdef name="jboss-unit" classname="org.jboss.unit.tooling.ant.JBossUnitTask" classpathref="jboss.unit.tooling.test.classpath"/>
+
+ ]]>
+ </programlisting>
+
+ </example>
+ <para>The simplest configuration requires only to specify a single testsuite with a configuration file. You should
+ provide proper classpath to all jars that will be needed by the testsuite. If you leverage microcontainer or remoting
+ support additional jars will be needed.</para>
+ <example>
+ <caption>
+ <para>Simplest ant task configuration</para>
+ </caption>
+ <programlisting>
+ <![CDATA[
+<jboss-unit>
+ <tests config="./jboss-unit.xml"/>
+ <classpath>
+ <pathelement location="jboss-unit.jar"/>
+ <path refid="all.other.needed.dependencies.classpath"/>
+ </classpath>
+</jboss-unit>
+ ]]>
+ </programlisting>
+
+ </example>
+ <para>
+ In ant task you specify <emphasis>tests</emphasis>. Each <emphasis>test</emphasis> has single configuration file
+ and is eqivalent to signle JBoss Unit run. <emphasis>Tests</emphasis> are controled with additional constraints applied with
+ <emphasis>include</emphasis> and <emphasis>exclude</emphasis> elements. In each you can describe testcase to include or exclude
+ from execution by specifying its <emphasis>ids</emphasis> or <emphasis>keywords</emphasis>. Ant task also support
+ parameters and properties mechanisms. Reports generation can be configured either globally or per single testsuite
+ </para>
+
+ <example>
+ <caption>
+ <para>Custom ant task configuration</para>
+ </caption>
+ <programlisting>
+ <![CDATA[
+<jboss-unit>
+
+ <tests config="./jboss-unit.xml" suiteName="MyTests" jpda="false" jpdaPort="9000" jpdaSuspend="true" failOnError="false">
+
+ <!-- executed tests will be based on sum of all applied filters -->
+ <!-- exclude filters will take precedence during conditions check -->
+
+ <include ids="test1,test2,test3" keywords="key1,key2,key3"/>
+ <include id="test55" />
+
+ <exclude ids="biltoTest,oldTest,loloTest" keywords="outdated,examples"/>
+ <exclude id="excludeId" />
+
+ <property name="propertyOne" value="propertyOneValue"/>
+ <property name="propertyTwo" value="propertyTwoValue"/>
+
+ <parameter name="parameterOne>
+ <value>valueOne</value>
+ <value>valueTwo</value>
+ </parameter>
+ <parameter name="parameterTwo>
+ <value>valueOne</value>
+ <value>valueTwo</value>
+ </parameter>
+
+ <!-- reports specified for specific <tests> override global -->
+ <reports noconsole="true">
+ <html dir="">
+ </reports>
+ </tests>
+ <tests config="./jboss-unit2.xml"/>
+ <reports>
+ <xml toDir="./tests/xml"/>
+ <html toDir="./tests/html"/>
+ </reports>
+ <classpath>
+ <path refid="all.other.needed.dependencies.classpath"/>
+ </classpath>
+</jboss-unit>
+ ]]>
+ </programlisting>
+
+ </example>
+
+ <sect2>
+ <title>jboss-unit</title>
+ <table frame="all">
+ <title><jboss-unit> element</title>
+ <tgroup cols="5" align="left" colsep="1" rowset="1">
+ <colspec colname='c1'/>
+ <colspec colname='c2'/>
+ <colspec colname='c3'/>
+ <colspec colname='c4'/>
+ <colspec colname='c5'/>
+ <thead>
+ <row>
+ <entry align="center">Element</entry>
+ <entry align="center">Mandatory</entry>
+ <entry align="left">Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><tests></entry>
+ <entry>Yes</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><reports></entry>
+ <entry>No</entry>
+ <entry>Global reports configuration. It can be overwritten in single testsuite configuration</entry>
+ </row>
+ <row>
+ <entry><classpath></entry>
+ <entry>No</entry>
+ <entry>Ant classpath. All jars needed to run the tests.</entry>
+ </row>
+
+ </tbody>
+ </tgroup>
+ </table>
+ </sect2>
+
+ <sect2>
+ <title>tests</title>
+ <para>Single testsuite definition.</para>
+ <table frame="all">
+ <title><tests> element</title>
+ <tgroup cols="5" align="left" colsep="1" rowset="1">
+ <colspec colname='c1'/>
+ <colspec colname='c2'/>
+ <colspec colname='c3'/>
+ <colspec colname='c4'/>
+ <colspec colname='c5'/>
+ <thead>
+ <row>
+ <entry align="center">Element</entry>
+ <entry align="center">Attribute</entry>
+ <entry align="center">Mandatory</entry>
+ <entry align="center">Default</entry>
+ <entry align="left">Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry/>
+ <entry>config</entry>
+ <entry>Yes</entry>
+ <entry></entry>
+ <entry>JBoss Unit configuration file</entry>
+ </row>
+ <row>
+ <entry/>
+ <entry>suiteName</entry>
+ <entry>No</entry>
+ <entry></entry>
+ <entry>Testsuite name - this will be used in report generation</entry>
+ </row>
+ <row>
+ <entry/>
+ <entry>jpda</entry>
+ <entry>No</entry>
+ <entry>false</entry>
+ <entry>Remote debugging support (Java Platform Debugger Architecture)</entry>
+ </row>
+ <row>
+ <entry/>
+ <entry>jpdaPort</entry>
+ <entry>No</entry>
+ <entry>9000</entry>
+ <entry>JPDA port</entry>
+ </row>
+ <row>
+ <entry/>
+ <entry>jpdaSuspend</entry>
+ <entry>No</entry>
+ <entry>true</entry>
+ <entry>Remote debbugging (JPDA) suspend mode. If true it will suspend the VM and wait for the connection</entry>
+ </row>
+ <row>
+ <entry/>
+ <entry>failOnError</entry>
+ <entry>No</entry>
+ <entry>false</entry>
+ <entry>Any testcase failure will make the ant build fail</entry>
+ </row>
+ <row>
+ <entry><include></entry>
+ <entry/>
+ <entry>No</entry>
+ <entry></entry>
+ <entry>Testcases that will be included in testsuite execution. If defined only those tests will be executed. Excludes check takes precedence.</entry>
+ </row>
+ <row>
+ <entry><exclude></entry>
+ <entry/>
+ <entry>No</entry>
+ <entry></entry>
+ <entry>Testcases that will be excluded from testsuite execution. If defined all testcases besides specified will be executed. Excludes check takes precedence before includes.</entry>
+ </row>
+ <row>
+ <entry><parameter></entry>
+ <entry/>
+ <entry>No</entry>
+ <entry></entry>
+ <entry>Parameters that will be passed to testsuite run</entry>
+ </row>
+ <row>
+ <entry><property></entry>
+ <entry/>
+ <entry>No</entry>
+ <entry>Properties that will be passed to testsuite run</entry>
+ </row>
+ <row>
+ <entry><reports></entry>
+ <entry/>
+ <entry>No</entry>
+ <entry></entry>
+ <entry>Reports generation configuration valid for single testsuite</entry>
+ </row>
+
+ </tbody>
+ </tgroup>
+ </table>
+ </sect2>
+ <sect2>
+ <title>include and exclude</title>
+ <para>Defines testcases to include or exclude from testsuite run</para>
+ <example>
+ <programlisting>
+ <![CDATA[
+<include ids="test1,test2,test3" keywords="key1,key2,key3"/>
+<include id="test55" />
+
+<exclude ids="biltoTest,oldTest,loloTest" keywords="outdated,examples"/>
+<exclude id="excludeId" />
+ ]]>
+ </programlisting>
+ </example>
+ <table frame="all">
+ <title><include> and <exclude> elements</title>
+ <tgroup cols="3" align="left" colsep="1" rowset="1">
+ <colspec colname='c1'/>
+ <colspec colname='c2'/>
+ <colspec colname='c3'/>
+ <thead>
+ <row>
+ <entry align="center">Attribute</entry>
+ <entry align="center">Mandatory</entry>
+ <entry align="left">Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>id</entry>
+ <entry>No. Either <ids> or <id> can be used</entry>
+ <entry>Testcase id</entry>
+ </row>
+ <row>
+ <entry>ids</entry>
+ <entry>No. Either <ids> or <id> can be used</entry>
+ <entry>Coma separated list of testcase ids</entry>
+ </row>
+ <row>
+ <entry>keywords</entry>
+ <entry>No</entry>
+ <entry>Coma separated list of testscase keywords</entry>
+ </row>
+
+
+ </tbody>
+ </tgroup>
+ </table>
+ </sect2>
+ <sect2>
+ <title>property</title>
+ <para>Single value property that will be passed to testsuite execution</para>
+ <example>
+ <programlisting>
+ <![CDATA[
+<property name="propertyOne" value="propertyOneValue"/>
+<property name="propertyTwo" value="propertyTwoValue"/>
+
+ ]]>
+ </programlisting>
+ </example>
+ <table frame="all">
+ <title><property> element</title>
+ <tgroup cols="3" align="left" colsep="1" rowset="1">
+ <colspec colname='c1'/>
+ <colspec colname='c2'/>
+ <colspec colname='c3'/>
+ <thead>
+ <row>
+ <entry align="center">Attribute</entry>
+ <entry align="center">Mandatory</entry>
+ <entry align="left">Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>name</entry>
+ <entry>Yes</entry>
+ <entry>Property name</entry>
+ </row>
+ <row>
+ <entry>value</entry>
+ <entry>Yes</entry>
+ <entry>Property value</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </sect2>
+ <sect2>
+ <title>parameter</title>
+ <para>Multi value parameter that will be passed to testsuite execution</para>
+ <example>
+ <programlisting>
+ <![CDATA[
+<parameter name="parameterOne>
+ <value>valueOne</value>
+ <value>valueTwo</value>
+</parameter>
+
+<parameter name="parameterTwo>
+ <value>valueOne</value>
+ <value>valueTwo</value>
+</parameter>
+ ]]>
+ </programlisting>
+ </example>
+
+ <table frame="all">
+ <title><parameter> element</title>
+ <tgroup cols="4" align="left" colsep="1" rowset="1">
+ <colspec colname='c1'/>
+ <colspec colname='c2'/>
+ <colspec colname='c3'/>
+ <colspec colname='c4'/>
+ <thead>
+ <row>
+ <entry align="center">Element</entry>
+ <entry align="center">Attribute</entry>
+ <entry align="center">Mandatory</entry>
+ <entry align="left">Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry/>
+ <entry>name</entry>
+ <entry>Yes</entry>
+ <entry>Parameter name</entry>
+ </row>
+ <row>
+ <entry>value</entry>
+ <entry/>
+ <entry>Yes</entry>
+ <entry>Parameter value</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </sect2>
+ <sect2>
+ <title>reports</title>
+ <para></para>
+ <example>
+ <programlisting>
+ <![CDATA[
+<!-- reports specified for specific <tests> override global -->
+<reports noconsole="true">
+ <html dir="">
+</reports>
+ ]]>
+ </programlisting>
+ </example>
+
+ <table frame="all">
+ <title><reports> element</title>
+ <tgroup cols="4" align="left" colsep="1" rowset="1">
+ <colspec colname='c1'/>
+ <colspec colname='c2'/>
+ <colspec colname='c3'/>
+ <colspec colname='c4'/>
+ <thead>
+ <row>
+ <entry align="center">Element</entry>
+ <entry align="center">Attribute</entry>
+ <entry align="center">Mandatory</entry>
+ <entry align="left">Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry/>
+ <entry>noconsole</entry>
+ <entry>No</entry>
+ <entry>Disables console output</entry>
+ </row>
+ <row>
+ <entry>html</entry>
+ <entry/>
+ <entry>No</entry>
+ <entry>Directory to store html reports</entry>
+ </row>
+ <row>
+ <entry>xml</entry>
+ <entry/>
+ <entry>No</entry>
+ <entry>Directory to store xml reports in JUnit format</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </sect2>
+
+
+ </sect1>
+ <sect1>
+ <title>Common Ant and Maven options</title>
+ <para>
+ In both ant and maven builds you can force configuration changes from commandline. It is very usefull in situations
+ when you need to run specific tests cases or enable JPDA support just for a single testsuite run without modification
+ in pom.xml or build.xml files.
+ </para>
+ <para>
+ With this approach you can alter JBoss Unit configuration on three levels:
+ <itemizedlist>
+ <listitem><emphasis>jboss-unit.xml</emphasis> configuration file</listitem>
+ <listitem>build file configuration (<emphasis>build.xml</emphasis> or <emphasis>pom.xml</emphasis>)</listitem>
+ <listitem>build framework commanline invocation</listitem>
+ </itemizedlist>
+ </para>
+ <sect2>
+ <title>jboss.unit.tests</title>
+ <para>Execute only specified testcases. Coma separated list of testcase ids should be used as an argument</para>
+ <example>
+ <programlisting>
+ <![CDATA[
+# ant -Djboss.unit.tests=testOne,testTwo
+
+# mvn -Djboss.unit.tests=testCaseThree
+ ]]>
+ </programlisting>
+ </example>
+ </sect2>
+ <sect2>
+ <title>jboss.unit.jpda</title>
+ <para>Enable or disable JPDA support</para>
+ <example>
+ <programlisting>
+ <![CDATA[
+# ant -Djboss.unit.jpda=true
+
+# mvn -Djboss.unit.jpda=false
+ ]]>
+ </programlisting>
+ </example>
+ </sect2>
+ <sect2>
+ <title>jboss.unit.jpda.port</title>
+ <para>Specify port for JPDA connection</para>
+ <example>
+ <programlisting>
+ <![CDATA[
+# ant -Djboss.unit.jpda.port=9999
+
+# mvn -Djboss.unit.jpda.port=8888
+ ]]>
+ </programlisting>
+ </example>
+ </sect2>
+ <sect2>
+ <title>jboss.unit.jpda.suspend</title>
+ <para>JPDA suspend mode</para>
+ <example>
+ <programlisting>
+ <![CDATA[
+# ant -Djboss.unit.suspend=true
+
+# mvn -Djboss.unit.suspend=false
+ ]]>
+ </programlisting>
+ </example>
+ </sect2>
+ <sect2>
+ <title>jboss.unit.assertions</title>
+ <para>Enable or disable Java Assertions</para>
+ <example>
+ <programlisting>
+ <![CDATA[
+# ant -Djboss.unit.assertions=true
+
+# mvn -Djboss.unit.assertions=false
+ ]]>
+ </programlisting>
+ </example>
+ </sect2>
+ <sect2>
+ <title>jboss.unit.failonerror</title>
+ <para>Configure if build should fail on testcase failure</para>
+ <example>
+ <programlisting>
+ <![CDATA[
+# ant -Djboss.unit.failonerror=true
+
+# mvn -Djboss.unit.failonerror=false
+ ]]>
+ </programlisting>
+ </example>
+ </sect2>
+ <sect2>
+ <title>jboss.unit.property</title>
+ <para>Single property value</para>
+ <example>
+ <programlisting>
+ <![CDATA[
+# ant -Djboss.unit.property.name1=value
+
+# mvn -Djboss.unit.property.name2=value2
+ ]]>
+ </programlisting>
+ </example>
+ </sect2>
+ <sect2>
+ <title>jboss.unit.properties</title>
+ <para>Several name=value pairs for properties</para>
+ <example>
+ <programlisting>
+ <![CDATA[
+
+# ant -Djboss.unit.properties=[name1=value1,name2=value2]
+
+# mvn -Djboss.unit.properties=[name1=value1]
+
+ ]]>
+ </programlisting>
+ </example>
+ </sect2>
+ <sect2>
+ <title>jboss.unit.parameter</title>
+ <para>Single parameter values</para>
+ <example>
+ <programlisting>
+ <![CDATA[
+# ant -Djboss.unit.parameter.a=[b,c,d]
+
+# mvn -Djboss.unit.parameter.e=f
+ ]]>
+ </programlisting>
+ </example>
+ </sect2>
+ <sect2>
+ <title>jboss.unit.parameters</title>
+ <para>Several name=value paris for parameters. If single name is specified few times, sum of all
+ provided values will be passed</para>
+ <example>
+ <programlisting>
+ <![CDATA[
+# ant -Djboss.unit.parameters=[name=value1,name=value2,name2=value]
+
+# mvn -Djboss.unit.parameters=[name3=value1]
+ ]]>
+ </programlisting>
+ </example>
+ <para></para>
+ </sect2>
+
+ <!--<sect2>-->
+ <!--<title>jboss.unit.logging</title>-->
+ <!--<para></para>-->
+ <!--</sect2>-->
+
+ </sect1>
+
+
+
+
+
+</chapter>
18 years, 3 months
JBoss Portal SVN: r9622 - modules/portlet/trunk/test/src/test/resources/test.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-01-28 10:00:37 -0500 (Mon, 28 Jan 2008)
New Revision: 9622
Modified:
modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml
Log:
- rollbacked commented tests in jboss unit remote file
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-28 14:58:17 UTC (rev 9621)
+++ modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml 2008-01-28 15:00:37 UTC (rev 9622)
@@ -9,7 +9,6 @@
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-tck-dispatcher.war"/>
</generic>
-<!--
<generic>
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-tck-portletconfig.war"/>
@@ -50,10 +49,8 @@
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-tck-windowstates.war"/>
</generic>
--->
<!--API Tests-->
-<!--
<generic>
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-api-actionrequest.war"/>
@@ -106,10 +103,8 @@
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-api-windowstate.war"/>
</generic>
--->
<!--Ext Tests-->
-<!--
<generic>
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-ext-portletconfig.war"/>
@@ -150,10 +145,8 @@
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-ext-taglib.war"/>
</generic>
--->
<!--Spec TCK Assertions tests-->
-<!--
<generic>
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr286-tck-portletconfig.war"/>
@@ -182,18 +175,14 @@
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr286-tck-resourceserving.war"/>
</generic>
--->
<!--Spec API Assertions tests-->
-<!--
<generic>
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr286-api-event.war"/>
</generic>
--->
<!--Ext Assertions tests-->
-<!--
<generic>
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr286-ext-portletrequests.war"/>
@@ -202,7 +191,6 @@
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr286-ext-portletresponses.war"/>
</generic>
--->
<generic>
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr286-ext-dispatcher.war"/>
18 years, 3 months
JBoss Portal SVN: r9621 - in modules/portlet/trunk: portlet and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-01-28 09:58:17 -0500 (Mon, 28 Jan 2008)
New Revision: 9621
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/ContentBufferTestCase.java
Modified:
modules/portlet/trunk/build/pom.xml
modules/portlet/trunk/portlet/pom.xml
modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml
Log:
- upgraded portlet poms to use servlet 2.5/jsp 2.1
Modified: modules/portlet/trunk/build/pom.xml
===================================================================
--- modules/portlet/trunk/build/pom.xml 2008-01-28 12:26:38 UTC (rev 9620)
+++ modules/portlet/trunk/build/pom.xml 2008-01-28 14:58:17 UTC (rev 9621)
@@ -28,7 +28,8 @@
<version.apache.portals.bridges>1.0.3</version.apache.portals.bridges>
<version.activation>1.0.2</version.activation>
<version.concurrent>1.3.4</version.concurrent>
- <version.sun.servlet>2.4</version.sun.servlet>
+ <version.javax.servlet>2.5</version.javax.servlet>
+ <version.javax.servlet.jsp>2.1</version.javax.servlet.jsp>
<version.apache.tomcat>5.5.12</version.apache.tomcat>
<version.jboss-common-core>2.2.1.GA</version.jboss-common-core>
<version.jboss-logging>2.0.3.GA</version.jboss-logging>
@@ -167,14 +168,14 @@
<version>${version.javassist}</version>
</dependency>
<dependency>
- <groupId>sun-servlet</groupId>
+ <groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
- <version>${version.sun.servlet}</version>
+ <version>${version.javax.servlet}</version>
</dependency>
<dependency>
- <groupId>sun-servlet</groupId>
+ <groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
- <version>${version.sun.servlet}</version>
+ <version>${version.javax.servlet.jsp}</version>
</dependency>
<!--<dependency>-->
<!--<groupId>apache-tomcat</groupId>-->
Modified: modules/portlet/trunk/portlet/pom.xml
===================================================================
--- modules/portlet/trunk/portlet/pom.xml 2008-01-28 12:26:38 UTC (rev 9620)
+++ modules/portlet/trunk/portlet/pom.xml 2008-01-28 14:58:17 UTC (rev 9621)
@@ -32,7 +32,7 @@
<artifactId>web-web</artifactId>
</dependency>
<dependency>
- <groupId>sun-servlet</groupId>
+ <groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
</dependency>
<dependency>
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/ContentBufferTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/ContentBufferTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/ContentBufferTestCase.java 2008-01-28 14:58:17 UTC (rev 9621)
@@ -0,0 +1,196 @@
+/******************************************************************************
+ * 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;
+
+import org.jboss.unit.api.pojo.annotations.Test;
+import org.jboss.portal.portlet.impl.jsr168.ContentBuffer;
+import static org.jboss.unit.api.Assert.*;
+
+import java.io.PrintWriter;
+import java.io.OutputStream;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+@Test
+public class ContentBufferTestCase
+{
+
+ @Test
+ public void testResetChars()
+ {
+ ContentBuffer buffer = new ContentBuffer();
+ buffer.setContentType("text/html");
+ PrintWriter writer = buffer.getWriter();
+ writer.print("foo");
+ buffer.reset();
+ assertChars("", buffer.getChars().getBuffer());
+ }
+
+ @Test
+ public void testResetBytes() throws IOException
+ {
+ ContentBuffer buffer = new ContentBuffer();
+ buffer.setContentType("text/html");
+ OutputStream out = buffer.getOutputStream();
+ out.write("foo".getBytes("UTF8"));
+ buffer.reset();
+ assertEquals(new byte[0], buffer.getBytes().toByteArray());
+ }
+
+ @Test
+ public void testResetAfterCommit()
+ {
+ ContentBuffer buffer = new ContentBuffer();
+ buffer.setContentType("text/html");
+ buffer.commit();
+ try
+ {
+ buffer.reset();
+ fail();
+ }
+ catch (IllegalStateException ignore)
+ {
+ }
+ }
+
+ @Test
+ public void testCommit()
+ {
+ ContentBuffer buffer = new ContentBuffer();
+ buffer.setContentType("text/html");
+ assertFalse(buffer.isCommited());
+ buffer.commit();
+ assertTrue(buffer.isCommited());
+ }
+
+ @Test
+ public void testWriteCharsAfterCommit()
+ {
+ ContentBuffer buffer = new ContentBuffer();
+ buffer.setContentType("text/html");
+ buffer.commit();
+ PrintWriter writer = buffer.getWriter();
+ assertNotNull(writer);
+ writer.print("foo");
+ writer.close();
+ assertChars("foo", buffer.getChars().getBuffer());
+ }
+
+ @Test
+ public void testWriteCharsAndCommit()
+ {
+ ContentBuffer buffer = new ContentBuffer();
+ buffer.setContentType("text/html");
+ PrintWriter writer = buffer.getWriter();
+ assertNotNull(writer);
+ writer.print("foo");
+ buffer.commit();
+ writer.print("bar");
+ writer.close();
+ assertChars("foobar", buffer.getChars().getBuffer());
+ }
+
+ @Test
+ public void testWriteBytesAfterCommit() throws IOException
+ {
+ ContentBuffer buffer = new ContentBuffer();
+ buffer.setContentType("text/html");
+ buffer.commit();
+ OutputStream out = buffer.getOutputStream();
+ assertNotNull(out);
+ out.write("foo".getBytes("UTF8"));
+ out.close();
+ assertEquals("foo".getBytes("UTF8"), buffer.getBytes().toByteArray());
+ }
+
+ @Test
+ public void testWriteBytesAndCommit() throws IOException
+ {
+ ContentBuffer buffer = new ContentBuffer();
+ buffer.setContentType("text/html");
+ buffer.commit();
+ OutputStream out = buffer.getOutputStream();
+ out.write("foo".getBytes("UTF8"));
+ assertNotNull(out);
+ out.write("bar".getBytes("UTF8"));
+ out.close();
+ assertEquals("foobar".getBytes("UTF8"), buffer.getBytes().toByteArray());
+ }
+
+ @Test
+ public void testFlushWriterDoesCommit()
+ {
+ ContentBuffer buffer = new ContentBuffer();
+ buffer.setContentType("text/html");
+ PrintWriter writer = buffer.getWriter();
+ writer.print("foo");
+ writer.flush();
+ assertTrue(buffer.isCommited());
+ }
+
+ @Test
+ public void testCloseWriterDoesCommit()
+ {
+ ContentBuffer buffer = new ContentBuffer();
+ buffer.setContentType("text/html");
+ PrintWriter writer = buffer.getWriter();
+ writer.print("foo");
+ writer.close();
+ assertTrue(buffer.isCommited());
+ }
+
+ @Test
+ public void testFlushStreamDoesCommit() throws IOException
+ {
+ ContentBuffer buffer = new ContentBuffer();
+ buffer.setContentType("text/html");
+ OutputStream out = buffer.getOutputStream();
+ out.write("foo".getBytes("UTF8"));
+ out.flush();
+ assertTrue(buffer.isCommited());
+ }
+
+ @Test
+ public void testClosestreamDoesCommit() throws IOException
+ {
+ ContentBuffer buffer = new ContentBuffer();
+ buffer.setContentType("text/html");
+ OutputStream out = buffer.getOutputStream();
+ out.write("foo".getBytes("UTF8"));
+ out.close();
+ assertTrue(buffer.isCommited());
+ }
+
+ private void assertChars(String s, StringBuffer sb)
+ {
+ int length = s.length();
+ assertEquals(length, sb.length());
+ char[] chars = new char[length];
+ sb.getChars(0, length, chars, 0);
+ assertEquals(s, new String(chars));
+ }
+
+}
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-28 12:26:38 UTC (rev 9620)
+++ modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml 2008-01-28 14:58:17 UTC (rev 9621)
@@ -9,6 +9,7 @@
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-tck-dispatcher.war"/>
</generic>
+<!--
<generic>
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-tck-portletconfig.war"/>
@@ -49,8 +50,10 @@
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-tck-windowstates.war"/>
</generic>
+-->
<!--API Tests-->
+<!--
<generic>
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-api-actionrequest.war"/>
@@ -103,8 +106,10 @@
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-api-windowstate.war"/>
</generic>
+-->
<!--Ext Tests-->
+<!--
<generic>
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-ext-portletconfig.war"/>
@@ -145,8 +150,10 @@
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr168-ext-taglib.war"/>
</generic>
+-->
<!--Spec TCK Assertions tests-->
+<!--
<generic>
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr286-tck-portletconfig.war"/>
@@ -175,14 +182,18 @@
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr286-tck-resourceserving.war"/>
</generic>
+-->
<!--Spec API Assertions tests-->
+<!--
<generic>
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr286-api-event.war"/>
</generic>
+-->
<!--Ext Assertions tests-->
+<!--
<generic>
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr286-ext-portletrequests.war"/>
@@ -191,6 +202,7 @@
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr286-ext-portletresponses.war"/>
</generic>
+-->
<generic>
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr286-ext-dispatcher.war"/>
18 years, 3 months