org.camunda.bpm.engine.runtime.EventSubscriptionQuery Java Examples
The following examples show how to use
org.camunda.bpm.engine.runtime.EventSubscriptionQuery.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EventSubscriptionAuthorizationTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public void testQueryWithoutAuthorization() { // 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); // when EventSubscriptionQuery query = runtimeService.createEventSubscriptionQuery(); // then verifyQueryResults(query, 0); }
Example #2
Source File: EventSubscriptionAuthorizationTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
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()); }
Example #3
Source File: EventSubscriptionAuthorizationTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
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); }
Example #4
Source File: EventSubscriptionAuthorizationTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public void testQueryWithReadInstancesPermissionOnOneTaskProcess() { // 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, ONE_TASK_PROCESS_KEY, userId, READ_INSTANCE); // when EventSubscriptionQuery query = runtimeService.createEventSubscriptionQuery(); // then verifyQueryResults(query, 3); }
Example #5
Source File: EventSubscriptionRestServiceImpl.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public List<EventSubscriptionDto> queryEventSubscriptions(EventSubscriptionQueryDto queryDto, Integer firstResult, Integer maxResults) { ProcessEngine engine = getProcessEngine(); queryDto.setObjectMapper(getObjectMapper()); EventSubscriptionQuery query = queryDto.toQuery(engine); List<EventSubscription> matchingEventSubscriptions; if (firstResult != null || maxResults != null) { matchingEventSubscriptions = executePaginatedQuery(query, firstResult, maxResults); } else { matchingEventSubscriptions = query.list(); } List<EventSubscriptionDto> eventSubscriptionResults = new ArrayList<EventSubscriptionDto>(); for (EventSubscription eventSubscription : matchingEventSubscriptions) { EventSubscriptionDto resultEventSubscription = EventSubscriptionDto.fromEventSubscription(eventSubscription); eventSubscriptionResults.add(resultEventSubscription); } return eventSubscriptionResults; }
Example #6
Source File: EventSubscriptionAuthorizationTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
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); }
Example #7
Source File: EventSubscriptionQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public void testQueryByEventSubscriptionId() { createExampleEventSubscriptions(); List<EventSubscription> list = runtimeService.createEventSubscriptionQuery() .eventName("messageName2") .list(); assertEquals(1, list.size()); EventSubscription eventSubscription = list.get(0); EventSubscriptionQuery query = runtimeService.createEventSubscriptionQuery() .eventSubscriptionId(eventSubscription.getId()); assertEquals(1, query.count()); assertEquals(1, query.list().size()); assertNotNull(query.singleResult()); try { runtimeService.createEventSubscriptionQuery().eventSubscriptionId(null).list(); fail("Expected ProcessEngineException"); } catch (ProcessEngineException e) { } cleanDb(); }
Example #8
Source File: HistoricActivityInstanceTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources = {"org/camunda/bpm/engine/test/history/HistoricActivityInstanceTest.testHistoricActivityInstanceTimerEvent.bpmn20.xml"}) public void testHistoricActivityInstanceMessageEvent() { runtimeService.startProcessInstanceByKey("catchSignal"); JobQuery jobQuery = managementService.createJobQuery(); assertEquals(1, jobQuery.count()); EventSubscriptionQuery eventSubscriptionQuery = runtimeService.createEventSubscriptionQuery(); assertEquals(1, eventSubscriptionQuery.count()); runtimeService.correlateMessage("newInvoice"); TaskQuery taskQuery = taskService.createTaskQuery(); Task task = taskQuery.singleResult(); assertEquals("afterMessage", task.getName()); HistoricActivityInstanceQuery historicActivityInstanceQuery = historyService.createHistoricActivityInstanceQuery().activityId("gw1"); assertEquals(1, historicActivityInstanceQuery.count()); assertNotNull(historicActivityInstanceQuery.singleResult().getEndTime()); historicActivityInstanceQuery = historyService.createHistoricActivityInstanceQuery().activityId("messageEvent"); assertEquals(1, historicActivityInstanceQuery.count()); assertNotNull(historicActivityInstanceQuery.singleResult().getEndTime()); assertEquals("intermediateMessageCatch", historicActivityInstanceQuery.singleResult().getActivityType()); }
Example #9
Source File: InterruptingEventSubProcessTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment public void testKeepCompensation() { ProcessInstance pi = runtimeService.startProcessInstanceByKey("process"); TaskQuery taskQuery = taskService.createTaskQuery(); EventSubscriptionQuery eventSubscriptionQuery = runtimeService.createEventSubscriptionQuery(); Task task = taskQuery.singleResult(); assertNotNull(task); assertEquals("taskBeforeInterruptingEventSuprocess", task.getTaskDefinitionKey()); List<EventSubscription> eventSubscriptions = eventSubscriptionQuery.list(); assertEquals(2, eventSubscriptions.size()); runtimeService.messageEventReceived("newMessage", pi.getId()); task = taskQuery.singleResult(); assertNotNull(task); assertEquals("taskAfterMessageStartEvent", task.getTaskDefinitionKey()); assertEquals(1, eventSubscriptionQuery.count()); taskService.complete(task.getId()); assertProcessEnded(pi.getId()); }
Example #10
Source File: MultiTenancyEventSubscriptionQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public void testQueryByTenantIdsIncludeSubscriptionsWithoutTenantId() { EventSubscriptionQuery query = runtimeService .createEventSubscriptionQuery() .tenantIdIn(TENANT_ONE) .includeEventSubscriptionsWithoutTenantId(); assertThat(query.count(), is(2L)); query = runtimeService .createEventSubscriptionQuery() .tenantIdIn(TENANT_TWO) .includeEventSubscriptionsWithoutTenantId(); assertThat(query.count(), is(2L)); query = runtimeService .createEventSubscriptionQuery() .tenantIdIn(TENANT_ONE, TENANT_TWO) .includeEventSubscriptionsWithoutTenantId(); assertThat(query.count(), is(3L)); }
Example #11
Source File: InterruptingEventSubProcessTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Deployment public void testTimeCycle() { String processInstanceId = runtimeService.startProcessInstanceByKey("process").getId(); EventSubscriptionQuery eventSubscriptionQuery = runtimeService.createEventSubscriptionQuery(); assertEquals(0, eventSubscriptionQuery.count()); TaskQuery taskQuery = taskService.createTaskQuery(); assertEquals(1, taskQuery.count()); Task task = taskQuery.singleResult(); assertEquals("task", task.getTaskDefinitionKey()); JobQuery jobQuery = managementService.createJobQuery().timers(); assertEquals(1, jobQuery.count()); String jobId = jobQuery.singleResult().getId(); managementService.executeJob(jobId); assertEquals(0, jobQuery.count()); assertEquals(1, taskQuery.count()); task = taskQuery.singleResult(); assertEquals("eventSubProcessTask", task.getTaskDefinitionKey()); taskService.complete(task.getId()); assertProcessEnded(processInstanceId); }
Example #12
Source File: EventBasedGatewayTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Deployment public void testCatchSignalAndMessageAndTimer() { runtimeService.startProcessInstanceByKey("catchSignal"); assertEquals(2, runtimeService.createEventSubscriptionQuery().count()); EventSubscriptionQuery messageEventSubscriptionQuery = runtimeService.createEventSubscriptionQuery().eventType("message"); assertEquals(1, messageEventSubscriptionQuery.count()); assertEquals(1, runtimeService.createEventSubscriptionQuery().eventType("signal").count()); assertEquals(1, runtimeService.createProcessInstanceQuery().count()); assertEquals(1, managementService.createJobQuery().count()); // we can query for an execution with has both a signal AND message subscription Execution execution = runtimeService.createExecutionQuery() .messageEventSubscriptionName("newInvoice") .signalEventSubscriptionName("alert") .singleResult(); assertNotNull(execution); ClockUtil.setCurrentTime(new Date(ClockUtil.getCurrentTime().getTime() +10000)); try { EventSubscription messageEventSubscription = messageEventSubscriptionQuery.singleResult(); runtimeService.messageEventReceived(messageEventSubscription.getEventName(), messageEventSubscription.getExecutionId()); assertEquals(0, runtimeService.createEventSubscriptionQuery().count()); assertEquals(1, runtimeService.createProcessInstanceQuery().count()); assertEquals(0, managementService.createJobQuery().count()); Task task = taskService.createTaskQuery() .taskName("afterMessage") .singleResult(); assertNotNull(task); taskService.complete(task.getId()); }finally{ ClockUtil.setCurrentTime(new Date()); } }
Example #13
Source File: InterruptingEventSubProcessTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Deployment(resources="org/camunda/bpm/engine/test/bpmn/subprocess/InterruptingEventSubProcessTest.testCancelEventSubscriptions.bpmn") public void testCancelEventSubscriptionsWhenReceivingAMessage() { ProcessInstance pi = runtimeService.startProcessInstanceByKey("process"); TaskQuery taskQuery = taskService.createTaskQuery(); EventSubscriptionQuery eventSubscriptionQuery = runtimeService.createEventSubscriptionQuery(); Task task = taskQuery.singleResult(); assertNotNull(task); assertEquals("taskBeforeInterruptingEventSuprocess", task.getTaskDefinitionKey()); List<EventSubscription> eventSubscriptions = eventSubscriptionQuery.list(); assertEquals(2, eventSubscriptions.size()); runtimeService.messageEventReceived("newMessage", pi.getId()); task = taskQuery.singleResult(); assertNotNull(task); assertEquals("taskAfterMessageStartEvent", task.getTaskDefinitionKey()); assertEquals(0, eventSubscriptionQuery.count()); try { runtimeService.signalEventReceived("newSignal", pi.getId()); fail("A ProcessEngineException was expected."); } catch (ProcessEngineException e) { // expected exception; } taskService.complete(task.getId()); assertProcessEnded(pi.getId()); }
Example #14
Source File: InterruptingEventSubProcessTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Deployment(resources="org/camunda/bpm/engine/test/bpmn/subprocess/InterruptingEventSubProcessTest.testCancelEventSubscriptions.bpmn") public void testCancelEventSubscriptionsWhenReceivingASignal() { ProcessInstance pi = runtimeService.startProcessInstanceByKey("process"); TaskQuery taskQuery = taskService.createTaskQuery(); EventSubscriptionQuery eventSubscriptionQuery = runtimeService.createEventSubscriptionQuery(); Task task = taskQuery.singleResult(); assertNotNull(task); assertEquals("taskBeforeInterruptingEventSuprocess", task.getTaskDefinitionKey()); List<EventSubscription> eventSubscriptions = eventSubscriptionQuery.list(); assertEquals(2, eventSubscriptions.size()); runtimeService.signalEventReceived("newSignal", pi.getId()); task = taskQuery.singleResult(); assertNotNull(task); assertEquals("tastAfterSignalStartEvent", task.getTaskDefinitionKey()); assertEquals(0, eventSubscriptionQuery.count()); try { runtimeService.messageEventReceived("newMessage", pi.getId()); fail("A ProcessEngineException was expected."); } catch (ProcessEngineException e) { // expected exception; } taskService.complete(task.getId()); assertProcessEnded(pi.getId()); }
Example #15
Source File: EventSubscriptionAuthorizationTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public void testSimpleQueryWithReadInstancesPermissionOnAnyProcessDefinition() { // given String processInstanceId = startProcessInstanceByKey(ONE_TASK_PROCESS_KEY).getId(); createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, READ_INSTANCE); // when EventSubscriptionQuery query = runtimeService.createEventSubscriptionQuery(); // then verifyQueryResults(query, 1); EventSubscription eventSubscription = query.singleResult(); assertNotNull(eventSubscription); assertEquals(processInstanceId, eventSubscription.getProcessInstanceId()); }
Example #16
Source File: CallActivityTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Deployment(resources = {"org/camunda/bpm/engine/test/bpmn/callactivity/CallActivity.testInterruptingEventSubProcessEventSubscriptions.bpmn20.xml", "org/camunda/bpm/engine/test/bpmn/callactivity/interruptingEventSubProcessEventSubscriptions.bpmn20.xml"}) public void testInterruptingMessageEventSubProcessEventSubscriptionsInsideCallActivity() { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("callInterruptingEventSubProcess"); // one task in the call activity subprocess should be active after starting the process instance TaskQuery taskQuery = taskService.createTaskQuery(); Task taskInsideCallActivity = taskQuery.singleResult(); assertEquals("taskBeforeInterruptingEventSubprocess", taskInsideCallActivity.getTaskDefinitionKey()); // we should have no event subscriptions for the parent process assertEquals(0, runtimeService.createEventSubscriptionQuery().processInstanceId(processInstance.getId()).count()); // we should have two event subscriptions for the called process instance, one for message and one for signal String calledProcessInstanceId = taskInsideCallActivity.getProcessInstanceId(); EventSubscriptionQuery eventSubscriptionQuery = runtimeService.createEventSubscriptionQuery().processInstanceId(calledProcessInstanceId); List<EventSubscription> subscriptions = eventSubscriptionQuery.list(); assertEquals(2, subscriptions.size()); // start the message interrupting event sub process runtimeService.correlateMessage("newMessage"); Task taskAfterMessageStartEvent = taskQuery.processInstanceId(calledProcessInstanceId).singleResult(); assertEquals("taskAfterMessageStartEvent", taskAfterMessageStartEvent.getTaskDefinitionKey()); // no subscriptions left assertEquals(0, eventSubscriptionQuery.count()); // Complete the task inside the called process instance taskService.complete(taskAfterMessageStartEvent.getId()); assertProcessEnded(calledProcessInstanceId); assertProcessEnded(processInstance.getId()); }
Example #17
Source File: CallActivityTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Deployment(resources = {"org/camunda/bpm/engine/test/bpmn/callactivity/CallActivity.testInterruptingEventSubProcessEventSubscriptions.bpmn20.xml", "org/camunda/bpm/engine/test/bpmn/callactivity/interruptingEventSubProcessEventSubscriptions.bpmn20.xml"}) public void testInterruptingSignalEventSubProcessEventSubscriptionsInsideCallActivity() { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("callInterruptingEventSubProcess"); // one task in the call activity subprocess should be active after starting the process instance TaskQuery taskQuery = taskService.createTaskQuery(); Task taskInsideCallActivity = taskQuery.singleResult(); assertEquals("taskBeforeInterruptingEventSubprocess", taskInsideCallActivity.getTaskDefinitionKey()); // we should have no event subscriptions for the parent process assertEquals(0, runtimeService.createEventSubscriptionQuery().processInstanceId(processInstance.getId()).count()); // we should have two event subscriptions for the called process instance, one for message and one for signal String calledProcessInstanceId = taskInsideCallActivity.getProcessInstanceId(); EventSubscriptionQuery eventSubscriptionQuery = runtimeService.createEventSubscriptionQuery().processInstanceId(calledProcessInstanceId); List<EventSubscription> subscriptions = eventSubscriptionQuery.list(); assertEquals(2, subscriptions.size()); // start the signal interrupting event sub process runtimeService.signalEventReceived("newSignal"); Task taskAfterSignalStartEvent = taskQuery.processInstanceId(calledProcessInstanceId).singleResult(); assertEquals("taskAfterSignalStartEvent", taskAfterSignalStartEvent.getTaskDefinitionKey()); // no subscriptions left assertEquals(0, eventSubscriptionQuery.count()); // Complete the task inside the called process instance taskService.complete(taskAfterSignalStartEvent.getId()); assertProcessEnded(calledProcessInstanceId); assertProcessEnded(processInstance.getId()); }
Example #18
Source File: EventSubscriptionQueryDto.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Override protected void applyFilters(EventSubscriptionQuery query) { if (eventSubscriptionId != null) { query.eventSubscriptionId(eventSubscriptionId); } if (eventName != null) { query.eventName(eventName); } if (eventType != null) { query.eventType(eventType); } if (executionId != null) { query.executionId(executionId); } if (processInstanceId != null) { query.processInstanceId(processInstanceId); } if (activityId != null) { query.activityId(activityId); } if (tenantIdIn != null && !tenantIdIn.isEmpty()) { query.tenantIdIn(tenantIdIn.toArray(new String[tenantIdIn.size()])); } if (TRUE.equals(withoutTenantId)) { query.withoutTenantId(); } if (TRUE.equals(includeEventSubscriptionsWithoutTenantId)) { query.includeEventSubscriptionsWithoutTenantId(); } }
Example #19
Source File: EventSubscriptionQueryDto.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Override protected void applySortBy(EventSubscriptionQuery query, String sortBy, Map<String, Object> parameters, ProcessEngine engine) { if (sortBy.equals(SORT_BY_CREATED)) { query.orderByCreated(); } else if (sortBy.equals(SORT_BY_TENANT_ID)) { query.orderByTenantId(); } }
Example #20
Source File: EventSubscriptionRestServiceImpl.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
private List<EventSubscription> executePaginatedQuery(EventSubscriptionQuery query, Integer firstResult, Integer maxResults) { if (firstResult == null) { firstResult = 0; } if (maxResults == null) { maxResults = Integer.MAX_VALUE; } return query.listPage(firstResult, maxResults); }
Example #21
Source File: EventSubscriptionRestServiceImpl.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public CountResultDto queryEventSubscriptionsCount(EventSubscriptionQueryDto queryDto) { ProcessEngine engine = getProcessEngine(); queryDto.setObjectMapper(getObjectMapper()); EventSubscriptionQuery query = queryDto.toQuery(engine); long count = query.count(); CountResultDto result = new CountResultDto(); result.setCount(count); return result; }
Example #22
Source File: EventSubscriptionRestServiceQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
private EventSubscriptionQuery setUpMockEventSubscriptionQuery(List<EventSubscription> mockedInstances) { EventSubscriptionQuery sampleEventSubscriptionsQuery = mock(EventSubscriptionQuery.class); when(sampleEventSubscriptionsQuery.list()).thenReturn(mockedInstances); when(sampleEventSubscriptionsQuery.count()).thenReturn((long) mockedInstances.size()); when(processEngine.getRuntimeService().createEventSubscriptionQuery()).thenReturn(sampleEventSubscriptionsQuery); return sampleEventSubscriptionsQuery; }
Example #23
Source File: ExecutionRestServiceInteractionTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
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); }
Example #24
Source File: EventSubscriptionAuthorizationTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
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()); }
Example #25
Source File: MultiTenancyEventSubscriptionQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public void testQueryByTenantId() { EventSubscriptionQuery query = runtimeService .createEventSubscriptionQuery() .tenantIdIn(TENANT_ONE); assertThat(query.count(), is(1L)); query = runtimeService .createEventSubscriptionQuery() .tenantIdIn(TENANT_TWO); assertThat(query.count(), is(1L)); }
Example #26
Source File: MultiTenancyEventSubscriptionQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public void testQueryByTenantIds() { EventSubscriptionQuery query = runtimeService .createEventSubscriptionQuery() .tenantIdIn(TENANT_ONE, TENANT_TWO); assertThat(query.count(), is(2L)); }
Example #27
Source File: MultiTenancyEventSubscriptionQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public void testQueryBySubscriptionsWithoutTenantId() { EventSubscriptionQuery query = runtimeService .createEventSubscriptionQuery() .withoutTenantId(); assertThat(query.count(), is(1L)); }
Example #28
Source File: MultiTenancyEventSubscriptionQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public void testQueryByNonExistingTenantId() { EventSubscriptionQuery query = runtimeService. createEventSubscriptionQuery() .tenantIdIn("nonExisting"); assertThat(query.count(), is(0L)); }
Example #29
Source File: MultiTenancyEventSubscriptionQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
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)); }
Example #30
Source File: MultiTenancyEventSubscriptionQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public void testQueryAuthenticatedTenants() { identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE, TENANT_TWO)); EventSubscriptionQuery query = runtimeService.createEventSubscriptionQuery(); assertThat(query.count(), is(3L)); assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L)); assertThat(query.tenantIdIn(TENANT_TWO).count(), is(1L)); }