use of org.opennms.netmgt.rrd.model.v3.RRDv3 in project opennms by OpenNMS.
the class RRDv3IT method parseRrdWithAberrantBehaviorDetection.
/**
* Parses the RRD with aberrant behavior detection.
*
* @throws Exception the exception
*/
@Test
public void parseRrdWithAberrantBehaviorDetection() throws Exception {
RRDv3 rrd = JaxbUtils.unmarshal(RRDv3.class, new File("src/test/resources/rrd-dump-aberrant-behavior-detection.xml"));
Assert.assertNotNull(rrd);
}
use of org.opennms.netmgt.rrd.model.v3.RRDv3 in project opennms by OpenNMS.
the class RRDv3IT method testSamplesMultipleRRAs1.
/**
* Test samples for multiple RRAs (1)
*
* @throws Exception the exception
*/
@Test
public void testSamplesMultipleRRAs1() throws Exception {
File source = new File("src/test/resources/sample-counter-rras.xml");
RRDv3 rrd = JaxbUtils.unmarshal(RRDv3.class, source);
Assert.assertNotNull(rrd);
NavigableMap<Long, List<Double>> samples = rrd.generateSamples(rrd.getRras().get(1));
Assert.assertFalse(samples.isEmpty());
Assert.assertEquals(rrd.getRras().get(1).getRows().size(), samples.size());
}
use of org.opennms.netmgt.rrd.model.v3.RRDv3 in project opennms by OpenNMS.
the class RRDv3IT method testSamplesSingleRRA.
/**
* Test samples for a single RRA
*
* @throws Exception the exception
*/
@Test
public void testSamplesSingleRRA() throws Exception {
File source = new File("src/test/resources/sample-counter.xml");
RRDv3 rrd = JaxbUtils.unmarshal(RRDv3.class, source);
Assert.assertNotNull(rrd);
NavigableMap<Long, List<Double>> samples = rrd.generateSamples(rrd.getRras().get(0));
Assert.assertFalse(samples.isEmpty());
long ts = 1441748400L;
Double v1 = 600.0;
Double v2 = 2.0;
Assert.assertEquals(rrd.getRras().get(0).getRows().size(), samples.size());
for (Map.Entry<Long, List<Double>> s : samples.entrySet()) {
System.out.println(s);
Assert.assertEquals(2, s.getValue().size());
Assert.assertEquals(ts, (long) s.getKey());
Assert.assertEquals(v1, s.getValue().get(0));
Assert.assertEquals(v2, s.getValue().get(1));
ts += 300L;
v1 += 300.0 * v2;
v2 += 1.0;
}
}
use of org.opennms.netmgt.rrd.model.v3.RRDv3 in project opennms by OpenNMS.
the class RRDv3IT method testSamplesMultipleRRAs2.
/**
* Test samples for multiple RRAs (2)
*
* @throws Exception the exception
*/
@Test
public void testSamplesMultipleRRAs2() throws Exception {
File source = new File("src/test/resources/sample-counter-rras.xml");
RRDv3 rrd = JaxbUtils.unmarshal(RRDv3.class, source);
Assert.assertNotNull(rrd);
SortedMap<Long, List<Double>> samples = rrd.generateSamples();
Assert.assertFalse(samples.isEmpty());
int size = rrd.getRras().stream().mapToInt(r -> r.getRows().size()).sum();
// There are 3 timestamps that exist in both RRAs and the last one is incomplete
Assert.assertEquals(size - 3 - 1, samples.size());
}
use of org.opennms.netmgt.rrd.model.v3.RRDv3 in project opennms by OpenNMS.
the class RrdConvertUtilsIT method testConvertAdvRrdIntoJrb1.
/**
* Test convert Advanced RRD into JRB (1).
*
* @throws Exception the exception
*/
@Test(expected = IllegalArgumentException.class)
public void testConvertAdvRrdIntoJrb1() throws Exception {
RRDv3 rrd = JaxbUtils.unmarshal(RRDv3.class, new File("src/test/resources/rrd-dump-compute-ds.xml"));
RRDv1 jrb = RrdConvertUtils.convert(rrd);
Assert.assertNull(jrb);
}
Aggregations