Search in sources :

Example 6 with GenericIndexResourceType

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);
}
Also used : SnmpCollectionAgent(org.opennms.netmgt.collectd.SnmpCollectionAgent) SnmpInstId(org.opennms.netmgt.snmp.SnmpInstId) GenericIndexResource(org.opennms.netmgt.collectd.GenericIndexResource) SnmpCollectionResource(org.opennms.netmgt.collectd.SnmpCollectionResource) GenericIndexResourceType(org.opennms.netmgt.collectd.GenericIndexResourceType) Test(org.junit.Test)

Aggregations

GenericIndexResourceType (org.opennms.netmgt.collectd.GenericIndexResourceType)6 GenericIndexResource (org.opennms.netmgt.collectd.GenericIndexResource)5 SnmpCollectionAgent (org.opennms.netmgt.collectd.SnmpCollectionAgent)5 SnmpCollectionResource (org.opennms.netmgt.collectd.SnmpCollectionResource)5 SnmpInstId (org.opennms.netmgt.snmp.SnmpInstId)5 Test (org.junit.Test)4 HashMap (java.util.HashMap)3 OnmsSnmpCollection (org.opennms.netmgt.collectd.OnmsSnmpCollection)3 ServiceParameters (org.opennms.netmgt.collection.api.ServiceParameters)3 MockDataCollectionConfig (org.opennms.netmgt.mock.MockDataCollectionConfig)3 IfResourceType (org.opennms.netmgt.collectd.IfResourceType)2 NodeResourceType (org.opennms.netmgt.collectd.NodeResourceType)2 SnmpAttribute (org.opennms.netmgt.collectd.SnmpAttribute)2 CollectionAttribute (org.opennms.netmgt.collection.api.CollectionAttribute)2 Parameter (org.opennms.netmgt.config.datacollection.Parameter)2 PersistenceSelectorStrategy (org.opennms.netmgt.config.datacollection.PersistenceSelectorStrategy)2 ResourceType (org.opennms.netmgt.config.datacollection.ResourceType)2 StorageStrategy (org.opennms.netmgt.config.datacollection.StorageStrategy)2 Date (java.util.Date)1 ResourcePath (org.opennms.netmgt.model.ResourcePath)1