Beispiel #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testBpmnEdge()
        public virtual void testBpmnEdge()
        {
            BpmnEdge edge = sequenceFlow.DiagramElement;

            assertThat(edge.BpmnElement).isEqualTo(sequenceFlow);
            assertThat(edge.BpmnLabel).Null;
            assertThat(edge.MessageVisibleKind).Null;
            assertThat(edge.SourceElement).isInstanceOf(typeof(BpmnShape));
            assertThat(((BpmnShape)edge.SourceElement).BpmnElement).isEqualTo(startEvent);
            assertThat(edge.TargetElement).isInstanceOf(typeof(BpmnShape));
            assertThat(((BpmnShape)edge.TargetElement).BpmnElement).isEqualTo(endEvent);
        }
Beispiel #2
0
        protected internal virtual void setWaypointsWithSourceAndTarget(BpmnEdge edge, FlowNode edgeSource, FlowNode edgeTarget)
        {
            BpmnShape source = findBpmnShape(edgeSource);
            BpmnShape target = findBpmnShape(edgeTarget);

            if (source != null && target != null)
            {
                Bounds sourceBounds = source.Bounds;
                Bounds targetBounds = target.Bounds;

                double sourceX      = sourceBounds.getX().Value;
                double sourceY      = sourceBounds.getY().Value;
                double sourceWidth  = sourceBounds.getWidth().Value;
                double sourceHeight = sourceBounds.getHeight().Value;

                double targetX      = targetBounds.getX().Value;
                double targetY      = targetBounds.getY().Value;
                double targetHeight = targetBounds.getHeight().Value;

                Waypoint w1 = createInstance(typeof(Waypoint));

                if (edgeSource.Outgoing.Count == 1)
                {
                    w1.X = sourceX + sourceWidth;
                    w1.Y = sourceY + sourceHeight / 2;

                    edge.addChildElement(w1);
                }
                else
                {
                    w1.X = sourceX + sourceWidth / 2;
                    w1.Y = sourceY + sourceHeight;

                    edge.addChildElement(w1);

                    Waypoint w2 = createInstance(typeof(Waypoint));
                    w2.X = sourceX + sourceWidth / 2;
                    w2.Y = targetY + targetHeight / 2;

                    edge.addChildElement(w2);
                }

                Waypoint w3 = createInstance(typeof(Waypoint));
                w3.X = targetX;
                w3.Y = targetY + targetHeight / 2;

                edge.addChildElement(w3);
            }
        }
Beispiel #3
0
        protected internal virtual BpmnEdge findBpmnEdge(BaseElement sequenceFlow)
        {
            ICollection <BpmnEdge> allEdges = modelInstance.getModelElementsByType(typeof(BpmnEdge));
            IEnumerator <BpmnEdge> iterator = allEdges.GetEnumerator();

            while (iterator.MoveNext())
            {
                BpmnEdge edge = iterator.Current;
                if (edge.BpmnElement.Equals(sequenceFlow))
                {
                    return(edge);
                }
            }
            return(null);
        }
Beispiel #4
0
        public virtual BpmnEdge createEdge(BaseElement baseElement)
        {
            BpmnPlane bpmnPlane = findBpmnPlane();

            if (bpmnPlane != null)
            {
                BpmnEdge edge = createInstance(typeof(BpmnEdge));
                edge.BpmnElement = baseElement;
                Waypoints        = edge;

                bpmnPlane.addChildElement(edge);
                return(edge);
            }
            return(null);
        }
Beispiel #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotRemoveBpmElementReference()
        public virtual void shouldNotRemoveBpmElementReference()
        {
            assertThat(startEvent.Outgoing).contains(sequenceFlow);
            assertThat(endEvent.Incoming).contains(sequenceFlow);

            BpmnEdge edge = sequenceFlow.DiagramElement;

            assertThat(edge.BpmnElement).isEqualTo(sequenceFlow);

            startEvent.Outgoing.remove(sequenceFlow);
            endEvent.Incoming.remove(sequenceFlow);

            assertThat(startEvent.Outgoing).doesNotContain(sequenceFlow);
            assertThat(endEvent.Incoming).doesNotContain(sequenceFlow);

            assertThat(edge.BpmnElement).isEqualTo(sequenceFlow);
        }
