use of org.camunda.bpm.engine.repository.ProcessDefinition in project camunda-bpm-platform by camunda.
the class DelegateExecutionContextTest method testDelegateExecutionContext.
@Test
public void testDelegateExecutionContext() {
// given
ProcessDefinition definition = testHelper.deployAndGetDefinition(DELEGATION_PROCESS);
// a process instance with a service task and a java delegate
ProcessInstance instance = engineRule.getRuntimeService().startProcessInstanceById(definition.getId());
// then delegation execution context is no more available
DelegateExecution execution = DelegateExecutionContext.getCurrentDelegationExecution();
assertNull(execution);
}
use of org.camunda.bpm.engine.repository.ProcessDefinition in project camunda-bpm-platform by camunda.
the class DelegateExecutionContextTest method testDelegateExecutionContextWithExecutionListener.
@Test
public void testDelegateExecutionContextWithExecutionListener() {
// given
ProcessDefinition definition = testHelper.deployAndGetDefinition(EXEUCTION_LISTENER_PROCESS);
// a process instance with a service task and an execution listener
engineRule.getRuntimeService().startProcessInstanceById(definition.getId());
// then delegation execution context is no more available
DelegateExecution execution = DelegateExecutionContext.getCurrentDelegationExecution();
assertNull(execution);
}
use of org.camunda.bpm.engine.repository.ProcessDefinition in project camunda-bpm-platform by camunda.
the class DeploymentCacheCfgTest method testDescriptionIsNullWhenFetchProcessDefinitionDescriptionIsDisabled.
@Test
public void testDescriptionIsNullWhenFetchProcessDefinitionDescriptionIsDisabled() {
// given
deploy(ProcessModels.ONE_TASK_PROCESS_WITH_DOCUMENTATION);
runtimeService.startProcessInstanceByKey(ProcessModels.PROCESS_KEY);
// when
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey(ProcessModels.PROCESS_KEY).singleResult();
// then
assertNull(processDefinition.getDescription());
}
use of org.camunda.bpm.engine.repository.ProcessDefinition in project camunda-bpm-platform by camunda.
the class MigrateProcessInstanceAsyncTest method testMigrate.
@Test
@Deployment(resources = "org/camunda/bpm/engine/test/api/authorization/oneIncidentProcess.bpmn20.xml")
public void testMigrate() {
// given
ProcessDefinition sourceDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
ProcessDefinition targetDefinition = testHelper.deployAndGetDefinition(modify(ProcessModels.ONE_TASK_PROCESS).changeElementId(ProcessModels.PROCESS_KEY, "new" + ProcessModels.PROCESS_KEY));
ProcessInstance processInstance = engineRule.getRuntimeService().startProcessInstanceById(sourceDefinition.getId());
MigrationPlan migrationPlan = engineRule.getRuntimeService().createMigrationPlan(sourceDefinition.getId(), targetDefinition.getId()).mapEqualActivities().build();
// when
authRule.init(scenario).withUser("userId").bindResource("sourceDefinitionKey", sourceDefinition.getKey()).bindResource("targetDefinitionKey", targetDefinition.getKey()).bindResource("processInstance", processInstance.getId()).start();
batch = engineRule.getRuntimeService().newMigration(migrationPlan).processInstanceIds(Arrays.asList(processInstance.getId())).executeAsync();
// then
if (authRule.assertScenario(scenario)) {
Assert.assertEquals(1, engineRule.getManagementService().createBatchQuery().count());
}
}
use of org.camunda.bpm.engine.repository.ProcessDefinition in project camunda-bpm-platform by camunda.
the class MigrateProcessInstanceAsyncTest method testMigrateWithQuery.
@Test
@Deployment(resources = "org/camunda/bpm/engine/test/api/authorization/oneIncidentProcess.bpmn20.xml")
public void testMigrateWithQuery() {
// given
ProcessDefinition sourceDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
ProcessDefinition targetDefinition = testHelper.deployAndGetDefinition(modify(ProcessModels.ONE_TASK_PROCESS).changeElementId(ProcessModels.PROCESS_KEY, "new" + ProcessModels.PROCESS_KEY));
ProcessInstance processInstance = engineRule.getRuntimeService().startProcessInstanceById(sourceDefinition.getId());
MigrationPlan migrationPlan = engineRule.getRuntimeService().createMigrationPlan(sourceDefinition.getId(), targetDefinition.getId()).mapEqualActivities().build();
ProcessInstanceQuery query = engineRule.getRuntimeService().createProcessInstanceQuery();
// when
authRule.init(scenario).withUser("userId").bindResource("sourceDefinitionKey", sourceDefinition.getKey()).bindResource("targetDefinitionKey", targetDefinition.getKey()).bindResource("processInstance", processInstance.getId()).start();
batch = engineRule.getRuntimeService().newMigration(migrationPlan).processInstanceQuery(query).executeAsync();
// then
if (authRule.assertScenario(scenario)) {
Assert.assertEquals(1, engineRule.getManagementService().createBatchQuery().count());
}
}
Aggregations