Class ApplicationResourceTest
java.lang.Object
com.atlassian.crowd.acceptance.tests.rest.service.ApplicationResourceTest
Tests for the Application resource
- Since:
- 2.2
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected long
Returns the application ID.protected String
Returns the application name.protected ApplicationType
Returns the application type.protected javax.ws.rs.core.UriBuilder
Returns the base URI of the REST service.protected javax.ws.rs.client.WebTarget
getRootWebTarget
(String userName, String password) Returns the "root" WebResource.protected javax.ws.rs.client.WebTarget
getWebTarget
(String userName, String password, URI uri) Returns the WebResource with the specified URI.void
setRestServer
(RestServer restServer) void
void
void
Tests that adding an application is successful.void
Tests that adding an application with no name will fail with a 400 (Bad Request) with a reason of Illegal Argument.void
Tests that adding an application with no password will fail with a 400 (Bad Request) with a reason of Invalid Credential.void
Tests that adding an application with no type will fail with a 400 (Bad Request) with a reason of Illegal Argument.void
void
Tests adding an application with the request address included.void
Tests adding an application with the request address included, and simulating a proxy being involved (i.e.void
Tests that adding a remote address is successful.void
Tests that the REST service allows an application to be retrieved by IDvoid
Tests that retrieving a non-existent application by ID will return a 404 (Not Found) response with a reason of Application Not Found.void
Tests that the REST service allows an application to be retrieved by namevoid
Tests that retrieving a non-existent application by name will return a 404 (Not Found) response with a reason of Application Not Found.void
Tests that the REST service does not allow a user to access the Application Management API if an incorrect user password has been given.
-
Field Details
-
USER_NAME
- See Also:
-
USER_PASSWORD
- See Also:
-
APPLICATION_RESOURCE
- See Also:
-
CROWD_APPLICATION_ID
protected static final long CROWD_APPLICATION_ID- See Also:
-
CROWD_APPLICATION_NAME
- See Also:
-
REST_SERVICE_NAME
- See Also:
-
fixture
-
-
Constructor Details
-
ApplicationResourceTest
public ApplicationResourceTest()
-
-
Method Details
-
getApplicationId
protected long getApplicationId()Returns the application ID.- Returns:
- application ID
-
getApplicationName
Returns the application name.- Returns:
- application name
-
getApplicationType
Returns the application type.- Returns:
- application type
-
getBaseUriBuilder
protected javax.ws.rs.core.UriBuilder getBaseUriBuilder()Returns the base URI of the REST service.- Returns:
- UriBuilder
-
getRootWebTarget
Returns the "root" WebResource. This is the resource that's at the / of the crowd-rest-plugin plugin namespace.- Parameters:
userName
- name of the userpassword
- password of the user- Returns:
- root WebResource
-
getWebTarget
Returns the WebResource with the specified URI.- Parameters:
userName
- name of the userpassword
- password of the useruri
- URI of the resource- Returns:
- WebResource
-
testGetApplicationByName
Tests that the REST service allows an application to be retrieved by name- Throws:
Exception
-
testGetApplicationByName_NotFound
Tests that retrieving a non-existent application by name will return a 404 (Not Found) response with a reason of Application Not Found.- Throws:
Exception
-
testGetApplicationById
Tests that the REST service allows an application to be retrieved by ID- Throws:
Exception
-
testGetApplicationById_NotFound
Tests that retrieving a non-existent application by ID will return a 404 (Not Found) response with a reason of Application Not Found.- Throws:
Exception
-
testWrongPassword
Tests that the REST service does not allow a user to access the Application Management API if an incorrect user password has been given.- Throws:
Exception
-
testAddApplication
Tests that adding an application is successful.- Throws:
Exception
-
testAddApplication_NoPassword
Tests that adding an application with no password will fail with a 400 (Bad Request) with a reason of Invalid Credential.- Throws:
Exception
-
testAddApplication_NoName
Tests that adding an application with no name will fail with a 400 (Bad Request) with a reason of Illegal Argument.- Throws:
Exception
-
testAddApplication_NoType
Tests that adding an application with no type will fail with a 400 (Bad Request) with a reason of Illegal Argument.- Throws:
Exception
-
testAddRemoteAddress
Tests that adding a remote address is successful.- Throws:
Exception
-
testAddApplicationWithRequestAddress
public void testAddApplicationWithRequestAddress()Tests adding an application with the request address included. Checks that the application is able to connect to the Crowd REST service after adding the application. -
testAddApplicationWithRequestAddress_WithProxy
public void testAddApplicationWithRequestAddress_WithProxy()Tests adding an application with the request address included, and simulating a proxy being involved (i.e. the X-Forwarded-For header set). Checks that the application is able to connect to the Crowd REST service after adding the application. -
testAddApplicationWithDuplicateNameProducesConflictResponseCode
- Throws:
Exception
-
shouldUpdateExistingApplication
public void shouldUpdateExistingApplication() -
shouldNotUpdateWhenAppEntityLacksId
public void shouldNotUpdateWhenAppEntityLacksId() -
getRestServer
-
setRestServer
-