public virtual void testJavaDelegateModelExecutionContext() { deploy(); runtimeService.startProcessInstanceByKey(PROCESS_ID); BpmnModelInstance modelInstance = ModelExecutionContextServiceTask.modelInstance; assertNotNull(modelInstance); Model model = modelInstance.Model; ICollection <ModelElementInstance> events = modelInstance.getModelElementsByType(model.getType(typeof(Event))); assertEquals(2, events.Count); ICollection <ModelElementInstance> tasks = modelInstance.getModelElementsByType(model.getType(typeof(Task))); assertEquals(1, tasks.Count); Process process = (Process)modelInstance.Definitions.RootElements.GetEnumerator().next(); assertEquals(PROCESS_ID, process.Id); assertTrue(process.Executable); ServiceTask serviceTask = ModelExecutionContextServiceTask.serviceTask; assertNotNull(serviceTask); //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: assertEquals(typeof(ModelExecutionContextServiceTask).FullName, serviceTask.CamundaClass); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testBpmnDiagram() public virtual void testBpmnDiagram() { ICollection <BpmnDiagram> diagrams = modelInstance.getModelElementsByType(typeof(BpmnDiagram)); assertThat(diagrams).hasSize(1); BpmnDiagram diagram = diagrams.GetEnumerator().next(); assertThat(diagram.BpmnPlane).NotNull; assertThat(diagram.BpmnPlane.BpmnElement).isEqualTo(collaboration); assertThat(diagram.BpmnLabelStyles).hasSize(1); }
private void assertModelInstance() { BpmnModelInstance modelInstance = ModelExecutionContextTaskListener.modelInstance; assertNotNull(modelInstance); ICollection <ModelElementInstance> events = modelInstance.getModelElementsByType(modelInstance.Model.getType(typeof(Event))); assertEquals(2, events.Count); ICollection <ModelElementInstance> tasks = modelInstance.getModelElementsByType(modelInstance.Model.getType(typeof(Task))); assertEquals(1, tasks.Count); Process process = (Process)modelInstance.Definitions.RootElements.GetEnumerator().next(); assertEquals(PROCESS_ID, process.Id); assertTrue(process.Executable); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotGenerateIdsOnRead() public virtual void shouldNotGenerateIdsOnRead() { BpmnModelInstance modelInstance = Bpmn.readModelFromStream(typeof(GenerateIdTest).getResourceAsStream("GenerateIdTest.bpmn")); Definitions definitions = modelInstance.Definitions; assertThat(definitions.Id).Null; Process process = modelInstance.getModelElementsByType(typeof(Process)).GetEnumerator().next(); assertThat(process.Id).Null; StartEvent startEvent = modelInstance.getModelElementsByType(typeof(StartEvent)).GetEnumerator().next(); assertThat(startEvent.Id).Null; UserTask userTask = modelInstance.getModelElementsByType(typeof(UserTask)).GetEnumerator().next(); assertThat(userTask.Id).Null; }
public virtual void testRepositoryService() { string processDefinitionId = repositoryService.createProcessDefinitionQuery().processDefinitionKey(PROCESS_KEY).singleResult().Id; BpmnModelInstance modelInstance = repositoryService.getBpmnModelInstance(processDefinitionId); assertNotNull(modelInstance); ICollection <ModelElementInstance> events = modelInstance.getModelElementsByType(modelInstance.Model.getType(typeof(Event))); assertEquals(2, events.Count); ICollection <ModelElementInstance> sequenceFlows = modelInstance.getModelElementsByType(modelInstance.Model.getType(typeof(SequenceFlow))); assertEquals(1, sequenceFlows.Count); StartEvent startEvent = modelInstance.getModelElementById("start"); assertNotNull(startEvent); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldGenerateEdgeForSequenceFlow() public virtual void shouldGenerateEdgeForSequenceFlow() { ProcessBuilder builder = Bpmn.createExecutableProcess(); instance = builder.startEvent(START_EVENT_ID).sequenceFlowId(SEQUENCE_FLOW_ID).endEvent(END_EVENT_ID).done(); ICollection <BpmnEdge> allEdges = instance.getModelElementsByType(typeof(BpmnEdge)); assertEquals(1, allEdges.Count); assertBpmnEdgeExists(SEQUENCE_FLOW_ID); }
private void assertFlowElementIs(Type elementClass) { BpmnModelInstance modelInstance = ModelExecutionContextExecutionListener.modelInstance; assertNotNull(modelInstance); Model model = modelInstance.Model; ICollection <ModelElementInstance> events = modelInstance.getModelElementsByType(model.getType(typeof(Event))); assertEquals(3, events.Count); ICollection <ModelElementInstance> gateways = modelInstance.getModelElementsByType(model.getType(typeof(Gateway))); assertEquals(1, gateways.Count); ICollection <ModelElementInstance> tasks = modelInstance.getModelElementsByType(model.getType(typeof(Task))); assertEquals(1, tasks.Count); FlowElement flowElement = ModelExecutionContextExecutionListener.flowElement; assertNotNull(flowElement); assertTrue(elementClass.IsAssignableFrom(flowElement.GetType())); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldGenerateEdgesForSequenceFlowsUsingGateway() public virtual void shouldGenerateEdgesForSequenceFlowsUsingGateway() { ProcessBuilder builder = Bpmn.createExecutableProcess(); instance = builder.startEvent(START_EVENT_ID).sequenceFlowId("s1").parallelGateway("gateway").sequenceFlowId("s2").endEvent("e1").moveToLastGateway().sequenceFlowId("s3").endEvent("e2").done(); ICollection <BpmnEdge> allEdges = instance.getModelElementsByType(typeof(BpmnEdge)); assertEquals(3, allEdges.Count); assertBpmnEdgeExists("s1"); assertBpmnEdgeExists("s2"); assertBpmnEdgeExists("s3"); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldGenerateEdgesWhenUsingMoveToActivity() public virtual void shouldGenerateEdgesWhenUsingMoveToActivity() { ProcessBuilder builder = Bpmn.createExecutableProcess(); instance = builder.startEvent(START_EVENT_ID).sequenceFlowId("s1").exclusiveGateway().sequenceFlowId("s2").userTask(USER_TASK_ID).sequenceFlowId("s3").endEvent("e1").moveToActivity(USER_TASK_ID).sequenceFlowId("s4").endEvent("e2").done(); ICollection <BpmnEdge> allEdges = instance.getModelElementsByType(typeof(BpmnEdge)); assertEquals(4, allEdges.Count); assertBpmnEdgeExists("s1"); assertBpmnEdgeExists("s2"); assertBpmnEdgeExists("s3"); assertBpmnEdgeExists("s4"); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldGenerateShapeForBoundaryIntermediateEvent() public virtual void shouldGenerateShapeForBoundaryIntermediateEvent() { // given ProcessBuilder processBuilder = Bpmn.createExecutableProcess(); // when instance = processBuilder.startEvent(START_EVENT_ID).userTask(USER_TASK_ID).endEvent(END_EVENT_ID).moveToActivity(USER_TASK_ID).boundaryEvent(BOUNDARY_ID).conditionalEventDefinition(CONDITION_ID).condition(TEST_CONDITION).conditionalEventDefinitionDone().endEvent().done(); // then ICollection <BpmnShape> allShapes = instance.getModelElementsByType(typeof(BpmnShape)); assertEquals(5, allShapes.Count); assertEventShapeProperties(BOUNDARY_ID); }
protected internal virtual BpmnEdge findBpmnEdge(string sequenceFlowId) { ICollection <BpmnEdge> allEdges = instance.getModelElementsByType(typeof(BpmnEdge)); IEnumerator <BpmnEdge> iterator = allEdges.GetEnumerator(); while (iterator.MoveNext()) { BpmnEdge edge = iterator.Current; if (edge.BpmnElement.Id.Equals(sequenceFlowId)) { return(edge); } } return(null); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldGenerateShapeForStartEvent() public virtual void shouldGenerateShapeForStartEvent() { // given ProcessBuilder processBuilder = Bpmn.createExecutableProcess(); // when instance = processBuilder.startEvent(START_EVENT_ID).endEvent(END_EVENT_ID).done(); // then ICollection <BpmnShape> allShapes = instance.getModelElementsByType(typeof(BpmnShape)); assertEquals(2, allShapes.Count); assertEventShapeProperties(START_EVENT_ID); }
protected internal virtual BpmnShape findBpmnShape(string id) { ICollection <BpmnShape> allShapes = instance.getModelElementsByType(typeof(BpmnShape)); IEnumerator <BpmnShape> iterator = allShapes.GetEnumerator(); while (iterator.MoveNext()) { BpmnShape shape = iterator.Current; if (shape.BpmnElement.Id.Equals(id)) { return(shape); } } return(null); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldGeneratePlaneForProcess() public virtual void shouldGeneratePlaneForProcess() { // when instance = Bpmn.createExecutableProcess("process").done(); // then ICollection <BpmnDiagram> bpmnDiagrams = instance.getModelElementsByType(typeof(BpmnDiagram)); assertEquals(1, bpmnDiagrams.Count); BpmnDiagram diagram = bpmnDiagrams.GetEnumerator().next(); assertNotNull(diagram.Id); assertNotNull(diagram.BpmnPlane); assertEquals(diagram.BpmnPlane.BpmnElement, instance.getModelElementById("process")); }
private void assertUserTask(string eventName) { UserTask userTask = ModelExecutionContextTaskListener.userTask; assertNotNull(userTask); ModelElementInstance taskListener = userTask.ExtensionElements.getUniqueChildElementByNameNs(CAMUNDA_NS, "taskListener"); assertEquals(eventName, taskListener.getAttributeValueNs(CAMUNDA_NS, "event")); //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: assertEquals(typeof(ModelExecutionContextTaskListener).FullName, taskListener.getAttributeValueNs(CAMUNDA_NS, "class")); BpmnModelInstance modelInstance = ModelExecutionContextTaskListener.modelInstance; ICollection <ModelElementInstance> tasks = modelInstance.getModelElementsByType(modelInstance.Model.getType(typeof(Task))); assertTrue(tasks.Contains(userTask)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldGenerateShapeForExclusiveGateway() public virtual void shouldGenerateShapeForExclusiveGateway() { // given ProcessBuilder processBuilder = Bpmn.createExecutableProcess(); // when instance = processBuilder.startEvent(START_EVENT_ID).exclusiveGateway("or").endEvent(END_EVENT_ID).done(); // then ICollection <BpmnShape> allShapes = instance.getModelElementsByType(typeof(BpmnShape)); assertEquals(3, allShapes.Count); assertGatewayShapeProperties("or"); BpmnShape bpmnShape = findBpmnShape("or"); assertTrue(bpmnShape.MarkerVisible); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldGenerateShapeForBlankSubProcess() public virtual void shouldGenerateShapeForBlankSubProcess() { // given ProcessBuilder processBuilder = Bpmn.createExecutableProcess(); // when instance = processBuilder.startEvent(START_EVENT_ID).subProcess(SUB_PROCESS_ID).endEvent(END_EVENT_ID).done(); // then ICollection <BpmnShape> allShapes = instance.getModelElementsByType(typeof(BpmnShape)); assertEquals(3, allShapes.Count); BpmnShape bpmnShapeSubProcess = findBpmnShape(SUB_PROCESS_ID); assertNotNull(bpmnShapeSubProcess); assertSubProcessSize(bpmnShapeSubProcess); assertTrue(bpmnShapeSubProcess.Expanded); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldGenerateShapeForEventSubProcess() public virtual void shouldGenerateShapeForEventSubProcess() { // given ProcessBuilder processBuilder = Bpmn.createExecutableProcess(); // when instance = processBuilder.startEvent(START_EVENT_ID).endEvent(END_EVENT_ID).subProcess(SUB_PROCESS_ID).triggerByEvent().embeddedSubProcess().startEvent("innerStartEvent").endEvent("innerEndEvent").subProcessDone().done(); // then ICollection <BpmnShape> allShapes = instance.getModelElementsByType(typeof(BpmnShape)); assertEquals(5, allShapes.Count); assertEventShapeProperties("innerStartEvent"); assertEventShapeProperties("innerEndEvent"); BpmnShape bpmnShapeEventSubProcess = findBpmnShape(SUB_PROCESS_ID); assertNotNull(bpmnShapeEventSubProcess); assertTrue(bpmnShapeEventSubProcess.Expanded); }
private static IList <string> extractProcessDefinitionKeys(IList <string> deployableFileNames) { List <string> keys = new List <string>(); foreach (string file in deployableFileNames) { if (file.EndsWith(".bpmn", StringComparison.Ordinal) || file.EndsWith(".bpmn20.xml", StringComparison.Ordinal)) { BpmnModelInstance modelInstance = Bpmn.readModelFromFile(new File(file)); ICollection <Process> processes = modelInstance.getModelElementsByType(typeof(Process)); foreach (Process process in processes) { if (process.Executable) { keys.Add(process.Id); } } } } return(keys); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldGenerateShapeForTransaction() public virtual void shouldGenerateShapeForTransaction() { // given ProcessBuilder processBuilder = Bpmn.createExecutableProcess(); // when instance = processBuilder.startEvent(START_EVENT_ID).transaction(TRANSACTION_ID).embeddedSubProcess().startEvent("innerStartEvent").userTask("innerUserTask").endEvent("innerEndEvent").transactionDone().endEvent(END_EVENT_ID).done(); // then ICollection <BpmnShape> allShapes = instance.getModelElementsByType(typeof(BpmnShape)); assertEquals(6, allShapes.Count); assertEventShapeProperties("innerStartEvent"); assertTaskShapeProperties("innerUserTask"); assertEventShapeProperties("innerEndEvent"); BpmnShape bpmnShapeSubProcess = findBpmnShape(TRANSACTION_ID); assertNotNull(bpmnShapeSubProcess); assertTrue(bpmnShapeSubProcess.Expanded); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testGetTextAnnotationsByType() public virtual void testGetTextAnnotationsByType() { ICollection <TextAnnotation> textAnnotations = modelInstance.getModelElementsByType(typeof(TextAnnotation)); assertThat(textAnnotations).NotNull.hasSize(2); }
public virtual ICollection <ModelElementInstance> getModelElementsByType(ModelElementType referencingType) { return(modelInstance.getModelElementsByType(referencingType)); }