public abstract class

AbstractConfluenceAcceptanceTest

extends AbstractAtlassianWebTestCase
java.lang.Object
   ↳ junit.framework.Assert
     ↳ junit.framework.TestCase
       ↳ com.atlassian.confluence.ThreadLocalWebTestCase
         ↳ com.atlassian.confluence.AbstractAtlassianWebTestCase
           ↳ com.atlassian.confluence.AbstractConfluenceAcceptanceTest
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

This super class provides Confluence specific functions useful in acceptance tests.

Summary

Constants
String ANONYMOUS_USER
String BROWSE_MENU_LINK_ID
String SMTP_SUBJECT_PREFIX
String TESTBLOG_CONTENT
String TESTBLOG_TITLE
String TESTMAILSERVER_NAME
String TESTPAGE_COMMENT
String TESTPAGE_CONTENT
String TESTPAGE_TITLE
String TEST_GROUP1
String VIEW_PERSONAL_SPACE_LINK
[Expand]
Inherited Constants
From class com.atlassian.confluence.AbstractAtlassianWebTestCase
Fields
protected static final SimpleDateFormat BLOG_DATE_FORMAT
public static final String CONFLUENCE_ADMIN_GROUP
public static final String CONFLUENCE_USERS_GROUP
protected static final boolean CROWD_MODE
protected static final DirectoryConfiguration DIRECTORY_CONFIG
public static final RandomnessHandler RANDOM
public static final String TESTMAILSERVER_HOSTNAME
public static final String TESTSPACE2_DESCRIPTION
public static final String TESTSPACE2_KEY
public static final String TESTSPACE2_TITLE
public static final String TESTSPACE_DESCRIPTION
public static final String TESTSPACE_KEY
public static final String TESTSPACE_TITLE
public static final User TEST_ADMIN
public static final String TEST_ADMIN_EMAIL
public static final String TEST_ADMIN_FULLNAME
public static final String TEST_ADMIN_PASSWORD
public static final String TEST_ADMIN_USERNAME
public BlogPost TEST_BLOG
public Comment TEST_COMMENT
public static final String TEST_GEN_EMAIL1
public static final String TEST_GEN_EMAIL2
public static final String TEST_GEN_FULLNAME1
public static final String TEST_GEN_FULLNAME2
public static final String TEST_GEN_PASSWORD1
public static final String TEST_GEN_PASSWORD2
public static final String TEST_GEN_USERNAME1
public static final String TEST_GEN_USERNAME2
public Page TEST_PAGE
public static final Space TEST_SPACE
public static final Space TEST_SPACE2
public static final User TEST_USER1
public static final User TEST_USER2
protected AdminConsole adminConsole
protected String adminToken
public static final String context
protected List<File> filesToDelete
protected final Logger log
protected LogAdjuster logAdjuster Can be used by subclasses to turn logging on the server up or down for just one test.
protected MailServices mailServices
protected ConfluenceRpc rpc
protected String testUser2Token
protected String testUserToken
protected UserManagementHelper userHelper
protected ConfluenceRpc wikiMarkupRpc Use this for tests where you want to create pages/comments/blogs using wikimarkup.
protected XmlRpcClient xmlrpc This field is deprecated. use rpc instead.
[Expand]
Inherited Fields
From class com.atlassian.confluence.AbstractAtlassianWebTestCase
Public Constructors
AbstractConfluenceAcceptanceTest(String testName)
AbstractConfluenceAcceptanceTest()
Public Methods
void addAnonymousPermissionsToSpace(String spaceKey, Vector permissions)
void addComment(String spaceKey, String pageTitle, String comment)
This method is deprecated. Should use addComment() instead.
void addCommentToBlogPost(String spaceKey, String newsTitle, String comment)
void addSpaceLabel(String labelName)
void addUserToGroupViaHelper(String username, String groupname)
Adds the given user to a groupname
ViewContentBean addWatchPage()
void assertImagePresent(String imageName)
Provide our own implementation of assertImagePresent(String, String) that asserts the image name with a contains check rather than equals.
void assertImageValid(String imgSrc, String imgAlt)
We override the default implementation of this method as it has a bug when dealing with relative URLs

