Search in sources :

Example 6 with EventSubscriptionQuery

use of org.camunda.bpm.engine.runtime.EventSubscriptionQuery in project camunda-bpm-platform by camunda.

the class EventSubscriptionAuthorizationTest method testSimpleQueryWithReadInstancesPermissionOnOneTaskProcess.

public void testSimpleQueryWithReadInstancesPermissionOnOneTaskProcess() {
    // given
    String processInstanceId = startProcessInstanceByKey(ONE_TASK_PROCESS_KEY).getId();
    createGrantAuthorization(PROCESS_DEFINITION, ONE_TASK_PROCESS_KEY, userId, READ_INSTANCE);
    // when
    EventSubscriptionQuery query = runtimeService.createEventSubscriptionQuery();
    // then
    verifyQueryResults(query, 1);
    EventSubscription eventSubscription = query.singleResult();
    assertNotNull(eventSubscription);
    assertEquals(processInstanceId, eventSubscription.getProcessInstanceId());
}
Also used : EventSubscription(org.camunda.bpm.engine.runtime.EventSubscription) EventSubscriptionQuery(org.camunda.bpm.engine.runtime.EventSubscriptionQuery)

Example 7 with EventSubscriptionQuery

use of org.camunda.bpm.engine.runtime.EventSubscriptionQuery in project camunda-bpm-platform by camunda.

the class EventSubscriptionAuthorizationTest method testQueryWithReadInstancesPermissionOnAnyProcessDefinition.

public void testQueryWithReadInstancesPermissionOnAnyProcessDefinition() {
    // given
    startProcessInstanceByKey(ONE_TASK_PROCESS_KEY);
    startProcessInstanceByKey(ONE_TASK_PROCESS_KEY);
    startProcessInstanceByKey(ONE_TASK_PROCESS_KEY);
    startProcessInstanceByKey(SIGNAL_BOUNDARY_PROCESS_KEY);
    startProcessInstanceByKey(SIGNAL_BOUNDARY_PROCESS_KEY);
    startProcessInstanceByKey(SIGNAL_BOUNDARY_PROCESS_KEY);
    startProcessInstanceByKey(SIGNAL_BOUNDARY_PROCESS_KEY);
    createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, READ_INSTANCE);
    // when
    EventSubscriptionQuery query = runtimeService.createEventSubscriptionQuery();
    // then
    verifyQueryResults(query, 7);
}
Also used : EventSubscriptionQuery(org.camunda.bpm.engine.runtime.EventSubscriptionQuery)

Example 8 with EventSubscriptionQuery

use of org.camunda.bpm.engine.runtime.EventSubscriptionQuery in project camunda-bpm-platform by camunda.

the class EventSubscriptionAuthorizationTest method testQueryWithReadPermissionOnAnyProcessInstance.

public void testQueryWithReadPermissionOnAnyProcessInstance() {
    // given
    startProcessInstanceByKey(ONE_TASK_PROCESS_KEY);
    startProcessInstanceByKey(ONE_TASK_PROCESS_KEY);
    startProcessInstanceByKey(ONE_TASK_PROCESS_KEY);
    startProcessInstanceByKey(SIGNAL_BOUNDARY_PROCESS_KEY);
    startProcessInstanceByKey(SIGNAL_BOUNDARY_PROCESS_KEY);
    startProcessInstanceByKey(SIGNAL_BOUNDARY_PROCESS_KEY);
    startProcessInstanceByKey(SIGNAL_BOUNDARY_PROCESS_KEY);
    createGrantAuthorization(PROCESS_INSTANCE, ANY, userId, READ);
    // when
    EventSubscriptionQuery query = runtimeService.createEventSubscriptionQuery();
    // then
    verifyQueryResults(query, 7);
}
Also used : EventSubscriptionQuery(org.camunda.bpm.engine.runtime.EventSubscriptionQuery)

Example 9 with EventSubscriptionQuery

use of org.camunda.bpm.engine.runtime.EventSubscriptionQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyEventSubscriptionQueryTest method testQueryAuthenticatedTenant.

public void testQueryAuthenticatedTenant() {
    identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
    EventSubscriptionQuery query = runtimeService.createEventSubscriptionQuery();
    assertThat(query.count(), is(2L));
    assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
    assertThat(query.tenantIdIn(TENANT_TWO).count(), is(0L));
    assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).includeEventSubscriptionsWithoutTenantId().count(), is(2L));
}
Also used : EventSubscriptionQuery(org.camunda.bpm.engine.runtime.EventSubscriptionQuery)

Example 10 with EventSubscriptionQuery

use of org.camunda.bpm.engine.runtime.EventSubscriptionQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyEventSubscriptionQueryTest method testQueryBySubscriptionsWithoutTenantId.

public void testQueryBySubscriptionsWithoutTenantId() {
    EventSubscriptionQuery query = runtimeService.createEventSubscriptionQuery().withoutTenantId();
    assertThat(query.count(), is(1L));
}
Also used : EventSubscriptionQuery(org.camunda.bpm.engine.runtime.EventSubscriptionQuery)

Aggregations

EventSubscriptionQuery (org.camunda.bpm.engine.runtime.EventSubscriptionQuery)32 EventSubscription (org.camunda.bpm.engine.runtime.EventSubscription)13 Task (org.camunda.bpm.engine.task.Task)8 Deployment (org.camunda.bpm.engine.test.Deployment)8 TaskQuery (org.camunda.bpm.engine.task.TaskQuery)7 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)5 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)3 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)2 JobQuery (org.camunda.bpm.engine.runtime.JobQuery)2 Date (java.util.Date)1 HistoricActivityInstanceQuery (org.camunda.bpm.engine.history.HistoricActivityInstanceQuery)1 InvalidRequestException (org.camunda.bpm.engine.rest.exception.InvalidRequestException)1 Execution (org.camunda.bpm.engine.runtime.Execution)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1 Test (org.junit.Test)1 Matchers.anyString (org.mockito.Matchers.anyString)1