Java Doc for MockResponse.java in  » Web-Framework » rife-1.6.1 » com » uwyn » rife » 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 » rife 1.6.1 » com.uwyn.rife.test 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.uwyn.rife.engine.AbstractResponse
      com.uwyn.rife.test.MockResponse

MockResponse
public class MockResponse extends AbstractResponse (Code)
Provides a Response implementation that is suitable for testing a web application outside of a servlet container.
author:
   Geert Bevin (gbevin[remove] at uwyn dot com)
version:
   $Revision: 3669 $
since:
   1.1

Inner Class :static class QuotedStringTokenizer extends StringTokenizer


Constructor Summary
 MockResponse(MockConversation conversation, Request request)
    

Method Summary
protected  String_getCharacterEncoding()
    
protected  OutputStream_getOutputStream()
    
protected  void_sendRedirect(String location)
    
protected  void_setContentLength(int length)
    
protected  void_setContentType(String contentType)
    
public  voidaddCookie(Cookie cookie)
    
public  voidaddDateHeader(String name, long date)
    
public  voidaddHeader(String name, String value)
    
public  voidaddIntHeader(String name, int integer)
    
public  booleancontainsHeader(String name)
    
public  ResponsecreateEmbeddedResponse(String valueId, String differentiator)
    
public  StringencodeURL(String url)
    
public  byte[]getBytes()
     Retrieves the an array of all the bytes that have been written to this reponse.
public  StringgetContentType()
    
public  longgetDateHeader(String name)
     Returns the value of the specified response header as a long value that represents a Date object.
public  MockResponsegetEmbeddedResponse(String valueId)
     Retrieves the embedded response that corresponds to a specific value in the embedding template.
public  List<MockResponse>getEmbeddedResponses()
     Retrieves the embedded responses that were processed.
public  StringgetHeader(String name)
     Returns the value of the specified response header as a String.
public  CollectiongetHeaderNames()
     Returns the value of the specified response header as a String.
public  CollectiongetHeaders(String name)
     Returns all the values of the specified response header as an Collection of String objects.

If the response did not include any headers of the specified name, this method returns an empty Collection.

public  HttpServletResponsegetHttpServletResponse()
    
public  intgetIntHeader(String name)
     Returns the value of the specified response header as an int.
public  StringgetLastElementId()
     Retrieves the identifier of the element that was last processed with this response.
public  ElementInfogetLastElementInfo()
     Retrieves the ElementInfo of the element that was last processed with this response.
public  LocalegetLocale()
    
 MockConversationgetMockConversation()
    
public  List<String>getNewCookieNames()
     Retrieves the list of cookies that have been added in this reponse.
public  ParsedHtmlgetParsedHtml()
     Retrieves the content of this reponse as parsed HTML.
public  StringgetReason()
     Returns the error reason of this response.
public  intgetStatus()
     Returns the status code of this response.
public  TemplategetTemplate()
     Retrieves the template instance that was printed to the response.
public  StringgetText()
     Retrieves the content of this reponse as text.
public  PrintWritergetWriter()
    
public  voidprint(Template template)
    
public  voidremoveHeader(String name)
     Removes a response header with the given name.
public  voidsendError(int statusCode)
    
public  voidsendError(int statusCode, String message)
    
public  voidsetDateHeader(String name, long date)
    
public  voidsetHeader(String name, String value)
    
public  voidsetIntHeader(String name, int value)
    
public  voidsetLocale(Locale locale)
    
public  voidsetStatus(int statusCode)
    
public  voidvalidateAsXml()
     Validates the response as an XML document.
public  BooleanxpathBoolean(String expression)
     Evaluate an XPath expression in the context of the response text and return the result as a boolean.
exception:
  XPathExpressionException - if expression cannot be evaluated.
public  BooleanxpathBoolean(String expression, Object context)
     Evaluate an XPath expression in the provided context object and return the result as a boolean.
exception:
  XPathExpressionException - if expression cannot be evaluated.
public  NodexpathNode(String expression)
     Evaluate an XPath expression in the context of the response text and return the result as a DOM node.
exception:
  XPathExpressionException - if expression cannot be evaluated.
public  NodexpathNode(String expression, Object context)
     Evaluate an XPath expression in the provided context object and return the result as a DOM node.
exception:
  XPathExpressionException - if expression cannot be evaluated.
public  NodeListxpathNodeSet(String expression)
     Evaluate an XPath expression in the context of the response text and return the result as a list of DOM nodes.

More information about XPath can be found in the original specification or in this tutorial.
exception:
  XPathExpressionException - if expression cannot be evaluated.

public  NodeListxpathNodeSet(String expression, Object context)
     Evaluate an XPath expression in the provided context object and return the result as a list of DOM nodes.

More information about XPath can be found in the original specification or in this tutorial.
exception:
  XPathExpressionException - if expression cannot be evaluated.

public  DoublexpathNumber(String expression)
     Evaluate an XPath expression in the context of the response text and return the result as a number.
exception:
  XPathExpressionException - if expression cannot be evaluated.
public  DoublexpathNumber(String expression, Object context)
     Evaluate an XPath expression in the provided context object and return the result as a number.
exception:
  XPathExpressionException - if expression cannot be evaluated.
public  StringxpathString(String expression)
     Evaluate an XPath expression in the context of the response text and return the result as a string.
exception:
  XPathExpressionException - if expression cannot be evaluated.
public  StringxpathString(String expression, Object context)
     Evaluate an XPath expression in the provided context object and return the result as a string.
exception:
  XPathExpressionException - if expression cannot be evaluated.


Constructor Detail
MockResponse
MockResponse(MockConversation conversation, Request request)(Code)




Method Detail
_getCharacterEncoding
protected String _getCharacterEncoding()(Code)



_getOutputStream
protected OutputStream _getOutputStream() throws IOException(Code)



_sendRedirect
protected void _sendRedirect(String location)(Code)



_setContentLength
protected void _setContentLength(int length)(Code)



_setContentType
protected void _setContentType(String contentType)(Code)



addCookie
public void addCookie(Cookie cookie)(Code)



addDateHeader
public void addDateHeader(String name, long date)(Code)



addHeader
public void addHeader(String name, String value)(Code)



addIntHeader
public void addIntHeader(String name, int integer)(Code)



containsHeader
public boolean containsHeader(String name)(Code)



createEmbeddedResponse
public Response createEmbeddedResponse(String valueId, String differentiator)(Code)



encodeURL
public String encodeURL(String url)(Code)



getBytes
public byte[] getBytes()(Code)
Retrieves the an array of all the bytes that have been written to this reponse. an array of bytes with the response content
See Also:   MockResponse.getText
See Also:   MockResponse.getTemplate
See Also:   MockResponse.getParsedHtml
since:
   1.1



getContentType
public String getContentType()(Code)



getDateHeader
public long getDateHeader(String name)(Code)
Returns the value of the specified response header as a long value that represents a Date object. Use this method with headers that contain dates.

The date is returned as the number of milliseconds since January 1, 1970 GMT. The header name is case insensitive.

If the response did not have a header of the specified name, this method returns -1. If the header can't be converted to a date, the method throws an IllegalArgumentException.
Parameters:
  name - the name of the header
exception:
  java.lang.IllegalArgumentException - if the header value can'tbe converted to a date a long value representing the date specified inthe header expressed as the number of milliseconds since January 1,1970 GMT; or

-1 if the named header was not included with theresponse
since:
   1.1




getEmbeddedResponse
public MockResponse getEmbeddedResponse(String valueId)(Code)
Retrieves the embedded response that corresponds to a specific value in the embedding template.
Parameters:
  valueId - the template value in which the embedded element hasbeen processed, the "ELEMENT:" prefix is optional and will beautomatically added if you leave it off the embedded responses that corresponds to the value; or

null if no such value could be found
since:
   1.4




getEmbeddedResponses
public List<MockResponse> getEmbeddedResponses()(Code)
Retrieves the embedded responses that were processed. the collection of embedded responses; or

an empty collection if no embedded elements were processed
since:
   1.4




getHeader
public String getHeader(String name)(Code)
Returns the value of the specified response header as a String. If the reponse did not include a header of the specified name, this method returns null. The header name is case insensitive. You can use this method with any response header.
Parameters:
  name - the name of the header a String containing the value of the responseheader; or

null if the response does not have a header of thatname
since:
   1.1




getHeaderNames
public Collection getHeaderNames()(Code)
Returns the value of the specified response header as a String. If the reponse did not include a header of the specified name, this method returns null. The header name is case insensitive. You can use this method with any response header. a Collection of all the header names sent withthis response; or

if the response has no headers, an empty Collection
since:
   1.1




getHeaders
public Collection getHeaders(String name)(Code)
Returns all the values of the specified response header as an Collection of String objects.

If the response did not include any headers of the specified name, this method returns an empty Collection. The header name is case insensitive. You can use this method with any response header.
Parameters:
  name - the name of the header a Collection containing the values of the responseheader; or

if the response does not have any headers of that name return anempty Collection
since:
   1.1




getHttpServletResponse
public HttpServletResponse getHttpServletResponse()(Code)



getIntHeader
public int getIntHeader(String name)(Code)
Returns the value of the specified response header as an int. If the response does not have a header of the specified name, this method returns -1. If the header cannot be converted to an integer, this method throws a NumberFormatException.

The header name is case insensitive.
Parameters:
  name - the name of the header an integer expressing the value of the responseheader; or

-1 if the response doesn't have a header of this name
exception:
  java.lang.NumberFormatException - if the header value can't beconverted to an int
since:
   1.1




getLastElementId
public String getLastElementId()(Code)
Retrieves the identifier of the element that was last processed with this response. the identifier of the last element
See Also:   MockResponse.getLastElement
See Also:   MockResponse.getLastElementInfo
since:
   1.1



getLastElementInfo
public ElementInfo getLastElementInfo()(Code)
Retrieves the ElementInfo of the element that was last processed with this response. the ElementInfo of the last element
See Also:   MockResponse.getLastElement
See Also:   MockResponse.getLastElementId
since:
   1.1



getLocale
public Locale getLocale()(Code)



getMockConversation
MockConversation getMockConversation()(Code)



getNewCookieNames
public List<String> getNewCookieNames()(Code)
Retrieves the list of cookies that have been added in this reponse. the list of added cookies; or

an empty list if no cookies have been added
since:
   1.1




getParsedHtml
public ParsedHtml getParsedHtml() throws IOException, SAXException(Code)
Retrieves the content of this reponse as parsed HTML.
exception:
  IOException - when exception occured during the retrieval onthe response content
exception:
  SAXException - when exception occured during the parsing ofthe content as HTML the response content as parsed HTML
See Also:   MockResponse.getBytes
See Also:   MockResponse.getText
See Also:   MockResponse.getTemplate
since:
   1.1



getReason
public String getReason()(Code)
Returns the error reason of this response. an String expressing the reason of this response error
since:
   1.2



getStatus
public int getStatus()(Code)
Returns the status code of this response. an integer expressing the status code of thisresponse
since:
   1.2



getTemplate
public Template getTemplate()(Code)
Retrieves the template instance that was printed to the response. the template instance that was printed to the response; or

null of no template was printed to the response
See Also:   MockResponse.getBytes
See Also:   MockResponse.getText
See Also:   MockResponse.getParsedHtml
since:
   1.1




getText
public String getText()(Code)
Retrieves the content of this reponse as text. the response content as text
See Also:   MockResponse.getBytes
See Also:   MockResponse.getTemplate
See Also:   MockResponse.getParsedHtml
since:
   1.1