Basically if we are on the page /display/blah.action and there is an image src with /images/blah.gif, the default implementation will verify that the img src matches but will attempt to request the image at the URL /display/images/blah.gif.
void assertLinkPresentWithExactTextAndClass(String linkText, String cls)
void assertLoggedInAs(String username)
This method is deprecated. since 4.0. Use isLoggedInAs(String) and assertTrue.
void attachFile(File attachment, String comment)
Click the attach file link, attach a given file with a given comment and submit the attachment form.
void attachFile(File attachment)
Click the attach file link, attach a given file with a given comment and submit the attachment form.
void attachFileWithName(String fileName, InputStream in, String contentType, String comment)
Click the attach file link, attach a given file with a given comment and submit the attachment form.
String chooseRandomBaseUrl()
Selects a baseurl from the available specified base urls.
void createBlog(String spaceKey, String spaceTitle, String title, String body)
void createBlogInTestSpace(String title, String body)
void createGroup(String group)
Create a group via the Web Interface.
void createGroupViaHelper(String groupName)
Creates a group with the given name
void createMail(File mail, String spaceKey)
ViewContentBean createPage(String spaceKey, String title, String content, String parentPageTitle)
ViewContentBean createPageWithViewRestrictions(String spaceKey, String title, String content, String parentPageTitle, String viewPermissionUsers)
void createSpaceViaWebUI(Space space)
void createSpaceViaWebUI(String key, String name, String description)
void createSpaceViaWebUI(String key, String name, String description, String spaceGroupKey)
void createTemplate(String spaceName, String templateTitle, String templateDescription, String templateContent)
void createTestSpaceViaWebUI()
For those times we need to ensure a space was created via the web UI (For example if the web UI may behave differently to RPC)
void createUserViaHelper(String token, String username, String password, String fullName, String email)
Creates a new user with the given details.
void createUserViaHelper(User user)
void disableAnonymousAccess()
void disableAnonymousAccessToSpace(String spaceKey)
void editBlog(String spaceKey, String title, String content)
void editBlogLabels(String labels)
EditContentBean editPage(String spaceKey, String pageTitle)
void editPageContent(String content)
Sets content via RPC, as the admin user.
void editPageContentViaForm(String content)
Edits content on the form, and submits the form as the current user.
void editPageWithContent(String spaceKey, String title, String content)
void editSpaceDescription(User user, String spaceKey, String newDescription)
void editSpacePermsForm()
void enableAnonymousAccess()
void enableAnonymousAccessToSpace(String spaceKey)
void ensureTestUserCanViewTestSpace()
This method is deprecated. since 3.5 permissions should be granted using grantPermission(com.atlassian.confluence.it.SpacePermission, User) (which already ensures that users can view a space before other permissions are granted)
void forceViewGlobalAdmin()
File generateFile(String filename, String contents)
String getAppContext()
String getBaseUrl()
Returns base url that is used in tests.
String getConfiguredBaseUrl()
Returns the configured base URL in the Confluence app.
int getCurrentMailQueueSize()
String getFriendlyRelativeDate(Date now, Date date, TimeZone timeZone)
Use the FriendlyDateFormatter to format the date relative to the "now" time.
long getPageId(String spaceKey, String title)
String getTodaysBlogPostDate()
void gotoPageWithError(String url)
void grantAnonymousUseConfluencePermission()
void grantGlobalBrowsePermissionToGroup(String groupName)
This method is deprecated. since 3.5 use grantPermission(GlobalPermission, Group) instead
void grantGlobalPermissionToGroup(String permissionType, String groupName)
This method is deprecated. since 3.5 use grantPermission(GlobalPermission, Group) instead
void grantGlobalPermissionToUser(String permissionType, String userName)
This method is deprecated. since 3.5 use grantPermission(GlobalPermission, User) instead
void grantSpacePermissionToGroup(String spaceKey, String permissionType, String groupName)
Grant view space permissions and one other space permission to a specified group.
void grantSpacePermissionToGroupAndDelegate(String spaceKey, String permissionType, String groupName)
void grantSpacePermissionToUser(String spaceKey, String permissionType, String userName)
Grant view space permissions and one other space permission to a specified user.
void grantSpacePermissionToUserAndDelegate(String spaceKey, String permissionType, String userName)
Grants space permissions to the user by delegating to the rpc equivalent.
void grantViewSpacePermissionToGroup(String spaceKey, String groupName)
This method is deprecated. since 3.5 use grantPermission(com.atlassian.confluence.it.SpacePermission, Group) instead
void grantViewSpacePermissionToGroupAndDelegate(String spaceKey, String groupName)
void grantViewSpacePermissionToUser(String spaceKey, String username)
This method is deprecated. since 3.5 use grantPermission(com.atlassian.confluence.it.SpacePermission, User) instead
void importGlobalBackup(String importZipLocation, boolean waitForSuccess)
This method is deprecated. since 4.1 use an Importer instead.
void importMail(String filePath, String spaceKey)
Creates mails in the specified space.
void importMailAndAssertNoRunningTask(String filePath, String spaceKey)
Creates mails in the specified space and then checks if it successfully moved to the No Long Running Task page.
boolean isClustered()
void logIn(User user, String destination)
Log in as the specified user, going to the provided URL (relative to the context path) after logging in.
void logIn(User user)
Log in as the specified user, going to the default start page.
void logInAs(String username, String password, boolean rememberMe)
void logInAs(String username, String password)
void logInAsAdminAtDashboard()
void logInAsAtDashboard(String username, String password)
void loginAs(User user)
void loginAsAtDashboard(User user)
void loginAsTestUser()
void loginAsTestUser2()
void loginAsTestUserAtDashboard()
void logout()
static Vector<Object> makeParams(Object... params)
This method is deprecated. Use rpc instead.
void movePage(String spaceKey, String title, String newSpaceKey)
void movePage(String title, Space oldSpace, Space newSpace)
void movePageToNewParent(String oldSpaceKey, String title, String newSpaceKey, String newParentPage)
void movePageToNewParent(String spaceKey, String title, String newParentPage)
void movePageToNewSpace(String spaceKey, String title, String newSpaceKey)
void removeAnonymousPermissionToSpace(String spaceKey, String permission)
void removeGroup(String groupName)
Delete a group via the Web Interface.
void removePageLabel(String spaceKey, String pageTitle)
void removePageOrBlogById(long id)
void removePersonalSpace(String username)
void removeTestUser1()
Remove testUser1 via the Web Interface.
void removeTestUser1ViaHelper(String token)
Removes the test user
void removeUser(String username)
Remove a user via the Web Interface.
void removeUserFromGroupViaHelper(String username, String groupname)
Removes the given user from the group
void removeUserViaHelper(String username)
Removes a user with the given username
void renamePage(String spaceKey, String originalPageTitle, String newPageTitle)
void revokeAnonymousUseConfluencePermission()
void revokeGlobalPermissionFromGroup(String permissionType, String groupName)
This method is deprecated. since 3.5 use revokePermission(GlobalPermission, Entity) instead
void revokeGlobalPermissionFromUser(String permissionType, User user)
This method is deprecated. since 3.5 use revokePermission(GlobalPermission, Entity) instead
void revokeSpacePermissionFromGroup(String spaceKey, String permissionType, String groupName)
Remove a space permission from a specified group.
void revokeSpacePermissionFromUser(String spaceKey, String permissionType, String userName)
Remove a space permission from a specified user.
Hashtable rpcAddComment(String token, long pageId, long parentCommentId, String comment)
Adds a comment to a page via the XML-RPC interface
Hashtable rpcAddComment(String token, String spaceKey, String pageTitle, String comment)
Adds a comment to a page via the XML-RPC interface
Hashtable rpcAddComment(String token, long pageId, String comment)
Adds a comment to a page via the XML-RPC interface
void rpcAddLabelToBlog(String token, String label, long blogId)
Adds a label to the blogpost with the given page ID
void rpcAddLabelToPage(String token, String label, long pageId)
Adds a label to the Page with the given page ID
void rpcAddLabelToPage(String token, String label, String spaceKey, String pageTitle)
Adds a label to the Page with the given details

This method retrieves the ID for the given Page and passes it onto the appropriate rpcAddLabelToPage method
void rpcAddLabelToSpace(String token, String label, String spaceKey)
Adds a label to a space
String rpcAddTestComment(String token)
void rpcClearIndex()
void rpcClearQueue(String token, String queueName)
long rpcCreateBlogPost(String token, String spaceKey, String postTitle, String postContent, Date lastModification)
long rpcCreateBlogPost(String token, String spaceKey, String postTitle, String postContent)
Creates a new blog entry via the XML-RPC interface
long rpcCreatePage(String token, String spaceKey, String title, String content)
This method is deprecated. use createPage(String, String, String, long) instead.
long rpcCreatePage(String token, String spaceKey, String title, String content, long parentPageId)
This method is deprecated. use createPage(String, String, String, long) instead.
Hashtable rpcCreatePersonalSpace(String token, String name, String description, String username)
Creates a personal space via the XML-RPC interface
Hashtable rpcCreateSpace(String token, String key, String name, String description)
This method is deprecated. Use createSpace(com.atlassian.confluence.it.Space) instead.
Hashtable rpcCreateSpace(String token, String key, String name, String description, String spaceGroup)
This method is deprecated. Use createSpace(com.atlassian.confluence.it.Space) instead.
Hashtable rpcCreateSpaceGroup(String token, String key, String name)
Hashtable rpcCreateTestSpace(String token)
Creates the test space via the XML-RPC interface

This method first checks if the test space exists, and logs a message if it does
Hashtable rpcCreateTestSpace2(String token)
Creates the 2nd test space via the XML-RPC interface

This method first checks if the test space exists, and logs a message if it does
long rpcCreateXhtmlPage(String token, String spaceKey, String title, String content)
void rpcEditBlogPost(String token, long entryId, String newTitle, String newContent)
Modifies the page with the given details via the XML-RPC interface
Hashtable rpcEditComment(String token, long pageId, long commentId, String comment)
void rpcEditPage(String token, String spaceKey, String pageTitle, String newTitle, String newContent)
void rpcFlushIndexQueue()
This method is deprecated. use flushIndexQueue() instead.
void rpcFlushMailQueue()
This method is deprecated. since 3.3
String rpcGetAdminToken()
Retrieves a token for the admin user
long rpcGetBlogPostId(String token, String spaceKey, int dayOfMonth, String postTitle)
Retrieves the ID of a blog post with the given details
Vector rpcGetChildren(String token, long pageId)
Returns the ordered id list of pages that are direct children of a given page.
Vector rpcGetComments(String token, String pageId)
String rpcGetLocalisedText(String messageKey)
Returns the localised message text for the given key, retrieved from the application via RPC.
int rpcGetMailQueueSize()
long rpcGetPageId(String token, String spaceKey, String pageTitle)
Retrieves the page ID for a page with the given details
List rpcGetPageLabels(String token, String spaceKey, String pageTitle)
Retrieves the labels assigned to a page with the given details

