Thanks for the answers. But what I do is more complicated. I use DefaultMigrationHandler from external code. My definitions have the different names and the second has not migration tag. Here is my testcase that represent my use case (simplified):
public void testMigrateRunning()
{
deployJpdlClasspath("org/uni/stuttgart/iaas/fragments/test/a.jpdl.xml");
ProcessInstance processInstance = executionService
.startProcessInstanceById("a-1");
assertTrue(processInstance.isActive("a"));
String id = processInstance.getId();
processInstance = executionService.signalExecutionById(id);
assertTrue(processInstance.isActive("x"));
deployJpdlClasspath("org/uni/stuttgart/iaas/fragments/test/b.jpdl.xml");
processInstance = executionService.signalExecutionById(id);
assertTrue(processInstance.isActive("b"));
processInstance = executionService.signalExecutionById(id);
assertTrue(processInstance.isEnded());
}
public void testMigrateRunningIntern()
{
deployJpdlClasspath("org/uni/stuttgart/iaas/fragments/test/a.jpdl.xml");
ProcessInstance processInstance = executionService
.startProcessInstanceById("a-1");
assertTrue(processInstance.isActive("a"));
String id = processInstance.getId();
processInstance = executionService.signalExecutionById(id);
assertTrue(processInstance.isActive("x"));
String deploymentId = deployJpdlClasspath("org/uni/stuttgart/iaas/fragments/test/c.jpdl.xml");
// Get new process definition
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().deploymentId(
deploymentId).uniqueResult();
assertTrue(processDefinition.getName().equalsIgnoreCase("c"));
// Migrate instance here
new DefaultMigrationHandler().migrateInstance(processDefinition, processInstance, new MigrationDescriptor());
processInstance = executionService.signalExecutionById(id);
assertTrue(processInstance.isActive("b"));
processInstance = executionService.signalExecutionById(id);
assertTrue(processInstance.isEnded());
}
The first test is ok, the second is failed.
jpdl definition a:
<?xml version="1.0" encoding="UTF-8"?>
<process name="a" xmlns="http://jbpm.org/4.3/jpdl">
<start g="11,99,48,48" name="s">
<transition to="a"/>
</start>
<state g="106,94,110,52" name="a">
<transition to="x"/>
</state>
<state g="279,176,110,52" name="x">
<transition to="e"/>
</state>
<end g="499,99,48,48" name="e"/>
</process>
jpdl definition b:
<?xml version="1.0" encoding="UTF-8"?>
<process name="a" xmlns="http://jbpm.org/4.3/jpdl">
<start g="11,99,48,48" name="s">
<transition to="a"/>
</start>
<state g="106,94,110,52" name="a">
<transition to="x"/>
</state>
<state g="234,185,110,52" name="x">
<transition to="b"/>
</state>
<state g="371,92,110,52" name="b">
<transition to="e"/>
</state>
<end g="549,92,48,48" name="e"/>
<migrate-instances/>
</process>
jpdl definition c:
<?xml version="1.0" encoding="UTF-8"?>
<process name="c" xmlns="http://jbpm.org/4.3/jpdl">
<start g="11,99,48,48" name="s">
<transition to="a"/>
</start>
<state g="106,94,110,52" name="a">
<transition to="x"/>
</state>
<state g="234,185,110,52" name="x">
<transition to="b"/>
</state>
<state g="371,92,110,52" name="b">
<transition to="e"/>
</state>
<end g="549,92,48,48" name="e"/>
</process>
Any help would be appreciated.