| Constructor and Description |
|---|
TestContext()
Construct a test client context.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCookie(javax.servlet.http.Cookie cookie)
Add a cookie to the test context.
|
void |
addCookie(String name,
String value,
String domain)
Add a cookie to the test context.
|
void |
addCookie(String name,
String value,
String domain,
int expiry)
Add a cookie to the test context.
|
void |
addRequestHeader(String name,
String value)
Add a custom request header.
|
void |
clearAuthorizations()
Clear all authorizations (basic, digest, ntlm, proxy).
|
void |
clearRequestHeaders()
Clear custom request headers.
|
URL |
getBaseUrl()
Return the base URL for the test context.
|
List<javax.servlet.http.Cookie> |
getCookies()
Return the cookies which have been added to the test context.
|
String |
getDomain()
Return the user domain.
|
Locale |
getLocale()
Return the locale established for the test context.
|
String |
getPassword()
Return the user password.
|
String |
getProxyHost()
Return the proxy server name
|
String |
getProxyPasswd()
Return the proxy password
|
int |
getProxyPort()
Return the proxy server port
|
String |
getProxyUser()
Return the proxy user name
|
Map<String,String> |
getRequestHeaders()
Get custom request headers.
|
String |
getResourceBundleName()
Return the test context resource bundle for expected value lookups.
|
String |
getUser()
Return the authorized user for the test context.
|
String |
getUserAgent() |
boolean |
hasAuthorization()
Return true if a basic authentication has been set on the context via
setAuthorization(java.lang.String, java.lang.String). |
boolean |
hasCookies()
Return true if one or more cookies have been added to the test context.
|
boolean |
hasNTLMAuthorization()
Return true if a NTLM authentication has been set on the context via
setNTLMAuthorization(java.lang.String, java.lang.String, java.lang.String). |
boolean |
hasProxyAuthorization()
Return true if a proxy authentication has been set on the context via
setProxyAuthorization(java.lang.String, java.lang.String, java.lang.String, int). |
boolean |
hasUserAgent() |
void |
removeRequestHeader(String name)
Remove a custom request header.
|
void |
setAuthorization(String user,
String passwd)
Set basic authentication information for the test context.
|
void |
setBaseUrl(String url)
Set the base url for the test context.
|
void |
setBaseUrl(URL url)
Set the base url for the test context.
|
void |
setLocale(Locale locale)
Set the locale for the test context.
|
void |
setNTLMAuthorization(String user,
String passwd,
String domain)
Set NTLM authentication information for the test context.
|
void |
setProxyAuthorization(String user,
String passwd,
String host,
int port)
Set proxy authentication information for the test context.
|
void |
setResourceBundleName(String name)
Set a resource bundle to use for the test context (will be used to lookup expected values by key in WebTester).
|
void |
setUserAgent(String userAgent) |
public void clearAuthorizations()
public void setAuthorization(String user, String passwd)
user - user namepasswd - passwordpublic void setNTLMAuthorization(String user, String passwd, String domain)
user - user namepasswd - passwordpublic void setProxyAuthorization(String user, String passwd, String host, int port)
user - user name (null if none)passwd - password (null if none)host - proxy host name (null if applicable to any host).port - proxy port (negative if applicable to any port).public void addCookie(String name, String value, String domain, int expiry)
name - cookie name.value - cookie value.domain - cookie domain (ie localhost or www.foo.bar).expiry - the expiry date in seconds. -1 will delete this cookie, 0 will delete it at the end of the browser session.public void addCookie(String name, String value, String domain)
name - cookie name.value - cookie value.domain - cookie domain (ie localhost or www.foo.bar).public void addCookie(javax.servlet.http.Cookie cookie)
cookie - a cookie.public boolean hasAuthorization()
setAuthorization(java.lang.String, java.lang.String).public boolean hasNTLMAuthorization()
setNTLMAuthorization(java.lang.String, java.lang.String, java.lang.String).public boolean hasProxyAuthorization()
setProxyAuthorization(java.lang.String, java.lang.String, java.lang.String, int).public boolean hasCookies()
public String getUser()
public String getPassword()
public String getDomain()
public List<javax.servlet.http.Cookie> getCookies()
public String getUserAgent()
public void setUserAgent(String userAgent)
public boolean hasUserAgent()
public Locale getLocale()
public void setLocale(Locale locale)
public void setResourceBundleName(String name)
name - path name of the resource bundle.public String getResourceBundleName()
public String getProxyHost()
public int getProxyPort()
public String getProxyUser()
public String getProxyPasswd()
public URL getBaseUrl()
public void setBaseUrl(String url)
url - Base url value - A trailing "/" is appended if not provided.public void setBaseUrl(URL url)
url - Base url value. Anything after trailing "/" will be skipped.public void addRequestHeader(String name, String value)
name - header name.value - header value.public void removeRequestHeader(String name)
name - header name.public Map<String,String> getRequestHeaders()
name - header name.value - header value.public void clearRequestHeaders()
Copyright © 2002–2017 JWebUnit. All rights reserved.