use of org.camunda.bpm.engine.runtime.EventSubscriptionQuery in project camunda-bpm-platform by camunda.
the class ExecutionRestServiceInteractionTest method mockEventSubscriptionQuery.
private void mockEventSubscriptionQuery() {
EventSubscription mockSubscription = MockProvider.createMockEventSubscription();
EventSubscriptionQuery mockQuery = mock(EventSubscriptionQuery.class);
when(runtimeServiceMock.createEventSubscriptionQuery()).thenReturn(mockQuery);
when(mockQuery.executionId(eq(MockProvider.EXAMPLE_EXECUTION_ID))).thenReturn(mockQuery);
when(mockQuery.eventType(eq(MockProvider.EXAMPLE_EVENT_SUBSCRIPTION_TYPE))).thenReturn(mockQuery);
when(mockQuery.eventName(eq(MockProvider.EXAMPLE_EVENT_SUBSCRIPTION_NAME))).thenReturn(mockQuery);
when(mockQuery.singleResult()).thenReturn(mockSubscription);
}
use of org.camunda.bpm.engine.runtime.EventSubscriptionQuery in project camunda-bpm-platform by camunda.
the class EventSubscriptionAuthorizationTest method testQueryWithReadPermissionOnProcessInstance.
public void testQueryWithReadPermissionOnProcessInstance() {
// given
startProcessInstanceByKey(ONE_TASK_PROCESS_KEY);
startProcessInstanceByKey(ONE_TASK_PROCESS_KEY);
String processInstanceId = startProcessInstanceByKey(ONE_TASK_PROCESS_KEY).getId();
startProcessInstanceByKey(SIGNAL_BOUNDARY_PROCESS_KEY);
startProcessInstanceByKey(SIGNAL_BOUNDARY_PROCESS_KEY);
startProcessInstanceByKey(SIGNAL_BOUNDARY_PROCESS_KEY);
startProcessInstanceByKey(SIGNAL_BOUNDARY_PROCESS_KEY);
createGrantAuthorization(PROCESS_INSTANCE, processInstanceId, userId, READ);
// when
EventSubscriptionQuery query = runtimeService.createEventSubscriptionQuery();
// then
verifyQueryResults(query, 1);
EventSubscription eventSubscription = query.singleResult();
assertNotNull(eventSubscription);
assertEquals(processInstanceId, eventSubscription.getProcessInstanceId());
}
use of org.camunda.bpm.engine.runtime.EventSubscriptionQuery in project camunda-bpm-platform by camunda.
the class EventSubscriptionAuthorizationTest method testSimpleQueryWithoutAuthorization.
public void testSimpleQueryWithoutAuthorization() {
// given
startProcessInstanceByKey(ONE_TASK_PROCESS_KEY);
// when
EventSubscriptionQuery query = runtimeService.createEventSubscriptionQuery();
// then
verifyQueryResults(query, 0);
}
use of org.camunda.bpm.engine.runtime.EventSubscriptionQuery in project camunda-bpm-platform by camunda.
the class EventSubscriptionAuthorizationTest method testSimpleQueryWithReadPermissionOnProcessInstance.
public void testSimpleQueryWithReadPermissionOnProcessInstance() {
// given
String processInstanceId = startProcessInstanceByKey(ONE_TASK_PROCESS_KEY).getId();
createGrantAuthorization(PROCESS_INSTANCE, processInstanceId, userId, READ);
// when
EventSubscriptionQuery query = runtimeService.createEventSubscriptionQuery();
// then
verifyQueryResults(query, 1);
EventSubscription eventSubscription = query.singleResult();
assertNotNull(eventSubscription);
assertEquals(processInstanceId, eventSubscription.getProcessInstanceId());
}
use of org.camunda.bpm.engine.runtime.EventSubscriptionQuery in project camunda-bpm-platform by camunda.
the class EventSubscriptionAuthorizationTest method testSimpleQueryWithMultiple.
public void testSimpleQueryWithMultiple() {
// given
String processInstanceId = startProcessInstanceByKey(ONE_TASK_PROCESS_KEY).getId();
createGrantAuthorization(PROCESS_INSTANCE, ANY, userId, READ);
createGrantAuthorization(PROCESS_INSTANCE, processInstanceId, userId, READ);
// when
EventSubscriptionQuery query = runtimeService.createEventSubscriptionQuery();
// then
verifyQueryResults(query, 1);
}
Aggregations