Search in sources :

Example 1 with ReportParameters

use of org.opennms.api.reporting.parameter.ReportParameters in project opennms by OpenNMS.

the class DefaultSchedulerServiceIT method setUp.

@BeforeClass
public static void setUp() {
    MockLogAppender.setupLogging();
    m_criteria = new ReportParameters();
    m_criteria.setReportId(REPORT_ID);
}
Also used : ReportParameters(org.opennms.api.reporting.parameter.ReportParameters) BeforeClass(org.junit.BeforeClass)

Example 2 with ReportParameters

use of org.opennms.api.reporting.parameter.ReportParameters in project opennms by OpenNMS.

the class DefaultParameterConversionServiceTest method testDefaultDateConversion.

@Test
public void testDefaultDateConversion() {
    ReportParameters parameters = m_conversionService.convert(m_dao.getParameters(ID));
    Calendar cal = Calendar.getInstance();
    cal.set(Calendar.HOUR_OF_DAY, 23);
    cal.set(Calendar.MINUTE, 59);
    cal.set(Calendar.SECOND, 0);
    cal.set(Calendar.MILLISECOND, 0);
    System.out.println("test date " + cal.getTime().toString());
    cal.add(Calendar.DATE, -1);
    Date configDate = parameters.getDateParms().get(0).getDate();
    assertEquals(0, configDate.compareTo(cal.getTime()));
}
Also used : ReportParameters(org.opennms.api.reporting.parameter.ReportParameters) Calendar(java.util.Calendar) Date(java.util.Date) Test(org.junit.Test)

Example 3 with ReportParameters

use of org.opennms.api.reporting.parameter.ReportParameters in project opennms by OpenNMS.

the class DefaultParameterConversionServiceTest method testModifiedDateConversion.

@Test
public void testModifiedDateConversion() {
    ReportParameters parameters = m_conversionService.convert(m_dao.getParameters(ID));
    Calendar cal = Calendar.getInstance();
    cal.add(Calendar.MONTH, -1);
    cal.set(Calendar.HOUR_OF_DAY, 0);
    cal.set(Calendar.MINUTE, 0);
    cal.set(Calendar.SECOND, 0);
    cal.set(Calendar.MILLISECOND, 0);
    ReportDateParm dateParm = parameters.getDateParms().get(0);
    dateParm.setCount(1);
    dateParm.setInterval("month");
    dateParm.setHours(0);
    dateParm.setMinutes(0);
    Map<String, Object> parmMap = parameters.getReportParms(ReportMode.SCHEDULED);
    Date storedDate = (Date) parmMap.get("endDate");
    assertEquals(0, storedDate.compareTo(cal.getTime()));
}
Also used : ReportParameters(org.opennms.api.reporting.parameter.ReportParameters) ReportDateParm(org.opennms.api.reporting.parameter.ReportDateParm) Calendar(java.util.Calendar) Date(java.util.Date) Test(org.junit.Test)

Example 4 with ReportParameters

use of org.opennms.api.reporting.parameter.ReportParameters in project opennms by OpenNMS.

the class JasperReportServiceGetParametersTest method readPropertiesOfPropertyTestReportTest.

@Test
public void readPropertiesOfPropertyTestReportTest() throws ReportException {
    String id = "parameter-test";
    assertNotNull(service.getParameters(id));
    ReportParameters params = service.getParameters(id);
    assertEquals(7, params.getReportParms().size());
}
Also used : ReportParameters(org.opennms.api.reporting.parameter.ReportParameters) Test(org.junit.Test)

Example 5 with ReportParameters

use of org.opennms.api.reporting.parameter.ReportParameters in project opennms by OpenNMS.

the class JasperReportServiceGetParametersTest method readPropertiesOfPropertyTestReportFromRESTRepoTest.

@Test
public void readPropertiesOfPropertyTestReportFromRESTRepoTest() throws ReportException {
    String id = "REMOTE_parameterTestJasperReport";
    assertNotNull(service.getParameters(id));
    ReportParameters params = service.getParameters(id);
    assertEquals(7, params.getReportParms().size());
}
Also used : ReportParameters(org.opennms.api.reporting.parameter.ReportParameters) Test(org.junit.Test)

Aggregations

ReportParameters (org.opennms.api.reporting.parameter.ReportParameters)14 Test (org.junit.Test)12 ReportStringParm (org.opennms.api.reporting.parameter.ReportStringParm)4 Calendar (java.util.Calendar)3 Date (java.util.Date)2 ReportDateParm (org.opennms.api.reporting.parameter.ReportDateParm)2 ReportIntParm (org.opennms.api.reporting.parameter.ReportIntParm)2 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 BeforeClass (org.junit.BeforeClass)1 ReportDoubleParm (org.opennms.api.reporting.parameter.ReportDoubleParm)1 ReportFloatParm (org.opennms.api.reporting.parameter.ReportFloatParm)1 DefaultTime (org.opennms.netmgt.config.reporting.DefaultTime)1 Parameters (org.opennms.netmgt.config.reporting.Parameters)1 ParameterConversionService (org.opennms.reporting.core.svclayer.ParameterConversionService)1