com.atlassian.crowd.acceptance.tests.directory
Class BaseTest
java.lang.Object
junit.framework.Assert
junit.framework.TestCase
org.springframework.test.ConditionalTestCase
org.springframework.test.AbstractSpringContextTests
org.springframework.test.AbstractSingleSpringContextTests
org.springframework.test.AbstractDependencyInjectionSpringContextTests
org.springframework.test.AbstractTransactionalSpringContextTests
org.springframework.test.AbstractTransactionalDataSourceSpringContextTests
com.atlassian.crowd.acceptance.tests.directory.BaseTest
- All Implemented Interfaces:
- junit.framework.Test
- Direct Known Subclasses:
- BasicTest, DbCachingLdapTest, DnRangeTest, GroupRoleTest, LdapDirectoryWithEscapedDnsTest, LocalAttributesTest, LocalGroupsTest, NestedGroupsTest, PageAndRangeTest
public abstract class BaseTest
- extends org.springframework.test.AbstractTransactionalDataSourceSpringContextTests
Sets properties and connects to a directory for testing. The RemoteDirectory interface is exercised by a subclass.
This now includes support for the database to allow testing of internal-backed LDAP directories.
Fields inherited from class org.springframework.test.AbstractTransactionalDataSourceSpringContextTests |
jdbcTemplate |
Fields inherited from class org.springframework.test.AbstractTransactionalSpringContextTests |
transactionDefinition, transactionManager, transactionStatus |
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 |
Method Summary |
protected void |
addGroup(GroupTemplate group)
|
protected Group |
addGroup(String groupName,
Long directoryId)
|
protected void |
addUser(String userName,
Long directoryId,
String password)
|
protected void |
addUser(UserTemplate user,
String password)
|
protected GroupTemplate |
buildGroup(String groupName,
Long directoryId)
|
protected UserTemplateWithAttributes |
buildUser(String userName,
Long directoryId)
|
protected UserTemplateWithAttributes |
buildUser(String userName,
String emailAddress,
String firstName,
String lastName,
Long directoryId)
|
protected void |
configureDirectory(Properties directorySettings)
Configures a runtime Crowd object that connects to the Sun instance. |
protected void |
customizeBeanFactory(org.springframework.beans.factory.support.DefaultListableBeanFactory beanFactory)
|
protected void |
deleteFromTables(String[] names)
Delete tables without setting the 'zapped' flag so we can commit. |
protected String[] |
getConfigLocations()
|
String |
getDirectoryConfigFile()
|
protected RemoteDirectory |
getRemoteDirectory()
|
protected abstract void |
loadTestData()
Called before every test run to add data needed for test. |
protected void |
onSetUpBeforeTransaction()
|
protected void |
onSetUpInTransaction()
|
void |
onTearDown()
|
protected void |
removeGroup(String groupName)
Convenience method used by subclasses. |
protected void |
removeRole(String roleName)
Convenience method used by subclasses. |
protected abstract void |
removeTestData()
Called before loadTestData() AND after every test run to remove data added for test. |
protected void |
removeUser(String userName)
Convenience method used by subclasses. |
void |
setDirectoryConfigFile(String directoryConfigFile)
|
void |
setLdapPropertiesHelper(LDAPPropertiesHelperImpl ldapPropertiesHelperImpl)
|
void |
setSessionFactory(org.hibernate.SessionFactory sessionFactory)
|
void |
setupSpring()
|
Methods inherited from class org.springframework.test.AbstractTransactionalDataSourceSpringContextTests |
countRowsInTable, executeSqlScript, getJdbcTemplate, setComplete, setDataSource, setSqlScriptEncoding |
Methods inherited from class org.springframework.test.AbstractTransactionalSpringContextTests |
endTransaction, isDefaultRollback, isRollback, onSetUp, onTearDownAfterTransaction, onTearDownInTransaction, preventTransaction, setDefaultRollback, setTransactionDefinition, setTransactionManager, startNewTransaction |
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, createBeanDefinitionReader, getApplicationContext, getConfigPath, getConfigPaths, getLoadCount, loadContext, loadContextLocations, prepareApplicationContext, setDirty, setUp, tearDown |
Methods inherited from class org.springframework.test.AbstractSpringContextTests |
addContext, contextKeyString, getContext, hasCachedContext, isContextKeyEmpty, 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 |
directory
protected DirectoryImpl directory
directoryManager
protected MockDirectoryManager directoryManager
sessionFactory
protected org.hibernate.SessionFactory sessionFactory
BaseTest
protected BaseTest()
BaseTest
protected BaseTest(String name)
customizeBeanFactory
protected void customizeBeanFactory(org.springframework.beans.factory.support.DefaultListableBeanFactory beanFactory)
- Overrides:
customizeBeanFactory
in class org.springframework.test.AbstractSingleSpringContextTests
getConfigLocations
protected String[] getConfigLocations()
- Overrides:
getConfigLocations
in class org.springframework.test.AbstractSingleSpringContextTests
configureDirectory
protected void configureDirectory(Properties directorySettings)
- Configures a runtime Crowd object that connects to the Sun instance.
setupSpring
public void setupSpring()
onSetUpBeforeTransaction
protected void onSetUpBeforeTransaction()
throws Exception
- Overrides:
onSetUpBeforeTransaction
in class org.springframework.test.AbstractTransactionalSpringContextTests
- Throws:
Exception
onSetUpInTransaction
protected void onSetUpInTransaction()
throws Exception
- Overrides:
onSetUpInTransaction
in class org.springframework.test.AbstractTransactionalSpringContextTests
- Throws:
Exception
onTearDown
public void onTearDown()
throws Exception
- Overrides:
onTearDown
in class org.springframework.test.AbstractTransactionalSpringContextTests
- Throws:
Exception
removeTestData
protected abstract void removeTestData()
- Called before loadTestData() AND after every test run to remove data added for test.
loadTestData
protected abstract void loadTestData()
throws Exception
- Called before every test run to add data needed for test.
- Throws:
Exception
setLdapPropertiesHelper
public void setLdapPropertiesHelper(LDAPPropertiesHelperImpl ldapPropertiesHelperImpl)
setDirectoryConfigFile
public void setDirectoryConfigFile(String directoryConfigFile)
getDirectoryConfigFile
public String getDirectoryConfigFile()
getRemoteDirectory
protected RemoteDirectory getRemoteDirectory()
throws DirectoryInstantiationException
- Throws:
DirectoryInstantiationException
removeUser
protected void removeUser(String userName)
- Convenience method used by subclasses. Doesn't log or throw on exception - use only in tearDown()
- Parameters:
userName
-
removeGroup
protected void removeGroup(String groupName)
- Convenience method used by subclasses. Doesn't log or throw on exception - use only in tearDown()
- Parameters:
groupName
-
removeRole
protected void removeRole(String roleName)
- Convenience method used by subclasses. Doesn't log or throw on exception - use only in tearDown()
- Parameters:
roleName
-
buildUser
protected UserTemplateWithAttributes buildUser(String userName,
Long directoryId)
buildUser
protected UserTemplateWithAttributes buildUser(String userName,
String emailAddress,
String firstName,
String lastName,
Long directoryId)
addUser
protected void addUser(UserTemplate user,
String password)
throws InvalidCredentialException,
InvalidUserException,
OperationFailedException,
UserAlreadyExistsException,
DirectoryNotFoundException,
UserNotFoundException
- Throws:
InvalidCredentialException
InvalidUserException
OperationFailedException
UserAlreadyExistsException
DirectoryNotFoundException
UserNotFoundException
addUser
protected void addUser(String userName,
Long directoryId,
String password)
throws InvalidCredentialException,
InvalidUserException,
OperationFailedException,
UserAlreadyExistsException,
DirectoryNotFoundException,
UserNotFoundException
- Throws:
InvalidCredentialException
InvalidUserException
OperationFailedException
UserAlreadyExistsException
DirectoryNotFoundException
UserNotFoundException
buildGroup
protected GroupTemplate buildGroup(String groupName,
Long directoryId)
addGroup
protected Group addGroup(String groupName,
Long directoryId)
throws InvalidGroupException,
OperationFailedException,
DirectoryNotFoundException,
GroupNotFoundException
- Throws:
InvalidGroupException
OperationFailedException
DirectoryNotFoundException
GroupNotFoundException
addGroup
protected void addGroup(GroupTemplate group)
throws InvalidCredentialException,
InvalidUserException,
InvalidGroupException,
OperationFailedException,
DirectoryNotFoundException,
GroupNotFoundException
- Throws:
InvalidCredentialException
InvalidUserException
InvalidGroupException
OperationFailedException
DirectoryNotFoundException
GroupNotFoundException
setSessionFactory
public void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
deleteFromTables
protected void deleteFromTables(String[] names)
- Delete tables without setting the 'zapped' flag so we can commit.
- Overrides:
deleteFromTables
in class org.springframework.test.AbstractTransactionalDataSourceSpringContextTests
Copyright © 2012 Atlassian. All Rights Reserved.