[jboss-cvs] JBossAS SVN: r58279 - in trunk/testsuite: imports/sections src/main/org/jboss/test/web/servlets src/main/org/jboss/test/web/test src/resources/web src/resources/web/META-INF src/resources/web/WEB-INF src/resources/web/classpath

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Nov 11 22:47:35 EST 2006


Author: scott.stark at jboss.org
Date: 2006-11-11 22:47:28 -0500 (Sat, 11 Nov 2006)
New Revision: 58279

Added:
   trunk/testsuite/src/main/org/jboss/test/web/test/ClasspathUnitTestCase.java
   trunk/testsuite/src/resources/web/classpath/
   trunk/testsuite/src/resources/web/classpath/application.xml
   trunk/testsuite/src/resources/web/classpath/web.xml
Removed:
   trunk/testsuite/src/resources/web/META-INF/application-mf.xml
   trunk/testsuite/src/resources/web/WEB-INF/manifest-web.xml
Modified:
   trunk/testsuite/imports/sections/web.xml
   trunk/testsuite/src/main/org/jboss/test/web/servlets/ClasspathServlet.java
Log:
Factor the classpath tests into a separate unit test

Modified: trunk/testsuite/imports/sections/web.xml
===================================================================
--- trunk/testsuite/imports/sections/web.xml	2006-11-12 02:03:46 UTC (rev 58278)
+++ trunk/testsuite/imports/sections/web.xml	2006-11-12 03:47:28 UTC (rev 58279)
@@ -62,13 +62,19 @@
       </manifest>
       <war warfile="${build.lib}/manifest-web.war"
          manifest="${build.resources}/manifest-web.mf"
-         webxml="${build.resources}/web/WEB-INF/manifest-web.xml">
+         webxml="${build.resources}/web/classpath/web.xml">
+         <classes dir="${build.classes}">
+            <include name="org/jboss/test/web/servlets/ClasspathServlet.class"/>
+         </classes>
+         <lib dir="${build.lib}">
+            <include name="jbosstest-web-libservlet.jar"/>
+         </lib>
          <fileset dir="${build.resources}/web/html/manifest">
             <include name="**/*.jsp"/>
          </fileset>
       </war>
       <ear earfile="${build.lib}/manifest-web.ear"
-         appxml="${build.resources}/web/META-INF/application-mf.xml">
+         appxml="${build.resources}/web/classpath/application.xml">
          <fileset dir="${build.lib}">
             <include name="manifest-web.war"/>
             <include name="jbosstest-web-util.jar"/>

Modified: trunk/testsuite/src/main/org/jboss/test/web/servlets/ClasspathServlet.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/web/servlets/ClasspathServlet.java	2006-11-12 02:03:46 UTC (rev 58278)
+++ trunk/testsuite/src/main/org/jboss/test/web/servlets/ClasspathServlet.java	2006-11-12 03:47:28 UTC (rev 58279)
@@ -50,6 +50,8 @@
  */
 public class ClasspathServlet extends HttpServlet
 {
+   private static final long serialVersionUID = 1;
+
    private static Logger log = Logger.getLogger(ClasspathServlet.class);
 
    private StringBuffer initInfo = new StringBuffer();

Added: trunk/testsuite/src/main/org/jboss/test/web/test/ClasspathUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/web/test/ClasspathUnitTestCase.java	2006-11-12 02:03:46 UTC (rev 58278)
+++ trunk/testsuite/src/main/org/jboss/test/web/test/ClasspathUnitTestCase.java	2006-11-12 03:47:28 UTC (rev 58279)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * 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.web.test;
+
+import java.net.URL;
+
+import junit.framework.Test;
+
+import org.apache.commons.httpclient.Header;
+import org.apache.commons.httpclient.HttpMethodBase;
+import org.jboss.test.JBossTestCase;
+import org.jboss.test.util.web.HttpUtils;
+
+/** Tests of web app classpath issues
+ 
+ @author Scott.Stark at jboss.org
+ @version $Revision: 42698 $
+ */
+public class ClasspathUnitTestCase extends JBossTestCase
+{
+   private String baseURL = HttpUtils.getBaseURL(); 
+   
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(UserInRoleUnitTestCase.class, "manifest-web.ear");
+   }
+
+   public ClasspathUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   /** Test of a war that accesses classes referred to via the war manifest
+    * classpath. Access the http://{host}/manifest/classpath.jsp
+    */
+   public void testWarManifest() throws Exception
+   {
+      URL url = new URL(baseURL+"manifest/classpath.jsp");
+      HttpMethodBase request = HttpUtils.accessURL(url);
+      Header errors = request.getResponseHeader("X-Exception");
+      log.info("X-Exception: "+errors);
+      assertTrue("X-Exception("+errors+") is null", errors == null);
+   }
+
+   /** Access the http://{host}/manifest/ClassesServlet
+    */
+   public void testClassesServlet()
+      throws Exception
+   {
+      URL url = new URL(baseURL+"manifest/ClassesServlet");
+      HttpMethodBase request = HttpUtils.accessURL(url);
+      Header errors = request.getResponseHeader("X-Exception");
+      log.info("X-Exception: "+errors);
+      assertTrue("X-Exception("+errors+") is null", errors == null);      
+   }
+
+   /** Access the http://{host}/manifest/LibServlet
+    */
+   public void testLibServlet()
+      throws Exception
+   {
+      URL url = new URL(baseURL+"manifest/LibServlet");
+      HttpMethodBase request = HttpUtils.accessURL(url);
+      Header errors = request.getResponseHeader("X-Exception");
+      log.info("X-Exception: "+errors);
+      assertTrue("X-Exception("+errors+") is null", errors == null);      
+   }
+}

