jakarta-watchdog-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sant...@locus.apache.org
Subject cvs commit: jakarta-watchdog-4.0/src/server/servlet-tests/classes/tests/javax_servlet/Servlet CoreServletTest.java DoDestroyedTestServlet.java DoInit1TestServlet.java DoInit2TestServlet.java DoServiceTestServlet.java DoServletConfigTestServlet.java DoServletInfoTestServlet.java PUTestServlet.java
Date Mon, 16 Oct 2000 22:44:04 GMT
santosh     00/10/16 15:44:02

  Added:       src/server/servlet-tests/classes/tests/javax_servlet/Servlet
                        CoreServletTest.java DoDestroyedTestServlet.java
                        DoInit1TestServlet.java DoInit2TestServlet.java
                        DoServiceTestServlet.java
                        DoServletConfigTestServlet.java
                        DoServletInfoTestServlet.java PUTestServlet.java
  Log:
  watchdog 4.0
  
  Revision  Changes    Path
  1.1                  jakarta-watchdog-4.0/src/server/servlet-tests/classes/tests/javax_servlet/Servlet/CoreServletTest.java
  
  Index: CoreServletTest.java
  ===================================================================
  package tests.javax_servlet.Servlet;
  
  import javax.servlet.Servlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  import javax.servlet.ServletOutputStream;
  import javax.servlet.ServletRequest;
  import javax.servlet.ServletResponse;
  import javax.servlet.ServletConfig;
  import javax.servlet.ServletException;
  import java.io.IOException;
  
  /**
   *
   * @author Ankur Chandra [ankurc@eng.sun.com]
   * @author James Todd [gonzo@eng.sun.com]
   */
  
  public abstract class CoreServletTest
  implements Servlet {
  
  	ServletConfig config;
  	
  	private boolean sawInit=false;
  	private boolean sawDestroy=false;
  	private boolean sawService=false;
  
      // for life cycle test
      public boolean isInit() {
  	return sawInit;
      }
  
      // for life cycle test
      public boolean isDestroyed() {
  	return sawDestroy;
      }
  
      public void init(ServletConfig config) throws ServletException {
  	//set sawInit to true
  	sawInit=true;
  	this.config=config;
      }
  
      public void service (ServletRequest request,ServletResponse response) throws ServletException,IOException
{
  	sawService=true;
      }
  
  
      public String getServletInfo() {
  	return "Servlet Info";
      }
  
      public ServletConfig getServletConfig() {
  	return config;
      }
  
      public void destroy() {
  	//set sawDestroy to true
  	sawDestroy=true;
      }
  }
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/servlet-tests/classes/tests/javax_servlet/Servlet/DoDestroyedTestServlet.java
  
  Index: DoDestroyedTestServlet.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-watchdog-4.0/src/server/servlet-tests/classes/tests/javax_servlet/Servlet/DoDestroyedTestServlet.java,v
