final DiagramEditor de = TestUtil.loadFile("addConnection.dispel");
Diagram d = de.getDiagramTypeProvider().getDiagram();
ILinkService ls = Graphiti.getLinkService();
ContainerShape peShape = null;
EObject linked = null;
//Get Demo Echo PE
for (Shape s : d.getChildren()) {
linked = ls.getBusinessObjectForLinkedPictogramElement(s);
if (linked instanceof LocalVariableStatement) {
if (((LocalVariableStatement) linked).getVariable().getName(
).equals("DemoEcho")) {
assertTrue(s instanceof ContainerShape);
peShape = (ContainerShape) s;
break;
}
}
}
assertNotNull(peShape);
assertNotNull(linked.eContainer());
//Find Literal
Shape literalShape = null;
for (Shape s : d.getChildren()) {
linked = ls.getBusinessObjectForLinkedPictogramElement(s);
if (linked instanceof ConnectionInitialization) {
ConnectionInitialization ci = (ConnectionInitialization) linked;
EObject e = Utility.getChildLiteral(ci);
if (Utility.getLiteralValue(
Utility.getChildLiteral(ci)).equals("\"Connection\"")) {
literalShape = s;
break;
}
}
}
assertNotNull(literalShape);
assertNotNull(linked.eContainer());
assertTrue(literalShape.getAnchors().size() > 0);
ProcessingElementParameter param = null;
Shape paramShape = null;
for (Shape s :peShape.getChildren()) {
linked = ls.getBusinessObjectForLinkedPictogramElement(s);
if (linked instanceof ProcessingElementParameter) {
ProcessingElementParameter paramTmp =
(ProcessingElementParameter) linked;
if (paramTmp.getName().equals("input")) {