Java Doc for ServletTestModule.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 Reference  Class Diagram Java Document (Java Doc) 


com.mockrunner.base.HTMLOutputModule
   com.mockrunner.servlet.ServletTestModule

ServletTestModule
public class ServletTestModule extends HTMLOutputModule (Code)
Module for servlet and filter tests. Can test single servlets and filters and simulate a filter chain.



Constructor Summary
public  ServletTestModule(WebMockObjectFactory mockFactory)
    

Method Summary
public  voidaddFilter(Filter filter)
     Adds the specified filter to the filter chain without initializing it.
public  voidaddFilter(Filter filter, boolean doInit)
     Adds the specified filter it to the filter chain.
public  voidclearOutput()
    
public  FiltercreateFilter(Class filterClass)
     Creates a filter, initializes it and adds it to the filter chain.
public  HttpServletcreateServlet(Class servletClass)
     Creates a servlet and initializes it.
public  voiddoDelete()
     Calls the current servlets doDelete method.
public  voiddoFilter()
     Loops through the filter chain and calls the current servlets service method at the end (only if a current servlet is set).
public  voiddoGet()
     Calls the current servlets doGet method.
public  voiddoHead()
     Calls the current servlets doHead method.
public  voiddoOptions()
     Calls the current servlets doOptions method.
public  voiddoPost()
     Calls the current servlets doPost method.
public  voiddoPut()
     Calls the current servlets doPut method.
public  voiddoTrace()
     Calls the current servlets doTrace method.
public  ServletRequestgetFilteredRequest()
     Returns the last request from the filter chain.
public  ServletResponsegetFilteredResponse()
     Returns the last response from the filter chain.
public  StringgetOutput()
     Returns the servlet output as a string.
public  HttpServletgetServlet()
     Returns the current servlet.
public  voidinit()
     Calls the current servlets init method.
public  voidreleaseFilters()
     Deletes all filters in the filter chain.
public  voidservice()
     Calls the current servlets service method.
public  voidsetDoChain(boolean doChain)
     If doChain is set to true (default is false) every call of one of the servlet methods will go through the filter chain before calling the servlet method.
public  voidsetServlet(HttpServlet servlet)
     Sets the specified servlet as the current servlet without initializing it.
public  voidsetServlet(HttpServlet servlet, boolean doInit)
     Sets the specified servlet as the current servlet.


Constructor Detail
ServletTestModule
public ServletTestModule(WebMockObjectFactory mockFactory)(Code)




Method Detail
addFilter
public void addFilter(Filter filter)(Code)
Adds the specified filter to the filter chain without initializing it. You have to set the FilterConfig on your own. Usually you can use com.mockrunner.mock.web.WebMockObjectFactory.getMockFilterConfig .
Parameters:
  filter - the filter



addFilter
public void addFilter(Filter filter, boolean doInit)(Code)
Adds the specified filter it to the filter chain. Initializes it, if doInit is true.
Parameters:
  filter - the filter
Parameters:
  doInit - should init be called



clearOutput
public void clearOutput()(Code)
Clears the output content



createFilter
public Filter createFilter(Class filterClass)(Code)
Creates a filter, initializes it and adds it to the filter chain. filterClass must be of the type Filter, otherwise a RuntimeException will be thrown. You can loop through the filter chain with ServletTestModule.doFilter . If you set doChain to true every call of one of the servlet methods will go through the filter chain before calling the servlet method.
Parameters:
  filterClass - the class of the filter instance of Filter
throws:
  RuntimeException - if filterClass is not aninstance of Filter



createServlet
public HttpServlet createServlet(Class servletClass)(Code)
Creates a servlet and initializes it. servletClass must be of the type HttpServlet, otherwise a RuntimeException will be thrown. Sets the specified servlet as the current servlet and initializes the filter chain with it.
Parameters:
  servletClass - the class of the servlet instance of HttpServlet
throws:
  RuntimeException - if servletClass is not aninstance of HttpServlet



doDelete
public void doDelete()(Code)
Calls the current servlets doDelete method. If you set doChain to true (use ServletTestModule.setDoChain ), the filter chain will be called before doDelete.



doFilter
public void doFilter()(Code)
Loops through the filter chain and calls the current servlets service method at the end (only if a current servlet is set). You can use it to test single filters or the interaction of filters and servlets. If you set doChain to true (use ServletTestModule.setDoChain ), this method is called before any call of a servlet method. If a filter does not call it's chains doFilter method, the chain breaks and the servlet will not be called (just like it in the real container).



doGet
public void doGet()(Code)
Calls the current servlets doGet method. If you set doChain to true (use ServletTestModule.setDoChain ), the filter chain will be called before doGet.



doHead
public void doHead()(Code)
Calls the current servlets doHead method. If you set doChain to true (use ServletTestModule.setDoChain ), the filter chain will be called before doHead.



doOptions
public void doOptions()(Code)
Calls the current servlets doOptions method. If you set doChain to true (use ServletTestModule.setDoChain ), the filter chain will be called before doOptions.



doPost
public void doPost()(Code)
Calls the current servlets doPost method. If you set doChain to true (use ServletTestModule.setDoChain ), the filter chain will be called before doPost.



doPut
public void doPut()(Code)
Calls the current servlets doPut method. If you set doChain to true (use ServletTestModule.setDoChain ), the filter chain will be called before doPut.



doTrace
public void doTrace()(Code)
Calls the current servlets doTrace method. If you set doChain to true (use ServletTestModule.setDoChain ), the filter chain will be called before doTrace.



getFilteredRequest
public ServletRequest getFilteredRequest()(Code)
Returns the last request from the filter chain. Since filters can replace the request with a request wrapper, this method makes only sense after calling at least one filter, i.e. after calling ServletTestModule.doFilter or after calling one servlet method with doChain set to true. the filtered request



getFilteredResponse
public ServletResponse getFilteredResponse()(Code)
Returns the last response from the filter chain. Since filters can replace the response with a response wrapper, this method makes only sense after calling at least one filter, i.e. after calling ServletTestModule.doFilter or after calling one servlet method with doChain set to true. the filtered response



getOutput
public String getOutput()(Code)
Returns the servlet output as a string. Flushes the output before returning it. the servlet output



getServlet
public HttpServlet getServlet()(Code)
Returns the current servlet. the servlet



init
public void init()(Code)
Calls the current servlets init method. Is automatically done when calling ServletTestModule.createServlet .



releaseFilters
public void releaseFilters()(Code)
Deletes all filters in the filter chain.



service
public void service()(Code)
Calls the current servlets service method. If you set doChain to true (use ServletTestModule.setDoChain ), the filter chain will be called before service.



setDoChain
public void setDoChain(boolean doChain)(Code)
If doChain is set to true (default is false) every call of one of the servlet methods will go through the filter chain before calling the servlet method.
Parameters:
  doChain - true if the chain should be called



setServlet
public void setServlet(HttpServlet servlet)(Code)
Sets the specified servlet as the current servlet without initializing it. You have to set the ServletConfig on your own. Usually you can use com.mockrunner.mock.web.WebMockObjectFactory.getMockServletConfig .
Parameters:
  servlet - the servlet



setServlet
public void setServlet(HttpServlet servlet, boolean doInit)(Code)
Sets the specified servlet as the current servlet. Initializes it, if doInit is true.
Parameters:
  servlet - the servlet
Parameters:
  doInit - should init be called



Methods inherited from com.mockrunner.base.HTMLOutputModule
abstract public String getOutput()(Code)(Java Doc)
public BufferedReader getOutputAsBufferedReader()(Code)(Java Doc)
public org.jdom.Document getOutputAsJDOMDocument()(Code)(Java Doc)
public org.w3c.dom.Document getOutputAsW3CDocument()(Code)(Java Doc)
public String getOutputAsWellformedXML()(Code)(Java Doc)
public void setCaseSensitive(boolean caseSensitive)(Code)(Java Doc)
public void verifyOutput(String expectedOutput)(Code)(Java Doc)
public void verifyOutputContains(String expectedOutput)(Code)(Java Doc)
public void verifyOutputRegularExpression(String expression)(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.