Search in sources :

Example 6 with MigratingBpmnEventTrigger

use of org.camunda.bpm.engine.test.api.runtime.migration.util.MigratingBpmnEventTrigger in project camunda-bpm-platform by camunda.

the class MigrationBoundaryEventsParameterizedTest method testMigrateBoundaryEventToParallelSubProcess.

@Test
public void testMigrateBoundaryEventToParallelSubProcess() {
    // given
    BpmnModelInstance sourceProcess = ProcessModels.PARALLEL_SUBPROCESS_PROCESS.clone();
    MigratingBpmnEventTrigger eventTrigger = eventFactory.addBoundaryEvent(rule.getProcessEngine(), sourceProcess, "subProcess1", BOUNDARY_ID);
    ModifiableBpmnModelInstance.wrap(sourceProcess).flowNodeBuilder(BOUNDARY_ID).userTask(AFTER_BOUNDARY_TASK).endEvent().done();
    BpmnModelInstance targetProcess = modify(sourceProcess).changeElementId(BOUNDARY_ID, NEW_BOUNDARY_ID);
    ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(sourceProcess);
    ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(targetProcess);
    MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("subProcess1", "subProcess1").mapActivities(USER_TASK_1_ID, USER_TASK_1_ID).mapActivities("subProcess2", "subProcess2").mapActivities(USER_TASK_2_ID, USER_TASK_2_ID).mapActivities(BOUNDARY_ID, NEW_BOUNDARY_ID).updateEventTrigger().build();
    // when
    testHelper.createProcessInstanceAndMigrate(migrationPlan);
    // then
    eventTrigger.assertEventTriggerMigrated(testHelper, NEW_BOUNDARY_ID);
    // and it is possible to successfully complete the migrated instance
    testHelper.completeTask(USER_TASK_1_ID);
    testHelper.completeTask(USER_TASK_2_ID);
    testHelper.assertProcessEnded(testHelper.snapshotBeforeMigration.getProcessInstanceId());
}
Also used : MigratingBpmnEventTrigger(org.camunda.bpm.engine.test.api.runtime.migration.util.MigratingBpmnEventTrigger) MigrationPlan(org.camunda.bpm.engine.migration.MigrationPlan) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance) Test(org.junit.Test)

Example 7 with MigratingBpmnEventTrigger

use of org.camunda.bpm.engine.test.api.runtime.migration.util.MigratingBpmnEventTrigger in project camunda-bpm-platform by camunda.

the class MigrationActiveEventSubProcessTest method testMigrateActiveCompensationEventSubProcess.

@Test
public void testMigrateActiveCompensationEventSubProcess() {
    // given
    BpmnModelInstance processModel = ProcessModels.ONE_TASK_PROCESS.clone();
    MigratingBpmnEventTrigger eventTrigger = eventFactory.addEventSubProcess(rule.getProcessEngine(), processModel, ProcessModels.PROCESS_KEY, "eventSubProcess", "eventSubProcessStart");
    ModifiableBpmnModelInstance.wrap(processModel).startEventBuilder("eventSubProcessStart").userTask("eventSubProcessTask").endEvent().done();
    ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(processModel);
    ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(processModel);
    ProcessInstance processInstance = rule.getRuntimeService().createProcessInstanceById(sourceProcessDefinition.getId()).startBeforeActivity("eventSubProcessStart").executeWithVariablesInReturn();
    MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("eventSubProcess", "eventSubProcess").mapActivities("eventSubProcessStart", "eventSubProcessStart").updateEventTrigger().mapActivities("eventSubProcessTask", "eventSubProcessTask").build();
    // when
    testHelper.migrateProcessInstance(migrationPlan, processInstance);
    // then
    eventTrigger.assertEventTriggerMigrated(testHelper, "eventSubProcessStart");
    // and it is possible to complete the process instance
    testHelper.completeTask("eventSubProcessTask");
    testHelper.assertProcessEnded(processInstance.getId());
}
Also used : MigratingBpmnEventTrigger(org.camunda.bpm.engine.test.api.runtime.migration.util.MigratingBpmnEventTrigger) MigrationPlan(org.camunda.bpm.engine.migration.MigrationPlan) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance) Test(org.junit.Test)

Example 8 with MigratingBpmnEventTrigger

use of org.camunda.bpm.engine.test.api.runtime.migration.util.MigratingBpmnEventTrigger in project camunda-bpm-platform by camunda.

the class MigrationBoundaryEventsParameterizedTest method testMigrateBoundaryEventToSubProcessWithScopeUserTaskAndTriggerEvent.

