use of org.camunda.bpm.engine.impl.RuntimeServiceImpl in project camunda-bpm-platform by camunda.
the class ProcessInstanceAuthorizationTest method testUpdateVariablesLocalWithReadInstancePermissionOnAnyProcessDefinition.
public void testUpdateVariablesLocalWithReadInstancePermissionOnAnyProcessDefinition() {
// given
String processInstanceId = startProcessInstanceByKey(PROCESS_KEY).getId();
createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, UPDATE_INSTANCE);
VariableInstanceQuery query = runtimeService.createVariableInstanceQuery();
// when (1)
((RuntimeServiceImpl) runtimeService).updateVariablesLocal(processInstanceId, getVariables(), null);
// then (1)
disableAuthorization();
verifyQueryResults(query, 1);
enableAuthorization();
// when (2)
((RuntimeServiceImpl) runtimeService).updateVariablesLocal(processInstanceId, null, Arrays.asList(VARIABLE_NAME));
// then (2)
disableAuthorization();
verifyQueryResults(query, 0);
enableAuthorization();
// when (3)
((RuntimeServiceImpl) runtimeService).updateVariablesLocal(processInstanceId, getVariables(), Arrays.asList(VARIABLE_NAME));
// then (3)
disableAuthorization();
verifyQueryResults(query, 0);
enableAuthorization();
}
use of org.camunda.bpm.engine.impl.RuntimeServiceImpl in project camunda-bpm-platform by camunda.
the class RuntimeServiceTest method testUpdateVariables.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" })
@Test
public void testUpdateVariables() {
Map<String, Object> modifications = new HashMap<String, Object>();
modifications.put("variable1", "value1");
modifications.put("variable2", "value2");
List<String> deletions = new ArrayList<String>();
deletions.add("variable1");
Map<String, Object> initialVariables = new HashMap<String, Object>();
initialVariables.put("variable1", "initialValue");
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess", initialVariables);
((RuntimeServiceImpl) runtimeService).updateVariables(processInstance.getId(), modifications, deletions);
assertNull(runtimeService.getVariable(processInstance.getId(), "variable1"));
assertEquals("value2", runtimeService.getVariable(processInstance.getId(), "variable2"));
}
Aggregations