This method retrieves the page ID and passes it onto the appropriate rpcGetPageLabels method
List rpcGetPageLabels(String token, long pageId)
Retrieves the labels assigned to a Page with the given page ID
String rpcGetTestUser2Token()
Retrieves a token for the test user 2
String rpcGetTestUserToken()
Retrieves a token for the test user
Vector rpcGetTopLevelPages(String token, String spaceKey)
Returns the ordered id list of top-level pages in a given space.
Vector rpcGetUserGroups(String token, String username)
String rpcGetUserToken(User user)
String rpcGetUserToken(String username, String password)
Retrieves the user token for the given details, for use with the XML-RPC interface
int rpcGetVersionForPage(String token, long pageId)
void rpcGrantAnonymousSpacePermission(String token, String permission, String spaceKey)
Grants the given permission to the anonymous user for the given space
void rpcGrantGlobalPermission(String token, String permission, String entityName)
Grants the given global permission to a user.
void rpcGrantSpacePermission(String token, String permission, String username, String spaceKey)
Grants the given permission to a user for a particular Space
void rpcGrantViewSpacePermission(String token, String entityName, String spaceKey)
Convenience method for granting VIEWSPACE permission to a particular user
boolean rpcHasGroup(String token, String groupName)
boolean rpcHasUser(String token, String username)
void rpcLogOut(String token)
void rpcLogOutAdmin()
void rpcMovePageToTopLevel(String token, long pageId, String targetSpaceKey)
Moves a page to the top of a given space.
void rpcPauseJob(String jobName)
void rpcRemoveAnonymousSpacePermission(String token, String permission, String spaceKey)
Removes the given permission for the anonymous user from the given space
void rpcRemoveAttachment(String token, String attachmentFileName, long contentId)
Remove an attachment from a page or blog.
void rpcRemoveGlobalPermissions(String token, String permission, String username)
Removes the given global permission for a user
void rpcRemoveGroup(String groupname)
Removes the given group
void rpcRemoveLabelFromPage(String token, String label, long pageId)
Removes the given label from the page with the given page ID
void rpcRemoveLabelFromPage(String token, String label, String spaceKey, String pageTitle)
void rpcRemoveLabelFromSpace(String token, String label, String spaceKey)
Removes a label from a space
void rpcRemovePage(String token, String spaceKey, long pageId)
This method is deprecated. use removePage(long) instead.
void rpcRemoveSpace(String token, String spaceKey)
This method is deprecated. use removeSpace(String) instead.
void rpcRemoveSpacePermission(String token, String permission, String username, String spaceKey)
Removes the given permission for a user for a particular Space
void rpcRenderContent(String token, String spaceKey, long pageId, String newContent)
void rpcRestoreAbstractPage(long id)
void rpcResumeJob(String jobName)
Hashtable rpcStoreBlogEntry(String token, long pageId, String comment)
void rpcTrashPage(String token, long pageId)
Trashes (removes) a page with the given ID

This method converts the long into a String and calls the appropriate rpcTrashPage method
void rpcTrashPage(String token, String spaceKey, String pageTitle)
Trashes (removes) a page with the given details

This method retrieves the page with the given details and calls the appropriate rpcTrashPage method
void rpcTrashPage(String token, String pageId)
Trashes (removes) a page with the given ID
void rpcTriggerJob(String jobName)
void search(String query)
void setApplicationConfigProperty(String propertyKey, String propertyValue)
void setAttachmentMaxUploadSize(long max)
JSONObject setBlogLabels(String spaceKey, String blogTitle, String labels)
Add the specified labels to the blog
void setEditPermissionsForGroups(String spaceKey, String pageTitle, String groups)
void setEditPermissionsForUsers(String spaceKey, String pageTitle, String users)
void setMaxAttachmentsInUI(long max)
JSONObject setPageLabels(String spaceKey, String pageTitle, String labels)
Add the specified labels to the page
void setSharedMode(boolean enable)
void setThreadedComments(boolean enable)
void setViewPermissionsForGroups(String spaceKey, String pageTitle, String groups)
void setViewPermissionsForUsers(String spaceKey, String pageTitle, String users)
void showAllUsers()
void shutdownQuartz()
void stopTestMailServer()
void viewBlog(String spaceKey, String datePath, String title)
void viewEditBlogPostPage(long entryId)
Views the edit blog post page for the post with the given ID
void viewGlobalAdmin()
GlobalPermissions viewGlobalPermissions()
void viewHomepage()
void viewLabel(String spaceKey, String labelName)
void viewLanguages()
ViewContentBean viewPage(String spaceKey, String pageTitle)
void viewPeopleDirectory()
SpaceAdmin viewSpaceAdmin()
void viewSpaceAdvanced()
void viewSpaceContent()
SpacePermissions viewSpacePermissions(Space space)
void viewSpacePermissions(String spaceKey)
This method is deprecated. since 3.5 use viewSpacePermissions(com.atlassian.confluence.it.Space) instead
void viewSpaceSummary()
void viewSpaceSummary(String spaceKey)
ViewContentBean viewTodaysBlog(String spaceKey, String title)
void viewTrash()
void viewUser(String name)
ViewContentBean watchPage(String spaceKey, String pageTitle)
void watchSpace(Space space)
void watchSpace(String spaceKey)
Object xmlRpcExecute(String method, Vector params)
This method is deprecated. call ConfluenceRpc#execute(String, Object...) or ConfluenceRpc#executeFuncTest(String, Object...) instead.
Protected Methods
void assertMailReceived()
void assertNoMailReceived()
void createTestMailServer()
Starts up and configures a new mail server which will be pulled back down during tearDown().
String generateBaseUrl()
long getCurrentPageId()
PluginHelper getPluginHelper()
void importGlobalBackup(File backupFile, boolean waitForSuccess)
This method is deprecated. since 4.1 use an Importer instead.
void importSpaceBackup(String importZipLocation, boolean waitForSuccess)
This method is deprecated. since 4.1 use an Importer instead.
void loginViaForm(String username, String password, boolean rememberMe)
void rebuildIndex()
void rpcFlushAllCaches(String token)
This method is deprecated. use flushAllCaches() instead.
void rpcMovePage(String token, long sourcePageId, long targetPageId, String position)
Moves a page to a location relative to another page.
void rpcRemoveAllSpaceGroups(String token)
void rpcRemoveComment(String token, long commentId)
Remove a comment, identified by its id.
void rpcRemoveComment(String token, String commentContent, String spaceKey, String pageTitle)
Remove a comment, identified by its location and content, from a page.
void rpclogCommandOutput(String commandString)
void setCheckbox(boolean check, String checkBox)
void setUp()
void setUp(String beginAt)
Default setUp method.
void setUpTestNG(Method method)
Called by TestNG, calls setUp() on the current class, prevents the need to put this annotation everywhere, and sets the test name properly.
void tearDown()
Default tearDown method.
void tearDownTestNG(Method method)
Called by TestNG, calls tearDown() on the current class, prevents the need to put this annotation everywhere, and sets the test name properly.
String withParagraph(String value)
[Expand]
Inherited Methods
From class com.atlassian.confluence.AbstractAtlassianWebTestCase
From class com.atlassian.confluence.ThreadLocalWebTestCase
From class junit.framework.TestCase
From class junit.framework.Assert
From class java.lang.Object
From interface junit.framework.Test

