use of org.camunda.bpm.engine.test.Deployment in project camunda-bpm-platform by camunda.
the class DelegationAuthorizationTest method testTaskListenerExecutesCommandAfterUserCompletesTaskAsExpression.
@Deployment
public void testTaskListenerExecutesCommandAfterUserCompletesTaskAsExpression() {
// 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();
}
use of org.camunda.bpm.engine.test.Deployment in project camunda-bpm-platform by camunda.
the class DelegationAuthorizationTest method testScriptExecutionListenerExecutesCommandAfterUserCompletesTask.
@Deployment
public void testScriptExecutionListenerExecutesCommandAfterUserCompletesTask() {
// given
String processInstanceId = startProcessInstanceByKey(DEFAULT_PROCESS_KEY).getId();
String taskId = selectSingleTask().getId();
createGrantAuthorization(TASK, taskId, userId, UPDATE);
// when
taskService.complete(taskId);
// then
disableAuthorization();
VariableInstance variableUser = runtimeService.createVariableInstanceQuery().processInstanceIdIn(processInstanceId).variableName("userId").singleResult();
assertNotNull(variableUser);
assertEquals(userId, variableUser.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 testExecutionListenerExecutesCommandAfterUserCompletesTaskAsDelegateExpression.
@Deployment
public void testExecutionListenerExecutesCommandAfterUserCompletesTaskAsDelegateExpression() {
// given
processEngineConfiguration.getBeans().put("myListener", new ExecuteCommandListener());
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();
}
use of org.camunda.bpm.engine.test.Deployment in project camunda-bpm-platform by camunda.
the class DelegationAuthorizationTest method testScriptTaskListenerExecutesQueryAfterUserCompletesTask.
@Deployment
public void testScriptTaskListenerExecutesQueryAfterUserCompletesTask() {
// given
startProcessInstancesByKey(DEFAULT_PROCESS_KEY, 5);
Task task = selectAnyTask();
String taskId = task.getId();
String processInstanceId = task.getProcessInstanceId();
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(5l, variableCount.getValue());
enableAuthorization();
}
use of org.camunda.bpm.engine.test.Deployment in project camunda-bpm-platform by camunda.
the class DelegationAuthorizationTest method testJavaDelegateExecutesQueryAfterUserCompletesTaskAsDelegateExpression.
@Deployment
public void testJavaDelegateExecutesQueryAfterUserCompletesTaskAsDelegateExpression() {
// given
processEngineConfiguration.getBeans().put("myDelegate", new ExecuteQueryDelegate());
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);
}
Aggregations