001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.jetspeed.mocks;
018:
019: import java.util.HashMap;
020: import java.util.Map;
021:
022: import javax.servlet.ServletContext;
023:
024: import com.mockrunner.mock.web.MockServletContext;
025:
026: public abstract class BaseMockServletContext extends MockServletContext
027: implements ServletContext {
028: private final Map attributes = new HashMap();
029:
030: public BaseMockServletContext() {
031: super ();
032: }
033:
034: public Object getAttribute(String arg0) {
035: return attributes.get(arg0);
036: }
037:
038: /*
039: public Enumeration getAttributeNames()
040: {
041: unsupported();
042: return null;
043: }
044:
045: public ServletContext getContext(String arg0)
046: {
047: unsupported();
048: return null;
049: }
050:
051: public String getInitParameter(String arg0)
052: {
053: unsupported();
054: return null;
055: }
056:
057: public Enumeration getInitParameterNames()
058: {
059: unsupported();
060: return null;
061: }
062:
063: public int getMajorVersion()
064: {
065: return 2;
066: }
067:
068: public String getMimeType(String arg0)
069: {
070: unsupported();
071: return null;
072: }
073:
074: public int getMinorVersion()
075: {
076: return 3;
077: }
078:
079: public RequestDispatcher getNamedDispatcher(String arg0)
080: {
081: unsupported();
082: return null;
083: }
084:
085: public String getRealPath(String arg0)
086: {
087: unsupported();
088: return null;
089: }
090:
091: public RequestDispatcher getRequestDispatcher(String arg0)
092: {
093: unsupported();
094: return null;
095: }
096:
097: public URL getResource(String arg0) throws MalformedURLException
098: {
099: unsupported();
100: return null;
101: }
102:
103: public InputStream getResourceAsStream(String arg0)
104: {
105: unsupported();
106: return null;
107: }
108:
109: public Set getResourcePaths(String arg0)
110: {
111: unsupported();
112: return null;
113: }
114:
115: public String getServerInfo()
116: {
117: unsupported();
118: return null;
119: }
120:
121: public Servlet getServlet(String arg0) throws ServletException
122: {
123: unsupported();
124: return null;
125: }
126:
127: public String getServletContextName()
128: {
129: unsupported();
130: return null;
131: }
132:
133: public Enumeration getServletNames()
134: {
135: unsupported();
136: return null;
137: }
138:
139: public Enumeration getServlets()
140: {
141: unsupported();
142: return null;
143: }
144:
145: public void log(Exception arg0, String arg1)
146: {
147: unsupported();
148:
149: }
150:
151: public void log(String arg0, Throwable arg1)
152: {
153: unsupported();
154:
155: }
156:
157: public void log(String arg0)
158: {
159: unsupported();
160:
161: }
162: */
163: public void removeAttribute(String arg0) {
164: attributes.remove(arg0);
165:
166: }
167:
168: public void setAttribute(String arg0, Object arg1) {
169: attributes.put(arg0, arg1);
170:
171: }
172:
173: protected final void unsupported()
174: throws UnsupportedOperationException {
175: throw new UnsupportedOperationException(
176: "The method called has not been implemented.");
177: }
178:
179: }
|