//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testCannotMigrateAsyncActivityInstance() public virtual void testCannotMigrateAsyncActivityInstance() { // given //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: BpmnModelInstance model = ProcessModels.newModel().startEvent().serviceTask("serviceTask").camundaAsyncBefore().camundaClass(typeof(SignallableServiceTaskDelegate).FullName).endEvent().done(); ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(model); ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(model); MigrationPlan migrationPlan = rule.RuntimeService.createMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id).mapActivities("serviceTask", "serviceTask").build(); string processInstanceId = rule.RuntimeService.startProcessInstanceById(sourceProcessDefinition.Id).Id; testHelper.executeAvailableJobs(); // when try { rule.RuntimeService.newMigration(migrationPlan).processInstanceIds(processInstanceId).execute(); Assert.fail("should fail"); } catch (MigratingProcessInstanceValidationException e) { // then assertThat(e.ValidationReport).hasActivityInstanceFailures("serviceTask", "The type of the source activity is not supported for activity instance migration"); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testCallBpmnProcessReconfigureCallActivity() public virtual void testCallBpmnProcessReconfigureCallActivity() { // given BpmnModelInstance model = CallActivityModels.oneBpmnCallActivityProcess("oneTaskProcess"); ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(model); ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(modify(model).callActivityBuilder("callActivity").calledElement("foo").done()); MigrationPlan migrationPlan = rule.RuntimeService.createMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id).mapActivities("callActivity", "callActivity").build(); // when ProcessInstance processInstance = testHelper.createProcessInstanceAndMigrate(migrationPlan); // then the called instance has not changed (e.g. not been migrated to a different process definition) ProcessInstance calledInstance = rule.RuntimeService.createProcessInstanceQuery().processDefinitionKey("oneTaskProcess").singleResult(); Assert.assertNotNull(calledInstance); // and it is possible to complete the called process instance testHelper.completeTask("userTask"); // and the calling process instance testHelper.completeTask("userTask"); 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 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 testCallBpmnProcessSimpleMigration() public virtual void testCallBpmnProcessSimpleMigration() { // given BpmnModelInstance model = CallActivityModels.oneBpmnCallActivityProcess("oneTaskProcess"); ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(model); ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(model); MigrationPlan migrationPlan = rule.RuntimeService.createMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id).mapActivities("callActivity", "callActivity").build(); // when ProcessInstance processInstance = testHelper.createProcessInstanceAndMigrate(migrationPlan); // then testHelper.assertExecutionTreeAfterMigration().hasProcessDefinitionId(targetProcessDefinition.Id).matches(describeExecutionTree(null).scope().id(testHelper.snapshotBeforeMigration.ProcessInstanceId).child("callActivity").scope().id(testHelper.getSingleExecutionIdForActivityBeforeMigration("callActivity")).done()); testHelper.assertActivityTreeAfterMigration().hasStructure(describeActivityInstanceTree(targetProcessDefinition.Id).activity("callActivity", testHelper.getSingleActivityInstanceBeforeMigration("callActivity").Id).done()); // and it is possible to complete the called process instance testHelper.completeTask("userTask"); // and the calling process instance testHelper.completeTask("userTask"); 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 testCanOnlyTriggerCompensationInParentOfRemovedScope() public virtual void testCanOnlyTriggerCompensationInParentOfRemovedScope() { BpmnModelInstance sourceModel = ProcessModels.newModel().startEvent().subProcess("outerSubProcess").embeddedSubProcess().startEvent().userTask("userTask1").boundaryEvent("compensationBoundary").compensateEventDefinition().compensateEventDefinitionDone().moveToActivity("userTask1").subProcess("innerSubProcess").embeddedSubProcess().startEvent().userTask("userTask2").endEvent().subProcessDone().endEvent().subProcessDone().done(); CompensationModels.addUserTaskCompensationHandler(sourceModel, "compensationBoundary", "compensationHandler"); ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(sourceModel); ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(modify(CompensationModels.COMPENSATION_TWO_TASKS_SUBPROCESS_MODEL).endEventBuilder("subProcessEnd").compensateEventDefinition().waitForCompletion(true).compensateEventDefinitionDone().done()); MigrationPlan migrationPlan = rule.RuntimeService.createMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id).mapActivities("innerSubProcess", "subProcess").mapActivities("userTask2", "userTask2").mapActivities("compensationBoundary", "compensationBoundary").build(); ProcessInstance processInstance = rule.RuntimeService.startProcessInstanceById(sourceProcessDefinition.Id); testHelper.completeTask("userTask1"); testHelper.migrateProcessInstance(migrationPlan, processInstance); // when testHelper.completeTask("userTask2"); // then compensation is not triggered from inside the inner sub process // but only on process definition level ActivityInstance activityInstance = rule.RuntimeService.getActivityInstance(processInstance.Id); assertThat(activityInstance).hasStructure(describeActivityInstanceTree(targetProcessDefinition.Id).activity("compensationEvent").beginScope("subProcess").activity("compensationHandler").done()); }
//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 }); }
protected internal virtual void deployProcess(string scriptFormat, string scriptText) { BpmnModelInstance process = createProcess(scriptFormat, scriptText); Deployment deployment = repositoryService.createDeployment().addModelInstance("testProcess.bpmn", process).deploy(); deploymentId = deployment.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 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()); }
protected internal virtual void deployMixedProcess(BpmnModelInstance model, string parentId, string activityId, bool isInterrupting) { BpmnModelInstance modelInstance = addEventSubProcess(model, parentId, TASK_AFTER_CONDITIONAL_START_EVENT, isInterrupting); modelInstance = addBoundaryEvent(modelInstance, activityId, TASK_AFTER_CONDITIONAL_BOUNDARY_EVENT, isInterrupting); engine.manageDeployment(repositoryService.createDeployment().addModelInstance(CONDITIONAL_MODEL, modelInstance).deploy()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testCallCmmnCaseParallelMultiInstance() public virtual void testCallCmmnCaseParallelMultiInstance() { // given BpmnModelInstance model = modify(CallActivityModels.oneCmmnCallActivityProcess("oneTaskCase")).activityBuilder("callActivity").multiInstance().parallel().cardinality("1").done(); ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(model); ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(model); MigrationPlan migrationPlan = rule.RuntimeService.createMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id).mapActivities("callActivity#multiInstanceBody", "callActivity#multiInstanceBody").mapActivities("callActivity", "callActivity").build(); // when ProcessInstance processInstance = testHelper.createProcessInstanceAndMigrate(migrationPlan); // then testHelper.assertExecutionTreeAfterMigration().hasProcessDefinitionId(targetProcessDefinition.Id).matches(describeExecutionTree(null).scope().id(testHelper.snapshotBeforeMigration.ProcessInstanceId).child(null).scope().id(testHelper.getSingleExecutionIdForActivityBeforeMigration("callActivity#multiInstanceBody")).child("callActivity").concurrent().noScope().id(testHelper.getSingleExecutionIdForActivityBeforeMigration("callActivity")).done()); testHelper.assertActivityTreeAfterMigration().hasStructure(describeActivityInstanceTree(targetProcessDefinition.Id).beginMiBody("callActivity").activity("callActivity", testHelper.getSingleActivityInstanceBeforeMigration("callActivity").Id).done()); // and the link between calling and called instance is maintained correctly testHelper.assertSuperExecutionOfCaseInstance(rule.CaseService.createCaseInstanceQuery().caseDefinitionKey("oneTaskCase").singleResult().Id, testHelper.getSingleExecutionIdForActivityAfterMigration("callActivity")); // and it is possible to complete the called case instance CaseExecution caseExecution = rule.CaseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult(); testHelper.completeTask("PI_HumanTask_1"); // and the calling process instance testHelper.completeTask("userTask"); testHelper.assertProcessEnded(processInstance.Id); // and close the called case instance rule.CaseService.withCaseExecution(caseExecution.CaseInstanceId).close(); testHelper.assertCaseEnded(caseExecution.CaseInstanceId); }
//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 shouldReturnBpmnModelInstance() public virtual void shouldReturnBpmnModelInstance() { ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey(TEST_PROCESS).singleResult(); BpmnModelInstance bpmnModelInstance = repositoryService.getBpmnModelInstance(processDefinition.Id); Assert.assertNotNull(bpmnModelInstance); }
protected internal static void makeCancelEvent(BpmnModelInstance model, string eventId) { ModelElementInstance element = model.getModelElementById(eventId); CancelEventDefinition eventDefinition = model.newInstance(typeof(CancelEventDefinition)); element.addChildElement(eventDefinition); }
private void deployModelInstance(BpmnModelInstance modelInstance) { DeploymentBuilder deploymentbuilder = repositoryService.createDeployment(); deploymentbuilder.addModelInstance("process0.bpmn", modelInstance); Deployment deployment = deploymentbuilder.deploy(); rule.manageDeployment(deployment); }
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); }
//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); }
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 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)); }
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)); }
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); }
//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"); }
//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"); }
public virtual void testEvaluateDecisionWithVersionTagBinding_ResolveTenantFromDefinition() { // given BpmnModelInstance process = Bpmn.createExecutableProcess("process").startEvent().businessRuleTask().camundaDecisionRef("decision").camundaDecisionRefBinding("versionTag").camundaDecisionRefVersionTag("0.0.2").camundaMapDecisionResult("singleEntry").camundaResultVariable("decisionVar").endEvent().camundaAsyncBefore().done(); deploymentForTenant(TENANT_ONE, DMN_FILE_VERSION_TAG, process); deploymentForTenant(TENANT_TWO, DMN_FILE_VERSION_TAG_TWO, process); ProcessInstance processInstanceOne = runtimeService.createProcessInstanceByKey("process").setVariable("status", "gold").processDefinitionTenantId(TENANT_ONE).execute(); ProcessInstance processInstanceTwo = runtimeService.createProcessInstanceByKey("process").setVariable("status", "gold").processDefinitionTenantId(TENANT_TWO).execute(); assertThat((string)runtimeService.getVariable(processInstanceOne.Id, "decisionVar"), @is(RESULT_OF_VERSION_TAG_ONE)); assertThat((string)runtimeService.getVariable(processInstanceTwo.Id, "decisionVar"), @is(RESULT_OF_VERSION_TAG_TWO)); }
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 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)); }
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)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testNewKeyInStartExecListener() public virtual void testNewKeyInStartExecListener() { // given string listener = [email protected]_Fields.EVENTNAME_START; BpmnModelInstance process = createModelExecutionListener(listener); testRule.deploy(process); // when string newBusinessKeyValue = "newBusinessKey"; runtimeService.startProcessInstanceByKey(PROCESS_KEY, Variables.createVariables().putValue(BUSINESS_KEY_VARIABLE, newBusinessKeyValue)); // then checkBusinessKeyChanged(newBusinessKeyValue); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testUpdateKeyNullValueInStartTaskListener() public virtual void testUpdateKeyNullValueInStartTaskListener() { // given string listener = [email protected]_Fields.EVENTNAME_CREATE; BpmnModelInstance process = createModelTaskListener(listener); testRule.deploy(process); // when string newBusinessKeyValue = null; runtimeService.startProcessInstanceByKey(PROCESS_KEY, "aBusinessKey", Variables.createVariables().putValue(BUSINESS_KEY_VARIABLE, newBusinessKeyValue)); // then checkBusinessKeyChanged(newBusinessKeyValue); }