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 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 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); }