use of org.camunda.bpm.engine.repository.CaseDefinition in project camunda-bpm-platform by camunda.
the class MultiTenancyDelegateCaseExecutionTest method createCaseInstance.
protected void createCaseInstance(String caseDefinitionKey) {
CaseDefinition caseDefinition = repositoryService.createCaseDefinitionQuery().caseDefinitionKey(caseDefinitionKey).latestVersion().singleResult();
caseService.createCaseInstanceById(caseDefinition.getId());
}
use of org.camunda.bpm.engine.repository.CaseDefinition in project camunda-bpm-platform by camunda.
the class MultiTenancyCaseTaskTest method testStartCaseInstanceWithLatestBindingDifferentVersion.
public void testStartCaseInstanceWithLatestBindingDifferentVersion() {
deploymentForTenant(TENANT_ONE, CMMN_LATEST_WITH_MANUAL_ACTIVATION, CMMN_CASE);
deploymentForTenant(TENANT_TWO, CMMN_LATEST_WITH_MANUAL_ACTIVATION, CMMN_CASE);
deploymentForTenant(TENANT_TWO, CMMN_CASE);
createCaseInstance("caseTaskCase", TENANT_ONE);
createCaseInstance("caseTaskCase", TENANT_TWO);
CaseInstanceQuery query = caseService.createCaseInstanceQuery().caseDefinitionKey("oneTaskCase");
assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
CaseDefinition latestCaseDefinitionTenantTwo = repositoryService.createCaseDefinitionQuery().caseDefinitionKey("oneTaskCase").tenantIdIn(TENANT_TWO).latestVersion().singleResult();
query = caseService.createCaseInstanceQuery().caseDefinitionId(latestCaseDefinitionTenantTwo.getId());
assertThat(query.count(), is(1L));
}
use of org.camunda.bpm.engine.repository.CaseDefinition in project camunda-bpm-platform by camunda.
the class HistoryCleanupAuthorizationTest method prepareInstances.
protected void prepareInstances(Integer processInstanceTimeToLive, Integer decisionTimeToLive, Integer caseTimeToLive) {
// update time to live
disableAuthorization();
List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery().processDefinitionKey("testProcess").list();
assertEquals(1, processDefinitions.size());
repositoryService.updateProcessDefinitionHistoryTimeToLive(processDefinitions.get(0).getId(), processInstanceTimeToLive);
final List<DecisionDefinition> decisionDefinitions = repositoryService.createDecisionDefinitionQuery().decisionDefinitionKey("testDecision").list();
assertEquals(1, decisionDefinitions.size());
repositoryService.updateDecisionDefinitionHistoryTimeToLive(decisionDefinitions.get(0).getId(), decisionTimeToLive);
List<CaseDefinition> caseDefinitions = repositoryService.createCaseDefinitionQuery().caseDefinitionKey("oneTaskCase").list();
assertEquals(1, caseDefinitions.size());
repositoryService.updateCaseDefinitionHistoryTimeToLive(caseDefinitions.get(0).getId(), caseTimeToLive);
Date oldCurrentTime = ClockUtil.getCurrentTime();
ClockUtil.setCurrentTime(DateUtils.addDays(oldCurrentTime, -6));
// create 3 process instances
List<String> processInstanceIds = new ArrayList<String>();
Map<String, Object> variables = Variables.createVariables().putValue("pojo", new TestPojo("okay", 13.37));
for (int i = 0; i < 3; i++) {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testProcess", variables);
processInstanceIds.add(processInstance.getId());
}
runtimeService.deleteProcessInstances(processInstanceIds, null, true, true);
// +10 standalone decisions
for (int i = 0; i < 10; i++) {
decisionService.evaluateDecisionByKey("testDecision").variables(variables).evaluate();
}
// create 4 case instances
for (int i = 0; i < 4; i++) {
CaseInstance caseInstance = caseService.createCaseInstanceByKey("oneTaskCase", Variables.createVariables().putValue("pojo", new TestPojo("okay", 13.37 + i)));
caseService.terminateCaseExecution(caseInstance.getId());
caseService.closeCaseInstance(caseInstance.getId());
}
ClockUtil.setCurrentTime(oldCurrentTime);
enableAuthorization();
}
use of org.camunda.bpm.engine.repository.CaseDefinition in project camunda-bpm-platform by camunda.
the class MultiTenancyCallActivityTest method testStartCaseInstanceWithLatestBindingDifferentVersion.
public void testStartCaseInstanceWithLatestBindingDifferentVersion() {
BpmnModelInstance callingProcess = Bpmn.createExecutableProcess("callingProcess").startEvent().callActivity().camundaCaseRef("Case_1").camundaCaseBinding("latest").endEvent().done();
deploymentForTenant(TENANT_ONE, CMMN, callingProcess);
deploymentForTenant(TENANT_TWO, CMMN, callingProcess);
deploymentForTenant(TENANT_TWO, CMMN);
runtimeService.createProcessInstanceByKey("callingProcess").processDefinitionTenantId(TENANT_ONE).execute();
runtimeService.createProcessInstanceByKey("callingProcess").processDefinitionTenantId(TENANT_TWO).execute();
CaseInstanceQuery query = caseService.createCaseInstanceQuery().caseDefinitionKey("Case_1");
assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
CaseDefinition latestCaseDefinitionTenantTwo = repositoryService.createCaseDefinitionQuery().tenantIdIn(TENANT_TWO).latestVersion().singleResult();
query = caseService.createCaseInstanceQuery().caseDefinitionId(latestCaseDefinitionTenantTwo.getId());
assertThat(query.count(), is(1L));
}
use of org.camunda.bpm.engine.repository.CaseDefinition in project camunda-bpm-platform by camunda.
the class RepositoryServiceTest method testGetCaseDefinition.
@Deployment(resources = { "org/camunda/bpm/engine/test/repository/one.cmmn" })
public void testGetCaseDefinition() {
CaseDefinitionQuery query = repositoryService.createCaseDefinitionQuery();
CaseDefinition caseDefinition = query.singleResult();
String caseDefinitionId = caseDefinition.getId();
CaseDefinition definition = repositoryService.getCaseDefinition(caseDefinitionId);
assertNotNull(definition);
assertEquals(caseDefinitionId, definition.getId());
}
Aggregations