Beispiel #6
0
        public void BPMNEdge_Populate()
        {
            BpmnEdge edge = new BpmnEdge
            {
                BPMNLabel                   = new BpmnLabel(),
                BpmnElement                 = XmlQualifiedName.Empty,
                SourceElement               = XmlQualifiedName.Empty,
                TargetElement               = XmlQualifiedName.Empty,
                MessageVisibleKind          = MessageVisibleKind.initiating,
                MessageVisibleKindSpecified = false
            };

            Assert.NotNull(edge.BPMNLabel);
            Assert.NotNull(edge.BpmnElement);
            Assert.NotNull(edge.SourceElement);
            Assert.NotNull(edge.TargetElement);
            Assert.Equal(MessageVisibleKind.initiating, edge.MessageVisibleKind);
            Assert.False(edge.MessageVisibleKindSpecified);
        }
Beispiel #7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCreateValidBpmnDi()
        public virtual void shouldCreateValidBpmnDi()
        {
            modelInstance = Bpmn.createProcess("process").startEvent("start").sequenceFlowId("flow").endEvent("end").done();

            process      = modelInstance.getModelElementById("process");
            startEvent   = modelInstance.getModelElementById("start");
            sequenceFlow = modelInstance.getModelElementById("flow");
            endEvent     = modelInstance.getModelElementById("end");

            // create bpmn diagram
            BpmnDiagram bpmnDiagram = modelInstance.newInstance(typeof(BpmnDiagram));

            bpmnDiagram.Id            = "diagram";
            bpmnDiagram.Name          = "diagram";
            bpmnDiagram.Documentation = "bpmn diagram element";
            bpmnDiagram.Resolution    = 120.0;
            modelInstance.Definitions.addChildElement(bpmnDiagram);

            // create plane for process
            BpmnPlane processPlane = modelInstance.newInstance(typeof(BpmnPlane));

            processPlane.Id          = "plane";
            processPlane.BpmnElement = process;
            bpmnDiagram.BpmnPlane    = processPlane;

            // create shape for start event
            BpmnShape startEventShape = modelInstance.newInstance(typeof(BpmnShape));

            startEventShape.Id          = "startShape";
            startEventShape.BpmnElement = startEvent;
            processPlane.DiagramElements.Add(startEventShape);

            // create bounds for start event shape
            Bounds startEventBounds = modelInstance.newInstance(typeof(Bounds));

            startEventBounds.setHeight(36.0);
            startEventBounds.setWidth(36.0);
            startEventBounds.setX(632.0);
            startEventBounds.setY(312.0);
            startEventShape.Bounds = startEventBounds;

            // create shape for end event
            BpmnShape endEventShape = modelInstance.newInstance(typeof(BpmnShape));

            endEventShape.Id          = "endShape";
            endEventShape.BpmnElement = endEvent;
            processPlane.DiagramElements.Add(endEventShape);

            // create bounds for end event shape
            Bounds endEventBounds = modelInstance.newInstance(typeof(Bounds));

            endEventBounds.setHeight(36.0);
            endEventBounds.setWidth(36.0);
            endEventBounds.setX(718.0);
            endEventBounds.setY(312.0);
            endEventShape.Bounds = endEventBounds;

            // create edge for sequence flow
            BpmnEdge flowEdge = modelInstance.newInstance(typeof(BpmnEdge));

            flowEdge.Id            = "flowEdge";
            flowEdge.BpmnElement   = sequenceFlow;
            flowEdge.SourceElement = startEventShape;
            flowEdge.TargetElement = endEventShape;
            processPlane.DiagramElements.Add(flowEdge);

            // create waypoints for sequence flow edge
            Waypoint startWaypoint = modelInstance.newInstance(typeof(Waypoint));

            startWaypoint.X = 668.0;
            startWaypoint.Y = 330.0;
            flowEdge.Waypoints.add(startWaypoint);

            Waypoint endWaypoint = modelInstance.newInstance(typeof(Waypoint));

            endWaypoint.X = 718.0;
            endWaypoint.Y = 330.0;
            flowEdge.Waypoints.add(endWaypoint);
        }
Beispiel #8
0
        protected internal virtual void assertBpmnEdgeExists(string id)
        {
            BpmnEdge edge = findBpmnEdge(id);

            assertNotNull(edge);
        }