Java Code Examples for org.camunda.bpm.engine.variable.Variables#putValue()
The following examples show how to use
org.camunda.bpm.engine.variable.Variables#putValue() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MultiTenancyExecutionPropagationTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public void testPropagateTenantIdToVariableInstanceOnStartProcessInstance() { deploymentForTenant(TENANT_ID, Bpmn.createExecutableProcess(PROCESS_DEFINITION_KEY) .startEvent() .userTask() .endEvent() .done()); VariableMap variables = Variables.putValue("var", "test"); ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult(); runtimeService.startProcessInstanceById(processDefinition.getId(), variables); VariableInstance variableInstance = runtimeService.createVariableInstanceQuery().singleResult(); assertThat(variableInstance, is(notNullValue())); // inherit the tenant id from process instance assertThat(variableInstance.getTenantId(), is(TENANT_ID)); }
Example 2
Source File: MultiTenancyCaseInstanceCmdsTenantCheckTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
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(); } }
Example 3
Source File: MultiTenancyExecutionPropagationTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public void testPropagateTenantIdToVariableInstanceOnCreateCaseInstance() { deploymentForTenant(TENANT_ID, CMMN_FILE); VariableMap variables = Variables.putValue("var", "test"); CaseDefinition caseDefinition = repositoryService.createCaseDefinitionQuery().singleResult(); caseService.createCaseInstanceById(caseDefinition.getId(), variables); VariableInstance variableInstance = runtimeService.createVariableInstanceQuery().singleResult(); assertThat(variableInstance, is(notNullValue())); // inherit the tenant id from case instance assertThat(variableInstance.getTenantId(), is(TENANT_ID)); }
Example 4
Source File: ExternalTaskServiceTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Deployment(resources = { "org/camunda/bpm/engine/test/api/externaltask/ExternalTaskVariablesTest.testExternalTaskVariablesLocal.bpmn20.xml" }) public void testFetchOnlyLocalVariables() { VariableMap globalVars = Variables.putValue("globalVar", "globalVal"); runtimeService.startProcessInstanceByKey("oneExternalTaskProcess", globalVars); final String workerId = "workerId"; final String topicName = "testTopic"; List<LockedExternalTask> lockedExternalTasks = externalTaskService.fetchAndLock(10, workerId) .topic(topicName, 60000) .execute(); assertEquals(1, lockedExternalTasks.size()); LockedExternalTask lockedExternalTask = lockedExternalTasks.get(0); VariableMap variables = lockedExternalTask.getVariables(); assertEquals(2, variables.size()); assertEquals("globalVal", variables.getValue("globalVar", String.class)); assertEquals("localVal", variables.getValue("localVar", String.class)); externalTaskService.unlock(lockedExternalTask.getId()); lockedExternalTasks = externalTaskService.fetchAndLock(10, workerId) .topic(topicName, 60000) .variables("globalVar", "localVar") .localVariables() .execute(); assertEquals(1, lockedExternalTasks.size()); lockedExternalTask = lockedExternalTasks.get(0); variables = lockedExternalTask.getVariables(); assertEquals(1, variables.size()); assertEquals("localVal", variables.getValue("localVar", String.class)); }
Example 5
Source File: HistoricDecisionInstanceTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Deployment(resources = { DECISION_SINGLE_OUTPUT_DMN }) public void testDecisionEvaluatedWithAuthenticatedUser() { identityService.setAuthenticatedUserId("demo"); VariableMap variables = Variables.putValue("input1", "test"); decisionService.evaluateDecisionTableByKey(DECISION_DEFINITION_KEY, variables); HistoricDecisionInstance historicDecisionInstance = historyService.createHistoricDecisionInstanceQuery().singleResult(); assertThat(historicDecisionInstance, is(notNullValue())); // the user should be set since the decision was evaluated with the decision service assertThat(historicDecisionInstance.getUserId(), is("demo")); }
Example 6
Source File: PurgeDatabaseTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Test public void testPurgeDatabase() { Assert.assertNotNull(processEngine); VariableMap variableMap = Variables.putValue("var", "value"); runtimeService.startProcessInstanceByKey("testDeployProcessArchive", variableMap); runtimeService.startProcessInstanceByKey("testDeployProcessArchive", variableMap); ManagementServiceImpl managementServiceImpl = (ManagementServiceImpl) managementService; managementServiceImpl.purge(); assertAndEnsureCleanDb(processEngine); }
Example 7
Source File: SpinScriptTaskSupportWithAutoStoreScriptVariablesTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
protected void startProcess() { VariableMap variables = Variables.putValue("foo", "bar"); processInstance = runtimeService.startProcessInstanceByKey("testProcess", variables); }
Example 8
Source File: HistoricDecisionInstanceQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
protected void evaluateDecisionWithAuthenticatedUser(String userId) { identityService.setAuthenticatedUserId(userId); VariableMap variables = Variables.putValue("input1", "test"); decisionService.evaluateDecisionTableByKey(DECISION_DEFINITION_KEY, variables); }
Example 9
Source File: VariableScopeFakeTest.java From camunda-bpm-mockito with Apache License 2.0 | 3 votes |
@Test public void variablesLocal() throws Exception { VariableMap variables = Variables.putValue("foo", "bar"); variableScope.setVariablesLocal(variables); String foo = (String) variableScope.getVariableLocal("foo"); assertThat(foo).isEqualTo("bar"); }