com.atlassian.crowd.acceptance.tests.rest.service.client
Class RestCrowdClientTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by net.sourceforge.jwebunit.junit.WebTestCase
              extended by com.atlassian.crowd.acceptance.utils.CrowdWebTestCase
                  extended by com.atlassian.crowd.acceptance.tests.applications.crowd.CrowdAcceptanceTestCase
                      extended by com.atlassian.crowd.acceptance.tests.rest.service.client.RestCrowdClientTest
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
ConfigurationFromFileCrowdAcceptanceTestHarness.RestCrowdClientTestNoRestore

public class RestCrowdClientTest
extends CrowdAcceptanceTestCase

Tests the RestCrowdClient.


Field Summary
 
Fields inherited from class com.atlassian.crowd.acceptance.tests.applications.crowd.CrowdAcceptanceTestCase
ADMIN_EMAIL, ADMIN_FULL_NAME, ADMIN_GROUP, ADMIN_PW, ADMIN_USER, DEVELOPER_LICENSE_KEY, EXPIRED_MAINTENANCE_KEY, HOST_PATH, logger, specProperties, UNLIMITED_LICENSE_KEY, URL_HOME, WORKGROUP_LICENSE_KEY
 
Fields inherited from class net.sourceforge.jwebunit.junit.WebTestCase
customTester, tester
 
Constructor Summary
RestCrowdClientTest()
           
 
Method Summary
 void setUp()
           
 void testAddGroupToGroup()
           
 void testAddGroupToGroupWhenMembershipAlreadyExists()
           
 void testAddUser()
           
 void testAddUserToGroup()
           
 void testAddUserToGroupWhenMembershipAlreadyExists()
           
 void testConnectToInvalidRestService()
          Tests that RestCrowdClient throws an OperationFailedException if the RestCrowdClient is not communicating with a valid Crowd REST service.
 void testConnectToRestService_WrongPassword()
          Tests that RestCrowdClient throws an InvalidAuthenticationException if the application password is invalid.
 void testFindUserFromInvalidSSOToken()
           
 void testFindUserFromNonExistentSSOToken()
           
 void testFindUserFromValidSSOToken()
           
 void testGetGroupNameMembershipsForGroup_InvalidStartIndex()
          Tests that CrowdClient.getNamesOfParentGroupsForGroup(String, int, int) with an invalid start index will throw an OperationFailedException.
 void testGetGroupNameMembershipsForGroup_NonExistentGroup()
          Tests that CrowdClient.getNamesOfParentGroupsForGroup(String, int, int) for a non-existent group returns an empty list.
 void testGetGroupNameMembershipsForGroup()
          Tests that CrowdClient.getNamesOfParentGroupsForGroup(String, int, int) retrieves the correct parent group names.
 void testGetMemberships()
          Tests that RestCrowdClient.getMemberships() returns successfully.
 void testGetNestedGroupMembershipsForGroup_NonExistent()
          Tests that CrowdClient.getParentGroupsForNestedGroup(String, int, int) returns an empty list for a non-existent group.
 void testGetNestedGroupMembershipsForGroup()
          Tests that CrowdClient.getParentGroupsForNestedGroup(String, int, int) returns the correct nested group memberships for a group.
 void testGetNestedGroupMembershipsForUser_NonExistent()
          Tests that CrowdClient.getGroupsForNestedUser(String, int, int) returns an empty list for a non-existent username.
 void testGetNestedGroupMembershipsForUser()
          Tests that CrowdClient.getGroupsForNestedUser(String, int, int) returns the correct nested group memberships for a user.
 void testGetNestedGroupMembersOfGroup_NonExistentGroup()
          Tests that CrowdClient.getNestedChildGroupsOfGroup(String, int, int) returns an empty list for a non-existent group.
 void testGetNestedGroupMembersOfGroup()
          Tests that CrowdClient.getNestedChildGroupsOfGroup(String, int, int) returns the nested group members of group.
 void testGetNestedGroupNameMembershipsForGroup_NonExistent()
          Tests that CrowdClient.getNamesOfParentGroupsForNestedGroup(String, int, int) returns an empty list for a non-existent group.
 void testGetNestedGroupNameMembershipsForGroup()
          Tests that CrowdClient.getNamesOfParentGroupsForNestedGroup(String, int, int) returns the correct nested group name memberships of a group.
 void testGetNestedGroupNameMembershipsForUser_NonExistent()
          Tests that CrowdClient.getNamesOfGroupsForNestedUser(String, int, int) returns an empty list for a non-existent username.
 void testGetNestedGroupNameMembershipsForUser()
          Tests that CrowdClient.getNamesOfGroupsForNestedUser(String, int, int) returns the correct group names for a nested user member
 void testGetNestedGroupNameMembersOfGroup_NonExistent()
          Tests that CrowdClient.getNamesOfNestedChildGroupsOfGroup(String, int, int) returns an empty list for a non-existent group.
 void testGetNestedGroupNameMembersOfGroup()
          Tests that CrowdClient.getNamesOfNestedChildGroupsOfGroup(String, int, int) returns the group names of nested group members.
 void testGetNestedUserNameMembersOfGroup_NonExistentGroup()
          Tests that CrowdClient.getNamesOfNestedUsersOfGroup(String, int, int) returns an empty list for a non-existent group.
 void testGetNestedUserNameMembersOfGroup()
          Tests that CrowdClient.getNamesOfNestedUsersOfGroup(String, int, int) returns the correct user names of nested members of a group.
 void testGetNonExistingWebhook()
           
 void testGetUser()
           
 void testInvalidateAllOtherSSOTokensForUser()
           
 void testInvalidateAllSSOTokensForUser()
           
 void testMailUsernamesFailsWithUnknownAddress()
           
 void testQueryForNullFirstNames()
           
 void testSSOUserWithDefaultTokenDuration()
           
 void testSSOUserWithZeroLivedToken()
           
 void testUnregisterNonExistingWebhook()
           
 void testUpdateGroupWithAttributes()
           
 void testUpdateUserCredential()
           
 void testUpdateUserCredentialPasswordDoesNotMatchDirectoryComplexityRequirement()
           
 
