com.atlassian.crowd.acceptance.tests.directory
Class BaseTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.springframework.test.ConditionalTestCase
              extended by org.springframework.test.AbstractSpringContextTests
                  extended by org.springframework.test.AbstractSingleSpringContextTests
                      extended by org.springframework.test.AbstractDependencyInjectionSpringContextTests
                          extended by com.atlassian.crowd.acceptance.tests.directory.BaseTest
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
BasicTest, GroupRoleTest, NestedGroupsTest, PageAndRangeTest

public abstract class BaseTest
extends org.springframework.test.AbstractDependencyInjectionSpringContextTests

Sets properties and connects to a directory for testing. The RemoteDirectory interface is exercised by a subclass


Field Summary
protected  Directory directory
           
protected  MockDirectoryManager directoryManager
           
 
Fields inherited from class org.springframework.test.AbstractDependencyInjectionSpringContextTests
AUTOWIRE_BY_NAME, AUTOWIRE_BY_TYPE, AUTOWIRE_NO
 
Fields inherited from class org.springframework.test.AbstractSingleSpringContextTests
applicationContext
 
Fields inherited from class org.springframework.test.ConditionalTestCase
logger
 
Constructor Summary
BaseTest()
           
 
Method Summary
protected  void addGroup(GroupTemplate group)
           
protected  Group addGroup(java.lang.String groupName, java.lang.Long directoryId)
           
protected  void addUser(java.lang.String userName, java.lang.Long directoryId, java.lang.String password)
           
protected  void addUser(UserTemplate user, java.lang.String password)
           
protected  GroupTemplate buildGroup(java.lang.String groupName, java.lang.Long directoryId)
           
protected  UserTemplateWithAttributes buildUser(java.lang.String userName, java.lang.Long directoryId)
           
protected  UserTemplateWithAttributes buildUser(java.lang.String userName, java.lang.String emailAddress, java.lang.String firstName, java.lang.String lastName, java.lang.Long directoryId)
           
protected  void configureDirectory(java.util.Properties directorySettings)
          Configures a runtime Crowd object that connects to the Sun instance.
protected  java.lang.String[] getConfigLocations()
           
 java.lang.String getDirectoryConfigFile()
           
protected  RemoteDirectory getRemoteDirectory()
           
protected abstract  void loadTestData()
          Called before every test run to add data needed for test.
 void onSetUp()
           
 void onTearDown()
           
protected  void removeGroup(java.lang.String groupName)
          Convenience method used by subclasses.
protected  void removeRole(java.lang.String roleName)
          Convenience method used by subclasses.
protected abstract  void removeTestData()
          Called after every test run to remove data added for test.
protected  void removeUser(java.lang.String userName)
          Convenience method used by subclasses.
 void setDirectoryConfigFile(java.lang.String directoryConfigFile)
           
 void setLdapPropertiesHelper(LDAPPropertiesHelperImpl ldapPropertiesHelperImpl)
           
 void setupSpring()
           
 
Methods inherited from class org.springframework.test.AbstractDependencyInjectionSpringContextTests
getAutowireMode, injectDependencies, isDependencyCheck, isPopulateProtectedVariables, prepareTestInstance, setAutowireMode, setDependencyCheck, setPopulateProtectedVariables
 
Methods inherited from class org.springframework.test.AbstractSingleSpringContextTests
contextKey, createApplicationContext, customizeBeanFactory, getApplicationContext, getConfigPath, getConfigPaths, getLoadCount, loadContext, loadContextLocations, setDirty, setUp, tearDown
 
Methods inherited from class org.springframework.test.AbstractSpringContextTests
addContext, contextKeyString, getContext, hasCachedContext, setDirty
 
Methods inherited from class org.springframework.test.ConditionalTestCase
getDisabledTestCount, isDisabledInThisEnvironment, recordDisabled, runBare
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
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, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

directory

protected Directory directory

directoryManager