getWriter
public PrintWriter getWriter() throws IOException(Code)



print
public void print(Template template) throws EngineException(Code)



removeHeader
public void removeHeader(String name)(Code)
Removes a response header with the given name.
Parameters:
  name - the name of the header to remove
since:
   1.1



sendError
public void sendError(int statusCode) throws EngineException(Code)



sendError
public void sendError(int statusCode, String message) throws EngineException(Code)



setDateHeader
public void setDateHeader(String name, long date)(Code)



setHeader
public void setHeader(String name, String value)(Code)



setIntHeader
public void setIntHeader(String name, int value)(Code)



setLocale
public void setLocale(Locale locale)(Code)



setStatus
public void setStatus(int statusCode)(Code)



validateAsXml
public void validateAsXml() throws InvalidXmlException(Code)
Validates the response as an XML document.
exception:
  InvalidXmlException - when the XML document isn't valid
since:
   1.2



xpathBoolean
public Boolean xpathBoolean(String expression) throws XPathExpressionException(Code)
Evaluate an XPath expression in the context of the response text and return the result as a boolean.
exception:
  XPathExpressionException - if expression cannot be evaluated. the result as a Node
See Also:   MockResponse.xpathNodeSet(String)
See Also:   MockResponse.xpathNode(String)
See Also:   MockResponse.xpathString(String)
See Also:   MockResponse.xpathNumber(String)
since:
   1.1



xpathBoolean
public Boolean xpathBoolean(String expression, Object context) throws XPathExpressionException(Code)
Evaluate an XPath expression in the provided context object and return the result as a boolean.
exception:
  XPathExpressionException - if expression cannot be evaluated. the result as a Node
See Also:   MockResponse.xpathNodeSet(String,Object)
See Also:   MockResponse.xpathNode(String,Object)
See Also:   MockResponse.xpathString(String,Object)
See Also:   MockResponse.xpathNumber(String,Object)
since:
   1.2



xpathNode
public Node xpathNode(String expression) throws XPathExpressionException(Code)
Evaluate an XPath expression in the context of the response text and return the result as a DOM node.
exception:
  XPathExpressionException - if expression cannot be evaluated. the result as a Node
See Also:   MockResponse.xpathNodeSet(String)
See Also:   MockResponse.xpathString(String)
See Also:   MockResponse.xpathBoolean(String)
See Also:   MockResponse.xpathNumber(String)
since:
   1.1



xpathNode
public Node xpathNode(String expression, Object context) throws XPathExpressionException(Code)
Evaluate an XPath expression in the provided context object and return the result as a DOM node.
exception:
  XPathExpressionException - if expression cannot be evaluated. the result as a Node
See Also:   MockResponse.xpathNodeSet(String,Object)
See Also:   MockResponse.xpathString(String,Object)
See Also:   MockResponse.xpathBoolean(String,Object)
See Also:   MockResponse.xpathNumber(String,Object)
since:
   1.2



xpathNodeSet
public NodeList xpathNodeSet(String expression) throws XPathExpressionException(Code)
Evaluate an XPath expression in the context of the response text and return the result as a list of DOM nodes.

More information about XPath can be found in the original specification or in this tutorial.
exception:
  XPathExpressionException - if expression cannot be evaluated. the result as a NodeList
See Also:   MockResponse.xpathNode(String)
See Also:   MockResponse.xpathString(String)
See Also:   MockResponse.xpathBoolean(String)
See Also:   MockResponse.xpathNumber(String)
since:
   1.1




xpathNodeSet
public NodeList xpathNodeSet(String expression, Object context) throws XPathExpressionException(Code)
Evaluate an XPath expression in the provided context object and return the result as a list of DOM nodes.

More information about XPath can be found in the original specification or in this tutorial.
exception:
  XPathExpressionException - if expression cannot be evaluated. the result as a NodeList