Methods inherited from class com.atlassian.crowd.acceptance.tests.applications.crowd.CrowdAcceptanceTestCase
_loginAdminUser, _loginAsUser, _logout, assertUnescapedKeyNotPresent, assertUnescapedKeyPresent, assertUserInTable, assertUserInTable, assertUserNotInTable, getBaseUrl, getCrowdApplicationPassword, getCrowdHome, getText, gotoAddApplication, gotoAddGroup, gotoAddPrincipal, gotoAdministrationPage, gotoBackup, gotoBrowseApplications, gotoBrowseDirectories, gotoBrowseGroups, gotoBrowseGroups, gotoBrowsePrincipals, gotoBrowsePrincipals, gotoCreateDirectory, gotoCurrentApplicationSessions, gotoCurrentPrincipalSessions, gotoGeneral, gotoImporters, gotoLdapConnectionPool, gotoLicensing, gotoLoggingProfiling, gotoMailServer, gotoMailTemplate, gotoRemovePrincipal, gotoRestore, gotoSAMLConfig, gotoSessionConfig, gotoSystemInfo, gotoTrustedProxies, gotoViewApplication, gotoViewGroup, gotoViewPrincipal, intendToModifyData, intendToModifyLdapData, log, restoreBaseSetup, restoreCrowdFromXML, submitLoginForm, submitLoginFormAsAdminUser, tearDown
 
