01: // Copyright (C) 2003,2004,2005 by Object Mentor, Inc. All rights reserved.
02: // Released under the terms of the GNU General Public License version 2 or later.
03: package fitnesse.http;
04:
05: public class MockRequest extends Request {
06: private Exception parseException = null;
07:
08: public MockRequest() {
09: resource = "";
10: }
11:
12: public void setRequestUri(String value) {
13: requestURI = value;
14: }
15:
16: public void setRequestLine(String value) {
17: requestLine = value;
18: }
19:
20: public void setResource(String value) {
21: resource = value;
22: }
23:
24: public void setBody(String value) {
25: entityBody = value;
26: }
27:
28: public void setQueryString(String value) {
29: queryString = value;
30: parseQueryString(value);
31: }
32:
33: public void addInput(String key, Object value) {
34: inputs.put(key, value);
35: }
36:
37: public void addHeader(String key, Object value) {
38: headers.put(key.toLowerCase(), value);
39: }
40:
41: public void throwExceptionOnParse(Exception e) {
42: parseException = e;
43: }
44:
45: public void getCredentials() {
46: return;
47: }
48:
49: public void setCredentials(String username, String password) {
50: authorizationUsername = username;
51: authorizationPassword = password;
52:
53: }
54:
55: public void parse() throws Exception {
56: if (parseException != null) {
57: throw parseException;
58: }
59: }
60: }
|