use of org.camunda.bpm.engine.runtime.CaseExecution in project camunda-bpm-platform by camunda.
the class TenantIdProviderTest method providerCalledWithVariables_ProcessTask.
@Test
public void providerCalledWithVariables_ProcessTask() {
ContextLoggingTenantIdProvider tenantIdProvider = new ContextLoggingTenantIdProvider();
TestTenantIdProvider.delegate = tenantIdProvider;
testRule.deploy(Bpmn.createExecutableProcess(PROCESS_DEFINITION_KEY).startEvent().userTask().done(), "org/camunda/bpm/engine/test/api/multitenancy/CaseWithProcessTask.cmmn");
// if the case is started
engineRule.getCaseService().createCaseInstanceByKey("testCase", Variables.createVariables().putValue("varName", true));
CaseExecution caseExecution = engineRule.getCaseService().createCaseExecutionQuery().activityId("PI_ProcessTask_1").singleResult();
// then the tenant id provider is passed in the variable
assertThat(tenantIdProvider.parameters.size(), is(1));
VariableMap variables = tenantIdProvider.parameters.get(0).getVariables();
assertThat(variables.size(), is(1));
assertThat((Boolean) variables.get("varName"), is(true));
}
use of org.camunda.bpm.engine.runtime.CaseExecution in project camunda-bpm-platform by camunda.
the class TenantIdProviderTest method providerCalledForProcessDefinitionWithoutTenantId_ProcessTask.
// process task in case //////////////////////////////
@Test
public void providerCalledForProcessDefinitionWithoutTenantId_ProcessTask() {
ContextLoggingTenantIdProvider tenantIdProvider = new ContextLoggingTenantIdProvider();
TestTenantIdProvider.delegate = tenantIdProvider;
testRule.deploy(Bpmn.createExecutableProcess(PROCESS_DEFINITION_KEY).startEvent().userTask().done(), "org/camunda/bpm/engine/test/api/multitenancy/CaseWithProcessTask.cmmn");
// if the case is started
engineRule.getCaseService().createCaseInstanceByKey("testCase");
CaseExecution caseExecution = engineRule.getCaseService().createCaseExecutionQuery().activityId("PI_ProcessTask_1").singleResult();
// then the tenant id provider is invoked once for the process instance
assertThat(tenantIdProvider.parameters.size(), is(1));
}
use of org.camunda.bpm.engine.runtime.CaseExecution in project camunda-bpm-platform by camunda.
the class MultiTenancyCaseInstanceCmdsTenantCheckTest method reenableCaseExecutionWithAuthenticatedTenant.
@Test
public void reenableCaseExecutionWithAuthenticatedTenant() {
caseService.disableCaseExecution(caseExecutionId);
identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
caseService.reenableCaseExecution(caseExecutionId);
identityService.clearAuthentication();
CaseExecution caseExecution = getCaseExecution();
assertThat(caseExecution.isEnabled(), is(true));
}
use of org.camunda.bpm.engine.runtime.CaseExecution in project camunda-bpm-platform by camunda.
the class MultiTenancyCaseInstanceCmdsTenantCheckTest method reenableCaseExecutionDisabledTenantCheck.
@Test
public void reenableCaseExecutionDisabledTenantCheck() {
caseService.disableCaseExecution(caseExecutionId);
identityService.setAuthentication("user", null, null);
processEngineConfiguration.setTenantCheckEnabled(false);
caseService.reenableCaseExecution(caseExecutionId);
identityService.clearAuthentication();
CaseExecution caseExecution = getCaseExecution();
assertThat(caseExecution.isEnabled(), is(true));
}
use of org.camunda.bpm.engine.runtime.CaseExecution in project camunda-bpm-platform by camunda.
the class MultiTenancyCaseInstanceCmdsTenantCheckTest method manuallyStartCaseExecutionWithAuthenticatedTenant.
@Test
public void manuallyStartCaseExecutionWithAuthenticatedTenant() {
identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
caseService.manuallyStartCaseExecution(caseExecutionId);
identityService.clearAuthentication();
CaseExecution caseExecution = getCaseExecution();
assertThat(caseExecution.isActive(), is(true));
}
Aggregations