Methods inherited from class com.atlassian.crowd.acceptance.utils.CrowdWebTestCase
addRequestHeader, assertErrorNotPresent, assertErrorPresent, assertErrorPresentWithKey, assertKeyInElement, assertKeyPresent, assertKeyPresent, assertKeyPresent, assertKeyPresentOnce, assertLinkPresentWithKey, assertServerResponseContains, assertServerResponseDoesNotContain, assertSuccessPresent, assertTextPresent, assertWarningAndErrorNotPresent, assertWarningNotPresent, assertWarningPresent, clickLinkWithKey, getElementTextById, getPageText, isTextPresent, scrapeTable, scrapeTable, setRadioButton, setTester, waitFor, waitForElementById, waitForElementByXPath, waitForText, waitForText
 
Methods inherited from class net.sourceforge.jwebunit.junit.WebTestCase
assertButtonNotPresent, assertButtonNotPresentWithText, assertButtonPresent, assertButtonPresentWithText, assertCheckboxNotPresent, assertCheckboxNotPresent, assertCheckboxNotSelected, assertCheckboxNotSelected, assertCheckboxPresent, assertCheckboxPresent, assertCheckboxSelected, assertCheckboxSelected, assertCommentNotPresent, assertCommentPresent, assertCookiePresent, assertCookieValueEquals, assertCookieValueMatch, assertDownloadedFileEquals, assertElementNotPresent, assertElementNotPresentByXPath, assertElementPresent, assertElementPresentByXPath, assertFormElementEmpty, assertFormElementEquals, assertFormElementMatch, assertFormElementNotPresent, assertFormElementPresent, assertFormNotPresent, assertFormNotPresent, assertFormPresent, assertFormPresent, assertFramePresent, assertHeaderEquals, assertHeaderMatches, assertHeaderNotPresent, assertHeaderPresent, assertHiddenFieldPresent, assertImagePresent, assertImagePresentPartial, assertImageValid, assertImageValidAndStore, assertKeyInTable, assertKeyInTable, assertKeyNotInTable, assertKeyNotPresent, assertKeyNotPresent, assertKeyPresent, assertKeysInTable, assertKeysInTable, assertLabeledFieldEquals, assertLabelMatches, assertLabelPresent, assertLinkNotPresent, assertLinkNotPresentWithExactText, assertLinkNotPresentWithExactText, assertLinkNotPresentWithImage, assertLinkNotPresentWithImage, assertLinkNotPresentWithText, assertLinkNotPresentWithText, assertLinkPresent, assertLinkPresentWithExactText, assertLinkPresentWithExactText, assertLinkPresentWithImage, assertLinkPresentWithImage, assertLinkPresentWithText, assertLinkPresentWithText, assertMatch, assertMatch, assertMatch, assertMatchInElement, assertMatchInTable, assertMatchInTable, assertNoMatch, assertNoMatchInElement, assertNoMatchInTable, assertNoMatchInTable, assertNotMatch, assertNotMatch, assertRadioOptionNotPresent, assertRadioOptionNotSelected, assertRadioOptionPresent, assertRadioOptionSelected, assertResetButtonNotPresent, assertResetButtonNotPresent, assertResetButtonPresent, assertResetButtonPresent, assertResponseCode, assertResponseCodeBetween, assertSelectedOptionEquals, assertSelectedOptionEquals, assertSelectedOptionMatches, assertSelectedOptionMatches, assertSelectedOptionsEqual, assertSelectedOptionsEqual, assertSelectedOptionsMatch, assertSelectedOptionsMatch, assertSelectedOptionValueEquals, assertSelectedOptionValueEquals, assertSelectedOptionValuesEqual, assertSelectedOptionValuesEqual, assertSelectOptionNotPresent, assertSelectOptionNotPresent, assertSelectOptionPresent, assertSelectOptionPresent, assertSelectOptionsEqual, assertSelectOptionsEqual, assertSelectOptionsNotEqual, assertSelectOptionsNotEqual, assertSelectOptionsPresent, assertSelectOptionsPresent, assertSelectOptionValueNotPresent, assertSelectOptionValueNotPresent, assertSelectOptionValuePresent, assertSelectOptionValuePresent, assertSelectOptionValuesEqual, assertSelectOptionValuesEqual, assertSelectOptionValuesNotEqual, assertSelectOptionValuesNotEqual, assertSelectOptionValuesPresent, assertSelectOptionValuesPresent, assertSubmitButtonNotPresent, assertSubmitButtonNotPresent, assertSubmitButtonPresent, assertSubmitButtonPresent, assertSubmitButtonPresent, assertTableEquals, assertTableEquals, assertTableMatch, assertTableMatch, assertTableNotPresent, assertTablePresent, assertTableRowCountEquals, assertTableRowsEqual, assertTableRowsEqual, assertTableRowsMatch, assertTableRowsMatch, assertTextFieldEquals, assertTextInElement, assertTextInTable, assertTextInTable, assertTextNotInElement, assertTextNotInTable, assertTextNotInTable, assertTextNotPresent, assertTextPresent, assertTitleEquals, assertTitleEqualsKey, assertTitleEqualsKey, assertTitleMatch, assertTitleNotEquals, assertTitleNotSame, assertWindowCountEquals, assertWindowPresent, assertWindowPresent, assertWindowPresentWithTitle, beginAt, checkCheckbox, checkCheckbox, clickButton, clickButtonWithText, clickElementByXPath, clickLink, clickLinkWithExactText, clickLinkWithExactText, clickLinkWithImage, clickLinkWithImage, clickLinkWithText, clickLinkWithText, clickRadioOption, closeBrowser, closeWindow, dumpCookies, dumpHtml, dumpHtml, dumpTable, dumpTable, getAllHeaders, getComments, getDialog, getElementAttributByXPath, getElementAttributeByXPath, getElementById, getElementByXPath, getElementsByXPath, getElementTextByXPath, getFieldsForLabel, getFormElementValue, getHeader, getImage, getLabeledFieldValue, getMessage, getMessage, getPageSource, getResponseHeaders, getServerResponse, getServeurResponse, getTable, getTestContext, getTester, getTestingEngine, getTestingEngineKey, gotoFrame, gotoPage, gotoRootWindow, gotoWindow, gotoWindow, gotoWindowByTitle, reset, runBare, saveAs, selectOption, selectOption, selectOptionByValue, selectOptionByValue, selectOptions, selectOptions, selectOptionsByValues, selectOptionsByValues, setBaseUrl, setBaseUrl, setDialog, setExpectedJavaScriptAlert, setExpectedJavaScriptAlert, setExpectedJavaScriptConfirm, setExpectedJavaScriptConfirm, setExpectedJavaScriptPrompt, setExpectedJavaScriptPrompt, setFormElement, setHiddenField, setIgnoreFailingStatusCodes, setLabeledFormElementField, setScriptingEnabled, setTestContext, setTestingEngineKey, setTextField, setTimeout, setWorkingForm, setWorkingForm, setWorkingForm, submit, submit, submit, uncheckCheckbox, uncheckCheckbox
 