Deleted: trunk/testsuite/src/resources/web/META-INF/application-mf.xml
===================================================================
--- trunk/testsuite/src/resources/web/META-INF/application-mf.xml	2006-11-12 02:03:46 UTC (rev 58278)
+++ trunk/testsuite/src/resources/web/META-INF/application-mf.xml	2006-11-12 03:47:28 UTC (rev 58279)
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<application>
-    <display-name>JBossTest Web Container Testsuite</display-name>
-
-    <module>
-       <web>
-           <description>Another war to test manifest classpath</description>
-           <web-uri>manifest-web.war</web-uri>
-           <context-root>/manifest</context-root>
-       </web>
-    </module>
-
-</application>
-

Deleted: trunk/testsuite/src/resources/web/WEB-INF/manifest-web.xml
===================================================================
--- trunk/testsuite/src/resources/web/WEB-INF/manifest-web.xml	2006-11-12 02:03:46 UTC (rev 58278)
+++ trunk/testsuite/src/resources/web/WEB-INF/manifest-web.xml	2006-11-12 03:47:28 UTC (rev 58279)
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!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>
-   <description>A war that references classes via a manifest Class-Path</description>
-</web-app>

Added: trunk/testsuite/src/resources/web/classpath/application.xml
===================================================================
--- trunk/testsuite/src/resources/web/classpath/application.xml	2006-11-12 02:03:46 UTC (rev 58278)
+++ trunk/testsuite/src/resources/web/classpath/application.xml	2006-11-12 03:47:28 UTC (rev 58279)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<application>
+    <display-name>JBossTest Web Container Testsuite</display-name>
+
+    <module>
+       <web>
+           <description>Another war to test manifest classpath</description>
+           <web-uri>manifest-web.war</web-uri>
+           <context-root>/manifest</context-root>
+       </web>
+    </module>
+
+</application>

Added: trunk/testsuite/src/resources/web/classpath/web.xml
===================================================================
--- trunk/testsuite/src/resources/web/classpath/web.xml	2006-11-12 02:03:46 UTC (rev 58278)
+++ trunk/testsuite/src/resources/web/classpath/web.xml	2006-11-12 03:47:28 UTC (rev 58279)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+   http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
+   <description>Webapp classpath tests</description>
+   <display-name>ClasspathWebApp</display-name>
+   
+   <servlet>
+      <description>A servlet in WEB-INF/classes</description>
+      <servlet-name>ClassesServlet</servlet-name>
+      <servlet-class>org.jboss.test.web.servlets.ClasspathServlet</servlet-class>
+   </servlet>
+   <servlet>
+      <description>A servlet in WEB-INF/lib/jbosstest-web-libservlet.jar</description>
+      <servlet-name>LibServlet</servlet-name>
+      <servlet-class>org.jboss.test.web.servlets.lib.SimpleServlet</servlet-class>
+   </servlet>
+   <servlet>
+      <description>A jsp file that access various classes in the war classpath</description>
+      <servlet-name>ClasspathJSP</servlet-name>
+      <jsp-file>/classpath.jsp</jsp-file>
+   </servlet>
+
+   <servlet-mapping>
+      <servlet-name>ClassesServlet</servlet-name>
+      <url-pattern>/ClassesServlet</url-pattern>
+   </servlet-mapping>
+   <servlet-mapping>
+      <servlet-name>LibServlet</servlet-name>
+      <url-pattern>/LibServlet</url-pattern>
+   </servlet-mapping>
+   <servlet-mapping>
+      <servlet-name>ClasspathJSP</servlet-name>
+      <url-pattern>/ClasspathJSP</url-pattern>
+   </servlet-mapping>
+
+</web-app>




More information about the jboss-cvs-commits mailing list