View Javadoc

1   package test.crispy.mock;
2   
3   import java.util.Enumeration;
4   import java.util.Properties;
5   
6   import javax.servlet.ServletConfig;
7   import javax.servlet.ServletContext;
8   
9   public class MockServletConfig implements ServletConfig {
10  
11  
12  	private final ServletContext servletContext = new MockServletContext();
13  	private String servletName = "";
14  	private final Properties initParameters = new Properties();
15  
16  	public MockServletConfig(String pvServletName) {	
17  		servletName = pvServletName;
18  	}
19  
20  
21  	public String getServletName() {
22  		return servletName;
23  	}
24  
25  	public ServletContext getServletContext() {
26  		return servletContext;
27  	}
28  
29  	public void addInitParameter(String name, String value) {
30  		this.initParameters.setProperty(name, value);
31  	}
32  
33  	public String getInitParameter(String name) {
34  		return this.initParameters.getProperty(name);
35  	}
36  
37  	public Enumeration getInitParameterNames() {
38  		return this.initParameters.keys();
39  	}
40  
41  }