Methods inherited from class junit.framework.TestCase
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, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runTest, setName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RestCrowdClientTest

public RestCrowdClientTest()
Method Detail

setUp

public void setUp()
           throws Exception
Overrides:
setUp in class CrowdAcceptanceTestCase
Throws:
Exception

testGetUser

public void testGetUser()
                 throws Exception
Throws:
Exception

testGetGroupNameMembershipsForGroup

public void testGetGroupNameMembershipsForGroup()
                                         throws Exception
Tests that CrowdClient.getNamesOfParentGroupsForGroup(String, int, int) retrieves the correct parent group names.

Throws:
Exception

testGetGroupNameMembershipsForGroup_InvalidStartIndex

public void testGetGroupNameMembershipsForGroup_InvalidStartIndex()
                                                           throws Exception
Tests that CrowdClient.getNamesOfParentGroupsForGroup(String, int, int) with an invalid start index will throw an OperationFailedException.

Throws:
Exception

testGetGroupNameMembershipsForGroup_NonExistentGroup

public void testGetGroupNameMembershipsForGroup_NonExistentGroup()
                                                          throws Exception
Tests that CrowdClient.getNamesOfParentGroupsForGroup(String, int, int) for a non-existent group returns an empty list.

Throws:
Exception

testGetNestedUserNameMembersOfGroup

