use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.
the class BPMNDiagramMarshallerTest method testMarshallIntermediateSignalEventCatching.
@Test
public void testMarshallIntermediateSignalEventCatching() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_INTERMEDIATE_SIGNAL_EVENTCATCHING);
String result = tested.marshall(diagram);
assertDiagram(result, 1, 1, 0);
assertTrue(result.contains("<bpmn2:intermediateCatchEvent"));
assertTrue(result.contains(" name=\"MySignalCatchingEvent\""));
assertTrue(result.contains("<bpmn2:signalEventDefinition"));
assertTrue(result.contains(" signalRef=\"_3b677877-9be0-3fe7-bfc4-94a862fdc919\""));
assertTrue(result.contains("<bpmn2:signal"));
assertTrue(result.contains("name=\"MySignal\""));
}
use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.
the class BPMNDiagramMarshallerTest method testUnmarshallUserTaskProperties.
@Test
@SuppressWarnings("unchecked")
public void testUnmarshallUserTaskProperties() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_USERTASKPROPERTIES);
assertDiagram(diagram, 4);
assertEquals("MyBP", diagram.getMetadata().getTitle());
UserTaskExecutionSet userTaskExecutionSet = 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 UserTask) {
UserTask userTask = (UserTask) oDefinition;
userTaskExecutionSet = userTask.getExecutionSet();
break;
}
}
}
assertEquals("MyUserTask", userTaskExecutionSet.getTaskName().getValue());
assertEquals("true", userTaskExecutionSet.getIsAsync().getValue().toString());
assertEquals("false", userTaskExecutionSet.getSkippable().getValue().toString());
assertEquals("my subject", userTaskExecutionSet.getSubject().getValue());
assertEquals("admin", userTaskExecutionSet.getCreatedBy().getValue());
assertEquals("my description", userTaskExecutionSet.getDescription().getValue());
assertEquals("3", userTaskExecutionSet.getPriority().getValue());
assertEquals("true", userTaskExecutionSet.getAdHocAutostart().getValue().toString());
assertEquals("System.out.println(\"Hello\");", userTaskExecutionSet.getOnEntryAction().getValue().getValues().get(0).getScript());
assertEquals("java", userTaskExecutionSet.getOnEntryAction().getValue().getValues().get(0).getLanguage());
assertEquals("System.out.println(\"Bye\");", userTaskExecutionSet.getOnExitAction().getValue().getValues().get(0).getScript());
assertEquals("java", userTaskExecutionSet.getOnExitAction().getValue().getValues().get(0).getLanguage());
}
use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.
the class BPMNDiagramMarshallerTest method testUnmarshallSequenceFlow.
@Test
public void testUnmarshallSequenceFlow() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_SEQUENCEFLOW);
SequenceFlow sequenceFlow1 = null;
SequenceFlow sequenceFlow2 = 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 ExclusiveGateway) {
List<Edge> outEdges = ((NodeImpl) element).getOutEdges();
for (Edge edge : outEdges) {
SequenceFlow flow = (SequenceFlow) ((ViewConnectorImpl) ((EdgeImpl) edge).getContent()).getDefinition();
if ("route1".equals(flow.getGeneral().getName().getValue())) {
sequenceFlow1 = flow;
}
if ("route2".equals(flow.getGeneral().getName().getValue())) {
sequenceFlow2 = flow;
}
}
}
}
}
assertNotNull(sequenceFlow1);
assertNotNull(sequenceFlow1.getExecutionSet());
assertNotNull(sequenceFlow1.getExecutionSet().getConditionExpression());
assertNotNull(sequenceFlow1.getExecutionSet().getPriority());
assertNotNull(sequenceFlow1.getGeneral());
assertNotNull(sequenceFlow1.getGeneral().getName());
assertEquals("route1", sequenceFlow1.getGeneral().getName().getValue());
assertEquals("age >= 10;", sequenceFlow1.getExecutionSet().getConditionExpression().getValue().getScript());
assertEquals("javascript", sequenceFlow1.getExecutionSet().getConditionExpression().getValue().getLanguage());
assertEquals("2", sequenceFlow1.getExecutionSet().getPriority().getValue());
assertNotNull(sequenceFlow2);
assertNotNull(sequenceFlow2.getExecutionSet());
assertNotNull(sequenceFlow2.getExecutionSet().getConditionExpression());
assertNotNull(sequenceFlow2.getExecutionSet().getPriority());
assertNotNull(sequenceFlow2.getGeneral());
assertNotNull(sequenceFlow2.getGeneral().getName());
assertEquals("route2", sequenceFlow2.getGeneral().getName().getValue());
assertEquals("age\n" + "<\n" + "10;", sequenceFlow2.getExecutionSet().getConditionExpression().getValue().getScript());
assertEquals("java", sequenceFlow2.getExecutionSet().getConditionExpression().getValue().getLanguage());
assertEquals("1", sequenceFlow2.getExecutionSet().getPriority().getValue());
}
use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.
the class BPMNDiagramMarshallerTest method testUnmarshallIntermediateSignalEventThrowing.
@Test
@SuppressWarnings("unchecked")
public void testUnmarshallIntermediateSignalEventThrowing() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_INTERMEDIATE_SIGNAL_EVENTTHROWING);
assertDiagram(diagram, 2);
assertEquals("intermediateSignalThrowing", diagram.getMetadata().getTitle());
Node<? extends Definition, ?> intermediateEventNode = diagram.getGraph().getNode("_A45EC77D-5414-4348-BA8F-05C4FFD660EE");
IntermediateSignalEventThrowing intermediateSignalEventThrowing = (IntermediateSignalEventThrowing) intermediateEventNode.getContent().getDefinition();
assertNotNull(intermediateSignalEventThrowing.getGeneral());
assertEquals("MySignalThrowingEvent", intermediateSignalEventThrowing.getGeneral().getName().getValue());
assertEquals("MySignalThrowingEventDocumentation", intermediateSignalEventThrowing.getGeneral().getDocumentation().getValue());
assertNotNull(intermediateSignalEventThrowing.getExecutionSet());
assertEquals("processInstance", intermediateSignalEventThrowing.getExecutionSet().getSignalScope().getValue());
assertEquals("MySignal", intermediateSignalEventThrowing.getExecutionSet().getSignalRef().getValue());
DataIOSet dataIOSet = intermediateSignalEventThrowing.getDataIOSet();
AssignmentsInfo assignmentsInfo = dataIOSet.getAssignmentsinfo();
assertEquals("_input1:String||||[din]var1->_input1", assignmentsInfo.getValue());
}
use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.
the class BPMNDiagramMarshallerTest method testMarshallEndTerminateEvent.
@Test
public void testMarshallEndTerminateEvent() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_ENDTERMINATEEVENT);
String result = tested.marshall(diagram);
assertDiagram(result, 1, 2, 1);
assertTrue(result.contains("<bpmn2:endEvent"));
assertTrue(result.contains(" id=\"_1B379E3E-E4ED-4BD2-AEE8-CD85374CEC78\""));
assertTrue(result.contains("name=\"MyEndTerminateEvent\""));
assertTrue(result.contains("<drools:metaValue><![CDATA[MyEndTerminateEvent]]></drools:metaValue>"));
assertTrue(result.contains("<![CDATA[MyEndTerminateEventDocumentation]]></bpmn2:documentation>"));
assertTrue(result.contains("<bpmn2:terminateEventDefinition"));
assertTrue(result.contains("</bpmn2:endEvent>"));
}
Aggregations