use of org.jbpm.services.api.admin.MigrationReport in project jbpm by kiegroup.
the class EMigrateProcessTest method testUpgradeProcessInstanceWithNodeMapping.
@Test
public void testUpgradeProcessInstanceWithNodeMapping() throws Exception {
Long processInstanceId = processService.startProcess(kieJar, EVALUATION_PROCESS_ID_V1);
if (processInstanceId != null) {
archive.getPids().add(processInstanceId);
}
List<TaskSummary> tasks = runtimeDataService.getTasksAssignedAsPotentialOwner(USER_YODA, new QueryFilter(0, 10));
Assertions.assertThat(tasks.size()).isEqualTo(1);
TaskSummary task = tasks.get(0);
Assertions.assertThat(tasks.get(0).getName()).isEqualTo("Evaluate items");
Assertions.assertThat(task.getDeploymentId()).isEqualTo(kieJar);
Assertions.assertThat(task.getProcessId()).isEqualTo(EVALUATION_PROCESS_ID_V1);
Assertions.assertThat(task.getProcessInstanceId()).isEqualTo(processInstanceId);
Map<String, String> nodeMapping = new HashMap<String, String>();
nodeMapping.put("_4E8E7545-FB70-494E-9136-2B9ABE655889", "_56FB3E50-DEDD-415B-94DD-0357C91836B9");
// migrate process instance to evaluation 2 in container 2
MigrationReport report = migrationService.migrate(kieJar, processInstanceId, kieJar2, EVALUATION_PROCESS_ID_V2, nodeMapping);
Assertions.assertThat(report).isNotNull();
Assertions.assertThat(report.isSuccessful()).isTrue();
// migrated to Approve user task
tasks = runtimeDataService.getTasksAssignedAsPotentialOwner(USER_YODA, new QueryFilter(0, 10));
Assertions.assertThat(tasks.size()).isEqualTo(1);
task = tasks.get(0);
Assertions.assertThat(task.getName()).isEqualTo("Approve");
Assertions.assertThat(task.getDeploymentId()).isEqualTo(kieJar2);
Assertions.assertThat(task.getProcessId()).isEqualTo(EVALUATION_PROCESS_ID_V2);
Assertions.assertThat(task.getProcessInstanceId()).isEqualTo(processInstanceId);
}
use of org.jbpm.services.api.admin.MigrationReport in project jbpm by kiegroup.
the class ProcessInstanceMigrationServiceImplTest method testMigrateMultipleProcessInstances.
@Test
public void testMigrateMultipleProcessInstances() {
List<Long> ids = new ArrayList<Long>();
for (int i = 0; i < 5; i++) {
long processInstanceId = processService.startProcess(deploymentUnitV1.getIdentifier(), ADDTASKAFTERACTIVE_ID_V1);
assertNotNull(processInstanceId);
ids.add(processInstanceId);
}
List<MigrationReport> reports = migrationService.migrate(deploymentUnitV1.getIdentifier(), ids, deploymentUnitV2.getIdentifier(), ADDTASKAFTERACTIVE_ID_V2);
assertNotNull(reports);
Iterator<MigrationReport> reportsIt = reports.iterator();
for (Long processInstanceId : ids) {
MigrationReport report = reportsIt.next();
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 EMigrateProcessTest method testUpgradeProcessInstance.
@Test
public void testUpgradeProcessInstance() throws Exception {
Long processInstanceId = processService.startProcess(kieJar, EVALUATION_PROCESS_ID_V1);
if (processInstanceId != null) {
archive.getPids().add(processInstanceId);
}
List<TaskSummary> tasks = runtimeDataService.getTasksAssignedAsPotentialOwner(USER_YODA, new QueryFilter(0, 10));
Assertions.assertThat(tasks.size()).isEqualTo(1);
TaskSummary task = tasks.get(0);
Assertions.assertThat(task.getName()).isEqualTo("Evaluate items");
Assertions.assertThat(task.getDeploymentId()).isEqualTo(kieJar);
Assertions.assertThat(task.getProcessId()).isEqualTo(EVALUATION_PROCESS_ID_V1);
Assertions.assertThat(task.getProcessInstanceId()).isEqualTo(processInstanceId);
// migrate process instance to evaluation 2 in container 2
MigrationReport report = migrationService.migrate(kieJar, processInstanceId, kieJar2, EVALUATION_PROCESS_ID_V2);
Assertions.assertThat(report).isNotNull();
Assertions.assertThat(report.isSuccessful()).isTrue();
// it stays in the same task
tasks = runtimeDataService.getTasksAssignedAsPotentialOwner(USER_YODA, new QueryFilter(0, 10));
Assertions.assertThat(tasks.size()).isEqualTo(1);
task = tasks.get(0);
Assertions.assertThat(task.getName()).isEqualTo("Evaluate items");
Assertions.assertThat(task.getDeploymentId()).isEqualTo(kieJar2);
Assertions.assertThat(task.getProcessId()).isEqualTo(EVALUATION_PROCESS_ID_V2);
Assertions.assertThat(task.getProcessInstanceId()).isEqualTo(processInstanceId);
userTaskService.completeAutoProgress(task.getId(), USER_YODA, null);
// but next task should be Approve user task
tasks = runtimeDataService.getTasksAssignedAsPotentialOwner(USER_YODA, new QueryFilter(0, 10));
Assertions.assertThat(tasks.size()).isEqualTo(1);
task = tasks.get(0);
Assertions.assertThat(task.getName()).isEqualTo("Approve");
Assertions.assertThat(task.getDeploymentId()).isEqualTo(kieJar2);
Assertions.assertThat(task.getProcessId()).isEqualTo(EVALUATION_PROCESS_ID_V2);
Assertions.assertThat(task.getProcessInstanceId()).isEqualTo(processInstanceId);
}
use of org.jbpm.services.api.admin.MigrationReport in project jbpm by kiegroup.
the class EMigrateProcessTest method testUpgradeProcessInstancesWithNodeMapping.
@Test
public void testUpgradeProcessInstancesWithNodeMapping() throws Exception {
List<Long> ids = new ArrayList<Long>();
for (int i = 0; i < 5; i++) {
Long processInstanceId = processService.startProcess(kieJar, EVALUATION_PROCESS_ID_V1);
ids.add(processInstanceId);
if (processInstanceId != null) {
archive.getPids().add(processInstanceId);
}
}
List<TaskSummary> tasks = runtimeDataService.getTasksAssignedAsPotentialOwner(USER_YODA, new QueryFilter(0, 10));
Assertions.assertThat(tasks.size()).isEqualTo(5);
for (TaskSummary task : tasks) {
Assertions.assertThat(task.getName()).isEqualTo("Evaluate items");
Assertions.assertThat(task.getDeploymentId()).isEqualTo(kieJar);
Assertions.assertThat(task.getProcessId()).isEqualTo(EVALUATION_PROCESS_ID_V1);
}
Map<String, String> nodeMapping = new HashMap<String, String>();
nodeMapping.put("_4E8E7545-FB70-494E-9136-2B9ABE655889", "_56FB3E50-DEDD-415B-94DD-0357C91836B9");
// migrate process instance to evaluation 2 in container 2
List<MigrationReport> reports = migrationService.migrate(kieJar, ids, kieJar2, EVALUATION_PROCESS_ID_V2, nodeMapping);
Assertions.assertThat(reports).isNotNull();
for (MigrationReport report : reports) {
Assertions.assertThat(report.isSuccessful()).isTrue();
}
// but next task should be Approve user task
tasks = runtimeDataService.getTasksAssignedAsPotentialOwner(USER_YODA, new QueryFilter(0, 10));
Assertions.assertThat(tasks.size()).isEqualTo(5);
for (TaskSummary task : tasks) {
Assertions.assertThat(task.getName()).isEqualTo("Approve");
Assertions.assertThat(task.getDeploymentId()).isEqualTo(kieJar2);
Assertions.assertThat(task.getProcessId()).isEqualTo(EVALUATION_PROCESS_ID_V2);
}
}
use of org.jbpm.services.api.admin.MigrationReport in project jbpm by kiegroup.
the class EMigrateProcessTest method testUpgradeProcessInstances.
@Test
public void testUpgradeProcessInstances() throws Exception {
List<Long> ids = new ArrayList<Long>();
for (int i = 0; i < 5; i++) {
Long processInstanceId = processService.startProcess(kieJar, EVALUATION_PROCESS_ID_V1);
ids.add(processInstanceId);
if (processInstanceId != null) {
archive.getPids().add(processInstanceId);
}
}
List<TaskSummary> tasks = runtimeDataService.getTasksAssignedAsPotentialOwner(USER_YODA, new QueryFilter(0, 10));
Assertions.assertThat(tasks.size()).isEqualTo(5);
for (TaskSummary task : tasks) {
Assertions.assertThat(task.getName()).isEqualTo("Evaluate items");
Assertions.assertThat(task.getDeploymentId()).isEqualTo(kieJar);
Assertions.assertThat(task.getProcessId()).isEqualTo(EVALUATION_PROCESS_ID_V1);
}
// migrate process instance to evaluation 2 in container 2
List<MigrationReport> reports = migrationService.migrate(kieJar, ids, kieJar2, EVALUATION_PROCESS_ID_V2);
Assertions.assertThat(reports).isNotNull();
for (MigrationReport report : reports) {
Assertions.assertThat(report.isSuccessful()).isTrue();
}
// it stays in the same task
tasks = runtimeDataService.getTasksAssignedAsPotentialOwner(USER_YODA, new QueryFilter(0, 10));
Assertions.assertThat(tasks.size()).isEqualTo(5);
for (TaskSummary task : tasks) {
Assertions.assertThat(task.getName()).isEqualTo("Evaluate items");
Assertions.assertThat(task.getDeploymentId()).isEqualTo(kieJar2);
Assertions.assertThat(task.getProcessId()).isEqualTo(EVALUATION_PROCESS_ID_V2);
userTaskService.completeAutoProgress(task.getId(), USER_YODA, null);
}
// but next task should be Approve user task
tasks = runtimeDataService.getTasksAssignedAsPotentialOwner(USER_YODA, new QueryFilter(0, 10));
Assertions.assertThat(tasks.size()).isEqualTo(5);
for (TaskSummary task : tasks) {
Assertions.assertThat(task.getName()).isEqualTo("Approve");
Assertions.assertThat(task.getDeploymentId()).isEqualTo(kieJar2);
Assertions.assertThat(task.getProcessId()).isEqualTo(EVALUATION_PROCESS_ID_V2);
}
}
Aggregations