Search in sources :

Example 46 with CaseExecution

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));
}
Also used : DelegateCaseExecution(org.camunda.bpm.engine.delegate.DelegateCaseExecution) CaseExecution(org.camunda.bpm.engine.runtime.CaseExecution) VariableMap(org.camunda.bpm.engine.variable.VariableMap) Test(org.junit.Test)

Example 47 with CaseExecution

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));
}
Also used : DelegateCaseExecution(org.camunda.bpm.engine.delegate.DelegateCaseExecution) CaseExecution(org.camunda.bpm.engine.runtime.CaseExecution) Test(org.junit.Test)

Example 48 with CaseExecution

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));
}
Also used : CaseExecution(org.camunda.bpm.engine.runtime.CaseExecution) Test(org.junit.Test)

Example 49 with CaseExecution

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));
}
Also used : CaseExecution(org.camunda.bpm.engine.runtime.CaseExecution) Test(org.junit.Test)

Example 50 with CaseExecution

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));
}
Also used : CaseExecution(org.camunda.bpm.engine.runtime.CaseExecution) Test(org.junit.Test)

Aggregations

CaseExecution (org.camunda.bpm.engine.runtime.CaseExecution)280 Deployment (org.camunda.bpm.engine.test.Deployment)246 CaseInstance (org.camunda.bpm.engine.runtime.CaseInstance)61 CaseExecutionQuery (org.camunda.bpm.engine.runtime.CaseExecutionQuery)48 Task (org.camunda.bpm.engine.task.Task)28 VariableInstance (org.camunda.bpm.engine.runtime.VariableInstance)27 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)18 Test (org.junit.Test)17 HashMap (java.util.HashMap)13 HistoricCaseActivityInstance (org.camunda.bpm.engine.history.HistoricCaseActivityInstance)11 CaseExecutionEntity (org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity)11 NotAllowedException (org.camunda.bpm.engine.exception.NotAllowedException)9 VariableMap (org.camunda.bpm.engine.variable.VariableMap)7 DelegateCaseExecution (org.camunda.bpm.engine.delegate.DelegateCaseExecution)6 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)4 MigrationPlan (org.camunda.bpm.engine.migration.MigrationPlan)4 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)4 VariableMapImpl (org.camunda.bpm.engine.variable.impl.VariableMapImpl)3 ArrayList (java.util.ArrayList)2 CaseService (org.camunda.bpm.engine.CaseService)2