Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@meyerdan
Created November 6, 2013 12:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meyerdan/7335610 to your computer and use it in GitHub Desktop.
Save meyerdan/7335610 to your computer and use it in GitHub Desktop.
public class DummySerializable implements Serializable {
private static final long serialVersionUID = 1L;
}
<?xml version="1.0" encoding="UTF-8"?>
<definitions
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:camunda="http://activiti.org/bpmn"
targetNamespace="org.camunda.bpm.engine.test.enginge.test.api.runtime">
<process id="testProcess">
<startEvent id="theStart" />
<sequenceFlow id="flow1" sourceRef="theStart" targetRef="theTask" />
<userTask id="theTask" name="my task" />
<sequenceFlow id="flow2" sourceRef="theTask" targetRef="serviceTask" />
<serviceTask id="serviceTask" name="my task" camunda:class="org.camunda.bpm.engine.test.api.runtime.ReadSerializableVariableDelegate" />
</process>
</definitions>
public class ReadSerializableVariableDelegate implements JavaDelegate {
public void execute(DelegateExecution execution) throws Exception {
// get variable
execution.getVariable("serializableVar");
}
}
@Deployment
public void testSetVariableSerializable() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testProcess");
runtimeService.setVariable(processInstance.getId(), "serializableVar", new DummySerializable());
Task task = taskService.createTaskQuery().singleResult();
taskService.complete(task.getId());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment