Search in sources :

Example 6 with MigrationReport

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);
    }
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) MigrationReport(org.jbpm.services.api.admin.MigrationReport) KModuleDeploymentServiceTest(org.jbpm.kie.services.test.KModuleDeploymentServiceTest) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Example 7 with MigrationReport

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);
}
Also used : MigrationReport(org.jbpm.services.api.admin.MigrationReport) KModuleDeploymentServiceTest(org.jbpm.kie.services.test.KModuleDeploymentServiceTest) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Example 8 with MigrationReport

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);
}
Also used : HashMap(java.util.HashMap) MigrationReport(org.jbpm.services.api.admin.MigrationReport) KModuleDeploymentServiceTest(org.jbpm.kie.services.test.KModuleDeploymentServiceTest) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Example 9 with MigrationReport

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;
}
Also used : ArrayList(java.util.ArrayList) MigrationReport(org.jbpm.services.api.admin.MigrationReport)

Aggregations

MigrationReport (org.jbpm.services.api.admin.MigrationReport)9 Test (org.junit.Test)8 ArrayList (java.util.ArrayList)5 HashMap (java.util.HashMap)4 KModuleDeploymentServiceTest (org.jbpm.kie.services.test.KModuleDeploymentServiceTest)4 AbstractKieServicesBaseTest (org.jbpm.kie.test.util.AbstractKieServicesBaseTest)4 AbstractRuntimeEJBServicesTest (org.jbpm.test.container.AbstractRuntimeEJBServicesTest)4 TaskSummary (org.kie.api.task.model.TaskSummary)4 QueryFilter (org.kie.internal.query.QueryFilter)4