public virtual 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)); }
public virtual 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)); }
public virtual void testQueryByEventSubscriptionId() { createExampleEventSubscriptions(); IList <EventSubscription> list = runtimeService.createEventSubscriptionQuery().eventName("messageName2").list(); assertEquals(1, list.Count); EventSubscription eventSubscription = list[0]; EventSubscriptionQuery query = runtimeService.createEventSubscriptionQuery().eventSubscriptionId(eventSubscription.Id); assertEquals(1, query.count()); assertEquals(1, query.list().size()); assertNotNull(query.singleResult()); try { runtimeService.createEventSubscriptionQuery().eventSubscriptionId(null).list(); fail("Expected ProcessEngineException"); } catch (ProcessEngineException) { } cleanDb(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Deployment public void testTimeCycle() public virtual void testTimeCycle() { string processInstanceId = runtimeService.startProcessInstanceByKey("process").Id; EventSubscriptionQuery eventSubscriptionQuery = runtimeService.createEventSubscriptionQuery(); assertEquals(0, eventSubscriptionQuery.count()); TaskQuery taskQuery = taskService.createTaskQuery(); assertEquals(1, taskQuery.count()); Task task = taskQuery.singleResult(); assertEquals("task", task.TaskDefinitionKey); JobQuery jobQuery = managementService.createJobQuery().timers(); assertEquals(1, jobQuery.count()); string jobId = jobQuery.singleResult().Id; managementService.executeJob(jobId); assertEquals(0, jobQuery.count()); assertEquals(1, taskQuery.count()); task = taskQuery.singleResult(); assertEquals("eventSubProcessTask", task.TaskDefinitionKey); taskService.complete(task.Id); assertProcessEnded(processInstanceId); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Deployment public void testKeepCompensation() public virtual void testKeepCompensation() { ProcessInstance pi = runtimeService.startProcessInstanceByKey("process"); TaskQuery taskQuery = taskService.createTaskQuery(); EventSubscriptionQuery eventSubscriptionQuery = runtimeService.createEventSubscriptionQuery(); Task task = taskQuery.singleResult(); assertNotNull(task); assertEquals("taskBeforeInterruptingEventSuprocess", task.TaskDefinitionKey); IList <EventSubscription> eventSubscriptions = eventSubscriptionQuery.list(); assertEquals(2, eventSubscriptions.Count); runtimeService.messageEventReceived("newMessage", pi.Id); task = taskQuery.singleResult(); assertNotNull(task); assertEquals("taskAfterMessageStartEvent", task.TaskDefinitionKey); assertEquals(1, eventSubscriptionQuery.count()); taskService.complete(task.Id); assertProcessEnded(pi.Id); }
public virtual void testQueryNoAuthenticatedTenants() { identityService.setAuthentication("user", null, null); EventSubscriptionQuery query = runtimeService.createEventSubscriptionQuery(); assertThat(query.count(), @is(1L)); }
public virtual void testQueryDisabledTenantCheck() { processEngineConfiguration.TenantCheckEnabled = false; identityService.setAuthentication("user", null, null); EventSubscriptionQuery query = runtimeService.createEventSubscriptionQuery(); assertThat(query.count(), @is(3L)); }
public virtual 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)); }
public virtual void testCancelEventSubscriptionsWhenReceivingASignal() { ProcessInstance pi = runtimeService.startProcessInstanceByKey("process"); TaskQuery taskQuery = taskService.createTaskQuery(); EventSubscriptionQuery eventSubscriptionQuery = runtimeService.createEventSubscriptionQuery(); Task task = taskQuery.singleResult(); assertNotNull(task); assertEquals("taskBeforeInterruptingEventSuprocess", task.TaskDefinitionKey); IList <EventSubscription> eventSubscriptions = eventSubscriptionQuery.list(); assertEquals(2, eventSubscriptions.Count); runtimeService.signalEventReceived("newSignal", pi.Id); task = taskQuery.singleResult(); assertNotNull(task); assertEquals("tastAfterSignalStartEvent", task.TaskDefinitionKey); assertEquals(0, eventSubscriptionQuery.count()); try { runtimeService.messageEventReceived("newMessage", pi.Id); fail("A ProcessEngineException was expected."); } catch (ProcessEngineException) { // expected exception; } taskService.complete(task.Id); assertProcessEnded(pi.Id); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Deployment public void testCatchSignalAndMessageAndTimer() public virtual 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.CurrentTime = new DateTime(ClockUtil.CurrentTime.Ticks + 10000); try { EventSubscription messageEventSubscription = messageEventSubscriptionQuery.singleResult(); runtimeService.messageEventReceived(messageEventSubscription.EventName, messageEventSubscription.ExecutionId); 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.Id); } finally { ClockUtil.CurrentTime = DateTime.Now; } }
public virtual void testQueryByNonExistingTenantId() { EventSubscriptionQuery query = runtimeService.createEventSubscriptionQuery().tenantIdIn("nonExisting"); assertThat(query.count(), @is(0L)); }
public virtual void testQueryBySubscriptionsWithoutTenantId() { EventSubscriptionQuery query = runtimeService.createEventSubscriptionQuery().withoutTenantId(); assertThat(query.count(), @is(1L)); }
public virtual void testQueryNoTenantIdSet() { EventSubscriptionQuery query = runtimeService.createEventSubscriptionQuery(); assertThat(query.count(), @is(3L)); }