use of org.jbpm.services.api.admin.MigrationReport in project jbpm by kiegroup.
the class ProcessInstanceMigrationServiceImplTest method testMigrateMultipleProcessInstancesWithNodeMapping.
@Test
public void testMigrateMultipleProcessInstancesWithNodeMapping() {
List<Long> ids = new ArrayList<Long>();
for (int i = 0; i < 5; i++) {
long processInstanceId = processService.startProcess(deploymentUnitV1.getIdentifier(), REMOVEACTIVETASK_ID_V1);
assertNotNull(processInstanceId);
ids.add(processInstanceId);
}
String activeNodeId = "_ECEDD1CE-7380-418C-B7A6-AF8ECB90B820";
String nextNodeId = "_9EF3CAE0-D978-4E96-9C00-8A80082EB68E";
Map<String, String> nodeMapping = new HashMap<String, String>();
nodeMapping.put(activeNodeId, nextNodeId);
List<MigrationReport> reports = migrationService.migrate(deploymentUnitV1.getIdentifier(), ids, deploymentUnitV2.getIdentifier(), REMOVEACTIVETASK_ID_V2, nodeMapping);
assertNotNull(reports);
Iterator<MigrationReport> reportsIt = reports.iterator();
for (Long processInstanceId : ids) {
MigrationReport report = reportsIt.next();
assertTrue(report.isSuccessful());
assertMigratedProcessInstance(REMOVEACTIVETASK_ID_V2, processInstanceId, ProcessInstance.STATE_ACTIVE);
assertMigratedTaskAndComplete(REMOVEACTIVETASK_ID_V2, processInstanceId, "Mapped Task");
assertMigratedProcessInstance(REMOVEACTIVETASK_ID_V2, processInstanceId, ProcessInstance.STATE_COMPLETED);
}
}
use of org.jbpm.services.api.admin.MigrationReport in project jbpm by kiegroup.
the class ProcessInstanceMigrationServiceImplTest method testMigrateSingleProcessInstance.
@Test
public void testMigrateSingleProcessInstance() {
long processInstanceId = processService.startProcess(deploymentUnitV1.getIdentifier(), ADDTASKAFTERACTIVE_ID_V1);
assertNotNull(processInstanceId);
MigrationReport report = migrationService.migrate(deploymentUnitV1.getIdentifier(), processInstanceId, deploymentUnitV2.getIdentifier(), ADDTASKAFTERACTIVE_ID_V2);
assertNotNull(report);
assertTrue(report.isSuccessful());
assertMigratedProcessInstance(ADDTASKAFTERACTIVE_ID_V2, processInstanceId, ProcessInstance.STATE_ACTIVE);
assertMigratedTaskAndComplete(ADDTASKAFTERACTIVE_ID_V2, processInstanceId, "Active Task");
assertMigratedTaskAndComplete(ADDTASKAFTERACTIVE_ID_V2, processInstanceId, "Added Task");
assertMigratedProcessInstance(ADDTASKAFTERACTIVE_ID_V2, processInstanceId, ProcessInstance.STATE_COMPLETED);
}
use of org.jbpm.services.api.admin.MigrationReport in project jbpm by kiegroup.
the class ProcessInstanceMigrationServiceImplTest method testMigrateSingleProcessInstanceWithNodeMapping.
@Test
public void testMigrateSingleProcessInstanceWithNodeMapping() {
String activeNodeId = "_ECEDD1CE-7380-418C-B7A6-AF8ECB90B820";
String nextNodeId = "_9EF3CAE0-D978-4E96-9C00-8A80082EB68E";
Map<String, String> nodeMapping = new HashMap<String, String>();
nodeMapping.put(activeNodeId, nextNodeId);
long processInstanceId = processService.startProcess(deploymentUnitV1.getIdentifier(), REMOVEACTIVETASK_ID_V1);
assertNotNull(processInstanceId);
MigrationReport report = migrationService.migrate(deploymentUnitV1.getIdentifier(), processInstanceId, deploymentUnitV2.getIdentifier(), REMOVEACTIVETASK_ID_V2, nodeMapping);
assertNotNull(report);
assertTrue(report.isSuccessful());
assertMigratedProcessInstance(REMOVEACTIVETASK_ID_V2, processInstanceId, ProcessInstance.STATE_ACTIVE);
assertMigratedTaskAndComplete(REMOVEACTIVETASK_ID_V2, processInstanceId, "Mapped Task");
assertMigratedProcessInstance(REMOVEACTIVETASK_ID_V2, processInstanceId, ProcessInstance.STATE_COMPLETED);
}
use of org.jbpm.services.api.admin.MigrationReport in project jbpm by kiegroup.
the class ProcessInstanceMigrationServiceImpl method migrate.
@Override
public List<MigrationReport> migrate(String sourceDeploymentId, List<Long> processInstanceIds, String targetDeploymentId, String targetProcessId, Map<String, String> nodeMapping) {
List<MigrationReport> reports = new ArrayList<MigrationReport>();
for (Long pId : processInstanceIds) {
MigrationReport report = migrate(sourceDeploymentId, pId, targetDeploymentId, targetProcessId, nodeMapping);
reports.add(report);
}
return reports;
}
Aggregations