use of org.camunda.bpm.engine.repository.CaseDefinition in project camunda-bpm-platform by camunda.
the class CaseServiceTest method testCaseInstanceQuery.
@Deployment(resources = "org/camunda/bpm/engine/test/api/cmmn/loan-application.cmmn")
public void testCaseInstanceQuery() {
// given
// there exists a deployment containing a case definition with key "loanApplication"
CaseDefinition caseDefinition = repositoryService.createCaseDefinitionQuery().caseDefinitionKey("loanApplication").singleResult();
assertNotNull(caseDefinition);
// when
// create a new case instance by key
CaseInstance caseInstance = caseService.withCaseDefinitionByKey(caseDefinition.getKey()).create();
// then
// the returned caseInstance is not null
assertNotNull(caseInstance);
// verify that there is one caseInstance
// only select ACTIVE case instances
List<CaseInstance> caseInstances = caseService.createCaseInstanceQuery().active().list();
assertEquals(1, caseInstances.size());
}
use of org.camunda.bpm.engine.repository.CaseDefinition in project camunda-bpm-platform by camunda.
the class CaseServiceTest method testCreateCaseInstanceByKey.
@Deployment(resources = "org/camunda/bpm/engine/test/api/cmmn/loan-application.cmmn")
public void testCreateCaseInstanceByKey() {
// given
// there exists a deployment containing a case definition with key "loanApplication"
CaseDefinition caseDefinition = repositoryService.createCaseDefinitionQuery().caseDefinitionKey("loanApplication").singleResult();
assertNotNull(caseDefinition);
// when
// create a new case instance by key
CaseInstance caseInstance = caseService.withCaseDefinitionByKey(caseDefinition.getKey()).create();
// then
// the returned caseInstance is not null
assertNotNull(caseInstance);
// verify that the case instance is persisted using the API
CaseInstance instance = caseService.createCaseInstanceQuery().caseInstanceId(caseInstance.getId()).singleResult();
assertNotNull(instance);
}
use of org.camunda.bpm.engine.repository.CaseDefinition in project camunda-bpm-platform by camunda.
the class CaseServiceTest method testCreateCaseInstanceById.
@Deployment(resources = "org/camunda/bpm/engine/test/api/cmmn/loan-application.cmmn")
public void testCreateCaseInstanceById() {
// given
// there exists a deployment containing a case definition with key "loanApplication"
CaseDefinition caseDefinition = repositoryService.createCaseDefinitionQuery().caseDefinitionKey("loanApplication").singleResult();
assertNotNull(caseDefinition);
// when
// create a new case instance by id
CaseInstance caseInstance = caseService.withCaseDefinition(caseDefinition.getId()).create();
// then
// the returned caseInstance is not null
assertNotNull(caseInstance);
// verify that the case instance is persisted using the API
CaseInstance instance = caseService.createCaseInstanceQuery().caseInstanceId(caseInstance.getId()).singleResult();
assertNotNull(instance);
}
use of org.camunda.bpm.engine.repository.CaseDefinition in project camunda-bpm-platform by camunda.
the class TaskQueryTest method getCaseDefinitionIds.
/**
* @return the case definition ids
*/
protected List<String> getCaseDefinitionIds() {
List<String> caseDefinitionIds = new ArrayList<String>();
List<CaseDefinition> caseDefinitions = repositoryService.createCaseDefinitionQuery().list();
for (CaseDefinition caseDefinition : caseDefinitions) {
caseDefinitionIds.add(caseDefinition.getId());
}
return caseDefinitionIds;
}
use of org.camunda.bpm.engine.repository.CaseDefinition in project camunda-bpm-platform by camunda.
the class TaskQueryTest method testQueryByCaseDefinitionName.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testQueryByCaseDefinitionName() {
CaseDefinition caseDefinition = repositoryService.createCaseDefinitionQuery().singleResult();
String caseDefinitionId = caseDefinition.getId();
String caseDefinitionName = caseDefinition.getName();
caseService.withCaseDefinition(caseDefinitionId).create();
TaskQuery query = taskService.createTaskQuery();
query.caseDefinitionName(caseDefinitionName);
verifyQueryResults(query, 1);
}
Aggregations