Search in sources :

Example 1 with ExecuteQueryListener

use of org.camunda.bpm.engine.test.api.authorization.service.ExecuteQueryListener 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);
}
Also used : ExecuteQueryListener(org.camunda.bpm.engine.test.api.authorization.service.ExecuteQueryListener) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 2 with ExecuteQueryListener

use of org.camunda.bpm.engine.test.api.authorization.service.ExecuteQueryListener in project camunda-bpm-platform by camunda.

the class DelegationAuthorizationTest method testExecutionListenerExecutesQueryAfterUserCompletesTaskAsExpression.

@Deployment
public void testExecutionListenerExecutesQueryAfterUserCompletesTaskAsExpression() {
    // 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);
}
Also used : ExecuteQueryListener(org.camunda.bpm.engine.test.api.authorization.service.ExecuteQueryListener) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

Deployment (org.camunda.bpm.engine.test.Deployment)2 ExecuteQueryListener (org.camunda.bpm.engine.test.api.authorization.service.ExecuteQueryListener)2