use of org.camunda.bpm.engine.cdi.BusinessProcess in project camunda-bpm-platform by camunda.
the class StartProcessTest method testStartProcessByKey.
@Test
@Deployment(resources = "org/camunda/bpm/engine/cdi/test/api/annotation/StartProcessTest.bpmn20.xml")
public void testStartProcessByKey() {
assertNull(runtimeService.createProcessInstanceQuery().singleResult());
getBeanInstance(DeclarativeProcessController.class).startProcessByKey();
BusinessProcess businessProcess = getBeanInstance(BusinessProcess.class);
assertNotNull(runtimeService.createProcessInstanceQuery().singleResult());
assertEquals("camunda", businessProcess.getVariable("name"));
TypedValue nameTypedValue = businessProcess.getVariableTyped("name");
assertNotNull(nameTypedValue);
assertTrue(nameTypedValue instanceof StringValue);
assertEquals(ValueType.STRING, nameTypedValue.getType());
assertEquals("camunda", nameTypedValue.getValue());
assertEquals("untypedName", businessProcess.getVariable("untypedName"));
TypedValue untypedNameTypedValue = businessProcess.getVariableTyped("untypedName");
assertNotNull(untypedNameTypedValue);
assertTrue(untypedNameTypedValue instanceof StringValue);
assertEquals(ValueType.STRING, untypedNameTypedValue.getType());
assertEquals("untypedName", untypedNameTypedValue.getValue());
assertEquals("typedName", businessProcess.getVariable("typedName"));
TypedValue typedNameTypedValue = businessProcess.getVariableTyped("typedName");
assertNotNull(typedNameTypedValue);
assertTrue(typedNameTypedValue instanceof StringValue);
assertEquals(ValueType.STRING, typedNameTypedValue.getType());
assertEquals("typedName", typedNameTypedValue.getValue());
businessProcess.startTask(taskService.createTaskQuery().singleResult().getId());
businessProcess.completeTask();
}
use of org.camunda.bpm.engine.cdi.BusinessProcess in project camunda-bpm-platform by camunda.
the class TaskIdTest method testTaskIdInjectable.
@Test
@Deployment
public void testTaskIdInjectable() {
BusinessProcess businessProcess = getBeanInstance(BusinessProcess.class);
businessProcess.startProcessByKey("keyOfTheProcess");
businessProcess.startTask(taskService.createTaskQuery().singleResult().getId());
// assert that now the 'taskId'-bean can be looked up
assertNotNull(getBeanInstance("taskId"));
businessProcess.completeTask();
}
use of org.camunda.bpm.engine.cdi.BusinessProcess in project camunda-bpm-platform by camunda.
the class BusinessProcessContextTest method testResolution.
@Test
@Deployment
public void testResolution() throws Exception {
BusinessProcess businessProcess = getBeanInstance(BusinessProcess.class);
businessProcess.startProcessByKey("testResolution").getId();
assertNotNull(getBeanInstance(CreditCard.class));
}
Aggregations