com.atlassian.crowd.acceptance.tests.rest.service
Class ApplicationResourceTest

java.lang.Object
  extended by com.atlassian.crowd.acceptance.tests.rest.service.ApplicationResourceTest

public class ApplicationResourceTest
extends Object

Tests for the Application resource

Since:
2.2

Field Summary
protected static String APPLICATION_RESOURCE
           
protected static long CROWD_APPLICATION_ID
           
protected static String CROWD_APPLICATION_NAME
           
protected static String REST_SERVICE_NAME
           
protected static String USER_NAME
           
protected static String USER_PASSWORD
           
 
Constructor Summary
ApplicationResourceTest()
           
 
Method Summary
protected  long getApplicationId()
          Returns the application ID.
protected  String getApplicationName()
          Returns the application name.
protected  ApplicationType getApplicationType()
          Returns the application type.
protected  javax.ws.rs.core.UriBuilder getBaseUriBuilder()
          Returns the base URI of the REST service.
protected  com.sun.jersey.api.client.WebResource getRootWebResource(String userName, String password)
          Returns the "root" WebResource.
protected  com.sun.jersey.api.client.WebResource getWebResource(String userName, String password, URI uri)
          Returns the WebResource with the specified URI.
 void setUp()
           
 void tearDown()
           
 void testAddApplication_NoName()
          Tests that adding an application with no name will fail with a 400 (Bad Request) with a reason of Illegal Argument.
 void testAddApplication_NoPassword()
          Tests that adding an application with no password will fail with a 400 (Bad Request) with a reason of Invalid Credential.
 void testAddApplication_NoType()
          Tests that adding an application with no type will fail with a 400 (Bad Request) with a reason of Illegal Argument.
 void testAddApplication()
          Tests that adding an application is successful.
 void testAddApplicationWithRequestAddress_WithProxy()
          Tests adding an application with the request address included, and simulating a proxy being involved (i.e.
 void testAddApplicationWithRequestAddress()
          Tests adding an application with the request address included.
 void testAddRemoteAddress()
          Tests that adding a remote address is successful.
 void 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.
 void testGetApplicationById()
          Tests that the REST service allows an application to be retrieved by ID
 void 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.
 void testGetApplicationByName()
          Tests that the REST service allows an application to be retrieved by name
 void 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USER_NAME

protected static final String USER_NAME
See Also:
Constant Field Values

USER_PASSWORD

protected static final String USER_PASSWORD
See Also:
Constant Field Values

APPLICATION_RESOURCE

protected static final String APPLICATION_RESOURCE
See Also:
Constant Field Values

CROWD_APPLICATION_ID

protected static final long CROWD_APPLICATION_ID
See Also:
Constant Field Values

CROWD_APPLICATION_NAME

protected static final String CROWD_APPLICATION_NAME
See Also:
Constant Field Values

REST_SERVICE_NAME

protected static final String REST_SERVICE_NAME
See Also:
Constant Field Values
Constructor Detail

ApplicationResourceTest

public ApplicationResourceTest()
Method Detail

setUp

public void setUp()
           throws Exception
Throws:
Exception

tearDown

public void tearDown()
              throws Exception
Throws:
Exception

getApplicationId

protected long getApplicationId()
Returns the application ID.

Returns:
application ID

getApplicationName

protected String getApplicationName()
Returns the application name.

Returns:
application name

getApplicationType

protected ApplicationType 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

getRootWebResource

protected com.sun.jersey.api.client.WebResource getRootWebResource(String userName,
                                                                   String password)
Returns the "root" WebResource. This is the resource that's at the / of the crowd-rest-plugin plugin namespace.

Parameters:
userName - name of the user
password - password of the user
Returns:
root WebResource

getWebResource

protected com.sun.jersey.api.client.WebResource getWebResource(String userName,
                                                               String password,
                                                               URI uri)
Returns the WebResource with the specified URI.

Parameters:
userName - name of the user
password - password of the user
uri - URI of the resource
Returns:
WebResource

testGetApplicationByName

public void testGetApplicationByName()
                              throws Exception
Tests that the REST service allows an application to be retrieved by name

Throws:
Exception

testGetApplicationByName_NotFound

public void testGetApplicationByName_NotFound()
                                       throws Exception
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

public void testGetApplicationById()
                            throws Exception
Tests that the REST service allows an application to be retrieved by ID

Throws:
Exception

testGetApplicationById_NotFound

public void testGetApplicationById_NotFound()
                                     throws Exception
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

public void testWrongPassword()
                       throws Exception
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

public void testAddApplication()
                        throws Exception
Tests that adding an application is successful.

Throws:
Exception

testAddApplication_NoPassword

public void testAddApplication_NoPassword()
                                   throws Exception
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

public void testAddApplication_NoName()
                               throws Exception
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

public void testAddApplication_NoType()
                               throws Exception
Tests that adding an application with no type will fail with a 400 (Bad Request) with a reason of Illegal Argument.

Throws:
Exception

testAddRemoteAddress

public void testAddRemoteAddress()
                          throws Exception
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.



Copyright © 2013 Atlassian. All Rights Reserved.