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.Collections;
18: import java.util.HashMap;
19: import java.util.Map;
20: import org.apache.commons.lang.NotImplementedException;
21: import org.araneaframework.InputData;
22: import org.araneaframework.OutputData;
23: import org.araneaframework.Path;
24:
25: /**
26: * @author toomas
27: *
28: */
29: public class MockInputData implements InputData {
30: private Map data;
31:
32: public MockInputData(Map data) {
33: this ();
34: this .data = data;
35: }
36:
37: public MockInputData() {
38: data = new HashMap();
39: }
40:
41: public Map getScopedData(Path path) {
42: /*System.out.println("getScopedData");
43: System.out.println("path is "+path);
44: System.out.println(data);*/
45: if (data.get(path.toString()) == null) {
46: //System.out.println("Returning null");
47: return Collections.unmodifiableMap(new HashMap());
48: } else {
49: //System.out.println("Returning "+data.get(path));
50: return Collections.unmodifiableMap((Map) data.get(path
51: .toString()));
52: }
53: }
54:
55: public void extend(Class interfaceClass, Object implementation) {
56: //XXX
57: throw new NotImplementedException();
58: }
59:
60: public Object narrow(Class interfaceClass) {
61: //XXX
62: throw new NotImplementedException();
63: }
64:
65: public Map getGlobalData() {
66: return data;
67: }
68:
69: public OutputData getOutputData() {
70: //XXX
71: throw new NotImplementedException();
72: }
73: }
|