Java Doc for MockConversation.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.test.MockConversation

MockConversation
public class MockConversation (Code)
Simulates a conversation between a web browser and a servlet container.

Cookies will be remembered between requests and can be easily examined. To check which new cookies have been set during a request, the MockResponse.getNewCookieNames method can be used.

An instance of this class is tied to a regular Site structure instance. Your tests can thus reference existing site XML declarations, combine different sites into one, build a new site-structure on-the-fly in Java, modify existing element declarations, override property injections, ...

Note that RIFE relies on com.uwyn.rife.engine.EngineClassLoader to provide continuations functionalities to pure Java elements. If you want to test elements that use continuations, you have to make sure the first class in your test setup is loaded by com.uwyn.rife.engine.EngineClassLoader . The easiest way to do so is to run your main class with RunWithEngineClassLoader .
author:
   Geert Bevin (gbevin[remove] at uwyn dot com)
version:
   $Revision: 3634 $
since:
   1.1



Field Summary
final static  StringSESSION_ID_COOKIE
    
final static  StringSESSION_ID_URL
    
final static  StringSESSION_URL_PREFIX
    

Constructor Summary
public  MockConversation(Site site)
     Creates a new MockConversation instance for a particular site.

Method Summary
public  voidaddCookie(Cookie cookie)
     Add a cookie.
public  voidaddCookie(String name, String value)
     Add a cookie with only a name and a value, the other fields will be empty.
static  StringbuildCookieId(Cookie cookie)
    
public  MockConversationcontextPath(String contextPath)
     Sets the context path that will be used by this conversation.
public  MockConversationcookie(Cookie cookie)
     Add a cookie.
public  MockConversationcookie(String name, String value)
     Add a cookie with only a name and a value, the other fields will be empty.
public  MockResponsedoRequest(String url)
     Perform a request for a particular URL.
public  MockResponsedoRequest(String url, MockRequest request)
     Perform a request for a particular URL and request configuration.

The request can either be complete with the scheme and hostname, or an absolute path.

static  Map<String, String[]>extractParameters(String url)
    
public  StringgetContextPath()
     Retrieves the context path that is used by this conversation.
public  CookiegetCookie(String name)
     Retrieves a cookie.
Parameters:
  name - the name of the cookie.
public  StringgetCookieValue(String name)
     Retrieves the value of a cookie.
Parameters:
  name - the name of the cookie.
public  Cookie[]getCookies()
     Retrieves all cookies.
public  StringgetScheme()
     Retrieves the scheme that is used by this conversation.
public  StringgetServerName()
     Retrieves the server name that is used by this conversation.
public  intgetServerPort()
     Retrieves the server port that is used by this conversation.
 MockSessiongetSession(String id)
    
public  booleanhasCookie(String name)
     Checks whether a cookie is present.
Parameters:
  name - the name of the cookie.
 MockSessionnewHttpSession()
    
 voidremoveSession(String id)
    
public  MockConversationscheme(String scheme)
     Sets the scheme that will be used by this conversation.
public  MockConversationserverName(String serverName)
     Sets the server name that will be used by this conversation.
public  MockConversationserverPort(int serverPort)
     Sets the server port that will be used by this conversation.
public  voidsetContextPath(String contextPath)
     Sets the context path that will be used by this conversation.
public  voidsetScheme(String scheme)
     Sets the scheme that will be used by this conversation.
public  voidsetServerName(String serverName)
     Sets the server name that will be used by this conversation.
public  voidsetServerPort(int serverPort)
     Sets the server port that will be used by this conversation.

Field Detail
SESSION_ID_COOKIE
final static String SESSION_ID_COOKIE(Code)



SESSION_ID_URL
final static String SESSION_ID_URL(Code)



SESSION_URL_PREFIX
final static String SESSION_URL_PREFIX(Code)




Constructor Detail
MockConversation
public MockConversation(Site site) throws EngineException(Code)
Creates a new MockConversation instance for a particular site.
Parameters:
  site - the site structure that will be tested
