org.jvnet.hudson.test
Class HudsonTestCase.WebClient

java.lang.Object
  extended by com.gargoylesoftware.htmlunit.WebClient
      extended by org.jvnet.hudson.test.HudsonTestCase.WebClient
All Implemented Interfaces:
java.io.Serializable
Enclosing class:
HudsonTestCase

public class HudsonTestCase.WebClient
extends com.gargoylesoftware.htmlunit.WebClient

Extends WebClient and provide convenience methods for accessing Hudson.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.gargoylesoftware.htmlunit.WebClient
HTMLUNIT_COOKIE_POLICY, URL_ABOUT_BLANK
 
Constructor Summary
HudsonTestCase.WebClient()
           
 
Method Summary
 com.gargoylesoftware.htmlunit.WebRequestSettings addCrumb(com.gargoylesoftware.htmlunit.WebRequestSettings req)
          Adds a security crumb to the quest
 java.net.URL createCrumbedUrl(java.lang.String relativePath)
          Creates a URL with crumb parameters relative to {getContextPath()
 java.lang.String getContextPath()
          Returns the URL of the webapp top page.
 com.gargoylesoftware.htmlunit.html.HtmlPage getPage(Item item)
           
 com.gargoylesoftware.htmlunit.html.HtmlPage getPage(Item item, java.lang.String relative)
           
 com.gargoylesoftware.htmlunit.html.HtmlPage getPage(Node item)
           
 com.gargoylesoftware.htmlunit.html.HtmlPage getPage(Node item, java.lang.String relative)
           
 com.gargoylesoftware.htmlunit.html.HtmlPage getPage(Run r)
          Short for getPage(r,""), to access the top page of a build.
 com.gargoylesoftware.htmlunit.html.HtmlPage getPage(Run r, java.lang.String relative)
          Accesses a page inside Run.
 com.gargoylesoftware.htmlunit.Page getPage(java.lang.String url)
          Deprecated. This method expects a full URL. This method is marked as deprecated to warn you that you probably should be using goTo(String) method, which accepts a relative path within the Hudson being tested. (IOW, if you really need to hit a website on the internet, there's nothing wrong with using this method.)
 com.gargoylesoftware.htmlunit.html.HtmlPage goTo(java.lang.String relative)
          Requests a page within Hudson.
 com.gargoylesoftware.htmlunit.Page goTo(java.lang.String relative, java.lang.String expectedContentType)
           
 HudsonTestCase.WebClient login(java.lang.String username)
          Logs in to Hudson, by using the user name as the password.
 HudsonTestCase.WebClient login(java.lang.String username, java.lang.String password)
          Logs in to Hudson.
 com.gargoylesoftware.htmlunit.html.HtmlPage search(java.lang.String q)
           
 
Methods inherited from class com.gargoylesoftware.htmlunit.WebClient
addHostsToProxyBypass, addRequestHeader, addWebWindowListener, deregisterWebWindow, encodeUrl, expandUrl, getActiveXObjectMap, getAjaxController, getAlertHandler, getAttachmentHandler, getBrowserVersion, getCache, getConfirmHandler, getCredentialsProvider, getCurrentWindow, getHomePage, getHTMLParserListener, getIgnoreOutsideContent, getIncorrectnessListener, getJavaScriptEngine, getJavaScriptTimeout, getLog, getOnbeforeunloadHandler, getPage, getPage, getPage, getPage, getPageCreator, getPrintContentOnFailingStatusCode, getPromptHandler, getProxyConfig, getRefreshHandler, getScriptPreProcessor, getStatusHandler, getTimeout, getWebConnection, getWebWindowByName, getWebWindows, guessContentType, initialize, initialize, initializeEmptyWindow, isCookiesEnabled, isCssEnabled, isJavaScriptEnabled, isPopupBlockerEnabled, isRedirectEnabled, isThrowExceptionOnFailingAjax, isThrowExceptionOnFailingStatusCode, isThrowExceptionOnScriptError, loadWebResponse, loadWebResponseInto, openWindow, openWindow, popFirstWindow, printContentIfNecessary, pushClearFirstWindow, registerWebWindow, removeHostsFromProxyBypass, removeRequestHeader, removeWebWindowListener, setActiveXObjectMap, setAjaxController, setAlertHandler, setAttachmentHandler, setCache, setConfirmHandler, setCookiesEnabled, setCredentialsProvider, setCssEnabled, setCurrentWindow, setHomePage, setHTMLParserListener, setIgnoreOutsideContent, setIncorrectnessListener, setJavaScriptEnabled, setJavaScriptEngine, setJavaScriptTimeout, setOnbeforeunloadHandler, setPageCreator, setPopupBlockerEnabled, setPrintContentOnFailingStatusCode, setPromptHandler, setProxyConfig, setProxyHost, setProxyPort, setRedirectEnabled, setRefreshHandler, setScriptPreProcessor, setStatusHandler, setThrowExceptionOnFailingAjax, setThrowExceptionOnFailingStatusCode, setThrowExceptionOnScriptError, setTimeout, setUseInsecureSSL, setWebConnection, throwFailingHttpStatusCodeExceptionIfNecessary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HudsonTestCase.WebClient

public HudsonTestCase.WebClient()
Method Detail

login

public HudsonTestCase.WebClient login(java.lang.String username,
                                      java.lang.String password)
                               throws java.lang.Exception
Logs in to Hudson.

Throws:
java.lang.Exception

login

public HudsonTestCase.WebClient login(java.lang.String username)
                               throws java.lang.Exception
Logs in to Hudson, by using the user name as the password.

See HudsonTestCase.configureUserRealm() for how the container is set up with the user names and passwords. All the test accounts have the same user name and password.

Throws:
java.lang.Exception

search

public com.gargoylesoftware.htmlunit.html.HtmlPage search(java.lang.String q)
                                                   throws java.io.IOException,
                                                          org.xml.sax.SAXException
Throws:
java.io.IOException
org.xml.sax.SAXException

getPage

public com.gargoylesoftware.htmlunit.html.HtmlPage getPage(Run r)
                                                    throws java.io.IOException,
                                                           org.xml.sax.SAXException
Short for getPage(r,""), to access the top page of a build.

Throws:
java.io.IOException
org.xml.sax.SAXException

getPage

public com.gargoylesoftware.htmlunit.html.HtmlPage getPage(Run r,
                                                           java.lang.String relative)
                                                    throws java.io.IOException,
                                                           org.xml.sax.SAXException
Accesses a page inside Run.

Parameters:
relative - Relative URL within the build URL, like "changes". Doesn't start with '/'. Can be empty.
Throws:
java.io.IOException
org.xml.sax.SAXException

getPage

public com.gargoylesoftware.htmlunit.html.HtmlPage getPage(Item item)
                                                    throws java.io.IOException,
                                                           org.xml.sax.SAXException
Throws:
java.io.IOException
org.xml.sax.SAXException

getPage

public com.gargoylesoftware.htmlunit.html.HtmlPage getPage(Item item,
                                                           java.lang.String relative)
                                                    throws java.io.IOException,
                                                           org.xml.sax.SAXException
Throws:
java.io.IOException
org.xml.sax.SAXException

getPage

public com.gargoylesoftware.htmlunit.html.HtmlPage getPage(Node item)
                                                    throws java.io.IOException,
                                                           org.xml.sax.SAXException
Throws:
java.io.IOException
org.xml.sax.SAXException

getPage

public com.gargoylesoftware.htmlunit.html.HtmlPage getPage(Node item,
                                                           java.lang.String relative)
                                                    throws java.io.IOException,
                                                           org.xml.sax.SAXException
Throws:
java.io.IOException
org.xml.sax.SAXException

getPage

public com.gargoylesoftware.htmlunit.Page getPage(java.lang.String url)
                                           throws java.io.IOException,
                                                  com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException
Deprecated. This method expects a full URL. This method is marked as deprecated to warn you that you probably should be using goTo(String) method, which accepts a relative path within the Hudson being tested. (IOW, if you really need to hit a website on the internet, there's nothing wrong with using this method.)

Overrides:
getPage in class com.gargoylesoftware.htmlunit.WebClient
Throws:
java.io.IOException
com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException

goTo

public com.gargoylesoftware.htmlunit.html.HtmlPage goTo(java.lang.String relative)
                                                 throws java.io.IOException,
                                                        org.xml.sax.SAXException
Requests a page within Hudson.

Parameters:
relative - Relative path within Hudson. Starts without '/'. For example, "job/test/" to go to a job top page.
Throws:
java.io.IOException
org.xml.sax.SAXException

goTo

public com.gargoylesoftware.htmlunit.Page goTo(java.lang.String relative,
                                               java.lang.String expectedContentType)
                                        throws java.io.IOException,
                                               org.xml.sax.SAXException
Throws:
java.io.IOException
org.xml.sax.SAXException

getContextPath

public java.lang.String getContextPath()
Returns the URL of the webapp top page. URL ends with '/'.


addCrumb

public com.gargoylesoftware.htmlunit.WebRequestSettings addCrumb(com.gargoylesoftware.htmlunit.WebRequestSettings req)
Adds a security crumb to the quest


createCrumbedUrl

public java.net.URL createCrumbedUrl(java.lang.String relativePath)
                              throws java.net.MalformedURLException
Creates a URL with crumb parameters relative to {getContextPath()

Throws:
java.net.MalformedURLException


Copyright © 2009. All Rights Reserved.