Author: julien(a)jboss.com
Date: 2008-01-27 08:39:31 -0500 (Sun, 27 Jan 2008)
New Revision: 9617
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/TaglibTestCase.java
modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/
modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/WEB-INF/
modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/WEB-INF/portlet.xml
modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/WEB-INF/web.xml
modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/usetaglib.jsp
Modified:
modules/portlet/trunk/test/src/test/build.xml
modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml
Log:
added basic test case for JSR 168 taglib
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/TaglibTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/TaglibTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/TaglibTestCase.java 2008-01-27
13:39:31 UTC (rev 9617)
@@ -0,0 +1,78 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.ext.taglib;
+
+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.ServletServiceTestAction;
+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.PortletTestContext;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletSession;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletException;
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.io.IOException;
+
+/**
+ * The goal is to test that cross context session attributes are set in container and are
accessible from the direct
+ * servlet.
+ * <p/>
+ * 1/ portlet put key=value in the http session 2/ portlet ask the client to perform get
on /servlet 3/ servlet check
+ * that key=value
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+@TestCase
+public class TaglibTestCase
+{
+ public TaglibTestCase(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
+ {
+ response.setContentType("text/html");
+ PortletRequestDispatcher dispatcher =
((AbstractUniversalTestPortlet)portlet).getPortletContext().getRequestDispatcher("/usetaglib.jsp");
+ dispatcher.include(request, response);
+ return new EndTestResponse();
+ }
+ });
+ }
+}
\ No newline at end of file
Modified: modules/portlet/trunk/test/src/test/build.xml
===================================================================
--- modules/portlet/trunk/test/src/test/build.xml 2008-01-25 22:38:16 UTC (rev 9616)
+++ modules/portlet/trunk/test/src/test/build.xml 2008-01-27 13:39:31 UTC (rev 9617)
@@ -176,6 +176,12 @@
<!--Portlet test framework lib jar-->
<jar
jarfile="${test.temp.lib}/portal-portlet-test-framework-lib.jar">
<fileset dir="${test.temp.portlet}"
includes="org/jboss/portal/unit/**"/>
+
+ <!-- JSR 168 TLD -->
+ <zipfileset
+ src="${dependency.portal-portlet.jar}"
+ includes="org/jboss/portal/portlet/portlet.tld"
+ fullpath="META-INF/portlet.tld"/>
</jar>
<!--<jar jarfile="${test.temp.lib}/test-info.jar">-->
@@ -228,6 +234,7 @@
<package-ext-test test="portletmode"/>
<package-ext-test test="portletconfig"/>
<package-ext-test test="dispatcher"/>
+ <package-ext-test test="taglib"/>
<package-misc-test test="log4j"/>
@@ -313,7 +320,6 @@
<pathelement path="${dependency.jboss-kernel.jar}"/>
</path>
<path id="mc.portal-common">
- <!--<pathelement
path="${dependency.portal-common.jar}"/>-->
<pathelement path="${dependency.portal-common-mc.jar}"/>
</path>
<path id="mc.jboss-unit">
@@ -332,9 +338,6 @@
<path id="mc.log4j">
<pathelement path="${dependency.log4j.jar}"/>
</path>
- <path id="mc.portal-portlet">
- <pathelement path="${dependency.portal-portlet.jar}"/>
- </path>
<path id="mc.jaxb-api">
<pathelement path="${dependency.jaxb-api.jar}"/>
</path>
@@ -346,7 +349,7 @@
<fileset dir="${test.temp.lib}"
includes="portlet-test-lib.jar"/>
<path refid="mc.portal-common"/>
- <path refid="mc.portal-portlet"/>
+ <!--<path
location="${dependency.portal-portlet.jar}"/>-->
<!-- Remote plugin -->
<path refid="mc.jboss-remoting"/>
@@ -377,9 +380,8 @@
<!-- -->
<fileset dir="${test.temp.lib}"
includes="portlet-test-lib.jar"/>
-
+
<path refid="mc.portal-common"/>
- <path refid="mc.portal-portlet"/>
<!-- Remote plugin -->
<path refid="mc.jboss-remoting"/>
@@ -437,13 +439,17 @@
wait="${cargo.wait}">
<!--<sysproperty key="java.io.tmpdir"
value="${target}/cargo-tmp"/>-->
<sharedClasspath>
+
<path location="${dependency.portal-common.jar}"/>
<path location="${dependency.portal-common-portal.jar}"/>
+ <path location="${dependency.portal-portlet.jar}"/>
+ <path location="${dependency.portal-web.jar}"/>
+ <path location="${dependency.jsr168api.jar}"/>
+
<path location="${dependency.jboss-unit.jar}"/>
<path location="${dependency.jboss-unit-remote.jar}"/>
<path location="${dependency.portal-test.jar}"/>
- <path location="${dependency.portal-web.jar}"/>
- <path location="${dependency.jsr168api.jar}"/>
+
</sharedClasspath>
<configuration home="${test.jboss-4.2.tempdir}">
<property name="cargo.servlet.port" value="8080"/>
@@ -532,19 +538,22 @@
action="start"
wait="${cargo.wait}">
<sharedClasspath>
+
+ <path location="${dependency.log4j.jar}"/>
+ <path location="${dependency.concurrent.jar}"/>
+ <path location="${dependency.activation.jar}"/>
+ <path location="${dependency.jaxb-api.jar}"/>
+
<path location="${dependency.portal-common.jar}"/>
<path location="${dependency.portal-common-portal.jar}"/>
+ <path location="${dependency.portal-portlet.jar}"/>
+ <path location="${dependency.portal-web.jar}"/>
+ <path location="${dependency.jsr168api.jar}"/>
+
<path location="${dependency.jboss-unit.jar}"/>
<path location="${dependency.jboss-unit-remote.jar}"/>
<path location="${dependency.portal-test.jar}"/>
- <path location="${dependency.portal-web.jar}"/>
- <path location="${dependency.jsr168api.jar}"/>
- <path location="${dependency.log4j.jar}"/>
- <path location="${dependency.concurrent.jar}"/>
- <path location="${dependency.activation.jar}"/>
- <path location="${dependency.jaxb-api.jar}"/>
-
</sharedClasspath>
<configuration>
<property name="cargo.servlet.port" value="8080"/>
Added:
modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/WEB-INF/portlet.xml
===================================================================
---
modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/WEB-INF/portlet.xml
(rev 0)
+++
modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/WEB-INF/portlet.xml 2008-01-27
13:39:31 UTC (rev 9617)
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<portlet-app
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1...
http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ version="1.0">
+
+ <portlet>
+ <portlet-name>UniversalTestPortletA</portlet-name>
+
<portlet-class>org.jboss.portal.test.portlet.framework.UTP1</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title></title>
+ </portlet-info>
+ </portlet>
+
+
+</portlet-app>
Added:
modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/WEB-INF/web.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/WEB-INF/web.xml
(rev 0)
+++
modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/WEB-INF/web.xml 2008-01-27
13:39:31 UTC (rev 9617)
@@ -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>
Added: modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/usetaglib.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/usetaglib.jsp
(rev 0)
+++
modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/usetaglib.jsp 2008-01-27
13:39:31 UTC (rev 9617)
@@ -0,0 +1,5 @@
+<%@ page language="java" %>
+<%@ taglib
uri="http://java.sun.com/portlet" prefix="portlet"
%>
+<portlet:defineObjects/>
+<%
+%>
\ No newline at end of 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-25
22:38:16 UTC (rev 9616)
+++ modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml 2008-01-27
13:39:31 UTC (rev 9617)
@@ -145,6 +145,10 @@
<class
name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId"
value="test-jsr168-ext-nocache.war"/>
</generic>
+ <generic>
+ <class
name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
+ <property name="archiveId"
value="test-jsr168-ext-taglib.war"/>
+ </generic>
<!--Spec TCK Assertions tests-->
<generic>