Search in sources :

Example 41 with EventSubscription

use of org.camunda.bpm.engine.runtime.EventSubscription in project camunda-bpm-platform by camunda.

the class MigrationReceiveTaskTest method testMigrateEventSubscriptionProperties.

@Test
public void testMigrateEventSubscriptionProperties() {
    // given
    ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(MessageReceiveModels.ONE_RECEIVE_TASK_PROCESS);
    ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(MessageReceiveModels.ONE_RECEIVE_TASK_PROCESS);
    MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("receiveTask", "receiveTask").build();
    // when
    testHelper.createProcessInstanceAndMigrate(migrationPlan);
    // then
    EventSubscription eventSubscriptionBefore = testHelper.snapshotBeforeMigration.getEventSubscriptions().get(0);
    List<EventSubscription> eventSubscriptionsAfter = testHelper.snapshotAfterMigration.getEventSubscriptions();
    Assert.assertEquals(1, eventSubscriptionsAfter.size());
    EventSubscription eventSubscriptionAfter = eventSubscriptionsAfter.get(0);
    Assert.assertEquals(eventSubscriptionBefore.getCreated(), eventSubscriptionAfter.getCreated());
    Assert.assertEquals(eventSubscriptionBefore.getExecutionId(), eventSubscriptionAfter.getExecutionId());
    Assert.assertEquals(eventSubscriptionBefore.getProcessInstanceId(), eventSubscriptionAfter.getProcessInstanceId());
}
Also used : EventSubscription(org.camunda.bpm.engine.runtime.EventSubscription) MigrationPlan(org.camunda.bpm.engine.migration.MigrationPlan) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) Test(org.junit.Test)

Example 42 with EventSubscription

use of org.camunda.bpm.engine.runtime.EventSubscription in project camunda-bpm-platform by camunda.

the class MigrationTestRule method assertEventSubscriptionMigrated.

public void assertEventSubscriptionMigrated(String activityIdBefore, String eventNameBefore, String activityIdAfter, String eventNameAfter) {
    EventSubscription eventSubscriptionBefore = snapshotBeforeMigration.getEventSubscriptionForActivityIdAndEventName(activityIdBefore, eventNameBefore);
    assertNotNull("Expected that an event subscription for activity '" + activityIdBefore + "' exists before migration", eventSubscriptionBefore);
    assertEventSubscriptionMigrated(eventSubscriptionBefore, activityIdAfter, eventNameAfter);
}
Also used : EventSubscription(org.camunda.bpm.engine.runtime.EventSubscription)

Example 43 with EventSubscription

use of org.camunda.bpm.engine.runtime.EventSubscription in project camunda-bpm-platform by camunda.

the class MigrationMessageStartEventTest method assertEventSubscriptionMigrated.

protected void assertEventSubscriptionMigrated(EventSubscription eventSubscriptionBefore, String activityIdAfter, String eventName) {
    EventSubscription eventSubscriptionAfter = runtimeService.createEventSubscriptionQuery().singleResult();
    assertNotNull("Expected that an event subscription with id '" + eventSubscriptionBefore.getId() + "' " + "exists after migration", eventSubscriptionAfter);
    assertEquals(eventSubscriptionBefore.getEventType(), eventSubscriptionAfter.getEventType());
    assertEquals(activityIdAfter, eventSubscriptionAfter.getActivityId());
    assertEquals(eventName, eventSubscriptionAfter.getEventName());
}
Also used : EventSubscription(org.camunda.bpm.engine.runtime.EventSubscription)

Example 44 with EventSubscription

use of org.camunda.bpm.engine.runtime.EventSubscription in project camunda-bpm-platform by camunda.

the class MigrationTestRule method assertEventSubscriptionCreated.

public void assertEventSubscriptionCreated(String activityId, String eventName) {
    EventSubscription eventSubscriptionAfter = snapshotAfterMigration.getEventSubscriptionForActivityIdAndEventName(activityId, eventName);
    assertNotNull("Expected an event subscription for activity '" + activityId + "' after the migration", eventSubscriptionAfter);
    for (EventSubscription eventSubscription : snapshotBeforeMigration.getEventSubscriptions()) {
        if (eventSubscriptionAfter.getId().equals(eventSubscription.getId())) {
            fail("Expected event subscription '" + eventSubscriptionAfter.getId() + "' to be created after migration");
        }
    }
}
Also used : EventSubscription(org.camunda.bpm.engine.runtime.EventSubscription)

Example 45 with EventSubscription

use of org.camunda.bpm.engine.runtime.EventSubscription in project camunda-bpm-platform by camunda.

the class MultiTenancyStartProcessInstanceByConditionCmdTenantCheckTest method ensureEventSubscriptions.

protected void ensureEventSubscriptions(int count) {
    List<EventSubscription> eventSubscriptions = engineRule.getRuntimeService().createEventSubscriptionQuery().list();
    assertEquals(count, eventSubscriptions.size());
    for (EventSubscription eventSubscription : eventSubscriptions) {
        assertEquals(EventType.CONDITONAL.name(), eventSubscription.getEventType());
    }
}
Also used : EventSubscription(org.camunda.bpm.engine.runtime.EventSubscription)

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