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/ServletConfig GetServletConfigInitParameterNamesTestServlet.java GetServletConfigInitParameterNames_1TestServlet.java GetServletConfigInitParameterTestServlet.java GetServletConfigInitParameter_1TestServlet.java GetServletNameTestServlet.java ServletConfigGetServletContextTestServlet.java
Date Mon, 16 Oct 2000 22:47:10 GMT
santosh     00/10/16 15:47:10

  Added:       src/server/servlet-tests/classes/tests/javax_servlet/ServletConfig
                        GetServletConfigInitParameterNamesTestServlet.java
                        GetServletConfigInitParameterNames_1TestServlet.java
                        GetServletConfigInitParameterTestServlet.java
                        GetServletConfigInitParameter_1TestServlet.java
                        GetServletNameTestServlet.java
                        ServletConfigGetServletContextTestServlet.java
  Log:
  watchdog 4.0
  
  Revision  Changes    Path
  1.1                  jakarta-watchdog-4.0/src/server/servlet-tests/classes/tests/javax_servlet/ServletConfig/GetServletConfigInitParameterNamesTestServlet.java
  
  Index: GetServletConfigInitParameterNamesTestServlet.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-watchdog-4.0/src/server/servlet-tests/classes/tests/javax_servlet/ServletConfig/GetServletConfigInitParameterNamesTestServlet.java,v
