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
Fields Modifier and Type Field Description protected Mandantclientprotected DatenbankZugriffdbConnprotected DatenbankZugriffdbConnInvalidprotected IEntityContextHolderecprotected FormEingangformDataprotected VorgangformRecordprotected FormVersionformVersionprotected BenutzerGruppegroupprotected BenutzerGruppegroupOtherprotected Textbausteini18nprotected Postfachinboxprotected static org.slf4j.LoggerLOGprotected WorkflowProcessprocessprotected Projektprojectprotected Rolleroleprotected WorkflowStatestateprotected WorkflowStatestateArchivedprotected TestSystemInfotestSystemInfoprotected IUseruserprotected WorkflowVersionversion 
- 
Constructor Summary
Constructors Constructor Description AWorkflowEngineTest() 
- 
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidassertAttachmentContentString(EAttachmentSource source, String value)protected voidassertAttachmentContentString(EAttachmentSource source, Predicate<String> nameFilter, String value)protected voidassertAttachmentContentZippedString(Map<String,String> expectedFiles, Attachment attachment)protected voidassertAttachmentsContentString(EAttachmentSource source, String... values)protected voidassertAttachmentsContentString(EAttachmentSource source, Predicate<String> nameFilter, String... values)protected voidassertAttachmentsContentString(List<Attachment> attachments, String... values)protected voidassertEntriesAreEqual(Map<?,?> expectedSubset, Map<?,?> actual)protected List<ProtocolEntryProcessing>assertHasLogEntriesOfType(EProtocolEntryProcessType expectedType, int expectedAmount)protected voidassertHasNoAttachments(EAttachmentSource source)protected ProtocolEntryProcessingassertHasSingleLogEntryOfType(EProtocolEntryProcessType type)protected byte[]binaryResource(String resourcePath)protected MandantRessourcecreateClientResource(@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 MandantRessourcecreateClientResource(@NotNull String resourceName, @NotNull String fileName, @javax.validation.constraints.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)Creates form data for the current form record.protected AttachmentcreateFormRecordResource(@NotNull String attachmentFilename, EAttachmentSource attachmentSource, @javax.validation.constraints.NotNull byte[] resourceData, Date editDate, String uploadElementName)protected AttachmentcreateFormRecordResource(@NotNull String attachmentFilename, EAttachmentSource attachmentSource, @NotNull String resourceData, Date editDate, String uploadElementName)protected ProjektRessourcecreateProjectResource(@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 ProjektRessourcecreateProjectResource(@NotNull String resourceName, @NotNull String fileName, @javax.validation.constraints.NotNull byte[] resourceData, @NotNull String resourceDescription)protected ProjektRessourcecreateProjectResource(String name, @NotNull String resourceData, @NotNull String resourceDescription)Creates a project resource where the resource- and the file-name are the same.protected WorkflowNodecreateSleepNode(int sleepTimeMillis)IEntityContextec()protected FormElementformElement(String name)protected byte[]getAttachmentContentData(Attachment attachment)protected StringgetAttachmentContentString(Attachment attachment)protected AttachmentgetFormRecordAttachment(EAttachmentSource source)protected AttachmentgetFormRecordAttachment(EAttachmentSource source, Predicate<String> nameFilter)protected List<Attachment>getFormRecordAttachments(EAttachmentSource source)protected List<Attachment>getFormRecordAttachments(EAttachmentSource source, Predicate<String> nameFilter)protected List<ProtocolEntryProcessing>getProcessingProtcolEntriesByType(Vorgang formRecord, EProtocolEntryProcessType... types)protected <T> TgetSuccessValueAs(IEventExecutionResult result, AWorkflowElement<?,?> element, Class<T> expectedType)protected StringplainTextResource(String resourcePath)protected StringplainTextResource(String resourcePath, Charset charset)protected byte[]readBinaryFile(File file)protected byte[]readBinaryFile(Path file)protected StringreadFile(File file)protected VorgangreadFormRecord(Long id)protected voidreloadFormRecord()protected voidreloadProcess()protected voidreloadProject()protected voidsaveAndReloadFormRecord()protected voidsaveAndReloadProcess()protected voidsaveAndReloadProject()protected voidsetupEntities()protected abstract voidsetupProcess()protected com.alibaba.fastjson.JSONObjecttoJsonObject(Object data)protected voidupdateClientLicense(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 FormElementuploadElement(String name)protected AutoCloseablewaitUntilFormRecordLocked()protected AutoCloseablewaitUntilFormRecordLocked(int timeoutSeconds)protected AutoCloseablewaitUntilFormRecordLocked(long formRecordId)protected AutoCloseablewaitUntilFormRecordLocked(long formRecordId, int timeoutSeconds)protected voidwaitUntilFormRecordUnlocked()protected voidwaitUntilFormRecordUnlocked(int timeoutSeconds)protected voidwaitUntilFormRecordUnlocked(long formRecordId)protected voidwaitUntilFormRecordUnlocked(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 Detail
- 
LOG
protected static final org.slf4j.Logger LOG
 
- 
client
protected Mandant client
 
- 
dbConn
protected DatenbankZugriff dbConn
 
- 
dbConnInvalid
protected DatenbankZugriff dbConnInvalid
 
- 
ec
protected IEntityContextHolder ec
 
- 
formData
protected FormEingang formData
 
- 
formRecord
protected Vorgang formRecord
 
- 
formVersion
protected FormVersion formVersion
 
- 
group
protected BenutzerGruppe group
 
- 
groupOther
protected BenutzerGruppe groupOther
 
- 
i18n
protected Textbaustein i18n
 
- 
inbox
protected Postfach inbox
 
- 
process
protected WorkflowProcess process
 
- 
project
protected Projekt project
 
- 
role
protected Rolle role
 
- 
state
protected WorkflowState state
 
- 
stateArchived
protected WorkflowState stateArchived
 
- 
testSystemInfo
protected TestSystemInfo testSystemInfo
 
- 
user
protected IUser user
 
- 
version
protected WorkflowVersion version
 
 - 
 
- 
Method Detail
- 
ec
public IEntityContext ec()
- Specified by:
 ecin interfaceDaoCrudMixin- Returns:
 - The entity context to use for database operations.
 
 
- 
assertAttachmentContentString
protected void assertAttachmentContentString(EAttachmentSource source, Predicate<String> nameFilter, String value)
 
- 
assertAttachmentContentString
protected void assertAttachmentContentString(EAttachmentSource source, String value)
 
- 
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
protected void assertAttachmentsContentString(EAttachmentSource source, String... values)
 
- 
assertAttachmentsContentString
protected void assertAttachmentsContentString(List<Attachment> attachments, String... values)
 
- 
assertEntriesAreEqual
protected void assertEntriesAreEqual(Map<?,?> expectedSubset, Map<?,?> actual)
 
- 
assertHasLogEntriesOfType
protected List<ProtocolEntryProcessing> assertHasLogEntriesOfType(EProtocolEntryProcessType expectedType, int expectedAmount)
 
- 
assertHasNoAttachments
protected void assertHasNoAttachments(EAttachmentSource source)
 
- 
assertHasSingleLogEntryOfType
protected ProtocolEntryProcessing assertHasSingleLogEntryOfType(EProtocolEntryProcessType type)
 
- 
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
protected void createFormData(String fileName, String... formElements)
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
protected WorkflowNode createSleepNode(int sleepTimeMillis) throws FastJsonException
- Throws:
 FastJsonException
 
- 
formElement
protected FormElement formElement(String name)
 
- 
getAttachmentContentData
protected byte[] getAttachmentContentData(Attachment attachment)
 
- 
getAttachmentContentString
protected String getAttachmentContentString(Attachment attachment)
 
- 
getFormRecordAttachment
protected Attachment getFormRecordAttachment(EAttachmentSource source)
 
- 
getFormRecordAttachment
protected Attachment getFormRecordAttachment(EAttachmentSource source, Predicate<String> nameFilter)
 
- 
getFormRecordAttachments
protected List<Attachment> getFormRecordAttachments(EAttachmentSource source)
 
- 
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)
 
- 
binaryResource
protected byte[] binaryResource(String resourcePath)
 
- 
readFile
protected String readFile(File file) throws IOException
- Throws:
 IOException
 
- 
readBinaryFile
protected byte[] readBinaryFile(File file) throws IOException
- Throws:
 IOException
 
- 
readBinaryFile
protected byte[] readBinaryFile(Path file) throws IOException
- Throws:
 IOException
 
- 
reloadFormRecord
protected void reloadFormRecord()
 
- 
reloadProcess
protected void reloadProcess()
 
- 
reloadProject
protected void reloadProject()
 
- 
saveAndReloadFormRecord
protected void saveAndReloadFormRecord()
 
- 
saveAndReloadProcess
protected void saveAndReloadProcess()
 
- 
saveAndReloadProject
protected void saveAndReloadProject()
 
- 
setupProcess
protected abstract void setupProcess()
 
- 
toJsonObject
protected com.alibaba.fastjson.JSONObject toJsonObject(Object data)
 
- 
updateClientLicense
protected void updateClientLicense(String licenseKey, String pathToLicenseFile) throws IOException
- Throws:
 IOException
 
- 
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
protected FormElement uploadElement(String name)
 
- 
waitUntilFormRecordLocked
protected AutoCloseable waitUntilFormRecordLocked()
 
- 
waitUntilFormRecordLocked
protected AutoCloseable waitUntilFormRecordLocked(int timeoutSeconds)
 
- 
waitUntilFormRecordLocked
protected AutoCloseable waitUntilFormRecordLocked(long formRecordId)
 
- 
waitUntilFormRecordLocked
protected AutoCloseable waitUntilFormRecordLocked(long formRecordId, int timeoutSeconds)
 
- 
waitUntilFormRecordUnlocked
protected void waitUntilFormRecordUnlocked()
 
- 
waitUntilFormRecordUnlocked
protected void waitUntilFormRecordUnlocked(int timeoutSeconds)
 
- 
waitUntilFormRecordUnlocked
protected void waitUntilFormRecordUnlocked(long formRecordId)
 
- 
waitUntilFormRecordUnlocked
protected void waitUntilFormRecordUnlocked(long formRecordId, int timeoutSeconds) 
 - 
 
 -