Search in sources :

Example 1 with LocalMeasurementDataSourceWrapper

use of org.opennms.netmgt.jasper.measurement.local.LocalMeasurementDataSourceWrapper in project opennms by OpenNMS.

the class LocalMeasurementDataSourceWrapperTest method verifyContainsResultEvenIfResourceOrAttributeDoNotExist.

// See NMS-8337
@Test
public void verifyContainsResultEvenIfResourceOrAttributeDoNotExist() throws JRException {
    SpringHelper springHelper = MeasurementsHelper.getSpringHelper();
    MeasurementDataSource dataSource = (MeasurementDataSource) new LocalMeasurementDataSourceWrapper(springHelper.getMeasurementFetchStrategy(), springHelper.getExpressionEngine(), springHelper.getFilterEngine()).createDataSource(getQuery());
    Assert.assertEquals(2, dataSource.getRowCount());
    double[] data = new double[] { 13, 17 };
    while (dataSource.next()) {
        Assert.assertEquals(data[dataSource.getCurrentRow()], dataSource.getFieldValue("ifInErrors", dataSource.getCurrentRow()));
        Assert.assertEquals(Double.NaN, dataSource.getFieldValue("ifOutDiscards", dataSource.getCurrentRow()));
        Assert.assertEquals(Double.NaN, dataSource.getFieldValue("ifOutErrors", dataSource.getCurrentRow()));
    }
}
Also used : SpringHelper(org.opennms.netmgt.jasper.helper.SpringHelper) MeasurementDataSource(org.opennms.netmgt.jasper.measurement.MeasurementDataSource) LocalMeasurementDataSourceWrapper(org.opennms.netmgt.jasper.measurement.local.LocalMeasurementDataSourceWrapper) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 SpringHelper (org.opennms.netmgt.jasper.helper.SpringHelper)1 MeasurementDataSource (org.opennms.netmgt.jasper.measurement.MeasurementDataSource)1 LocalMeasurementDataSourceWrapper (org.opennms.netmgt.jasper.measurement.local.LocalMeasurementDataSourceWrapper)1