use of org.camunda.bpm.engine.runtime.EventSubscription in project camunda-bpm-platform by camunda.
the class EventSubscriptionQueryTest method testQueryByExecutionId.
@Deployment
public void testQueryByExecutionId() {
// starting two instances:
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("catchSignal");
runtimeService.startProcessInstanceByKey("catchSignal");
// test query by process instance id
EventSubscription subscription = runtimeService.createEventSubscriptionQuery().processInstanceId(processInstance.getId()).singleResult();
assertNotNull(subscription);
Execution executionWaitingForSignal = runtimeService.createExecutionQuery().activityId("signalEvent").processInstanceId(processInstance.getId()).singleResult();
// test query by execution id
EventSubscription signalSubscription = runtimeService.createEventSubscriptionQuery().executionId(executionWaitingForSignal.getId()).singleResult();
assertNotNull(signalSubscription);
assertEquals(signalSubscription, subscription);
try {
runtimeService.createEventSubscriptionQuery().executionId(null).list();
fail("Expected ProcessEngineException");
} catch (ProcessEngineException e) {
}
cleanDb();
}
Aggregations