Search in sources :

Example 6 with ExternalValueAttribute

use of org.opennms.netmgt.model.ExternalValueAttribute in project opennms by OpenNMS.

the class PropertiesGraphDaoIT method testGetPrefabGraphsForResourceWithSuppressUnused.

@Test
public void testGetPrefabGraphsForResourceWithSuppressUnused() {
    MockResourceType resourceType = new MockResourceType();
    resourceType.setName("interface");
    HashSet<OnmsAttribute> attributes = new HashSet<OnmsAttribute>(0);
    attributes.add(new RrdGraphAttribute("ifHCInOctets", "", ""));
    attributes.add(new RrdGraphAttribute("ifHCOutOctets", "", ""));
    attributes.add(new ExternalValueAttribute("ifSpeed", ""));
    OnmsResource resource = new OnmsResource("node", "1", resourceType, attributes, ResourcePath.get("foo"));
    PrefabGraph[] graphs = m_dao.getPrefabGraphsForResource(resource);
    assertEquals("prefab graph array size", 1, graphs.length);
    assertEquals("prefab graph[0] name", "mib2.HCbits", graphs[0].getName());
}
Also used : OnmsResource(org.opennms.netmgt.model.OnmsResource) PrefabGraph(org.opennms.netmgt.model.PrefabGraph) OnmsAttribute(org.opennms.netmgt.model.OnmsAttribute) RrdGraphAttribute(org.opennms.netmgt.model.RrdGraphAttribute) ExternalValueAttribute(org.opennms.netmgt.model.ExternalValueAttribute) MockResourceType(org.opennms.netmgt.mock.MockResourceType) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 7 with ExternalValueAttribute

use of org.opennms.netmgt.model.ExternalValueAttribute in project opennms by OpenNMS.

the class PropertiesGraphDaoIT method testGetPrefabGraphsForResourceWithSuppress.

@Test
public void testGetPrefabGraphsForResourceWithSuppress() {
    MockResourceType resourceType = new MockResourceType();
    resourceType.setName("interface");
    HashSet<OnmsAttribute> attributes = new HashSet<OnmsAttribute>(0);
    attributes.add(new RrdGraphAttribute("ifInOctets", "", ""));
    attributes.add(new RrdGraphAttribute("ifOutOctets", "", ""));
    attributes.add(new RrdGraphAttribute("ifHCInOctets", "", ""));
    attributes.add(new RrdGraphAttribute("ifHCOutOctets", "", ""));
    attributes.add(new ExternalValueAttribute("ifSpeed", ""));
    OnmsResource resource = new OnmsResource("node", "1", resourceType, attributes, ResourcePath.get("foo"));
    PrefabGraph[] graphs = m_dao.getPrefabGraphsForResource(resource);
    assertEquals("prefab graph array size", 1, graphs.length);
    assertEquals("prefab graph[0] name", "mib2.HCbits", graphs[0].getName());
}
Also used : OnmsResource(org.opennms.netmgt.model.OnmsResource) PrefabGraph(org.opennms.netmgt.model.PrefabGraph) OnmsAttribute(org.opennms.netmgt.model.OnmsAttribute) RrdGraphAttribute(org.opennms.netmgt.model.RrdGraphAttribute) ExternalValueAttribute(org.opennms.netmgt.model.ExternalValueAttribute) MockResourceType(org.opennms.netmgt.mock.MockResourceType) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

ExternalValueAttribute (org.opennms.netmgt.model.ExternalValueAttribute)7 OnmsAttribute (org.opennms.netmgt.model.OnmsAttribute)7 OnmsResource (org.opennms.netmgt.model.OnmsResource)7 HashSet (java.util.HashSet)6 MockResourceType (org.opennms.netmgt.mock.MockResourceType)6 RrdGraphAttribute (org.opennms.netmgt.model.RrdGraphAttribute)5 Test (org.junit.Test)3 PrefabGraph (org.opennms.netmgt.model.PrefabGraph)3 FetchResults (org.opennms.netmgt.measurements.api.FetchResults)2 Source (org.opennms.netmgt.measurements.model.Source)2 ArrayList (java.util.ArrayList)1 StringTokenizer (java.util.StringTokenizer)1 TreeMap (java.util.TreeMap)1 Matcher (java.util.regex.Matcher)1 LazySet (org.opennms.core.utils.LazySet)1 SymbolTable (org.opennms.core.utils.PropertiesUtils.SymbolTable)1 OnmsNode (org.opennms.netmgt.model.OnmsNode)1 StringPropertyAttribute (org.opennms.netmgt.model.StringPropertyAttribute)1