Search in sources :

Example 11 with Deployment

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());
}
Also used : Task(org.camunda.bpm.engine.task.Task) DeclarativeProcessController(org.camunda.bpm.engine.cdi.test.impl.beans.DeclarativeProcessController) BusinessProcess(org.camunda.bpm.engine.cdi.BusinessProcess) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 12 with Deployment

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());
}
Also used : VariableMap(org.camunda.bpm.engine.variable.VariableMap) DeclarativeProcessController(org.camunda.bpm.engine.cdi.test.impl.beans.DeclarativeProcessController) StringValue(org.camunda.bpm.engine.variable.value.StringValue) BusinessProcess(org.camunda.bpm.engine.cdi.BusinessProcess) TypedValue(org.camunda.bpm.engine.variable.value.TypedValue) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 13 with Deployment

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());
}
Also used : VariableMap(org.camunda.bpm.engine.variable.VariableMap) DeclarativeProcessController(org.camunda.bpm.engine.cdi.test.impl.beans.DeclarativeProcessController) StringValue(org.camunda.bpm.engine.variable.value.StringValue) BusinessProcess(org.camunda.bpm.engine.cdi.BusinessProcess) TypedValue(org.camunda.bpm.engine.variable.value.TypedValue) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 14 with Deployment

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"));
}
Also used : Task(org.camunda.bpm.engine.task.Task) HashMap(java.util.HashMap) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) BpmnError(org.camunda.bpm.engine.delegate.BpmnError) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 15 with Deployment

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());
}
Also used : HashMap(java.util.HashMap) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) HistoricVariableInstance(org.camunda.bpm.engine.history.HistoricVariableInstance) VariableInstance(org.camunda.bpm.engine.runtime.VariableInstance) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

Deployment (org.camunda.bpm.engine.test.Deployment)3376 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)1325 Task (org.camunda.bpm.engine.task.Task)788 Test (org.junit.Test)635 HashMap (java.util.HashMap)441 Job (org.camunda.bpm.engine.runtime.Job)310 ActivityInstance (org.camunda.bpm.engine.runtime.ActivityInstance)277 VariableInstance (org.camunda.bpm.engine.runtime.VariableInstance)265 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)256 CaseExecution (org.camunda.bpm.engine.runtime.CaseExecution)251 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)230 VariableInstanceQuery (org.camunda.bpm.engine.runtime.VariableInstanceQuery)206 TaskQuery (org.camunda.bpm.engine.task.TaskQuery)195 Execution (org.camunda.bpm.engine.runtime.Execution)189 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)175 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)161 CaseInstance (org.camunda.bpm.engine.runtime.CaseInstance)149 JobQuery (org.camunda.bpm.engine.runtime.JobQuery)143 ExecutionAssert.describeExecutionTree (org.camunda.bpm.engine.test.util.ExecutionAssert.describeExecutionTree)134 ExecutionTree (org.camunda.bpm.engine.test.util.ExecutionTree)134