public void testPropagateTenantIdToIntermediateSignalEventSubscription() { deploymentForTenant(TENANT_ID, Bpmn.createExecutableProcess(PROCESS_DEFINITION_KEY) .startEvent() .intermediateCatchEvent() .signal("start") .endEvent() .done()); startProcessInstance(PROCESS_DEFINITION_KEY); EventSubscription eventSubscription = runtimeService.createEventSubscriptionQuery().singleResult(); assertThat(eventSubscription, is(notNullValue())); // inherit the tenant id from process instance assertThat(eventSubscription.getTenantId(), is(TENANT_ID)); }
protected BpmnModelInstance signalCatchProcess(String processId) { return Bpmn.createExecutableProcess(processId) .startEvent() .intermediateCatchEvent() .signal("signal") .userTask() .endEvent() .done(); }
@Test public void testSignalWithTransientVariables() { // given BpmnModelInstance instance = Bpmn.createExecutableProcess("Process") .startEvent() .intermediateCatchEvent("signalCatch") .signal("signal") .scriptTask("scriptTask") .scriptFormat("javascript") .camundaResultVariable("abc") .scriptText("execution.setVariable('abc', foo);") .endEvent() .done(); testRule.deploy(instance); runtimeService.startProcessInstanceByKey("Process"); // when runtimeService.signalEventReceived("signal", Variables.createVariables().putValue("foo", Variables.stringValue("bar", true))); // then List<HistoricVariableInstance> variables = historyService.createHistoricVariableInstanceQuery().list(); assertEquals(1, variables.size()); assertEquals("abc", variables.get(0).getName()); }
.startEvent() .intermediateCatchEvent("signalCatch") .signal(newSignalName) .userTask("userTask") .endEvent()
@Test public void testMigrateGatewayRemoveSignalEvent() { // given ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(modify(EventBasedGatewayModels.SIGNAL_EVENT_BASED_GW_PROCESS) .flowNodeBuilder("eventBasedGateway") .intermediateCatchEvent("oldSignalCatch") .signal("old" + EventBasedGatewayModels.SIGNAL_NAME) .endEvent() .done()); ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(EventBasedGatewayModels.SIGNAL_EVENT_BASED_GW_PROCESS); MigrationPlan migrationPlan = rule.getRuntimeService() .createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()) .mapActivities("eventBasedGateway", "eventBasedGateway") .mapActivities("signalCatch", "signalCatch") .build(); // when testHelper.createProcessInstanceAndMigrate(migrationPlan); // then testHelper.assertEventSubscriptionRemoved("oldSignalCatch", "old" + EventBasedGatewayModels.SIGNAL_NAME); testHelper.assertEventSubscriptionMigrated("signalCatch", "signalCatch", EventBasedGatewayModels.SIGNAL_NAME); }
@Test public void testMigrateEventSubscriptionPreserveSignalName() { // given ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(SignalCatchModels.ONE_SIGNAL_CATCH_PROCESS); ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.newModel() .startEvent() .intermediateCatchEvent("signalCatch") .signal("new" + SignalCatchModels.SIGNAL_NAME) .userTask("userTask") .endEvent() .done()); MigrationPlan migrationPlan = rule.getRuntimeService() .createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()) .mapActivities("signalCatch", "signalCatch") .build(); // when ProcessInstance processInstance = testHelper.createProcessInstanceAndMigrate(migrationPlan); // then the signal name of the event subscription has not changed testHelper.assertEventSubscriptionMigrated("signalCatch", "signalCatch", SignalCatchModels.SIGNAL_NAME); // and it is possible to trigger the event rule.getRuntimeService().signalEventReceived(SignalCatchModels.SIGNAL_NAME); testHelper.completeTask("userTask"); testHelper.assertProcessEnded(processInstance.getId()); }
@Test public void testMigrateEventSubscriptionUpdateSignalName() { // given ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(SignalCatchModels.ONE_SIGNAL_CATCH_PROCESS); ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.newModel() .startEvent() .intermediateCatchEvent("signalCatch") .signal("new" + SignalCatchModels.SIGNAL_NAME) .userTask("userTask") .endEvent() .done()); MigrationPlan migrationPlan = rule.getRuntimeService() .createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()) .mapActivities("signalCatch", "signalCatch") .updateEventTrigger() .build(); // when ProcessInstance processInstance = testHelper.createProcessInstanceAndMigrate(migrationPlan); // then the message event subscription's event name has not changed testHelper.assertEventSubscriptionMigrated( "signalCatch", SignalCatchModels.SIGNAL_NAME, "signalCatch", "new" + SignalCatchModels.SIGNAL_NAME); // and it is possible to trigger the event rule.getRuntimeService().signalEventReceived("new" + SignalCatchModels.SIGNAL_NAME); testHelper.completeTask("userTask"); testHelper.assertProcessEnded(processInstance.getId()); }
@Test public void testMigrateGatewayAddSignalEvent() { // given ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(EventBasedGatewayModels.SIGNAL_EVENT_BASED_GW_PROCESS); ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(modify(EventBasedGatewayModels.SIGNAL_EVENT_BASED_GW_PROCESS) .flowNodeBuilder("eventBasedGateway") .intermediateCatchEvent("newSignalCatch") .signal("new" + EventBasedGatewayModels.SIGNAL_NAME) .userTask("afterNewSignalCatch") .endEvent() .done()); MigrationPlan migrationPlan = rule.getRuntimeService() .createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()) .mapActivities("eventBasedGateway", "eventBasedGateway") .mapActivities("signalCatch", "signalCatch") .build(); // when ProcessInstance processInstance = testHelper.createProcessInstanceAndMigrate(migrationPlan); // then testHelper.assertEventSubscriptionCreated("newSignalCatch", "new" + EventBasedGatewayModels.SIGNAL_NAME); testHelper.assertEventSubscriptionMigrated("signalCatch", "signalCatch", EventBasedGatewayModels.SIGNAL_NAME); rule.getRuntimeService().signalEventReceived("new" + EventBasedGatewayModels.SIGNAL_NAME); testHelper.completeTask("afterNewSignalCatch"); testHelper.assertProcessEnded(processInstance.getId()); }
public void testPropagateTenantIdToIntermediateSignalEventSubscription() { deploymentForTenant(TENANT_ID, Bpmn.createExecutableProcess(PROCESS_DEFINITION_KEY) .startEvent() .intermediateCatchEvent() .signal("start") .endEvent() .done()); startProcessInstance(PROCESS_DEFINITION_KEY); EventSubscription eventSubscription = runtimeService.createEventSubscriptionQuery().singleResult(); assertThat(eventSubscription, is(notNullValue())); // inherit the tenant id from process instance assertThat(eventSubscription.getTenantId(), is(TENANT_ID)); }
protected BpmnModelInstance signalCatchProcess(String processId) { return Bpmn.createExecutableProcess(processId) .startEvent() .intermediateCatchEvent() .signal("signal") .userTask() .endEvent() .done(); }
@Test public void testSignalWithTransientVariables() { // given BpmnModelInstance instance = Bpmn.createExecutableProcess("Process") .startEvent() .intermediateCatchEvent("signalCatch") .signal("signal") .scriptTask("scriptTask") .scriptFormat("javascript") .camundaResultVariable("abc") .scriptText("execution.setVariable('abc', foo);") .endEvent() .done(); testRule.deploy(instance); runtimeService.startProcessInstanceByKey("Process"); // when runtimeService.signalEventReceived("signal", Variables.createVariables().putValue("foo", Variables.stringValue("bar", true))); // then List<HistoricVariableInstance> variables = historyService.createHistoricVariableInstanceQuery().list(); assertEquals(1, variables.size()); assertEquals("abc", variables.get(0).getName()); }
.startEvent() .intermediateCatchEvent("signalCatch") .signal(newSignalName) .userTask("userTask") .endEvent()
@Test public void testMigrateGatewayRemoveSignalEvent() { // given ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(modify(EventBasedGatewayModels.SIGNAL_EVENT_BASED_GW_PROCESS) .flowNodeBuilder("eventBasedGateway") .intermediateCatchEvent("oldSignalCatch") .signal("old" + EventBasedGatewayModels.SIGNAL_NAME) .endEvent() .done()); ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(EventBasedGatewayModels.SIGNAL_EVENT_BASED_GW_PROCESS); MigrationPlan migrationPlan = rule.getRuntimeService() .createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()) .mapActivities("eventBasedGateway", "eventBasedGateway") .mapActivities("signalCatch", "signalCatch") .build(); // when testHelper.createProcessInstanceAndMigrate(migrationPlan); // then testHelper.assertEventSubscriptionRemoved("oldSignalCatch", "old" + EventBasedGatewayModels.SIGNAL_NAME); testHelper.assertEventSubscriptionMigrated("signalCatch", "signalCatch", EventBasedGatewayModels.SIGNAL_NAME); }
@Test public void testMigrateEventSubscriptionPreserveSignalName() { // given ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(SignalCatchModels.ONE_SIGNAL_CATCH_PROCESS); ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.newModel() .startEvent() .intermediateCatchEvent("signalCatch") .signal("new" + SignalCatchModels.SIGNAL_NAME) .userTask("userTask") .endEvent() .done()); MigrationPlan migrationPlan = rule.getRuntimeService() .createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()) .mapActivities("signalCatch", "signalCatch") .build(); // when ProcessInstance processInstance = testHelper.createProcessInstanceAndMigrate(migrationPlan); // then the signal name of the event subscription has not changed testHelper.assertEventSubscriptionMigrated("signalCatch", "signalCatch", SignalCatchModels.SIGNAL_NAME); // and it is possible to trigger the event rule.getRuntimeService().signalEventReceived(SignalCatchModels.SIGNAL_NAME); testHelper.completeTask("userTask"); testHelper.assertProcessEnded(processInstance.getId()); }
@Test public void testMigrateEventSubscriptionUpdateSignalName() { // given ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(SignalCatchModels.ONE_SIGNAL_CATCH_PROCESS); ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.newModel() .startEvent() .intermediateCatchEvent("signalCatch") .signal("new" + SignalCatchModels.SIGNAL_NAME) .userTask("userTask") .endEvent() .done()); MigrationPlan migrationPlan = rule.getRuntimeService() .createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()) .mapActivities("signalCatch", "signalCatch") .updateEventTrigger() .build(); // when ProcessInstance processInstance = testHelper.createProcessInstanceAndMigrate(migrationPlan); // then the message event subscription's event name has not changed testHelper.assertEventSubscriptionMigrated( "signalCatch", SignalCatchModels.SIGNAL_NAME, "signalCatch", "new" + SignalCatchModels.SIGNAL_NAME); // and it is possible to trigger the event rule.getRuntimeService().signalEventReceived("new" + SignalCatchModels.SIGNAL_NAME); testHelper.completeTask("userTask"); testHelper.assertProcessEnded(processInstance.getId()); }
@Test public void testMigrateGatewayAddSignalEvent() { // given ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(EventBasedGatewayModels.SIGNAL_EVENT_BASED_GW_PROCESS); ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(modify(EventBasedGatewayModels.SIGNAL_EVENT_BASED_GW_PROCESS) .flowNodeBuilder("eventBasedGateway") .intermediateCatchEvent("newSignalCatch") .signal("new" + EventBasedGatewayModels.SIGNAL_NAME) .userTask("afterNewSignalCatch") .endEvent() .done()); MigrationPlan migrationPlan = rule.getRuntimeService() .createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()) .mapActivities("eventBasedGateway", "eventBasedGateway") .mapActivities("signalCatch", "signalCatch") .build(); // when ProcessInstance processInstance = testHelper.createProcessInstanceAndMigrate(migrationPlan); // then testHelper.assertEventSubscriptionCreated("newSignalCatch", "new" + EventBasedGatewayModels.SIGNAL_NAME); testHelper.assertEventSubscriptionMigrated("signalCatch", "signalCatch", EventBasedGatewayModels.SIGNAL_NAME); rule.getRuntimeService().signalEventReceived("new" + EventBasedGatewayModels.SIGNAL_NAME); testHelper.completeTask("afterNewSignalCatch"); testHelper.assertProcessEnded(processInstance.getId()); }