|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object junit.framework.Assert junit.framework.TestCase com.atlassian.confluence.ThreadLocalWebTestCase com.atlassian.confluence.AbstractAtlassianWebTestCase com.atlassian.confluence.AbstractConfluenceAcceptanceTest
public abstract class AbstractConfluenceAcceptanceTest
This super class provides Confluence specific functions useful in acceptance tests.
Constructor Summary | |
---|---|
AbstractConfluenceAcceptanceTest()
|
|
AbstractConfluenceAcceptanceTest(String testName)
|
Method Summary | |
---|---|
void |
addUserToGroupViaHelper(String username,
String groupname)
Adds the given user to a groupname |
ViewContentBean |
addWatchPage()
|
void |
assertImagePresent(String imageName)
Provide our own implementation of ThreadLocalWebTestCase.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)
|
protected void |
assertMailReceived()
|
protected void |
assertNoMailReceived()
|
void |
attachFile(File attachment)
Click the attach file link, attach a given file with a given comment and submit the attachment form. |
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 |
attachFileWithName(String fileName,
InputStream in,
String comment)
Click the attach file link, attach a given file with a given comment and submit the attachment form. |
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)
|
protected void |
createTestMailServer()
Starts up and configures a new mail server which will be pulled back down during tearDown() . |
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(User user)
Creates a new user with the given details. |
void |
disableAnonymousAccess()
|
EditContentBean |
editPage(String spaceKey,
String pageTitle)
|
void |
editPageContent(String content)
Sets content via RPC, as the admin user. |
void |
editPageWithContent(String spaceKey,
String title,
String content)
|
void |
editSpaceDescription(User user,
String spaceKey,
String newDescription)
|
void |
editSpacePermsForm()
|
void |
enableAnonymousAccess()
|
void |
ensureTestUserCanViewTestSpace()
Deprecated. since 3.5 permissions should be granted using SpacePermissions.grantPermission(com.atlassian.confluence.it.SpacePermission, User)
(which already ensures that users can view a space before other permissions are granted) |
void |
forceViewGlobalAdmin()
|
protected String |
generateBaseUrl()
|
File |
generateFile(String filename,
String contents)
|
String |
getAppContext()
|
String |
getBaseUrl()
|
String |
getConfiguredBaseUrl()
Returns the configured base URL in the Confluence app. |
int |
getCurrentMailQueueSize()
|
protected long |
getCurrentPageId()
|
String |
getFriendlyRelativeDate(Date now,
Date date,
TimeZone timeZone)
Use the FriendlyDateFormatter to format the date relative to the "now" time. |
protected String |
getLoginButtonId()
HACK - temp method to get tests checking for login screen working. |
long |
getPageId(String spaceKey,
String title)
|
protected PluginHelper |
getPluginHelper()
|
void |
gotoPageWithError(String url)
|
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 using redirect. |
void |
logInAs(String username,
String password)
Log in as the specified user, going to START_LOCATION . |
void |
logInAs(String username,
String password,
boolean rememberMe)
Log in with the given details. |
void |
logInAs(User user)
Log in as the specified user, going to the default start page. |
void |
logInAsAdminAtHomepage()
|
void |
logInAsAtHomepage(String username,
String password)
Logs in and then goes straight to "/" |
void |
logInAsAtHomepage(User user)
Logs in fast and then goes straight to "/" |
void |
loginAsTestUser()
|
void |
loginAsTestUser2()
|
void |
loginAsTestUserAtHomepage()
|
protected void |
loginViaForm(String username,
String password,
boolean rememberMe)
|
void |
logout()
Log out by going straight to the regular logout.action and then starting a new conversation at the start location, usually noop.jsp. |
void |
movePage(String title,
Space oldSpace,
Space newSpace)
|
void |
movePage(String spaceKey,
String title,
String newSpaceKey)
|
void |
movePageToNewParent(String spaceKey,
String title,
String newParentPage)
|
void |
movePageToNewParent(String oldSpaceKey,
String title,
String newSpaceKey,
String newParentPage)
|
void |
movePageToNewSpace(String spaceKey,
String title,
String newSpaceKey)
|
protected void |
rebuildIndex()
|
void |
removeGroup(String groupName)
Delete a group via the Web Interface. |
void |
removePageLabel(String spaceKey,
String pageTitle)
|
void |
removePageOrBlogById(long id)
|
void |
removeTestUser1ViaHelper()
Removes the test user |
void |
removeUserViaHelper(String username)
Removes a user with the given username |
void |
renamePage(String spaceKey,
String originalPageTitle,
String newPageTitle)
|
void |
search(String query)
|
void |
setAttachmentMaxUploadSize(long max)
|
JSONObject |
setBlogLabels(Space space,
String blogTitle,
String labels)
Add the specified labels to the blog |
void |
setEditPermissionsForGroups(String spaceKey,
String pageTitle,
String groups)
Deprecated. Use ConfluenceRpc.grantContentPermission(com.atlassian.confluence.it.content.security.ContentPermission, ContentEntity) |
void |
setEditPermissionsForUsers(String spaceKey,
String pageTitle,
String users)
Deprecated. Use ConfluenceRpc.grantContentPermission(com.atlassian.confluence.it.content.security.ContentPermission, ContentEntity) |
void |
setMaxAttachmentsInUI(long max)
|
JSONObject |
setPageLabels(String spaceKey,
String pageTitle,
String labels)
Add the specified labels to the page |
void |
setThreadedComments(boolean enable)
|
protected void |
setUp()
|
protected void |
setUp(String beginAt)
Default setUp method. |
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. |
void |
setViewPermissionsForGroups(String spaceKey,
String pageTitle,
String groups)
Deprecated. Use ConfluenceRpc.grantContentPermission(com.atlassian.confluence.it.content.security.ContentPermission, ContentEntity) |
void |
setViewPermissionsForUsers(String spaceKey,
String pageTitle,
String users)
Deprecated. Use ConfluenceRpc.grantContentPermission(com.atlassian.confluence.it.content.security.ContentPermission, ContentEntity) |
void |
stopTestMailServer()
|
protected void |
tearDown()
Default tearDown method. |
protected void |
tearDownTestNG()
Called by TestNG, calls tearDown() on the current class, prevents the need to put this annotation everywhere, and sets the test name properly. |
GlobalPermissions |
viewGlobalPermissions()
|
void |
viewHomepage()
|
void |
viewLabel(String spaceKey,
String labelName)
|
void |
viewLanguages()
|
ViewContentBean |
viewPage(long pageId)
|
ViewContentBean |
viewPage(String spaceKey,
String pageTitle)
|
void |
viewPeopleDirectory()
|
SpaceAdmin |
viewSpaceAdmin()
|
void |
viewSpaceAdvanced()
|
void |
viewSpaceContent()
|
SpacePermissions |
viewSpacePermissions(Space space)
|
void |
viewSpaceSummary()
|
void |
viewSpaceSummary(String spaceKey)
|
void |
viewTrash()
|
ViewContentBean |
watchPage(String spaceKey,
String pageTitle)
|
void |
watchSpace(Space space)
|
void |
watchSpace(String spaceKey)
|
Methods inherited from class junit.framework.TestCase |
---|
countTestCases, createResult, getName, run, run, runTest, setName, toString |
Methods inherited from class junit.framework.Assert |
---|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final transient org.slf4j.Logger log
public static final String context
protected TestData testData
protected static DirectoryConfiguration DIRECTORY_CONFIG
protected static final boolean CROWD_MODE
public static final User TEST_ADMIN
public static final String TEST_ADMIN_USERNAME
public static final String TEST_ADMIN_PASSWORD
public static final String TEST_ADMIN_FULLNAME
public static final String TEST_ADMIN_EMAIL
public static final User TEST_USER1
public static final String TEST_GEN_USERNAME1
public static final String TEST_GEN_PASSWORD1
public static final String TEST_GEN_FULLNAME1
public static final String TEST_GEN_EMAIL1
public static final User TEST_USER2
public static final String TEST_GEN_USERNAME2
public static final String TEST_GEN_PASSWORD2
public static final String TEST_GEN_FULLNAME2
public static final String TEST_GEN_EMAIL2
public static final String ANONYMOUS_USER
protected static final String TEST_GROUP1
public Space TEST_SPACE
public Space TEST_SPACE2
public static String TESTSPACE_TITLE
public static String TESTSPACE_KEY
public static String TESTSPACE2_TITLE
public static String TESTSPACE2_KEY
public static final String TESTPAGE_TITLE
public static final String TESTPAGE_CONTENT
public static final String TESTPAGE_COMMENT
public static final String TESTBLOG_TITLE
public static final String TESTBLOG_CONTENT
public Page TEST_PAGE
public BlogPost TEST_BLOG
public Comment TEST_COMMENT
public static final String TESTMAILSERVER_NAME
public static final String TESTMAILSERVER_HOSTNAME
public static final RandomnessHandler RANDOM
protected static final String BROWSE_MENU_LINK_ID
protected static final String SMTP_SUBJECT_PREFIX
protected ConfluenceRpc wikiMarkupRpc
protected ConfluenceRpc rpc
protected ServerStateManager serverStateManager
protected List<File> filesToDelete
protected UserManagementHelper userHelper
protected LoginHelper loginHelper
protected MailServices mailServices
protected AdminConsole adminConsole
protected static final String VIEW_PERSONAL_SPACE_LINK
protected LogAdjuster logAdjuster
LogAdjuster.resetLogLevels()
is called in tearDown()
.
public static final String DASHBOARD_RECENT_UPDATES_URL
Constructor Detail |
---|
public AbstractConfluenceAcceptanceTest(String testName)
public AbstractConfluenceAcceptanceTest()
Method Detail |
---|
protected void setUp() throws Exception
setUp
in class junit.framework.TestCase
Exception
protected void setUpTestNG(Method method) throws Exception
method
- The test method being called
Exception
- if setup failsprotected void setUp(String beginAt) throws Exception
beginAt
- the initial path (relative to the context path) to begin at
Exception
- from superprotected PluginHelper getPluginHelper()
protected void tearDownTestNG() throws Exception
Exception
- if tear down failsprotected void tearDown() throws Exception
filesToDelete
list.
tearDown
in class ThreadLocalWebTestCase
Exception
protected String generateBaseUrl()
public String getConfiguredBaseUrl()
public void logInAs(String username, String password)
START_LOCATION
.
public void logInAs(User user)
user
- the user to log in as.public void logInAsAtHomepage(String username, String password)
public void logInAsAtHomepage(User user)
public void logIn(User user, String destination)
LoginHelper.login(com.atlassian.confluence.it.User)
, followed by an explicit visit to the destination.
user
- the user to log in as.destination
- where to go after logging in. Pass 'null' to go to the default homepage.public void logInAs(String username, String password, boolean rememberMe)
LoginHelper.logInFast(com.atlassian.confluence.it.User)
.
protected void loginViaForm(String username, String password, boolean rememberMe)
protected String getLoginButtonId()
public void logInAsAdminAtHomepage()
public void loginAsTestUser()
public void loginAsTestUserAtHomepage()
public void loginAsTestUser2()
public void logout()
LoginHelper.logOutSlowly()
instead if you're testing what
logging out actually does, and LoginHelper.logout()
if you just want to clean up the session as fast as
possible.
LoginHelper.logout()
,
LoginHelper.logOutSlowly()
public void assertLinkPresentWithExactTextAndClass(String linkText, String cls)
public void createSpaceViaWebUI(Space space)
public void createTestSpaceViaWebUI()
public ViewContentBean createPage(String spaceKey, String title, String content, String parentPageTitle)
public ViewContentBean createPageWithViewRestrictions(String spaceKey, String title, String content, String parentPageTitle, @Nullable String viewPermissionUsers)
public long getPageId(String spaceKey, String title)
protected long getCurrentPageId()
public ViewContentBean viewPage(String spaceKey, String pageTitle)
public ViewContentBean viewPage(long pageId)
public void viewLabel(String spaceKey, String labelName)
public EditContentBean editPage(String spaceKey, String pageTitle)
public void movePageToNewSpace(String spaceKey, String title, String newSpaceKey)
public void movePage(String spaceKey, String title, String newSpaceKey)
public void movePage(String title, Space oldSpace, Space newSpace)
public void movePageToNewParent(String spaceKey, String title, String newParentPage)
public void movePageToNewParent(String oldSpaceKey, String title, String newSpaceKey, String newParentPage)
public void createUserViaHelper(User user)
ldapMode
test property the
user is created in an ldap repository or via the XML-RPC interface.
user
- the user to createpublic void removeUserViaHelper(String username)
username
- the username of the user to removepublic void removeTestUser1ViaHelper()
public void createGroupViaHelper(String groupName)
groupName
- the name of the group to be createdpublic void createGroup(String group)
group
- name of grouppublic void addUserToGroupViaHelper(String username, String groupname)
username
- the username of the user to be addedgroupname
- the group the user should be added topublic void removeGroup(String groupName)
groupName
- name of group to removepublic void viewPeopleDirectory()
public GlobalPermissions viewGlobalPermissions()
public void viewLanguages()
public SpaceAdmin viewSpaceAdmin()
public void viewSpaceSummary()
public void viewSpaceSummary(String spaceKey)
public SpacePermissions viewSpacePermissions(Space space)
public void viewHomepage()
public void viewSpaceContent()
public void viewTrash()
public void setThreadedComments(boolean enable)
@Deprecated public void ensureTestUserCanViewTestSpace()
SpacePermissions.grantPermission(com.atlassian.confluence.it.SpacePermission, User)
(which already ensures that users can view a space before other permissions are granted)
public void editSpacePermsForm()
public void enableAnonymousAccess()
public void disableAnonymousAccess()
public void attachFile(File attachment)
attachment
- the file attachmentpublic void attachFile(File attachment, @Nullable String comment)
attachment
- the file attachmentcomment
- the comment for the attachmentpublic void attachFileWithName(String fileName, InputStream in, String comment)
fileName
- the filename to attachin
- the stream to read the filecomment
- a comment for this attachmentpublic void createMail(File mail, String spaceKey)
public void setAttachmentMaxUploadSize(long max)
public void setMaxAttachmentsInUI(long max)
public void search(String query)
public String getAppContext()
public void importMailAndAssertNoRunningTask(String filePath, String spaceKey)
filePath
- the file path to the mailboxspaceKey
- the space key to import intopublic void importMail(String filePath, String spaceKey)
filePath
- the file path to the mailboxspaceKey
- the space key to import intopublic void renamePage(String spaceKey, String originalPageTitle, String newPageTitle)
public void viewSpaceAdvanced()
public ViewContentBean addWatchPage() throws Exception
Exception
public ViewContentBean watchPage(String spaceKey, String pageTitle)
public void watchSpace(String spaceKey)
public void watchSpace(Space space)
public File generateFile(String filename, String contents)
public int getCurrentMailQueueSize()
@Deprecated public void setViewPermissionsForUsers(String spaceKey, String pageTitle, String users)
ConfluenceRpc.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.
spaceKey
- the space the page belongs topageTitle
- the title of the pageusers
- the users to restrict view permissions to as a comma separated list of usernames.@Deprecated public void setViewPermissionsForGroups(String spaceKey, String pageTitle, String groups)
ConfluenceRpc.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.
spaceKey
- the space the page belongs topageTitle
- the title of the pagegroups
- the groups to restrict view permissions to as a comma separated list of group names.@Deprecated public void setEditPermissionsForUsers(String spaceKey, String pageTitle, String users)
ConfluenceRpc.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.
spaceKey
- the space the page belongs topageTitle
- the title of the pageusers
- the users to restrict edit permissions to as a comma separated list of usernames.@Deprecated public void setEditPermissionsForGroups(String spaceKey, String pageTitle, String groups)
ConfluenceRpc.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.
spaceKey
- the space the page belongs topageTitle
- the title of the pagegroups
- the groups to restrict edit permissions to as a comma separated list of group names.public void removePageOrBlogById(long id)
public String getBaseUrl()
getConfiguredBaseUrl()
method.public JSONObject setPageLabels(String spaceKey, String pageTitle, String labels) throws JSONException
spaceKey
- the space keypageTitle
- the page titlelabels
- the labels
JSONException
- .public JSONObject setBlogLabels(Space space, String blogTitle, String labels) throws JSONException
space
- the spaceblogTitle
- the blog titlelabels
- the labels
JSONException
- .public void removePageLabel(String spaceKey, String pageTitle)
public void editPageContent(String content)
content
- new page contentpublic void editPageWithContent(String spaceKey, String title, String content)
public void gotoPageWithError(String url)
public void assertImageValid(String imgSrc, String imgAlt)
createUrl(String, URL)
assertImageValid
in class ThreadLocalWebTestCase
ThreadLocalWebTestCase.assertImageValidAndStore(String, String, java.io.File)
public void assertImagePresent(String imageName)
ThreadLocalWebTestCase.assertImagePresent(String, String)
that asserts the image name with
a contains check rather than equals.
imageName
- The path to the image (i.e. the src attribute value)public boolean isClustered()
public String getFriendlyRelativeDate(Date now, Date date, TimeZone timeZone)
FriendlyDateFormatter
to format the date relative to the "now" time.
Note that the output format varies greatly even from second to second -- see FriendlyDateFormatter
.
now
- the date which the relative time is calculated in relation todate
- the date of some event which is to be formattedtimeZone
- the current time zone
FriendlyDateFormatter
public void forceViewGlobalAdmin()
protected void createTestMailServer() throws BindException
tearDown()
.
BindException
- If a free port could not be foundpublic void stopTestMailServer()
protected void assertNoMailReceived() throws InterruptedException
InterruptedException
protected void assertMailReceived() throws InterruptedException
InterruptedException
protected void rebuildIndex() throws InterruptedException
InterruptedException
public void editSpaceDescription(User user, String spaceKey, String newDescription)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |