public final class TestUtilities extends Object
Modifier and Type | Method and Description |
---|---|
static void |
assertApprovals(String docId,
String[] users,
boolean shouldHaveApproval)
Asserts that the specified users do or do not have outstanding approvals
|
static void |
assertAtNode(String message,
WorkflowDocument document,
String nodeNameToAssert)
Checks that the document is at a node with the given name.
|
static void |
assertAtNode(WorkflowDocument document,
String nodeName) |
static void |
assertAtNodeNew(String message,
WorkflowDocument document,
String nodeName)
Checks that the document is at a node with the given name.
|
static void |
assertAtNodeNew(WorkflowDocument document,
String nodeName) |
static void |
assertInActionList(String principalId,
String documentId)
Asserts that the given document id is in the given user's action list.
|
static void |
assertNotInActionList(String principalId,
String documentId)
Asserts that the given document id is NOT in the given user's action list.
|
static void |
assertNumberOfPendingRequests(String documentId,
int numberOfPendingRequests) |
static void |
assertUserHasPendingRequest(String documentId,
String principalName)
Asserts that the user with the given network id has a pending request on the given document
|
static void |
cleanupPluginDirectories() |
static void |
clearTables(org.springframework.transaction.PlatformTransactionManager transactionManager,
DataSource dataSource,
String edenSchemaName,
List<String> dontClear) |
static Set<String> |
createNodeInstanceNameSet(Collection nodeInstances) |
static File |
createTempDir() |
static <T extends Throwable> |
findExceptionInStack(Throwable topLevelException,
Class<T> exceptionClass)
This method searches for an exception of the specified type in the exception stack
|
static Thread |
getExceptionThreader() |
static org.springframework.jdbc.core.JdbcTemplate |
getJdbcTemplate() |
static File |
getPluginsDirectory() |
static String |
getTestPlatform()
Attempts to derive the database "platform" to use for unit tests by
inspected Ant build.properties files in typical locations.
|
static org.springframework.transaction.support.TransactionTemplate |
getTransactionTemplate() |
static void |
initializePluginDirectories() |
static InputStream |
loadResource(Class packageClass,
String resourceName) |
static void |
logActionRequests(String docId) |
static void |
setExceptionThreader(Thread exceptionThreader) |
static WorkflowDocument |
switchByPrincipalName(String principalName,
WorkflowDocument document) |
static WorkflowDocument |
switchPrincipalId(String principalId,
WorkflowDocument document) |
static void |
verifyTestEnvironment(DataSource dataSource) |
static void |
waitForExceptionRouting()
Waits "indefinately" for the exception routing thread to terminate.
|
static void |
waitForExceptionRouting(long milliseconds) |
public static InputStream loadResource(Class packageClass, String resourceName)
public static org.springframework.transaction.support.TransactionTemplate getTransactionTemplate()
public static void verifyTestEnvironment(DataSource dataSource)
public static void clearTables(org.springframework.transaction.PlatformTransactionManager transactionManager, DataSource dataSource, String edenSchemaName, List<String> dontClear)
public static Set<String> createNodeInstanceNameSet(Collection nodeInstances)
public static void assertAtNode(String message, WorkflowDocument document, String nodeNameToAssert)
public static void assertAtNode(WorkflowDocument document, String nodeName) throws WorkflowException
WorkflowException
public static void assertAtNodeNew(String message, WorkflowDocument document, String nodeName) throws WorkflowException
WorkflowException
public static void assertAtNodeNew(WorkflowDocument document, String nodeName) throws WorkflowException
WorkflowException
public static void assertInActionList(String principalId, String documentId)
public static void assertNotInActionList(String principalId, String documentId)
public static void assertNumberOfPendingRequests(String documentId, int numberOfPendingRequests)
public static void assertUserHasPendingRequest(String documentId, String principalName) throws WorkflowException
WorkflowException
public static void assertApprovals(String docId, String[] users, boolean shouldHaveApproval) throws WorkflowException
docId
- the id of the documentusers
- the list of usersshouldHaveApproval
- whether they should have an approval outstandingWorkflowException
public static WorkflowDocument switchByPrincipalName(String principalName, WorkflowDocument document) throws WorkflowException
WorkflowException
public static WorkflowDocument switchPrincipalId(String principalId, WorkflowDocument document) throws WorkflowException
WorkflowException
public static void logActionRequests(String docId)
public static org.springframework.jdbc.core.JdbcTemplate getJdbcTemplate()
public static void waitForExceptionRouting()
public static void waitForExceptionRouting(long milliseconds)
public static Thread getExceptionThreader()
public static void setExceptionThreader(Thread exceptionThreader)
public static String getTestPlatform() throws IOException
IOException
- if anything goes awryDEFAULT_TEST_PLATFORM
public static File createTempDir() throws Exception
Exception
public static File getPluginsDirectory()
public static void initializePluginDirectories() throws Exception
Exception
public static void cleanupPluginDirectories() throws Exception
Exception
public static <T extends Throwable> T findExceptionInStack(Throwable topLevelException, Class<T> exceptionClass)
topLevelException
- the exception whose stack to traverseexceptionClass
- the exception class to look forCopyright © 2005–2014 The Kuali Foundation. All rights reserved.