Search in sources :

Example 41 with Metadata

use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.

the class BPMNDiagramMarshallerTest method testMarshallIsInterruptingStartErrorEvent.

@Test
public void testMarshallIsInterruptingStartErrorEvent() throws Exception {
    Diagram<Graph, Metadata> testIt = unmarshall(BPMN_EVENT_SUBPROCESS_STARTERROREVENT);
    String result = tested.marshall(testIt);
    assertDiagram(result, 1, 6, 2);
    Diagram<Graph, Metadata> marshalledDiagram = unmarshall(getStream(result));
    assertDiagram(marshalledDiagram, 7);
    assertEquals("EventSubprocessStartErrorEvent", marshalledDiagram.getMetadata().getTitle());
    Node<? extends Definition, ?> filledEventNode = testIt.getGraph().getNode("9ABD5C04-C6E2-4DF3-829F-ADB283330AD6");
    Node<? extends Definition, ?> marshalledFilledEventNode = marshalledDiagram.getGraph().getNode("9ABD5C04-C6E2-4DF3-829F-ADB283330AD6");
    assertEquals(filledEventNode, marshalledFilledEventNode);
    Node<? extends Definition, ?> emptyEventNode = marshalledDiagram.getGraph().getNode("50B93E5E-C05D-40DD-BF48-2B6AE919763E");
    Node<? extends Definition, ?> marshalledEmptyEventNode = marshalledDiagram.getGraph().getNode("50B93E5E-C05D-40DD-BF48-2B6AE919763E");
    assertEquals(emptyEventNode, marshalledEmptyEventNode);
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 42 with Metadata

use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.

the class BPMNDiagramMarshallerTest method testUnmarshallEndMessageEvent.

@Test
@SuppressWarnings("unchecked")
public void testUnmarshallEndMessageEvent() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_ENDMESSAGEEVENT);
    assertDiagram(diagram, 2);
    assertEquals("EndMessageEvent", diagram.getMetadata().getTitle());
    Node<? extends Definition, ?> endMessageEventNode = diagram.getGraph().getNode("_4A8A0A9E-D4A5-4B6E-94A6-20817A57B3C6");
    EndMessageEvent endMessageEvent = (EndMessageEvent) endMessageEventNode.getContent().getDefinition();
    assertNotNull(endMessageEvent.getExecutionSet());
    MessageRef messageRef = endMessageEvent.getExecutionSet().getMessageRef();
    assertEquals("msgref", messageRef.getValue());
    DataIOSet dataIOSet = endMessageEvent.getDataIOSet();
    AssignmentsInfo assignmentsInfo = dataIOSet.getAssignmentsinfo();
    assertEquals("EndMessageEventInputVar1:String||||[din]var1->EndMessageEventInputVar1", assignmentsInfo.getValue());
}
Also used : DataIOSet(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.DataIOSet) Graph(org.kie.workbench.common.stunner.core.graph.Graph) MessageRef(org.kie.workbench.common.stunner.bpmn.definition.property.event.message.MessageRef) AssignmentsInfo(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.AssignmentsInfo) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) EndMessageEvent(org.kie.workbench.common.stunner.bpmn.definition.EndMessageEvent) Test(org.junit.Test)

Example 43 with Metadata

use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.

the class BPMNDiagramMarshallerTest method testMarshallXorGateway.

@Test
public void testMarshallXorGateway() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_XORGATEWAY);
    String result = tested.marshall(diagram);
    assertDiagram(result, 1, 6, 5);
    assertTrue(result.contains("<bpmn2:exclusiveGateway id=\"_877EA035-1A14-42E9-8CAA-43E9BF908C70\" drools:dg=\"_5110D608-BDAD-47BF-A3F9-E1DBE43ED7CD\" name=\"AgeSplit\" gatewayDirection=\"Diverging\" default=\"_5110D608-BDAD-47BF-A3F9-E1DBE43ED7CD\">"));
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 44 with Metadata

use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.