@Test
public void testMigrateBoundaryEventToSubProcessWithScopeUserTaskAndTriggerEvent() {
    // given
    BpmnModelInstance sourceProcess = ProcessModels.SCOPE_TASK_SUBPROCESS_PROCESS.clone();
    MigratingBpmnEventTrigger eventTrigger = eventFactory.addBoundaryEvent(rule.getProcessEngine(), sourceProcess, SUB_PROCESS_ID, BOUNDARY_ID);
    ModifiableBpmnModelInstance.wrap(sourceProcess).flowNodeBuilder(BOUNDARY_ID).userTask(AFTER_BOUNDARY_TASK).endEvent().done();
    BpmnModelInstance targetProcess = modify(sourceProcess).changeElementId(BOUNDARY_ID, NEW_BOUNDARY_ID);
    ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(sourceProcess);
    ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(targetProcess);
    MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities(SUB_PROCESS_ID, SUB_PROCESS_ID).mapActivities(USER_TASK_ID, USER_TASK_ID).mapActivities(BOUNDARY_ID, NEW_BOUNDARY_ID).updateEventTrigger().build();
    // when
    ProcessInstance processInstance = testHelper.createProcessInstanceAndMigrate(migrationPlan);
    // then it is possible to trigger the event and successfully complete the migrated instance
    eventTrigger.inContextOf(NEW_BOUNDARY_ID).trigger(processInstance.getId());
    testHelper.completeTask(AFTER_BOUNDARY_TASK);
    testHelper.assertProcessEnded(testHelper.snapshotBeforeMigration.getProcessInstanceId());
}
Also used : MigratingBpmnEventTrigger(org.camunda.bpm.engine.test.api.runtime.migration.util.MigratingBpmnEventTrigger) MigrationPlan(org.camunda.bpm.engine.migration.MigrationPlan) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance) Test(org.junit.Test)

Example 9 with MigratingBpmnEventTrigger

use of org.camunda.bpm.engine.test.api.runtime.migration.util.MigratingBpmnEventTrigger in project camunda-bpm-platform by camunda.

the class MigrationBoundaryEventsParameterizedTest method testMigrateBoundaryEventToSubProcess.

@Test
public void testMigrateBoundaryEventToSubProcess() {
    // given
    BpmnModelInstance sourceProcess = ProcessModels.SUBPROCESS_PROCESS.clone();
    MigratingBpmnEventTrigger eventTrigger = eventFactory.addBoundaryEvent(rule.getProcessEngine(), sourceProcess, SUB_PROCESS_ID, BOUNDARY_ID);
    ModifiableBpmnModelInstance.wrap(sourceProcess).flowNodeBuilder(BOUNDARY_ID).userTask(AFTER_BOUNDARY_TASK).endEvent().done();
    BpmnModelInstance targetProcess = modify(sourceProcess).changeElementId(BOUNDARY_ID, NEW_BOUNDARY_ID);
    ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(sourceProcess);
    ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(targetProcess);
    MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities(SUB_PROCESS_ID, SUB_PROCESS_ID).mapActivities(USER_TASK_ID, USER_TASK_ID).mapActivities(BOUNDARY_ID, NEW_BOUNDARY_ID).updateEventTrigger().build();
    // when
    testHelper.createProcessInstanceAndMigrate(migrationPlan);
    // then
    eventTrigger.assertEventTriggerMigrated(testHelper, NEW_BOUNDARY_ID);
    // and it is possible to successfully complete the migrated instance
    testHelper.completeTask(USER_TASK_ID);
    testHelper.assertProcessEnded(testHelper.snapshotBeforeMigration.getProcessInstanceId());
}
Also used : MigratingBpmnEventTrigger(org.camunda.bpm.engine.test.api.runtime.migration.util.MigratingBpmnEventTrigger) MigrationPlan(org.camunda.bpm.engine.migration.MigrationPlan) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance) Test(org.junit.Test)

Example 10 with MigratingBpmnEventTrigger

use of org.camunda.bpm.engine.test.api.runtime.migration.util.MigratingBpmnEventTrigger in project camunda-bpm-platform by camunda.

the class MigrationBoundaryEventsParameterizedTest method testMigrateBoundaryEventOnUserTask.

// tests ////////////////////////////////////////////////////////////////////////////////////////////////////////////
@Test
public void testMigrateBoundaryEventOnUserTask() {
    // given
    BpmnModelInstance sourceProcess = ProcessModels.ONE_TASK_PROCESS.clone();
    MigratingBpmnEventTrigger eventTrigger = eventFactory.addBoundaryEvent(rule.getProcessEngine(), sourceProcess, USER_TASK_ID, BOUNDARY_ID);
    ModifiableBpmnModelInstance.wrap(sourceProcess).flowNodeBuilder(BOUNDARY_ID).userTask(AFTER_BOUNDARY_TASK).endEvent().done();
    BpmnModelInstance targetProcess = modify(sourceProcess).changeElementId(BOUNDARY_ID, NEW_BOUNDARY_ID);
    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(BOUNDARY_ID, NEW_BOUNDARY_ID).updateEventTrigger().build();
    // when
    testHelper.createProcessInstanceAndMigrate(migrationPlan);
    // then
    eventTrigger.assertEventTriggerMigrated(testHelper, NEW_BOUNDARY_ID);
    // and it is possible to successfully complete the migrated instance
    testHelper.completeTask(USER_TASK_ID);
    testHelper.assertProcessEnded(testHelper.snapshotBeforeMigration.getProcessInstanceId());
}
Also used : MigratingBpmnEventTrigger(org.camunda.bpm.engine.test.api.runtime.migration.util.MigratingBpmnEventTrigger) MigrationPlan(org.camunda.bpm.engine.migration.MigrationPlan) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance) Test(org.junit.Test)

Aggregations

MigrationPlan (org.camunda.bpm.engine.migration.MigrationPlan)14 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)14 MigratingBpmnEventTrigger (org.camunda.bpm.engine.test.api.runtime.migration.util.MigratingBpmnEventTrigger)14 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)14 Test (org.junit.Test)14 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)8