001 package com.mockrunner.mock.web; 002 003 import javax.servlet.ServletConfig; 004 import javax.servlet.ServletContext; 005 006 import org.apache.struts.action.ActionServlet; 007 008 /** 009 * This mock version of the Struts <code>ActionServlet</code> 010 * is necessary, because some Struts methods use it to 011 * get the <code>ServletContext</code> and other things. 012 */ 013 public class MockActionServlet extends ActionServlet 014 { 015 private ServletConfig config; 016 private ServletContext context; 017 018 /** 019 * Returns the <code>ServletConfig</code>. 020 * @return the <code>ServletConfig</code> 021 */ 022 public ServletConfig getServletConfig() 023 { 024 return config; 025 } 026 027 /** 028 * Returns the <code>ServletContext</code>. 029 * @return the <code>ServletContext</code> 030 */ 031 public ServletContext getServletContext() 032 { 033 return context; 034 } 035 036 /** 037 * Set the <code>ServletConfig</code>. 038 * @param config the <code>ServletConfig</code> 039 */ 040 public void setServletConfig(ServletConfig config) 041 { 042 this.config = config; 043 } 044 045 /** 046 * Set the <code>ServletContext</code>. 047 * @param context the <code>ServletContext</code> 048 */ 049 public void setServletContext(ServletContext context) 050 { 051 this.context = context; 052 } 053 }