001 package com.mockrunner.servlet; 002 003 import javax.servlet.Filter; 004 import javax.servlet.ServletRequest; 005 import javax.servlet.ServletResponse; 006 import javax.servlet.http.HttpServlet; 007 008 import com.mockrunner.base.HTMLOutputModule; 009 import com.mockrunner.base.HTMLOutputTestCase; 010 011 /** 012 * Delegator for {@link com.mockrunner.servlet.ServletTestModule}. You can 013 * subclass this adapter or use {@link com.mockrunner.servlet.ServletTestModule} 014 * directly (so your test case can use another base class). 015 * This adapter extends {@link com.mockrunner.base.BaseTestCase}. 016 * It can be used if you want to use several modules in conjunction. 017 * <b>This class is generated from the {@link com.mockrunner.servlet.ServletTestModule} 018 * and should not be edited directly</b>. 019 */ 020 public abstract class ServletTestCaseAdapter extends HTMLOutputTestCase 021 { 022 private ServletTestModule servletTestModule; 023 024 public ServletTestCaseAdapter() 025 { 026 027 } 028 029 public ServletTestCaseAdapter(String name) 030 { 031 super(name); 032 } 033 034 protected void tearDown() throws Exception 035 { 036 super.tearDown(); 037 servletTestModule = null; 038 } 039 040 /** 041 * Creates the {@link com.mockrunner.servlet.ServletTestModule}. If you 042 * overwrite this method, you must call <code>super.setUp()</code>. 043 */ 044 protected void setUp() throws Exception 045 { 046 super.setUp(); 047 servletTestModule = createServletTestModule(getWebMockObjectFactory()); 048 } 049 050 /** 051 * Returns the {@link com.mockrunner.servlet.ServletTestModule} as 052 * {@link com.mockrunner.base.HTMLOutputModule}. 053 * @return the {@link com.mockrunner.base.HTMLOutputModule} 054 */ 055 protected HTMLOutputModule getHTMLOutputModule() 056 { 057 return servletTestModule; 058 } 059 060 /** 061 * Gets the {@link com.mockrunner.servlet.ServletTestModule}. 062 * @return the {@link com.mockrunner.servlet.ServletTestModule} 063 */ 064 protected ServletTestModule getServletTestModule() 065 { 066 return servletTestModule; 067 } 068 069 /** 070 * Sets the {@link com.mockrunner.servlet.ServletTestModule}. 071 * @param servletTestModule the {@link com.mockrunner.servlet.ServletTestModule} 072 */ 073 protected void setServletTestModule(ServletTestModule servletTestModule) 074 { 075 this.servletTestModule = servletTestModule; 076 } 077 078 /** 079 * Delegates to {@link com.mockrunner.servlet.ServletTestModule#setServlet(HttpServlet)} 080 */ 081 protected void setServlet(HttpServlet servlet) 082 { 083 servletTestModule.setServlet(servlet); 084 } 085 086 /** 087 * Delegates to {@link com.mockrunner.servlet.ServletTestModule#setServlet(HttpServlet, boolean)} 088 */ 089 protected void setServlet(HttpServlet servlet, boolean doInit) 090 { 091 servletTestModule.setServlet(servlet, doInit); 092 } 093 094 /** 095 * Delegates to {@link com.mockrunner.servlet.ServletTestModule#doGet} 096 */ 097 protected void doGet() 098 { 099 servletTestModule.doGet(); 100 } 101 102 /** 103 * Delegates to {@link com.mockrunner.servlet.ServletTestModule#doPost} 104 */ 105 protected void doPost() 106 { 107 servletTestModule.doPost(); 108 } 109 110 /** 111 * Delegates to {@link com.mockrunner.servlet.ServletTestModule#doHead} 112 */ 113 protected void doHead() 114 { 115 servletTestModule.doHead(); 116 } 117 118 /** 119 * Delegates to {@link com.mockrunner.servlet.ServletTestModule#doPut} 120 */ 121 protected void doPut() 122 { 123 servletTestModule.doPut(); 124 } 125 126 /** 127 * Delegates to {@link com.mockrunner.servlet.ServletTestModule#doDelete} 128 */ 129 protected void doDelete() 130 { 131 servletTestModule.doDelete(); 132 } 133 134 /** 135 * Delegates to {@link com.mockrunner.servlet.ServletTestModule#doOptions} 136 */ 137 protected void doOptions() 138 { 139 servletTestModule.doOptions(); 140 } 141 142 /** 143 * Delegates to {@link com.mockrunner.servlet.ServletTestModule#doTrace} 144 */ 145 protected void doTrace() 146 { 147 servletTestModule.doTrace(); 148 } 149 150 /** 151 * Delegates to {@link com.mockrunner.servlet.ServletTestModule#getServlet} 152 */ 153 protected HttpServlet getServlet() 154 { 155 return servletTestModule.getServlet(); 156 } 157 158 /** 159 * Delegates to {@link com.mockrunner.servlet.ServletTestModule#createServlet(Class)} 160 */ 161 protected HttpServlet createServlet(Class servletClass) 162 { 163 return servletTestModule.createServlet(servletClass); 164 } 165 166 /** 167 * Delegates to {@link com.mockrunner.servlet.ServletTestModule#createFilter(Class)} 168 */ 169 protected Filter createFilter(Class filterClass) 170 { 171 return servletTestModule.createFilter(filterClass); 172 } 173 174 /** 175 * Delegates to {@link com.mockrunner.servlet.ServletTestModule#addFilter(Filter)} 176 */ 177 protected void addFilter(Filter filter) 178 { 179 servletTestModule.addFilter(filter); 180 } 181 182 /** 183 * Delegates to {@link com.mockrunner.servlet.ServletTestModule#addFilter(Filter, boolean)} 184 */ 185 protected void addFilter(Filter filter, boolean doInit) 186 { 187 servletTestModule.addFilter(filter, doInit); 188 } 189 190 /** 191 * Delegates to {@link com.mockrunner.servlet.ServletTestModule#releaseFilters} 192 */ 193 protected void releaseFilters() 194 { 195 servletTestModule.releaseFilters(); 196 } 197 198 /** 199 * Delegates to {@link com.mockrunner.servlet.ServletTestModule#setDoChain(boolean)} 200 */ 201 protected void setDoChain(boolean doChain) 202 { 203 servletTestModule.setDoChain(doChain); 204 } 205 206 /** 207 * Delegates to {@link com.mockrunner.servlet.ServletTestModule#doFilter} 208 */ 209 protected void doFilter() 210 { 211 servletTestModule.doFilter(); 212 } 213 214 /** 215 * Delegates to {@link com.mockrunner.servlet.ServletTestModule#getFilteredRequest} 216 */ 217 protected ServletRequest getFilteredRequest() 218 { 219 return servletTestModule.getFilteredRequest(); 220 } 221 222 /** 223 * Delegates to {@link com.mockrunner.servlet.ServletTestModule#getFilteredResponse} 224 */ 225 protected ServletResponse getFilteredResponse() 226 { 227 return servletTestModule.getFilteredResponse(); 228 } 229 230 /** 231 * Delegates to {@link com.mockrunner.servlet.ServletTestModule#clearOutput} 232 */ 233 protected void clearOutput() 234 { 235 servletTestModule.clearOutput(); 236 } 237 238 /** 239 * Delegates to {@link com.mockrunner.servlet.ServletTestModule#init} 240 */ 241 protected void init() 242 { 243 servletTestModule.init(); 244 } 245 246 /** 247 * Delegates to {@link com.mockrunner.servlet.ServletTestModule#service} 248 */ 249 protected void service() 250 { 251 servletTestModule.service(); 252 } 253 }