the class BPMNDiagramMarshallerTest method testMarshallMagnetDockers.

@Test
public void testMarshallMagnetDockers() throws Exception {
    Diagram<Graph, Metadata> diagram1 = unmarshall(BPMN_MAGNETDOCKERS);
    String result = tested.marshall(diagram1);
    assertDiagram(result, 1, 8, 7);
    Diagram<Graph, Metadata> diagram2 = unmarshall(new ByteArrayInputStream(result.getBytes()));
    testMagnetDockers(diagram2);
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) ByteArrayInputStream(java.io.ByteArrayInputStream) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 45 with Metadata

use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.

the class BPMNDiagramMarshallerTest method testMarshallIntermediateTimerEvent.

@Test
public void testMarshallIntermediateTimerEvent() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_TIMER_EVENT);
    IntermediateTimerEvent timerEvent = null;
    Iterator<Element> it = nodesIterator(diagram);
    while (it.hasNext()) {
        Element element = it.next();
        if (element.getContent() instanceof View) {
            Object oDefinition = ((View) element.getContent()).getDefinition();
            if (oDefinition instanceof IntermediateTimerEvent) {
                timerEvent = (IntermediateTimerEvent) oDefinition;
                break;
            }
        }
    }
    assertNotNull(timerEvent);
    assertNotNull(timerEvent.getGeneral());
    assertNotNull(timerEvent.getExecutionSet());
    assertEquals("myTimeDateValue", timerEvent.getExecutionSet().getTimerSettings().getValue().getTimeDate());
    assertEquals("MyTimeDurationValue", timerEvent.getExecutionSet().getTimerSettings().getValue().getTimeDuration());
    assertEquals("myTimeCycleValue", timerEvent.getExecutionSet().getTimerSettings().getValue().getTimeCycle());
    assertEquals("cron", timerEvent.getExecutionSet().getTimerSettings().getValue().getTimeCycleLanguage());
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) IntermediateTimerEvent(org.kie.workbench.common.stunner.bpmn.definition.IntermediateTimerEvent) ItemAwareElement(org.eclipse.bpmn2.ItemAwareElement) FlowElement(org.eclipse.bpmn2.FlowElement) RootElement(org.eclipse.bpmn2.RootElement) Element(org.kie.workbench.common.stunner.core.graph.Element) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Test(org.junit.Test)

Aggregations

Metadata (org.kie.workbench.common.stunner.core.diagram.Metadata)175 Graph (org.kie.workbench.common.stunner.core.graph.Graph)158 Test (org.junit.Test)156 Matchers.anyString (org.mockito.Matchers.anyString)53 View (org.kie.workbench.common.stunner.core.graph.content.view.View)32 AssignmentsInfo (org.kie.workbench.common.stunner.bpmn.definition.property.dataio.AssignmentsInfo)30 ItemAwareElement (org.eclipse.bpmn2.ItemAwareElement)28 RootElement (org.eclipse.bpmn2.RootElement)28 DataIOSet (org.kie.workbench.common.stunner.bpmn.definition.property.dataio.DataIOSet)28 Element (org.kie.workbench.common.stunner.core.graph.Element)27 FlowElement (org.eclipse.bpmn2.FlowElement)26 Diagram (org.kie.workbench.common.stunner.core.diagram.Diagram)16 UserTask (org.kie.workbench.common.stunner.bpmn.definition.UserTask)14 Edge (org.kie.workbench.common.stunner.core.graph.Edge)14 BPMNGeneralSet (org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet)11 StartErrorEvent (org.kie.workbench.common.stunner.bpmn.definition.StartErrorEvent)10 MessageRef (org.kie.workbench.common.stunner.bpmn.definition.property.event.message.MessageRef)10 StartSignalEvent (org.kie.workbench.common.stunner.bpmn.definition.StartSignalEvent)9 StartTimerEvent (org.kie.workbench.common.stunner.bpmn.definition.StartTimerEvent)9 Node (org.kie.workbench.common.stunner.core.graph.Node)9