Constants

public static final String ANONYMOUS_USER

Constant Value: "Anonymous"

protected static final String BROWSE_MENU_LINK_ID

Constant Value: "browse-menu-link"

protected static final String SMTP_SUBJECT_PREFIX

Constant Value: "[confluence-tests]"

public static final String TESTBLOG_CONTENT

Constant Value: "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."

public static final String TESTBLOG_TITLE

Constant Value: "Test Blog"

public static final String TESTMAILSERVER_NAME

Constant Value: "Test Server"

public static final String TESTPAGE_COMMENT

Constant Value: "Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."

public static final String TESTPAGE_CONTENT

Constant Value: "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."

public static final String TESTPAGE_TITLE

Constant Value: "Test Page"

protected static final String TEST_GROUP1

Constant Value: "testgroup1"

protected static final String VIEW_PERSONAL_SPACE_LINK

Constant Value: "view-personal-space-link"

Fields

protected static final SimpleDateFormat BLOG_DATE_FORMAT

public static final String CONFLUENCE_ADMIN_GROUP

public static final String CONFLUENCE_USERS_GROUP

protected static final boolean CROWD_MODE

protected static final DirectoryConfiguration DIRECTORY_CONFIG

public static final RandomnessHandler RANDOM

public static final String TESTMAILSERVER_HOSTNAME

public static final String TESTSPACE2_DESCRIPTION

public static final String TESTSPACE2_KEY

public static final String TESTSPACE2_TITLE

public static final String TESTSPACE_DESCRIPTION

public static final String TESTSPACE_KEY

public static final String TESTSPACE_TITLE

public static final User TEST_ADMIN

public static final String TEST_ADMIN_EMAIL

public static final String TEST_ADMIN_FULLNAME

public static final String TEST_ADMIN_PASSWORD

public static final String TEST_ADMIN_USERNAME

public BlogPost TEST_BLOG

public Comment TEST_COMMENT

public static final String TEST_GEN_EMAIL1

public static final String TEST_GEN_EMAIL2

public static final String TEST_GEN_FULLNAME1

public static final String TEST_GEN_FULLNAME2

public static final String TEST_GEN_PASSWORD1

public static final String TEST_GEN_PASSWORD2

public static final String TEST_GEN_USERNAME1

public static final String TEST_GEN_USERNAME2

public Page TEST_PAGE

public static final Space TEST_SPACE

public static final Space TEST_SPACE2

public static final User TEST_USER1

public static final User TEST_USER2

protected AdminConsole adminConsole

protected String adminToken

public static final String context

protected List<File> filesToDelete

protected final Logger log

protected LogAdjuster logAdjuster

Can be used by subclasses to turn logging on the server up or down for just one test. resetLogLevels() is called in tearDown().

protected MailServices mailServices

protected ConfluenceRpc rpc

protected String testUser2Token

protected String testUserToken

protected UserManagementHelper userHelper

protected ConfluenceRpc wikiMarkupRpc

Use this for tests where you want to create pages/comments/blogs using wikimarkup.

protected XmlRpcClient xmlrpc

This field is deprecated.
use rpc instead.

Public Constructors

public AbstractConfluenceAcceptanceTest (String testName)

public AbstractConfluenceAcceptanceTest ()

Public Methods

public void addAnonymousPermissionsToSpace (String spaceKey, Vector permissions)

public void addComment (String spaceKey, String pageTitle, String comment)

This method is deprecated.
Should use addComment() instead.

public void addCommentToBlogPost (String spaceKey, String newsTitle, String comment)

public void addSpaceLabel (String labelName)

public void addUserToGroupViaHelper (String username, String groupname)

Adds the given user to a groupname

Parameters
username the username of the user to be added
groupname the group the user should be added to

public ViewContentBean addWatchPage ()

Throws
Exception

public void assertImagePresent (String imageName)

Provide our own implementation of assertImagePresent(String, String) that asserts the image name with a contains check rather than equals.

public void assertImageValid (String imgSrc, String imgAlt)

We override the default implementation of this method as it has a bug when dealing with relative URLs

Basically if we are on the page /display/blah.action and there is an image src with /images/blah.gif, the default implementation will verify that the img src matches but will attempt to request the image at the URL /display/images/blah.gif. The bug is in the method #createUrl(String, URL)

public void assertLinkPresentWithExactTextAndClass (String linkText, String cls)

public void assertLoggedInAs (String username)

This method is deprecated.
since 4.0. Use isLoggedInAs(String) and assertTrue.

public void attachFile (File attachment, String comment)

Click the attach file link, attach a given file with a given comment and submit the attachment form.

Parameters
attachment the file attachment
comment the comment for the attachment

public void attachFile (File attachment)

Click the attach file link, attach a given file with a given comment and submit the attachment form.

Parameters
attachment the file attachment

public void attachFileWithName (String fileName, InputStream in, String contentType, String comment)

Click the attach file link, attach a given file with a given comment and submit the attachment form.

Parameters
fileName the filename to attach
in the stream to read the file
contentType the content type of the attachment
comment a comment for this attachment

public String chooseRandomBaseUrl ()

Selects a baseurl from the available specified base urls. Base urls are specified by properties of the form baseurl, baseurl2 etc. The randomness is introduced by RANDOM which is created with a seed that is logged so that the tests may be reproduced by passing a test property named "seed".

Note that the search for baseurls stops at the first number that isn't specified. Eg if baseurl4 is specified but baseurl3 is not specified, then baseurl4 will not be discovered.
Returns
  • a randomly selected baseurl or null if no baseurls are specified.

public void createBlog (String spaceKey, String spaceTitle, String title, String body)

public void createBlogInTestSpace (String title, String body)

public void createGroup (String group)

Create a group via the Web Interface. This should only be used where the web interface itself is being tested. It cannot be used when the UserRepository being tested is unmodifiable.

public void createGroupViaHelper (String groupName)

Creates a group with the given name

Parameters
groupName the name of the group to be created

public void createMail (File mail, String spaceKey)

public ViewContentBean createPage (String spaceKey, String title, String content, String parentPageTitle)

public ViewContentBean createPageWithViewRestrictions (String spaceKey, String title, String content, String parentPageTitle, String viewPermissionUsers)

public void createSpaceViaWebUI (Space space)

public void createSpaceViaWebUI (String key, String name, String description)

public void createSpaceViaWebUI (String key, String name, String description, String spaceGroupKey)

public void createTemplate (String spaceName, String templateTitle, String templateDescription, String templateContent)

public void createTestSpaceViaWebUI ()

For those times we need to ensure a space was created via the web UI (For example if the web UI may behave differently to RPC)

public void createUserViaHelper (String token, String username, String password, String fullName, String email)

Creates a new user with the given details. Depending on the value of the ldapMode test property the user is created in an ldap repository or via the XML-RPC interface.

