@Test public void testSetLocalScopeWithExecutionListenerStart() { testHelper.deploy(Bpmn.createExecutableProcess("process") .startEvent().id("activityId") .camundaExecutionListenerClass(ExecutionListener.EVENTNAME_START, ExecutionListener.class) .endEvent() .done()); engineRule.getRuntimeService().startProcessInstanceByKey("process"); }
@Test public void createVariablesUsingVariableMap() { // given BpmnModelInstance simpleInstanceWithListener = Bpmn.createExecutableProcess("Process") .startEvent() .camundaExecutionListenerClass(ExecutionListener.EVENTNAME_END, ReadTransientVariableExecutionListener.class) .userTask() .endEvent() .done(); testRule.deploy(simpleInstanceWithListener); // when VariableMap variables = Variables.createVariables(); variables.put(VARIABLE_NAME, Variables.untypedValue(true, true)); runtimeService.startProcessInstanceByKey("Process", variables ); // then List<VariableInstance> variableInstances = runtimeService.createVariableInstanceQuery().list(); List<HistoricVariableInstance> historicVariableInstances = historyService.createHistoricVariableInstanceQuery().list(); assertEquals(0, variableInstances.size()); assertEquals(0, historicVariableInstances.size()); }
@Test public void createTransientVariablesUsingFluentBuilder() { // given BpmnModelInstance simpleInstanceWithListener = Bpmn.createExecutableProcess("Process") .startEvent() .camundaExecutionListenerClass(ExecutionListener.EVENTNAME_END, ReadTransientVariableExecutionListener.class) .userTask() .endEvent() .done(); testRule.deploy(simpleInstanceWithListener); // when runtimeService.createProcessInstanceByKey("Process") .setVariables(Variables.createVariables().putValue(VARIABLE_NAME, Variables.stringValue("dlsd", true))) .execute(); // then List<VariableInstance> variableInstances = runtimeService.createVariableInstanceQuery().list(); List<HistoricVariableInstance> historicVariableInstances = historyService.createHistoricVariableInstanceQuery().list(); assertEquals(0, variableInstances.size()); assertEquals(0, historicVariableInstances.size()); }
public void testSetVariableInEndListenerOfAsyncStartEvent () throws Exception { //given BpmnModelInstance subProcess = Bpmn.createExecutableProcess("process") .startEvent() .camundaAsyncBefore() .camundaExecutionListenerClass(ExecutionListener.EVENTNAME_END, SubProcessActivityStartListener.class.getName()) .endEvent() .done(); org.camunda.bpm.engine.repository.Deployment deployment = repositoryService.createDeployment() .addModelInstance("process.bpmn", subProcess) .deploy(); //when runtimeService.startProcessInstanceByKey("process", Variables.createVariables().putValue("executionListenerCounter",1)); managementService.executeJob(managementService.createJobQuery().active().singleResult().getId()); //then assertThat(historyService.createHistoricVariableInstanceQuery().count(), is (2L)); repositoryService.deleteDeployment(deployment.getId(),true); }
public void testSetVariableInStartListenerOfAsyncStartEvent () throws Exception { //given BpmnModelInstance subProcess = Bpmn.createExecutableProcess("process") .startEvent() .camundaAsyncBefore() .camundaExecutionListenerClass(ExecutionListener.EVENTNAME_START, SubProcessActivityStartListener.class.getName()) .endEvent() .done(); org.camunda.bpm.engine.repository.Deployment deployment = repositoryService.createDeployment() .addModelInstance("process.bpmn", subProcess) .deploy(); //when runtimeService.startProcessInstanceByKey("process", Variables.createVariables().putValue("executionListenerCounter",1)); managementService.executeJob(managementService.createJobQuery().active().singleResult().getId()); //then assertThat(historyService.createHistoricVariableInstanceQuery().count(), is (2L)); repositoryService.deleteDeployment(deployment.getId(),true); }
@Test public void testSetLocalScopeInSubprocessWithStartExecutionListener() { testHelper.deploy(Bpmn.createExecutableProcess("process") .startEvent() .subProcess().embeddedSubProcess() .startEvent().id("activityId") .camundaExecutionListenerClass(ExecutionListener.EVENTNAME_START, ExecutionListener.class) .endEvent() .subProcessDone() .endEvent() .done()); engineRule.getRuntimeService().startProcessInstanceByKey("process"); }
public void testSetVariableInSubProcessStartEventWithEndListener () throws Exception { //given BpmnModelInstance topProcess = Bpmn.createExecutableProcess("topProcess") .startEvent() .callActivity() .calledElement("subProcess") .camundaIn("executionListenerCounter","executionListenerCounter") .endEvent() .done(); BpmnModelInstance subProcess = Bpmn.createExecutableProcess("subProcess") .startEvent() .camundaAsyncBefore() .camundaExecutionListenerClass(ExecutionListener.EVENTNAME_END, "org.camunda.bpm.engine.test.history.SubProcessActivityStartListener") .endEvent() .done(); org.camunda.bpm.engine.repository.Deployment deployment = repositoryService.createDeployment() .addModelInstance("process.bpmn", topProcess) .addModelInstance("subProcess.bpmn", subProcess) .deploy(); //when runtimeService.startProcessInstanceByKey("topProcess", Variables.createVariables().putValue("executionListenerCounter",1)); managementService.executeJob(managementService.createJobQuery().active().singleResult().getId()); //then assertThat(historyService.createHistoricVariableInstanceQuery().count(), is (3L)); repositoryService.deleteDeployment(deployment.getId(),true); }
@Test public void testSetLocalScopeWithExecutionListenerStart() { testHelper.deploy(Bpmn.createExecutableProcess("process") .startEvent().id("activityId") .camundaExecutionListenerClass(ExecutionListener.EVENTNAME_START, ExecutionListener.class) .endEvent() .done()); engineRule.getRuntimeService().startProcessInstanceByKey("process"); }
@Test public void createVariablesUsingVariableMap() { // given BpmnModelInstance simpleInstanceWithListener = Bpmn.createExecutableProcess("Process") .startEvent() .camundaExecutionListenerClass(ExecutionListener.EVENTNAME_END, ReadTransientVariableExecutionListener.class) .userTask() .endEvent() .done(); testRule.deploy(simpleInstanceWithListener); // when VariableMap variables = Variables.createVariables(); variables.put(VARIABLE_NAME, Variables.untypedValue(true, true)); runtimeService.startProcessInstanceByKey("Process", variables ); // then List<VariableInstance> variableInstances = runtimeService.createVariableInstanceQuery().list(); List<HistoricVariableInstance> historicVariableInstances = historyService.createHistoricVariableInstanceQuery().list(); assertEquals(0, variableInstances.size()); assertEquals(0, historicVariableInstances.size()); }
@Test public void createTransientVariablesUsingFluentBuilder() { // given BpmnModelInstance simpleInstanceWithListener = Bpmn.createExecutableProcess("Process") .startEvent() .camundaExecutionListenerClass(ExecutionListener.EVENTNAME_END, ReadTransientVariableExecutionListener.class) .userTask() .endEvent() .done(); testRule.deploy(simpleInstanceWithListener); // when runtimeService.createProcessInstanceByKey("Process") .setVariables(Variables.createVariables().putValue(VARIABLE_NAME, Variables.stringValue("dlsd", true))) .execute(); // then List<VariableInstance> variableInstances = runtimeService.createVariableInstanceQuery().list(); List<HistoricVariableInstance> historicVariableInstances = historyService.createHistoricVariableInstanceQuery().list(); assertEquals(0, variableInstances.size()); assertEquals(0, historicVariableInstances.size()); }
public void testSetVariableInEndListenerOfAsyncStartEvent () throws Exception { //given BpmnModelInstance subProcess = Bpmn.createExecutableProcess("process") .startEvent() .camundaAsyncBefore() .camundaExecutionListenerClass(ExecutionListener.EVENTNAME_END, SubProcessActivityStartListener.class.getName()) .endEvent() .done(); org.camunda.bpm.engine.repository.Deployment deployment = repositoryService.createDeployment() .addModelInstance("process.bpmn", subProcess) .deploy(); //when runtimeService.startProcessInstanceByKey("process", Variables.createVariables().putValue("executionListenerCounter",1)); managementService.executeJob(managementService.createJobQuery().active().singleResult().getId()); //then assertThat(historyService.createHistoricVariableInstanceQuery().count(), is (2L)); repositoryService.deleteDeployment(deployment.getId(),true); }
public void testSetVariableInStartListenerOfAsyncStartEvent () throws Exception { //given BpmnModelInstance subProcess = Bpmn.createExecutableProcess("process") .startEvent() .camundaAsyncBefore() .camundaExecutionListenerClass(ExecutionListener.EVENTNAME_START, SubProcessActivityStartListener.class.getName()) .endEvent() .done(); org.camunda.bpm.engine.repository.Deployment deployment = repositoryService.createDeployment() .addModelInstance("process.bpmn", subProcess) .deploy(); //when runtimeService.startProcessInstanceByKey("process", Variables.createVariables().putValue("executionListenerCounter",1)); managementService.executeJob(managementService.createJobQuery().active().singleResult().getId()); //then assertThat(historyService.createHistoricVariableInstanceQuery().count(), is (2L)); repositoryService.deleteDeployment(deployment.getId(),true); }
@Test public void testSetLocalScopeInSubprocessWithStartExecutionListener() { testHelper.deploy(Bpmn.createExecutableProcess("process") .startEvent() .subProcess().embeddedSubProcess() .startEvent().id("activityId") .camundaExecutionListenerClass(ExecutionListener.EVENTNAME_START, ExecutionListener.class) .endEvent() .subProcessDone() .endEvent() .done()); engineRule.getRuntimeService().startProcessInstanceByKey("process"); }
public void testSetVariableInSubProcessStartEventWithEndListener () throws Exception { //given BpmnModelInstance topProcess = Bpmn.createExecutableProcess("topProcess") .startEvent() .callActivity() .calledElement("subProcess") .camundaIn("executionListenerCounter","executionListenerCounter") .endEvent() .done(); BpmnModelInstance subProcess = Bpmn.createExecutableProcess("subProcess") .startEvent() .camundaAsyncBefore() .camundaExecutionListenerClass(ExecutionListener.EVENTNAME_END, "org.camunda.bpm.engine.test.history.SubProcessActivityStartListener") .endEvent() .done(); org.camunda.bpm.engine.repository.Deployment deployment = repositoryService.createDeployment() .addModelInstance("process.bpmn", topProcess) .addModelInstance("subProcess.bpmn", subProcess) .deploy(); //when runtimeService.startProcessInstanceByKey("topProcess", Variables.createVariables().putValue("executionListenerCounter",1)); managementService.executeJob(managementService.createJobQuery().active().singleResult().getId()); //then assertThat(historyService.createHistoricVariableInstanceQuery().count(), is (3L)); repositoryService.deleteDeployment(deployment.getId(),true); }