public void testGetNestedUserNameMembersOfGroup()
                                         throws Exception
Tests that CrowdClient.getNamesOfNestedUsersOfGroup(String, int, int) returns the correct user names of nested members of a group.

Throws:
Exception

testGetNestedUserNameMembersOfGroup_NonExistentGroup

public void testGetNestedUserNameMembersOfGroup_NonExistentGroup()
                                                          throws Exception
Tests that CrowdClient.getNamesOfNestedUsersOfGroup(String, int, int) returns an empty list for a non-existent group.

Throws:
Exception

testGetNestedGroupMembersOfGroup

public void testGetNestedGroupMembersOfGroup()
                                      throws Exception
Tests that CrowdClient.getNestedChildGroupsOfGroup(String, int, int) returns the nested group members of group.

Throws:
Exception

testGetNestedGroupMembersOfGroup_NonExistentGroup

public void testGetNestedGroupMembersOfGroup_NonExistentGroup()
                                                       throws Exception
Tests that CrowdClient.getNestedChildGroupsOfGroup(String, int, int) returns an empty list for a non-existent group.

Throws:
Exception

testGetNestedGroupNameMembersOfGroup

public void testGetNestedGroupNameMembersOfGroup()
                                          throws Exception
Tests that CrowdClient.getNamesOfNestedChildGroupsOfGroup(String, int, int) returns the group names of nested group members.

Throws:
Exception

testGetNestedGroupNameMembersOfGroup_NonExistent

public void testGetNestedGroupNameMembersOfGroup_NonExistent()
                                                      throws Exception
Tests that CrowdClient.getNamesOfNestedChildGroupsOfGroup(String, int, int) returns an empty list for a non-existent group.

Throws:
Exception

testGetNestedGroupMembershipsForUser

public void testGetNestedGroupMembershipsForUser()
                                          throws Exception
Tests that CrowdClient.getGroupsForNestedUser(String, int, int) returns the correct nested group memberships for a user.

Throws:
Exception

testGetNestedGroupMembershipsForUser_NonExistent

public void testGetNestedGroupMembershipsForUser_NonExistent()
                                                      throws Exception
Tests that CrowdClient.getGroupsForNestedUser(String, int, int) returns an empty list for a non-existent username.

Throws:
Exception

testGetNestedGroupNameMembershipsForUser

public void testGetNestedGroupNameMembershipsForUser()
                                              throws Exception
Tests that CrowdClient.getNamesOfGroupsForNestedUser(String, int, int) returns the correct group names for a nested user member

Throws:
Exception

testGetNestedGroupNameMembershipsForUser_NonExistent

public void testGetNestedGroupNameMembershipsForUser_NonExistent()
                                                          throws Exception
Tests that CrowdClient.getNamesOfGroupsForNestedUser(String, int, int) returns an empty list for a non-existent username.

Throws:
Exception

testGetNestedGroupMembershipsForGroup

public void testGetNestedGroupMembershipsForGroup()
                                           throws Exception
Tests that CrowdClient.getParentGroupsForNestedGroup(String, int, int) returns the correct nested group memberships for a group.

Throws:
Exception

testGetNestedGroupMembershipsForGroup_NonExistent

public void testGetNestedGroupMembershipsForGroup_NonExistent()
                                                       throws Exception
Tests that CrowdClient.getParentGroupsForNestedGroup(String, int, int) returns an empty list for a non-existent group.

Throws:
Exception

testGetNestedGroupNameMembershipsForGroup

public void testGetNestedGroupNameMembershipsForGroup()
                                               throws Exception
