Hi Stefan,
Thanks for the test case. Cases 1 and 2 are not expected to work because you attempt to use Java byte-serialization for classes that do not implement java.io.Serializable
(SpinXmlElement
and implementing classes). Case 3 does not work for the reason described here: Spin Plugin XML Serialization. Spin uses JAXB for XML serialization and you can’t serialize a plain Java ArrayList object via JAXB to anything meaningful, because ArrayList has no JAXB annotations. However, if you follow the advice given in that post, then you will probably hit another wall because serializing SpinXmlElement
via JAXB will also not produce a meaningful result for the same reason.
Now the easiest way to make this work is by using an EL expression for the camunda:collection
attribute.
- Assume we have a process variable called
rootElement
that is set to the following value:Spin.XML("<root><child1/><child2/></root>");
- Configure the
camunda:collection
attribute of the multi-instance task to be${rootElement.childElements()}
Lastly, to make your tests fail properly, do the following:
- Deactivate the job executor
- Fetch jobs via
ManagementService#createJobQuery
- Execute jobs via
ManagementService#executeJob
That way, you can define the order in which you execute jobs and the jobs are executed in the context of the test thread (not of the job executor thread pool), so that execution failure properly bumps up to the JUnit runner.
Cheers,
Thorben