Search in sources :

Example 1 with ExecuteQueryDelegate

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

Example 2 with ExecuteQueryDelegate

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

the class DelegationAuthorizationTest method testJavaDelegateExecutesQueryAfterUserCompletesTaskAsExpression.

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

Aggregations

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