2009/05/20 - Apache Shale has been retired.

For more information, please explore the Attic.

Coverage Report - org.apache.shale.test.mock.MockServlet
 
Classes in this File Line Coverage Branch Coverage Complexity
MockServlet
0% 
N/A 
1
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 3  
  * contributor license agreements.  See the NOTICE file distributed with
 4  
  * this work for additional information regarding copyright ownership.
 5  
  * The ASF licenses this file to you under the Apache License, Version 2.0
 6  
  * (the "License"); you may not use this file except in compliance with
 7  
  * the License.  You may obtain a copy of the License at
 8  
  *
 9  
  *      http://www.apache.org/licenses/LICENSE-2.0
 10  
  *
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 
 18  
 package org.apache.shale.test.mock;
 19  
 
 20  
 import java.io.IOException;
 21  
 
 22  
 import javax.servlet.Servlet;
 23  
 import javax.servlet.ServletConfig;
 24  
 import javax.servlet.ServletException;
 25  
 import javax.servlet.ServletRequest;
 26  
 import javax.servlet.ServletResponse;
 27  
 
 28  
 /**
 29  
  * <p>Mock implementation of <code>Servlet</code>.</p>
 30  
  *
 31  
  * $Id$
 32  
  */
 33  
 
 34  
 public class MockServlet implements Servlet {
 35  
 
 36  
 
 37  
     // ------------------------------------------------------------ Constructors
 38  
 
 39  
 
 40  
     /**
 41  
      * <p>Create a default Servlet instance.</p>
 42  
      */
 43  0
     public MockServlet() {
 44  0
     }
 45  
 
 46  
 
 47  
     /**
 48  
      * <p>Create a new Servlet with the specified ServletConfig.</p>
 49  
      *
 50  
      * @param config The new ServletConfig instance
 51  
      */
 52  0
     public MockServlet(ServletConfig config) throws ServletException {
 53  0
         init(config);
 54  0
     }
 55  
 
 56  
 
 57  
     // ----------------------------------------------------- Mock Object Methods
 58  
 
 59  
 
 60  
     /**
 61  
      * <p>Set the <code>ServletConfig</code> instance for this servlet.</p>
 62  
      *
 63  
      * @param config The new ServletConfig instance
 64  
      */
 65  
     public void setServletConfig(ServletConfig config) {
 66  
 
 67  0
         this.config = config;
 68  
 
 69  0
     }
 70  
 
 71  
 
 72  
     // ------------------------------------------------------ Instance Variables
 73  
 
 74  
 
 75  
     /**
 76  
      * <p>The <code>ServletConfig</code> instance for this servlet.</p>
 77  
      */
 78  
     private ServletConfig config;
 79  
 
 80  
 
 81  
     // --------------------------------------------------------- Servlet Methods
 82  
 
 83  
 
 84  
     /** {@inheritDoc} */
 85  
     public void destroy() {
 86  0
     }
 87  
 
 88  
 
 89  
     /** {@inheritDoc} */
 90  
     public ServletConfig getServletConfig() {
 91  
 
 92  0
         return this.config;
 93  
 
 94  
     }
 95  
 
 96  
 
 97  
     /** {@inheritDoc} */
 98  
     public String getServletInfo() {
 99  
 
 100  0
         return "MockServlet";
 101  
 
 102  
     }
 103  
 
 104  
 
 105  
     /** {@inheritDoc} */
 106  
     public void init(ServletConfig config) throws ServletException {
 107  
 
 108  0
         this.config = config;
 109  
 
 110  0
     }
 111  
 
 112  
 
 113  
     /** {@inheritDoc} */
 114  
     public void service(ServletRequest request, ServletResponse response)
 115  
       throws IOException, ServletException {
 116  
 
 117  
         // Do nothing by default
 118  
 
 119  0
     }
 120  
 
 121  
 
 122  
 }