1   /*
2    * Copyright 2001-2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.portletbridge.mock;
17  
18  import java.util.Enumeration;
19  import java.util.Hashtable;
20  
21  import javax.servlet.ServletConfig;
22  import javax.servlet.ServletContext;
23  
24  /***
25   * @author JMcCrindle
26   */
27  public class MockServletConfig implements ServletConfig {
28  
29      private Hashtable params = new Hashtable();
30      private String name = null;
31      private ServletContext context = null;
32      
33      /***
34       * 
35       */
36      public MockServletConfig() {
37          super();
38      }
39  
40      /* (non-Javadoc)
41       * @see javax.servlet.ServletConfig#getServletName()
42       */
43      public String getServletName() {
44          return name;
45      }
46  
47      /* (non-Javadoc)
48       * @see javax.servlet.ServletConfig#getServletContext()
49       */
50      public ServletContext getServletContext() {
51          return context;
52      }
53  
54      /* (non-Javadoc)
55       * @see javax.servlet.ServletConfig#getInitParameter(java.lang.String)
56       */
57      public String getInitParameter(String name) {
58          return (String) params.get(name);
59      }
60  
61      /* (non-Javadoc)
62       * @see javax.servlet.ServletConfig#getInitParameterNames()
63       */
64      public Enumeration getInitParameterNames() {
65          return params.keys();
66      }
67      
68      public void setupParam(String name, String value) {
69          params.put(name, value);
70      }
71      
72      public void setupContext(ServletContext context) {
73          this.context = context;
74      }
75  
76  }