use of org.opennms.features.topology.api.topo.AbstractEdge in project opennms by OpenNMS.
the class HierarchyLayoutAlgorithmTest method basicLayout.
/**
* Generates the following graph:
*
* t1-v1
* / \
* t1-v2 t1-v3
*
* and verifies the resulting X and Y coordinates.
*/
@Test
public void basicLayout() {
// Vertices
vertices.add(new LevelAwareTestVertex("v1", 0));
vertices.add(new LevelAwareTestVertex("v2", 1));
vertices.add(new LevelAwareTestVertex("v3", 1));
// Edges
edges.add(new AbstractEdge("test", "v1-v2", vertices.get(0), vertices.get(1)));
edges.add(new AbstractEdge("test", "v1-v3", vertices.get(0), vertices.get(2)));
buildLayout();
expectVertexToBeAt(0, 150.0d, 100.0d);
expectVertexToBeAt(1, 100.0d, 200.0d);
expectVertexToBeAt(2, 200.0d, 200.0d);
}
use of org.opennms.features.topology.api.topo.AbstractEdge in project opennms by OpenNMS.
the class HierarchyLayoutAlgorithmTest method notSoBasicLayout.
/**
* Generates the following graph:
*
* t1-v1 t2-v1
* / \
* t1-v2 t1-v3
* /
* t1-v4
*
* and verifies the resulting X and Y coordinates.
*/
@Test
public void notSoBasicLayout() {
// Vertices
vertices.add(new LevelAwareTestVertex("t1-v1", 0));
vertices.add(new LevelAwareTestVertex("t1-v2", 1));
vertices.add(new LevelAwareTestVertex("t1-v3", 1));
vertices.add(new LevelAwareTestVertex("t1-v4", 2));
vertices.add(new LevelAwareTestVertex("t2-v1", 0));
// Edges
edges.add(new AbstractEdge("test", "t1-v1-v2", vertices.get(0), vertices.get(1)));
edges.add(new AbstractEdge("test", "t1-v1-v3", vertices.get(0), vertices.get(2)));
edges.add(new AbstractEdge("test", "t1-v2-v4", vertices.get(1), vertices.get(3)));
buildLayout();
expectVertexToBeAt(0, 150.0d, 100.0d);
expectVertexToBeAt(1, 100.0d, 200.0d);
expectVertexToBeAt(2, 200.0d, 200.0d);
expectVertexToBeAt(3, 100.0d, 300.0d);
expectVertexToBeAt(4, 300.0d, 100.0d);
}
Aggregations