Parameters
token the authentication token
username the username of the new user
password the password of the new user
fullName the full name of the new user
email the email of the new user

public void createUserViaHelper (User user)

public void disableAnonymousAccess ()

public void disableAnonymousAccessToSpace (String spaceKey)

public void editBlog (String spaceKey, String title, String content)

public void editBlogLabels (String labels)

public EditContentBean editPage (String spaceKey, String pageTitle)

public void editPageContent (String content)

Sets content via RPC, as the admin user.

public void editPageContentViaForm (String content)

Edits content on the form, and submits the form as the current user.

public void editPageWithContent (String spaceKey, String title, String content)

public void editSpaceDescription (User user, String spaceKey, String newDescription)

public void editSpacePermsForm ()

public void enableAnonymousAccess ()

public void enableAnonymousAccessToSpace (String spaceKey)

public void ensureTestUserCanViewTestSpace ()

This method is deprecated.
since 3.5 permissions should be granted using grantPermission(com.atlassian.confluence.it.SpacePermission, User) (which already ensures that users can view a space before other permissions are granted)

public void forceViewGlobalAdmin ()

public File generateFile (String filename, String contents)

public String getAppContext ()

public String getBaseUrl ()

Returns base url that is used in tests. Note that in case of cluster it will return a base url of the node that the current test is running against. For configured base url please use getConfiguredBaseUrl() method.

public String getConfiguredBaseUrl ()

Returns the configured base URL in the Confluence app. This is the same as the base URL of node #1 in a cluster.

Returns
  • it

public int getCurrentMailQueueSize ()

public String getFriendlyRelativeDate (Date now, Date date, TimeZone timeZone)

Use the FriendlyDateFormatter to format the date relative to the "now" time. Note that the output format varies greatly even from second to second -- see FriendlyDateFormatter.

Parameters
now the date which the relative time is calculated in relation to
date the date of some event which is to be formatted
timeZone the current time zone
Returns
  • a formatted relative date-time

public long getPageId (String spaceKey, String title)

public String getTodaysBlogPostDate ()

public void gotoPageWithError (String url)

public void grantAnonymousUseConfluencePermission ()

public void grantGlobalBrowsePermissionToGroup (String groupName)

This method is deprecated.
since 3.5 use grantPermission(GlobalPermission, Group) instead

public void grantGlobalPermissionToGroup (String permissionType, String groupName)

This method is deprecated.
since 3.5 use grantPermission(GlobalPermission, Group) instead

public void grantGlobalPermissionToUser (String permissionType, String userName)

This method is deprecated.
since 3.5 use grantPermission(GlobalPermission, User) instead

public void grantSpacePermissionToGroup (String spaceKey, String permissionType, String groupName)

Grant view space permissions and one other space permission to a specified group. Grants the permission via the web interface. Must already be logged in as a user with permission to set permissions on the space. Group must not already have view space permissions for the space.

Parameters
spaceKey the key of the existing space.
permissionType one of the strings in SpacePermission, eg SYSTEM_ADMINISTRATOR_PERMISSION
groupName The name of the group.

public void grantSpacePermissionToGroupAndDelegate (String spaceKey, String permissionType, String groupName)

public void grantSpacePermissionToUser (String spaceKey, String permissionType, String userName)

Grant view space permissions and one other space permission to a specified user. Grants the permission via the web interface. Must already be logged in as a user with permission to set permissions on the space. User must not already have view space permissions for the space.

Parameters
spaceKey the key of the existing space.
permissionType one of the strings in SpacePermission, eg SYSTEM_ADMINISTRATOR_PERMISSION
userName The name of the user.

public void grantSpacePermissionToUserAndDelegate (String spaceKey, String permissionType, String userName)

Grants space permissions to the user by delegating to the rpc equivalent. Used to minify the amount of changes required for many existing calls.

Parameters
spaceKey to grant the space permission to
permissionType to grant
userName the name of the user to grant the permission to.

public void grantViewSpacePermissionToGroup (String spaceKey, String groupName)

This method is deprecated.
since 3.5 use grantPermission(com.atlassian.confluence.it.SpacePermission, Group) instead

public void grantViewSpacePermissionToGroupAndDelegate (String spaceKey, String groupName)

public void grantViewSpacePermissionToUser (String spaceKey, String username)

This method is deprecated.
since 3.5 use grantPermission(com.atlassian.confluence.it.SpacePermission, User) instead

public void importGlobalBackup (String importZipLocation, boolean waitForSuccess)

This method is deprecated.
since 4.1 use an Importer instead.

Perform a site import via the web ui. Logs in as admin first. After the import is performed, the admin user logs in again and the base url setting is restored.

If waiting for success, the method relies on being the only import process running at the time, since it waits for an ImportFinishedEvent.

Parameters
importZipLocation zip file location relative to classpath
waitForSuccess synchronously wait for the export to complete

public void importMail (String filePath, String spaceKey)

Creates mails in the specified space. Mail import can be done with an Mbox file or single mail. No explicit assertions are made by this method.

Parameters
filePath the file path to the mailbox
spaceKey the space key to import into

public void importMailAndAssertNoRunningTask (String filePath, String spaceKey)

Creates mails in the specified space and then checks if it successfully moved to the No Long Running Task page. Mail import can be done with an Mbox file or single mail.

Parameters
filePath the file path to the mailbox
spaceKey the space key to import into

public boolean isClustered ()

Returns
  • true if testing against a clustered intance of Confluence, false otherwise.

public void logIn (User user, String destination)

Log in as the specified user, going to the provided URL (relative to the context path) after logging in.

Parameters
user the user to log in as.
destination where to go after logging in. Pass 'null' to go to the default homepage.

public void logIn (User user)

Log in as the specified user, going to the default start page.

Parameters
user the user to log in as.

public void logInAs (String username, String password, boolean rememberMe)

public void logInAs (String username, String password)

public void logInAsAdminAtDashboard ()

public void logInAsAtDashboard (String username, String password)

public void loginAs (User user)

public void loginAsAtDashboard (User user)

public void loginAsTestUser ()

public void loginAsTestUser2 ()

public void loginAsTestUserAtDashboard ()

public void logout ()

public static Vector<Object> makeParams (Object... params)

This method is deprecated.
Use rpc instead.

Convert the given params into a Vector.

Parameters
params the params.
Returns
  • the vector.

public void movePage (String spaceKey, String title, String newSpaceKey)

public void movePage (String title, Space oldSpace, Space newSpace)

public void movePageToNewParent (String oldSpaceKey, String title, String newSpaceKey, String newParentPage)

public void movePageToNewParent (String spaceKey, String title, String newParentPage)

public void movePageToNewSpace (String spaceKey, String title, String newSpaceKey)

public void removeAnonymousPermissionToSpace (String spaceKey, String permission)

public void removeGroup (String groupName)

Delete a group via the Web Interface. This should only be used where the web interface itself is being tested. It cannot be used when the UserRepository being tested is unmodifiable.

public void removePageLabel (String spaceKey, String pageTitle)

public void removePageOrBlogById (long id)

public void removePersonalSpace (String username)

public void removeTestUser1 ()

Remove testUser1 via the Web Interface. This should only be used where the web interface itself is being tested. It cannot be used when the UserRepository being tested is unmodifiable.

public void removeTestUser1ViaHelper (String token)

Removes the test user

Parameters
token the authentication token

public void removeUser (String username)

