use of org.kie.workbench.common.stunner.core.diagram.Metadata 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>"));
}
use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.
the class BPMNDiagramMarshallerTest method testMarshallIntermediateMessageEventThrowing.
@Test
public void testMarshallIntermediateMessageEventThrowing() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_INTERMEDIATE_MESSAGE_EVENTTHROWING);
String result = tested.marshall(diagram);
assertDiagram(result, 1, 1, 0);
assertTrue(result.contains("<bpmn2:intermediateThrowEvent"));
assertTrue(result.contains(" name=\"IntermediateMessageEventThrowing\""));
assertTrue(result.contains("<bpmn2:message "));
assertTrue(result.contains(" name=\"msgref\""));
assertTrue(result.contains("<bpmn2:messageEventDefinition"));
}
use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.
the class BPMNDiagramMarshallerTest method testMarshallAdHocSubprocess.
public void testMarshallAdHocSubprocess() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_ADHOC_SUBPROCESS);
assertDiagram(diagram, 9);
String result = tested.marshall(diagram);
assertDiagram(result, 1, 8, 5);
assertTrue(result.contains("<bpmn2:adHocSubProcess id=\"_B65DDF51-9822-4B12-8669-2018A845A01B\""));
assertTrue(result.contains("name=\"AdHocSubprocess1\""));
assertTrue(result.contains("<drools:onEntry-script scriptFormat=\"http://www.mvel.org/2.0\">"));
assertTrue(result.contains("<drools:script><![CDATA[System.out.println(\"onEntryAction\");]]></drools:script>"));
assertTrue(result.contains("</drools:onEntry-script>"));
assertTrue(result.contains("<drools:onExit-script scriptFormat=\"http://www.java.com/java\">"));
assertTrue(result.contains("<drools:script><![CDATA[System.out.println(\"onExitAction\");]]></drools:script>"));
assertTrue(result.contains("</drools:onExit-script>"));
assertTrue(result.contains("<bpmn2:completionCondition xsi:type=\"bpmn2:tFormalExpression\""));
assertTrue(result.contains("language=\"http://www.jboss.org/drools/rule\"><![CDATA[autocomplete]]></bpmn2:completionCondition>"));
}
use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.
the class BPMNDiagramMarshallerTest method testUnmarshallUserTaskAssignments.
@Test
@SuppressWarnings("unchecked")
public void testUnmarshallUserTaskAssignments() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_USERTASKASSIGNMENTS);
assertDiagram(diagram, 8);
assertEquals("UserTaskAssignments", diagram.getMetadata().getTitle());
Node<? extends Definition, ?> selfEvaluationNode = diagram.getGraph().getNode("_6063D302-9D81-4C86-920B-E808A45377C2");
UserTask selfEvaluationTask = (UserTask) selfEvaluationNode.getContent().getDefinition();
assertEquals(selfEvaluationTask.getTaskType().getValue(), TaskTypes.USER);
UserTaskExecutionSet executionSet = selfEvaluationTask.getExecutionSet();
AssignmentsInfo assignmentsinfo = executionSet.getAssignmentsinfo();
assertEquals(assignmentsinfo.getValue(), "|reason:com.test.Reason,Comment:Object,Skippable:Object||performance:Object|[din]reason->reason,[dout]performance->performance");
}
use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.
the class BPMNDiagramMarshallerTest method testUnmarshallIntermediateMessageEventCatching.
@Test
@SuppressWarnings("unchecked")
public void testUnmarshallIntermediateMessageEventCatching() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_INTERMEDIATE_MESSAGE_EVENTCATCHING);
assertDiagram(diagram, 2);
assertEquals("IntermediateMessageEventCatching", diagram.getMetadata().getTitle());
Node<? extends Definition, ?> intermediateMessageEventCatchingNode = diagram.getGraph().getNode("_BD708E30-CA48-4051-BAEA-BBCB5F396CEE");
IntermediateMessageEventCatching intermediateMessageEventCatching = (IntermediateMessageEventCatching) intermediateMessageEventCatchingNode.getContent().getDefinition();
assertNotNull(intermediateMessageEventCatching.getExecutionSet());
MessageRef messageRef = intermediateMessageEventCatching.getExecutionSet().getMessageRef();
assertEquals("msgref1", messageRef.getValue());
DataIOSet dataIOSet = intermediateMessageEventCatching.getDataIOSet();
AssignmentsInfo assignmentsInfo = dataIOSet.getAssignmentsinfo();
assertEquals("||IntermediateMessageEventCatchingOutputVar1:String||[dout]IntermediateMessageEventCatchingOutputVar1->var1", assignmentsInfo.getValue());
}
Aggregations