protected MockDirectoryManager directoryManager
Constructor Detail

BaseTest

public BaseTest()
Method Detail

getConfigLocations

protected java.lang.String[] getConfigLocations()
Overrides:
getConfigLocations in class org.springframework.test.AbstractSingleSpringContextTests

configureDirectory

protected void configureDirectory(java.util.Properties directorySettings)
Configures a runtime Crowd object that connects to the Sun instance.


setupSpring

public void setupSpring()

onSetUp

public void onSetUp()
             throws java.lang.Exception
Overrides:
onSetUp in class org.springframework.test.AbstractSingleSpringContextTests
Throws:
java.lang.Exception

onTearDown

public void onTearDown()
                throws java.lang.Exception
Overrides:
onTearDown in class org.springframework.test.AbstractSingleSpringContextTests
Throws:
java.lang.Exception

removeTestData

protected abstract void removeTestData()
Called after every test run to remove data added for test.


loadTestData

protected abstract void loadTestData()
                              throws java.lang.Exception
Called before every test run to add data needed for test.

Throws:
java.lang.Exception

setLdapPropertiesHelper

public void setLdapPropertiesHelper(LDAPPropertiesHelperImpl ldapPropertiesHelperImpl)

setDirectoryConfigFile

public void setDirectoryConfigFile(java.lang.String directoryConfigFile)

getDirectoryConfigFile

public java.lang.String getDirectoryConfigFile()

getRemoteDirectory

protected RemoteDirectory getRemoteDirectory()
                                      throws DirectoryInstantiationException
Throws:
DirectoryInstantiationException

removeUser

protected void removeUser(java.lang.String userName)
Convenience method used by subclasses. Doesn't log or throw on exception - use only in tearDown()

Parameters:
userName -

removeGroup

protected void removeGroup(java.lang.String groupName)
Convenience method used by subclasses. Doesn't log or throw on exception - use only in tearDown()

Parameters:
groupName -

removeRole

protected void removeRole(java.lang.String roleName)
Convenience method used by subclasses. Doesn't log or throw on exception - use only in tearDown()

Parameters:
roleName -

buildUser

protected UserTemplateWithAttributes buildUser(java.lang.String userName,
                                               java.lang.Long directoryId)

buildUser

protected UserTemplateWithAttributes buildUser(java.lang.String userName,
                                               java.lang.String emailAddress,
                                               java.lang.String firstName,
                                               java.lang.String lastName,
                                               java.lang.Long directoryId)

addUser

protected void addUser(UserTemplate user,
                       java.lang.String password)
                throws DirectoryInstantiationException,
                       InvalidCredentialException,
                       ObjectNotFoundException,
                       InvalidUserException
Throws:
DirectoryInstantiationException
InvalidCredentialException
ObjectNotFoundException
InvalidUserException

addUser

protected void addUser(java.lang.String userName,
                       java.lang.Long directoryId,
                       java.lang.String password)
                throws DirectoryInstantiationException,
                       InvalidCredentialException,
                       ObjectNotFoundException,
                       InvalidUserException
Throws:
DirectoryInstantiationException
InvalidCredentialException
ObjectNotFoundException
InvalidUserException

buildGroup

protected GroupTemplate buildGroup(java.lang.String groupName,
                                   java.lang.Long directoryId)

addGroup

protected Group addGroup(java.lang.String groupName,
                         java.lang.Long directoryId)
                  throws DirectoryInstantiationException,
                         ObjectNotFoundException,
                         InvalidGroupException
Throws:
DirectoryInstantiationException
ObjectNotFoundException
InvalidGroupException

addGroup

protected void addGroup(GroupTemplate group)
                 throws DirectoryInstantiationException,
                        InvalidCredentialException,
                        ObjectNotFoundException,
                        InvalidUserException,
                        InvalidGroupException
Throws:
DirectoryInstantiationException
InvalidCredentialException
ObjectNotFoundException
InvalidUserException
InvalidGroupException


Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.