Remove a user via the Web Interface. This should only be used where the web interface itself is being tested. It cannot be used when the UserRepository being tested is unmodifiable.

public void removeUserFromGroupViaHelper (String username, String groupname)

Removes the given user from the group

Parameters
username the username of the user to be removed
groupname the name of the group the user should be removed from

public void removeUserViaHelper (String username)

Removes a user with the given username

Parameters
username the username of the user to remove

public void renamePage (String spaceKey, String originalPageTitle, String newPageTitle)

public void revokeAnonymousUseConfluencePermission ()

public void revokeGlobalPermissionFromGroup (String permissionType, String groupName)

This method is deprecated.
since 3.5 use revokePermission(GlobalPermission, Entity) instead

Removes the specified global permission (from SpacePermission) from the given group name

Parameters
permissionType the permissiont type
groupName the group to remove the permission from

public void revokeGlobalPermissionFromUser (String permissionType, User user)

This method is deprecated.
since 3.5 use revokePermission(GlobalPermission, Entity) instead

Removes the specified global permission (from SpacePermission) from the given group name

Parameters
permissionType the permission type to remove
user who will lose the permission

public void revokeSpacePermissionFromGroup (String spaceKey, String permissionType, String groupName)

Remove a space permission from a specified group. Removes the permission via the web interface. Must already be logged in as a group with permission to set permissions on the space.

Parameters
spaceKey the key of the existing space.
permissionType one of the strings in SpacePermission, eg SYSTEM_ADMINISTRATOR_PERMISSION
groupName The name of the group.

public void revokeSpacePermissionFromUser (String spaceKey, String permissionType, String userName)

Remove a space permission from a specified user. Removes the permission via the web interface. Must already be logged in as a user with permission to set permissions on the space.

Parameters
spaceKey the key of the existing space.
permissionType one of the strings in SpacePermission, eg SYSTEM_ADMINISTRATOR_PERMISSION
userName The name of the user.

public Hashtable rpcAddComment (String token, long pageId, long parentCommentId, String comment)

Adds a comment to a page via the XML-RPC interface

Parameters
token the authentication token
pageId the ID of the page to add the comment to
parentCommentId the ID of the parent comment to add the comment to
comment the text of the comment
Returns
  • the comment as a hash table

public Hashtable rpcAddComment (String token, String spaceKey, String pageTitle, String comment)

Adds a comment to a page via the XML-RPC interface

Parameters
token the authentication token
spaceKey the space key of the page
pageTitle the title of the page
comment the text of the comment
Returns
  • the comment as a hash table

public Hashtable rpcAddComment (String token, long pageId, String comment)

Adds a comment to a page via the XML-RPC interface

Parameters
token the authentication token
pageId the ID of the page to add the comment to
comment the text of the comment
Returns
  • the comment as a hash table

public void rpcAddLabelToBlog (String token, String label, long blogId)

Adds a label to the blogpost with the given page ID

Parameters
token the authentication token
label the label to be added to the Page
blogId the ID of the page

public void rpcAddLabelToPage (String token, String label, long pageId)

Adds a label to the Page with the given page ID

Parameters
token the authentication token
label the label to be added to the Page
pageId the ID of the page

public void rpcAddLabelToPage (String token, String label, String spaceKey, String pageTitle)

Adds a label to the Page with the given details

This method retrieves the ID for the given Page and passes it onto the appropriate rpcAddLabelToPage method
Parameters
token the authentication token
label the label to be added to the page
spaceKey the key of the Space the page is located in
pageTitle the title of the Page

public void rpcAddLabelToSpace (String token, String label, String spaceKey)

Adds a label to a space

Parameters
token the token identifying the user
label the label name (namespaces allowed)
spaceKey the space key

public String rpcAddTestComment (String token)

public void rpcClearIndex ()

public void rpcClearQueue (String token, String queueName)

public long rpcCreateBlogPost (String token, String spaceKey, String postTitle, String postContent, Date lastModification)

public long rpcCreateBlogPost (String token, String spaceKey, String postTitle, String postContent)

Creates a new blog entry via the XML-RPC interface

Parameters
token the authentication token
spaceKey the key of the Space the blog entry will be created in
postTitle the title of the post to be created
postContent the content of the post to be created
Returns
  • returns the id of the new blogpost

public long rpcCreatePage (String token, String spaceKey, String title, String content)

This method is deprecated.
use createPage(String, String, String, long) instead.

Creates a page via the XML-RPC interface

Parameters
token the authentication token
spaceKey the key for the space the page will be created in
title the title of the new page
content the content of the new page
Returns
  • the page id

public long rpcCreatePage (String token, String spaceKey, String title, String content, long parentPageId)

This method is deprecated.
use createPage(String, String, String, long) instead.

Creates a page via the XML-RPC interface

Parameters
token the authentication token
spaceKey the key for the space the page will be created in
title the title of the new page
content the content of the new page
parentPageId the id of the parent page, 0 if none.
Returns
  • the page id

public Hashtable rpcCreatePersonalSpace (String token, String name, String description, String username)

Creates a personal space via the XML-RPC interface

Parameters
token the authentication token
name the name of the Space
description the description of the Space
username name of the user to own the space
Returns
  • the space as a hashtable

public Hashtable rpcCreateSpace (String token, String key, String name, String description)

This method is deprecated.
Use createSpace(com.atlassian.confluence.it.Space) instead.

public Hashtable rpcCreateSpace (String token, String key, String name, String description, String spaceGroup)

This method is deprecated.
Use createSpace(com.atlassian.confluence.it.Space) instead.

Creates a space via the XML-RPC interface

Parameters
token the authentication token
key the key of the Space
name the name of the Space
description the description of the Space
spaceGroup the space group key, can be null
Returns
  • the space as a hashtable

public Hashtable rpcCreateSpaceGroup (String token, String key, String name)

public Hashtable rpcCreateTestSpace (String token)

Creates the test space via the XML-RPC interface

This method first checks if the test space exists, and logs a message if it does
Parameters
token the authentication token
Returns
  • the space as a hash table

public Hashtable rpcCreateTestSpace2 (String token)

Creates the 2nd test space via the XML-RPC interface

This method first checks if the test space exists, and logs a message if it does
Parameters
token the authentication token
Returns
  • the space as a hashtable

public long rpcCreateXhtmlPage (String token, String spaceKey, String title, String content)

public void rpcEditBlogPost (String token, long entryId, String newTitle, String newContent)

Modifies the page with the given details via the XML-RPC interface

Parameters
token the authentication token
entryId the ID of the blog entry
newTitle the new title of the Blog Post (null if the same)
newContent the new content of the Blog Post (null if the same)

public Hashtable rpcEditComment (String token, long pageId, long commentId, String comment)

public void rpcEditPage (String token, String spaceKey, String pageTitle, String newTitle, String newContent)

This method is deprecated.
use editPage(com.atlassian.confluence.it.Space, String, String, String) instead

Modifies the page with the given details via the XML-RPC interface

Parameters
token the authentication token
spaceKey the key of the Space the Page is in
pageTitle the current title of the Page
newTitle the new title of the Page (null if the same)
newContent the new content of the Page (null if the same)

public void rpcFlushIndexQueue ()

This method is deprecated.
use flushIndexQueue() instead.

public void rpcFlushMailQueue ()

This method is deprecated.
since 3.3

