use of org.camunda.bpm.engine.variable.VariableMap in project camunda-bpm-platform by camunda.
the class MultiTenancyExecutionPropagationTest method testPropagateTenantIdToVariableInstanceFromTask.
public void testPropagateTenantIdToVariableInstanceFromTask() {
deploymentForTenant(TENANT_ID, Bpmn.createExecutableProcess(PROCESS_DEFINITION_KEY).startEvent().userTask().camundaAsyncAfter().endEvent().done());
startProcessInstance(PROCESS_DEFINITION_KEY);
VariableMap variables = Variables.createVariables().putValue("var", "test");
Task task = taskService.createTaskQuery().singleResult();
taskService.setVariablesLocal(task.getId(), variables);
VariableInstance variableInstance = runtimeService.createVariableInstanceQuery().singleResult();
assertThat(variableInstance, is(notNullValue()));
// inherit the tenant id from task
assertThat(variableInstance.getTenantId(), is(TENANT_ID));
}
use of org.camunda.bpm.engine.variable.VariableMap 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.variable.VariableMap in project camunda-bpm-platform by camunda.
the class MultiTenancyCaseInstanceCmdsTenantCheckTest method createCaseInstance.
protected String createCaseInstance(String tenantId) {
VariableMap variables = Variables.putValue(VARIABLE_NAME, VARIABLE_VALUE);
CaseInstanceBuilder builder = caseService.withCaseDefinitionByKey("twoTaskCase").setVariables(variables);
if (tenantId == null) {
return builder.create().getId();
} else {
return builder.caseDefinitionTenantId(tenantId).create().getId();
}
}
use of org.camunda.bpm.engine.variable.VariableMap in project camunda-bpm-platform by camunda.
the class MultiTenancyHistoricDataCmdsTenantCheckTest method evaluateDecisionTable.
protected String evaluateDecisionTable(String tenantId) {
String decisionDefinitionId;
if (tenantId == null) {
decisionDefinitionId = repositoryService.createDecisionDefinitionQuery().singleResult().getId();
} else {
decisionDefinitionId = repositoryService.createDecisionDefinitionQuery().tenantIdIn(tenantId).singleResult().getId();
}
VariableMap variables = Variables.createVariables().putValue("status", "bronze");
decisionService.evaluateDecisionTableById(decisionDefinitionId, variables);
return decisionDefinitionId;
}
use of org.camunda.bpm.engine.variable.VariableMap in project camunda-bpm-platform by camunda.
the class MultiTenancyHistoricDecisionInstanceQueryTest method evaluateDecisionInstanceForTenant.
protected void evaluateDecisionInstanceForTenant(String tenant) {
String decisionDefinitionId = repositoryService.createDecisionDefinitionQuery().tenantIdIn(tenant).singleResult().getId();
VariableMap variables = Variables.createVariables().putValue("status", "bronze");
decisionService.evaluateDecisionTableById(decisionDefinitionId, variables);
}
Aggregations