01: /**
02: * Copyright 2006 Webmedia Group Ltd.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: **/package org.araneaframework.mock;
16:
17: import java.util.HashMap;
18: import javax.servlet.http.HttpServletRequest;
19: import javax.servlet.http.HttpServletResponse;
20: import org.araneaframework.Environment;
21: import org.araneaframework.Path;
22: import org.araneaframework.core.StandardEnvironment;
23: import org.araneaframework.core.StandardPath;
24: import org.araneaframework.http.core.StandardServletInputData;
25: import org.araneaframework.http.core.StandardServletOutputData;
26: import org.springframework.mock.web.MockHttpServletRequest;
27: import org.springframework.mock.web.MockHttpServletResponse;
28:
29: /**
30: * @author "Toomas Römer" <toomas@webmedia.ee>
31: *
32: */
33: public class MockUtil {
34: public static StandardServletInputData getInput() {
35: HttpServletRequest req = new MockHttpServletRequest();
36: return new StandardServletInputData(req);
37: }
38:
39: public static StandardServletOutputData getOutput() {
40: HttpServletRequest req = new MockHttpServletRequest();
41: HttpServletResponse res = new MockHttpServletResponse();
42: return new StandardServletOutputData(req, res);
43: }
44:
45: public static Path getPath() {
46: return new StandardPath("");
47: }
48:
49: public static Path getPath(String str) {
50: return new StandardPath(str);
51: }
52:
53: public static Environment getEnv() {
54: return new StandardEnvironment(null, new HashMap());
55: }
56: }
|