Class AWorkflowEngineTest
java.lang.Object
de.xima.fc.ms.test.workflow.AWorkflowEngineTest
- All Implemented Interfaces:
DaoCrudMixin
- Direct Known Subclasses:
AEventRunnerTest
Base test for all workflow tests that created the workflow process.
- Since:
- 7.0.0
- Author:
- XIMA MEDIA GmbH
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Mandantprotected DatenbankZugriffprotected DatenbankZugriffprotected IEntityContextHolderprotected FormEingangprotected Vorgangprotected FormVersionprotected BenutzerGruppeprotected BenutzerGruppeprotected Textbausteinprotected Postfachprotected static final org.slf4j.Loggerprotected WorkflowProcessprotected Projektprotected Rolleprotected WorkflowStateprotected WorkflowStateprotected Pathprotected TestSystemInfoprotected IUserprotected IUserprotected WorkflowVersion -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidassertAttachmentAccessibleByEndUsers(EAttachmentSource source, boolean value) protected voidassertAttachmentContentJsonObject(EAttachmentSource source, Predicate<String> nameFilter, Object value) protected voidassertAttachmentContentString(EAttachmentSource source, String value) protected voidassertAttachmentContentString(EAttachmentSource source, Predicate<String> nameFilter, String value) protected voidassertAttachmentContentZippedString(Map<String, String> expectedFiles, Attachment attachment) protected voidassertAttachmentCount(EAttachmentSource source, int expectedCount) protected voidassertAttachmentFileName(EAttachmentSource source, String value) protected voidassertAttachmentFileName(EAttachmentSource source, Predicate<String> nameFilter, String value) protected voidassertAttachmentsAccessibleByEndUsers(EAttachmentSource source, boolean... values) protected voidassertAttachmentsAccessibleByEndUsers(List<Attachment> attachments, boolean... values) protected voidassertAttachmentsContentJsonObject(EAttachmentSource source, Predicate<String> nameFilter, Object... values) protected voidassertAttachmentsContentJsonObject(List<Attachment> attachments, Object... values) protected voidassertAttachmentsContentString(EAttachmentSource source, String... values) protected voidassertAttachmentsContentString(EAttachmentSource source, Predicate<String> nameFilter, String... values) protected voidassertAttachmentsContentString(List<Attachment> attachments, String... values) protected voidassertAttachmentsFileName(EAttachmentSource source, String... values) protected voidassertAttachmentsFileName(EAttachmentSource source, Predicate<String> nameFilter, String... values) protected voidassertAttachmentsFileName(List<Attachment> attachments, String... values) protected voidassertEntriesAreEqual(Map<?, ?> expectedSubset, Map<?, ?> actual) protected List<ProtocolEntryProcessing> assertHasLogEntriesOfType(EProtocolEntryProcessType expectedType, int expectedAmount) protected voidprotected ProtocolEntryProcessingprotected voidprotected byte[]binaryResource(String resourcePath) protected static voidcleanupAfterAll(AutoCloseable cleanupAction) protected voidcleanupAfterEach(AutoCloseable cleanupAction) protected MandantRessourcecreateClientResource(@NotNull String name, @NotNull byte[] resourceData, @NotNull String resourceDescription) Creates a client resource where the resource- and the file-name are the same.protected MandantRessourcecreateClientResource(@NotNull String resourceName, @NotNull String fileName, @NotNull byte[] resourceData, @NotNull String resourceDescription) protected MandantRessourcecreateClientResource(@NotNull String name, @NotNull String resourceData, @NotNull String resourceDescription) Creates a client resource where the resource- and the file-name are the same.protected voidcreateFormData(String fileName, String... formElements) Deprecated.protected IFormDataAdapterCreates the form data adapter for accessing the values of the current form submission.protected IFormDataAdaptercreateFormDataAdapter(FormEingang formData) Creates the form data adapter for accessing the values of the given form submission.protected AttachmentcreateFormRecordResource(@NotNull String attachmentFilename, EAttachmentSource attachmentSource, @NotNull byte[] resourceData, Date editDate, String uploadElementName) protected AttachmentcreateFormRecordResource(@NotNull String attachmentFilename, EAttachmentSource attachmentSource, @NotNull String resourceData, Date editDate, String uploadElementName) protected AttachmentcreateFormRecordResource(String attachmentFilename, EAttachmentSource attachmentSource, String resourceData) protected ProjektRessourcecreateProjectResource(@NotNull String name, @NotNull byte[] resourceData, @NotNull String resourceDescription) Creates a project resource where the resource- and the file-name are the same.protected ProjektRessourcecreateProjectResource(@NotNull String resourceName, @NotNull String fileName, @NotNull byte[] resourceData, @NotNull String resourceDescription) protected ProjektRessourcecreateProjectResource(String name, String content) Creates a project resource where the resource- and the file-name are the same.protected ProjektRessourcecreateProjectResource(String name, String resourceData, String resourceDescription) Creates a project resource where the resource- and the file-name are the same.protected WorkflowNodecreateSleepNode(int sleepTimeMillis) protected voidprotected PathcreateTextFile(String fileName, String content) protected voidec()protected FormElementformElement(String name) protected byte[]getAttachmentContentData(Attachment attachment) protected com.alibaba.fastjson.JSONObjectgetAttachmentContentJsonObject(Attachment attachment) protected StringgetAttachmentContentString(Attachment attachment) protected Attachmentprotected AttachmentgetFormRecordAttachment(EAttachmentSource source, Predicate<String> nameFilter) protected Stringprotected List<Attachment> protected List<Attachment> getFormRecordAttachments(EAttachmentSource source, Predicate<String> nameFilter) protected FormRecordChatprotected List<FormRecordChat> protected List<ProtocolEntryProcessing> getProcessingProtcolEntriesByType(Vorgang formRecord, EProtocolEntryProcessType... types) protected ObjectgetSuccessValue(IEventExecutionResult result, AWorkflowElement<?, ?> element) protected <T> TgetSuccessValueAs(IEventExecutionResult result, AWorkflowElement<?, ?> element, Class<T> expectedType) protected DummyUserCreatorprotected static NodeKeynodeKey(WorkflowTrigger trigger, WorkflowNode node) protected StringplainTextResource(String resourcePath) protected StringplainTextResource(String resourcePath, Charset charset) protected byte[]readBinaryFile(File file) protected byte[]readBinaryFile(Path file) protected Stringprotected VorgangreadFormRecord(Long id) protected <T extends de.xima.cmn.dao.interfaces.IEntity<?>, E extends de.xima.cmn.dao.interfaces.IBaseEntityContext>
voidregisterQueryListener(de.xima.cmn.dao.interfaces.IAbstractDao<T, ?, E> dao, de.xima.cmn.dao.enums.EDaoAction action, de.xima.cmn.dao.enums.EDaoActionState state, de.xima.cmn.dao.interfaces.IDaoActionListener<T, E> listener) protected voidprotected voidprotected voidprotected static voidprotected voidprotected voidprotected voidprotected voidprotected voidsetFormData(Map<String, Object> dataToSet) Sets the submitted form data for the current form record to the given values.protected voidprotected abstract voidprotected com.alibaba.fastjson.JSONObjecttoJsonObject(Object data) protected voidupdateClientLicense(String licenseKey, String pathToLicenseFile) protected voidupdateFormDataWithPersistenceXml(String fileName) Updates the current form record with the form field values from the given persistence XML.protected voidupdateFormVersionWithPersistJson(String fileName, String... formElements) Updates the current form version with the persist JSON from the given file.protected <TElement extends IWorkflowElementEntity, TSearchTerm extends AWorkflowElementSearchTerm<TElement>, TData extends BaseActionProps>
voidupdateName(AWorkflowElement<TElement, TSearchTerm> element, String name) protected <TElement extends IWorkflowElementEntity, TSearchTerm extends AWorkflowElementSearchTerm<TElement>, TData>
voidupdateParams(AWorkflowElement<TElement, TSearchTerm> element, IElementHandler<TData, TElement> handler, Consumer<TData> updater) protected <TElement extends IWorkflowElementEntity, TSearchTerm extends AWorkflowElementSearchTerm<TElement>, TData>
voidupdateParams(AWorkflowElement<TElement, TSearchTerm> element, Class<TData> type, Consumer<TData> updater) protected <TElement extends IWorkflowElementEntity, TSearchTerm extends AWorkflowElementSearchTerm<TElement>>
voidupdateParams(AWorkflowElement<TElement, TSearchTerm> element, Consumer<Object> updater) protected FormElementuploadElement(String name) protected AutoCloseableprotected AutoCloseablewaitUntilFormRecordLocked(int timeoutSeconds) protected AutoCloseablewaitUntilFormRecordLocked(long formRecordId) protected AutoCloseablewaitUntilFormRecordLocked(long formRecordId, int timeoutSeconds) protected voidprotected voidwaitUntilFormRecordUnlocked(int timeoutSeconds) protected voidwaitUntilFormRecordUnlocked(long formRecordId) protected voidwaitUntilFormRecordUnlocked(long formRecordId, int timeoutSeconds)
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOG -
client
-
dbConn
-
dbConnInvalid
-
ec
-
formData
-
formRecord
-
formVersion
-
group
-
groupOther
-
i18n
-
inbox
-
process
-
project
-
role
-
state
-
stateArchived
-
tempDir
-
testSystemInfo
-
user
-
userOther
-
version
-
-
Constructor Details
-
AWorkflowEngineTest
public AWorkflowEngineTest()
-
-
Method Details
-
ec
- Specified by:
ecin interfaceDaoCrudMixin- Returns:
- The entity context to use for database operations.
-
assertAttachmentAccessibleByEndUsers
-
assertAttachmentContentJsonObject
protected void assertAttachmentContentJsonObject(EAttachmentSource source, Predicate<String> nameFilter, Object value) -
assertAttachmentContentString
protected void assertAttachmentContentString(EAttachmentSource source, Predicate<String> nameFilter, String value) -
assertAttachmentContentString
-
assertAttachmentContentZippedString
protected void assertAttachmentContentZippedString(Map<String, String> expectedFiles, Attachment attachment) throws IOException- Throws:
IOException
-
assertAttachmentCount
-
assertAttachmentFileName
protected void assertAttachmentFileName(EAttachmentSource source, Predicate<String> nameFilter, String value) -
assertAttachmentFileName
-
assertAttachmentsAccessibleByEndUsers
-
assertAttachmentsAccessibleByEndUsers
protected void assertAttachmentsAccessibleByEndUsers(List<Attachment> attachments, boolean... values) -
assertAttachmentsContentJsonObject
protected void assertAttachmentsContentJsonObject(EAttachmentSource source, Predicate<String> nameFilter, Object... values) -
assertAttachmentsContentJsonObject
-
assertAttachmentsContentString
protected void assertAttachmentsContentString(EAttachmentSource source, Predicate<String> nameFilter, String... values) -
assertAttachmentsContentString
-
assertAttachmentsContentString
-
assertAttachmentsFileName
protected void assertAttachmentsFileName(EAttachmentSource source, Predicate<String> nameFilter, String... values) -
assertAttachmentsFileName
-
assertAttachmentsFileName
-
assertEntriesAreEqual
-
assertHasLogEntriesOfType
protected List<ProtocolEntryProcessing> assertHasLogEntriesOfType(EProtocolEntryProcessType expectedType, int expectedAmount) -
assertHasNoAttachments
-
assertHasSingleLogEntryOfType
-
assertNoFormRecordChats
protected void assertNoFormRecordChats() -
binaryResource
-
cleanupAfterEach
-
createClientResource
protected MandantRessource createClientResource(@NotNull @NotNull String name, @NotNull @NotNull byte[] resourceData, @NotNull @NotNull String resourceDescription) throws Exception Creates a client resource where the resource- and the file-name are the same.- Parameters:
name- Name of the file.resourceData- Contents of the file.resourceDescription- Description of the file.- Returns:
- The newly created client resource.
- Throws:
Exception- When the resource could not be created, such as due to a database error.
-
createClientResource
-
createClientResource
protected MandantRessource createClientResource(@NotNull @NotNull String name, @NotNull @NotNull String resourceData, @NotNull @NotNull String resourceDescription) throws Exception Creates a client resource where the resource- and the file-name are the same.- Parameters:
name- Name of the file.resourceData- Contents of the file.resourceDescription- Description of the file.- Returns:
- The newly created client resource.
- Throws:
Exception- When the resource could not be created, such as due to a database error.
-
createFormData
Deprecated.Creates form data for the current form record.- Parameters:
fileName- XML and JSON file with the form data. If it starts with a slash: a full path to a classpath resource, without the extension. Otherwise it should be a file name without an extension, which is looked up as a classpath resource in the/forms/folder.formElements- Names of the form elements to make available.
-
createFormDataAdapter
Creates the form data adapter for accessing the values of the current form submission.- Returns:
- The form data adapter.
-
createFormDataAdapter
Creates the form data adapter for accessing the values of the given form submission.- Parameters:
formData- The form submission to create the adapter for.- Returns:
- The form data adapter.
-
createFormRecordResource
protected Attachment createFormRecordResource(@NotNull @NotNull String attachmentFilename, EAttachmentSource attachmentSource, @NotNull @NotNull byte[] resourceData, @Nullable Date editDate, @Nullable String uploadElementName) throws Exception - Throws:
Exception
-
createFormRecordResource
protected Attachment createFormRecordResource(String attachmentFilename, EAttachmentSource attachmentSource, String resourceData) throws Exception - Throws:
Exception
-
createFormRecordResource
protected Attachment createFormRecordResource(@NotNull @NotNull String attachmentFilename, EAttachmentSource attachmentSource, @NotNull @NotNull String resourceData, @Nullable Date editDate, @Nullable String uploadElementName) throws Exception - Throws:
Exception
-
createProjectResource
protected ProjektRessource createProjectResource(@NotNull @NotNull String name, @NotNull @NotNull byte[] resourceData, @NotNull @NotNull String resourceDescription) throws Exception Creates a project resource where the resource- and the file-name are the same.- Parameters:
name- Name of the file.resourceData- Content of the file.resourceDescription- Description of the file.- Returns:
- The newly create form file.
- Throws:
Exception- When the file could not be created, such as due to a database error.
-
createProjectResource
-
createProjectResource
protected ProjektRessource createProjectResource(String name, String resourceData, String resourceDescription) throws Exception Creates a project resource where the resource- and the file-name are the same.- Parameters:
name- Name of the file.resourceData- Content of the file.resourceDescription- Description of the file.- Returns:
- The newly create form file.
- Throws:
Exception- When the file could not be created, such as due to a database error.
-
createProjectResource
Creates a project resource where the resource- and the file-name are the same.- Parameters:
name- Name of the file.content- Content of the file.- Returns:
- The newly create form file.
- Throws:
Exception- When the file could not be created, such as due to a database error.
-
createSleepNode
- Throws:
FastJsonException
-
createTempDir
- Throws:
IOException
-
createTextFile
- Throws:
IOException
-
deleteTempDir
@AfterEach protected void deleteTempDir() -
formElement
-
getAttachmentContentData
-
getAttachmentContentJsonObject
-
getAttachmentContentString
-
getFormRecordAttachment
-
getFormRecordAttachment
protected Attachment getFormRecordAttachment(EAttachmentSource source, Predicate<String> nameFilter) -
getFormRecordAttachmentContentString
-
getFormRecordAttachments
-
getFormRecordAttachments
protected List<Attachment> getFormRecordAttachments(EAttachmentSource source, Predicate<String> nameFilter) -
getFormRecordChat
-
getFormRecordChats
-
getProcessingProtcolEntriesByType
protected List<ProtocolEntryProcessing> getProcessingProtcolEntriesByType(Vorgang formRecord, EProtocolEntryProcessType... types) -
getSuccessValue
-
getSuccessValueAs
protected <T> T getSuccessValueAs(IEventExecutionResult result, AWorkflowElement<?, ?> element, Class<T> expectedType) -
plainTextResource
-
plainTextResource
-
readBinaryFile
- Throws:
IOException
-
readBinaryFile
- Throws:
IOException
-
readFile
- Throws:
IOException
-
readFormRecord
-
registerQueryListener
protected <T extends de.xima.cmn.dao.interfaces.IEntity<?>, E extends de.xima.cmn.dao.interfaces.IBaseEntityContext> void registerQueryListener(de.xima.cmn.dao.interfaces.IAbstractDao<T, ?, E> dao, de.xima.cmn.dao.enums.EDaoAction action, de.xima.cmn.dao.enums.EDaoActionState state, de.xima.cmn.dao.interfaces.IDaoActionListener<T, E> listener) -
reloadFormRecord
protected void reloadFormRecord() -
reloadProcess
protected void reloadProcess() -
reloadProject
protected void reloadProject() -
runGenericAfterEachCleanupActions
-
saveAndReloadFormRecord
protected void saveAndReloadFormRecord() -
saveAndReloadProcess
protected void saveAndReloadProcess() -
saveAndReloadProject
protected void saveAndReloadProject() -
setFormData
Sets the submitted form data for the current form record to the given values. The map key is the name of the form element, and the value is the value to set. The value may be either a single string or a list of strings.- Parameters:
dataToSet- The form data to set.
-
setupEntities
-
setupProcess
protected abstract void setupProcess() -
toJsonObject
-
updateClientLicense
- Throws:
IOException
-
updateFormDataWithPersistenceXml
Updates the current form record with the form field values from the given persistence XML.- Parameters:
fileName- XML file with the persistence JSON. If it starts with a slash: a full path to a classpath resource, without the extension. Otherwise, it should be a file name without an extension, which is looked up as a classpath resource in the/forms/folder.
-
updateFormVersionWithPersistJson
Updates the current form version with the persist JSON from the given file.- Parameters:
fileName- JSON file with the persist JSON. If it starts with a slash: a full path to a classpath resource, without the extension. Otherwise, it should be a file name without an extension, which is looked up as a classpath resource in the/forms/folder.formElements- Names of the form elements to make available. When empty, all elements in the given persist JSON are added.
-
updateName
protected <TElement extends IWorkflowElementEntity, TSearchTerm extends AWorkflowElementSearchTerm<TElement>, TData extends BaseActionProps> void updateName(AWorkflowElement<TElement, TSearchTerm> element, String name) -
updateParams
protected <TElement extends IWorkflowElementEntity, TSearchTerm extends AWorkflowElementSearchTerm<TElement>, TData> void updateParams(AWorkflowElement<TElement, TSearchTerm> element, Class<TData> type, Consumer<TData> updater) -
updateParams
protected <TElement extends IWorkflowElementEntity, TSearchTerm extends AWorkflowElementSearchTerm<TElement>> void updateParams(AWorkflowElement<TElement, TSearchTerm> element, Consumer<Object> updater) -
updateParams
protected <TElement extends IWorkflowElementEntity, TSearchTerm extends AWorkflowElementSearchTerm<TElement>, TData> void updateParams(AWorkflowElement<TElement, TSearchTerm> element, IElementHandler<TData, TElement> handler, Consumer<TData> updater) -
uploadElement
-
waitUntilFormRecordLocked
-
waitUntilFormRecordLocked
-
waitUntilFormRecordLocked
-
waitUntilFormRecordLocked
-
waitUntilFormRecordUnlocked
protected void waitUntilFormRecordUnlocked() -
waitUntilFormRecordUnlocked
protected void waitUntilFormRecordUnlocked(int timeoutSeconds) -
waitUntilFormRecordUnlocked
protected void waitUntilFormRecordUnlocked(long formRecordId) -
waitUntilFormRecordUnlocked
protected void waitUntilFormRecordUnlocked(long formRecordId, int timeoutSeconds) -
cleanupAfterAll
-
newDummyUserCreator
-
nodeKey
-
runGenericAfterAllCleanupActions
-
updateFormDataWithPersistenceXml(String)and/orupdateFormVersionWithPersistJson(String, String...)