Search in sources :

Example 71 with EventSubscription

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();
}
Also used : Execution(org.camunda.bpm.engine.runtime.Execution) EventSubscription(org.camunda.bpm.engine.runtime.EventSubscription) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

EventSubscription (org.camunda.bpm.engine.runtime.EventSubscription)71 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)38 Deployment (org.camunda.bpm.engine.test.Deployment)38 Task (org.camunda.bpm.engine.task.Task)16 EventSubscriptionQuery (org.camunda.bpm.engine.runtime.EventSubscriptionQuery)13 Test (org.junit.Test)13 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)10 Execution (org.camunda.bpm.engine.runtime.Execution)8 MigrationPlan (org.camunda.bpm.engine.migration.MigrationPlan)6 TaskQuery (org.camunda.bpm.engine.task.TaskQuery)5 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)4 EventSubscriptionEntity (org.camunda.bpm.engine.impl.persistence.entity.EventSubscriptionEntity)4 HashMap (java.util.HashMap)3 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)2 ActivityInstance (org.camunda.bpm.engine.runtime.ActivityInstance)2 AbstractFoxPlatformIntegrationTest (org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest)2 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)2 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1