use of org.osate.ge.internal.diagram.runtime.DockArea in project osate2 by osate.
the class DiagramUpdaterTest method checkElements.
private static void checkElements(final Collection<DiagramElement> elements, final TestBusinessObject parentBO, final DockArea parentDockArea, final EnumSet<CheckFlag> flags) {
// Check the number of elements in the model
assertThat(elements.size(), is(equalTo(parentBO.children.length)));
// Check that each element in the model is in the element set
for (final TestBusinessObject child : parentBO.children) {
boolean foundBO = false;
final RelativeBusinessObjectReference modelChildRef = child.getRelativeReference();
for (final DiagramElement e : elements) {
final RelativeBusinessObjectReference elementRef = ((TestBusinessObject) e.getBusinessObject()).getRelativeReference();
if (elementRef.equals(modelChildRef)) {
foundBO = true;
break;
}
}
assertThat("The diagram does not contain an element for the business object: " + child, foundBO);
}
// Finish checking each element
for (final DiagramElement e : elements) {
// Check the position of the element
final TestBusinessObject testBo = (TestBusinessObject) e.getBusinessObject();
if (flags.contains(CheckFlag.CHECK_POSITION)) {
assertThat(e.getPosition(), is(equalTo(testBo.getTestPosition())));
}
final DockArea dockArea = getExpectedDockArea(testBo, parentDockArea);
if (flags.contains(CheckFlag.CHECK_DOCK_AREA)) {
assertThat(e.getDockArea(), is(equalTo(dockArea)));
}
// Check the children
checkElements(e.getChildren(), (TestBusinessObject) e.getBusinessObject(), dockArea, flags);
}
}
Aggregations