Use flushMailQueue() instead.

public String rpcGetAdminToken ()

Retrieves a token for the admin user

Returns
  • Token for the admin user

public long rpcGetBlogPostId (String token, String spaceKey, int dayOfMonth, String postTitle)

Retrieves the ID of a blog post with the given details

Parameters
token the authentication token
spaceKey the key of the Space the blog post is located int
dayOfMonth the day of the month the blog post was made
postTitle the title of the blog post
Returns
  • ID of the post

public Vector rpcGetChildren (String token, long pageId)

Returns the ordered id list of pages that are direct children of a given page.

Parameters
token the authentication token
pageId the page to find children for
Returns
  • List of page id Longs

public Vector rpcGetComments (String token, String pageId)

public String rpcGetLocalisedText (String messageKey)

Returns the localised message text for the given key, retrieved from the application via RPC. The message will be localised to the administrator's locale.

If the key is not found, the key itself will be returned, as per getText(String).
Parameters
messageKey the message key to internationalise.
Returns
  • a localised message in the administrator's locale

public int rpcGetMailQueueSize ()

public long rpcGetPageId (String token, String spaceKey, String pageTitle)

Retrieves the page ID for a page with the given details

Parameters
token the authentication token
spaceKey the key of the Space the Page is located in
pageTitle the title of the page
Returns
  • The ID of the page

public List rpcGetPageLabels (String token, String spaceKey, String pageTitle)

Retrieves the labels assigned to a page with the given details

This method retrieves the page ID and passes it onto the appropriate rpcGetPageLabels method
Parameters
token the authentication token
spaceKey the key of the space the Page is located in
pageTitle the title of the Page
Returns
  • A list of label names as Strings

public List rpcGetPageLabels (String token, long pageId)

Retrieves the labels assigned to a Page with the given page ID

Parameters
token the authentication token
pageId the ID of the page
Returns
  • A list of label names as Strings

public String rpcGetTestUser2Token ()

Retrieves a token for the test user 2

Returns
  • Token for the test user

public String rpcGetTestUserToken ()

Retrieves a token for the test user

Returns
  • Token for the test user

public Vector rpcGetTopLevelPages (String token, String spaceKey)

Returns the ordered id list of top-level pages in a given space.

Parameters
token the authentication token
spaceKey the key of the space to find top-level pages for
Returns
  • List of page id Longs

public Vector rpcGetUserGroups (String token, String username)

public String rpcGetUserToken (User user)

public String rpcGetUserToken (String username, String password)

Retrieves the user token for the given details, for use with the XML-RPC interface

Parameters
username the username
password the password
Returns
  • Token for the logged in user

public int rpcGetVersionForPage (String token, long pageId)

public void rpcGrantAnonymousSpacePermission (String token, String permission, String spaceKey)

Grants the given permission to the anonymous user for the given space

Parameters
token the token identifying the current user
permission the permission to give the anonymous user
spaceKey the space to grant the permission on

public void rpcGrantGlobalPermission (String token, String permission, String entityName)

Grants the given global permission to a user.

Parameters
token the authentication token
permission the String corresponding to the permission
entityName the username or group name to grant the permission to

public void rpcGrantSpacePermission (String token, String permission, String username, String spaceKey)

Grants the given permission to a user for a particular Space

Parameters
token the authentication token
permission the String corresponding to the permission
username the user to grant the permission to
spaceKey the key of the Space to grant the permission in

public void rpcGrantViewSpacePermission (String token, String entityName, String spaceKey)

Convenience method for granting VIEWSPACE permission to a particular user

Parameters
token the authentication token
entityName the username or group name
spaceKey the key of the Space to grant the permission in

public boolean rpcHasGroup (String token, String groupName)

public boolean rpcHasUser (String token, String username)

public void rpcLogOut (String token)

public void rpcLogOutAdmin ()

public void rpcMovePageToTopLevel (String token, long pageId, String targetSpaceKey)

Moves a page to the top of a given space.

Parameters
token the authentication token
pageId the id of the page being moved
targetSpaceKey the space to move the page to

public void rpcPauseJob (String jobName)

public void rpcRemoveAnonymousSpacePermission (String token, String permission, String spaceKey)

Removes the given permission for the anonymous user from the given space

Parameters
token the token identifying the current user
permission the permission to remove
spaceKey the space to remove the permission on

public void rpcRemoveAttachment (String token, String attachmentFileName, long contentId)

Remove an attachment from a page or blog.

Parameters
attachmentFileName The name of the attachment
contentId the id of the page or blogpost to which the file is currently attached

public void rpcRemoveGlobalPermissions (String token, String permission, String username)

Removes the given global permission for a user

Parameters
token the authentication token
permission the String corresponding to the permission
username the user to remove the permission from

public void rpcRemoveGroup (String groupname)

Removes the given group

Parameters
groupname the group to be removed

public void rpcRemoveLabelFromPage (String token, String label, long pageId)

Removes the given label from the page with the given page ID

Parameters
token the authentication token
label the label name to be removed
pageId the page ID of the page with the label

public void rpcRemoveLabelFromPage (String token, String label, String spaceKey, String pageTitle)

public void rpcRemoveLabelFromSpace (String token, String label, String spaceKey)

Removes a label from a space

Parameters
token the token identifying the user
label the label name (namespaces allowed)
spaceKey the space key

public void rpcRemovePage (String token, String spaceKey, long pageId)

This method is deprecated.
use removePage(long) instead.

public void rpcRemoveSpace (String token, String spaceKey)

This method is deprecated.
use removeSpace(String) instead.

Remove a space with the given key via the XML-RPC interface

Parameters
token the authentication token
spaceKey the space to remove

public void rpcRemoveSpacePermission (String token, String permission, String username, String spaceKey)

Removes the given permission for a user for a particular Space

Parameters
token the authentication token
permission the String corresponding to the permission
username the user to remove the permission from
spaceKey the key of the Space to grant the permission in

public void rpcRenderContent (String token, String spaceKey, long pageId, String newContent)

Throws
IOException
XmlRpcException

public void rpcRestoreAbstractPage (long id)

public void rpcResumeJob (String jobName)

public Hashtable rpcStoreBlogEntry (String token, long pageId, String comment)

public void rpcTrashPage (String token, long pageId)

Trashes (removes) a page with the given ID

This method converts the long into a String and calls the appropriate rpcTrashPage method
Parameters
token the authentication token
pageId ID of the page to be trashed

public void rpcTrashPage (String token, String spaceKey, String pageTitle)

Trashes (removes) a page with the given details

This method retrieves the page with the given details and calls the appropriate rpcTrashPage method
Parameters
token the authentication token
spaceKey key of the Space the page is in
pageTitle title of the page to be trashed

public void rpcTrashPage (String token, String pageId)

Trashes (removes) a page with the given ID

Parameters
token the authentication token
pageId ID of the page to be trashed

public void rpcTriggerJob (String jobName)

public void search (String query)

public void setApplicationConfigProperty (String propertyKey, String propertyValue)

public void setAttachmentMaxUploadSize (long max)

public JSONObject setBlogLabels (String spaceKey, String blogTitle, String labels)

Add the specified labels to the blog

Parameters
spaceKey the space key
blogTitle the blog title
labels the labels
Returns
  • a JSONObject with the server response
Throws
JSONException

public void setEditPermissionsForGroups (String spaceKey, String pageTitle, String groups)

