Source Code Cross Referenced for TestServletContext.java in  » Web-Framework » calyxo » de » odysseus » calyxo » base » test » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Framework » calyxo » de.odysseus.calyxo.base.test 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2004, 2005, 2006 Odysseus Software GmbH
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *     http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:        package de.odysseus.calyxo.base.test;
017:
018:        import java.io.InputStream;
019:        import java.net.MalformedURLException;
020:        import java.net.URL;
021:        import java.util.Collections;
022:        import java.util.Enumeration;
023:        import java.util.HashMap;
024:        import java.util.Map;
025:        import java.util.Set;
026:
027:        import javax.servlet.RequestDispatcher;
028:        import javax.servlet.Servlet;
029:        import javax.servlet.ServletContext;
030:        import javax.servlet.ServletException;
031:
032:        /**
033:         * Mock servlet context for testing purposes.
034:         * Contains nothing but attribute values.
035:         * 
036:         * @author Christoph Beck
037:         */
038:        public class TestServletContext implements  ServletContext {
039:
040:            // contains entries of type string (attribute name) -> object (attribute values)
041:            private Map attributes;
042:
043:            /**
044:             * Creates a new instance.
045:             */
046:            public TestServletContext() {
047:                this (new HashMap());
048:            }
049:
050:            /**
051:             * Creates a new instance.
052:             *
053:             * @param attributes A java.util.Map containing entries whose
054:             *            keys are strings and whose values are objects.
055:             *            It represents the mapping from attribute names
056:             *            to attribute values.
057:             */
058:            public TestServletContext(Map attributes) {
059:                super ();
060:
061:                this .attributes = attributes;
062:            }
063:
064:            /* (non-Javadoc)
065:             * @see javax.servlet.ServletContext#getContext(java.lang.String)
066:             */
067:            public ServletContext getContext(String arg0) {
068:                throw new UnsupportedOperationException();
069:            }
070:
071:            /* (non-Javadoc)
072:             * @see javax.servlet.ServletContext#getMajorVersion()
073:             */
074:            public int getMajorVersion() {
075:                throw new UnsupportedOperationException();
076:            }
077:
078:            /* (non-Javadoc)
079:             * @see javax.servlet.ServletContext#getMinorVersion()
080:             */
081:            public int getMinorVersion() {
082:                throw new UnsupportedOperationException();
083:            }
084:
085:            /* (non-Javadoc)
086:             * @see javax.servlet.ServletContext#getMimeType(java.lang.String)
087:             */
088:            public String getMimeType(String arg0) {
089:                throw new UnsupportedOperationException();
090:            }
091:
092:            /* (non-Javadoc)
093:             * @see javax.servlet.ServletContext#getResourcePaths(java.lang.String)
094:             */
095:            public Set getResourcePaths(String arg0) {
096:                throw new UnsupportedOperationException();
097:            }
098:
099:            /**
100:             * Forward to {@link Class#getResource(java.lang.String)}
101:             */
102:            public URL getResource(String arg0) throws MalformedURLException {
103:                return getClass().getResource(arg0);
104:            }
105:
106:            /**
107:             * Forward to {@link Class#getResourceAsStream(java.lang.String)}
108:             */
109:            public InputStream getResourceAsStream(String arg0) {
110:                return getClass().getResourceAsStream(arg0);
111:            }
112:
113:            /* (non-Javadoc)
114:             * @see javax.servlet.ServletContext#getRequestDispatcher(java.lang.String)
115:             */
116:            public RequestDispatcher getRequestDispatcher(String arg0) {
117:                throw new UnsupportedOperationException();
118:            }
119:
120:            /* (non-Javadoc)
121:             * @see javax.servlet.ServletContext#getNamedDispatcher(java.lang.String)
122:             */
123:            public RequestDispatcher getNamedDispatcher(String arg0) {
124:                throw new UnsupportedOperationException();
125:            }
126:
127:            /* (non-Javadoc)
128:             * @see javax.servlet.ServletContext#getServlet(java.lang.String)
129:             */
130:            public Servlet getServlet(String arg0) throws ServletException {
131:                throw new UnsupportedOperationException();
132:            }
133:
134:            /* (non-Javadoc)
135:             * @see javax.servlet.ServletContext#getServlets()
136:             */
137:            public Enumeration getServlets() {
138:                throw new UnsupportedOperationException();
139:            }
140:
141:            /* (non-Javadoc)
142:             * @see javax.servlet.ServletContext#getServletNames()
143:             */
144:            public Enumeration getServletNames() {
145:                throw new UnsupportedOperationException();
146:            }
147:
148:            /* (non-Javadoc)
149:             * @see javax.servlet.ServletContext#log(java.lang.String)
150:             */
151:            public void log(String arg0) {
152:                throw new UnsupportedOperationException();
153:            }
154:
155:            /* (non-Javadoc)
156:             * @see javax.servlet.ServletContext#log(java.lang.Exception, java.lang.String)
157:             */
158:            public void log(Exception arg0, String arg1) {
159:                throw new UnsupportedOperationException();
160:            }
161:
162:            /* (non-Javadoc)
163:             * @see javax.servlet.ServletContext#log(java.lang.String, java.lang.Throwable)
164:             */
165:            public void log(String arg0, Throwable arg1) {
166:                throw new UnsupportedOperationException();
167:            }
168:
169:            /* (non-Javadoc)
170:             * @see javax.servlet.ServletContext#getRealPath(java.lang.String)
171:             */
172:            public String getRealPath(String arg0) {
173:                throw new UnsupportedOperationException();
174:            }
175:
176:            /* (non-Javadoc)
177:             * @see javax.servlet.ServletContext#getServerInfo()
178:             */
179:            public String getServerInfo() {
180:                throw new UnsupportedOperationException();
181:            }
182:
183:            /* (non-Javadoc)
184:             * @see javax.servlet.ServletContext#getInitParameter(java.lang.String)
185:             */
186:            public String getInitParameter(String arg0) {
187:                throw new UnsupportedOperationException();
188:            }
189:
190:            /* (non-Javadoc)
191:             * @see javax.servlet.ServletContext#getInitParameterNames()
192:             */
193:            public Enumeration getInitParameterNames() {
194:                throw new UnsupportedOperationException();
195:            }
196:
197:            /* (non-Javadoc)
198:             * @see javax.servlet.ServletContext#getAttribute(java.lang.String)
199:             */
200:            public Object getAttribute(String arg0) {
201:                return attributes.get(arg0);
202:            }
203:
204:            /* (non-Javadoc)
205:             * @see javax.servlet.ServletContext#getAttributeNames()
206:             */
207:            public Enumeration getAttributeNames() {
208:                return Collections.enumeration(attributes.keySet());
209:            }
210:
211:            /* (non-Javadoc)
212:             * @see javax.servlet.ServletContext#setAttribute(java.lang.String, java.lang.Object)
213:             */
214:            public void setAttribute(String arg0, Object arg1) {
215:                attributes.put(arg0, arg1);
216:            }
217:
218:            /* (non-Javadoc)
219:             * @see javax.servlet.ServletContext#removeAttribute(java.lang.String)
220:             */
221:            public void removeAttribute(String arg0) {
222:                attributes.remove(arg0);
223:            }
224:
225:            /* (non-Javadoc)
226:             * @see javax.servlet.ServletContext#getServletContextName()
227:             */
228:            public String getServletContextName() {
229:                throw new UnsupportedOperationException();
230:            }
231:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.