use of org.camunda.bpm.engine.runtime.CaseInstanceQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyCallActivityTest method testStartCaseInstanceWithVersionBinding.
public void testStartCaseInstanceWithVersionBinding() {
BpmnModelInstance callingProcess = Bpmn.createExecutableProcess("callingProcess").startEvent().callActivity().camundaCaseRef("Case_1").camundaCaseBinding("version").camundaCaseVersion("1").endEvent().done();
deploymentForTenant(TENANT_ONE, CMMN, callingProcess);
deploymentForTenant(TENANT_TWO, CMMN, callingProcess);
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));
assertThat(query.tenantIdIn(TENANT_TWO).count(), is(1L));
}
use of org.camunda.bpm.engine.runtime.CaseInstanceQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyCreateCaseInstanceTest method testCreateCaseInstanceByKeyWithTenantIdDisabledTenantCheck.
public void testCreateCaseInstanceByKeyWithTenantIdDisabledTenantCheck() {
processEngineConfiguration.setTenantCheckEnabled(false);
identityService.setAuthentication("user", null, null);
deploymentForTenant(TENANT_ONE, CMMN_FILE);
caseService.withCaseDefinitionByKey(CASE_DEFINITION_KEY).caseDefinitionTenantId(TENANT_ONE).create();
CaseInstanceQuery query = caseService.createCaseInstanceQuery();
assertThat(query.count(), is(1L));
assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
}
use of org.camunda.bpm.engine.runtime.CaseInstanceQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyCreateCaseInstanceTest method testCreateCaseInstanceByIdAuthenticatedTenant.
public void testCreateCaseInstanceByIdAuthenticatedTenant() {
deploymentForTenant(TENANT_ONE, CMMN_FILE);
CaseDefinition caseDefinition = repositoryService.createCaseDefinitionQuery().singleResult();
identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
caseService.withCaseDefinition(caseDefinition.getId()).create();
CaseInstanceQuery query = caseService.createCaseInstanceQuery();
assertThat(query.count(), is(1L));
assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
}
use of org.camunda.bpm.engine.runtime.CaseInstanceQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyCreateCaseInstanceTest method testCreateCaseInstanceByKeyWithoutTenantId.
public void testCreateCaseInstanceByKeyWithoutTenantId() {
deployment(CMMN_FILE);
caseService.withCaseDefinitionByKey(CASE_DEFINITION_KEY).caseDefinitionWithoutTenantId().create();
CaseInstanceQuery query = caseService.createCaseInstanceQuery();
assertThat(query.count(), is(1L));
assertThat(query.singleResult().getTenantId(), is(nullValue()));
}
use of org.camunda.bpm.engine.runtime.CaseInstanceQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyCreateCaseInstanceTest method testCreateCaseInstanceByKeyWithAuthenticatedTenant.
public void testCreateCaseInstanceByKeyWithAuthenticatedTenant() {
identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
deploymentForTenant(TENANT_ONE, CMMN_FILE);
deploymentForTenant(TENANT_TWO, CMMN_FILE);
caseService.withCaseDefinitionByKey(CASE_DEFINITION_KEY).create();
CaseInstanceQuery query = caseService.createCaseInstanceQuery();
assertThat(query.count(), is(1L));
assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
}
Aggregations