1.1 2000/10/16 22:44:01 santosh Exp $
   * $Date: 2000/10/16 22:44:01 $
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package tests.javax_servlet.Servlet;
  
  
  import javax.servlet.ServletRequest;
  import javax.servlet.ServletResponse;
  import javax.servlet.ServletConfig;
  import javax.servlet.ServletException;
  import java.io.IOException;
  import java.io.PrintWriter;
  
  /**
   *	Test for destroy Method
   */
  
  
  public class DoDestroyedTestServlet extends CoreServletTest {
  
  
  /**
   *	Testing that destroy method is not called during 
   * service method execution 
   *	
   */
  
  
  	public void service (ServletRequest request,ServletResponse response) throws ServletException,
IOException {
  
  		//checking whether destroy is called before this
  		PrintWriter out = response.getWriter();
  
  		if(isDestroyed())
  		{
  			out.println("DoDestroyedTest test FAILED");
  			out.println("Servlet Life Cycle is incorrect. destroy is called before/during the service
method");
  
  		}
  		else
  		{
  			out.println("DoDestroyedTest test PASSED");
  		}
  
  	}
  }
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/servlet-tests/classes/tests/javax_servlet/Servlet/DoInit1TestServlet.java
  
  Index: DoInit1TestServlet.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-watchdog-4.0/src/server/servlet-tests/classes/tests/javax_servlet/Servlet/DoInit1TestServlet.java,v
1.1 2000/10/16 22:44:01 santosh Exp $
   * $Date: 2000/10/16 22:44:01 $
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  /* @Author : Ramesh.Mandava
  */
  
  package tests.javax_servlet.Servlet;
  
  
  import javax.servlet.ServletRequest;
  import javax.servlet.ServletResponse;
  import javax.servlet.ServletConfig;
  import javax.servlet.UnavailableException;
  import javax.servlet.ServletException;
  import java.io.IOException;
  import java.io.PrintWriter;
  
  /**
   *	Negative Test for Servlet.init(ServletConfig) method
   */
  
  
  public class DoInit1TestServlet extends CoreServletTest {
  
  /**
   *	We will throw UnavailableException from inside init
   *	The Servlet should not be initialized
   */
  
  	public void init(ServletConfig sc) throws ServletException {
  		throw new UnavailableException(this,"Negative Init Test");
  	}
  
  
  
  	public void service (ServletRequest request,ServletResponse response) throws ServletException,
IOException {
  
  		//oops its a Fault Tolerant Servlet
  
  		PrintWriter out = response.getWriter();
  		out.println( "DoInit1Test test FAILED <BR>");
  		out.println("service method getting called even when we throw UnavailableException in
init()");
  
  	}
  }
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/servlet-tests/classes/tests/javax_servlet/Servlet/DoInit2TestServlet.java
  
  Index: DoInit2TestServlet.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-watchdog-4.0/src/server/servlet-tests/classes/tests/javax_servlet/Servlet/DoInit2TestServlet.java,v
1.1 2000/10/16 22:44:01 santosh Exp $
   * $Date: 2000/10/16 22:44:01 $
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package tests.javax_servlet.Servlet;
  
  
  import javax.servlet.ServletRequest;
  import javax.servlet.ServletResponse;
  import javax.servlet.ServletConfig;
  import javax.servlet.ServletException;
  import java.io.IOException;
  import java.io.PrintWriter;
  
  /**
   *	Test for Servlet.init() method
   */
  
  
  public class DoInit2TestServlet extends CoreServletTest {
  
  /**
   *	inside coreServletTest we are implementing
   *	init(ServletConfig) and setting a bool var
   *	to true
   *	we'll check for that here
   */
  
  
  	public void service (ServletRequest request,ServletResponse response) throws ServletException,
IOException {
  		PrintWriter out = response.getWriter();
  		//isInit() should return true
  		if(isInit()) {
  			out.println("DoInit2Test test PASSED");	
  		}
  		else
  		{
  			//problem with LifeCycle
  			out.println("DoInit2Test test FAILED");	
  			out.println("Problem with Servlet LifeCycle");
  			out.println("init not called before service");
  		}
  		
  			
  
  	}
  }
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/servlet-tests/classes/tests/javax_servlet/Servlet/DoServiceTestServlet.java
  
  Index: DoServiceTestServlet.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-watchdog-4.0/src/server/servlet-tests/classes/tests/javax_servlet/Servlet/DoServiceTestServlet.java,v
1.1 2000/10/16 22:44:01 santosh Exp $
   * $Date: 2000/10/16 22:44:01 $
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * @Author : Ramesh.Mandava
   */
  
  package tests.javax_servlet.Servlet;
  
  
  import javax.servlet.ServletRequest;
  import javax.servlet.ServletResponse;
  import javax.servlet.ServletConfig;
  import javax.servlet.ServletException;
  import java.io.IOException;
  import java.io.PrintWriter;
  
  /**
   *	A Test for service(ServletRequest,ServletResponse) method
   */
  
  
  public class DoServiceTestServlet extends CoreServletTest {
  
  /**
   *	We1'll override init method and assign some value to the String
   *	We'll check for that value in the service method
   */
  
  	String precedence="starting";
  
  	public void init(ServletConfig sc) throws ServletException {
  
  		super.init(sc);
  		precedence="init is called";
  	}
  
  
  	public void service (ServletRequest request,ServletResponse response) throws ServletException,
IOException {
  
  
  		PrintWriter out = response.getWriter();
  		if(precedence.equals("init is called")) 
  		{
  			out.println("DoServiceTest test PASSED");	
  		}
  		else
  		{
  			out.println("DoServiceTest test FAILED");
  			out.println("Problem with Servlet life cycle");
  			out.println("init is not called before service");
  		}
  
  	}
  }
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/servlet-tests/classes/tests/javax_servlet/Servlet/DoServletConfigTestServlet.java
  
  Index: DoServletConfigTestServlet.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-watchdog-4.0/src/server/servlet-tests/classes/tests/javax_servlet/Servlet/DoServletConfigTestServlet.java,v
1.1 2000/10/16 22:44:01 santosh Exp $
   * $Date: 2000/10/16 22:44:01 $
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * @Author : Ramesh.Mandava
   *
   */
  
  
  package tests.javax_servlet.Servlet;
  
  
  import javax.servlet.ServletRequest;
  import javax.servlet.ServletResponse;
  import javax.servlet.ServletConfig;
  import javax.servlet.ServletException;
  import java.io.IOException;
  import java.io.PrintWriter;
  
  /**
   *	A Test for getServletConfig method
   */
  
  public class DoServletConfigTestServlet extends CoreServletTest {
  
  /**
   *	getServletConfig gives the ServletConfig object
   * 	that is passed to the init method by the engine
   */
  
  
  	public void service (ServletRequest request,ServletResponse response) throws ServletException,
IOException 
  	{
  
  		PrintWriter out = response.getWriter();
  		if(getServletConfig()!=null)
  		{
  			out.println("DoServletConfigTest test PASSED");
  		 }
  		else
  		{
  			out.println("DoServletConfigTest test FAILED");
  			out.println("getServletConfig returned null?");
  
  		}
  			
  
  	}
  }
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/servlet-tests/classes/tests/javax_servlet/Servlet/DoServletInfoTestServlet.java
  
  Index: DoServletInfoTestServlet.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-watchdog-4.0/src/server/servlet-tests/classes/tests/javax_servlet/Servlet/DoServletInfoTestServlet.java,v
1.1 2000/10/16 22:44:02 santosh Exp $
   * $Date: 2000/10/16 22:44:02 $
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package tests.javax_servlet.Servlet;
  
  
  import javax.servlet.ServletRequest;
  import javax.servlet.ServletResponse;
  import javax.servlet.ServletConfig;
  import javax.servlet.ServletException;
  import java.io.IOException;
  import java.io.PrintWriter;
  
  
  public class DoServletInfoTestServlet extends CoreServletTest {
  
  
  	public void service (ServletRequest request,ServletResponse response) throws ServletException,
IOException {
  
  		PrintWriter out = response.getWriter();
  		if ( (getServletInfo()!=null) && ( getServletInfo().equals("Servlet Info")  ))
{
  			out.println("DoServletInfoTest test PASSED");
  		}
  		else
  		{
  			out.println("DoServletInfoTest test FAILED");
  			out.println("Problem getting Servlet Info");
  		}
  		
  	}
  }
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/servlet-tests/classes/tests/javax_servlet/Servlet/PUTestServlet.java
  
  Index: PUTestServlet.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-watchdog-4.0/src/server/servlet-tests/classes/tests/javax_servlet/Servlet/PUTestServlet.java,v
1.1 2000/10/16 22:44:02 santosh Exp $
   * $Date: 2000/10/16 22:44:02 $
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package tests.javax_servlet.Servlet;
  
  
  import javax.servlet.ServletRequest;
  import javax.servlet.ServletResponse;
  import javax.servlet.ServletConfig;
  import javax.servlet.ServletException;
  import javax.servlet.GenericServlet;
  import javax.servlet.UnavailableException;
  import java.io.IOException;
  import java.io.PrintWriter;
  
  /**
   *	A Test for servlet Life Cycle
   *	@author Ramesh Mandava,Vanitha Venkatraman 
   */
  
  
  public class PUTestServlet extends GenericServlet {
  
  	/**
  	 *	By passing  ServletTest's service method
  	 *
  	 */
  
  	public void service(ServletRequest request,ServletResponse response) throws ServletException
, IOException {
  	  PrintWriter out = response.getWriter();
  	  try 
  	  {
  		   
  
  		throw new UnavailableException("Throwing Permanent unavailable Exception ");
  	   }
  	   catch ( UnavailableException ex )
  	   {
  		if ( ex.isPermanent()== true )
  		{
  		     out.println("PUTest test PASSED");
  		}
  		else
  		{
  			out.println("PUTest test FAILED <BR>");
  			out.println("isPermanent() method is returing false for Permanent Unavailable Exception");
  		}
  	   }
  	}
  
  
  }
  
  
  

Mime
View raw message