use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.
the class ProcessTaskTest method testCallProcessByVersion.
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/processtask/ProcessTaskTest.testCallProcessByVersion.cmmn", "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testCallProcessByVersion() {
// given
String bpmnResourceName = "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml";
String secondDeploymentId = repositoryService.createDeployment().addClasspathResource(bpmnResourceName).deploy().getId();
String thirdDeploymentId = repositoryService.createDeployment().addClasspathResource(bpmnResourceName).deploy().getId();
assertEquals(3, repositoryService.createProcessDefinitionQuery().count());
String caseInstanceId = createCaseInstanceByKey(ONE_PROCESS_TASK_CASE).getId();
String processTaskId = queryCaseExecutionByActivityId(PROCESS_TASK).getId();
// latest process definition
String processDefinitionIdInSecondDeployment = repositoryService.createProcessDefinitionQuery().deploymentId(secondDeploymentId).singleResult().getId();
// then
// there exists a process instance
ExecutionEntity processInstance = (ExecutionEntity) queryProcessInstance();
assertNotNull(processInstance);
// the case instance id is set on called process instance
assertEquals(caseInstanceId, processInstance.getCaseInstanceId());
// the super case execution id is equals the processTaskId
assertEquals(processTaskId, processInstance.getSuperCaseExecutionId());
// it is associated with the correct process definition
assertEquals(processDefinitionIdInSecondDeployment, processInstance.getProcessDefinitionId());
TaskEntity task = (TaskEntity) queryTask();
// the case instance id has been also set on the task
assertEquals(caseInstanceId, task.getCaseInstanceId());
// the case execution id should be null
assertNull(task.getCaseExecutionId());
// complete ////////////////////////////////////////////////////////
taskService.complete(task.getId());
assertProcessEnded(processInstance.getId());
close(caseInstanceId);
assertCaseEnded(caseInstanceId);
repositoryService.deleteDeployment(secondDeploymentId, true);
repositoryService.deleteDeployment(thirdDeploymentId, true);
}
use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.
the class ProcessTaskTest method testCallProcessAsExpressionStartsWithDollar.
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/processtask/ProcessTaskTest.testCallProcessAsExpressionStartsWithDollar.cmmn", "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testCallProcessAsExpressionStartsWithDollar() {
// given
// a deployed case definition
String caseInstanceId = createCaseInstanceByKey(ONE_PROCESS_TASK_CASE, Variables.createVariables().putValue("process", "oneTaskProcess")).getId();
String processTaskId = queryCaseExecutionByActivityId(PROCESS_TASK).getId();
// then
// there exists a process instance
ExecutionEntity processInstance = (ExecutionEntity) queryProcessInstance();
assertNotNull(processInstance);
// the case instance id is set on called process instance
assertEquals(caseInstanceId, processInstance.getCaseInstanceId());
// the super case execution id is equals the processTaskId
assertEquals(processTaskId, processInstance.getSuperCaseExecutionId());
TaskEntity task = (TaskEntity) queryTask();
// the case instance id has been also set on the task
assertEquals(caseInstanceId, task.getCaseInstanceId());
// the case execution id should be null
assertNull(task.getCaseExecutionId());
// complete ////////////////////////////////////////////////////////
taskService.complete(task.getId());
assertProcessEnded(processInstance.getId());
close(caseInstanceId);
assertCaseEnded(caseInstanceId);
}
use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.
the class ProcessTaskTest method testCallProcessByDeployment.
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/processtask/ProcessTaskTest.testCallProcessByDeployment.cmmn", "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testCallProcessByDeployment() {
// given
String firstDeploymentId = repositoryService.createDeploymentQuery().singleResult().getId();
String bpmnResourceName = "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml";
String deploymentId = repositoryService.createDeployment().addClasspathResource(bpmnResourceName).deploy().getId();
assertEquals(2, repositoryService.createProcessDefinitionQuery().count());
String caseInstanceId = createCaseInstanceByKey(ONE_PROCESS_TASK_CASE).getId();
String processTaskId = queryCaseExecutionByActivityId(PROCESS_TASK).getId();
// latest process definition
String processDefinitionIdInSameDeployment = repositoryService.createProcessDefinitionQuery().deploymentId(firstDeploymentId).singleResult().getId();
// then
// there exists a process instance
ExecutionEntity processInstance = (ExecutionEntity) queryProcessInstance();
assertNotNull(processInstance);
// the case instance id is set on called process instance
assertEquals(caseInstanceId, processInstance.getCaseInstanceId());
// the super case execution id is equals the processTaskId
assertEquals(processTaskId, processInstance.getSuperCaseExecutionId());
// it is associated with the correct process definition
assertEquals(processDefinitionIdInSameDeployment, processInstance.getProcessDefinitionId());
TaskEntity task = (TaskEntity) queryTask();
// the case instance id has been also set on the task
assertEquals(caseInstanceId, task.getCaseInstanceId());
// the case execution id should be null
assertNull(task.getCaseExecutionId());
// complete ////////////////////////////////////////////////////////
taskService.complete(task.getId());
assertProcessEnded(processInstance.getId());
close(caseInstanceId);
assertCaseEnded(caseInstanceId);
repositoryService.deleteDeployment(deploymentId, true);
}
use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.
the class HistoricVariableInstanceScopeTest method testSetVariableOnProcessIntanceStartAndSetVariableLocalOnUserTask.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testSetVariableOnProcessIntanceStartAndSetVariableLocalOnUserTask() {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("testVar", "testValue");
ProcessInstance pi = runtimeService.startProcessInstanceByKey("oneTaskProcess", variables);
Task task = taskService.createTaskQuery().singleResult();
assertNotNull(task);
taskService.setVariableLocal(task.getId(), "testVar", "anotherTestValue");
ExecutionEntity taskExecution = (ExecutionEntity) runtimeService.createExecutionQuery().singleResult();
assertNotNull(taskExecution);
HistoricVariableInstanceQuery query = historyService.createHistoricVariableInstanceQuery();
assertEquals(2, query.count());
List<HistoricVariableInstance> result = query.list();
HistoricVariableInstance firstVar = result.get(0);
assertEquals("testVar", firstVar.getVariableName());
assertEquals("testValue", firstVar.getValue());
// the variable is in the process instance scope
assertEquals(pi.getId(), firstVar.getActivityInstanceId());
HistoricVariableInstance secondVar = result.get(1);
assertEquals("testVar", secondVar.getVariableName());
assertEquals("anotherTestValue", secondVar.getValue());
// the variable is in the task scope
assertEquals(taskExecution.getActivityInstanceId(), secondVar.getActivityInstanceId());
taskService.complete(task.getId());
assertProcessEnded(pi.getId());
}
use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.
the class InclusiveGatewayTest method testDefaultSequenceFlowExecutionIsActive.
@Deployment(resources = "org/camunda/bpm/engine/test/bpmn/gateway/InclusiveGatewayTest.testDefaultSequenceFlow.bpmn20.xml")
public void testDefaultSequenceFlowExecutionIsActive() {
// given a triggered inclusive gateway default flow
runtimeService.startProcessInstanceByKey("inclusiveGwDefaultSequenceFlow", CollectionUtil.singletonMap("input", 5));
// then the process instance execution is not deactivated
ExecutionEntity execution = (ExecutionEntity) runtimeService.createExecutionQuery().singleResult();
assertEquals("theTask2", execution.getActivityId());
assertTrue(execution.isActive());
}
Aggregations