use of org.camunda.bpm.engine.test.Deployment in project camunda-bpm-platform by camunda.
the class CompleteTaskTest method testCompleteTask.
@Test
@Deployment(resources = "org/camunda/bpm/engine/cdi/test/api/annotation/CompleteTaskTest.bpmn20.xml")
public void testCompleteTask() {
BusinessProcess businessProcess = getBeanInstance(BusinessProcess.class);
businessProcess.startProcessByKey("keyOfTheProcess");
Task task = taskService.createTaskQuery().singleResult();
// associate current unit of work with the task:
businessProcess.startTask(task.getId());
getBeanInstance(DeclarativeProcessController.class).completeTask();
// assert that now the task is completed
assertNull(taskService.createTaskQuery().singleResult());
}
use of org.camunda.bpm.engine.test.Deployment in project camunda-bpm-platform by camunda.
the class ProcessVariableTypedTest method testProcessVariableTypeAnnotation.
@Test
@Deployment(resources = "org/camunda/bpm/engine/cdi/test/api/annotation/CompleteTaskTest.bpmn20.xml")
public void testProcessVariableTypeAnnotation() {
BusinessProcess businessProcess = getBeanInstance(BusinessProcess.class);
VariableMap variables = Variables.createVariables().putValue("injectedValue", "camunda");
businessProcess.startProcessByKey("keyOfTheProcess", variables);
TypedValue value = getBeanInstance(DeclarativeProcessController.class).getInjectedValue();
assertNotNull(value);
assertTrue(value instanceof StringValue);
assertEquals(ValueType.STRING, value.getType());
assertEquals("camunda", value.getValue());
}
use of org.camunda.bpm.engine.test.Deployment in project camunda-bpm-platform by camunda.
the class ProcessVariableLocalTypedTest method testProcessVariableLocalTypeAnnotation.
@Test
@Deployment(resources = "org/camunda/bpm/engine/cdi/test/api/annotation/CompleteTaskTest.bpmn20.xml")
public void testProcessVariableLocalTypeAnnotation() {
BusinessProcess businessProcess = getBeanInstance(BusinessProcess.class);
VariableMap variables = Variables.createVariables().putValue("injectedLocalValue", "camunda");
businessProcess.startProcessByKey("keyOfTheProcess", variables);
TypedValue value = getBeanInstance(DeclarativeProcessController.class).getInjectedLocalValue();
assertNotNull(value);
assertTrue(value instanceof StringValue);
assertEquals(ValueType.STRING, value.getType());
assertEquals("camunda", value.getValue());
}
use of org.camunda.bpm.engine.test.Deployment in project camunda-bpm-platform by camunda.
the class ConnectProcessEnginePluginTest method testConnectorBpmnErrorThrownInScriptResourceInputMappingIsHandledByBoundaryEvent.
@Deployment(resources = "org/camunda/connect/plugin/ConnectProcessEnginePluginTest.testConnectorWithThrownExceptionInScriptResourceInputOutputMapping.bpmn")
public void testConnectorBpmnErrorThrownInScriptResourceInputMappingIsHandledByBoundaryEvent() {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("throwInMapping", "in");
variables.put("exception", new BpmnError("error"));
runtimeService.startProcessInstanceByKey("testProcess", variables);
// we will only reach the user task if the BPMNError from the script was handled by the boundary event
Task task = taskService.createTaskQuery().singleResult();
assertThat(task.getName(), is("User Task"));
}
use of org.camunda.bpm.engine.test.Deployment in project camunda-bpm-platform by camunda.
the class ConnectProcessEnginePluginTest method testIntermediateMessageThrowEventWithConnector.
@Deployment
public void testIntermediateMessageThrowEventWithConnector() {
String outputParamValue = "someMessageThrowOutputValue";
String inputVariableValue = "someMessageThrowInputVariableValue";
TestConnector.responseParameters.put("someOutputParameter", outputParamValue);
Map<String, Object> vars = new HashMap<String, Object>();
vars.put("someInputVariable", inputVariableValue);
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process_sending_with_connector", vars);
// validate input parameter
assertNotNull(TestConnector.requestParameters.get("reqParam1"));
assertEquals(inputVariableValue, TestConnector.requestParameters.get("reqParam1"));
// validate connector output
VariableInstance variable = runtimeService.createVariableInstanceQuery().variableName("out1").singleResult();
assertNotNull(variable);
assertEquals(outputParamValue, variable.getValue());
}
Aggregations