Hi all,
I have created a custom VariableType called Object type which extends SerializableType. This type marshals a java bean to xml and then uses a wrapper to serialize the XML and store it in the activiti tables.
This all works fine. I have written a unit test for this but I cannot create a VariableInstanceEntity as SerializableType relies on a DB session.
Is there any way to test the SerializableType or mock the db session.
Thanks
Perhaps I am missing something, but can you not create a Unit test that extends PluggableActivitiTestCase?
This will configure up a process engine with an in memory database.
You can then test your serialization/deserialization by simply using setVariable() and getVariable().
Check out the org.activiti.examples.variables.VariablesTest.java for an example of this approach.
Cheers,
Greg
It seems like a huge overhead to setup an in memory DB just to test that the object serializes and de-serializes as expected - I have overwritten the serialize and deserialize methods for my custom object type and I am testing that this works rather than testing the getValue and setValue methods
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.