since:
   1.1




Method Detail
addCookie
public void addCookie(Cookie cookie)(Code)
Add a cookie.
Parameters:
  cookie - the cookie instance that will be added
See Also:   MockConversation.hasCookie(String)
See Also:   MockConversation.getCookie(String)
See Also:   MockConversation.getCookieValue(String)
See Also:   MockConversation.getCookies()
See Also:   MockConversation.addCookie(String,String)
since:
   1.1



addCookie
public void addCookie(String name, String value)(Code)
Add a cookie with only a name and a value, the other fields will be empty.
Parameters:
  name - the name of the cookie
Parameters:
  value - the value of the cookie
See Also:   MockConversation.hasCookie(String)
See Also:   MockConversation.getCookie(String)
See Also:   MockConversation.getCookieValue(String)
See Also:   MockConversation.getCookies()
See Also:   MockConversation.addCookie(Cookie)
since:
   1.1



buildCookieId
static String buildCookieId(Cookie cookie)(Code)



contextPath
public MockConversation contextPath(String contextPath)(Code)
Sets the context path that will be used by this conversation.
Parameters:
  contextPath - the context path this MockConversation instance
See Also:   MockConversation.getContextPath
See Also:   MockConversation.setContextPath
since:
   1.1



cookie
public MockConversation cookie(Cookie cookie)(Code)
Add a cookie.
Parameters:
  cookie - the cookie instance that will be added this MockConversation instance
See Also:   MockConversation.hasCookie(String)
See Also:   MockConversation.getCookie(String)
See Also:   MockConversation.getCookieValue(String)
See Also:   MockConversation.getCookies()
See Also:   MockConversation.addCookie(Cookie)
See Also:   MockConversation.addCookie(String,String)
since:
   1.1



cookie
public MockConversation cookie(String name, String value)(Code)
Add a cookie with only a name and a value, the other fields will be empty.
Parameters:
  name - the name of the cookie
Parameters:
  value - the value of the cookie this MockConversation instance
See Also:   MockConversation.hasCookie(String)
See Also:   MockConversation.getCookie(String)
See Also:   MockConversation.getCookieValue(String)
See Also:   MockConversation.getCookies()
See Also:   MockConversation.addCookie(Cookie)
See Also:   MockConversation.addCookie(String,String)
since:
   1.1



doRequest
public MockResponse doRequest(String url) throws EngineException(Code)
Perform a request for a particular URL.
Parameters:
  url - the url that should be tested the response of the request as a MockResponse instance;or

null if the scheme, hostname and port don't correspondto the conversation setup
See Also:   MockConversation.doRequest(String,MockRequest)
since:
   1.1




doRequest
public MockResponse doRequest(String url, MockRequest request) throws EngineException(Code)
Perform a request for a particular URL and request configuration.

The request can either be complete with the scheme and hostname, or an absolute path. These two URLs are thus considered the same:

http://localhost/some/url?name1=value1&name2=value2
/some/url?name1=value1&name2=value2

Note that when the complete URL form is used, it should correspond to the scheme, hostname and port configuration of this conversation.
Parameters:
  url - the url that should be tested
Parameters:
  request - the request that will be used the response of the request as a MockResponse instance;or

null if the scheme, hostname and port don't correspondto the conversation setup
See Also:   MockConversation.doRequest(String)
since:
   1.1




extractParameters
static Map<String, String[]> extractParameters(String url)(Code)



getContextPath
public String getContextPath()(Code)
Retrieves the context path that is used by this conversation. the context path of this conversation
See Also:   MockConversation.setContextPath
See Also:   MockConversation.contextPath
since:
   1.1



getCookie
public Cookie getCookie(String name)(Code)
Retrieves a cookie.
Parameters:
  name - the name of the cookie. the instance of the cookie; or

null if no such cookie is present
See Also:   MockConversation.hasCookie(String)
See Also:   MockConversation.getCookieValue(String)
See Also:   MockConversation.getCookies()
See Also:   MockConversation.addCookie(Cookie)
See Also:   MockConversation.addCookie(String,String)
since:
   1.1




