use of org.opennms.netmgt.collectd.GenericIndexResourceType in project opennms by OpenNMS.
the class ThresholdingVisitorIT method testBug3227.
/*
* This test uses this files from src/test/resources:
* - threshd-configuration.xml
* - test-thresholds-bug3227.xml
*
* There is no Frame Relay related thresholds definitions on test-thresholds-bug3227.xml.
* When visit resources, getEntityMap from ThresholdingSet must be null.
* Updated to reflect the fact that counter are treated as rates.
*/
@Test
public void testBug3227() throws Exception {
initFactories("/threshd-configuration.xml", "/test-thresholds-bug3227.xml");
ThresholdingVisitor visitor = createVisitor();
SnmpCollectionAgent agent = createCollectionAgent();
GenericIndexResourceType resourceType = createGenericIndexResourceType(agent, "frCircuitIfIndex");
// Creating Resource
SnmpInstId inst = new SnmpInstId(100);
SnmpCollectionResource resource = new GenericIndexResource(resourceType, "frCircuitIfIndex", inst);
addAttributeToCollectionResource(resource, resourceType, "frReceivedOctets", "counter", "frCircuitIfIndex", 1000);
addAttributeToCollectionResource(resource, resourceType, "frSentOctets", "counter", "frCircuitIfIndex", 1000);
/*
* Run Visitor
* I must receive 2 special info events because getEntityMap should be called 2 times.
* One for each attribute and one for each resource.
* Original code will throw a NullPointerException after call getEntityMap.
* Original code expects WARNs, but this message is now an INFO.
*/
resource.visit(visitor);
}
Aggregations