1.1 2000/10/16 22:47:09 santosh Exp $
   * $Date: 2000/10/16 22:47:09 $
   *
   * 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.ServletConfig;
  
  
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.ServletConfig;
  import java.util.Enumeration;
  import javax.servlet.ServletException;
  import java.io.IOException;
  import java.io.PrintWriter;
  
  
  /**
   *	Test for Servlet Config getInitParameterNames() method
   */
  
  
  public class GetServletConfigInitParameterNamesTestServlet extends HttpServlet {
  
  
  /**
   *	getInitParameterNames returns an Enumeration of values
   *	associated with the init parameters
   */
  	public void service (HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException {
  
  		PrintWriter out = response.getWriter();
  		ServletConfig config = this.getServletConfig();
  		Enumeration enum = config.getInitParameterNames();
  
  		int count =0;
  
  		//count should be 2
  		while(enum.hasMoreElements()) {
  			enum.nextElement();
  			count++;
  		}
  		if(count==2) {
  			count=0;
  			enum = config.getInitParameterNames();
  			while(enum.hasMoreElements()) {
  				String name=(String)enum.nextElement();
  				if(name.equals("Team")||name.equals("org")) {
  					out.println("GetServletConfigInitParameterNamesTest test PASSED");
  					count++;
  				}
  				else {
  					out.println("GetServletConfigInitParameterNamesTest test FAILED");
  					out.println("ServletConfig.getInitParameterNames() method returned incorrect result");
  				}
  			}
  			if(count!=2) {
  					out.println("GetServletConfigInitParameterNamesTest test FAILED");
  					out.println("ServletConfig.getInitParameterNames() method did not return two init parameters");
  			}
  
  		}
  	}
  }
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/servlet-tests/classes/tests/javax_servlet/ServletConfig/GetServletConfigInitParameterNames_1TestServlet.java
  
  Index: GetServletConfigInitParameterNames_1TestServlet.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-watchdog-4.0/src/server/servlet-tests/classes/tests/javax_servlet/ServletConfig/GetServletConfigInitParameterNames_1TestServlet.java,v
1.1 2000/10/16 22:47:09 santosh Exp $
   * $Date: 2000/10/16 22:47:09 $
   *
   * 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.ServletConfig;
  
  
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.ServletConfig;
  import java.util.Enumeration;
  import javax.servlet.ServletException;
  import java.io.IOException;
  import java.io.PrintWriter;
  
  
  /**
   *	Negative Test for ServletConfig getInitParameterNames() method
   */
  
  
  public class GetServletConfigInitParameterNames_1TestServlet extends HttpServlet {
  
  /**
   *	getInitParameterNames returns an Enumeration of values
   *	associated with the init parameters
   */
  
  	public void service (HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException {
  
  		PrintWriter out = response.getWriter();
  		ServletConfig config = this.getServletConfig();
  
  		Enumeration enum= config.getInitParameterNames();
  
  		//we set nothing
  		if(!enum.hasMoreElements()) {
  			out.println("GetServletConfigInitParameterNames_1Test test PASSED");
  		}
  		else {
  			out.println("GetServletConfigInitParameterNames_1Test test FAILED");
  			out.println("Servlet Config getInitParameterNames() method should return an empty enumeration
as no init parameters were specified ");
  		}
  	}
  }
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/servlet-tests/classes/tests/javax_servlet/ServletConfig/GetServletConfigInitParameterTestServlet.java
  
  Index: GetServletConfigInitParameterTestServlet.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-watchdog-4.0/src/server/servlet-tests/classes/tests/javax_servlet/ServletConfig/GetServletConfigInitParameterTestServlet.java,v
1.1 2000/10/16 22:47:09 santosh Exp $
   * $Date: 2000/10/16 22:47:09 $
   *
   * 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.ServletConfig;
  
  
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.ServletConfig;
  import javax.servlet.ServletException;
  import java.io.IOException;
  import java.io.PrintWriter;
  
  
  /**
   *	Test for ServletConfig getInitParameter(String)
   */
  
  public class GetServletConfigInitParameterTestServlet extends HttpServlet {
  
  	public void service (HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException {
  
  		PrintWriter out = response.getWriter();
  		ServletConfig config = this.getServletConfig();
  
  		//Init parameters specified in web.xml for GetServletConfigInitParameterTest servlet
  		String initParam = config.getInitParameter("Team");
  		if(initParam!=null) {
  			if(initParam.equals("WebAccess")) {
  				out.println("GetServletConfigInitParameterTest test PASSED");
  			}
  			else {
  				out.println("GetServletConfigInitParameterTest test FAILED");
  				out.println("ServletConfig getInitParameter(String) gives incorrect results");
  				out.println("ServletConfig getInitParameter(String) != 'WebAccess' as specified in web.xml
for GetServletConfigInitParameterTest servlet"); 
  			}
  		}
  		else {
  				out.println("GetServletConfigInitParameterTest test FAILED");
  				out.println("ServletConfig getInitParameter(String) is null");
  		}
  	}
  }
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/servlet-tests/classes/tests/javax_servlet/ServletConfig/GetServletConfigInitParameter_1TestServlet.java
  
  Index: GetServletConfigInitParameter_1TestServlet.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-watchdog-4.0/src/server/servlet-tests/classes/tests/javax_servlet/ServletConfig/GetServletConfigInitParameter_1TestServlet.java,v
1.1 2000/10/16 22:47:09 santosh Exp $
   * $Date: 2000/10/16 22:47:09 $
   *
   * 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.ServletConfig;
  
  
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.ServletConfig;
  import javax.servlet.ServletException;
  import java.io.IOException;
  import java.io.PrintWriter;
  
  /**
   *	Negative Test for ServletConfig getInitParameter(String) method
   */
  
  
  public class GetServletConfigInitParameter_1TestServlet extends HttpServlet {
  
  	public void service (HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException {
  
  /**
   *	We will try this method with a bogus param
   *	We expect null as an output
   */
  
  		PrintWriter out = response.getWriter();
  		ServletConfig config = this.getServletConfig();
  
  		String initParam = config.getInitParameter("Mono Phosphate");
  
  		if(initParam==null) {
  			out.println("GetServletConfigInitParameter_1Test test PASSED");
  		}
  		else {
  			out.println("GetServletConfigInitParameter_1Test test FAILED");
  			out.println("Actual Output from ServletConfig.getInitParameter(String) -> initParam");
  			out.println("Expected Value from ServletConfig.getInitParameter(String) -> null as
a bogus param was used for the String");
  		}
  	}
  }
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/servlet-tests/classes/tests/javax_servlet/ServletConfig/GetServletNameTestServlet.java
  
  Index: GetServletNameTestServlet.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-watchdog-4.0/src/server/servlet-tests/classes/tests/javax_servlet/ServletConfig/GetServletNameTestServlet.java,v
1.1 2000/10/16 22:47:09 santosh Exp $
   * $Date: 2000/10/16 22:47:09 $
   *
   * 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.ServletConfig;
  
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.ServletConfig;
  import javax.servlet.ServletException;
  import java.io.IOException;
  import java.io.PrintWriter;
  
  
  /**
   *	Test for  ServletConfig.getServletName()
   */
  
  public class GetServletNameTestServlet extends HttpServlet {
  
  	public void service (HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException {
  
  		PrintWriter out = response.getWriter();
  		ServletConfig config = this.getServletConfig();
  
  		//get this servlets name
  		String servletName = config.getServletName();
  
  		if(servletName.equals("GetServletNameTest")) {
  			out.println("GetServletNameTest test PASSED");
  		}
  		else {
  			out.println("GetServletNameTest test FAILED <BR>");
  			out.println("Expected Result -> GetServletNameTest <BR>");
  			out.println("Actual Result -> " +  servletName);
  		}
  	}
  }
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/servlet-tests/classes/tests/javax_servlet/ServletConfig/ServletConfigGetServletContextTestServlet.java
  
  Index: ServletConfigGetServletContextTestServlet.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-watchdog-4.0/src/server/servlet-tests/classes/tests/javax_servlet/ServletConfig/ServletConfigGetServletContextTestServlet.java,v
1.1 2000/10/16 22:47:09 santosh Exp $
   * $Date: 2000/10/16 22:47:09 $
   *
   * 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.ServletConfig;
  
  
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.ServletConfig;
  import javax.servlet.ServletContext;
  import javax.servlet.ServletException;
  import java.io.IOException;
  import java.io.PrintWriter;
  
  /**
   *	Test for ServletConfig.getServletContext() method
   */
  
  
  
  public class ServletConfigGetServletContextTestServlet extends HttpServlet {
  
  /**
   *	We'll try to get the ServletContext for this servlet itself
   */
  
  	public void service (HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException {
  
  		PrintWriter out = response.getWriter();
  		String anotherServlet="/servlet-tests/ServletConfigGetServletContextTest";
  		ServletConfig config = this.getServletConfig();
  		ServletContext context = config.getServletContext();
  
  		//we expect ServletContext object that corresponds to the named URL
  		ServletContext context2 = context.getContext(anotherServlet); 
  		if((context2 == context))  {
  			out.println("ServletConfigGetServletContextTest test PASSED");
  		}
  		else {
  			out.println("ServletConfigGetServletContextTest test FAILED");
  			out.println("ServletConfig.getServletContext() returned incorrect result");
  		}
  	}
  }
  
  
  

Mime
View raw message