Source Code Cross Referenced for BasicServletTestCaseAdapter.java in  » Testing » mockrunner-0.4 » com » mockrunner » servlet » 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 » Testing » mockrunner 0.4 » com.mockrunner.servlet 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.mockrunner.servlet;
002:
003:        import javax.servlet.Filter;
004:        import javax.servlet.ServletRequest;
005:        import javax.servlet.ServletResponse;
006:        import javax.servlet.http.HttpServlet;
007:
008:        import com.mockrunner.base.BasicHTMLOutputTestCase;
009:        import com.mockrunner.base.HTMLOutputModule;
010:        import com.mockrunner.mock.web.WebMockObjectFactory;
011:
012:        /**
013:         * Delegator for {@link com.mockrunner.servlet.ServletTestModule}. You can
014:         * subclass this adapter or use {@link com.mockrunner.servlet.ServletTestModule}
015:         * directly (so your test case can use another base class).
016:         * This basic adapter can be used if you don't need any other modules. It
017:         * does not extend {@link com.mockrunner.base.BaseTestCase}. If you want
018:         * to use several modules in conjunction, consider subclassing
019:         * {@link com.mockrunner.servlet.ServletTestCaseAdapter}.
020:         * <b>This class is generated from the {@link com.mockrunner.servlet.ServletTestModule}
021:         * and should not be edited directly</b>.
022:         */
023:        public abstract class BasicServletTestCaseAdapter extends
024:                BasicHTMLOutputTestCase {
025:            private ServletTestModule servletTestModule;
026:            private WebMockObjectFactory webMockObjectFactory;
027:
028:            public BasicServletTestCaseAdapter() {
029:
030:            }
031:
032:            public BasicServletTestCaseAdapter(String name) {
033:                super (name);
034:            }
035:
036:            protected void tearDown() throws Exception {
037:                super .tearDown();
038:                servletTestModule = null;
039:                webMockObjectFactory = null;
040:            }
041:
042:            /**
043:             * Creates the {@link com.mockrunner.servlet.ServletTestModule}. If you
044:             * overwrite this method, you must call <code>super.setUp()</code>.
045:             */
046:            protected void setUp() throws Exception {
047:                super .setUp();
048:                servletTestModule = createServletTestModule(getWebMockObjectFactory());
049:            }
050:
051:            /**
052:             * Creates a {@link com.mockrunner.mock.web.WebMockObjectFactory}.
053:             * @return the created {@link com.mockrunner.mock.web.WebMockObjectFactory}
054:             */
055:            protected WebMockObjectFactory createWebMockObjectFactory() {
056:                return new WebMockObjectFactory();
057:            }
058:
059:            /**
060:             * Same as <code>createWebMockObjectFactory(otherFactory, true)</code>.
061:             */
062:            protected WebMockObjectFactory createWebMockObjectFactory(
063:                    WebMockObjectFactory otherFactory) {
064:                return new WebMockObjectFactory(otherFactory);
065:            }
066:
067:            /**
068:             * Creates a {@link com.mockrunner.mock.web.WebMockObjectFactory} based on another 
069:             * {@link com.mockrunner.mock.web.WebMockObjectFactory}.
070:             * The created {@link com.mockrunner.mock.web.WebMockObjectFactory} will have its own
071:             * request and response objects. If you set <i>createNewSession</i>
072:             * to <code>true</code> it will also have its own session object.
073:             * The two factories will share one <code>ServletContext</code>.
074:             * Especially important for multithreading tests.
075:             * If you set <i>createNewSession</i> to false, the two factories
076:             * will share one session. This setting simulates multiple requests
077:             * from the same client.
078:             * @param otherFactory the other factory
079:             * @param createNewSession create a new session for the new factory
080:             * @return the created {@link com.mockrunner.mock.web.WebMockObjectFactory}
081:             */
082:            protected WebMockObjectFactory createWebMockObjectFactory(
083:                    WebMockObjectFactory otherFactory, boolean createNewSession) {
084:                return new WebMockObjectFactory(otherFactory, createNewSession);
085:            }
086:
087:            /**
088:             * Gets the {@link com.mockrunner.mock.web.WebMockObjectFactory}.
089:             * @return the {@link com.mockrunner.mock.web.WebMockObjectFactory}
090:             */
091:            protected WebMockObjectFactory getWebMockObjectFactory() {
092:                synchronized (WebMockObjectFactory.class) {
093:                    if (webMockObjectFactory == null) {
094:                        webMockObjectFactory = createWebMockObjectFactory();
095:                    }
096:                }
097:                return webMockObjectFactory;
098:            }
099:
100:            /**
101:             * Sets the {@link com.mockrunner.mock.web.WebMockObjectFactory}.
102:             * @param webMockObjectFactory the {@link com.mockrunner.mock.web.WebMockObjectFactory}
103:             */
104:            protected void setWebMockObjectFactory(
105:                    WebMockObjectFactory webMockObjectFactory) {
106:                this .webMockObjectFactory = webMockObjectFactory;
107:            }
108:
109:            /**
110:             * Creates a {@link com.mockrunner.servlet.ServletTestModule} based on the current
111:             * {@link com.mockrunner.mock.web.WebMockObjectFactory}.
112:             * Same as <code>createServletTestModule(getWebMockObjectFactory())</code>.
113:             * @return the created {@link com.mockrunner.servlet.ServletTestModule}
114:             */
115:            protected ServletTestModule createServletTestModule() {
116:                return new ServletTestModule(getWebMockObjectFactory());
117:            }
118:
119:            /**
120:             * Creates a {@link com.mockrunner.servlet.ServletTestModule} with the specified
121:             * {@link com.mockrunner.mock.web.WebMockObjectFactory}.
122:             * @return the created {@link com.mockrunner.servlet.ServletTestModule}
123:             */
124:            protected ServletTestModule createServletTestModule(
125:                    WebMockObjectFactory mockFactory) {
126:                return new ServletTestModule(mockFactory);
127:            }
128:
129:            /**
130:             * Returns the {@link com.mockrunner.servlet.ServletTestModule} as
131:             * {@link com.mockrunner.base.HTMLOutputModule}.
132:             * @return the {@link com.mockrunner.base.HTMLOutputModule}
133:             */
134:            protected HTMLOutputModule getHTMLOutputModule() {
135:                return servletTestModule;
136:            }
137:
138:            /**
139:             * Gets the {@link com.mockrunner.servlet.ServletTestModule}.
140:             * @return the {@link com.mockrunner.servlet.ServletTestModule}
141:             */
142:            protected ServletTestModule getServletTestModule() {
143:                return servletTestModule;
144:            }
145:
146:            /**
147:             * Sets the {@link com.mockrunner.servlet.ServletTestModule}.
148:             * @param servletTestModule the {@link com.mockrunner.servlet.ServletTestModule}
149:             */
150:            protected void setServletTestModule(
151:                    ServletTestModule servletTestModule) {
152:                this .servletTestModule = servletTestModule;
153:            }
154:
155:            /**
156:             * Delegates to {@link com.mockrunner.servlet.ServletTestModule#setServlet(HttpServlet)}
157:             */
158:            protected void setServlet(HttpServlet servlet) {
159:                servletTestModule.setServlet(servlet);
160:            }
161:
162:            /**
163:             * Delegates to {@link com.mockrunner.servlet.ServletTestModule#setServlet(HttpServlet, boolean)}
164:             */
165:            protected void setServlet(HttpServlet servlet, boolean doInit) {
166:                servletTestModule.setServlet(servlet, doInit);
167:            }
168:
169:            /**
170:             * Delegates to {@link com.mockrunner.servlet.ServletTestModule#doGet}
171:             */
172:            protected void doGet() {
173:                servletTestModule.doGet();
174:            }
175:
176:            /**
177:             * Delegates to {@link com.mockrunner.servlet.ServletTestModule#doPost}
178:             */
179:            protected void doPost() {
180:                servletTestModule.doPost();
181:            }
182:
183:            /**
184:             * Delegates to {@link com.mockrunner.servlet.ServletTestModule#doHead}
185:             */
186:            protected void doHead() {
187:                servletTestModule.doHead();
188:            }
189:
190:            /**
191:             * Delegates to {@link com.mockrunner.servlet.ServletTestModule#doPut}
192:             */
193:            protected void doPut() {
194:                servletTestModule.doPut();
195:            }
196:
197:            /**
198:             * Delegates to {@link com.mockrunner.servlet.ServletTestModule#doDelete}
199:             */
200:            protected void doDelete() {
201:                servletTestModule.doDelete();
202:            }
203:
204:            /**
205:             * Delegates to {@link com.mockrunner.servlet.ServletTestModule#doOptions}
206:             */
207:            protected void doOptions() {
208:                servletTestModule.doOptions();
209:            }
210:
211:            /**
212:             * Delegates to {@link com.mockrunner.servlet.ServletTestModule#doTrace}
213:             */
214:            protected void doTrace() {
215:                servletTestModule.doTrace();
216:            }
217:
218:            /**
219:             * Delegates to {@link com.mockrunner.servlet.ServletTestModule#getServlet}
220:             */
221:            protected HttpServlet getServlet() {
222:                return servletTestModule.getServlet();
223:            }
224:
225:            /**
226:             * Delegates to {@link com.mockrunner.servlet.ServletTestModule#createServlet(Class)}
227:             */
228:            protected HttpServlet createServlet(Class servletClass) {
229:                return servletTestModule.createServlet(servletClass);
230:            }
231:
232:            /**
233:             * Delegates to {@link com.mockrunner.servlet.ServletTestModule#createFilter(Class)}
234:             */
235:            protected Filter createFilter(Class filterClass) {
236:                return servletTestModule.createFilter(filterClass);
237:            }
238:
239:            /**
240:             * Delegates to {@link com.mockrunner.servlet.ServletTestModule#addFilter(Filter)}
241:             */
242:            protected void addFilter(Filter filter) {
243:                servletTestModule.addFilter(filter);
244:            }
245:
246:            /**
247:             * Delegates to {@link com.mockrunner.servlet.ServletTestModule#addFilter(Filter, boolean)}
248:             */
249:            protected void addFilter(Filter filter, boolean doInit) {
250:                servletTestModule.addFilter(filter, doInit);
251:            }
252:
253:            /**
254:             * Delegates to {@link com.mockrunner.servlet.ServletTestModule#releaseFilters}
255:             */
256:            protected void releaseFilters() {
257:                servletTestModule.releaseFilters();
258:            }
259:
260:            /**
261:             * Delegates to {@link com.mockrunner.servlet.ServletTestModule#setDoChain(boolean)}
262:             */
263:            protected void setDoChain(boolean doChain) {
264:                servletTestModule.setDoChain(doChain);
265:            }
266:
267:            /**
268:             * Delegates to {@link com.mockrunner.servlet.ServletTestModule#doFilter}
269:             */
270:            protected void doFilter() {
271:                servletTestModule.doFilter();
272:            }
273:
274:            /**
275:             * Delegates to {@link com.mockrunner.servlet.ServletTestModule#getFilteredRequest}
276:             */
277:            protected ServletRequest getFilteredRequest() {
278:                return servletTestModule.getFilteredRequest();
279:            }
280:
281:            /**
282:             * Delegates to {@link com.mockrunner.servlet.ServletTestModule#getFilteredResponse}
283:             */
284:            protected ServletResponse getFilteredResponse() {
285:                return servletTestModule.getFilteredResponse();
286:            }
287:
288:            /**
289:             * Delegates to {@link com.mockrunner.servlet.ServletTestModule#clearOutput}
290:             */
291:            protected void clearOutput() {
292:                servletTestModule.clearOutput();
293:            }
294:
295:            /**
296:             * Delegates to {@link com.mockrunner.servlet.ServletTestModule#init}
297:             */
298:            protected void init() {
299:                servletTestModule.init();
300:            }
301:
302:            /**
303:             * Delegates to {@link com.mockrunner.servlet.ServletTestModule#service}
304:             */
305:            protected void service() {
306:                servletTestModule.service();
307:            }
308:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.