use of org.camunda.bpm.engine.test.Deployment in project camunda-bpm-platform by camunda.
the class DelegationAuthorizationTest method testScriptIoMappingExecutesCommandAfterUserCompletesTask.
@Deployment
public void testScriptIoMappingExecutesCommandAfterUserCompletesTask() {
// given
String processInstanceId = startProcessInstanceByKey(DEFAULT_PROCESS_KEY).getId();
String taskId = selectSingleTask().getId();
createGrantAuthorization(TASK, taskId, userId, UPDATE);
// when
taskService.complete(taskId);
// then
disableAuthorization();
VariableInstanceQuery query = runtimeService.createVariableInstanceQuery().processInstanceIdIn(processInstanceId);
VariableInstance variableUser = query.variableName("userId").singleResult();
assertNotNull(variableUser);
assertEquals(userId, variableUser.getValue());
VariableInstance variableCount = query.variableName("count").singleResult();
assertNotNull(variableCount);
assertEquals(1l, variableCount.getValue());
assertEquals(2, runtimeService.createProcessInstanceQuery().count());
enableAuthorization();
}
use of org.camunda.bpm.engine.test.Deployment in project camunda-bpm-platform by camunda.
the class DelegationAuthorizationTest method testCustomTaskFormHandlerExecutesQuery.
@Deployment
public void testCustomTaskFormHandlerExecutesQuery() {
// given
startProcessInstancesByKey(DEFAULT_PROCESS_KEY, 5);
String taskId = selectAnyTask().getId();
createGrantAuthorization(TASK, taskId, userId, READ);
// when
TaskFormData taskFormData = formService.getTaskFormData(taskId);
// then
assertNotNull(taskFormData);
assertNotNull(MyDelegationService.CURRENT_AUTHENTICATION);
assertEquals(userId, MyDelegationService.CURRENT_AUTHENTICATION.getUserId());
assertEquals(Long.valueOf(5), MyDelegationService.INSTANCES_COUNT);
}
use of org.camunda.bpm.engine.test.Deployment in project camunda-bpm-platform by camunda.
the class DelegationAuthorizationTest method testTaskListenerExecutesQueryAfterUserCompletesTaskAsDelegateExpression.
@Deployment
public void testTaskListenerExecutesQueryAfterUserCompletesTaskAsDelegateExpression() {
// given
processEngineConfiguration.getBeans().put("myListener", new ExecuteQueryTaskListener());
startProcessInstancesByKey(DEFAULT_PROCESS_KEY, 5);
String taskId = selectAnyTask().getId();
createGrantAuthorization(TASK, taskId, userId, UPDATE);
// when
taskService.complete(taskId);
// then
assertNotNull(MyDelegationService.CURRENT_AUTHENTICATION);
assertEquals(userId, MyDelegationService.CURRENT_AUTHENTICATION.getUserId());
assertEquals(Long.valueOf(5), MyDelegationService.INSTANCES_COUNT);
}
use of org.camunda.bpm.engine.test.Deployment in project camunda-bpm-platform by camunda.
the class DelegationAuthorizationTest method testExecutionListenerExecutesQueryAfterUserCompletesTaskAsDelegateExpression.
@Deployment
public void testExecutionListenerExecutesQueryAfterUserCompletesTaskAsDelegateExpression() {
// given
processEngineConfiguration.getBeans().put("myListener", new ExecuteQueryListener());
startProcessInstancesByKey(DEFAULT_PROCESS_KEY, 5);
String taskId = selectAnyTask().getId();
createGrantAuthorization(TASK, taskId, userId, UPDATE);
// when
taskService.complete(taskId);
// then
assertNotNull(MyDelegationService.CURRENT_AUTHENTICATION);
assertEquals(userId, MyDelegationService.CURRENT_AUTHENTICATION.getUserId());
assertEquals(Long.valueOf(5), MyDelegationService.INSTANCES_COUNT);
}
use of org.camunda.bpm.engine.test.Deployment in project camunda-bpm-platform by camunda.
the class DelegationAuthorizationTest method testTaskListenerExecutesCommandAfterUserCompletesTaskAsDelegateExpression.
@Deployment
public void testTaskListenerExecutesCommandAfterUserCompletesTaskAsDelegateExpression() {
// given
processEngineConfiguration.getBeans().put("myListener", new ExecuteCommandTaskListener());
startProcessInstanceByKey(DEFAULT_PROCESS_KEY);
String taskId = selectSingleTask().getId();
createGrantAuthorization(TASK, taskId, userId, UPDATE);
// when
taskService.complete(taskId);
// then
assertNotNull(MyDelegationService.CURRENT_AUTHENTICATION);
assertEquals(userId, MyDelegationService.CURRENT_AUTHENTICATION.getUserId());
disableAuthorization();
assertEquals(2, runtimeService.createProcessInstanceQuery().count());
enableAuthorization();
}
Aggregations