use of org.opennms.netmgt.poller.PollStatus in project opennms by OpenNMS.
the class DnsMonitorIT method testDNSIPV4Response.
@Test
public void testDNSIPV4Response() throws UnknownHostException {
final Map<String, Object> m = new ConcurrentSkipListMap<String, Object>();
final ServiceMonitor monitor = new DnsMonitor();
final MonitoredService svc = MonitorTestUtils.getMonitoredService(99, addr("127.0.0.1"), "DNS");
m.put("port", "9153");
m.put("retry", "1");
m.put("timeout", "3000");
m.put("lookup", "example.com");
final PollStatus status = monitor.poll(svc, m);
MockUtil.println("Reason: " + status.getReason());
assertEquals(PollStatus.SERVICE_AVAILABLE, status.getStatusCode());
}
use of org.opennms.netmgt.poller.PollStatus in project opennms by OpenNMS.
the class DiskUsageMonitorTest method testInvalidMatchTypeParameter.
@Test(expected = RuntimeException.class)
public void testInvalidMatchTypeParameter() throws Exception {
Map<String, Object> parameters = createBasicParams();
parameters.put("match-type", "invalid");
PollStatus status = monitor.poll(createMonitor(), parameters);
Assert.assertFalse(status.isAvailable());
}
use of org.opennms.netmgt.poller.PollStatus in project opennms by OpenNMS.
the class DiskUsageMonitorTest method testInvalidDiskRegex.
@Test
public void testInvalidDiskRegex() throws Exception {
Map<String, Object> parameters = createBasicParams();
parameters.put("disk", "^[A-Z:");
parameters.put("match-type", "regex");
PollStatus status = monitor.poll(createMonitor(), parameters);
Assert.assertFalse(status.isAvailable());
Assert.assertThat(status.getReason(), containsString("Invalid SNMP Criteria: Unclosed character class"));
}
use of org.opennms.netmgt.poller.PollStatus in project opennms by OpenNMS.
the class DiskUsageMonitorTest method testAllDisks.
@Test
public void testAllDisks() throws Exception {
Map<String, Object> parameters = createBasicParams();
parameters.put("match-type", "startswith");
parameters.put("require-type", "all");
PollStatus status = monitor.poll(createMonitor(), parameters);
Assert.assertFalse(status.isAvailable());
}
use of org.opennms.netmgt.poller.PollStatus in project opennms by OpenNMS.
the class LocationDataServiceIT method getAvailable.
private PollStatus getAvailable(final Date date) {
final PollStatus ps = PollStatus.available();
ps.setTimestamp(date);
return ps;
}
Aggregations