use of org.camunda.bpm.integrationtest.functional.spin.dataformat.Foo in project camunda-bpm-platform by camunda.
the class PaDataFormatProviderTest method customFormatCanBeUsedForVariableSerialization.
/**
* Tests that
* 1) a serialized value can be set OUT OF process application context
* even if the data format is not available (using the fallback serializer)
* 2) and that this value can be deserialized IN process application context
* by using the PA-local serializer
*/
@Test
public void customFormatCanBeUsedForVariableSerialization() {
final ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess", Variables.createVariables().putValue("serializedObject", serializedObjectValue("foo").serializationDataFormat(FooDataFormat.NAME).objectTypeName(Foo.class.getName())));
ObjectValue objectValue = null;
try {
ProcessApplicationContext.setCurrentProcessApplication(ReferenceStoringProcessApplication.INSTANCE);
objectValue = runtimeService.getVariableTyped(pi.getId(), "serializedObject", true);
} finally {
ProcessApplicationContext.clear();
}
Object value = objectValue.getValue();
Assert.assertNotNull(value);
Assert.assertTrue(value instanceof Foo);
}
Aggregations