use of org.camunda.bpm.engine.test.api.authorization.service.ExecuteCommandListener 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.api.authorization.service.ExecuteCommandListener in project camunda-bpm-platform by camunda.
the class DelegationAuthorizationTest method testExecutionListenerExecutesCommandAfterUserCompletesTaskAsExpression.
@Deployment
public void testExecutionListenerExecutesCommandAfterUserCompletesTaskAsExpression() {
// 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();
}
Aggregations