01: package com.mockrunner.mock.web;
02:
03: import javax.servlet.ServletConfig;
04: import javax.servlet.ServletContext;
05:
06: import org.apache.struts.action.ActionServlet;
07:
08: /**
09: * This mock version of the Struts <code>ActionServlet</code>
10: * is necessary, because some Struts methods use it to
11: * get the <code>ServletContext</code> and other things.
12: */
13: public class MockActionServlet extends ActionServlet {
14: private ServletConfig config;
15: private ServletContext context;
16:
17: /**
18: * Returns the <code>ServletConfig</code>.
19: * @return the <code>ServletConfig</code>
20: */
21: public ServletConfig getServletConfig() {
22: return config;
23: }
24:
25: /**
26: * Returns the <code>ServletContext</code>.
27: * @return the <code>ServletContext</code>
28: */
29: public ServletContext getServletContext() {
30: return context;
31: }
32:
33: /**
34: * Set the <code>ServletConfig</code>.
35: * @param config the <code>ServletConfig</code>
36: */
37: public void setServletConfig(ServletConfig config) {
38: this .config = config;
39: }
40:
41: /**
42: * Set the <code>ServletContext</code>.
43: * @param context the <code>ServletContext</code>
44: */
45: public void setServletContext(ServletContext context) {
46: this.context = context;
47: }
48: }
|