use of org.camunda.bpm.engine.migration.MigrationPlan in project camunda-bpm-platform by camunda.
the class MigrationProcessInstanceTest method testProcessInstanceIdsAndQuery.
@Test
public void testProcessInstanceIdsAndQuery() {
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
MigrationPlan migrationPlan = runtimeService.createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapEqualActivities().build();
ProcessInstance processInstance1 = runtimeService.startProcessInstanceById(sourceProcessDefinition.getId());
ProcessInstance processInstance2 = runtimeService.startProcessInstanceById(sourceProcessDefinition.getId());
ProcessInstanceQuery sourceProcessInstanceQuery = runtimeService.createProcessInstanceQuery().processInstanceId(processInstance2.getId());
ProcessInstanceQuery targetProcessInstanceQuery = runtimeService.createProcessInstanceQuery().processDefinitionId(targetProcessDefinition.getId());
assertEquals(0, targetProcessInstanceQuery.count());
runtimeService.newMigration(migrationPlan).processInstanceIds(Collections.singletonList(processInstance1.getId())).processInstanceQuery(sourceProcessInstanceQuery).execute();
assertEquals(2, targetProcessInstanceQuery.count());
}
use of org.camunda.bpm.engine.migration.MigrationPlan in project camunda-bpm-platform by camunda.
the class MigrationProcessInstanceTest method testProcessInstanceIdsListWithNullValue.
@Test
public void testProcessInstanceIdsListWithNullValue() {
ProcessDefinition testProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
MigrationPlan migrationPlan = runtimeService.createMigrationPlan(testProcessDefinition.getId(), testProcessDefinition.getId()).mapEqualActivities().build();
try {
runtimeService.newMigration(migrationPlan).processInstanceIds(Arrays.asList("foo", null, "bar")).execute();
fail("Should not be able to migrate");
} catch (ProcessEngineException e) {
assertThat(e.getMessage(), CoreMatchers.containsString("process instance ids contains null value"));
}
}
use of org.camunda.bpm.engine.migration.MigrationPlan in project camunda-bpm-platform by camunda.
the class MigrationProcessInstanceTest method testMigrateWithIdVarargsArray.
@Test
public void testMigrateWithIdVarargsArray() {
ProcessDefinition sourceDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
ProcessDefinition targetDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
MigrationPlan migrationPlan = runtimeService.createMigrationPlan(sourceDefinition.getId(), targetDefinition.getId()).mapEqualActivities().build();
ProcessInstance processInstance1 = runtimeService.startProcessInstanceById(sourceDefinition.getId());
ProcessInstance processInstance2 = runtimeService.startProcessInstanceById(sourceDefinition.getId());
// when
runtimeService.newMigration(migrationPlan).processInstanceIds(processInstance1.getId(), processInstance2.getId()).execute();
// then
Assert.assertEquals(2, runtimeService.createProcessInstanceQuery().processDefinitionId(targetDefinition.getId()).count());
}
use of org.camunda.bpm.engine.migration.MigrationPlan in project camunda-bpm-platform by camunda.
the class MigrationProcessInstanceTest method testOverlappingProcessInstanceIdsAndQuery.
@Test
public void testOverlappingProcessInstanceIdsAndQuery() {
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
MigrationPlan migrationPlan = runtimeService.createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapEqualActivities().build();
ProcessInstance processInstance1 = runtimeService.startProcessInstanceById(sourceProcessDefinition.getId());
ProcessInstance processInstance2 = runtimeService.startProcessInstanceById(sourceProcessDefinition.getId());
ProcessInstanceQuery sourceProcessInstanceQuery = runtimeService.createProcessInstanceQuery().processDefinitionId(sourceProcessDefinition.getId());
ProcessInstanceQuery targetProcessInstanceQuery = runtimeService.createProcessInstanceQuery().processDefinitionId(targetProcessDefinition.getId());
assertEquals(0, targetProcessInstanceQuery.count());
runtimeService.newMigration(migrationPlan).processInstanceIds(Arrays.asList(processInstance1.getId(), processInstance2.getId())).processInstanceQuery(sourceProcessInstanceQuery).execute();
assertEquals(2, targetProcessInstanceQuery.count());
}
use of org.camunda.bpm.engine.migration.MigrationPlan in project camunda-bpm-platform by camunda.
the class MigrationProcessInstanceTest method testNullProcessInstanceIdsList.
@Test
public void testNullProcessInstanceIdsList() {
ProcessDefinition testProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
MigrationPlan migrationPlan = runtimeService.createMigrationPlan(testProcessDefinition.getId(), testProcessDefinition.getId()).mapEqualActivities().build();
try {
runtimeService.newMigration(migrationPlan).processInstanceIds((List<String>) null).execute();
fail("Should not be able to migrate");
} catch (ProcessEngineException e) {
assertThat(e.getMessage(), CoreMatchers.containsString("process instance ids is empty"));
}
}
Aggregations