use of org.camunda.bpm.engine.runtime.Job in project camunda-bpm-platform by camunda.
the class MigrationTransitionInstancesTest method testMigrateAsyncBeforeStartEventTransitionInstanceCase3.
@Test
public void testMigrateAsyncBeforeStartEventTransitionInstanceCase3() {
// given
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(AsyncProcessModels.ASYNC_BEFORE_SUBPROCESS_START_EVENT_PROCESS);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(AsyncProcessModels.ASYNC_BEFORE_SUBPROCESS_START_EVENT_PROCESS);
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("subProcessStart", "subProcessStart").build();
// when
testHelper.createProcessInstanceAndMigrate(migrationPlan);
// then
testHelper.assertJobMigrated("subProcessStart", "subProcessStart", AsyncContinuationJobHandler.TYPE);
// and it is possible to successfully execute the migrated job
Job job = testHelper.snapshotAfterMigration.getJobs().get(0);
rule.getManagementService().executeJob(job.getId());
// and complete the task and process instance
testHelper.completeTask("userTask");
testHelper.assertProcessEnded(testHelper.snapshotBeforeMigration.getProcessInstanceId());
}
use of org.camunda.bpm.engine.runtime.Job in project camunda-bpm-platform by camunda.
the class MigrationTransitionInstancesTest method testMigrateAsyncBeforeInnerMultiInstance.
@Test
public void testMigrateAsyncBeforeInnerMultiInstance() {
// given
BpmnModelInstance model = modify(MultiInstanceProcessModels.PAR_MI_ONE_TASK_PROCESS).asyncBeforeInnerMiActivity("userTask");
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(model);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(model);
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapEqualActivities().build();
// when
testHelper.createProcessInstanceAndMigrate(migrationPlan);
// then
List<Job> jobs = testHelper.snapshotAfterMigration.getJobs();
Assert.assertEquals(3, jobs.size());
testHelper.assertJobMigrated(jobs.get(0), "userTask");
testHelper.assertJobMigrated(jobs.get(1), "userTask");
testHelper.assertJobMigrated(jobs.get(2), "userTask");
// and it is possible to successfully execute the migrated jobs
for (Job job : jobs) {
rule.getManagementService().executeJob(job.getId());
}
// and complete the task and process instance
testHelper.completeAnyTask("userTask");
testHelper.completeAnyTask("userTask");
testHelper.completeAnyTask("userTask");
testHelper.assertProcessEnded(testHelper.snapshotBeforeMigration.getProcessInstanceId());
}
use of org.camunda.bpm.engine.runtime.Job in project camunda-bpm-platform by camunda.
the class MigrationTransitionInstancesTest method testMigrateAsyncBeforeStartEventTransitionInstanceCase4.
@Test
public void testMigrateAsyncBeforeStartEventTransitionInstanceCase4() {
// given
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(AsyncProcessModels.ASYNC_BEFORE_SUBPROCESS_START_EVENT_PROCESS);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(AsyncProcessModels.ASYNC_BEFORE_START_EVENT_PROCESS);
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("subProcessStart", "startEvent").build();
// when
testHelper.createProcessInstanceAndMigrate(migrationPlan);
// then
testHelper.assertJobMigrated("subProcessStart", "startEvent", AsyncContinuationJobHandler.TYPE);
// and it is possible to successfully execute the migrated job
Job job = testHelper.snapshotAfterMigration.getJobs().get(0);
rule.getManagementService().executeJob(job.getId());
// and complete the task and process instance
testHelper.completeTask("userTask");
testHelper.assertProcessEnded(testHelper.snapshotBeforeMigration.getProcessInstanceId());
}
use of org.camunda.bpm.engine.runtime.Job in project camunda-bpm-platform by camunda.
the class MigrationTransitionInstancesTest method testMigrateAsyncBeforeTransitionInstanceAddParentScope.
@Test
public void testMigrateAsyncBeforeTransitionInstanceAddParentScope() {
// given
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(AsyncProcessModels.ASYNC_BEFORE_USER_TASK_PROCESS);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(AsyncProcessModels.ASYNC_BEFORE_SUBPROCESS_USER_TASK_PROCESS);
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("userTask", "userTask").build();
// when
testHelper.createProcessInstanceAndMigrate(migrationPlan);
// then
testHelper.assertExecutionTreeAfterMigration().hasProcessDefinitionId(targetProcessDefinition.getId()).matches(describeExecutionTree(null).scope().id(testHelper.snapshotBeforeMigration.getProcessInstanceId()).child("userTask").scope().done());
testHelper.assertActivityTreeAfterMigration().hasStructure(describeActivityInstanceTree(targetProcessDefinition.getId()).beginScope("subProcess").transition("userTask").done());
testHelper.assertJobMigrated("userTask", "userTask", AsyncContinuationJobHandler.TYPE);
// and it is possible to successfully execute the migrated job
Job job = testHelper.snapshotAfterMigration.getJobs().get(0);
rule.getManagementService().executeJob(job.getId());
// and complete the task and process instance
testHelper.completeTask("userTask");
testHelper.assertProcessEnded(testHelper.snapshotBeforeMigration.getProcessInstanceId());
}
use of org.camunda.bpm.engine.runtime.Job in project camunda-bpm-platform by camunda.
the class MigrationTransitionInstancesTest method testMigrateAsyncAfterTransitionInstanceAddOutgoingFlowCase2.
@Test
public void testMigrateAsyncAfterTransitionInstanceAddOutgoingFlowCase2() {
// given
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(AsyncProcessModels.ASYNC_AFTER_USER_TASK_PROCESS);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(modify(AsyncProcessModels.ASYNC_AFTER_USER_TASK_PROCESS).activityBuilder("userTask1").userTask("userTask3").endEvent().done());
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapEqualActivities().build();
ProcessInstance processInstance = rule.getRuntimeService().startProcessInstanceById(sourceProcessDefinition.getId());
testHelper.completeTask("userTask1");
// when
testHelper.migrateProcessInstance(migrationPlan, processInstance);
// then
testHelper.assertJobMigrated("userTask1", "userTask1", AsyncContinuationJobHandler.TYPE);
// and it is possible to successfully execute the migrated job
Job job = testHelper.snapshotAfterMigration.getJobs().get(0);
rule.getManagementService().executeJob(job.getId());
// and complete the process instance
testHelper.completeTask("userTask2");
testHelper.assertProcessEnded(testHelper.snapshotBeforeMigration.getProcessInstanceId());
}
Aggregations