Search in sources :

Example 91 with CaseInstance

use of org.camunda.bpm.engine.runtime.CaseInstance in project camunda-bpm-platform by camunda.

the class TenantIdProviderTest method tenantIdInheritedFromSuperCaseInstance.

@Test
public void tenantIdInheritedFromSuperCaseInstance() {
    String tenantId = TENANT_ID;
    SetValueOnRootCaseInstanceTenantIdProvider tenantIdProvider = new SetValueOnRootCaseInstanceTenantIdProvider(tenantId);
    TestTenantIdProvider.delegate = tenantIdProvider;
    testRule.deploy(CMMN_SUBPROCESS_FILE, CMMN_FILE);
    // if a case instance is created
    engineRule.getCaseService().withCaseDefinitionByKey(CASE_DEFINITION_KEY).create();
    // then the tenant id is inherited to the sub case instance even tough it is not set by the provider
    CaseInstance caseInstance = engineRule.getCaseService().createCaseInstanceQuery().caseDefinitionKey("oneTaskCase").singleResult();
    assertThat(caseInstance.getTenantId(), is(tenantId));
}
Also used : CaseInstance(org.camunda.bpm.engine.runtime.CaseInstance) Test(org.junit.Test)

Example 92 with CaseInstance

use of org.camunda.bpm.engine.runtime.CaseInstance in project camunda-bpm-platform by camunda.

the class MultiTenancyDecisionTaskTest method testEvaluateDecisionWithLatestBindingSameVersion.

public void testEvaluateDecisionWithLatestBindingSameVersion() {
    deploymentForTenant(TENANT_ONE, CMMN_LATEST, DMN_FILE);
    deploymentForTenant(TENANT_TWO, CMMN_LATEST, DMN_FILE_VERSION_TWO);
    CaseInstance caseInstanceOne = createCaseInstance(CASE_DEFINITION_KEY, TENANT_ONE);
    CaseInstance caseInstanceTwo = createCaseInstance(CASE_DEFINITION_KEY, TENANT_TWO);
    assertThat((String) caseService.getVariable(caseInstanceOne.getId(), "decisionVar"), is(RESULT_OF_VERSION_ONE));
    assertThat((String) caseService.getVariable(caseInstanceTwo.getId(), "decisionVar"), is(RESULT_OF_VERSION_TWO));
}
Also used : CaseInstance(org.camunda.bpm.engine.runtime.CaseInstance)

Example 93 with CaseInstance

use of org.camunda.bpm.engine.runtime.CaseInstance in project camunda-bpm-platform by camunda.

the class MultiTenancyDecisionTaskTest method testEvaluateDecisionWithLatestBindingDifferentVersions.

public void testEvaluateDecisionWithLatestBindingDifferentVersions() {
    deploymentForTenant(TENANT_ONE, CMMN_LATEST, DMN_FILE);
    deploymentForTenant(TENANT_TWO, CMMN_LATEST, DMN_FILE);
    deploymentForTenant(TENANT_TWO, CMMN_LATEST, DMN_FILE_VERSION_TWO);
    CaseInstance caseInstanceOne = createCaseInstance(CASE_DEFINITION_KEY, TENANT_ONE);
    CaseInstance caseInstanceTwo = createCaseInstance(CASE_DEFINITION_KEY, TENANT_TWO);
    assertThat((String) caseService.getVariable(caseInstanceOne.getId(), "decisionVar"), is(RESULT_OF_VERSION_ONE));
    assertThat((String) caseService.getVariable(caseInstanceTwo.getId(), "decisionVar"), is(RESULT_OF_VERSION_TWO));
}
Also used : CaseInstance(org.camunda.bpm.engine.runtime.CaseInstance)

Example 94 with CaseInstance

use of org.camunda.bpm.engine.runtime.CaseInstance in project camunda-bpm-platform by camunda.

the class MultiTenancyDecisionTaskTest method testEvaluateDecisionRefWithoutTenantIdConstant.

public void testEvaluateDecisionRefWithoutTenantIdConstant() {
    deploymentForTenant(TENANT_ONE, CMMN_WITHOUT_TENANT);
    deployment(DMN_FILE);
    deploymentForTenant(TENANT_TWO, DMN_FILE_VERSION_TWO);
    CaseInstance caseInstance = createCaseInstance(CASE_DEFINITION_KEY);
    assertThat((String) caseService.getVariable(caseInstance.getId(), "decisionVar"), is(RESULT_OF_VERSION_ONE));
}
Also used : CaseInstance(org.camunda.bpm.engine.runtime.CaseInstance)

Example 95 with CaseInstance

use of org.camunda.bpm.engine.runtime.CaseInstance in project camunda-bpm-platform by camunda.

the class MultiTenancyDecisionTaskTest method testEvaluateDecisionWithDeploymentBinding.

public void testEvaluateDecisionWithDeploymentBinding() {
    deploymentForTenant(TENANT_ONE, CMMN_DEPLOYMENT, DMN_FILE);
    deploymentForTenant(TENANT_TWO, CMMN_DEPLOYMENT, DMN_FILE_VERSION_TWO);
    CaseInstance caseInstanceOne = createCaseInstance(CASE_DEFINITION_KEY, TENANT_ONE);
    CaseInstance caseInstanceTwo = createCaseInstance(CASE_DEFINITION_KEY, TENANT_TWO);
    assertThat((String) caseService.getVariable(caseInstanceOne.getId(), "decisionVar"), is(RESULT_OF_VERSION_ONE));
    assertThat((String) caseService.getVariable(caseInstanceTwo.getId(), "decisionVar"), is(RESULT_OF_VERSION_TWO));
}
Also used : CaseInstance(org.camunda.bpm.engine.runtime.CaseInstance)

Aggregations

CaseInstance (org.camunda.bpm.engine.runtime.CaseInstance)183 Deployment (org.camunda.bpm.engine.test.Deployment)149 CaseExecution (org.camunda.bpm.engine.runtime.CaseExecution)62 VariableInstance (org.camunda.bpm.engine.runtime.VariableInstance)23 Test (org.junit.Test)21 HistoricCaseInstance (org.camunda.bpm.engine.history.HistoricCaseInstance)18 Task (org.camunda.bpm.engine.task.Task)18 CaseExecutionQuery (org.camunda.bpm.engine.runtime.CaseExecutionQuery)16 CaseDefinition (org.camunda.bpm.engine.repository.CaseDefinition)13 VariableInstanceQuery (org.camunda.bpm.engine.runtime.VariableInstanceQuery)10 HashMap (java.util.HashMap)9 CaseInstanceQuery (org.camunda.bpm.engine.runtime.CaseInstanceQuery)9 ArrayList (java.util.ArrayList)6 CaseService (org.camunda.bpm.engine.CaseService)6 HistoricDetail (org.camunda.bpm.engine.history.HistoricDetail)6 Date (java.util.Date)5 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)5 NotAllowedException (org.camunda.bpm.engine.exception.NotAllowedException)5 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)5 VariableMap (org.camunda.bpm.engine.variable.VariableMap)5