use of org.camunda.bpm.engine.impl.persistence.entity.TaskEntity in project camunda-bpm-platform by camunda.
the class TaskAuthorizationTest method testSaveTaskInsert.
public void testSaveTaskInsert() {
// given
TaskEntity task = TaskEntity.create();
task.setAssignee("demo");
createGrantAuthorization(TASK, ANY, userId, CREATE);
// when
taskService.saveTask(task);
// then
task = (TaskEntity) selectSingleTask();
assertNotNull(task);
assertEquals("demo", task.getAssignee());
String taskId = task.getId();
deleteTask(taskId, true);
}
use of org.camunda.bpm.engine.impl.persistence.entity.TaskEntity in project camunda-bpm-platform by camunda.
the class ProcessTaskTest method testCallProcessByVersionAsExpressionStartsWithDollar.
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/processtask/ProcessTaskTest.testCallProcessByVersionAsExpressionStartsWithDollar.cmmn", "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testCallProcessByVersionAsExpressionStartsWithDollar() {
// 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, Variables.createVariables().putValue("myVersion", 2)).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.TaskEntity in project camunda-bpm-platform by camunda.
the class ProcessTaskTest method testCallProcessAsExpressionStartsWithHash.
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/processtask/ProcessTaskTest.testCallProcessAsExpressionStartsWithHash.cmmn", "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testCallProcessAsExpressionStartsWithHash() {
// 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.TaskEntity in project camunda-bpm-platform by camunda.
the class ProcessTaskTest method testCallLatestProcess.
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/processtask/ProcessTaskTest.testCallLatestProcess.cmmn", "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testCallLatestProcess() {
// given
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 latestProcessDefinitionId = repositoryService.createProcessDefinitionQuery().latestVersion().singleResult().getId();
// then
// there exists a process instance
ExecutionEntity processInstance = (ExecutionEntity) queryProcessInstance();
// 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 latest process definition
assertEquals(latestProcessDefinitionId, 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.TaskEntity in project camunda-bpm-platform by camunda.
the class ProcessTaskTest method testInputDifferentBusinessKey.
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/processtask/ProcessTaskTest.testInputDifferentBusinessKey.cmmn", "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testInputDifferentBusinessKey() {
// given
String businessKey = "myBusinessKey";
String caseInstanceId = createCaseInstanceByKey(ONE_PROCESS_TASK_CASE, businessKey).getId();
String processTaskId = queryCaseExecutionByActivityId(PROCESS_TASK).getId();
// when
caseService.withCaseExecution(processTaskId).setVariable("myOwnBusinessKey", "myOwnBusinessKey").manualStart();
// 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());
// the business key has been set
assertEquals("myOwnBusinessKey", processInstance.getBusinessKey());
assertFalse(businessKey.equals(processInstance.getBusinessKey()));
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);
}
Aggregations