This method is deprecated.
Use grantContentPermission(com.atlassian.confluence.it.content.security.ContentPermission, ContentEntity)

Edit the permissions of the specified page as the current user.

One doesn't need to navigate to the page before calling this method.

Parameters
spaceKey the space the page belongs to
pageTitle the title of the page
groups the groups to restrict edit permissions to as a comma separated list of group names.

public void setEditPermissionsForUsers (String spaceKey, String pageTitle, String users)

This method is deprecated.
Use grantContentPermission(com.atlassian.confluence.it.content.security.ContentPermission, ContentEntity)

Edit the permissions of the specified page as the current user.

One doesn't need to navigate to the page before calling this method.

Parameters
spaceKey the space the page belongs to
pageTitle the title of the page
users the users to restrict edit permissions to as a comma separated list of usernames.

public void setMaxAttachmentsInUI (long max)

public JSONObject setPageLabels (String spaceKey, String pageTitle, String labels)

Add the specified labels to the page

Parameters
spaceKey the space key
pageTitle the page title
labels the labels
Returns
  • a JSONObject with the server response
Throws
JSONException

public void setSharedMode (boolean enable)

public void setThreadedComments (boolean enable)

public void setViewPermissionsForGroups (String spaceKey, String pageTitle, String groups)

This method is deprecated.
Use grantContentPermission(com.atlassian.confluence.it.content.security.ContentPermission, ContentEntity)

Edit the permissions of the specified page as the current user.

One doesn't need to navigate to the page before calling this method.

Parameters
spaceKey the space the page belongs to
pageTitle the title of the page
groups the groups to restrict view permissions to as a comma separated list of group names.

public void setViewPermissionsForUsers (String spaceKey, String pageTitle, String users)

This method is deprecated.
Use grantContentPermission(com.atlassian.confluence.it.content.security.ContentPermission, ContentEntity)

Edit the permissions of the specified page as the current user.

One doesn't need to navigate to the page before calling this method.

Parameters
spaceKey the space the page belongs to
pageTitle the title of the page
users the users to restrict view permissions to as a comma separated list of usernames.

public void showAllUsers ()

public void shutdownQuartz ()

public void stopTestMailServer ()

public void viewBlog (String spaceKey, String datePath, String title)

public void viewEditBlogPostPage (long entryId)

Views the edit blog post page for the post with the given ID

Parameters
entryId the ID of the blog post

public void viewGlobalAdmin ()

public GlobalPermissions viewGlobalPermissions ()

public void viewHomepage ()

public void viewLabel (String spaceKey, String labelName)

public void viewLanguages ()

public ViewContentBean viewPage (String spaceKey, String pageTitle)

public void viewPeopleDirectory ()

public SpaceAdmin viewSpaceAdmin ()

public void viewSpaceAdvanced ()

public void viewSpaceContent ()

public SpacePermissions viewSpacePermissions (Space space)

public void viewSpacePermissions (String spaceKey)

This method is deprecated.
since 3.5 use viewSpacePermissions(com.atlassian.confluence.it.Space) instead

public void viewSpaceSummary ()

public void viewSpaceSummary (String spaceKey)

public ViewContentBean viewTodaysBlog (String spaceKey, String title)

public void viewTrash ()

public void viewUser (String name)

public ViewContentBean watchPage (String spaceKey, String pageTitle)

public void watchSpace (Space space)

public void watchSpace (String spaceKey)

public Object xmlRpcExecute (String method, Vector params)

This method is deprecated.
call ConfluenceRpc#execute(String, Object...) or ConfluenceRpc#executeFuncTest(String, Object...) instead.

Wrapper for calling the xml rpc methods and handles the exceptions properly.

Parameters
method the method Name
params the method parameters
Returns
  • the result of the remote method call

Protected Methods

protected void assertMailReceived ()

protected void assertNoMailReceived ()

protected void createTestMailServer ()

Starts up and configures a new mail server which will be pulled back down during tearDown().

Throws
Exception

protected String generateBaseUrl ()

Returns
  • a random base URL selected from the nodes in the cluster. Used for switching between nodes for cluster testing.

protected long getCurrentPageId ()

protected PluginHelper getPluginHelper ()

protected void importGlobalBackup (File backupFile, boolean waitForSuccess)

This method is deprecated.
since 4.1 use an Importer instead.

Import a global backup from a file. This differs from the method that takes a string as the file may not be in the classpath. For example it could be a tempfile we created in a previous backup during the same test. This method also overwrites any directory configuration contained in the backup.

Parameters
backupFile the backup file to import.
waitForSuccess synchronously wait for the export to complete

protected void importSpaceBackup (String importZipLocation, boolean waitForSuccess)

This method is deprecated.
since 4.1 use an Importer instead.

Import an xml exported space from the classpath into Confluence via the web ui. Logs in as admin first.

If waiting for success, the method relies on being the only import process running at the time, since it waits for an ImportFinishedEvent.

Parameters
importZipLocation zip file location relative to classpath
waitForSuccess synchronously wait for the export to complete

protected void loginViaForm (String username, String password, boolean rememberMe)

protected void rebuildIndex ()

protected void rpcFlushAllCaches (String token)

This method is deprecated.
use flushAllCaches() instead.

Flush all the caches via rpc. Note that this clears all the cached rpc tokens.

Parameters
token of the user who is flushing the caches.
Throws
IOException e
XmlRpcException e

protected void rpcMovePage (String token, long sourcePageId, long targetPageId, String position)

Moves a page to a location relative to another page.

Parameters
token the authentication token
sourcePageId the id of the page being moved
targetPageId the id of the page the source page is moved in relation to
position the relative position to move to, see MovePageCommand
Throws
XmlRpcException

protected void rpcRemoveAllSpaceGroups (String token)

Throws
IOException
XmlRpcException

protected void rpcRemoveComment (String token, long commentId)

Remove a comment, identified by its id.

Parameters
token authentication token of user
commentId the id of the comment to remove
Throws
AssertionFailedError if the comment cannot be found or removed.
IOException
XmlRpcException

protected void rpcRemoveComment (String token, String commentContent, String spaceKey, String pageTitle)

Remove a comment, identified by its location and content, from a page.

Parameters
token authentication token of user
commentContent content of the comment to remove. This is used to identify the comment
spaceKey identifies the space containing the comment
pageTitle identifies the page
Throws
AssertionFailedError if the comment cannot be found or removed.
IOException
XmlRpcException

protected void rpclogCommandOutput (String commandString)

Throws
InterruptedException
XmlRpcException

protected void setCheckbox (boolean check, String checkBox)

protected void setUp ()

Throws
Exception

protected void setUp (String beginAt)

Default setUp method. Establishes XML-RPC connection and sets the base URL. Also configures LDAP repository.

Parameters
beginAt the initial path (relative to the context path) to begin at
Throws
Exception from super

protected void setUpTestNG (Method method)

Called by TestNG, calls setUp() on the current class, prevents the need to put this annotation everywhere, and sets the test name properly.

Throws
Exception

protected void tearDown ()

Default tearDown method. Removes any files which were added to the filesToDelete list.

Throws
Exception

protected void tearDownTestNG (Method method)

Called by TestNG, calls tearDown() on the current class, prevents the need to put this annotation everywhere, and sets the test name properly.

Throws
Exception

protected String withParagraph (String value)