use of org.kie.workbench.common.stunner.core.graph.Graph 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());
}
use of org.kie.workbench.common.stunner.core.graph.Graph 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\">"));
}
use of org.kie.workbench.common.stunner.core.graph.Graph 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);
}
use of org.kie.workbench.common.stunner.core.graph.Graph 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());
}
use of org.kie.workbench.common.stunner.core.graph.Graph in project kie-wb-common by kiegroup.
the class BPMNDiagramMarshallerTest method testMarshallScriptTask.
@Test
public void testMarshallScriptTask() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_SCRIPTTASK);
String result = tested.marshall(diagram);
assertDiagram(result, 1, 4, 3);
assertTrue(result.contains("name=\"Javascript Script Task\" scriptFormat=\"http://www.javascript.com/javascript\""));
assertTrue(result.contains("name=\"Java Script Task\" scriptFormat=\"http://www.java.com/java\""));
assertTrue(result.contains("<bpmn2:script><![CDATA[var str = FirstName + LastName;]]></bpmn2:script>"));
assertTrue(result.contains("<bpmn2:script><![CDATA[if (name.toString().equals(\"Jay\")) {" + NEW_LINE + NEW_LINE + " System.out.println(\"Hello\\n\" + name.toString() + \"\\n\");" + NEW_LINE + NEW_LINE + "} else {" + NEW_LINE + NEW_LINE + NEW_LINE + " System.out.println(\"Hi\\n\" + name.toString() + \"\\n\");" + NEW_LINE + NEW_LINE + NEW_LINE + "}" + NEW_LINE + "]]></bpmn2:script>"));
String flatResult = result.replace(NEW_LINE, " ").replaceAll("( )+", " ");
assertTrue(flatResult.contains("<drools:metaData name=\"customAsync\"> <drools:metaValue><![CDATA[true]]></drools:metaValue>"));
}
Aggregations