You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by la...@locus.apache.org on 2000/08/29 07:27:32 UTC

cvs commit: jakarta-tomcat/src/etc test-tomcat.xml

larryi      00/08/28 22:27:31

  Modified:    src/etc  Tag: tomcat_32 test-tomcat.xml
  Log:
  Added tests for WEB-INF and META-INF blocking as well as unavailable servlet
  behavior.
  
  Separated tests which have different reponses between Tomcat and Apache.
  The default and "client" targets include the Tomcat specific tests with the
  common ones.  The "apache" and "client-apache" targets include the Apache
  specific tests with the common ones.
  
  Tomcat passes all tests, as does Apache with JServ.  Apache with mod_jk has
  serveral failures that I haven't tracked down yet.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.20.2.1  +199 -30   jakarta-tomcat/src/etc/test-tomcat.xml
  
  Index: test-tomcat.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/etc/test-tomcat.xml,v
  retrieving revision 1.20
  retrieving revision 1.20.2.1
  diff -u -r1.20 -r1.20.2.1
  --- test-tomcat.xml	2000/05/24 04:41:49	1.20
  +++ test-tomcat.xml	2000/08/29 05:27:31	1.20.2.1
  @@ -1,9 +1,18 @@
  -<project name="TestRun" default="main" init="init">
  +<project name="TestRun" default="main">
      <!-- To test tomcat standalone, type:
             bin/tomcat.sh ant -f conf/test-tomcat.xml client
  +        or for Windows systems, type:
  +          bin\tomcat.bat ant -f conf/test-tomcat.xml client
           
           To test apache, type:
  -          bin/tomcat.sh ant -f conf/test-tomcat.xml -Dport=8001 -Dhttp.protocol=HTTP/1.1 client
  +          bin/tomcat.sh ant -f conf/test-tomcat.xml -Dport=<your port> -Dhttp.protocol=HTTP/1.1 client-apache
  +        or for Windows systems, type:
  +          bin/tomcat.bat ant -f conf/test-tomcat.xml -Dport=<your port> -Dhttp.protocol=HTTP/1.1 client-apache
  +	  Specify <your port> from "Port" setting in apache's httpd.conf file.
  +
  +        Works best if you manually start tomcat, and if necessary apache.  If you use this file's
  +        "main" or "apache" targets, tomcat may not start fast enough to avoid failing some of the
  +        early tests.
       -->
     
      <target name="init">
  @@ -27,6 +36,9 @@
              goldenFile="${gdir}/image1.gif"
              exactMatch="true"  />
   
  +   </target>
  +
  +  <target name="file-tomcat" depends="file">
       <gtest host="${host}" port="${port}"  description="Welcome File Test1"
              request="GET /test/welcome HTTP/1.0"
              expectHeaders="Location:/welcome/" 
  @@ -35,26 +47,32 @@
       <gtest host="${host}" port="${port}"  description="Welcome File Test2"
              request="GET /test/binaries HTTP/1.0"
              returnCode="${http.protocol} 200" />
  - 
  +
  +    <gtest host="${host}" port="${port}"  description="Welcome File Test3"
  +           request="GET /test/welcome/ HTTP/1.0"
  +           returnCode="${http.protocol} 302" 
  +           goldenFile="${gdir}/movedwelcome.txt" />
  +  </target>
  +
  +  <target name="file-apache" depends="file">
  +    <gtest host="${host}" port="${port}"  description="Welcome File Test1"
  +           request="GET /test/welcome HTTP/1.0"
  +           expectHeaders="Location:/welcome/" 
  +           returnCode="${http.protocol} 301" />
  +
  +    <gtest host="${host}" port="${port}"  description="Welcome File Test2"
  +           request="GET /test/binaries HTTP/1.0"
  +           returnCode="${http.protocol} 301" />
  +
  +    <!-- Tomcat returns 302 --> 
       <gtest host="${host}" port="${port}"  description="Welcome File Test3"
              request="GET /test/welcome/ HTTP/1.0"
              returnCode="${http.protocol} 200" 
              goldenFile="${gdir}/welcome.txt" />
  - 
  -   </target>
  +  </target>
   
     <!-- ==================== Dispatch tests ==================== -->
       <target name="dispatch">
  -      <gtest host="${host}" port="${port}"  description="SimpleRedirect"
  -             request="GET /test/servlet/dispatch.SimpleRedirectServlet?/index.html HTTP/1.0"
  -             expectHeaders="Location:http://${host}:${port}/index.html" 
  -             returnCode="${http.protocol} 302" 
  -       />
  -      <gtest host="${host}" port="${port}"  description="SimpleRedirect2"
  -             request="GET /test/servlet/dispatch.SimpleRedirectServlet?index.html HTTP/1.0"
  -             expectHeaders="Location:http://${host}:${port}/test/servlet/index.html" 
  -             returnCode="${http.protocol} 302" 
  -       />
         <gtest host="${host}" port="${port}"  description="SimpleInclude"
                request="GET /test/servlet/dispatch.SimpleIncludeServlet HTTP/1.0"
                expectHeaders="Content-Type:text/foobar" 
  @@ -124,6 +142,30 @@
   
       </target>
   
  +    <target name="dispatch-tomcat" depends="dispatch">
  +      <gtest host="${host}" port="${port}"  description="SimpleRedirect"
  +             request="GET /test/servlet/dispatch.SimpleRedirectServlet?/index.html HTTP/1.0"
  +             expectHeaders="Location:http://${host}:${port}/index.html" 
  +             returnCode="${http.protocol} 302" 
  +       />
  +      <gtest host="${host}" port="${port}"  description="SimpleRedirect2"
  +             request="GET /test/servlet/dispatch.SimpleRedirectServlet?index.html HTTP/1.0"
  +             expectHeaders="Location:http://${host}:${port}/test/servlet/index.html" 
  +             returnCode="${http.protocol} 302" 
  +       />
  +    </target>
  +
  +    <target name="dispatch-apache" depends="dispatch">
  +      <gtest host="${host}" port="${port}"  description="SimpleRedirect"
  +             request="GET /test/servlet/dispatch.SimpleRedirectServlet?/index.html HTTP/1.0"
  +             returnCode="${http.protocol} 302" 
  +       />
  +      <gtest host="${host}" port="${port}"  description="SimpleRedirect2"
  +             request="GET /test/servlet/dispatch.SimpleRedirectServlet?index.html HTTP/1.0"
  +             returnCode="${http.protocol} 302" 
  +       />
  +    </target>
  +
     <!-- ==================== Jsp tests ==================== -->
     <target name="jsp">
       <gtest host="${host}" port="${port}"  request="GET /test/jsp/HelloWorld.jsp HTTP/1.0"
  @@ -134,11 +176,6 @@
              returnCode="${http.protocol} 200"
              magnitude="false" />
   
  -    <gtest host="${host}" port="${port}"  request="GET /test/jsp/ HTTP/1.0"
  -           goldenFile="${gdir}/index.txt"  
  -           description="Serves index.html"
  -    />
  -
       <gtest host="${host}" port="${port}"  request="GET /test/jsp HTTP/1.0"
              returnCode="${http.protocol} 200"
              description="Getting -- HTTP/1.0 302 Found"
  @@ -397,6 +434,22 @@
   
      </target>
   
  +  <target name="jsp-tomcat" depends="jsp">
  +    <gtest host="${host}" port="${port}"  request="GET /test/jsp/ HTTP/1.0"
  +           goldenFile="${gdir}/movedindex.txt"  
  +           description="Redirects to index.html"
  +    />
  +
  +   </target>
  +
  +  <target name="jsp-apache" depends="jsp">
  +    <gtest host="${host}" port="${port}"  request="GET /test/jsp/ HTTP/1.0"
  +           goldenFile="${gdir}/index.txt"  
  +           description="Serves index.html"
  +    />
  +
  +   </target>
  +
     <target name="wrong_request">
       <gtest host="${host}" port="${port}"  request="GET /test/*.jsp HTTP/1.0"
              returnCode="${http.protocol} 200"
  @@ -426,6 +479,10 @@
   
   
      <target name="get">
  +      <!-- hit unavailable servlet 1st time -->
  +      <gtest host="${host}" port="${port}"  request="GET /test/servlet/Unavailable HTTP/1.0"
  +             returnCode="${http.protocol} 503"
  +      />
         <gtest host="${host}" port="${port}"  request="GET /test/servlet/Cookie25 HTTP/1.0"
                expectHeaders="Set-Cookie2:foo=bar;Version=1;Max-Age=8640000"
         />
  @@ -452,21 +509,20 @@
                returnCode="Error: "
                magnitude="false" / -->
   
  -      <gtest host="${host}" port="${port}"  request="GET /test/ HTTP/1.0"
  -             returnCode="${http.protocol} 200"
  -      />
  -
  +      <!-- tolerate for now
         <gtest host="${host}" port="${port}"  request="   GET   /   HTTP/1.0"
                returnCode="${http.protocol} 200"
  -      />
  +      /> --> 
   
  +      <!-- tolerate for now
         <gtest host="${host}" port="${port}"  request="GET /test/index.ht ml HTTP/1.0"
                returnCode="${http.protocol} 400"
  -      />
  +      /> -->
   
  +      <!-- tolerate for now
         <gtest host="${host}" port="${port}"  request="   GET   /index.ht ml HTTP/1.0 "  
                returnCode="${http.protocol} 400"
  -      />
  +      /> -->
   
   
         <gtest host="${host}" port="${port}"  request="GET /test/servlet HTTP/1.0"
  @@ -481,14 +537,34 @@
                returnCode="${http.protocol} 404"
         />
   
  +      <!-- hit unavailable servlet 2nd time -->
  +      <gtest host="${host}" port="${port}"  request="GET /test/servlet/Unavailable HTTP/1.0"
  +             returnCode="${http.protocol} 503"
  +      />
  +
  +
  +   </target>
  +
  +   <target name="get-tomcat" depends="get">
  +      <gtest host="${host}" port="${port}"  request="GET /test/ HTTP/1.0"
  +             returnCode="${http.protocol} 302"
  +      />
  +
         <gtest host="${host}" port="${port}"  request="GET /test/welcome HTTP/1.0"
                returnCode="${http.protocol} 302"
         />
  +   </target>
   
  +   <target name="get-apache" depends="get">
  +      <gtest host="${host}" port="${port}"  request="GET /test/ HTTP/1.0"
  +             returnCode="${http.protocol} 200"
  +      />
   
  +      <gtest host="${host}" port="${port}"  request="GET /test/welcome HTTP/1.0"
  +             returnCode="${http.protocol} 301"
  +      />
      </target>
   
  -
      <target name="requestMap">
         <gtest host="${host}" port="${port}"  description="/foo/bar/index.html : 1.0 : 200"
                request="GET /test/foo/bar/index.html HTTP/1.0"
  @@ -620,9 +696,10 @@
                returnCode="${http.protocol} 501"
               />
   
  +	<!-- tolerate for now
         <gtest host="${host}" port="${port}"  request="GET http://www.javasoft.com/index.html HTTP/1.0   "
                returnCode="${http.protocol} 400"
  -            />
  +            /> -->
   
         <gtest host="${host}" port="${port}"  request="POST /test/servlet/request.EchoServlet HTTP/1.0"
                headers="Content-Encoding: x-gzip"
  @@ -637,15 +714,106 @@
               / -->
      </target>
   
  +   <!-- ============= unavailable servlet tests ============= -->
  +   <target name="unavailable">
  +      <gtest host="${host}" port="${port}"  request="GET /test/servlet/PermanentlyUnavailable HTTP/1.0"
  +             returnCode="${http.protocol} 503"
  +      />
  +      <!-- again for good measure -->
  +      <gtest host="${host}" port="${port}"  request="GET /test/servlet/PermanentlyUnavailable HTTP/1.0"
  +             returnCode="${http.protocol} 503"
  +      />
  +      <!-- this one was loaded on startup -->
  +      <gtest host="${host}" port="${port}"  request="GET /test/servlet/PermanentlyUnavailable2 HTTP/1.0"
  +             returnCode="${http.protocol} 503"
  +      />
  +      <!-- 3rd hit on the unavailable servlet should succeed -->
  +      <gtest host="${host}" port="${port}"  request="GET /test/servlet/Unavailable HTTP/1.0"
  +             returnCode="${http.protocol} 200"
  +             responseMatch="Hello"
  +      />
  +   </target>
  +
  +   <!-- ============= restricted access tests ============= -->
  +   <target name="restricted">
  +      <gtest host="${host}" port="${port}"  request="GET /test/WEB-INF HTTP/1.0"
  +             returnCode="${http.protocol} 4" />
  +
  +      <gtest host="${host}" port="${port}"  request="GET /test/WEB-INF/ HTTP/1.0"
  +             returnCode="${http.protocol} 4" />
  +
  +      <gtest host="${host}" port="${port}"  request="GET /test/../test/WEB-INF HTTP/1.0"
  +             returnCode="${http.protocol} 4" />
  +
  +      <gtest host="${host}" port="${port}"  request="GET /test/../test/WEB-INF/ HTTP/1.0"
  +             returnCode="${http.protocol} 4" />
  +
  +      <gtest host="${host}" port="${port}"  request="GET /test/WEB-INF/classes HTTP/1.0"
  +             returnCode="${http.protocol} 4" />
  +
  +      <!-- For Windows systems, insure blocking is not case sensitive! -->
  +      <gtest host="${host}" port="${port}"  request="GET /test/web-inf HTTP/1.0"
  +             returnCode="${http.protocol} 4" />
  +
  +      <gtest host="${host}" port="${port}"  request="GET /test/web-inf/ HTTP/1.0"
  +             returnCode="${http.protocol} 4" />
  +
  +      <gtest host="${host}" port="${port}"  request="GET /test/../test/web-inf HTTP/1.0"
  +             returnCode="${http.protocol} 4" />
  +
  +      <gtest host="${host}" port="${port}"  request="GET /test/../test/web-inf/ HTTP/1.0"
  +             returnCode="${http.protocol} 4" />
   
  +      <gtest host="${host}" port="${port}"  request="GET /test/WEB-INF/web.xml HTTP/1.0"
  +             returnCode="${http.protocol} 4" />
  +
  +      <gtest host="${host}" port="${port}"  request="GET /test/../test/WEB-INF/web.xml HTTP/1.0"
  +             returnCode="${http.protocol} 4" />
  +
  +      <gtest host="${host}" port="${port}"  request="GET /test/WEB-INF/web.Xml HTTP/1.0"
  +             returnCode="${http.protocol} 4" />
  +
  +      <gtest host="${host}" port="${port}"  request="GET /test/web-inf/web.xml HTTP/1.0"
  +             returnCode="${http.protocol} 4" />
  +
  +      <gtest host="${host}" port="${port}"  request="GET /test/META-INF HTTP/1.0"
  +             returnCode="${http.protocol} 4" />
  +
  +      <gtest host="${host}" port="${port}"  request="GET /test/META-INF/ HTTP/1.0"
  +             returnCode="${http.protocol} 4" />
  +
  +      <gtest host="${host}" port="${port}"  request="GET /test/../test/META-INF HTTP/1.0"
  +             returnCode="${http.protocol} 4" />
  +
  +      <gtest host="${host}" port="${port}"  request="GET /test/../test/META-INF/ HTTP/1.0"
  +             returnCode="${http.protocol} 4" />
  +
  +      <gtest host="${host}" port="${port}"  request="GET /test/meta-inf HTTP/1.0"
  +             returnCode="${http.protocol} 4" />
  +
  +      <gtest host="${host}" port="${port}"  request="GET /test/META-INF/Manifest.mf HTTP/1.0"
  +             returnCode="${http.protocol} 4" />
  +
  +      <gtest host="${host}" port="${port}"  request="GET /test/../test/META-INF/Manifest.mf HTTP/1.0"
  +             returnCode="${http.protocol} 4" />
  +
  +      <gtest host="${host}" port="${port}"  request="GET /test/META-INF/Manifest.Mf HTTP/1.0"
  +             returnCode="${http.protocol} 4" />
  +
  +      <gtest host="${host}" port="${port}"  request="GET /test/meta-inf/Manifest.mf HTTP/1.0"
  +             returnCode="${http.protocol} 4" />
  +   </target>
  +
      <target name="startup">
        <java classname="org.apache.tomcat.startup.Tomcat" args="" />
      </target>
   
   
  -   <target name="client" depends="file,dispatch,get,requestMap,post,jsp,wrong_request">
  +   <target name="client" depends="file-tomcat,dispatch-tomcat,get-tomcat,requestMap,post,jsp-tomcat,wrong_request,unavailable,restricted">
      </target>
   
  +   <target name="client-apache" depends="file-apache,dispatch-apache,get-apache,post,jsp-apache,wrong_request,unavailable,restricted">
  +   </target>
   
      <target name="shutdown">
        <java classname="org.apache.tomcat.startup.Tomcat" args="-stop" />
  @@ -654,6 +822,7 @@
   
      <target name="main" depends="startup,client,shutdown" />
   
  +   <target name="apache" depends="startup,client-apache,shutdown" />
   
   </project>