use of org.opennms.features.topology.plugins.topo.asset.layers.PersistenceNodeProvider in project opennms by OpenNMS.
the class PersistenceNodeProviderIT method verifyLayerRestrictions.
/**
* In order to build a valid hierarchy, each{@link Layer}
* must ensure that the value for each node IS NOT null.
* To let the database do the filtering, a {@link Restriction}
* annotation must be present.
* This tests ensures that each defined {@link Layer} actually provides a restriction and that the {@link Restriction} works as expected.
*/
@Test
public void verifyLayerRestrictions() throws Exception {
List<LayerDefinition> mapping = new LayerDefinitionRepository().getDefinitions(NodeParamLabels.ALL_KEYS);
Assert.assertEquals(NodeParamLabels.ALL_KEYS.size(), Layers.values().length);
Assert.assertEquals(Layers.values().length, mapping.size());
final List<OnmsNode> nodes = new PersistenceNodeProvider(genericPersistenceAccessor).getNodes(mapping);
Assert.assertEquals(1, nodes.size());
OnmsNode actualNode = nodes.get(0);
OnmsNode expectedNode = nodeDao.findByLabel("Node 2").get(0);
Assert.assertEquals(expectedNode.getId(), actualNode.getId());
}
Aggregations