getCookieValue
public String getCookieValue(String name)(Code)
Retrieves the value of a cookie.
Parameters:
  name - the name of the cookie. the value of the cookie; or

null if no such cookie is present
See Also:   MockConversation.hasCookie(String)
See Also:   MockConversation.getCookie(String)
See Also:   MockConversation.getCookies()
See Also:   MockConversation.addCookie(Cookie)
See Also:   MockConversation.addCookie(String,String)
since:
   1.1




getCookies
public Cookie[] getCookies()(Code)
Retrieves all cookies. an array with all the cookies; or

null if no cookies are present
See Also:   MockConversation.hasCookie(String)
See Also:   MockConversation.getCookie(String)
See Also:   MockConversation.getCookieValue(String)
See Also:   MockConversation.addCookie(Cookie)
See Also:   MockConversation.addCookie(String,String)
since:
   1.1




getScheme
public String getScheme()(Code)
Retrieves the scheme that is used by this conversation. the scheme of this conversation
See Also:   MockConversation.setScheme
See Also:   MockConversation.scheme
since:
   1.1



getServerName
public String getServerName()(Code)
Retrieves the server name that is used by this conversation. the server name of this conversation
See Also:   MockConversation.setServerName
See Also:   MockConversation.serverName
since:
   1.1



getServerPort
public int getServerPort()(Code)
Retrieves the server port that is used by this conversation. the server port of this conversation
See Also:   MockConversation.setServerPort
See Also:   MockConversation.serverPort
since:
   1.1



getSession
MockSession getSession(String id)(Code)



hasCookie
public boolean hasCookie(String name)(Code)
Checks whether a cookie is present.
Parameters:
  name - the name of the cookie. true if the cookie was present; or

false otherwise
See Also:   MockConversation.getCookie(String)
See Also:   MockConversation.getCookieValue(String)
See Also:   MockConversation.getCookies()
See Also:   MockConversation.addCookie(Cookie)
See Also:   MockConversation.addCookie(String,String)
since:
   1.1




newHttpSession
MockSession newHttpSession()(Code)



removeSession
void removeSession(String id)(Code)



scheme
public MockConversation scheme(String scheme)(Code)
Sets the scheme that will be used by this conversation.
Parameters:
  scheme - the scheme this MockConversation instance
See Also:   MockConversation.getScheme
See Also:   MockConversation.setScheme
since:
   1.1



serverName
public MockConversation serverName(String serverName)(Code)
Sets the server name that will be used by this conversation.
Parameters:
  serverName - the server name this MockConversation instance
See Also:   MockConversation.getServerName
See Also:   MockConversation.setServerName
since:
   1.1



serverPort
public MockConversation serverPort(int serverPort)(Code)
Sets the server port that will be used by this conversation.
Parameters:
  serverPort - the server port this MockConversation instance
See Also:   MockConversation.getServerPort
See Also:   MockConversation.setServerPort
since:
   1.1



setContextPath
public void setContextPath(String contextPath)(Code)
Sets the context path that will be used by this conversation.
Parameters:
  contextPath - the context path
See Also:   MockConversation.getContextPath
See Also:   MockConversation.contextPath
since:
   1.1



setScheme
public void setScheme(String scheme)(Code)
Sets the scheme that will be used by this conversation.
Parameters:
  scheme - the scheme
See Also:   MockConversation.getScheme
See Also:   MockConversation.scheme
since:
   1.1



setServerName
public void setServerName(String serverName)(Code)
Sets the server name that will be used by this conversation.
Parameters:
  serverName - the server name
See Also:   MockConversation.getServerName
See Also:   MockConversation.serverName
since:
   1.1



setServerPort
public void setServerPort(int serverPort)(Code)
Sets the server port that will be used by this conversation.
Parameters:
  serverPort - the server port
See Also:   MockConversation.getServerPort
See Also:   MockConversation.serverPort
since:
   1.1



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.