com.atlassian.confluence.api
Class AbstractRemoteServiceAcceptanceTest

java.lang.Object
  extended by com.atlassian.confluence.api.AbstractAcceptanceTest
      extended by com.atlassian.confluence.api.AbstractRemoteServiceAcceptanceTest
Direct Known Subclasses:
RemoteAttachmentServiceAcceptanceTest, RemoteChildContentServiceAcceptanceTest, RemoteContentBodyConversionServiceAcceptanceTest, RemoteContentLabelServiceAcceptanceTest, RemoteContentMacroServiceAcceptanceTest, RemoteContentPropertyServiceAcceptanceTest, RemoteContentRestrictionServiceAcceptanceTest, RemoteContentServiceAcceptanceTest, RemoteContentTrashServiceAcceptanceTest, RemoteCQLSearchServiceAcceptanceTest, RemoteSpaceServiceAcceptanceTest

public abstract class AbstractRemoteServiceAcceptanceTest
extends AbstractAcceptanceTest

Provides common acceptance tests for RemoteServices.


Field Summary
protected  ProxyCreator proxyCreator
           
 
Fields inherited from class com.atlassian.confluence.api.AbstractAcceptanceTest
rpc, testHelper, testName
 
Constructor Summary
AbstractRemoteServiceAcceptanceTest()
           
 
Method Summary
protected  void checkPageResponse(String pageIdentifier, int expectedPageSize, int expectedUniqueResultsAfter, int actualUniqueResultsAfter, PageResponse<?> pageResponse)
          Method used to do some basic assumptions on PageResponse objects Assertions here: * page response is of expected size * page response contains unique results * page response does not add non-unique results to the previous pages
protected  Collection<String> getExcludedMethodNamesForProxyTest()
          Returns a collection of method names to skip the proxy test for.
protected abstract  Object getService()
           
protected abstract  Class getServiceClass()
           
protected  void loginIfNotAlready(User user)
          Checks whether currently logged in user is same as a user passed as an argument.
protected  void prepareMspacesWithNpages(int spacesAmount, int contentPagesPerEachSpace)
          Method creates cascaded setup of users and spaces see prepareSpacesAndUsersWithCascadedVisibility(int)
protected  void prepareSpacesAndUsersWithCascadedVisibility(int amount)
          Creates a set of users + set of spaces so that: * each user is an admin in the space with corresponding name * each user can see all the previous spaces + his own 1 1<-2 1<-2<-3
 void proxySetUp()
           
protected  Space spaceByNumber(int number)
          Creates a space with name like "space".
 void testServiceProxy()
          Test that RemoteService equivalents for API Service interfaces include all of the methods on the Services.
protected  User userByNumber(int number)
          Generated or gets arbitrary number of test users.
 
Methods inherited from class com.atlassian.confluence.api.AbstractAcceptanceTest
commonSetUp, exceptionSupplier, tearDown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

proxyCreator

protected ProxyCreator proxyCreator
Constructor Detail

AbstractRemoteServiceAcceptanceTest

public AbstractRemoteServiceAcceptanceTest()
Method Detail

proxySetUp

public final void proxySetUp()
                      throws Exception
Throws:
Exception

getService

protected abstract Object getService()
Returns:
the proxy of the API Service under test.

getServiceClass

protected abstract Class getServiceClass()
Returns:
the class of the API Service under test.

testServiceProxy

public void testServiceProxy()
                      throws Exception
Test that RemoteService equivalents for API Service interfaces include all of the methods on the Services.

Throws:
Exception

getExcludedMethodNamesForProxyTest

protected Collection<String> getExcludedMethodNamesForProxyTest()
Returns a collection of method names to skip the proxy test for.

Overridden by test classes for services with methods that are known to be implemented on the proxy, but not able to be tested with the logic in testServiceProxy. If we end up fixing the logic, these exclusions can (and should) be removed.


checkPageResponse

protected void checkPageResponse(String pageIdentifier,
                                 int expectedPageSize,
                                 int expectedUniqueResultsAfter,
                                 int actualUniqueResultsAfter,
                                 PageResponse<?> pageResponse)
Method used to do some basic assumptions on PageResponse objects Assertions here: * page response is of expected size * page response contains unique results * page response does not add non-unique results to the previous pages

Parameters:
pageIdentifier - - String which describes a paged request. Used for logging. I.e. "page 1 of user 1"
expectedPageSize - - Expected size of a page
expectedUniqueResultsAfter - - Expected count of all the unique results retrieved via this and previous pages
actualUniqueResultsAfter - - Actual count of all the unique results retrieved via this and previous pages
pageResponse - - Actual PageResponse entity

loginIfNotAlready

protected void loginIfNotAlready(User user)
Checks whether currently logged in user is same as a user passed as an argument. Logs user in if not.

Parameters:
user -

userByNumber

protected User userByNumber(int number)
Generated or gets arbitrary number of test users. Name pattern is "user". Password is same a name.

Parameters:
number -
Returns:

spaceByNumber

protected Space spaceByNumber(int number)
Creates a space with name like "space". Only user with name "user" has access to such a space. User will be created if not already.

Parameters:
number -
Returns:

prepareSpacesAndUsersWithCascadedVisibility

protected void prepareSpacesAndUsersWithCascadedVisibility(int amount)
Creates a set of users + set of spaces so that: * each user is an admin in the space with corresponding name * each user can see all the previous spaces + his own 1 1<-2 1<-2<-3

Parameters:
amount - - amount of user-spaces required

prepareMspacesWithNpages

protected void prepareMspacesWithNpages(int spacesAmount,
                                        int contentPagesPerEachSpace)
Method creates cascaded setup of users and spaces see prepareSpacesAndUsersWithCascadedVisibility(int)

Parameters:
spacesAmount - how many spaces needed
contentPagesPerEachSpace - how many pages should each space contain


Copyright © 2003–2015 Atlassian. All rights reserved.