1 18 19 20 package org.apache.struts.mock; 21 22 23 import java.util.Enumeration ; 24 import java.util.HashMap ; 25 26 import javax.servlet.ServletConfig ; 27 import javax.servlet.ServletContext ; 28 29 30 46 47 public class MockServletConfig implements ServletConfig { 48 49 50 51 53 54 public MockServletConfig() { 55 super(); 56 } 57 58 59 public MockServletConfig(ServletContext context) { 60 super(); 61 setServletContext(context); 62 } 63 64 65 67 68 protected ServletContext context = null; 69 protected HashMap parameters = new HashMap (); 70 71 72 74 75 public void addInitParameter(String name, String value) { 76 parameters.put(name, value); 77 } 78 79 80 public void setServletContext(ServletContext context) { 81 this.context = context; 82 } 83 84 85 87 88 public String getInitParameter(String name) { 89 return ((String ) parameters.get(name)); 90 } 91 92 93 public Enumeration getInitParameterNames() { 94 return (new MockEnumeration(parameters.keySet().iterator())); 95 } 96 97 98 public ServletContext getServletContext() { 99 return (this.context); 100 } 101 102 103 public String getServletName() { 104 return ("action"); 105 } 106 107 108 } 109 | Popular Tags |