use of org.camunda.bpm.model.bpmn.BpmnModelInstance in project camunda-bpm-platform by camunda.
the class MigrationEventSubProcessTest method testUpdateConditionalEventExpression.
@Test
public void testUpdateConditionalEventExpression() {
// given
BpmnModelInstance sourceProcess = EventSubProcessModels.FALSE_CONDITIONAL_EVENT_SUBPROCESS_PROCESS;
BpmnModelInstance targetProcess = modify(CONDITIONAL_EVENT_SUBPROCESS_PROCESS);
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(sourceProcess);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(targetProcess);
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities(USER_TASK_ID, USER_TASK_ID).mapActivities(EVENT_SUB_PROCESS_START_ID, EVENT_SUB_PROCESS_START_ID).updateEventTrigger().build();
// when process is migrated without update event trigger
testHelper.createProcessInstanceAndMigrate(migrationPlan);
// then condition is migrated and has new condition expr
testHelper.assertEventSubscriptionMigrated(EVENT_SUB_PROCESS_START_ID, EVENT_SUB_PROCESS_START_ID, null);
// and it is possible to successfully complete the migrated instance
testHelper.setAnyVariable(testHelper.snapshotAfterMigration.getProcessInstanceId());
testHelper.completeTask(EVENT_SUB_PROCESS_TASK_ID);
testHelper.assertProcessEnded(testHelper.snapshotBeforeMigration.getProcessInstanceId());
}
use of org.camunda.bpm.model.bpmn.BpmnModelInstance in project camunda-bpm-platform by camunda.
the class MigrationEventSubProcessTest method testMigrateNonInterruptingEventSubprocessMessageTrigger.
@Test
public void testMigrateNonInterruptingEventSubprocessMessageTrigger() {
BpmnModelInstance nonInterruptingModel = modify(EventSubProcessModels.MESSAGE_EVENT_SUBPROCESS_PROCESS).startEventBuilder(EVENT_SUB_PROCESS_START_ID).interrupting(false).done();
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(nonInterruptingModel);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(nonInterruptingModel);
ProcessInstance processInstance = rule.getRuntimeService().startProcessInstanceById(sourceProcessDefinition.getId());
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities(USER_TASK_ID, USER_TASK_ID).mapActivities(EVENT_SUB_PROCESS_START_ID, EVENT_SUB_PROCESS_START_ID).build();
// when
testHelper.migrateProcessInstance(migrationPlan, processInstance);
// then
testHelper.assertEventSubscriptionMigrated(EVENT_SUB_PROCESS_START_ID, EVENT_SUB_PROCESS_START_ID, EventSubProcessModels.MESSAGE_NAME);
// and it is possible to trigger the event subprocess
rule.getRuntimeService().correlateMessage(EventSubProcessModels.MESSAGE_NAME);
Assert.assertEquals(2, rule.getTaskService().createTaskQuery().count());
// and complete the process instance
testHelper.completeTask(EVENT_SUB_PROCESS_TASK_ID);
testHelper.completeTask(USER_TASK_ID);
testHelper.assertProcessEnded(processInstance.getId());
}
use of org.camunda.bpm.model.bpmn.BpmnModelInstance in project camunda-bpm-platform by camunda.
the class MigrationPlanCreationTest method testMapEqualActivitiesWithParallelMultiInstance.
@Test
public void testMapEqualActivitiesWithParallelMultiInstance() {
// given
BpmnModelInstance testProcess = modify(ProcessModels.ONE_TASK_PROCESS).getBuilderForElementById("userTask", UserTaskBuilder.class).multiInstance().parallel().cardinality("3").multiInstanceDone().done();
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(testProcess);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(testProcess);
// when
try {
runtimeService.createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("userTask", "userTask").build();
fail("Should not succeed");
} catch (MigrationPlanValidationException e) {
assertThat(e.getValidationReport()).hasInstructionFailures("userTask", "Target activity 'userTask' is a descendant of multi-instance body 'userTask#multiInstanceBody' " + "that is not mapped from the source process definition.");
}
}
use of org.camunda.bpm.model.bpmn.BpmnModelInstance in project camunda-bpm-platform by camunda.
the class MigrationPlanCreationTest method testMapEqualBoundaryEvents.
@Test
public void testMapEqualBoundaryEvents() {
BpmnModelInstance testProcess = modify(ProcessModels.ONE_TASK_PROCESS).activityBuilder("userTask").boundaryEvent("boundary").message(MESSAGE_NAME).done();
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(testProcess);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(testProcess);
MigrationPlan migrationPlan = runtimeService.createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("userTask", "userTask").mapActivities("boundary", "boundary").build();
assertThat(migrationPlan).hasSourceProcessDefinition(sourceProcessDefinition).hasTargetProcessDefinition(targetProcessDefinition).hasInstructions(migrate("userTask").to("userTask"), migrate("boundary").to("boundary"));
}
use of org.camunda.bpm.model.bpmn.BpmnModelInstance in project camunda-bpm-platform by camunda.
the class MigrationPlanCreationTest method testMapBoundaryToMigratedActivity.
@Test
public void testMapBoundaryToMigratedActivity() {
BpmnModelInstance sourceProcess = modify(ProcessModels.ONE_TASK_PROCESS).activityBuilder("userTask").boundaryEvent("boundary").message(MESSAGE_NAME).done();
BpmnModelInstance targetProcess = modify(sourceProcess).changeElementId("userTask", "newUserTask");
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(sourceProcess);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(targetProcess);
MigrationPlan migrationPlan = runtimeService.createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("userTask", "newUserTask").mapActivities("boundary", "boundary").build();
assertThat(migrationPlan).hasSourceProcessDefinition(sourceProcessDefinition).hasTargetProcessDefinition(targetProcessDefinition).hasInstructions(migrate("userTask").to("newUserTask"), migrate("boundary").to("boundary"));
}
Aggregations