Search in sources :

Example 56 with VariableInstanceQuery

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

the class TaskAuthorizationTest method testCaseTaskSetVariableLocal.

// TaskService#setVariableLocal() (case task) /////////////////////////////////////
public void testCaseTaskSetVariableLocal() {
    // given
    createCaseInstanceByKey(CASE_KEY);
    String taskId = selectSingleTask().getId();
    // when
    taskService.setVariableLocal(taskId, VARIABLE_NAME, VARIABLE_VALUE);
    // then
    disableAuthorization();
    VariableInstanceQuery query = runtimeService.createVariableInstanceQuery();
    verifyQueryResults(query, 1);
    enableAuthorization();
}
Also used : VariableInstanceQuery(org.camunda.bpm.engine.runtime.VariableInstanceQuery)

Example 57 with VariableInstanceQuery

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

the class TaskAuthorizationTest method testProcessTaskRemoveVariablesWithReadPermissionOnTask.

public void testProcessTaskRemoveVariablesWithReadPermissionOnTask() {
    // given
    startProcessInstanceByKey(PROCESS_KEY, getVariables());
    String taskId = selectSingleTask().getId();
    createGrantAuthorization(TASK, taskId, userId, UPDATE);
    // when
    taskService.removeVariables(taskId, Arrays.asList(VARIABLE_NAME));
    // then
    disableAuthorization();
    VariableInstanceQuery query = runtimeService.createVariableInstanceQuery();
    verifyQueryResults(query, 0);
    enableAuthorization();
}
Also used : VariableInstanceQuery(org.camunda.bpm.engine.runtime.VariableInstanceQuery)

Example 58 with VariableInstanceQuery

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

the class TaskAuthorizationTest method testStandaloneTaskSetVariablesLocalWithReadPermissionOnTask.

public void testStandaloneTaskSetVariablesLocalWithReadPermissionOnTask() {
    // given
    String taskId = "myTask";
    createTask(taskId);
    createGrantAuthorization(TASK, taskId, userId, UPDATE);
    // when
    taskService.setVariablesLocal(taskId, getVariables());
    // then
    disableAuthorization();
    VariableInstanceQuery query = runtimeService.createVariableInstanceQuery();
    verifyQueryResults(query, 1);
    enableAuthorization();
    deleteTask(taskId, true);
}
Also used : VariableInstanceQuery(org.camunda.bpm.engine.runtime.VariableInstanceQuery)

Example 59 with VariableInstanceQuery

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

the class TaskAuthorizationTest method testStandaloneTaskRemoveVariablesLocalWithReadPermissionOnTask.

@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_AUDIT)
public void testStandaloneTaskRemoveVariablesLocalWithReadPermissionOnTask() {
    // given
    String taskId = "myTask";
    createTask(taskId);
    createGrantAuthorization(TASK, taskId, userId, UPDATE);
    disableAuthorization();
    taskService.setVariable(taskId, VARIABLE_NAME, VARIABLE_VALUE);
    enableAuthorization();
    // when
    taskService.removeVariablesLocal(taskId, Arrays.asList(VARIABLE_NAME));
    // then
    disableAuthorization();
    VariableInstanceQuery query = runtimeService.createVariableInstanceQuery();
    verifyQueryResults(query, 0);
    enableAuthorization();
    deleteTask(taskId, true);
    HistoricVariableInstance deletedVariable = historyService.createHistoricVariableInstanceQuery().includeDeleted().singleResult();
    Assert.assertEquals("DELETED", deletedVariable.getState());
}
Also used : VariableInstanceQuery(org.camunda.bpm.engine.runtime.VariableInstanceQuery) HistoricVariableInstance(org.camunda.bpm.engine.history.HistoricVariableInstance) RequiredHistoryLevel(org.camunda.bpm.engine.test.RequiredHistoryLevel)

Example 60 with VariableInstanceQuery

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

the class TaskAuthorizationTest method testStandaloneTaskSetVariablesWithReadPermissionOnAnyTask.

public void testStandaloneTaskSetVariablesWithReadPermissionOnAnyTask() {
    // given
    String taskId = "myTask";
    createTask(taskId);
    createGrantAuthorization(TASK, ANY, userId, UPDATE);
    // when
    taskService.setVariables(taskId, getVariables());
    // then
    disableAuthorization();
    VariableInstanceQuery query = runtimeService.createVariableInstanceQuery();
    verifyQueryResults(query, 1);
    enableAuthorization();
    deleteTask(taskId, true);
}
Also used : VariableInstanceQuery(org.camunda.bpm.engine.runtime.VariableInstanceQuery)

Aggregations

VariableInstanceQuery (org.camunda.bpm.engine.runtime.VariableInstanceQuery)347 Deployment (org.camunda.bpm.engine.test.Deployment)206 VariableInstance (org.camunda.bpm.engine.runtime.VariableInstance)90 Test (org.junit.Test)79 HashMap (java.util.HashMap)72 Matchers.containsString (org.hamcrest.Matchers.containsString)28 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)20 Task (org.camunda.bpm.engine.task.Task)18 TaskServiceImpl (org.camunda.bpm.engine.impl.TaskServiceImpl)12 CaseInstance (org.camunda.bpm.engine.runtime.CaseInstance)10 RuntimeServiceImpl (org.camunda.bpm.engine.impl.RuntimeServiceImpl)8 HistoricVariableInstance (org.camunda.bpm.engine.history.HistoricVariableInstance)7 RequiredHistoryLevel (org.camunda.bpm.engine.test.RequiredHistoryLevel)6 MySpecialTaskListener (org.camunda.bpm.engine.test.cmmn.tasklistener.util.MySpecialTaskListener)6 MyTaskListener (org.camunda.bpm.engine.test.cmmn.tasklistener.util.MyTaskListener)6 ActivityInstance (org.camunda.bpm.engine.runtime.ActivityInstance)4 ArrayList (java.util.ArrayList)3 AbstractFoxPlatformIntegrationTest (org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest)3 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)3 OperateOnDeployment (org.jboss.arquillian.container.test.api.OperateOnDeployment)3