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"));
}
Aggregations