See Also:   MockResponse.xpathNode(String,Object)
See Also:   MockResponse.xpathString(String,Object)
See Also:   MockResponse.xpathBoolean(String,Object)
See Also:   MockResponse.xpathNumber(String,Object)
since:
   1.2




xpathNumber
public Double xpathNumber(String expression) throws XPathExpressionException(Code)
Evaluate an XPath expression in the context of the response text and return the result as a number.
exception:
  XPathExpressionException - if expression cannot be evaluated. the result as a Node
See Also:   MockResponse.xpathNodeSet(String)
See Also:   MockResponse.xpathNode(String)
See Also:   MockResponse.xpathString(String)
See Also:   MockResponse.xpathBoolean(String)
since:
   1.1



xpathNumber
public Double xpathNumber(String expression, Object context) throws XPathExpressionException(Code)
Evaluate an XPath expression in the provided context object and return the result as a number.
exception:
  XPathExpressionException - if expression cannot be evaluated. the result as a Node
See Also:   MockResponse.xpathNodeSet(String,Object)
See Also:   MockResponse.xpathNode(String,Object)
See Also:   MockResponse.xpathString(String,Object)
See Also:   MockResponse.xpathBoolean(String,Object)
since:
   1.2



xpathString
public String xpathString(String expression) throws XPathExpressionException(Code)
Evaluate an XPath expression in the context of the response text and return the result as a string.
exception:
  XPathExpressionException - if expression cannot be evaluated. the result as a Node
See Also:   MockResponse.xpathNodeSet(String)
See Also:   MockResponse.xpathNode(String)
See Also:   MockResponse.xpathBoolean(String)
See Also:   MockResponse.xpathNumber(String)
since:
   1.1



xpathString
public String xpathString(String expression, Object context) throws XPathExpressionException(Code)
Evaluate an XPath expression in the provided context object and return the result as a string.
exception:
  XPathExpressionException - if expression cannot be evaluated. the result as a Node
See Also:   MockResponse.xpathNodeSet(String,Object)
See Also:   MockResponse.xpathNode(String,Object)
See Also:   MockResponse.xpathBoolean(String,Object)
See Also:   MockResponse.xpathNumber(String,Object)
since:
   1.2



Methods inherited from com.uwyn.rife.engine.AbstractResponse
abstract protected String _getCharacterEncoding()(Code)(Java Doc)
abstract protected OutputStream _getOutputStream() throws IOException(Code)(Java Doc)
abstract protected void _sendRedirect(String location)(Code)(Java Doc)
abstract protected void _setContentLength(int length)(Code)(Java Doc)
abstract protected void _setContentType(String contentType)(Code)(Java Doc)
public void clearBuffer()(Code)(Java Doc)
public void close() throws EngineException(Code)(Java Doc)
public void enableTextBuffer(boolean enabled)(Code)(Java Doc)
public void flush() throws EngineException(Code)(Java Doc)
public String getCharacterEncoding()(Code)(Java Doc)
public String getContentType()(Code)(Java Doc)
public ArrayList<CharSequence> getEmbeddedContent()(Code)(Java Doc)
public ElementSupport getLastElement()(Code)(Java Doc)
public OutputStream getOutputStream() throws EngineException(Code)(Java Doc)
public Request getRequest()(Code)(Java Doc)
public boolean isContentTypeSet()(Code)(Java Doc)
public boolean isEmbedded()(Code)(Java Doc)
public boolean isTextBufferEnabled()(Code)(Java Doc)
public void print(Template template) throws EngineException(Code)(Java Doc)
public void print(Collection<CharSequence> deferredContent) throws EngineException(Code)(Java Doc)
public void print(Object value) throws EngineException(Code)(Java Doc)
public void sendRedirect(String location) throws EngineException(Code)(Java Doc)
public void setContentLength(int length) throws EngineException(Code)(Java Doc)
public void setContentType(String contentType)(Code)(Java Doc)
public void setLastElement(ElementSupport element)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(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.