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 Details

  • Constructor Details

    • RestCrowdServiceAcceptanceTestCase

      protected RestCrowdServiceAcceptanceTestCase(String name)
      Constructs a test case with the given name.
      Parameters:
      name - the test name
    • RestCrowdServiceAcceptanceTestCase

      protected RestCrowdServiceAcceptanceTestCase(String name, RestServer restServer)
      Constructs a test case with the given name, using the given RestServer.
      Parameters:
      name - the test name
      restServer - the RestServer
  • Method Details

    • setUp

      public void setUp() throws Exception
      Overrides:
      setUp in class junit.framework.TestCase
      Throws:
      Exception
    • tearDown

      protected void tearDown() throws Exception
      Overrides:
      tearDown in class junit.framework.TestCase
      Throws:
      Exception
    • setRestServer

      public final void setRestServer(RestServer restServer)
      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

      protected javax.ws.rs.core.UriBuilder getBaseUriBuilder(String serviceName)
    • getBaseUriBuilder

      protected javax.ws.rs.core.UriBuilder getBaseUriBuilder(String serviceName, String version)
    • getServerUriBuilder

      protected javax.ws.rs.core.UriBuilder getServerUriBuilder()
    • getRootWebTarget

      protected javax.ws.rs.client.WebTarget getRootWebTarget(String applicationName, String password)
      Returns the "root" WebTarget. This is the resource that's at the / of the crowd-rest-plugin plugin namespace.
      Parameters:
      applicationName - name of the application
      password - 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 application
      password - password of the application
      uri - URI of the resource
      Returns:
      WebTarget
    • getWebTarget

      protected javax.ws.rs.client.WebTarget getWebTarget(URI uri)
      Returns the WebTarget with the specified URI, retrieved anonymously.
      Returns:
      WebTarget
    • authenticateUser

      protected UserEntity authenticateUser(String username, String password)
      Authenticate a user with the specified username and password against the 'crowd' application.
      Parameters:
      username - username
      password - 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 - username
      password - password
      applicationName - 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

      protected void deactivateUser(String username)
    • requestEventToken

      public String requestEventToken()
    • requestEvents

      protected EventEntityList requestEvents(String eventToken)