Search in sources :

Example 1 with SpringHelper

use of org.opennms.netmgt.jasper.helper.SpringHelper in project opennms by OpenNMS.

the class DefaultSpringConfiguration method createSpringHelper.

@Bean(name = "springHelper")
public SpringHelper createSpringHelper() {
    SpringHelper helper = new SpringHelper();
    helper.setApplicationContext(context);
    return helper;
}
Also used : SpringHelper(org.opennms.netmgt.jasper.helper.SpringHelper) Bean(org.springframework.context.annotation.Bean)

Example 2 with SpringHelper

use of org.opennms.netmgt.jasper.helper.SpringHelper 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

SpringHelper (org.opennms.netmgt.jasper.helper.SpringHelper)2 Test (org.junit.Test)1 MeasurementDataSource (org.opennms.netmgt.jasper.measurement.MeasurementDataSource)1 LocalMeasurementDataSourceWrapper (org.opennms.netmgt.jasper.measurement.local.LocalMeasurementDataSourceWrapper)1 Bean (org.springframework.context.annotation.Bean)1