use of org.opennms.netmgt.dao.support.PropertiesGraphDao.PrefabGraphTypeDao in project opennms by OpenNMS.
the class PropertiesGraphDaoIT method testNoType.
@Test
public void testNoType() throws Exception {
PropertiesGraphDao dao = createPropertiesGraphDao(s_emptyMap, s_emptyMap);
String ourConfig = s_responsePrefab.replaceAll("report.icmp.type=responseTime", "");
ByteArrayInputStream in = new ByteArrayInputStream(ourConfig.getBytes());
dao.loadProperties("response", in);
PrefabGraphTypeDao type = dao.findPrefabGraphTypeDaoByName("response");
assertNotNull("could not get response prefab graph type", type);
PrefabGraph graph = type.getQuery("icmp");
assertNotNull("could not get icmp response prefab graph type", graph);
assertNotNull("graph type list should not be null", graph.getTypes());
assertEquals("graph type was not specified the list should be empty", 0, graph.getTypes().length);
assertFalse("should not have responseTime type", graph.hasMatchingType("responseTime"));
}
use of org.opennms.netmgt.dao.support.PropertiesGraphDao.PrefabGraphTypeDao in project opennms by OpenNMS.
the class PropertiesGraphDaoIT method testOneType.
@Test
public void testOneType() throws Exception {
PropertiesGraphDao dao = createPropertiesGraphDao(s_emptyMap, s_emptyMap);
ByteArrayInputStream in = new ByteArrayInputStream(s_responsePrefab.getBytes());
dao.loadProperties("response", in);
PrefabGraphTypeDao type = dao.findPrefabGraphTypeDaoByName("response");
assertNotNull("could not get response prefab graph type", type);
PrefabGraph graph = type.getQuery("icmp");
assertNotNull("could not get icmp response prefab graph type", graph);
assertNotNull("graph type list should not be null", graph.getTypes());
assertEquals("graph type was not specified the list should be empty", 1, graph.getTypes().length);
assertEquals("graph type 1", "responseTime", graph.getTypes()[0]);
assertTrue("should have responseTime type", graph.hasMatchingType("responseTime"));
assertFalse("should not have distributedStatus type", graph.hasMatchingType("distributedStatus"));
assertTrue("should have responseTime or distributedStatus type", graph.hasMatchingType("responseTime", "distributedStatus"));
}
use of org.opennms.netmgt.dao.support.PropertiesGraphDao.PrefabGraphTypeDao in project opennms by OpenNMS.
the class PropertiesGraphDaoIT method testTwoTypes.
@Test
public void testTwoTypes() throws Exception {
PropertiesGraphDao dao = createPropertiesGraphDao(s_emptyMap, s_emptyMap);
String ourConfig = s_responsePrefab.replaceAll("report.icmp.type=responseTime", "report.icmp.type=responseTime, distributedStatus");
ByteArrayInputStream in = new ByteArrayInputStream(ourConfig.getBytes());
dao.loadProperties("response", in);
PrefabGraphTypeDao type = dao.findPrefabGraphTypeDaoByName("response");
assertNotNull("could not get response prefab graph type", type);
PrefabGraph graph = type.getQuery("icmp");
assertNotNull("could not get icmp response prefab graph type", graph);
assertNotNull("graph type should not be null", graph.getTypes());
assertEquals("graph type count", 2, graph.getTypes().length);
assertEquals("graph type 1", "responseTime", graph.getTypes()[0]);
assertEquals("graph type 2", "distributedStatus", graph.getTypes()[1]);
assertTrue("should have responseTime type", graph.hasMatchingType("responseTime"));
assertTrue("should have distributedStatus type", graph.hasMatchingType("distributedStatus"));
}
use of org.opennms.netmgt.dao.support.PropertiesGraphDao.PrefabGraphTypeDao in project opennms by OpenNMS.
the class PropertiesGraphDaoITCase method setUp.
@Before
public void setUp() throws Exception {
MockLogAppender.setupLogging(true);
m_dao = createPropertiesGraphDao(s_emptyMap, s_emptyMap);
ByteArrayInputStream in = new ByteArrayInputStream(s_prefab.getBytes());
m_dao.loadProperties("performance", in);
PrefabGraphTypeDao type = m_dao.findPrefabGraphTypeDaoByName("performance");
assertNotNull("could not get performance prefab graph type", type);
m_graphs = type.getReportMap();
assertNotNull("report map shouldn't be null", m_graphs);
m_fileAnticipator = new FileAnticipator();
}
Aggregations