Class RestCrowdServiceAcceptanceTestCase
java.lang.Object
junit.framework.Assert
junit.framework.TestCase
com.atlassian.crowd.acceptance.tests.rest.service.RestCrowdServiceAcceptanceTestCase
- All Implemented Interfaces:
junit.framework.Test
- Direct Known Subclasses:
AliasResourceTest
,AuditResourceTest
,AuthenticationResourceTest
,BlockOpenSocialRequestFilterAcceptanceTest
,CookieConfigResourceTest
,CrowdSpecificUsersResourceTest
,CrowdWadlResourceTest
,DirectoryResourceTest
,EventsResourceTest
,GroupsResourceTest
,LowerCaseOutputTest
,PluginSettingsResourceTest
,RepresentationTest
,RestCachingHeadersResponsesTest
,SearchResourceTest
,TokenResourceTest
,UserPermissionAdminResourceTest
,UsersResourceTest
,WebhooksResourceTest
public abstract class RestCrowdServiceAcceptanceTestCase
extends junit.framework.TestCase
All REST acceptance tests should subclass this class.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
protected static final String
protected static final String
protected static final String
protected static final String
static final String
static final String
protected static final String
static final String
static final String
static final String
static final String
static final String
protected static final String
protected static final javax.ws.rs.core.MediaType
Specify this type for any entities being sent to the server.static final String
static final String
static final String
static final String
static final String
static final String
static final String
protected static final String
protected RestServer
static final String
static final String
protected static final String
protected static final String
protected static final String
protected static final String
-
Constructor Summary
ModifierConstructorDescriptionprotected
Constructs a test case with the given name.protected
RestCrowdServiceAcceptanceTestCase
(String name, RestServer restServer) Constructs a test case with the given name, using the given RestServer. -
Method Summary
Modifier and TypeMethodDescriptionprotected UserEntity
authenticateUser
(String username, String password) Authenticate a user with the specified username and password against the 'crowd' application.protected UserEntity
authenticateUser
(String username, String password, String applicationName, String applicationPassword) Authenticate a user with the specified username and password.protected void
deactivateUser
(String username) protected javax.ws.rs.core.UriBuilder
Returns the base URI of the REST service.protected javax.ws.rs.core.UriBuilder
getBaseUriBuilder
(String serviceName) protected javax.ws.rs.core.UriBuilder
getBaseUriBuilder
(String serviceName, String version) protected javax.ws.rs.client.WebTarget
getRootWebTarget
(String applicationName, String password) Returns the "root" WebTarget.protected javax.ws.rs.core.UriBuilder
protected javax.ws.rs.client.WebTarget
getWebTarget
(String applicationName, String password, URI uri) Returns the WebTarget with the specified URI.protected javax.ws.rs.client.WebTarget
getWebTarget
(URI uri) Returns the WebTarget with the specified URI, retrieved anonymously.protected EventEntityList
requestEvents
(String eventToken) final void
setRestServer
(RestServer restServer) Sets the RestServer instance to test against.void
setUp()
protected void
tearDown()
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, runBare, runTest, setName, toString
-
Field Details
-
APPLICATION_NAME
- See Also:
-
APPLICATION_PASSWORD
- See Also:
-
GROUPS_RESOURCE
- See Also:
-
ATTRIBUTES_RESOURCE
- See Also:
-
USERS_RESOURCE
- See Also:
-
AUTHENTICATION_RESOURCE
- See Also:
-
SESSION_RESOURCE
- See Also:
-
WEBHOOKS_RESOURCE
- See Also:
-
EVENTS_RESOURCE
- See Also:
-
MT
protected static final javax.ws.rs.core.MediaType MTSpecify this type for any entities being sent to the server. -
REST_SERVICE_NAME
- See Also:
-
USERNAME_PARAM
- See Also:
-
ADMIN_USERNAME
- See Also:
-
ADMIN_PASSWORD
- See Also:
-
EEEEP_USERNAME
- See Also:
-
EEEEP_PASSWORD
- See Also:
-
PENNY_USERNAME
- See Also:
-
NON_EXISTENT_USER
- See Also:
-
NON_ADMIN_USER_NAME
- See Also:
-
NON_ADMIN_USER_PASSWORD
- See Also:
-
NON_CROWD_USER_USERNAME
- See Also:
-
NON_CROWD_USER_PASSWORD
- See Also:
-
SECOND_ADMIN_USERNAME
- See Also:
-
SECOND_ADMIN_PASSWORD
- See Also:
-
GROUP_BADGERS
- See Also:
-
GROUP_BADGERS_DESCRIPTION
- See Also:
-
GROUP_CROWD_ADMINS
- See Also:
-
GROUP_CROWD_TESTERS
- See Also:
-
GROUP_CROWD_USERS
- See Also:
-
NON_EXISTENT_GROUP
- See Also:
-
restServer
-
-
Constructor Details
-
RestCrowdServiceAcceptanceTestCase
Constructs a test case with the given name.- Parameters:
name
- the test name
-
RestCrowdServiceAcceptanceTestCase
Constructs a test case with the given name, using the given RestServer.- Parameters:
name
- the test namerestServer
- the RestServer
-
-
Method Details
-
setUp
- Overrides:
setUp
in classjunit.framework.TestCase
- Throws:
Exception
-
tearDown
- Overrides:
tearDown
in classjunit.framework.TestCase
- Throws:
Exception
-
setRestServer
Sets the RestServer instance to test against.- Parameters:
restServer
- a RestServer
-
getBaseUriBuilder
protected javax.ws.rs.core.UriBuilder getBaseUriBuilder()Returns the base URI of the REST service.- Returns:
- UriBuilder
-
getBaseUriBuilder
-
getBaseUriBuilder
-
getServerUriBuilder
protected javax.ws.rs.core.UriBuilder getServerUriBuilder() -
getRootWebTarget
Returns the "root" WebTarget. This is the resource that's at the / of the crowd-rest-plugin plugin namespace.- Parameters:
applicationName
- name of the applicationpassword
- password of the application- Returns:
- root WebTarget
-
getWebTarget
protected javax.ws.rs.client.WebTarget getWebTarget(String applicationName, String password, URI uri) Returns the WebTarget with the specified URI.- Parameters:
applicationName
- name of the applicationpassword
- password of the applicationuri
- URI of the resource- Returns:
- WebTarget
-
getWebTarget
Returns the WebTarget with the specified URI, retrieved anonymously.- Returns:
- WebTarget
-
authenticateUser
Authenticate a user with the specified username and password against the 'crowd' application.- Parameters:
username
- usernamepassword
- password- Returns:
- UserEntity
- Throws:
javax.ws.rs.WebApplicationException
- if the status of the HTTP response is greater than or equal to 300.
-
authenticateUser
protected UserEntity authenticateUser(String username, String password, String applicationName, String applicationPassword) Authenticate a user with the specified username and password.- Parameters:
username
- usernamepassword
- passwordapplicationName
- The application to authenticate against.applicationPassword
- The password for the application.- Returns:
- UserEntity
- Throws:
javax.ws.rs.WebApplicationException
- if the status of the HTTP response is greater than or equal to 300.
-
deactivateUser
-
requestEventToken
-
requestEvents
-