Package de.xima.fc.ms.test.workflow
Class AWorkflowEngineTest
java.lang.Object
de.xima.fc.ms.test.workflow.AWorkflowEngineTest
- All Implemented Interfaces:
DaoCrudMixin
- Direct Known Subclasses:
AEventRunnerTest
@ExtendWith(FcSystemIntegrationExtension.class)
public abstract class AWorkflowEngineTest
extends Object
implements DaoCrudMixin
Base test for all workflow tests that created the workflow process.
- Since:
- 7.0.0
- Author:
- XIMA MEDIA GmbH
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Mandant
protected DatenbankZugriff
protected DatenbankZugriff
protected IEntityContextHolder
protected FormEingang
protected Vorgang
protected FormVersion
protected BenutzerGruppe
protected BenutzerGruppe
protected Textbaustein
protected Postfach
protected static final org.slf4j.Logger
protected WorkflowProcess
protected Projekt
protected Rolle
protected WorkflowState
protected WorkflowState
protected Path
protected TestSystemInfo
protected IUser
protected WorkflowVersion
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
assertAttachmentContentString
(EAttachmentSource source, String value) protected void
assertAttachmentContentString
(EAttachmentSource source, Predicate<String> nameFilter, String value) protected void
assertAttachmentContentZippedString
(Map<String, String> expectedFiles, Attachment attachment) protected void
assertAttachmentsContentString
(EAttachmentSource source, String... values) protected void
assertAttachmentsContentString
(EAttachmentSource source, Predicate<String> nameFilter, String... values) protected void
assertAttachmentsContentString
(List<Attachment> attachments, String... values) protected void
assertEntriesAreEqual
(Map<?, ?> expectedSubset, Map<?, ?> actual) protected List<ProtocolEntryProcessing>
assertHasLogEntriesOfType
(EProtocolEntryProcessType expectedType, int expectedAmount) protected void
protected ProtocolEntryProcessing
protected byte[]
binaryResource
(String resourcePath) protected static void
cleanupAfterAll
(AutoCloseable cleanupAction) protected void
cleanupAfterEach
(AutoCloseable cleanupAction) protected MandantRessource
createClientResource
(@NotNull String name, @javax.validation.constraints.NotNull byte[] resourceData, @NotNull String resourceDescription) Creates a client resource where the resource- and the file-name are the same.protected MandantRessource
createClientResource
(@NotNull String resourceName, @NotNull String fileName, @javax.validation.constraints.NotNull byte[] resourceData, @NotNull String resourceDescription) protected MandantRessource
createClientResource
(@NotNull String name, @NotNull String resourceData, @NotNull String resourceDescription) Creates a client resource where the resource- and the file-name are the same.protected void
createFormData
(String fileName, String... formElements) Creates form data for the current form record.protected Attachment
createFormRecordResource
(@NotNull String attachmentFilename, EAttachmentSource attachmentSource, @javax.validation.constraints.NotNull byte[] resourceData, Date editDate, String uploadElementName) protected Attachment
createFormRecordResource
(@NotNull String attachmentFilename, EAttachmentSource attachmentSource, @NotNull String resourceData, Date editDate, String uploadElementName) protected ProjektRessource
createProjectResource
(@NotNull String name, @javax.validation.constraints.NotNull byte[] resourceData, @NotNull String resourceDescription) Creates a project resource where the resource- and the file-name are the same.protected ProjektRessource
createProjectResource
(@NotNull String resourceName, @NotNull String fileName, @javax.validation.constraints.NotNull byte[] resourceData, @NotNull String resourceDescription) protected ProjektRessource
createProjectResource
(String name, @NotNull String resourceData, @NotNull String resourceDescription) Creates a project resource where the resource- and the file-name are the same.protected WorkflowNode
createSleepNode
(int sleepTimeMillis) protected void
protected Path
createTextFile
(String fileName, String content) protected void
ec()
protected FormElement
formElement
(String name) protected byte[]
getAttachmentContentData
(Attachment attachment) protected String
getAttachmentContentString
(Attachment attachment) protected Attachment
protected Attachment
getFormRecordAttachment
(EAttachmentSource source, Predicate<String> nameFilter) protected String
protected List<Attachment>
protected List<Attachment>
getFormRecordAttachments
(EAttachmentSource source, Predicate<String> nameFilter) protected List<ProtocolEntryProcessing>
getProcessingProtcolEntriesByType
(Vorgang formRecord, EProtocolEntryProcessType... types) protected <T> T
getSuccessValueAs
(IEventExecutionResult result, AWorkflowElement<?, ?> element, Class<T> expectedType) protected static NodeKey
nodeKey
(WorkflowTrigger trigger, WorkflowNode node) protected String
plainTextResource
(String resourcePath) protected String
plainTextResource
(String resourcePath, Charset charset) protected byte[]
readBinaryFile
(File file) protected byte[]
readBinaryFile
(Path file) protected String
protected Vorgang
readFormRecord
(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 void
protected void
protected void
protected static void
protected void
protected void
protected void
protected void
protected void
protected abstract void
protected com.alibaba.fastjson.JSONObject
toJsonObject
(Object data) protected void
updateClientLicense
(String licenseKey, String pathToLicenseFile) 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 FormElement
uploadElement
(String name) protected AutoCloseable
protected AutoCloseable
waitUntilFormRecordLocked
(int timeoutSeconds) protected AutoCloseable
waitUntilFormRecordLocked
(long formRecordId) protected AutoCloseable
waitUntilFormRecordLocked
(long formRecordId, int timeoutSeconds) protected void
protected void
waitUntilFormRecordUnlocked
(int timeoutSeconds) protected void
waitUntilFormRecordUnlocked
(long formRecordId) protected void
waitUntilFormRecordUnlocked
(long formRecordId, int timeoutSeconds) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface de.xima.fc.ms.test.dao.DaoCrudMixin
create, createOrUpdate, dao, dao, delete, read, read, readAll, update
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOG -
client
-
tempDir
-
dbConn
-
dbConnInvalid
-
ec
-
formData
-
formRecord
-
formVersion
-
group
-
groupOther
-
i18n
-
inbox
-
process
-
project
-
role
-
state
-
stateArchived
-
testSystemInfo
-
user
-
version
-
-
Constructor Details
-
AWorkflowEngineTest
public AWorkflowEngineTest()
-
-
Method Details
-
ec
- Specified by:
ec
in interfaceDaoCrudMixin
- Returns:
- The entity context to use for database operations.
-
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
-
assertAttachmentsContentString
protected void assertAttachmentsContentString(EAttachmentSource source, Predicate<String> nameFilter, String... values) -
assertAttachmentsContentString
-
assertAttachmentsContentString
-
assertEntriesAreEqual
-
assertHasLogEntriesOfType
protected List<ProtocolEntryProcessing> assertHasLogEntriesOfType(EProtocolEntryProcessType expectedType, int expectedAmount) -
assertHasNoAttachments
-
assertHasSingleLogEntryOfType
-
createClientResource
protected MandantRessource createClientResource(@NotNull @NotNull String name, @NotNull @javax.validation.constraints.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
protected MandantRessource createClientResource(@NotNull @NotNull String resourceName, @NotNull @NotNull String fileName, @NotNull @javax.validation.constraints.NotNull byte[] resourceData, @NotNull @NotNull String resourceDescription) throws Exception - Throws:
Exception
-
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
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.
-
createFormRecordResource
protected Attachment createFormRecordResource(@NotNull @NotNull String attachmentFilename, EAttachmentSource attachmentSource, @NotNull @javax.validation.constraints.NotNull byte[] resourceData, @Nullable Date editDate, @Nullable String uploadElementName) 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 @javax.validation.constraints.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
protected ProjektRessource createProjectResource(@NotNull @NotNull String resourceName, @NotNull @NotNull String fileName, @NotNull @javax.validation.constraints.NotNull byte[] resourceData, @NotNull @NotNull String resourceDescription) throws Exception - Throws:
Exception
-
createProjectResource
protected ProjektRessource createProjectResource(String name, @NotNull @NotNull String 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.
-
createSleepNode
- Throws:
FastJsonException
-
createTextFile
- Throws:
IOException
-
formElement
-
getAttachmentContentData
-
getAttachmentContentString
-
getFormRecordAttachment
-
getFormRecordAttachment
protected Attachment getFormRecordAttachment(EAttachmentSource source, Predicate<String> nameFilter) -
getFormRecordAttachmentContentString
-
getFormRecordAttachments
-
getFormRecordAttachments
protected List<Attachment> getFormRecordAttachments(EAttachmentSource source, Predicate<String> nameFilter) -
getProcessingProtcolEntriesByType
protected List<ProtocolEntryProcessing> getProcessingProtcolEntriesByType(Vorgang formRecord, EProtocolEntryProcessType... types) -
getSuccessValueAs
protected <T> T getSuccessValueAs(IEventExecutionResult result, AWorkflowElement<?, ?> element, Class<T> expectedType) -
plainTextResource
-
plainTextResource
-
binaryResource
-
readFile
- Throws:
IOException
-
readBinaryFile
- Throws:
IOException
-
readBinaryFile
- Throws:
IOException
-
readFormRecord
-
reloadFormRecord
protected void reloadFormRecord() -
reloadProcess
protected void reloadProcess() -
reloadProject
protected void reloadProject() -
saveAndReloadFormRecord
protected void saveAndReloadFormRecord() -
saveAndReloadProcess
protected void saveAndReloadProcess() -
saveAndReloadProject
protected void saveAndReloadProject() -
createTempDir
- Throws:
IOException
-
deleteTempDir
@AfterEach protected void deleteTempDir() -
setupEntities
- Throws:
Exception
-
setupProcess
protected abstract void setupProcess() -
toJsonObject
-
updateClientLicense
- Throws:
IOException
-
updateParams
protected <TElement extends IWorkflowElementEntity,TSearchTerm extends AWorkflowElementSearchTerm<TElement>, void updateParamsTData> (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>, void updateParamsTData> (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) -
cleanupAfterEach
-
cleanupAfterAll
-
nodeKey
-
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) -
runGenericAfterEachCleanupActions
- Throws:
Exception
-
runGenericAfterAllCleanupActions
- Throws:
Exception
-