com.atlassian.crowd.acceptance.tests.directory.monitor
Class ActiveDirectoryMonitorTest
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.monitor.BaseSpringTestCase
com.atlassian.crowd.acceptance.tests.directory.monitor.ActiveDirectoryMonitorTest
- All Implemented Interfaces:
- junit.framework.Test
public class ActiveDirectoryMonitorTest
- extends BaseSpringTestCase
This integration tests brings up a full spring context
backed by an in-memory (HSQL) database to test Active
Directory monitoring.
The AD config location is stored in crowd-ad1.properties
but the baseDN is over-ridden to use:
dc=sydney,dc=atlassian,dc=com
The user/group DNs are the baseDN.
As polling a directory is a very time-sensitive operation,
you should ensure that no one is mutating the directory
while this test is being run, otherwise you can get
some pretty interesting FAILs.
You must:
1. Connect to crowd-ad1 via SSL (add the AD cert to your JVMs keystore)
2. Have sydney.atlassian.com point to the IP of crowd-ad1 (in your hosts file)
3. Make sure crowd-ad1 is up!
4. The users/groups/roles that will be added do not already exist in AD
5. No one else is updating the directory when the tests are run
6. Not use breakpoints as this will stuff up the timing of poller and tester
Because of the aforementioned requirements, this test is
not included in the integration suite.
If you are experiencing timing related issues, try bumping
the MONITOR_POLLING_INTERVAL to 30 or even 60 seconds. This
will allow for more time for the poller to execute the
uSNChanged searches and allow for more time to prepare each
test execution.
Using MONITOR_POLLING_INTERVAL = 15, this test takes
approximately 5 minutes to execute.
- Author:
- Shihab Hamid
| 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 |
| Methods inherited from class org.springframework.test.AbstractTransactionalDataSourceSpringContextTests |
countRowsInTable, deleteFromTables, executeSqlScript, getJdbcTemplate, setComplete, setDataSource |
| Methods inherited from class org.springframework.test.AbstractTransactionalSpringContextTests |
endTransaction, onTearDown, 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, 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 |
ActiveDirectoryMonitorTest
public ActiveDirectoryMonitorTest()
onSetUpInTransaction
protected void onSetUpInTransaction()
throws java.lang.Exception
- Overrides:
onSetUpInTransaction in class org.springframework.test.AbstractTransactionalSpringContextTests
- Throws:
java.lang.Exception
initialiseMonitoredAD
protected RemoteDirectory initialiseMonitoredAD()
throws ObjectNotFoundException,
DirectoryInstantiationException,
java.io.IOException,
java.lang.InterruptedException
- Throws:
ObjectNotFoundException
DirectoryInstantiationException
java.io.IOException
java.lang.InterruptedException
testActiveDirectoryPolling
public void testActiveDirectoryPolling()
throws ObjectNotFoundException,
java.lang.InterruptedException,
InvalidCredentialException,
InvalidUserException,
InvalidGroupException,
InvalidMembershipException,
MembershipNotFoundException
- Throws:
ObjectNotFoundException
java.lang.InterruptedException
InvalidCredentialException
InvalidUserException
InvalidGroupException
InvalidMembershipException
MembershipNotFoundException
buildUser
protected UserTemplate buildUser(java.lang.String name,
java.lang.String firstName,
java.lang.String lastName,
java.lang.String email)
buildGroup
protected GroupTemplate buildGroup(java.lang.String name,
java.lang.String description)
buildRole
protected GroupTemplate buildRole(java.lang.String name,
java.lang.String description)
_testPrincipalCreatedEventsFired
protected void _testPrincipalCreatedEventsFired()
throws InvalidCredentialException,
InvalidUserException,
ObjectNotFoundException,
java.lang.InterruptedException
- Throws:
InvalidCredentialException
InvalidUserException
ObjectNotFoundException
java.lang.InterruptedException
_testPrincipalUpdatedEventsFired
protected void _testPrincipalUpdatedEventsFired()
throws ObjectNotFoundException,
java.lang.InterruptedException,
InvalidUserException
- Throws:
ObjectNotFoundException
java.lang.InterruptedException
InvalidUserException
_testPrincipalDeletedEventsFired
protected void _testPrincipalDeletedEventsFired()
throws ObjectNotFoundException,
java.lang.InterruptedException
- Throws:
ObjectNotFoundException
java.lang.InterruptedException
_testContainerCreatedEventsFired
protected void _testContainerCreatedEventsFired()
throws ObjectNotFoundException,
InvalidGroupException,
java.lang.InterruptedException
- Throws:
ObjectNotFoundException
InvalidGroupException
java.lang.InterruptedException
_testContainerUpdatedEventsFired
protected void _testContainerUpdatedEventsFired()
throws ObjectNotFoundException,
java.lang.InterruptedException,
InvalidGroupException
- Throws:
ObjectNotFoundException
java.lang.InterruptedException
InvalidGroupException
_testContainerDeletedEventsFired
protected void _testContainerDeletedEventsFired()
throws ObjectNotFoundException,
java.lang.InterruptedException
- Throws:
ObjectNotFoundException
java.lang.InterruptedException
_testContainerMembershipAddedEventsFired
protected void _testContainerMembershipAddedEventsFired()
throws ObjectNotFoundException,
java.lang.InterruptedException,
InvalidMembershipException
- Throws:
ObjectNotFoundException
java.lang.InterruptedException
InvalidMembershipException
_testContainerMembershipRemovedEventsFired
protected void _testContainerMembershipRemovedEventsFired()
throws ObjectNotFoundException,
java.lang.InterruptedException,
MembershipNotFoundException
- Throws:
ObjectNotFoundException
java.lang.InterruptedException
MembershipNotFoundException
waitForPoller
protected void waitForPoller()
throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
assertHasGUID
protected void assertHasGUID(LDAPDirectoryEntity entity)
assertUserEquals
protected void assertUserEquals(User one,
User two)
assertGroupEquals
protected void assertGroupEquals(Group one,
Group two)
setDirectoryDAO
public void setDirectoryDAO(DirectoryDAO directoryDAO)
setEventManager
public void setEventManager(com.atlassian.event.EventManager eventManager)
setDirectoryMonitorManager
public void setDirectoryMonitorManager(DirectoryMonitorManager directoryMonitorManager)
setDirectoryPollerManager
public void setDirectoryPollerManager(DirectoryPollerManager directoryPollerManager)
setDirectoryCacheManager
public void setDirectoryCacheManager(DirectoryCacheManager directoryCacheManager)
Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.