use of org.opennms.features.topology.api.topo.VertexListener in project opennms by OpenNMS.
the class EnhancedLinkdTopologyProviderTest method testTopoProviderSetParent.
@Test
public void testTopoProviderSetParent() {
VertexRef vertexId1 = addVertexToTopr();
VertexRef vertexId2 = addVertexToTopr();
final AtomicInteger eventsReceived = new AtomicInteger(0);
m_topologyProvider.addVertexListener(new VertexListener() {
@Override
public void vertexSetChanged(VertexProvider provider, Collection<? extends Vertex> added, Collection<? extends Vertex> update, Collection<String> removedVertexIds) {
eventsReceived.incrementAndGet();
}
@Override
public void vertexSetChanged(VertexProvider provider) {
eventsReceived.incrementAndGet();
}
});
Vertex groupId = m_topologyProvider.addGroup("Test Group", "groupIcon.jpg");
assertEquals(1, eventsReceived.get());
eventsReceived.set(0);
m_topologyProvider.setParent(vertexId1, groupId);
m_topologyProvider.setParent(vertexId2, groupId);
assertEquals(2, eventsReceived.get());
}
Aggregations