1 /*
2 * Angkor Web Framework
3 *
4 * Distributable under LGPL license.
5 * See terms of license at gnu.org.
6 */
7
8 package com.tirsen.angkor.test.unit.mock;
9
10 import org.apache.commons.logging.Log;
11 import org.apache.commons.logging.LogFactory;
12
13 import javax.servlet.RequestDispatcher;
14 import javax.servlet.ServletInputStream;
15 import javax.servlet.http.Cookie;
16 import javax.servlet.http.HttpServletRequest;
17 import javax.servlet.http.HttpSession;
18 import java.io.BufferedReader;
19 import java.io.IOException;
20 import java.io.UnsupportedEncodingException;
21 import java.security.Principal;
22 import java.util.Enumeration;
23 import java.util.Locale;
24 import java.util.Map;
25
26 import com.tirsen.angkor.Application;
27 import com.tirsen.angkor.ApplicationFactory;
28
29 /***
30 * TODO document MockServletRequest
31 *
32 * <!-- $Id: MockServletRequest.java,v 1.4 2002/10/13 19:59:23 tirsen Exp $ -->
33 *
34 * @author $Author: tirsen $
35 * @version $Revision: 1.4 $
36 */
37 public class MockServletRequest implements HttpServletRequest
38 {
39 private static Log logger = LogFactory.getLog(MockServletRequest.class);
40
41 private String requestURI = "/app";
42
43 public MockServletRequest()
44 {
45 }
46
47 public MockServletRequest(String requestURI)
48 {
49 this.requestURI = requestURI;
50 }
51
52 public MockServletRequest(Application application, String requestURI)
53 {
54 this(application);
55 this.requestURI = requestURI;
56 }
57
58 public MockServletRequest(Application application)
59 {
60 ApplicationFactory applicationFactory = new ApplicationFactory(getSession());
61 applicationFactory.setApplication(application);
62 }
63
64 private MockHttpSession session = new MockHttpSession();
65
66 public Object getAttribute(String s)
67 {
68 // TODO implement MockServletRequest.getAttribute
69 throw new RuntimeException("MockServletRequest.getAttribute is not implemented yet.");
70 }
71
72 public Enumeration getAttributeNames()
73 {
74 // TODO implement MockServletRequest.getAttributeNames
75 throw new RuntimeException("MockServletRequest.getAttributeNames is not implemented yet.");
76 }
77
78 public String getCharacterEncoding()
79 {
80 // TODO implement MockServletRequest.getCharacterEncoding
81 throw new RuntimeException("MockServletRequest.getCharacterEncoding is not implemented yet.");
82 }
83
84 public void setCharacterEncoding(String s) throws UnsupportedEncodingException
85 {
86 // TODO implement MockServletRequest.setCharacterEncoding
87 throw new RuntimeException("MockServletRequest.setCharacterEncoding is not implemented yet.");
88 }
89
90 public int getContentLength()
91 {
92 // TODO implement MockServletRequest.getContentLength
93 throw new RuntimeException("MockServletRequest.getContentLength is not implemented yet.");
94 }
95
96 public String getContentType()
97 {
98 // TODO implement MockServletRequest.getContentType
99 throw new RuntimeException("MockServletRequest.getContentType is not implemented yet.");
100 }
101
102 public ServletInputStream getInputStream() throws IOException
103 {
104 // TODO implement MockServletRequest.getInputStream
105 throw new RuntimeException("MockServletRequest.getInputStream is not implemented yet.");
106 }
107
108 public String getParameter(String s)
109 {
110 // TODO implement MockServletRequest.getParameter
111 throw new RuntimeException("MockServletRequest.getParameter is not implemented yet.");
112 }
113
114 public Enumeration getParameterNames()
115 {
116 // TODO implement MockServletRequest.getParameterNames
117 throw new RuntimeException("MockServletRequest.getParameterNames is not implemented yet.");
118 }
119
120 public String[] getParameterValues(String s)
121 {
122 // TODO implement MockServletRequest.getParameterValues
123 throw new RuntimeException("MockServletRequest.getParameterValues is not implemented yet.");
124 }
125
126 public Map getParameterMap()
127 {
128 // TODO implement MockServletRequest.getParameterMap
129 throw new RuntimeException("MockServletRequest.getParameterMap is not implemented yet.");
130 }
131
132 public String getProtocol()
133 {
134 // TODO implement MockServletRequest.getProtocol
135 throw new RuntimeException("MockServletRequest.getProtocol is not implemented yet.");
136 }
137
138 public String getScheme()
139 {
140 return "http";
141 }
142
143 public String getServerName()
144 {
145 return "localhost";
146 }
147
148 public int getServerPort()
149 {
150 return 80;
151 }
152
153 public BufferedReader getReader() throws IOException
154 {
155 // TODO implement MockServletRequest.getReader
156 throw new RuntimeException("MockServletRequest.getReader is not implemented yet.");
157 }
158
159 public String getRemoteAddr()
160 {
161 // TODO implement MockServletRequest.getRemoteAddr
162 throw new RuntimeException("MockServletRequest.getRemoteAddr is not implemented yet.");
163 }
164
165 public String getRemoteHost()
166 {
167 // TODO implement MockServletRequest.getRemoteHost
168 throw new RuntimeException("MockServletRequest.getRemoteHost is not implemented yet.");
169 }
170
171 public void setAttribute(String s, Object o)
172 {
173 // TODO implement MockServletRequest.setAttribute
174 throw new RuntimeException("MockServletRequest.setAttribute is not implemented yet.");
175 }
176
177 public void removeAttribute(String s)
178 {
179 // TODO implement MockServletRequest.removeAttribute
180 throw new RuntimeException("MockServletRequest.removeAttribute is not implemented yet.");
181 }
182
183 public Locale getLocale()
184 {
185 // TODO implement MockServletRequest.getLocale
186 throw new RuntimeException("MockServletRequest.getLocale is not implemented yet.");
187 }
188
189 public Enumeration getLocales()
190 {
191 // TODO implement MockServletRequest.getLocales
192 throw new RuntimeException("MockServletRequest.getLocales is not implemented yet.");
193 }
194
195 public boolean isSecure()
196 {
197 // TODO implement MockServletRequest.isSecure
198 throw new RuntimeException("MockServletRequest.isSecure is not implemented yet.");
199 }
200
201 public RequestDispatcher getRequestDispatcher(String s)
202 {
203 // TODO implement MockServletRequest.getRequestDispatcher
204 throw new RuntimeException("MockServletRequest.getRequestDispatcher is not implemented yet.");
205 }
206
207 public String getRealPath(String s)
208 {
209 // TODO implement MockServletRequest.getRealPath
210 throw new RuntimeException("MockServletRequest.getRealPath is not implemented yet.");
211 }
212
213 public String getAuthType()
214 {
215 // TODO implement MockServletRequest.getAuthType
216 throw new RuntimeException("MockServletRequest.getAuthType is not implemented yet.");
217 }
218
219 public Cookie[] getCookies()
220 {
221 // TODO implement MockServletRequest.getCookies
222 throw new RuntimeException("MockServletRequest.getCookies is not implemented yet.");
223 }
224
225 public long getDateHeader(String s)
226 {
227 // TODO implement MockServletRequest.getDateHeader
228 throw new RuntimeException("MockServletRequest.getDateHeader is not implemented yet.");
229 }
230
231 public String getHeader(String s)
232 {
233 // TODO implement MockServletRequest.getHeader
234 throw new RuntimeException("MockServletRequest.getHeader is not implemented yet.");
235 }
236
237 public Enumeration getHeaders(String s)
238 {
239 // TODO implement MockServletRequest.getHeaders
240 throw new RuntimeException("MockServletRequest.getHeaders is not implemented yet.");
241 }
242
243 public Enumeration getHeaderNames()
244 {
245 // TODO implement MockServletRequest.getHeaderNames
246 throw new RuntimeException("MockServletRequest.getHeaderNames is not implemented yet.");
247 }
248
249 public int getIntHeader(String s)
250 {
251 // TODO implement MockServletRequest.getIntHeader
252 throw new RuntimeException("MockServletRequest.getIntHeader is not implemented yet.");
253 }
254
255 public String getMethod()
256 {
257 // TODO implement MockServletRequest.getMethod
258 throw new RuntimeException("MockServletRequest.getMethod is not implemented yet.");
259 }
260
261 public boolean isRequestedSessionIdFromUrl()
262 {
263 // TODO implement MockServletRequest.isRequestedSessionIdFromUrl
264 throw new RuntimeException("MockServletRequest.isRequestedSessionIdFromUrl is not implemented yet.");
265 }
266
267 public boolean isRequestedSessionIdFromURL()
268 {
269 // TODO implement MockServletRequest.isRequestedSessionIdFromURL
270 throw new RuntimeException("MockServletRequest.isRequestedSessionIdFromURL is not implemented yet.");
271 }
272
273 public boolean isRequestedSessionIdFromCookie()
274 {
275 // TODO implement MockServletRequest.isRequestedSessionIdFromCookie
276 throw new RuntimeException("MockServletRequest.isRequestedSessionIdFromCookie is not implemented yet.");
277 }
278
279 public boolean isRequestedSessionIdValid()
280 {
281 // TODO implement MockServletRequest.isRequestedSessionIdValid
282 throw new RuntimeException("MockServletRequest.isRequestedSessionIdValid is not implemented yet.");
283 }
284
285 public HttpSession getSession()
286 {
287 return session;
288 }
289
290 public HttpSession getSession(boolean b)
291 {
292 // TODO implement MockServletRequest.getSession
293 throw new RuntimeException("MockServletRequest.getSession is not implemented yet.");
294 }
295
296 public String getServletPath()
297 {
298 // TODO implement MockServletRequest.getServletPath
299 throw new RuntimeException("MockServletRequest.getServletPath is not implemented yet.");
300 }
301
302 public StringBuffer getRequestURL()
303 {
304 // TODO implement MockServletRequest.getRequestURL
305 throw new RuntimeException("MockServletRequest.getRequestURL is not implemented yet.");
306 }
307
308 public String getRequestURI()
309 {
310 return requestURI;
311 }
312
313 public void setRequestURI(String requestURI)
314 {
315 this.requestURI = requestURI;
316 }
317
318 public String getRequestedSessionId()
319 {
320 // TODO implement MockServletRequest.getRequestedSessionId
321 throw new RuntimeException("MockServletRequest.getRequestedSessionId is not implemented yet.");
322 }
323
324 public Principal getUserPrincipal()
325 {
326 // TODO implement MockServletRequest.getUserPrincipal
327 throw new RuntimeException("MockServletRequest.getUserPrincipal is not implemented yet.");
328 }
329
330 public boolean isUserInRole(String s)
331 {
332 // TODO implement MockServletRequest.isUserInRole
333 throw new RuntimeException("MockServletRequest.isUserInRole is not implemented yet.");
334 }
335
336 public String getRemoteUser()
337 {
338 // TODO implement MockServletRequest.getRemoteUser
339 throw new RuntimeException("MockServletRequest.getRemoteUser is not implemented yet.");
340 }
341
342 public String getQueryString()
343 {
344 // TODO implement MockServletRequest.getQueryString
345 throw new RuntimeException("MockServletRequest.getQueryString is not implemented yet.");
346 }
347
348 public String getContextPath()
349 {
350 return "TODO";
351 }
352
353 public String getPathTranslated()
354 {
355 // TODO implement MockServletRequest.getPathTranslated
356 throw new RuntimeException("MockServletRequest.getPathTranslated is not implemented yet.");
357 }
358
359 public String getPathInfo()
360 {
361 // TODO implement MockServletRequest.getPathInfo
362 throw new RuntimeException("MockServletRequest.getPathInfo is not implemented yet.");
363 }
364 }
This page was automatically generated by Maven