Package de.xima.fc.ms.test.workflow
Class AEventRunnerTest
- java.lang.Object
-
- de.xima.fc.ms.test.workflow.AWorkflowEngineTest
-
- de.xima.fc.ms.test.workflow.AEventRunnerTest
-
- All Implemented Interfaces:
DaoCrudMixin
public class AEventRunnerTest extends AWorkflowEngineTest
Base class for tests that want to test the workflow event runner, such as tests for specific triggers.- Since:
- 7.0.0
- Author:
- XIMA MEDIA GmbH
-
-
Field Summary
-
Fields inherited from class de.xima.fc.ms.test.workflow.AWorkflowEngineTest
client, dbConn, dbConnInvalid, ec, formData, formRecord, formVersion, group, groupOther, i18n, inbox, LOG, process, project, role, state, stateArchived, tempDir, testSystemInfo, user, userOther, version
-
-
Constructor Summary
Constructors Constructor Description AEventRunnerTest()
-
Method Summary
-
Methods inherited from class de.xima.fc.ms.test.workflow.AWorkflowEngineTest
assertAttachmentAccessibleByEndUsers, assertAttachmentContentJsonObject, assertAttachmentContentString, assertAttachmentContentString, assertAttachmentContentZippedString, assertAttachmentCount, assertAttachmentFileName, assertAttachmentFileName, assertAttachmentsAccessibleByEndUsers, assertAttachmentsAccessibleByEndUsers, assertAttachmentsContentJsonObject, assertAttachmentsContentJsonObject, assertAttachmentsContentString, assertAttachmentsContentString, assertAttachmentsContentString, assertAttachmentsFileName, assertAttachmentsFileName, assertAttachmentsFileName, assertEntriesAreEqual, assertHasLogEntriesOfType, assertHasNoAttachments, assertHasSingleLogEntryOfType, assertNoFormRecordChats, binaryResource, cleanupAfterAll, cleanupAfterEach, createClientResource, createClientResource, createClientResource, createFormData, createFormDataAdapter, createFormDataAdapter, createFormRecordResource, createFormRecordResource, createFormRecordResource, createProjectResource, createProjectResource, createProjectResource, createSleepNode, createTempDir, createTextFile, deleteTempDir, ec, formElement, getAttachmentContentData, getAttachmentContentJsonObject, getAttachmentContentString, getFormRecordAttachment, getFormRecordAttachment, getFormRecordAttachmentContentString, getFormRecordAttachments, getFormRecordAttachments, getFormRecordChat, getFormRecordChats, getProcessingProtcolEntriesByType, getSuccessValueAs, nodeKey, plainTextResource, plainTextResource, readBinaryFile, readBinaryFile, readFile, readFormRecord, registerQueryListener, reloadFormRecord, reloadProcess, reloadProject, runGenericAfterAllCleanupActions, runGenericAfterEachCleanupActions, saveAndReloadFormRecord, saveAndReloadProcess, saveAndReloadProject, setFormData, setupEntities, toJsonObject, updateClientLicense, updateFormDataWithPersistenceXml, updateFormVersionWithPersistJson, updateName, updateParams, updateParams, updateParams, uploadElement, waitUntilFormRecordLocked, waitUntilFormRecordLocked, waitUntilFormRecordLocked, waitUntilFormRecordLocked, waitUntilFormRecordUnlocked, waitUntilFormRecordUnlocked, waitUntilFormRecordUnlocked, waitUntilFormRecordUnlocked
-
-
-
-
Method Detail
-
addTo
protected void addTo(WorkflowTask task, WorkflowNode parent, int index, WorkflowNode childToAdd)
Adds the child to the given parent.- Parameters:
task
- Task to which to add the node.parent
- Parent to which to add a child.index
- Position where to add the child.childToAdd
- Child to add to the parent.
-
addTo
protected void addTo(WorkflowTask task, WorkflowNode parent, WorkflowNode childToAdd)
Adds the child to the given parent.- Parameters:
task
- Task to which to add the node.parent
- Parent to which to add a child.childToAdd
- Child to add to the parent.
-
addToRootSequence
protected void addToRootSequence(WorkflowTask task, WorkflowNode... nodes)
Adds the given node the root node, i.e. the main sequence of actions.- Parameters:
task
- Task to which to add the node.nodes
- Nodes to add.
-
addTriggers
protected void addTriggers(WorkflowTrigger... triggers)
-
assertContainsTriggers
protected void assertContainsTriggers(WorkflowTrigger... triggers)
-
assertFormRecordIsInState
protected void assertFormRecordIsInState(Vorgang formRecord, WorkflowState state)
-
assertFormRecordIsInState
protected void assertFormRecordIsInState(WorkflowState state)
-
assertInvokesTriggers
protected IEventExecutionResult assertInvokesTriggers(IFormRecordProvidingEvent event, WorkflowTrigger... triggers)
Asserts the given event invokes the given triggers, and only the given triggers; in the given order.- Parameters:
event
- Event to fire.triggers
- Triggers to check whether they are invoked.- Returns:
- The result of the workflow execution.
-
createAwaitTriggerInvokation
protected Runnable createAwaitTriggerInvokation(Duration waitTime, WorkflowTrigger trigger, int count)
-
createCountExecutionNode
protected WorkflowNode createCountExecutionNode(AtomicInteger counter)
-
createRecordNameNode
protected WorkflowNode createRecordNameNode(String name, Collection<String> names) throws FastJsonException
Creates a node that, upon execution, adds the name of the executed node to the given collection.- Parameters:
name
- Initial name for the node.names
- Collection to which to add the node's name.- Returns:
- A node that adds its name to the given collection when executed.
- Throws:
FastJsonException
- When the data could not be serialized.
-
formSubmissionEvent
protected IFormRecordProvidingEvent formSubmissionEvent()
-
formSubmissionEventBuilder
protected FormSubmissionEventDataBuilder formSubmissionEventBuilder()
-
runner
protected IWorkflowEventRunner runner()
-
setTasks
protected List<WorkflowTask> setTasks(int taskCount)
-
setTriggers
protected void setTriggers(WorkflowTrigger... triggers)
-
setXfAction
protected void setXfAction(String xfAction)
-
setXfQualifier
protected void setXfQualifier(String xfQualifier)
-
setupProcess
protected void setupProcess()
- Specified by:
setupProcess
in classAWorkflowEngineTest
-
triggerEvent
protected IEventExecutionResult triggerEvent(IFormRecordProvidingEvent event)
-
assertCounterDoesNotChange
protected static void assertCounterDoesNotChange(AtomicInteger counter, int expectedInitial, int seconds)
-
assertCounterReaches
protected static void assertCounterReaches(AtomicInteger counter, int target, int seconds)
-
assertCounterReachesOrHasReached
protected static void assertCounterReachesOrHasReached(AtomicInteger counter, int target, int seconds)
-
assertCounterReachesOrHasReachedAtLeast
protected static void assertCounterReachesOrHasReachedAtLeast(AtomicInteger counter, int target, int seconds)
-
assertDidFire
protected static void assertDidFire(IEventExecutionResult result, WorkflowTrigger trigger)
Asserts that the trigger did fire, i.e. that the associated processing chain was executed.- Parameters:
result
- Event execution result.trigger
- Trigger to check.
-
assertErrorData
protected static void assertErrorData(IEventExecutionResult result, WorkflowNode node, Object expectedData)
-
assertErrorData
protected static void assertErrorData(IEventExecutionResult result, WorkflowNode node, Object expectedData, int... indices)
-
assertErrorMessage
protected static void assertErrorMessage(IEventExecutionResult result, WorkflowNode node, String expectedMessage)
-
assertErrorMessage
protected static void assertErrorMessage(IEventExecutionResult result, WorkflowNode node, String expectedMessage, int... indices)
-
assertErrorType
protected static void assertErrorType(IEventExecutionResult result, WorkflowNode node, String expectedType)
-
assertErrorType
protected static void assertErrorType(IEventExecutionResult result, WorkflowNode node, String expectedType, int... indices)
-
assertExecutionFinishedOrder
protected static void assertExecutionFinishedOrder(IEventExecutionResult result, WorkflowNode... nodes)
Asserts that node executions finished in the given order.- Parameters:
result
- Result obtained from executing the workflow.nodes
- Expected order in which the nodes should have started.
-
assertExecutionFinishedOrderPartial
protected static void assertExecutionFinishedOrderPartial(IEventExecutionResult result, WorkflowNode... nodes)
Asserts that node executions finished in the given order. Only checks the relative order of the given expected nodes, does not check that no other nodes were executed in between the expected nodes.- Parameters:
result
- Result obtained from executing the workflow.nodes
- Expected order in which the nodes should have finished.
-
assertExecutionStartedOrder
protected static void assertExecutionStartedOrder(IEventExecutionResult result, WorkflowNode... nodes)
Asserts that node executions started in the given order.- Parameters:
result
- Result obtained from executing the workflow.nodes
- Expected order in which the nodes should have started.
-
assertExecutionStartedOrderPartial
protected static void assertExecutionStartedOrderPartial(IEventExecutionResult result, WorkflowNode... nodes)
Asserts that node executions started in the given order. Only checks the relative order of the given expected nodes, does not check that no other nodes were executed in between the expected nodes.- Parameters:
result
- Result obtained from executing the workflow.nodes
- Expected order in which the nodes should have started.
-
assertFailure
protected static ITaskExecutionErrorResult assertFailure(IEventExecutionResult result)
-
assertFailure
@CanIgnoreReturnValue protected static NodeThrewException assertFailure(IEventExecutionResult result, WorkflowNode node)
-
assertFailure
protected static NodeThrewException assertFailure(IEventExecutionResult result, WorkflowNode node, int... indices)
-
assertNodeCompletionType
protected static ENodeCompletionType assertNodeCompletionType(ENodeCompletionType expected, IEventExecutionResult result, WorkflowNode node, int... indices)
-
assertNodeExecutionCount
protected static void assertNodeExecutionCount(IEventExecutionResult result, WorkflowNode node, int expectedCount)
-
assertNodeSuccessResultAtKeyEquals
protected static void assertNodeSuccessResultAtKeyEquals(Object expected, IEventExecutionResult result, WorkflowNode node, String key)
-
assertNodeSuccessResultAtKeyEquals
protected static void assertNodeSuccessResultAtKeyEquals(Object expected, IWorkflowNodeResult result, String key)
-
assertServletResponseContentString
protected static void assertServletResponseContentString(IEventExecutionResult result, String content) throws UnsupportedEncodingException
Asserts that the text content of the servlet response of the given event execution result equals the expected value. Uses the encoding of the servlet response to decode the binary content.- Parameters:
result
- Event execution result.content
- The expected content.- Throws:
UnsupportedEncodingException
- When the servlet response contains an unsupported encoding.
-
assertSuccess
protected static ITaskExecutionSuccessResult assertSuccess(IEventExecutionResult result)
-
assertSuccess
protected static ISuccessResultData assertSuccess(IEventExecutionResult result, WorkflowNode node)
-
assertSuccess
protected static ISuccessResultData assertSuccess(IEventExecutionResult result, WorkflowNode node, int... indices)
-
assertWasExecuted
protected static void assertWasExecuted(IEventExecutionResult result, WorkflowNode node)
Asserts that the given node was executed.- Parameters:
result
- Result obtained from executing the workflow.node
- Node to check.
-
assertWasExecutedNTimes
@Deprecated protected static void assertWasExecutedNTimes(IEventExecutionResult result, int count, WorkflowNode node)
Deprecated.Asserts that the given node was executed the given number of times.- Parameters:
result
- Result obtained from executing the workflow.count
- Number of expected executions.node
- Node to check.
-
assertWasExecutedNTimes
protected static void assertWasExecutedNTimes(int expectedCount, IEventExecutionResult result, WorkflowNode node)
Asserts that the given node was executed the given number of times.- Parameters:
result
- Result obtained from executing the workflow.expectedCount
- Number of expected executions.node
- Node to check.
-
assertWasNotExecuted
protected static void assertWasNotExecuted(IEventExecutionResult result, WorkflowNode node)
Asserts that the given node was not executed.- Parameters:
result
- Result obtained from executing the workflow.node
- Node to check.
-
getNodeErrorMessage
protected static String getNodeErrorMessage(IEventExecutionResult result, WorkflowNode node)
-
getNodeErrorMessage
protected static String getNodeErrorMessage(NodeThrewException error)
-
getNodeErrorResultAtPath
protected static Object getNodeErrorResultAtPath(IEventExecutionResult result, WorkflowNode node, String path)
-
getNodeErrorResultAtPath
protected static <T> T getNodeErrorResultAtPath(IEventExecutionResult result, WorkflowNode node, String path, Class<T> type)
-
getNodeErrorResultAtPath
protected static Object getNodeErrorResultAtPath(NodeThrewException result, String path)
-
getNodeErrorResultAtPath
protected static <T> T getNodeErrorResultAtPath(NodeThrewException result, String path, Class<T> type)
-
getNodeErrorResultAtPath
protected static <T> T getNodeErrorResultAtPath(Object errorResult, String path, Class<T> type)
-
getNodeErrorResultValue
protected static Object getNodeErrorResultValue(IEventExecutionResult result, WorkflowNode node)
-
getNodeErrorResultValue
protected static Object getNodeErrorResultValue(NodeThrewException nodeThrewException)
-
getNodeErrorType
protected static String getNodeErrorType(IEventExecutionResult result, WorkflowNode node)
-
getNodeErrorType
protected static String getNodeErrorType(NodeThrewException error)
-
getNodeExecutionCount
protected static int getNodeExecutionCount(IEventExecutionResult result, WorkflowNode node)
-
getNodeResult
protected static IWorkflowNodeResult getNodeResult(IEventExecutionResult result, WorkflowNode node)
-
getNodeResult
protected static IWorkflowNodeResult getNodeResult(IEventExecutionResult result, WorkflowNode node, int... indices)
-
getNodeResults
protected static List<IWorkflowNodeResult> getNodeResults(IEventExecutionResult result, WorkflowNode node)
-
getNodeSoftError
protected static NodeSoftErrorException getNodeSoftError(IEventExecutionResult result, WorkflowNode node)
-
getNodeSoftError
protected static NodeSoftErrorException getNodeSoftError(IWorkflowNodeResult nodeResult)
-
getNodeSoftErrorMessage
protected static String getNodeSoftErrorMessage(IEventExecutionResult result, WorkflowNode node)
-
getNodeSoftErrorMessage
protected static String getNodeSoftErrorMessage(IWorkflowNodeResult nodeResult)
-
getNodeSoftErrorMessages
protected static List<String> getNodeSoftErrorMessages(IEventExecutionResult result, WorkflowNode node)
-
getNodeSoftErrorMessages
protected static List<String> getNodeSoftErrorMessages(IWorkflowNodeResult nodeResult)
-
getNodeSoftErrorResultAtPath
protected static Object getNodeSoftErrorResultAtPath(IEventExecutionResult result, WorkflowNode node, String path)
-
getNodeSoftErrorResultAtPath
protected static <T> T getNodeSoftErrorResultAtPath(IEventExecutionResult result, WorkflowNode node, String path, Class<T> type)
-
getNodeSoftErrorResultAtPath
protected static Object getNodeSoftErrorResultAtPath(IWorkflowNodeResult nodeResult, String path)
-
getNodeSoftErrorResultAtPath
protected static <T> T getNodeSoftErrorResultAtPath(IWorkflowNodeResult nodeResult, String path, Class<T> type)
-
getNodeSoftErrorResultValue
protected static Object getNodeSoftErrorResultValue(IEventExecutionResult result, WorkflowNode node)
-
getNodeSoftErrorResultValue
protected static Object getNodeSoftErrorResultValue(IWorkflowNodeResult nodeResult)
-
getNodeSoftErrorResultValues
protected static List<Object> getNodeSoftErrorResultValues(IEventExecutionResult result, WorkflowNode node)
-
getNodeSoftErrorResultValues
protected static List<Object> getNodeSoftErrorResultValues(IWorkflowNodeResult nodeResult)
-
getNodeSoftErrorResultsAtPath
protected static List<Object> getNodeSoftErrorResultsAtPath(IEventExecutionResult result, WorkflowNode node, String path)
-
getNodeSoftErrorResultsAtPath
protected static <T> List<T> getNodeSoftErrorResultsAtPath(IEventExecutionResult result, WorkflowNode node, String path, Class<T> type)
-
getNodeSoftErrorResultsAtPath
protected static List<Object> getNodeSoftErrorResultsAtPath(IWorkflowNodeResult nodeResult, String path)
-
getNodeSoftErrorResultsAtPath
protected static <T> List<T> getNodeSoftErrorResultsAtPath(IWorkflowNodeResult nodeResult, String path, Class<T> type)
-
getNodeSoftErrorType
protected static String getNodeSoftErrorType(IEventExecutionResult result, WorkflowNode node)
-
getNodeSoftErrorType
protected static String getNodeSoftErrorType(IWorkflowNodeResult nodeResult)
-
getNodeSoftErrorTypes
protected static List<String> getNodeSoftErrorTypes(IEventExecutionResult result, WorkflowNode node)
-
getNodeSoftErrorTypes
protected static List<String> getNodeSoftErrorTypes(IWorkflowNodeResult nodeResult)
-
getNodeSoftErrors
protected static List<NodeSoftErrorException> getNodeSoftErrors(IEventExecutionResult result, WorkflowNode node)
-
getNodeSoftErrors
protected static List<NodeSoftErrorException> getNodeSoftErrors(IWorkflowNodeResult nodeResult)
-
getNodeSuccessResultAtKey
protected static Object getNodeSuccessResultAtKey(IEventExecutionResult result, WorkflowNode node, String key)
-
getNodeSuccessResultAtKey
protected static <T> T getNodeSuccessResultAtKey(IEventExecutionResult result, WorkflowNode node, String key, Class<T> type)
-
getNodeSuccessResultAtKey
protected static Object getNodeSuccessResultAtKey(IWorkflowNodeResult result, String key)
-
getNodeSuccessResultAtKey
protected static <T> T getNodeSuccessResultAtKey(IWorkflowNodeResult result, String key, Class<T> type)
-
getNodeSuccessResultAtKey
protected static <T> T getNodeSuccessResultAtKey(Object successResult, String key, Class<T> type)
-
getNodeSuccessResultAtPath
protected static Object getNodeSuccessResultAtPath(IEventExecutionResult result, WorkflowNode node, String path)
-
getNodeSuccessResultAtPath
protected static <T> T getNodeSuccessResultAtPath(IEventExecutionResult result, WorkflowNode node, String path, Class<T> type)
-
getNodeSuccessResultAtPath
protected static Object getNodeSuccessResultAtPath(IWorkflowNodeResult result, String path)
-
getNodeSuccessResultAtPath
protected static <T> T getNodeSuccessResultAtPath(IWorkflowNodeResult result, String path, Class<T> type)
-
getNodeSuccessResultAtPath
protected static <T> T getNodeSuccessResultAtPath(Object successResult, String path, Class<T> type)
-
getNodeSuccessResultData
protected static ISuccessResultData getNodeSuccessResultData(IEventExecutionResult result, WorkflowNode node)
-
getNodeSuccessResultValue
protected static Object getNodeSuccessResultValue(IEventExecutionResult result, WorkflowNode node)
-
getNodeSuccessResultValue
protected static Object getNodeSuccessResultValue(IWorkflowNodeResult nodeResult)
-
getNodeThrewException
protected static NodeThrewException getNodeThrewException(IEventExecutionResult result, WorkflowNode node)
-
getNodeThrewException
protected static NodeThrewException getNodeThrewException(IEventExecutionResult result, WorkflowNode node, int... indices)
-
getRootNode
protected static WorkflowNode getRootNode(WorkflowTrigger trigger)
-
getServletResponse
protected static IServletResponse getServletResponse(IEventExecutionResult result)
Gets the servlet response of the given event execution result. Also asserts that a servlet response is present.- Parameters:
result
- Event execution result.- Returns:
- The servlet response.
-
getServletResponseContentString
protected static String getServletResponseContentString(IEventExecutionResult result) throws UnsupportedEncodingException
Gets the text content of the servlet response of the given event execution result. Uses the encoding of the servlet response to decode the binary content.- Parameters:
result
- Event execution result.- Returns:
- The text content of the servlet response.
- Throws:
UnsupportedEncodingException
- When the servlet response contains an unsupported encoding.
-
valueAttachment
protected static Map<String,Object> valueAttachment(UUID uuid, String source, Map<String,Object> file)
-
valueAttachment
protected static Map<String,Object> valueAttachment(String uuid, String source, Map<String,Object> file)
-
valueFileItem
protected static Map<String,Object> valueFileItem(String fileName, String mimeType, long fileSizeBytes) throws javax.activation.MimeTypeParseException
- Throws:
javax.activation.MimeTypeParseException
-
valueMimeType
protected static Map<String,Object> valueMimeType(String mimeType) throws javax.activation.MimeTypeParseException
- Throws:
javax.activation.MimeTypeParseException
-
-