public class TestUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
TestUtils.RestTestUtils |
class |
TestUtils.Session
This class represents all cookies stored in the browser.
|
Modifier and Type | Field and Description |
---|---|
static org.apache.commons.httpclient.UsernamePasswordCredentials |
ADMIN_CREDENTIALS |
static String |
BASE_BIN_URL
Deprecated.
since 7.3M1, use
getBaseBinURL() instead |
static String |
BASE_REST_URL
Deprecated.
since 7.3M1, use
getBaseURL() instead |
static String |
BASE_URL
Deprecated.
since 7.3M1, use
getBaseURL() instead |
static int[] |
STATUS_ACCEPTED |
static int[] |
STATUS_CREATED |
static int[] |
STATUS_CREATED_ACCEPTED |
static int[] |
STATUS_NO_CONTENT |
static int[] |
STATUS_NO_CONTENT_NOT_FOUND |
static int[] |
STATUS_OK |
static int[] |
STATUS_OK_NOT_FOUND |
static org.apache.commons.httpclient.UsernamePasswordCredentials |
SUPER_ADMIN_CREDENTIALS |
Constructor and Description |
---|
TestUtils() |
Modifier and Type | Method and Description |
---|---|
void |
addClassProperty(org.xwiki.model.reference.EntityReference reference,
String propertyName,
String propertyType) |
void |
addClassProperty(String space,
String page,
String propertyName,
String propertyType) |
void |
addObject(org.xwiki.model.reference.EntityReference reference,
String className,
Map<String,?> properties) |
void |
addObject(org.xwiki.model.reference.EntityReference reference,
String className,
Object... properties) |
void |
addObject(String space,
String page,
String className,
Map<String,?> properties) |
void |
addObject(String space,
String page,
String className,
Object... properties) |
void |
addQueryStringEntry(StringBuilder builder,
String key,
Object value) |
void |
addQueryStringEntry(StringBuilder builder,
String key,
String value) |
void |
assertOnPage(org.xwiki.model.reference.EntityReference reference)
Verify if the passed reference corresponds to the current page, independently of the wiki.
|
void |
assertOnPage(String pageURL)
After successful completion of this function, you are guaranteed to be logged in as the given user and on the
page passed in pageURL.
|
static <M extends org.apache.commons.httpclient.HttpMethod> |
assertStatusCodes(M method,
boolean release,
int... expectedCodes) |
static void |
assertStatuses(int actualCode,
int... expectedCodes) |
void |
attachFile(org.xwiki.model.reference.EntityReference reference,
Object is,
boolean failIfExists) |
void |
attachFile(org.xwiki.model.reference.EntityReference pageReference,
String name,
InputStream is,
boolean failIfExists) |
void |
attachFile(org.xwiki.model.reference.EntityReference pageReference,
String name,
InputStream is,
boolean failIfExists,
org.apache.commons.httpclient.UsernamePasswordCredentials credentials) |
void |
attachFile(List<String> spaces,
String page,
String name,
InputStream is,
boolean failIfExists) |
void |
attachFile(List<String> spaces,
String page,
String name,
InputStream is,
boolean failIfExists,
org.apache.commons.httpclient.UsernamePasswordCredentials credentials) |
void |
attachFile(String space,
String page,
String name,
File file,
boolean failIfExists) |
void |
attachFile(String space,
String page,
String name,
InputStream is,
boolean failIfExists) |
void |
attachFile(String space,
String page,
String name,
InputStream is,
boolean failIfExists,
org.apache.commons.httpclient.UsernamePasswordCredentials credentials) |
void |
closeTab(String secondTabHandle) |
void |
createAdminUser()
Creates the Admin user and add it to the XWikiAdminGroup.
|
ViewPage |
createPage(org.xwiki.model.reference.EntityReference reference,
String content) |
ViewPage |
createPage(org.xwiki.model.reference.EntityReference reference,
String content,
String title) |
ViewPage |
createPage(org.xwiki.model.reference.EntityReference reference,
String content,
String title,
String syntaxId) |
ViewPage |
createPage(org.xwiki.model.reference.EntityReference reference,
String content,
String title,
String syntaxId,
String parentFullPageName) |
ViewPage |
createPage(List<String> spaces,
String page,
String content,
String title) |
ViewPage |
createPage(List<String> spaces,
String page,
String content,
String title,
String syntaxId) |
ViewPage |
createPage(List<String> spaces,
String page,
String content,
String title,
String syntaxId,
String parentFullPageName) |
ViewPage |
createPage(String space,
String page,
String content,
String title) |
ViewPage |
createPage(String space,
String page,
String content,
String title,
String syntaxId) |
ViewPage |
createPage(String space,
String page,
String content,
String title,
String syntaxId,
String parentFullPageName) |
ViewPage |
createPageWithAttachment(org.xwiki.model.reference.EntityReference reference,
String content,
String title,
String attachmentName,
InputStream attachmentData) |
ViewPage |
createPageWithAttachment(org.xwiki.model.reference.EntityReference reference,
String content,
String title,
String attachmentName,
InputStream attachmentData,
org.apache.commons.httpclient.UsernamePasswordCredentials credentials) |
ViewPage |
createPageWithAttachment(List<String> spaces,
String page,
String content,
String title,
String syntaxId,
String parentFullPageName,
String attachmentName,
InputStream attachmentData,
org.apache.commons.httpclient.UsernamePasswordCredentials credentials) |
ViewPage |
createPageWithAttachment(String space,
String page,
String content,
String title,
String attachmentName,
InputStream attachmentData) |
ViewPage |
createPageWithAttachment(String space,
String page,
String content,
String title,
String attachmentName,
InputStream attachmentData,
org.apache.commons.httpclient.UsernamePasswordCredentials credentials) |
ViewPage |
createPageWithAttachment(String space,
String page,
String content,
String title,
String syntaxId,
String parentFullPageName,
String attachmentName,
InputStream attachmentData) |
ViewPage |
createPageWithAttachment(String space,
String page,
String content,
String title,
String syntaxId,
String parentFullPageName,
String attachmentName,
InputStream attachmentData,
org.apache.commons.httpclient.UsernamePasswordCredentials credentials) |
void |
createUser(String username,
String password,
String redirectURL,
Object... properties) |
void |
createUserAndLogin(String username,
String password,
Object... properties) |
void |
createUserAndLoginWithRedirect(String username,
String password,
String url,
Object... properties) |
void |
deleteAttachement(org.xwiki.model.reference.EntityReference reference) |
void |
deleteAttachement(org.xwiki.model.reference.EntityReference pageReference,
String filename) |
void |
deleteLatestVersion(String space,
String page)
Delete the latest version from the history of a page, using the
/deleteversions/ action. |
void |
deleteObject(String space,
String page,
String className,
int objectNumber) |
void |
deletePage(org.xwiki.model.reference.EntityReference reference) |
void |
deletePage(org.xwiki.model.reference.EntityReference reference,
boolean affectChildren) |
void |
deletePage(String space,
String page) |
void |
deleteSpace(String space)
Accesses the URL to delete the specified space.
|
void |
deleteVersion(String space,
String page,
String version)
Delete a specific version from the history of a page, using the
/deleteversions/ action. |
void |
deleteVersions(String space,
String page,
String v1,
String v2)
Delete an interval of versions from the history of a page, using the
/deleteversions/ action. |
void |
disableSyntaxHighlighting()
Disable Syntax Highlighting.
|
ClassEditPage |
editClass(String space,
String page) |
ObjectEditPage |
editObjects(String space,
String page) |
String |
escapeURL(String url)
Encodes a given string so that it may be used as a URL component.
|
String |
escapeXPath(String value)
Usage example:
|
String |
executeAndGetBodyAsString(org.xwiki.model.reference.EntityReference reference,
Map<String,?> queryParameters) |
protected org.apache.commons.httpclient.methods.DeleteMethod |
executeDelete(String uri) |
protected void |
executeDelete(String uri,
int... expectedCodes) |
protected org.apache.commons.httpclient.methods.GetMethod |
executeGet(String uri) |
protected org.apache.commons.httpclient.methods.GetMethod |
executeGet(String uri,
boolean release,
int... expectedCodes) |
protected org.apache.commons.httpclient.methods.GetMethod |
executeGet(String uri,
int... expectedCodes) |
protected org.apache.commons.httpclient.methods.PostMethod |
executePost(String uri,
InputStream content,
String mediaType) |
protected org.apache.commons.httpclient.methods.PostMethod |
executePost(String uri,
InputStream content,
String mediaType,
boolean release,
int... expectedCodes) |
protected org.apache.commons.httpclient.methods.PostMethod |
executePost(String uri,
InputStream content,
String mediaType,
int... expectedCodes) |
protected org.apache.commons.httpclient.methods.PutMethod |
executePut(String uri,
InputStream content,
String mediaType) |
protected org.apache.commons.httpclient.methods.PutMethod |
executePut(String uri,
InputStream content,
String mediaType,
boolean release,
int... expectedCodes) |
protected void |
executePut(String uri,
InputStream content,
String mediaType,
int... expectedCodes) |
void |
forceGuestUser()
Forces the current user to be the Guest user by clearing all coookies.
|
String |
getAttachmentURL(String space,
String page,
String attachment) |
String |
getAttachmentURL(String space,
String page,
String attachment,
String action) |
String |
getAttachmentURL(String space,
String page,
String attachment,
String action,
String queryString) |
String |
getBaseBinURL() |
String |
getBaseBinURL(String wiki) |
String |
getBaseURL() |
XWikiExecutor |
getCurrentExecutor() |
String |
getCurrentTabHandle() |
String |
getCurrentWiki() |
org.apache.commons.httpclient.UsernamePasswordCredentials |
getDefaultCredentials() |
XWikiWebDriver |
getDriver() |
InputStream |
getInputStream(String path,
Map<String,?> queryParams) |
InputStream |
getInputStream(String prefix,
String path,
Map<String,?> queryParams,
Object... elements) |
String |
getLoggedInUserName() |
String |
getMavenVersion() |
String |
getSecretToken()
Get the secret token used for CSRF protection.
|
TestUtils.Session |
getSession() |
String |
getString(String path,
Map<String,?> queryParams) |
String |
getURL(org.xwiki.model.reference.EntityReference reference) |
String |
getURL(org.xwiki.model.reference.EntityReference reference,
String action,
String queryString) |
String |
getURL(org.xwiki.model.reference.EntityReference reference,
String action,
String queryString,
String fragment) |
String |
getURL(List<String> spaces,
String page) |
String |
getURL(List<String> spaces,
String page,
String action,
String queryString) |
String |
getURL(String space,
String page)
Get the URL to view a page.
|
String |
getURL(String action,
String[] path,
String queryString) |
String |
getURL(String action,
String[] path,
String queryString,
String fragment) |
String |
getURL(String space,
String page,
String action)
Get the URL of an action on a page.
|
String |
getURL(String space,
String page,
String action,
Map<String,?> queryParameters)
Get the URL of an action on a page with specified parameters.
|
String |
getURL(String space,
String page,
String action,
String queryString)
Get the URL of an action on a page with a specified query string.
|
String |
getURLFragment(org.xwiki.model.reference.EntityReference reference) |
String |
getURLToDeletePage(org.xwiki.model.reference.EntityReference reference) |
String |
getURLToDeletePage(org.xwiki.model.reference.EntityReference reference,
boolean affectChildren) |
String |
getURLToDeletePage(String space,
String page) |
String |
getURLToDeleteSpace(String space) |
String |
getURLToLoginAndGotoPage(String username,
String password,
String pageURL) |
String |
getURLToLoginAs(String username,
String password) |
String |
getURLToLoginAsAdmin() |
String |
getURLToLoginAsAdminAndGotoPage(String pageURL) |
String |
getURLToLoginAsSuperAdmin() |
String |
getURLToLoginAsSuperAdminAndGotoPage(String pageURL) |
String |
getURLToLogout()
Consider using setSession(null) because it will drop the cookies which is faster than invoking a logout action.
|
String |
getURLToNonExistentPage() |
String |
getVersion() |
ViewPage |
gotoPage(org.xwiki.model.reference.EntityReference reference) |
void |
gotoPage(org.xwiki.model.reference.EntityReference reference,
String action) |
void |
gotoPage(org.xwiki.model.reference.EntityReference reference,
String action,
Map<String,?> queryParameters) |
void |
gotoPage(org.xwiki.model.reference.EntityReference reference,
String action,
Object... queryParameters) |
void |
gotoPage(org.xwiki.model.reference.EntityReference reference,
String action,
String queryString) |
void |
gotoPage(org.xwiki.model.reference.EntityReference reference,
String action,
String queryString,
String fragment) |
void |
gotoPage(List<String> spaces,
String page,
String action,
Map<String,?> queryParameters) |
void |
gotoPage(List<String> spaces,
String page,
String action,
String queryString) |
void |
gotoPage(String url) |
ViewPage |
gotoPage(String space,
String page) |
void |
gotoPage(String space,
String page,
String action) |
void |
gotoPage(String space,
String page,
String action,
Map<String,?> queryParameters) |
void |
gotoPage(String space,
String page,
String action,
Object... queryParameters) |
void |
gotoPage(String space,
String page,
String action,
String queryString) |
void |
importXar(File file) |
static void |
initializeComponent(org.xwiki.component.manager.ComponentManager componentManager) |
boolean |
isInAdminMode() |
boolean |
isInClassEditMode() |
boolean |
isInCreateMode() |
boolean |
isInDeleteMode() |
boolean |
isInInlineEditMode() |
boolean |
isInObjectEditMode() |
boolean |
isInRenameMode() |
boolean |
isInRightsEditMode() |
boolean |
isInSourceViewMode() |
boolean |
isInViewMode() |
boolean |
isInWikiEditMode() |
boolean |
isInWYSIWYGEditMode() |
void |
login(String username,
String password) |
void |
loginAndGotoPage(String username,
String password,
String pageURL) |
void |
loginAndGotoPage(String username,
String password,
String pageURL,
boolean checkLoginSuccess) |
void |
loginAsAdmin() |
void |
loginAsAdminAndGotoPage(String pageURL) |
void |
loginAsSuperAdmin() |
void |
loginAsSuperAdminAndGotoPage(String pageURL) |
String |
openLinkInTab(org.openqa.selenium.By by,
String... existingTabHandles) |
boolean |
pageExists(List<String> spaces,
String page) |
boolean |
pageExists(String space,
String page) |
void |
recacheSecretToken()
(Re)-cache the secret token used for CSRF protection.
|
org.xwiki.model.reference.EntityReference |
resolveDocumentReference(String referenceAsString) |
org.xwiki.model.reference.EntityReference |
resolveSpaceReference(String referenceAsString) |
TestUtils.RestTestUtils |
rest() |
void |
rollBackTo(String space,
String page,
String version)
Roll back a page to the specified version, using the
/rollback/ action. |
void |
rollbackToPreviousVersion(String space,
String page)
Roll back a page to the previous version, using the
/rollback/ action. |
String |
serializeReference(org.xwiki.model.reference.EntityReference reference) |
static void |
setContext(PersistentTestContext context)
Used so that AllTests can set the persistent test context.
|
void |
setDefaultCredentials(String username,
String password) |
org.apache.commons.httpclient.UsernamePasswordCredentials |
setDefaultCredentials(org.apache.commons.httpclient.UsernamePasswordCredentials defaultCredentials) |
void |
setExecutors(List<XWikiExecutor> executors) |
void |
setGlobalRights(String groups,
String users,
String rights,
boolean enabled)
Add or update a
XWikiGlobalRights xobject to the current wiki's XWikiPrefrences document. |
void |
setHierarchyMode(String mode)
Set the hierarchy mode used in the wiki
|
void |
setPropertyInXWikiCfg(String configuration)
Set global xwiki configuration options (as if the xwiki.cfg file had been modified).
|
void |
setPropertyInXWikiPreferences(String propertyName,
String propertyType,
Object value)
Add and set a property into XWiki.XWikiPreferences.
|
void |
setRights(org.xwiki.model.reference.EntityReference entityReference,
String groups,
String users,
String rights,
boolean enabled)
Add or update a
XWikiRights xobject to the document specified in the passed entity reference. |
void |
setSession(TestUtils.Session session) |
static void |
setURLPrefix(String urlPrefix) |
String |
setWikiPreference(String propertyName,
String value)
Sets the value of an existing property of XWiki.XWikiPreferences.
|
void |
switchExecutor(int index) |
void |
switchTab(String tabHandle) |
String |
toQueryParameterKey(String className,
Integer objectNumber,
String key) |
Map<String,?> |
toQueryParameters(Object... properties) |
Map<String,?> |
toQueryParameters(String className,
Integer objectNumber,
Map<String,?> properties) |
Map<String,?> |
toQueryParameters(String className,
Integer objectNumber,
Object... properties) |
String |
toQueryString(Map<String,?> queryParameters) |
String |
toQueryString(Object... queryParameters) |
void |
updateClassProperty(org.xwiki.model.reference.EntityReference reference,
Object... queryParameters) |
void |
updateObject(org.xwiki.model.reference.EntityReference entityReference,
String className,
int objectNumber,
Object... properties) |
void |
updateObject(List<String> spaces,
String page,
String className,
int objectNumber,
Object... properties) |
void |
updateObject(String space,
String page,
String className,
int objectNumber,
Map<String,?> properties) |
void |
updateObject(String space,
String page,
String className,
int objectNumber,
Object... properties) |
public static final org.apache.commons.httpclient.UsernamePasswordCredentials ADMIN_CREDENTIALS
public static final org.apache.commons.httpclient.UsernamePasswordCredentials SUPER_ADMIN_CREDENTIALS
@Deprecated public static final String BASE_URL
getBaseURL()
instead@Deprecated public static final String BASE_BIN_URL
getBaseBinURL()
instead@Deprecated public static final String BASE_REST_URL
getBaseURL()
insteadpublic static final int[] STATUS_OK_NOT_FOUND
public static final int[] STATUS_OK
public static final int[] STATUS_NO_CONTENT
public static final int[] STATUS_NO_CONTENT_NOT_FOUND
public static final int[] STATUS_CREATED_ACCEPTED
public static final int[] STATUS_CREATED
public static final int[] STATUS_ACCEPTED
public XWikiExecutor getCurrentExecutor()
public void switchExecutor(int index)
public void setExecutors(List<XWikiExecutor> executors)
public static void setContext(PersistentTestContext context)
public static void initializeComponent(org.xwiki.component.manager.ComponentManager componentManager) throws Exception
Exception
public XWikiWebDriver getDriver()
public TestUtils.Session getSession()
public void setSession(TestUtils.Session session)
public void setDefaultCredentials(String username, String password)
public org.apache.commons.httpclient.UsernamePasswordCredentials setDefaultCredentials(org.apache.commons.httpclient.UsernamePasswordCredentials defaultCredentials)
public org.apache.commons.httpclient.UsernamePasswordCredentials getDefaultCredentials()
public void loginAsSuperAdmin()
public void loginAsSuperAdminAndGotoPage(String pageURL)
public void loginAsAdmin()
public void loginAsAdminAndGotoPage(String pageURL)
public void loginAndGotoPage(String username, String password, String pageURL, boolean checkLoginSuccess)
public String getURLToLogout()
public String getURLToLoginAsAdmin()
public String getURLToLoginAsSuperAdmin()
public String getURLToLoginAsAdminAndGotoPage(String pageURL)
pageURL
- the URL of the page to go to after logging in.public String getURLToLoginAsSuperAdminAndGotoPage(String pageURL)
pageURL
- the URL of the page to go to after logging in.public String getURLToLoginAndGotoPage(String username, String password, String pageURL)
username
- the name of the user to log in as.password
- the password for the user to log in.pageURL
- the URL of the page to go to after logging in.public String getURLToNonExistentPage()
public void assertOnPage(String pageURL)
public String getLoggedInUserName()
public void createUserAndLogin(String username, String password, Object... properties)
public void createUserAndLoginWithRedirect(String username, String password, String url, Object... properties)
public void createUser(String username, String password, String redirectURL, Object... properties)
public void createAdminUser()
public void setGlobalRights(String groups, String users, String rights, boolean enabled)
XWikiGlobalRights
xobject to the current wiki's XWikiPrefrences
document.groups
- the comma-separated list of groups that will have the rights (e.g. XWiki.XWikiAdminGroup
.
Can be empty or nullusers
- the comma-separated list of users that will have the rights (e.g. XWiki.Admin
. Can be
empty of nullrights
- the comma-separated list of rights to give (e.g. edit,admin
)enabled
- true if the rights should be allowed, false if they should be disabledpublic void setRights(org.xwiki.model.reference.EntityReference entityReference, String groups, String users, String rights, boolean enabled)
XWikiRights
xobject to the document specified in the passed entity reference.entityReference
- the reference to the document for which to set rights forgroups
- the comma-separated list of groups that will have the rights (e.g. XWiki.XWikiAdminGroup
.
Can be empty or nullusers
- the comma-separated list of users that will have the rights (e.g. XWiki.Admin
. Can be
empty of nullrights
- the comma-separated list of rights to give (e.g. edit,admin
)enabled
- true if the rights should be allowed, false if they should be disabledpublic ViewPage gotoPage(org.xwiki.model.reference.EntityReference reference)
public void gotoPage(org.xwiki.model.reference.EntityReference reference, String action)
public void gotoPage(String space, String page, String action, Object... queryParameters)
public void gotoPage(org.xwiki.model.reference.EntityReference reference, String action, Object... queryParameters)
public void gotoPage(String space, String page, String action, Map<String,?> queryParameters)
public void gotoPage(List<String> spaces, String page, String action, Map<String,?> queryParameters)
public void gotoPage(org.xwiki.model.reference.EntityReference reference, String action, Map<String,?> queryParameters)
public void gotoPage(List<String> spaces, String page, String action, String queryString)
public void gotoPage(org.xwiki.model.reference.EntityReference reference, String action, String queryString)
public void gotoPage(org.xwiki.model.reference.EntityReference reference, String action, String queryString, String fragment)
public void gotoPage(String url)
public String getURLToDeletePage(org.xwiki.model.reference.EntityReference reference)
public String getURLToDeletePage(org.xwiki.model.reference.EntityReference reference, boolean affectChildren)
public String getURLToDeleteSpace(String space)
space
- the name of the space to deletepublic ViewPage createPage(org.xwiki.model.reference.EntityReference reference, String content)
public ViewPage createPage(org.xwiki.model.reference.EntityReference reference, String content, String title)
public ViewPage createPage(List<String> spaces, String page, String content, String title)
public ViewPage createPage(String space, String page, String content, String title, String syntaxId)
public ViewPage createPage(org.xwiki.model.reference.EntityReference reference, String content, String title, String syntaxId)
public ViewPage createPage(List<String> spaces, String page, String content, String title, String syntaxId)
public ViewPage createPage(String space, String page, String content, String title, String syntaxId, String parentFullPageName)
public ViewPage createPage(List<String> spaces, String page, String content, String title, String syntaxId, String parentFullPageName)
public ViewPage createPage(org.xwiki.model.reference.EntityReference reference, String content, String title, String syntaxId, String parentFullPageName)
public ViewPage createPageWithAttachment(String space, String page, String content, String title, String syntaxId, String parentFullPageName, String attachmentName, InputStream attachmentData) throws Exception
Exception
public ViewPage createPageWithAttachment(String space, String page, String content, String title, String syntaxId, String parentFullPageName, String attachmentName, InputStream attachmentData, org.apache.commons.httpclient.UsernamePasswordCredentials credentials) throws Exception
Exception
public ViewPage createPageWithAttachment(List<String> spaces, String page, String content, String title, String syntaxId, String parentFullPageName, String attachmentName, InputStream attachmentData, org.apache.commons.httpclient.UsernamePasswordCredentials credentials) throws Exception
Exception
public ViewPage createPageWithAttachment(String space, String page, String content, String title, String attachmentName, InputStream attachmentData) throws Exception
Exception
public ViewPage createPageWithAttachment(String space, String page, String content, String title, String attachmentName, InputStream attachmentData, org.apache.commons.httpclient.UsernamePasswordCredentials credentials) throws Exception
Exception
public ViewPage createPageWithAttachment(org.xwiki.model.reference.EntityReference reference, String content, String title, String attachmentName, InputStream attachmentData, org.apache.commons.httpclient.UsernamePasswordCredentials credentials) throws Exception
Exception
public ViewPage createPageWithAttachment(org.xwiki.model.reference.EntityReference reference, String content, String title, String attachmentName, InputStream attachmentData) throws Exception
Exception
public void deletePage(org.xwiki.model.reference.EntityReference reference)
public void deletePage(org.xwiki.model.reference.EntityReference reference, boolean affectChildren)
public org.xwiki.model.reference.EntityReference resolveDocumentReference(String referenceAsString)
public org.xwiki.model.reference.EntityReference resolveSpaceReference(String referenceAsString)
public String serializeReference(org.xwiki.model.reference.EntityReference reference)
public void deleteSpace(String space)
space
- the name of the space to deletepublic boolean pageExists(List<String> spaces, String page) throws Exception
Exception
public String getURL(String space, String page)
space
- the space in which the page resides.page
- the name of the page.public String getURL(String space, String page, String action)
space
- the space in which the page resides.page
- the name of the page.action
- the action to do on the page.public String getURL(String space, String page, String action, String queryString)
space
- the space in which the page resides.page
- the name of the page.action
- the action to do on the page.queryString
- the query string to pass in the URL.public String getURL(List<String> spaces, String page, String action, String queryString)
public String getURL(org.xwiki.model.reference.EntityReference reference)
public String getURL(org.xwiki.model.reference.EntityReference reference, String action, String queryString)
public String getURL(org.xwiki.model.reference.EntityReference reference, String action, String queryString, String fragment)
public String executeAndGetBodyAsString(org.xwiki.model.reference.EntityReference reference, Map<String,?> queryParameters) throws Exception
Exception
public String getURLFragment(org.xwiki.model.reference.EntityReference reference)
public String getCurrentWiki()
public String getBaseURL()
public static void setURLPrefix(String urlPrefix)
public String getBaseBinURL()
public String getURL(String action, String[] path, String queryString, String fragment)
public String getURL(String space, String page, String action, Map<String,?> queryParameters)
space
- the space in which the page resides.page
- the name of the page.action
- the action to do on the page.queryParameters
- the parameters to pass in the URL, these will be automatically URL encoded.public String getAttachmentURL(String space, String page, String attachment, String action, String queryString)
space
- the name of the space that contains the page with the specified attachmentpage
- the name of the page that holds the attachmentattachment
- the attachment nameaction
- the action to perform on the attachmentqueryString
- the URL query stringpublic String getAttachmentURL(String space, String page, String attachment, String action)
space
- the name of the space that contains the page with the specified attachmentpage
- the name of the page that holds the attachmentattachment
- the attachment nameaction
- the action to perform on the attachmentpublic String getAttachmentURL(String space, String page, String attachment)
space
- the name of the space that contains the page with the specified attachmentpage
- the name of the page that holds the attachmentattachment
- the attachment namepublic void recacheSecretToken()
getSecretToken()
is called and after each re-login.getSecretToken()
public String getSecretToken()
recacheSecretToken()
first.recacheSecretToken()
public boolean isInWYSIWYGEditMode()
public boolean isInWikiEditMode()
public boolean isInViewMode()
public boolean isInSourceViewMode()
public boolean isInInlineEditMode()
public boolean isInRightsEditMode()
public boolean isInObjectEditMode()
public boolean isInClassEditMode()
public boolean isInDeleteMode()
public boolean isInRenameMode()
public boolean isInCreateMode()
public boolean isInAdminMode()
public void assertOnPage(org.xwiki.model.reference.EntityReference reference)
AssertionFailedError
if it's not the case.reference
- the reference to the document to checkpublic void forceGuestUser()
public void addObject(org.xwiki.model.reference.EntityReference reference, String className, Object... properties)
public void addObject(org.xwiki.model.reference.EntityReference reference, String className, Map<String,?> properties)
public void addObject(String space, String page, String className, Map<String,?> properties)
public void deleteObject(String space, String page, String className, int objectNumber) throws Exception
Exception
public void updateObject(String space, String page, String className, int objectNumber, Map<String,?> properties)
public void updateObject(String space, String page, String className, int objectNumber, Object... properties)
public void updateObject(org.xwiki.model.reference.EntityReference entityReference, String className, int objectNumber, Object... properties)
public void updateObject(List<String> spaces, String page, String className, int objectNumber, Object... properties)
public void addClassProperty(org.xwiki.model.reference.EntityReference reference, String propertyName, String propertyType)
public void updateClassProperty(org.xwiki.model.reference.EntityReference reference, Object... queryParameters)
public void addClassProperty(String space, String page, String propertyName, String propertyType)
public void addQueryStringEntry(StringBuilder builder, String key, Object value)
public void addQueryStringEntry(StringBuilder builder, String key, String value)
public Map<String,?> toQueryParameters(String className, Integer objectNumber, Object... properties)
public Map<String,?> toQueryParameters(String className, Integer objectNumber, Map<String,?> properties)
public String toQueryParameterKey(String className, Integer objectNumber, String key)
public ObjectEditPage editObjects(String space, String page)
public ClassEditPage editClass(String space, String page)
public void attachFile(String space, String page, String name, File file, boolean failIfExists) throws Exception
Exception
public void attachFile(String space, String page, String name, InputStream is, boolean failIfExists, org.apache.commons.httpclient.UsernamePasswordCredentials credentials) throws Exception
Exception
public void attachFile(List<String> spaces, String page, String name, InputStream is, boolean failIfExists, org.apache.commons.httpclient.UsernamePasswordCredentials credentials) throws Exception
Exception
public void attachFile(String space, String page, String name, InputStream is, boolean failIfExists) throws Exception
Exception
public void attachFile(List<String> spaces, String page, String name, InputStream is, boolean failIfExists) throws Exception
Exception
public void attachFile(org.xwiki.model.reference.EntityReference pageReference, String name, InputStream is, boolean failIfExists) throws Exception
Exception
public void attachFile(org.xwiki.model.reference.EntityReference reference, Object is, boolean failIfExists) throws Exception
Exception
public void attachFile(org.xwiki.model.reference.EntityReference pageReference, String name, InputStream is, boolean failIfExists, org.apache.commons.httpclient.UsernamePasswordCredentials credentials) throws Exception
Exception
public void deleteAttachement(org.xwiki.model.reference.EntityReference pageReference, String filename) throws Exception
Exception
public void deleteAttachement(org.xwiki.model.reference.EntityReference reference) throws Exception
Exception
public void deleteLatestVersion(String space, String page)
/deleteversions/
action.space
- the space name of the pagepage
- the name of the pagepublic void deleteVersion(String space, String page, String version)
/deleteversions/
action.space
- the space name of the pagepage
- the name of the pageversion
- the version to deletepublic void deleteVersions(String space, String page, String v1, String v2)
/deleteversions/
action.space
- the space name of the pagepage
- the name of the pagev1
- the starting version to deletev2
- the ending version to deletepublic void rollbackToPreviousVersion(String space, String page)
/rollback/
action.space
- the space name of the pagepage
- the name of the pagepublic void rollBackTo(String space, String page, String version)
/rollback/
action.space
- the space name of the pagepage
- the name of the pageversion
- the version to rollback topublic void setHierarchyMode(String mode)
mode
- the mode to use ("reference" or "parentchild")public void setPropertyInXWikiPreferences(String propertyName, String propertyType, Object value)
propertyName
- name of the property to setpropertyType
- the type of the property to addvalue
- value to set to the propertypublic void setPropertyInXWikiCfg(String configuration) throws IOException
configuration
- the configuration in Properties
format. For example "param1=value2\nparam2=value2"IOException
- if an error occurs while parsing the configurationpublic String setWikiPreference(String propertyName, String value) throws Exception
propertyName
- name of the property to setvalue
- value to set to the propertynull
otherwiseException
public static void assertStatuses(int actualCode, int... expectedCodes)
public static <M extends org.apache.commons.httpclient.HttpMethod> M assertStatusCodes(M method, boolean release, int... expectedCodes) throws Exception
Exception
public String escapeURL(String url)
url
- the url to encodepublic String escapeXPath(String value)
By.xpath("//a[. = " + escapeXPath(value) + "]")
value
- the value to escapepublic InputStream getInputStream(String path, Map<String,?> queryParams) throws Exception
Exception
public String getString(String path, Map<String,?> queryParams) throws Exception
Exception
public InputStream getInputStream(String prefix, String path, Map<String,?> queryParams, Object... elements) throws Exception
Exception
protected org.apache.commons.httpclient.methods.GetMethod executeGet(String uri) throws Exception
Exception
protected org.apache.commons.httpclient.methods.GetMethod executeGet(String uri, int... expectedCodes) throws Exception
Exception
protected org.apache.commons.httpclient.methods.GetMethod executeGet(String uri, boolean release, int... expectedCodes) throws Exception
Exception
protected org.apache.commons.httpclient.methods.PostMethod executePost(String uri, InputStream content, String mediaType) throws Exception
Exception
protected org.apache.commons.httpclient.methods.PostMethod executePost(String uri, InputStream content, String mediaType, int... expectedCodes) throws Exception
Exception
protected org.apache.commons.httpclient.methods.PostMethod executePost(String uri, InputStream content, String mediaType, boolean release, int... expectedCodes) throws Exception
Exception
protected org.apache.commons.httpclient.methods.DeleteMethod executeDelete(String uri) throws Exception
Exception
protected void executeDelete(String uri, int... expectedCodes) throws Exception
Exception
protected org.apache.commons.httpclient.methods.PutMethod executePut(String uri, InputStream content, String mediaType) throws Exception
Exception
protected void executePut(String uri, InputStream content, String mediaType, int... expectedCodes) throws Exception
Exception
protected org.apache.commons.httpclient.methods.PutMethod executePut(String uri, InputStream content, String mediaType, boolean release, int... expectedCodes) throws Exception
Exception
public TestUtils.RestTestUtils rest()
public void disableSyntaxHighlighting() throws Exception
Exception
public void switchTab(String tabHandle)
public String getCurrentTabHandle()
public String openLinkInTab(org.openqa.selenium.By by, String... existingTabHandles)
public void closeTab(String secondTabHandle)
Copyright © 2004–2021 XWiki. All rights reserved.