📄 test-tomcat.xml
字号:
<project name="TestRun" default="main" init="init">
<!-- To test tomcat standalone, type:
bin/tomcat.sh 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
-->
<target name="init">
<property name="host" value="localhost" />
<property name="port" value="8080" />
<property name="tomcat.home" value="." />
<property name="gdir" value="${tomcat.home}/lib/test/Golden" />
<property name="http.protocol" value="HTTP/1.0" />
<taskdef name="gtest" classname="org.apache.tomcat.task.GTest" />
</target>
<!-- ==================== File tests ==================== -->
<target name="file">
<gtest host="${host}" port="${port}" description="Content Type Test"
request="GET /test/binaries/image1.gif HTTP/1.0"
expectHeaders="Content-Type:image/gif" />
<gtest host="${host}" port="${port}" description="File Integrity and Length Test"
request="GET /test/binaries/image1.gif HTTP/1.0"
goldenFile="${gdir}/image1.gif"
exactMatch="true" />
<gtest host="${host}" port="${port}" description="Welcome File Test1"
request="GET /test/welcome HTTP/1.0"
expectHeaders="Location:/welcome/"
returnCode="${http.protocol} 302" />
<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} 200"
goldenFile="${gdir}/welcome.txt" />
</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"
returnCode="${http.protocol} 200"
goldenFile="${gdir}/SimpleInclude.txt"
/>
<gtest host="${host}" port="${port}" description="SimpleForward"
request="GET /test/servlet/dispatch.SimpleForwardServlet HTTP/1.0"
expectHeaders="Content-Type:text/funky"
returnCode="${http.protocol} 200"
goldenFile="${gdir}/SimpleForward.txt"
/>
<gtest host="${host}" port="${port}" description="PrintWriterTest"
request="GET /test/servlet/dispatch.PrintWriterTest1Servlet HTTP/1.0"
returnCode="${http.protocol} 200"
responseMatch="PreInclude"
/>
<gtest host="${host}" port="${port}" description="PrintWriterTest"
request="GET /test/servlet/dispatch.PrintWriterTest1Servlet HTTP/1.0"
returnCode="${http.protocol} 200"
responseMatch="PostInclude"
/>
<gtest host="${host}" port="${port}" description="PrintWriterTest"
request="GET /test/servlet/dispatch.PrintWriterTest1Servlet HTTP/1.0"
returnCode="${http.protocol} 200"
responseMatch="Included servlet error: 500"
/>
<gtest host="${host}" port="${port}" description="Mismatch2"
request="GET /test/servlet/dispatch.Mismatch2 HTTP/1.0"
returnCode="${http.protocol} 200"
goldenFile="${gdir}/Mismatch2.txt"
/>
<gtest host="${host}" port="${port}" description="IncludeMismatch1-1"
request="GET /test/servlet/dispatch.IncludeMismatch1 HTTP/1.0"
returnCode="${http.protocol} 200"
responseMatch="LINE1"
/>
<gtest host="${host}" port="${port}" description="IncludeMismatch1-2"
request="GET /test/servlet/dispatch.IncludeMismatch1 HTTP/1.0"
returnCode="${http.protocol} 200"
responseMatch="error: 500"
/>
<gtest host="${host}" port="${port}" description="IncludeMismatch1-3"
request="GET /test/servlet/dispatch.IncludeMismatch1 HTTP/1.0"
returnCode="${http.protocol} 200"
responseMatch="LINE1"
/>
<gtest host="${host}" port="${port}" description="IncludeFile"
request="GET /test/servlet/dispatch.IncludeFileServlet HTTP/1.0"
returnCode="${http.protocol} 200"
expectHeaders="Content-Type:text/foobar"
goldenFile="${gdir}/IncludeFile.txt"
/>
<gtest host="${host}" port="${port}" description="ForwardWithQuery"
request="GET /test/servlet/dispatch.ForwardWithQueryServlet?name=Sun%20Microsystems&age=100000&city=Cupertino HTTP/1.0"
returnCode="${http.protocol} 200"
expectHeaders="Content-Type:text/funky"
goldenFile="${gdir}/ForwardWithQuery.txt"
/>
</target>
<!-- ==================== Jsp tests ==================== -->
<target name="jsp">
<gtest host="${host}" port="${port}" request="GET /test/jsp/HelloWorld.jsp HTTP/1.0"
goldenFile="${gdir}/HelloWorld.txt"
/>
<gtest host="${host}" port="${port}" request="GET /test/doesNotExist.jsp HTTP/1.0"
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"
magnitude="false" />
<gtest host="${host}" port="${port}" request="GET /test/.jsp HTTP/1.0"
returnCode="${http.protocol} 200"
magnitude="false" />
<gtest host="${host}" port="${port}" request="GET /test/jsp/HelloWorld.jsp?????? HTTP/1.0"
goldenFile="${gdir}/HelloWorld.txt"
debug="0"
/>
<gtest host="${host}" port="${port}" request="GET /test/jsp/HelloWorld.jsp?a=b&c=d HTTP/1.0"
goldenFile="${gdir}/HelloWorld.txt"
debug="0"
/>
<gtest host="${host}" port="${port}" request="GET /test/jsp/HelloWorld.jsp?&& HTTP/1.0"
goldenFile="${gdir}/HelloWorld.txt"
/>
<gtest host="${host}" port="${port}" request="GET /test/jsp/declaration/IntegerOverflow.jsp HTTP/1.0"
returnCode="${http.protocol} 500"
debug="0"
/>
<gtest host="${host}" port="${port}" request="GET /test/jsp/error/err.jsp HTTP/1.0"
goldenFile="${gdir}/Err.txt"
returnCode="${http.protocol} 200"
/>
<gtest host="${host}" port="${port}" request="GET /test/jsp/forward/forward.jsp HTTP/1.0"
returnCode="${http.protocol} 200"
/>
<gtest host="${host}" port="${port}" request="GET /test/jsp/jsptoserv/jsptoservlet.jsp HTTP/1.0"
returnCode="${http.protocol} 200"
goldenFile="${gdir}/jsptoservlet.txt"
/>
<gtest host="${host}" port="${port}" request="GET /test/jsp/initDestroy.jsp HTTP/1.0"
returnCode="${http.protocol} 200"
/>
<gtest host="${host}" port="${port}" request="GET /test/jsp/classTest.jsp HTTP/1.0"
returnCode="${http.protocol} 200"
goldenFile="${gdir}/classTest.txt"
/>
<gtest host="${host}" port="${port}" request="GET /test/jsp/import.jsp HTTP/1.0"
returnCode="${http.protocol} 200"
goldenFile="${gdir}/import.txt"
/>
<gtest host="${host}" port="${port}" request="GET /test/jsp/buffer.jsp HTTP/1.0"
returnCode="${http.protocol} 200"
goldenFile="${gdir}/buffer.txt"
/>
<gtest host="${host}" port="${port}" request="GET /test/jsp/buffer1.jsp HTTP/1.0"
returnCode="${http.protocol} 200"
magnitude="false" />
<gtest host="${host}" port="${port}" request="GET /test/jsp/buffer2.jsp HTTP/1.0"
returnCode="${http.protocol} 200"
magnitude="false" />
<gtest host="${host}" port="${port}" request="GET /test/jsp/buffer3.jsp HTTP/1.0"
returnCode="${http.protocol} 200"
magnitude="false" />
<gtest host="${host}" port="${port}" request="GET /test/jsp/buffer4.jsp HTTP/1.0"
returnCode="${http.protocol} 200"
magnitude="false" />
<gtest host="${host}" port="${port}" request="GET /test/jsp/comments.jsp HTTP/1.0"
returnCode="${http.protocol} 500"
/>
<gtest host="${host}" port="${port}" request="GET /test/jsp/parse.jsp HTTP/1.0"
returnCode="${http.protocol} 200"
goldenFile="${gdir}/parse.txt"
/>
<gtest host="${host}" port="${port}" request="GET /test/jsp/pageInfo.jsp HTTP/1.0"
returnCode="${http.protocol} 200"
magnitude="false" />
<gtest host="${host}" port="${port}" request="GET /test/jsp/pageLanguage.jsp HTTP/1.0"
returnCode="${http.protocol} 200"
magnitude="false" />
<gtest host="${host}" port="${port}" request="GET /test/jsp/pageIsThreadSafe.jsp HTTP/1.0"
returnCode="${http.protocol} 200"
magnitude="false" />
<gtest host="${host}" port="${port}" request="GET /test/jsp/pageSession.jsp HTTP/1.0"
returnCode="${http.protocol} 200"
magnitude="false" />
<gtest host="${host}" port="${port}" request="GET /test/jsp/pageAutoFlush.jsp HTTP/1.0"
returnCode="${http.protocol} 200"
magnitude="false" />
<gtest host="${host}" port="${port}" request="GET /test/jsp/pageError.jsp HTTP/1.0"
returnCode="${http.protocol} 200"
/>
<gtest host="${host}" port="${port}" request="GET /test/jsp/pageExtends.jsp HTTP/1.0"
returnCode="${http.protocol} 200"
magnitude="false" />
<gtest host="${host}" port="${port}" request="GET /test/jsp/pageIsErrorPage.jsp HTTP/1.0"
returnCode="${http.protocol} 200"
magnitude="false" />
<gtest host="${host}" port="${port}" request="GET /test/jsp/pageContentType.jsp HTTP/1.0"
returnCode="${http.protocol} 200"
/>
<gtest host="${host}" port="${port}" request="GET /test/jsp/pageImport2.jsp HTTP/1.0"
returnCode="${http.protocol} 200"
magnitude="false" />
<gtest host="${host}" port="${port}" request="GET /test/jsp/pageImport.jsp HTTP/1.0"
returnCode="${http.protocol} 200"
goldenFile="${gdir}/pageImport.txt"
/>
<gtest host="${host}" port="${port}" request="GET /test/jsp/beanTest1.jsp HTTP/1.0"
returnCode="${http.protocol} 200"
goldenFile="${gdir}/beanTest.txt"
/>
<gtest host="${host}" port="${port}" request="GET /test/jsp/beanTest2.jsp HTTP/1.0"
returnCode="${http.protocol} 200"
magnitude="false" />
<gtest host="${host}" port="${port}" request="GET /test/jsp/beanScopePage.jsp HTTP/1.0"
returnCode="${http.protocol} 200"
/>
<gtest host="${host}" port="${port}" request="GET /test/jsp/beanScopeSession.jsp HTTP/1.0"
returnCode="${http.protocol} 200"
debug="0"
/>
<gtest host="${host}" port="${port}" request="GET /test/jsp/implicitOut.jsp HTTP/1.0"
returnCode="${http.protocol} 200"
goldenFile="${gdir}/implicitOut.txt"
/>
<gtest host="${host}" port="${port}" request="GET /test/jsp/implicitConfig.jsp HTTP/1.0"
returnCode="${http.protocol} 200"
goldenFile="${gdir}/implicitConfig.txt"
/>
<gtest host="${host}" port="${port}" request="GET /test/jsp/implicitException.jsp HTTP/1.0"
returnCode="${http.protocol} 200"
goldenFile="${gdir}/implicitException.txt"
/>
<gtest host="${host}" port="${port}" request="GET /test/jsp/implicitPageContext.jsp HTTP/1.0"
returnCode="${http.protocol} 200"
goldenFile="${gdir}/implicitPageContext.txt"
/>
<gtest host="${host}" port="${port}" request="GET /test/jsp/implicitContext.jsp HTTP/1.0"
returnCode="${http.protocol} 200"
goldenFile="${gdir}/implicitContext.txt"
/>
<gtest host="${host}" port="${port}" request="GET /test/jsp/implicitRequest.jsp HTTP/1.0"
returnCode="${http.protocol} 200"
goldenFile="${gdir}/implicitRequest.txt"
/>
<gtest host="${host}" port="${port}" request="GET /test/jsp/implicitResponse.jsp HTTP/1.0"
returnCode="${http.protocol} 200"
goldenFile="${gdir}/implicitResponse.txt"
/>
<gtest host="${host}" port="${port}" request="GET /test/jsp/implicitSession.jsp HTTP/1.0"
returnCode="${http.protocol} 200"
goldenFile="${gdir}/implicitSession.txt"
/>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -