本文整理了Java中org.camunda.bpm.engine.variable.Variables.createVariables()
方法的一些代码示例,展示了Variables.createVariables()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Variables.createVariables()
方法的具体详情如下:
包路径:org.camunda.bpm.engine.variable.Variables
类名称:Variables
方法名:createVariables
[英]Returns a new VariableMap instance.
[中]返回一个新的VariableMap实例。
代码示例来源:origin: camunda/camunda-bpm-platform
protected VariableMap getVariables(Object input) {
VariableMap variables = Variables.createVariables();
variables.put("input1", input);
return variables;
}
代码示例来源:origin: camunda/camunda-bpm-platform
public void createInstanceByDefinitionKey(String definitionKey) {
decisionService.evaluateDecisionTableByKey(definitionKey)
.variables(Variables.createVariables().putValue("input", "john"))
.evaluate();
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Deployment(resources = "org/camunda/bpm/engine/test/api/mgmt/jobPrioExpressionProcess.bpmn20.xml")
public void testFilterByJobPriorityLowerThanOrEqualsAndHigherThanOrEqual() {
// given five jobs with priorities from 1 to 5
List<ProcessInstance> instances = new ArrayList<ProcessInstance>();
for (int i = 0; i < 5; i++) {
instances.add(runtimeService.startProcessInstanceByKey("jobPrioExpressionProcess",
Variables.createVariables().putValue("priority", i)));
}
// when making a job query and filtering by disjunctive job priority
// then the no jobs are returned
assertEquals(0, managementService.createJobQuery().priorityLowerThanOrEquals(2).priorityHigherThanOrEquals(3).count());
}
代码示例来源:origin: camunda/camunda-bpm-platform
public void testStartProcessInstanceAndSetVariables() {
Map<String, Object> variables = Variables.createVariables().putValue("var1", "v1").putValue("var2", "v2");
ProcessInstance processInstance = runtimeService.createProcessInstanceByKey(PROCESS_DEFINITION_KEY).setVariables(variables).execute();
assertThat(runtimeService.getVariables(processInstance.getId()), is(variables));
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testNewKeyInAsyncServiceTask() {
// given
testRule.deploy(ASYNC_SERVICE_TASK_PROCESS);
String newBusinessKeyValue = "newBusinessKey";
runtimeService.startProcessInstanceByKey(PROCESS_KEY, Variables.createVariables().putValue(BUSINESS_KEY_VARIABLE, newBusinessKeyValue));
// when
executeJob();
// then
checkBusinessKeyChanged(newBusinessKeyValue);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testUpdateKeyInStartExecListener() {
// given
String listener = ExecutionListener.EVENTNAME_START;
BpmnModelInstance process = createModelExecutionListener(listener);
testRule.deploy(process);
// when
String newBusinessKeyValue = "newBusinessKey";
runtimeService.startProcessInstanceByKey(PROCESS_KEY, "aBusinessKey", Variables.createVariables().putValue(BUSINESS_KEY_VARIABLE, newBusinessKeyValue));
// then
checkBusinessKeyChanged(newBusinessKeyValue);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Before
public void init() {
// deploy tenants
testRule.deployForTenant(TENANT_ONE, START_FORM_RESOURCE);
instance = engineRule.getRuntimeService()
.startProcessInstanceByKey(PROCESS_DEFINITION_KEY, Variables.createVariables().putValue(VARIABLE_1, VARIABLE_VALUE_1)
.putValue(VARIABLE_2, VARIABLE_VALUE_2));
}
代码示例来源:origin: camunda/camunda-bpm-platform
protected void evaluateDecisionInstanceForTenant(String tenant) {
String decisionDefinitionId = repositoryService.createDecisionDefinitionQuery()
.tenantIdIn(tenant)
.singleResult()
.getId();
VariableMap variables = Variables.createVariables().putValue("status", "bronze");
decisionService.evaluateDecisionTableById(decisionDefinitionId, variables);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testNewKeyInStartExecListener() {
// given
String listener = ExecutionListener.EVENTNAME_START;
BpmnModelInstance process = createModelExecutionListener(listener);
testRule.deploy(process);
// when
String newBusinessKeyValue = "newBusinessKey";
runtimeService.startProcessInstanceByKey(PROCESS_KEY, Variables.createVariables().putValue(BUSINESS_KEY_VARIABLE, newBusinessKeyValue));
// then
checkBusinessKeyChanged(newBusinessKeyValue);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testUpdateKeyNullValueInStartTaskListener() {
// given
String listener = TaskListener.EVENTNAME_CREATE;
BpmnModelInstance process = createModelTaskListener(listener);
testRule.deploy(process);
// when
String newBusinessKeyValue = null;
runtimeService.startProcessInstanceByKey(PROCESS_KEY, "aBusinessKey", Variables.createVariables().putValue(BUSINESS_KEY_VARIABLE, newBusinessKeyValue));
// then
checkBusinessKeyChanged(newBusinessKeyValue);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Deployment
@Test
public void testSubmitStartFormWithFormFieldMarkedAsBusinessKey() {
String procDefId = repositoryService.createProcessDefinitionQuery().singleResult().getId();
ProcessInstance pi = formService.submitStartForm(procDefId, "foo", Variables.createVariables().putValue("secondParam", "bar"));
assertEquals("foo", pi.getBusinessKey());
List<VariableInstance> result = runtimeService.createVariableInstanceQuery().list();
assertEquals(1, result.size());
assertTrue(result.get(0).getName().equals("secondParam"));
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Deployment(resources = "org/camunda/bpm/engine/test/cmmn/cmm10/Cmmn10CompatibilityTest.testManualActivationRuleWithoutCondition.cmmn")
public void testManualActivationRuleWithoutCondition() {
createCaseInstanceByKey("case", Variables.createVariables().putValue("manual", false));
CaseExecution taskExecution = queryCaseExecutionByActivityId("PI_HumanTask_1");
assertNotNull(taskExecution);
assertTrue(taskExecution.isEnabled());
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Before
public void init() {
// deploy tenants
testRule.deployForTenant(TENANT_ONE, ONE_TASK_PROCESS);
processInstanceId = engineRule.getRuntimeService()
.startProcessInstanceByKey(PROCESS_DEFINITION_KEY,
Variables.createVariables()
.putValue(VARIABLE_1, VARIABLE_VALUE_1)
.putValue(VARIABLE_2, VARIABLE_VALUE_2))
.getId();
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Deployment(resources = { DECISION_PROCESS, DECISION_SINGLE_OUTPUT_DMN, DRG_DMN })
public void testQueryByDecisionDefinitionKeyIn() {
//when
startProcessInstanceAndEvaluateDecision();
decisionService.evaluateDecisionTableByKey(DISH_DECISION)
.variables(Variables.createVariables().putValue("temperature", 21).putValue("dayType", "Weekend"))
.evaluate();
//then
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery();
assertThat(query.decisionDefinitionKeyIn(DISH_DECISION, DECISION_DEFINITION_KEY).count(), is(2L));
assertThat(query.decisionDefinitionKeyIn("other id", "anotherFake").count(), is(0L));
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
@Deployment(resources = ONE_TASK_PROCESS)
public void testSerializeNullEncoding() {
ProcessInstance pi = runtimeService.startProcessInstanceByKey("oneTaskProcess",
Variables.createVariables().putValue("fileVar", Variables.fileValue("test.txt").mimeType("some mimetype").file("ABC".getBytes()).create()));
FileValue fileVar = runtimeService.getVariableTyped(pi.getId(), "fileVar");
assertNull(fileVar.getEncoding());
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Deployment(resources = LISTENERS_ON_SUB_PROCESS_AND_NESTED_SUB_PROCESS)
public void testSkipListenersOnSubProcessNested() {
RecorderExecutionListener.clear();
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process",
Variables.createVariables().putValue("listener", new RecorderExecutionListener()));
runtimeService.createProcessInstanceModification(processInstance.getId()).startBeforeActivity("boundaryEvent").execute(true, false);
assertProcessEnded(processInstance.getId());
// then the output mapping should not have executed
assertTrue(RecorderExecutionListener.getRecordedEvents().isEmpty());
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
@Deployment(resources = {"org/camunda/bpm/engine/test/api/variables/scope/TargetVariableScopeTest.testExecutionWithoutProperTargetScope.bpmn","org/camunda/bpm/engine/test/api/variables/scope/doer.bpmn"})
public void testExecutionWithoutProperTargetScope () {
VariableMap variables = Variables.createVariables().putValue("orderIds", Arrays.asList(new int[]{1, 2, 3}));
//fails due to inappropriate variable scope target
thrown.expect(ScriptEvaluationException.class);
ProcessDefinition processDefinition = engineRule.getRepositoryService().createProcessDefinitionQuery().processDefinitionKey("Process_MultiInstanceCallAcitivity").singleResult();
thrown.expectMessage(startsWith("Unable to evaluate script while executing activity 'CallActivity_1' in the process definition with id '" + processDefinition.getId() + "': org.camunda.bpm.engine.ProcessEngineException: ENGINE-20011 Scope with specified activity Id NOT_EXISTING and execution"));
engineRule.getRuntimeService().startProcessInstanceByKey("Process_MultiInstanceCallAcitivity",variables);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Deployment(resources = {"org/camunda/bpm/engine/test/history/HistoricJobLogTest.testAsyncContinuation.bpmn20.xml"})
public void testQueryBySuccessLog() {
runtimeService.startProcessInstanceByKey("process", Variables.createVariables().putValue("fail", false));
String jobId = managementService.createJobQuery().singleResult().getId();
managementService.executeJob(jobId);
HistoricJobLogQuery query = historyService.createHistoricJobLogQuery().successLog();
verifyQueryResults(query, 1);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Before
public void setUp() {
decisionService = engineRule.getDecisionService();
repositoryService = engineRule.getRepositoryService();
historyService = engineRule.getHistoryService();
identityService = engineRule.getIdentityService();
testRule.deploy(DISH_DRG_DMN);
decisionService.evaluateDecisionByKey(DISH_DECISION)
.variables(Variables.createVariables().putValue(TEMPERATURE, 21).putValue(DAY_TYPE, WEEKEND))
.evaluate();
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Before
public void setUp() {
decisionService = engineRule.getDecisionService();
repositoryService = engineRule.getRepositoryService();
historyService = engineRule.getHistoryService();
identityService = engineRule.getIdentityService();
testRule.deployForTenant(TENANT_ONE, DISH_DRG_DMN);
decisionService.evaluateDecisionByKey(DISH_DECISION)
.decisionDefinitionTenantId(TENANT_ONE)
.variables(Variables.createVariables().putValue(TEMPERATURE, 21).putValue(DAY_TYPE, WEEKEND))
.evaluate();
}
内容来源于网络,如有侵权,请联系作者删除!