Search in sources :

Example 86 with BpmnModelInstance

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());
}
Also used : 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 87 with BpmnModelInstance

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());
}
Also used : 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 88 with BpmnModelInstance

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.");
    }
}
Also used : UserTaskBuilder(org.camunda.bpm.model.bpmn.builder.UserTaskBuilder) MigrationPlanValidationException(org.camunda.bpm.engine.migration.MigrationPlanValidationException) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance) Test(org.junit.Test)

Example 89 with BpmnModelInstance

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"));
}
Also used : 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 90 with BpmnModelInstance

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"));
}
Also used : 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

BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)587 Test (org.junit.Test)408 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)258 Task (org.camunda.bpm.engine.task.Task)139 TaskQuery (org.camunda.bpm.engine.task.TaskQuery)124 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)119 MigrationPlan (org.camunda.bpm.engine.migration.MigrationPlan)67 ProcessApplicationDeployment (org.camunda.bpm.engine.repository.ProcessApplicationDeployment)47 Deployment (org.camunda.bpm.engine.repository.Deployment)39 ProcessDefinitionQuery (org.camunda.bpm.engine.repository.ProcessDefinitionQuery)27 Job (org.camunda.bpm.engine.runtime.Job)24 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)22 VariableInstance (org.camunda.bpm.engine.runtime.VariableInstance)21 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)16 Date (java.util.Date)15 HashMap (java.util.HashMap)15 HistoricVariableInstance (org.camunda.bpm.engine.history.HistoricVariableInstance)14 Execution (org.camunda.bpm.engine.runtime.Execution)14 MigratingBpmnEventTrigger (org.camunda.bpm.engine.test.api.runtime.migration.util.MigratingBpmnEventTrigger)14 SequenceFlow (org.camunda.bpm.model.bpmn.instance.SequenceFlow)14