larryi 01/02/12 07:01:34 Modified: src/tests/webpages/WEB-INF test-tomcat.xml src/tests/webpages/WEB-INF/classes Unavailable.java Log: Update test script and Unavailable.java so test can be re-run without generating errors. Revision Changes Path 1.22 +6 -20 jakarta-tomcat/src/tests/webpages/WEB-INF/test-tomcat.xml Index: test-tomcat.xml =================================================================== RCS file: /home/cvs/jakarta-tomcat/src/tests/webpages/WEB-INF/test-tomcat.xml,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- test-tomcat.xml 2001/02/10 23:30:27 1.21 +++ test-tomcat.xml 2001/02/12 15:01:21 1.22 @@ -16,7 +16,7 @@ early tests. --> - <property name="revision" value="$Revision: 1.21 $" /> + <property name="revision" value="$Revision: 1.22 $" /> <property name="host" value="127.0.0.1" /> <property name="port" value="8080" /> <property name="outputType" value="text" /> @@ -759,16 +759,6 @@ <target name="get" depends="init,init-params"> - <gtest description="First call to unavailable will fail, wait 10 sec" - request="GET /test/servlet/Unavailable HTTP/1.0" - returnCode="${http.protocol} 503" - /> - - <gtest description="Calls before 10 sec will fail" - request="GET /test/servlet/Unavailable HTTP/1.0" - returnCode="${http.protocol} 503" - /> - <gtest request="GET /test/servlet/Cookie25 HTTP/1.0" expectHeaders="Set-Cookie:foo=bar; Version=1; Max-Age=8640000" /> @@ -1008,17 +998,13 @@ <gtest request="GET /test/servlet/PermanentlyUnavailable HTTP/1.0" returnCode="${http.protocol} 503" /> - <!-- this one was loaded on startup - Can't find it ( costin ) - <gtest request="GET /test/servlet/PermanentlyUnavailable2 HTTP/1.0" + + <gtest description="First call to unavailable will fail" + request="GET /test/servlet/Unavailable HTTP/1.0" returnCode="${http.protocol} 503" /> - --> - - <!-- 2nd hit on the unavailable servlet should succeed - Must be run 10 seconds after the first try, in get - - we do it after jsp ( which will take more than 10 secs :-) - --> - <gtest description="Second call to Unavailable will succed if after 10s" + + <gtest description="Second call to Unavailable will succed" request="GET /test/servlet/Unavailable HTTP/1.0" returnCode="${http.protocol} 200" responseMatch="Hello" 1.3 +15 -8 jakarta-tomcat/src/tests/webpages/WEB-INF/classes/Unavailable.java Index: Unavailable.java =================================================================== RCS file: /home/cvs/jakarta-tomcat/src/tests/webpages/WEB-INF/classes/Unavailable.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Unavailable.java 2000/04/25 18:47:42 1.2 +++ Unavailable.java 2001/02/12 15:01:30 1.3 @@ -4,25 +4,32 @@ public class Unavailable extends HttpServlet { static int attempt=0; + static boolean success=false; public void init(ServletConfig conf) throws ServletException { - System.out.println("Try to init "); - attempt++; - if( attempt < 2 ) - throw new UnavailableException("Testing ", 10); - System.out.println("Init ok "); + attempt++; + if( attempt < 2 ) + throw new UnavailableException("Testing ", 0); } public void service(HttpServletRequest req, HttpServletResponse res) - throws IOException + throws IOException,ServletException { res.setContentType("text/plain"); - ServletOutputStream out = res.getOutputStream(); - out.println("Hello"); + if (attempt == 1) + out.println("Error: UnavailableException not handled correctly"); + else if ((attempt % 2) == 0) { + attempt++; + out.println("Hello"); + } else { + attempt++; + // in case test is re-run + throw new UnavailableException("Testing ", 0); + } out.close(); } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]