Tests that CrowdClient.getNamesOfParentGroupsForNestedGroup(String, int, int) returns the correct nested group name memberships of a group.

Throws:
Exception

testGetNestedGroupNameMembershipsForGroup_NonExistent

public void testGetNestedGroupNameMembershipsForGroup_NonExistent()
                                                           throws Exception
Tests that CrowdClient.getNamesOfParentGroupsForNestedGroup(String, int, int) returns an empty list for a non-existent group.

Throws:
Exception

testAddUser

public void testAddUser()
                 throws Exception
Throws:
Exception

testUpdateUserCredential

public void testUpdateUserCredential()
                              throws Exception
Throws:
Exception

testUpdateUserCredentialPasswordDoesNotMatchDirectoryComplexityRequirement

public void testUpdateUserCredentialPasswordDoesNotMatchDirectoryComplexityRequirement()
                                                                                throws Exception
Throws:
Exception

testConnectToInvalidRestService

public void testConnectToInvalidRestService()
                                     throws Exception
Tests that RestCrowdClient throws an OperationFailedException if the RestCrowdClient is not communicating with a valid Crowd REST service.

Throws:
Exception

testConnectToRestService_WrongPassword

public void testConnectToRestService_WrongPassword()
                                            throws Exception
Tests that RestCrowdClient throws an InvalidAuthenticationException if the application password is invalid.

Throws:
Exception

testGetMemberships

public void testGetMemberships()
                        throws Exception
Tests that RestCrowdClient.getMemberships() returns successfully. The content of the response is tested by GroupsResourceTest#testGetMembershipsReturnsExactlyExpectedMemberships in crowd-rest-test.

Throws:
Exception

testQueryForNullFirstNames

public void testQueryForNullFirstNames()
                                throws Exception
Throws:
Exception

testMailUsernamesFailsWithUnknownAddress

public void testMailUsernamesFailsWithUnknownAddress()
                                              throws Exception
Throws:
Exception

testUpdateGroupWithAttributes

public void testUpdateGroupWithAttributes()
                                   throws Exception
Throws:
Exception

testSSOUserWithDefaultTokenDuration

public void testSSOUserWithDefaultTokenDuration()
                                         throws Exception
Throws:
Exception

testSSOUserWithZeroLivedToken

public void testSSOUserWithZeroLivedToken()
                                   throws Exception
Throws:
Exception

testInvalidateAllSSOTokensForUser

public void testInvalidateAllSSOTokensForUser()
                                       throws Exception
Throws:
Exception

testInvalidateAllOtherSSOTokensForUser

public void testInvalidateAllOtherSSOTokensForUser()
                                            throws Exception
Throws:
Exception

testFindUserFromValidSSOToken

public void testFindUserFromValidSSOToken()
                                   throws Exception
Throws:
Exception

testFindUserFromInvalidSSOToken

public void testFindUserFromInvalidSSOToken()
                                     throws Exception
Throws:
Exception

testFindUserFromNonExistentSSOToken

public void testFindUserFromNonExistentSSOToken()
                                         throws Exception
Throws:
Exception

testGetNonExistingWebhook

public void testGetNonExistingWebhook()
                               throws Exception
Throws:
Exception

testUnregisterNonExistingWebhook

public void testUnregisterNonExistingWebhook()
                                      throws Exception
Throws:
Exception

testAddUserToGroup

public void testAddUserToGroup()
                        throws Exception
Throws:
Exception

testAddUserToGroupWhenMembershipAlreadyExists

public void testAddUserToGroupWhenMembershipAlreadyExists()
                                                   throws Exception
Throws:
Exception

testAddGroupToGroup

public void testAddGroupToGroup()
                         throws Exception
Throws:
Exception

testAddGroupToGroupWhenMembershipAlreadyExists

public void testAddGroupToGroupWhenMembershipAlreadyExists()
                                                    throws Exception
Throws:
Exception


Copyright © 2013 Atlassian. All Rights Reserved.