[PATCH] support for missing test: GetResourcePathsTest

"Immanuel, Gidado-Yisa" <[email protected]> Tue, 4 Jun 2002 13:20:46 -0400
Newsgroups gmane.comp.jakarta.watchdog.devel
Message-ID <[email protected]>
Crossposting to tomcat-dev as this should be of interest

I did not see an support for the (watchdog) testing of the method:

  ServletContext.getResourcePaths()

So I've created the necessary tests, which are attached
as (watchdog-patches0.txt).  I wasn't clear on how to
create a patch that included a new file, so I put all
the new files in the attached (watchdog-added.zip). Will
add this info to bugzilla (when it becomes available).

Note that I had to create the new directory "getResourcePaths"
in servlet-tests/WEB-INF that is reserved for GetResourcePathsTest.
This new path has a subdirectory, 'empty' which is empty.  This
empty dir did not get picked up in the zip (neither would it be
picked up in cvs if 'prune empty directories' is set). To accomadate
for that, the build file creates the empty directory at build time.

This is what the test checks for:
  1. for a path argument of 'null', it expects a null
  2. for a path arguments with consecutive '//', it expects
     these to be canonicalized to '/' in the returned paths.
  3. For a path argment that does not exist, it expects null
  4. For a path argment that does not contain anything, it
     expects an empty set

Anyway, adding this test will mean that Tomcat 4 does not pass.
But that patch is coming shortly.

- Gidado

--
To unsubscribe, e-mail:   <mailto:[email protected]>
For additional commands, e-mail: <mailto:[email protected]>
watchdog-patch0.txt (text/plain, 4.3 KB)
Index: build.xml
===================================================================
RCS file: /home/cvspublic/jakarta-watchdog-4.0/build.xml,v
retrieving revision 1.20
diff -u -r1.20 build.xml
--- build.xml	22 May 2002 03:04:00 -0000	1.20
+++ build.xml	4 Jun 2002 16:43:23 -0000
@@ -72,6 +72,7 @@
     <mkdir dir="${watchdog.build}/webapps/servlet-tests/WEB-INF"/>
     <mkdir dir="${watchdog.build}/webapps/servlet-tests/WEB-INF/classes"/>
     <mkdir dir="${watchdog.build}/webapps/servlet-tests/WEB-INF/lib"/>
+    <mkdir dir="${watchdog.build}/webapps/servlet-tests/WEB-INF/getResourcePaths/empty"/>
     <mkdir dir="${watchdog.build}/webapps/servlet-compat"/>
     <mkdir dir="${watchdog.build}/webapps/servlet-compat/WEB-INF"/>
     <mkdir dir="${watchdog.build}/webapps/servlet-compat/WEB-INF/classes"/>
Index: src/conf/servlet-gtest.xml
===================================================================
RCS file: /home/cvspublic/jakarta-watchdog-4.0/src/conf/servlet-gtest.xml,v
retrieving revision 1.43
diff -u -r1.43 servlet-gtest.xml
--- src/conf/servlet-gtest.xml	22 May 2002 02:54:17 -0000	1.43
+++ src/conf/servlet-gtest.xml	4 Jun 2002 16:44:06 -0000
@@ -258,6 +258,14 @@
             testStrategy="A negative test for getResourceAsStream() method"
         />
 
+        <watchdog request="GET /servlet-tests/GetResourcePathsTest HTTP/1.0"
+            testName="GetResourcePathsTest" debug="0"
+            host="${host}" port="${port}" exactMatch="true"
+            goldenFile="${wgdir}/javax_servlet/ServletContext/GetResourcePathsTest.html"
+            assertion="Returns a list of resource paths for the specified path, specified in the Java Servlet Pages Specification v2.3, Sec 14.2.8"
+            testStrategy="A Test for ServletContext.getResourcePaths(String) method"
+        />
+
         <watchdog request="GET /servlet-tests/GetResourceTest HTTP/1.0"
             testName="GetResourceTest" debug="0"
             host="${host}" port="${port}" exactMatch="true"
@@ -3345,6 +3353,16 @@
             goldenFile="${wgdir}/javax_servlet/ServletContext/GetResourceAsStream_1Test.html"
             assertion="Returns null if no resource exists at the specified path, specified in the Java Servlet Pages Specification v2.3,  Sec 14"
             testStrategy="A negative test for getResourceAsStream() method"
+        />
+    </target>
+
+    <target name="GetResourcePathsTest">
+        <watchdog request="GET /servlet-tests/GetResourcePathsTest HTTP/1.0"
+            testName="GetResourcePathsTest" debug="0"
+            host="${host}" port="${port}" exactMatch="true"
+            goldenFile="${wgdir}/javax_servlet/ServletContext/GetResourcePathsTest.html"
+            assertion="Returns a list of resource paths for the specified path, specified in the Java Servlet Pages Specification v2.3, Sec 14.2.8"
+            testStrategy="A Test for ServletContext.getResourcePaths(String) method"
         />
     </target>
Index: src/server/servlet-tests/WEB-INF/web.xml
===================================================================
RCS file: /home/cvspublic/jakarta-watchdog-4.0/src/server/servlet-tests/WEB-INF/web.xml,v
retrieving revision 1.11
diff -u -r1.11 web.xml
--- src/server/servlet-tests/WEB-INF/web.xml	1 Feb 2002 01:14:53 -0000	1.11
+++ src/server/servlet-tests/WEB-INF/web.xml	4 Jun 2002 16:45:04 -0000
@@ -568,6 +568,12 @@
     <load-on-startup>0</load-on-startup>
   </servlet>
   <servlet>
+    <servlet-name>GetResourcePathsTest</servlet-name>
+    <display-name>GetResourcePathsTest</display-name>
+    <servlet-class>tests.javax_servlet.ServletContext.GetResourcePathsTestServlet</servlet-class>
+    <load-on-startup>0</load-on-startup>
+  </servlet>
+  <servlet>
     <servlet-name>ServletContextSetAttributeTest</servlet-name>
     <display-name>ServletContextSetAttributeTest</display-name>
     <servlet-class>tests.javax_servlet.ServletContext.ServletContextSetAttributeTestServlet</servlet-class>
@@ -2789,6 +2795,10 @@
   <servlet-mapping>
     <servlet-name>GetResourceAsStreamTest</servlet-name>
     <url-pattern>/GetResourceAsStreamTest</url-pattern>
+  </servlet-mapping>
+  <servlet-mapping>
+    <servlet-name>GetResourcePathsTest</servlet-name>
+    <url-pattern>/GetResourcePathsTest</url-pattern>
   </servlet-mapping>
   <servlet-mapping>
     <servlet-name>ServletContextSetAttributeTest</servlet-name>
watchdog-added.zip (application/octet-stream, 172.1 KB) - not displayed