1 15 package org.apache.tapestry.test.mock; 16 17 import java.util.Collections ; 18 import java.util.Enumeration ; 19 import java.util.HashMap ; 20 import java.util.Map ; 21 22 import javax.servlet.ServletConfig ; 23 import javax.servlet.ServletContext ; 24 25 32 33 public class MockServletConfig implements ServletConfig , InitParameterHolder 34 { 35 private String _name; 36 private ServletContext _context; 37 private Map _initParameters = new HashMap (); 38 39 public MockServletConfig(String name, ServletContext context) 40 { 41 _name = name; 42 _context = context; 43 } 44 45 public String getInitParameter(String name) 46 { 47 return (String ) _initParameters.get(name); 48 } 49 50 public Enumeration getInitParameterNames() 51 { 52 return Collections.enumeration(_initParameters.keySet()); 53 } 54 55 public ServletContext getServletContext() 56 { 57 return _context; 58 } 59 60 public String getServletName() 61 { 62 return _name; 63 } 64 65 public void setInitParameter(String name, String value) 66 { 67 _initParameters.put(name, value); 68 } 69 70 } 71 | Popular Tags |