com.atlassian.crowd.acceptance.utils
Class DbCachingTestHelper

java.lang.Object
  extended by com.atlassian.crowd.acceptance.utils.DbCachingTestHelper

public class DbCachingTestHelper
extends Object

Helper class for testing DB caching directories.

Since:
v2.1

Nested Class Summary
 class DbCachingTestHelper.PartialSyncTask
          Uses the Builder pattern to create a synchronisation task.
static class DbCachingTestHelper.SyncInfo
          Information about the synchronisation.
 
Field Summary
static long DEFAULT_MAX_SYNC_WAIT_TIME_MS
           
protected static String LAST_SYNC_INFO_ELEM_ID
           
 
Constructor Summary
DbCachingTestHelper(net.sourceforge.jwebunit.junit.WebTester tester)
           
 
Method Summary
 boolean isSynchronising()
          Returns true if the directory is currently being synchronised.
 DbCachingTestHelper.PartialSyncTask syncDirectoryTask(String directoryName)
          Creates a partial sync task.
 DbCachingTestHelper.SyncInfo synchroniseDirectory(String directoryName, long maxWaitTimeMs)
          Synchronises the directory and waits until the synchronisation has finished.
 DbCachingTestHelper.SyncInfo synchroniseDirectory(String directoryName, long maxWaitTimeMs, String shortDescription)
          Synchronises the directory and waits until the synchronisation has finished.
static DbCachingTestHelper.SyncInfo synchroniseDirectory(net.sourceforge.jwebunit.junit.WebTester tester, String directoryName, long maxWaitTimeMs)
          Synchronises the directory and waits until the synchronisation has finished.
static DbCachingTestHelper.SyncInfo synchroniseDirectory(net.sourceforge.jwebunit.junit.WebTester tester, String directoryName, long maxWaitTimeMs, String shortDescription)
          Synchronises the directory and waits until the synchronisation has finished.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LAST_SYNC_INFO_ELEM_ID

protected static final String LAST_SYNC_INFO_ELEM_ID
See Also:
Constant Field Values

DEFAULT_MAX_SYNC_WAIT_TIME_MS

public static final long DEFAULT_MAX_SYNC_WAIT_TIME_MS
See Also:
Constant Field Values
Constructor Detail

DbCachingTestHelper

public DbCachingTestHelper(net.sourceforge.jwebunit.junit.WebTester tester)
Method Detail

synchroniseDirectory

public DbCachingTestHelper.SyncInfo synchroniseDirectory(String directoryName,
                                                         long maxWaitTimeMs)
Synchronises the directory and waits until the synchronisation has finished.

Parameters:
directoryName - name of the directory to synchronise
maxWaitTimeMs - maximum time in milliseconds to wait for the synchronisation to finish
Returns:
SyncInfo
Throws:
RuntimeException - if the synchronisation doesn't finish within maxWaitTimeMs milliseconds.

synchroniseDirectory

public DbCachingTestHelper.SyncInfo synchroniseDirectory(String directoryName,
                                                         long maxWaitTimeMs,
                                                         String shortDescription)
Synchronises the directory and waits until the synchronisation has finished.

Parameters:
directoryName - name of the directory to synchronise
maxWaitTimeMs - maximum time in milliseconds to wait for the synchronisation to finish
shortDescription - description about the synchronisation task
Returns:
SyncInfo
Throws:
RuntimeException - if the synchronisation doesn't finish within maxWaitTimeMs milliseconds.

synchroniseDirectory

public static DbCachingTestHelper.SyncInfo synchroniseDirectory(net.sourceforge.jwebunit.junit.WebTester tester,
                                                                String directoryName,
                                                                long maxWaitTimeMs)
Synchronises the directory and waits until the synchronisation has finished. Use as a convenience method for a one-off synchronisation. Otherwise instantiate an instance of DbCachingTestHelper.

Parameters:
tester - WebTester
directoryName - name of the directory to synchronise
maxWaitTimeMs - maximum time in milliseconds to wait for the synchronisation to finish
Throws:
RuntimeException - if the synchronisation doesn't finish within DEFAULT_MAX_SYNC_WAIT_TIME_MS milliseconds.

synchroniseDirectory

public static DbCachingTestHelper.SyncInfo synchroniseDirectory(net.sourceforge.jwebunit.junit.WebTester tester,
                                                                String directoryName,
                                                                long maxWaitTimeMs,
                                                                String shortDescription)
Synchronises the directory and waits until the synchronisation has finished. Use as a convenience method for a one-off synchronisation. Otherwise instantiate an instance of DbCachingTestHelper.

Parameters:
tester - WebTester
directoryName - name of the directory to synchronise
maxWaitTimeMs - maximum time in milliseconds to wait for the synchronisation to finish
shortDescription - description about the synchronisation task
Throws:
RuntimeException - if the synchronisation doesn't finish within DEFAULT_MAX_SYNC_WAIT_TIME_MS milliseconds.

syncDirectoryTask

public DbCachingTestHelper.PartialSyncTask syncDirectoryTask(String directoryName)
Creates a partial sync task. Typical usage would be: DbCachingTestHelper dbCachingTestHelper = new DbCachingTestHelper(tester); dbCachingTestHelper.syncDirectoryTask("ApacheDS). maxWaitMs(1000L). shortDescription("Adding 10 users"). sync();

Parameters:
directoryName - name of the directory to synchronise
Returns:
PartialSyncTask

isSynchronising

public boolean isSynchronising()
Returns true if the directory is currently being synchronised.

Returns:
true if the directory is currently being synchronised


Copyright © 2012 Atlassian. All Rights Reserved.