View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  
20  package org.apache.myfaces.tobago.internal.mock.servlet;
21  
22  import javax.servlet.RequestDispatcher;
23  import javax.servlet.Servlet;
24  import javax.servlet.ServletContext;
25  import javax.servlet.ServletException;
26  import java.io.InputStream;
27  import java.net.MalformedURLException;
28  import java.net.URL;
29  import java.util.Enumeration;
30  import java.util.HashMap;
31  import java.util.Map;
32  import java.util.Set;
33  
34  public class MockServletContext implements ServletContext {
35    private Map attributes = new HashMap();
36  
37    public Set getResourcePaths(final String reference) {
38      return null;
39    }
40  
41    public Object getAttribute(final String s) {
42      return attributes.get(s);
43    }
44  
45    public Enumeration getAttributeNames() {
46      return null;
47    }
48  
49    public String getContextPath() {
50      return "";
51    }
52  
53    public ServletContext getContext(final String s) {
54      return null;
55    }
56  
57    public String getInitParameter(final String s) {
58      return null;
59    }
60  
61    public Enumeration getInitParameterNames() {
62      return null;
63    }
64  
65    public int getMajorVersion() {
66      return 0;
67    }
68  
69    public String getMimeType(final String s) {
70      return null;
71    }
72  
73    public int getMinorVersion() {
74      return 0;
75    }
76  
77    public RequestDispatcher getNamedDispatcher(final String s) {
78      return null;
79    }
80  
81    public String getRealPath(final String s) {
82      return null;
83    }
84  
85    public RequestDispatcher getRequestDispatcher(final String s) {
86      return null;
87    }
88  
89    public URL getResource(final String s) throws MalformedURLException {
90      return null;
91    }
92  
93    public InputStream getResourceAsStream(final String s) {
94      return null;
95    }
96  
97    public Set getResourcePaths() {
98      return null;
99    }
100 
101   public String getServerInfo() {
102     return null;
103   }
104 
105   public Servlet getServlet(final String s) throws ServletException {
106     return null;
107   }
108 
109   public String getServletContextName() {
110     return null;
111   }
112 
113   public Enumeration getServletNames() {
114     return null;
115   }
116 
117   public Enumeration getServlets() {
118     return null;
119   }
120 
121   public void log(final Exception e, final String s) {
122   }
123 
124   public void log(final String s) {
125   }
126 
127   public void log(final String s, final Throwable throwable) {
128   }
129 
130   public void removeAttribute(final String s) {
131   }
132 
133   public void setAttribute(final String s, final Object o) {
134     attributes.put(s, o);
135   }
136 }