Search in sources :

Example 1 with ResourceReferenceDao

use of org.opennms.netmgt.dao.api.ResourceReferenceDao in project opennms by OpenNMS.

the class StatisticsReportsIT method hasReportLinkThatMatchDescription.

@Test
public void hasReportLinkThatMatchDescription() throws Exception {
    Date startOfTest = new Date();
    HibernateDaoFactory daoFactory = new HibernateDaoFactory(getPostgresService());
    ResourceReferenceDao resourceReferenceDao = daoFactory.getDao(ResourceReferenceDaoHibernate.class);
    StatisticsReportDao statisticsReportDao = daoFactory.getDao(StatisticsReportDaoHibernate.class);
    StatisticsReport report = new StatisticsReport();
    report.setName("Top10_Response_Hourly");
    report.setDescription("Hourly Top 10 responses across all nodes");
    report.setStartDate(new Date());
    report.setEndDate(new Date());
    report.setJobStartedDate(new Date());
    report.setJobCompletedDate(new Date());
    report.setPurgeDate(new Date());
    ResourceReference resource = new ResourceReference();
    resource.setResourceId("node1");
    resourceReferenceDao.save(resource);
    StatisticsReportData data = new StatisticsReportData();
    data.setReport(report);
    data.setResource(resource);
    data.setValue(4.0);
    report.addData(data);
    statisticsReportDao.save(report);
    await().atMost(1, MINUTES).pollInterval(5, SECONDS).until(DaoUtils.findMatchingCallable(statisticsReportDao, new CriteriaBuilder(StatisticsReport.class).ge("startDate", startOfTest).toCriteria()), notNullValue());
    m_driver.navigate().refresh();
    assertNotNull(findElementByLink("Hourly Top 10 responses across all nodes"));
}
Also used : StatisticsReportDao(org.opennms.netmgt.dao.api.StatisticsReportDao) CriteriaBuilder(org.opennms.core.criteria.CriteriaBuilder) HibernateDaoFactory(org.opennms.smoketest.utils.HibernateDaoFactory) StatisticsReport(org.opennms.netmgt.model.StatisticsReport) StatisticsReportData(org.opennms.netmgt.model.StatisticsReportData) ResourceReferenceDao(org.opennms.netmgt.dao.api.ResourceReferenceDao) ResourceReference(org.opennms.netmgt.model.ResourceReference) Date(java.util.Date) Test(org.junit.Test)

Aggregations

Date (java.util.Date)1 Test (org.junit.Test)1 CriteriaBuilder (org.opennms.core.criteria.CriteriaBuilder)1 ResourceReferenceDao (org.opennms.netmgt.dao.api.ResourceReferenceDao)1 StatisticsReportDao (org.opennms.netmgt.dao.api.StatisticsReportDao)1 ResourceReference (org.opennms.netmgt.model.ResourceReference)1 StatisticsReport (org.opennms.netmgt.model.StatisticsReport)1 StatisticsReportData (org.opennms.netmgt.model.StatisticsReportData)1 HibernateDaoFactory (org.opennms.smoketest.utils.HibernateDaoFactory)1