//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testConditionalEventSubProcessWithSetVariableOnEndListener() public virtual void testConditionalEventSubProcessWithSetVariableOnEndListener() { // given //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: BpmnModelInstance sourceModel = modify(Bpmn.createExecutableProcess(PROC_DEF_KEY).startEvent().subProcess(SUB_PROCESS_ID).camundaExecutionListenerClass([email protected]_Fields.EVENTNAME_END, typeof(SetVariableDelegate).FullName).embeddedSubProcess().startEvent().userTask(USER_TASK_ID).endEvent().subProcessDone().endEvent().done()).addSubProcessTo(PROC_DEF_KEY).triggerByEvent().embeddedSubProcess().startEvent(EVENT_SUB_PROCESS_START_ID).condition(VAR_CONDITION).endEvent().done(); sourceModel = modify(sourceModel).addSubProcessTo(SUB_PROCESS_ID).triggerByEvent().embeddedSubProcess().startEvent().condition(VAR_CONDITION).userTask(TASK_AFTER_CONDITION_ID).endEvent().done(); ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(sourceModel); ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(modify(ProcessModels.ONE_TASK_PROCESS).addSubProcessTo(PROC_DEF_KEY).triggerByEvent().embeddedSubProcess().startEvent(EVENT_SUB_PROCESS_START_ID).condition(VAR_CONDITION).userTask(TASK_AFTER_CONDITION_ID).endEvent().done()); MigrationPlan migrationPlan = rule.RuntimeService.createMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id).mapActivities(USER_TASK_ID, USER_TASK_ID).mapActivities(EVENT_SUB_PROCESS_START_ID, EVENT_SUB_PROCESS_START_ID).updateEventTrigger().build(); //when sub process is removed, end listener is called and sets variable ProcessInstance processInstance = testHelper.createProcessInstanceAndMigrate(migrationPlan); testHelper.assertEventSubscriptionMigrated(EVENT_SUB_PROCESS_START_ID, EVENT_SUB_PROCESS_START_ID, null); assertEquals(1, rule.RuntimeService.getVariable(processInstance.Id, VARIABLE_NAME)); //then conditional event is not triggered assertEquals(USER_TASK_ID, rule.TaskService.createTaskQuery().singleResult().TaskDefinitionKey); //when any var is set testHelper.AnyVariable = processInstance.Id; //then condition is satisfied, since variable is already set which satisfies condition testHelper.completeTask(TASK_AFTER_CONDITION_ID); testHelper.assertProcessEnded(processInstance.Id); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testSerializeFileVariable() public virtual void testSerializeFileVariable() { BpmnModelInstance modelInstance = Bpmn.createExecutableProcess("process").startEvent().userTask().endEvent().done(); org.camunda.bpm.engine.repository.Deployment deployment = repositoryService.createDeployment().addModelInstance("process.bpmn", modelInstance).deploy(); VariableMap variables = Variables.createVariables(); string filename = "test.txt"; string type = "text/plain"; FileValue fileValue = Variables.fileValue(filename).file("ABC".GetBytes()).encoding("UTF-8").mimeType(type).create(); variables.put("file", fileValue); runtimeService.startProcessInstanceByKey("process", variables); Task task = taskService.createTaskQuery().singleResult(); VariableInstance result = runtimeService.createVariableInstanceQuery().processInstanceIdIn(task.ProcessInstanceId).singleResult(); FileValue value = (FileValue)result.TypedValue; assertThat(value.Filename, @is(filename)); assertThat(value.MimeType, @is(type)); assertThat(value.Encoding, @is("UTF-8")); assertThat(value.EncodingAsCharset, @is(Charset.forName("UTF-8"))); using (Scanner scanner = new Scanner(value.Value)) { assertThat(scanner.nextLine(), @is("ABC")); } // clean up repositoryService.deleteDeployment(deployment.Id, true); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testCustomIncidentMigrationWithoutConfiguration() public virtual void testCustomIncidentMigrationWithoutConfiguration() { // given RuntimeService runtimeService = engineRule.RuntimeService; BpmnModelInstance instance1 = Bpmn.createExecutableProcess("process1").startEvent().userTask("u1").endEvent().done(); BpmnModelInstance instance2 = Bpmn.createExecutableProcess("process2").startEvent().userTask("u2").endEvent().done(); testHelper.deploy(instance1, instance2); ProcessInstance processInstance1 = runtimeService.startProcessInstanceByKey("process1"); ProcessInstance processInstance2 = runtimeService.startProcessInstanceByKey("process2"); MigrationPlan migrationPlan = runtimeService.createMigrationPlan(processInstance1.ProcessDefinitionId, processInstance2.ProcessDefinitionId).mapActivities("u1", "u2").build(); runtimeService.createIncident("custom", processInstance1.Id, null); // when runtimeService.newMigration(migrationPlan).processInstanceIds(processInstance1.Id).execute(); // then Incident incident = runtimeService.createIncidentQuery().singleResult(); assertEquals(processInstance2.ProcessDefinitionId, incident.ProcessDefinitionId); assertEquals("custom", incident.IncidentType); assertEquals(processInstance1.Id, incident.ExecutionId); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testNonInterruptingSetVariableInOutMappingOfCallActivity() public virtual void testNonInterruptingSetVariableInOutMappingOfCallActivity() { engine.manageDeployment(repositoryService.createDeployment().addModelInstance(CONDITIONAL_MODEL, DELEGATED_PROCESS).deploy()); BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(CONDITIONAL_EVENT_PROCESS_KEY).startEvent().userTask(TASK_BEFORE_CONDITION_ID).name(TASK_BEFORE_CONDITION).subProcess(SUB_PROCESS_ID).embeddedSubProcess().startEvent().callActivity(TASK_WITH_CONDITION_ID).calledElement(DELEGATED_PROCESS_KEY).camundaOut(VARIABLE_NAME, VARIABLE_NAME).userTask().name(TASK_AFTER_OUTPUT_MAPPING).endEvent().subProcessDone().endEvent().done(); modelInstance = addEventSubProcess(modelInstance, SUB_PROCESS_ID, TASK_AFTER_COND_START_EVENT_IN_SUB_PROCESS, false); modelInstance = addBoundaryEvent(modelInstance, TASK_WITH_CONDITION_ID, TASK_AFTER_COND_BOUN_EVENT_IN_SUB_PROCESS, false); deployMixedProcess(modelInstance, CONDITIONAL_EVENT_PROCESS_KEY, SUB_PROCESS_ID, false); // given ProcessInstance procInst = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY); TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(procInst.Id); Task task = taskQuery.singleResult(); assertNotNull(task); assertEquals(TASK_BEFORE_CONDITION, task.Name); //when task before service task is completed taskService.complete(task.Id); //then out mapping of call activity sets a variable //-> all non interrupting conditional events are triggered tasksAfterVariableIsSet = taskQuery.list(); assertEquals(5, tasksAfterVariableIsSet.Count); //three subscriptions: event sub process in sub process and on process instance level and boundary event of sub process assertEquals(3, conditionEventSubscriptionQuery.count()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testSuspensionWithTenancy() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void testSuspensionWithTenancy() { BpmnModelInstance instance = Bpmn.createExecutableProcess(PROCESS_ID).startEvent().userTask().endEvent().done(); ProcessDefinition processDefinition = processEngineTestRule.deployAndGetDefinition(instance); ProcessDefinition processDefinition1 = processEngineTestRule.deployForTenantAndGetDefinition(TENANT_ONE, instance); ProcessDefinition processDefinition2 = processEngineTestRule.deployForTenantAndGetDefinition(TENANT_TWO, instance); ProcessInstance processInstance = processEngineRule.RuntimeService.startProcessInstanceById(processDefinition.Id); ProcessInstance processInstance1 = processEngineRule.RuntimeService.startProcessInstanceById(processDefinition1.Id); ProcessInstance processInstance2 = processEngineRule.RuntimeService.startProcessInstanceById(processDefinition2.Id); //suspend Tenant one processEngineRule.RuntimeService.updateProcessInstanceSuspensionState().byProcessDefinitionKey(processDefinition1.Key).processDefinitionTenantId(processDefinition1.TenantId).suspend(); string[] processInstances = new string[] { processInstance1.Id, processInstance2.Id, processInstance.Id }; verifyStates(processInstances, new string[] { org.camunda.bpm.engine.history.HistoricProcessInstance_Fields.STATE_SUSPENDED, org.camunda.bpm.engine.history.HistoricProcessInstance_Fields.STATE_ACTIVE, org.camunda.bpm.engine.history.HistoricProcessInstance_Fields.STATE_ACTIVE }); //suspend without tenant processEngineRule.RuntimeService.updateProcessInstanceSuspensionState().byProcessDefinitionKey(processDefinition.Key).processDefinitionWithoutTenantId().suspend(); verifyStates(processInstances, new string[] { org.camunda.bpm.engine.history.HistoricProcessInstance_Fields.STATE_SUSPENDED, org.camunda.bpm.engine.history.HistoricProcessInstance_Fields.STATE_ACTIVE, org.camunda.bpm.engine.history.HistoricProcessInstance_Fields.STATE_SUSPENDED }); //reactivate without tenant processEngineRule.RuntimeService.updateProcessInstanceSuspensionState().byProcessDefinitionKey(processDefinition.Key).processDefinitionWithoutTenantId().activate(); verifyStates(processInstances, new string[] { org.camunda.bpm.engine.history.HistoricProcessInstance_Fields.STATE_SUSPENDED, org.camunda.bpm.engine.history.HistoricProcessInstance_Fields.STATE_ACTIVE, org.camunda.bpm.engine.history.HistoricProcessInstance_Fields.STATE_ACTIVE }); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testExclusiveJobs() public virtual void testExclusiveJobs() { testRule.deploy(Bpmn.createExecutableProcess("testProcess").startEvent().serviceTask("task1").camundaExpression("${true}").camundaAsyncBefore().serviceTask("task2").camundaExpression("${true}").camundaAsyncBefore().endEvent().done()); JobDefinition jobDefinition = managementService.createJobDefinitionQuery().activityIdIn("task2").singleResult(); // given that the second task is suspended managementService.suspendJobDefinitionById(jobDefinition.Id); // if I start a process instance runtimeService.startProcessInstanceByKey("testProcess"); testRule.waitForJobExecutorToProcessAllJobs(10000); // then the second task is not executed assertEquals(1, runtimeService.createProcessInstanceQuery().count()); // there is a suspended job instance Job job = managementService.createJobQuery().singleResult(); assertEquals(job.JobDefinitionId, jobDefinition.Id); assertTrue(job.Suspended); // if I unsuspend the job definition, the job is executed: managementService.activateJobDefinitionById(jobDefinition.Id, true); testRule.waitForJobExecutorToProcessAllJobs(10000); assertEquals(0, runtimeService.createProcessInstanceQuery().count()); }
public virtual void evaluateDecisionWithLiteralExpression() { testRule.deploy(Bpmn.createExecutableProcess("process").startEvent().businessRuleTask().camundaDecisionRef("decisionLiteralExpression").camundaResultVariable("result").camundaMapDecisionResult("singleEntry").endEvent().camundaAsyncBefore().done()); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process", Variables.createVariables().putValue("a", 2).putValue("b", 3)); assertEquals(5, getDecisionResult(processInstance)); }
public virtual void evaluateDecisionWithRequiredDecisions() { testRule.deploy(Bpmn.createExecutableProcess("process").startEvent().businessRuleTask().camundaDecisionRef("dish-decision").camundaResultVariable("result").camundaMapDecisionResult("singleEntry").endEvent().camundaAsyncBefore().done()); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process", Variables.createVariables().putValue("temperature", 32).putValue("dayType", "Weekend")); assertEquals("Light salad", getDecisionResult(processInstance)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void decisionRefVersionTagBindingWithoutVersionTag() public virtual void decisionRefVersionTagBindingWithoutVersionTag() { // expected thrown.expect(typeof(ProcessEngineException)); thrown.expectMessage("Could not parse BPMN process."); // when testRule.deploy(Bpmn.createExecutableProcess("process").startEvent().businessRuleTask().camundaDecisionRef("testDecision").camundaDecisionRefBinding("versionTag").camundaMapDecisionResult("singleEntry").camundaResultVariable("result").endEvent().camundaAsyncBefore().done()); }
public virtual void testTaskInsideEmbeddedSubprocess() { //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: deployment(Bpmn.createExecutableProcess("testProcess").startEvent().subProcess().embeddedSubProcess().startEvent().serviceTask().camundaClass(typeof(AssertingJavaDelegate).FullName).endEvent().subProcessDone().endEvent().done()); AssertingJavaDelegate.addAsserts(new DelegateExecutionAsserterAnonymousInnerClass3(this)); runtimeService.startProcessInstanceByKey("testProcess"); }
public virtual void testConcurrentServiceTasks() { //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: deployment(Bpmn.createExecutableProcess("testProcess").startEvent().parallelGateway("fork").serviceTask().camundaClass(typeof(AssertingJavaDelegate).FullName).parallelGateway("join").endEvent().moveToNode("fork").serviceTask().camundaClass(typeof(AssertingJavaDelegate).FullName).connectTo("join").done()); AssertingJavaDelegate.addAsserts(new DelegateExecutionAsserterAnonymousInnerClass2(this)); runtimeService.startProcessInstanceByKey("testProcess"); }
public virtual void testConcurrentExecution() { //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: deploymentForTenant("tenant1", Bpmn.createExecutableProcess(PROCESS_DEFINITION_KEY).startEvent().parallelGateway("fork").serviceTask().camundaClass(typeof(AssertingJavaDelegate).FullName).parallelGateway("join").endEvent().moveToNode("fork").serviceTask().camundaClass(typeof(AssertingJavaDelegate).FullName).connectTo("join").done()); AssertingJavaDelegate.addAsserts(hasTenantId("tenant1")); startProcessInstance(PROCESS_DEFINITION_KEY); }
public virtual void testEmbeddedSubprocess() { //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: deploymentForTenant("tenant1", Bpmn.createExecutableProcess(PROCESS_DEFINITION_KEY).startEvent().subProcess().embeddedSubProcess().startEvent().serviceTask().camundaClass(typeof(AssertingJavaDelegate).FullName).endEvent().subProcessDone().endEvent().done()); AssertingJavaDelegate.addAsserts(hasTenantId("tenant1")); startProcessInstance(PROCESS_DEFINITION_KEY); }
public virtual void testWithDelegateVariableMapping() { BpmnModelInstance instance = Bpmn.createExecutableProcess("process1").startEvent().subProcess("SubProcess_1").embeddedSubProcess().startEvent().callActivity().calledElement("Process_StuffDoer").camundaVariableMappingClass("org.camunda.bpm.engine.test.api.variables.scope.SetVariableMappingDelegate").serviceTask().camundaClass("org.camunda.bpm.engine.test.api.variables.scope.AssertVariableScopeDelegate").endEvent().subProcessDone().endEvent().done(); instance = modify(instance).activityBuilder("SubProcess_1").multiInstance().parallel().camundaCollection("orderIds").camundaElementVariable("orderId").done(); ProcessDefinition processDefinition = testHelper.deployAndGetDefinition(instance); VariableMap variables = Variables.createVariables().putValue("orderIds", Arrays.asList(new int[] { 1, 2, 3 })); engineRule.RuntimeService.startProcessInstanceById(processDefinition.Id, variables); }
public virtual void testEvaluateDecisionTenantIdExpression() { BpmnModelInstance process = Bpmn.createExecutableProcess("process").startEvent().businessRuleTask().camundaDecisionRef("decision").camundaDecisionRefBinding("latest").camundaDecisionRefTenantId("${'" + TENANT_ONE + "'}").camundaMapDecisionResult("singleEntry").camundaResultVariable("decisionVar").camundaAsyncAfter().endEvent().done(); deploymentForTenant(TENANT_ONE, DMN_FILE); deploymentForTenant(TENANT_TWO, DMN_FILE_VERSION_TWO); deployment(process); ProcessInstance processInstanceOne = runtimeService.createProcessInstanceByKey("process").setVariable("status", "gold").execute(); assertThat((string)runtimeService.getVariable(processInstanceOne.Id, "decisionVar"), @is(RESULT_OF_VERSION_ONE)); }
public virtual void testEvaluateDecisionWithVersionTagBinding() { // given deploymentForTenant(TENANT_ONE, DMN_FILE_VERSION_TAG); deployment(Bpmn.createExecutableProcess("process").startEvent().businessRuleTask().camundaDecisionRef("decision").camundaDecisionRefTenantId(TENANT_ONE).camundaDecisionRefBinding("versionTag").camundaDecisionRefVersionTag("0.0.2").camundaMapDecisionResult("singleEntry").camundaResultVariable("decisionVar").endEvent().camundaAsyncBefore().done()); // when ProcessInstance processInstance = runtimeService.createProcessInstanceByKey("process").setVariable("status", "gold").execute(); // then assertThat((string)runtimeService.getVariable(processInstance.Id, "decisionVar"), @is(RESULT_OF_VERSION_TAG_ONE)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void propagateTenantIdToProcessInstance() public virtual void propagateTenantIdToProcessInstance() { testRule.deploy(Bpmn.createExecutableProcess(PROCESS_DEFINITION_KEY).startEvent().userTask().endEvent().done()); engineRule.RuntimeService.startProcessInstanceByKey(PROCESS_DEFINITION_KEY); ProcessInstance processInstance = engineRule.RuntimeService.createProcessInstanceQuery().singleResult(); assertThat(processInstance, @is(notNullValue())); // get the tenant id from the provider assertThat(processInstance.TenantId, @is(TENANT_ID)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldDeleteDeployment() public virtual void shouldDeleteDeployment() { BpmnModelInstance instance = Bpmn.createExecutableProcess("process").startEvent().endEvent().done(); DeploymentWithDefinitions deployment = engineRule.RepositoryService.createDeployment().addModelInstance("foo.bpmn", instance).deployWithResult(); engineRule.RepositoryService.deleteDeployment(deployment.Id, true); long count = engineRule.RepositoryService.createDeploymentQuery().count(); assertEquals(0, count); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void decisionRefVersionTagBindingExpression() public virtual void decisionRefVersionTagBindingExpression() { // given testRule.deploy(DECISION_VERSION_TAG_OKAY_DMN); testRule.deploy(Bpmn.createExecutableProcess("process").startEvent().businessRuleTask().camundaDecisionRef("decision").camundaDecisionRefBinding("versionTag").camundaDecisionRefVersionTag("${versionTagExpr}").camundaMapDecisionResult("singleEntry").camundaResultVariable("result").endEvent().camundaAsyncBefore().done()); // when VariableMap variables = Variables.createVariables().putValue("versionTagExpr", "0.0.2").putValue("status", "gold"); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process", variables); // then assertEquals("A", getDecisionResult(processInstance)); }
public virtual void testCalledElementTenantIdExpression() { BpmnModelInstance callingProcess = Bpmn.createExecutableProcess("callingProcess").startEvent().callActivity().calledElement("subProcess").camundaCalledElementTenantId("${'" + TENANT_ONE + "'}").endEvent().done(); deploymentForTenant(TENANT_ONE, SUB_PROCESS); deployment(callingProcess); runtimeService.startProcessInstanceByKey("callingProcess"); ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery().processDefinitionKey("subProcess"); assertThat(query.tenantIdIn(TENANT_ONE).count(), @is(1L)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void propagateTenantIdToIntermediateTimerJob() public virtual void propagateTenantIdToIntermediateTimerJob() { testRule.deploy(Bpmn.createExecutableProcess("process").startEvent().intermediateCatchEvent().timerWithDuration("PT1M").endEvent().done()); engineRule.RuntimeService.startProcessInstanceByKey("process"); // the job is created when the timer event is reached Job job = engineRule.ManagementService.createJobQuery().singleResult(); assertThat(job, @is(notNullValue())); // inherit the tenant id from execution assertThat(job.TenantId, @is(TENANT_ID)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void propagateTenantIdToAsyncJob() public virtual void propagateTenantIdToAsyncJob() { testRule.deploy(Bpmn.createExecutableProcess("process").startEvent().userTask().camundaAsyncBefore().endEvent().done()); engineRule.RuntimeService.startProcessInstanceByKey("process"); // the job is created when the asynchronous activity is reached Job job = engineRule.ManagementService.createJobQuery().singleResult(); assertThat(job, @is(notNullValue())); // inherit the tenant id from execution assertThat(job.TenantId, @is(TENANT_ID)); }
public virtual void testCaseRefTenantIdExpression() { BpmnModelInstance callingProcess = Bpmn.createExecutableProcess("callingProcess").startEvent().callActivity().camundaCaseRef("Case_1").camundaCaseTenantId("${'" + TENANT_ONE + "'}").endEvent().done(); deploymentForTenant(TENANT_ONE, CMMN); deployment(callingProcess); runtimeService.startProcessInstanceByKey("callingProcess"); CaseInstanceQuery query = caseService.createCaseInstanceQuery().caseDefinitionKey("Case_1"); assertThat(query.tenantIdIn(TENANT_ONE).count(), @is(1L)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldOpenNewCommandContextWhenInteractingAccrossEngines() public virtual void shouldOpenNewCommandContextWhenInteractingAccrossEngines() { //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: BpmnModelInstance process1 = Bpmn.createExecutableProcess("process1").startEvent().serviceTask().camundaInputParameter("engineName", "engine2").camundaInputParameter("processKey", "process2").camundaClass(typeof(StartProcessInstanceOnEngineDelegate).FullName).endEvent().done(); BpmnModelInstance process2 = Bpmn.createExecutableProcess("process2").startEvent().endEvent().done(); // given engine1.RepositoryService.createDeployment().addModelInstance("process1.bpmn", process1).deploy(); engine2.RepositoryService.createDeployment().addModelInstance("process2.bpmn", process2).deploy(); // if engine1.RuntimeService.startProcessInstanceByKey("process1"); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testSetLocalScopeWithExecutionListenerTake() public virtual void testSetLocalScopeWithExecutionListenerTake() { BpmnModelInstance modelInstance = Bpmn.createExecutableProcess("process").startEvent().id("activityId").sequenceFlowId("sequenceFlow").endEvent().done(); CamundaExecutionListener listener = modelInstance.newInstance(typeof(CamundaExecutionListener)); listener.CamundaEvent = ExecutionListener.EVENTNAME_TAKE; //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: listener.CamundaClass = typeof(ExecutionListener).FullName; modelInstance.getModelElementById <SequenceFlow>("sequenceFlow").builder().addExtensionElement(listener); testHelper.deploy(modelInstance); engineRule.RuntimeService.startProcessInstanceByKey("process"); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testThrownInJavaDelegate() public virtual void testThrownInJavaDelegate() { // expect thrown.expect(typeof(ProcessEngineException)); thrown.expectMessage(containsString("no error handler")); // given BpmnModelInstance instance = Bpmn.createExecutableProcess("process").startEvent().serviceTask().camundaClass(typeof(ThrowBpmnErrorDelegate)).endEvent().done(); testRule.deploy(instance); // when runtimeService.startProcessInstanceByKey("process"); }
public virtual void testWithDelegateVariableMappingAndChildScope() { BpmnModelInstance instance = Bpmn.createExecutableProcess("process1").startEvent().parallelGateway().subProcess("SubProcess_1").embeddedSubProcess().startEvent().callActivity().calledElement("Process_StuffDoer").camundaVariableMappingClass("org.camunda.bpm.engine.test.api.variables.scope.SetVariableToChildMappingDelegate").serviceTask().camundaClass("org.camunda.bpm.engine.test.api.variables.scope.AssertVariableScopeDelegate").endEvent().subProcessDone().moveToLastGateway().subProcess("SubProcess_2").embeddedSubProcess().startEvent().userTask("ut").endEvent().subProcessDone().endEvent().done(); instance = modify(instance).activityBuilder("SubProcess_1").multiInstance().parallel().camundaCollection("orderIds").camundaElementVariable("orderId").done(); ProcessDefinition processDefinition = testHelper.deployAndGetDefinition(instance); thrown.expect(typeof(ProcessEngineException)); thrown.expectMessage(startsWith("org.camunda.bpm.engine.ProcessEngineException: ENGINE-20011 Scope with specified activity Id SubProcess_2 and execution")); VariableMap variables = Variables.createVariables().putValue("orderIds", Arrays.asList(new int[] { 1, 2, 3 })); engineRule.RuntimeService.startProcessInstanceById(processDefinition.Id, variables); }
public virtual void testTxListenersInvokeAsync() { BpmnModelInstance process = Bpmn.createExecutableProcess("testProcess").startEvent().camundaAsyncBefore().camundaAsyncAfter().endEvent().done(); Deployment deployment = repositoryService.createDeployment().addModelInstance("testProcess.bpmn", process).deploy(); ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess"); waitForJobExecutorToProcessAllJobs(6000); assertProcessEnded(pi.Id); repositoryService.deleteDeployment(deployment.Id, true); }
public virtual void testStartCaseInstanceWithVersionBinding() { BpmnModelInstance callingProcess = Bpmn.createExecutableProcess("callingProcess").startEvent().callActivity().camundaCaseRef("Case_1").camundaCaseBinding("version").camundaCaseVersion("1").endEvent().done(); deploymentForTenant(TENANT_ONE, CMMN, callingProcess); deploymentForTenant(TENANT_TWO, CMMN, callingProcess); runtimeService.createProcessInstanceByKey("callingProcess").processDefinitionTenantId(TENANT_ONE).execute(); runtimeService.createProcessInstanceByKey("callingProcess").processDefinitionTenantId(TENANT_TWO).execute(); CaseInstanceQuery query = caseService.createCaseInstanceQuery().caseDefinitionKey("Case_1"); assertThat(query.tenantIdIn(TENANT_ONE).count(), @is(1L)); assertThat(query.tenantIdIn(TENANT_TWO).count(), @is(1L)); }
public virtual void testStartProcessInstanceWithVersionBinding() { BpmnModelInstance callingProcess = Bpmn.createExecutableProcess("callingProcess").startEvent().callActivity().calledElement("subProcess").camundaCalledElementBinding("version").camundaCalledElementVersion("1").endEvent().done(); deploymentForTenant(TENANT_ONE, callingProcess, SUB_PROCESS); deploymentForTenant(TENANT_TWO, callingProcess, SUB_PROCESS); runtimeService.createProcessInstanceByKey("callingProcess").processDefinitionTenantId(TENANT_ONE).execute(); runtimeService.createProcessInstanceByKey("callingProcess").processDefinitionTenantId(TENANT_TWO).execute(); ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery().processDefinitionKey("subProcess"); assertThat(query.tenantIdIn(TENANT_ONE).count(), @is(1L)); assertThat(query.tenantIdIn(TENANT_TWO).count(), @is(1L)); }