use of org.opennms.netmgt.poller.mock.MockMonitoredService in project opennms by OpenNMS.
the class DNSResolutionMonitorIT method testLookup.
@Test
public void testLookup() throws Exception {
MockMonitoredService lookup = new MockMonitoredService(1, "no-such-name.example.com", InetAddress.getLocalHost(), "RESOLVE");
DNSResolutionMonitor monitor = new DNSResolutionMonitor();
Map<String, Object> parms = new HashMap<String, Object>();
parms.put(PARM_RESOLUTION_TYPE, PARM_RESOLUTION_TYPE_EITHER);
parms.put(PARM_LOOKUP, "wipv6day.opennms.org");
assertEquals(PollStatus.available(), monitor.poll(lookup, parms));
}
use of org.opennms.netmgt.poller.mock.MockMonitoredService in project opennms by OpenNMS.
the class DNSResolutionMonitorIT method pollIPv4CNAME.
@Test
public void pollIPv4CNAME() throws Exception {
MockMonitoredService cname = new MockMonitoredService(1, "www.opennms.org", InetAddress.getLocalHost(), "RESOLVE");
DNSResolutionMonitor monitor = new DNSResolutionMonitor();
Map<String, Object> params = new HashMap<>();
params.put(PARM_RECORD_TYPES, PARM_RECORD_TYPE_CNAME);
params.put(PARM_NAMESERVER, "[::1]:9153");
assertEquals(PollStatus.available(), monitor.poll(cname, params));
}
use of org.opennms.netmgt.poller.mock.MockMonitoredService in project opennms by OpenNMS.
the class DNSResolutionMonitorIT method pollIPv4andIPv6.
@Test
public void pollIPv4andIPv6() throws Exception {
MockMonitoredService dual = new MockMonitoredService(1, "wipv6day.opennms.org", InetAddress.getLocalHost(), "RESOLVE");
DNSResolutionMonitor monitor = new DNSResolutionMonitor();
Map<String, Object> v4Parms = new HashMap<>();
v4Parms.put(PARM_RESOLUTION_TYPE, PARM_RESOLUTION_TYPE_V4);
v4Parms.put(PARM_NAMESERVER, "[::1]:9153");
Map<String, Object> v6Parms = new HashMap<>();
v6Parms.put(PARM_RESOLUTION_TYPE, PARM_RESOLUTION_TYPE_V6);
v6Parms.put(PARM_NAMESERVER, "[::1]:9153");
Map<String, Object> bothParms = new HashMap<>();
bothParms.put(PARM_RESOLUTION_TYPE, PARM_RESOLUTION_TYPE_BOTH);
bothParms.put(PARM_NAMESERVER, "[::1]:9153");
Map<String, Object> eitherParms = new HashMap<>();
eitherParms.put(PARM_RESOLUTION_TYPE, PARM_RESOLUTION_TYPE_EITHER);
eitherParms.put(PARM_NAMESERVER, "[::1]:9153");
assertEquals(PollStatus.available(), monitor.poll(dual, v4Parms));
assertEquals(PollStatus.available(), monitor.poll(dual, v6Parms));
assertEquals(PollStatus.available(), monitor.poll(dual, bothParms));
assertEquals(PollStatus.available(), monitor.poll(dual, eitherParms));
}
use of org.opennms.netmgt.poller.mock.MockMonitoredService in project opennms by OpenNMS.
the class DNSResolutionMonitorIT method pollIPv4Only.
@Test
public void pollIPv4Only() throws Exception {
MockMonitoredService v4only = new MockMonitoredService(1, "choopa-ipv4.opennms.org", InetAddress.getLocalHost(), "RESOLVE");
DNSResolutionMonitor monitor = new DNSResolutionMonitor();
Map<String, Object> v4Parms = new HashMap<>();
v4Parms.put(PARM_RESOLUTION_TYPE, PARM_RESOLUTION_TYPE_V4);
v4Parms.put(PARM_NAMESERVER, "[::1]:9153");
Map<String, Object> v6Parms = new HashMap<>();
v6Parms.put(PARM_RESOLUTION_TYPE, PARM_RESOLUTION_TYPE_V6);
v6Parms.put(PARM_NAMESERVER, "[::1]:9153");
Map<String, Object> bothParms = new HashMap<>();
bothParms.put(PARM_RESOLUTION_TYPE, PARM_RESOLUTION_TYPE_BOTH);
bothParms.put(PARM_NAMESERVER, "[::1]:9153");
Map<String, Object> eitherParms = new HashMap<>();
eitherParms.put(PARM_RESOLUTION_TYPE, PARM_RESOLUTION_TYPE_EITHER);
eitherParms.put(PARM_NAMESERVER, "[::1]:9153");
assertEquals(PollStatus.available(), monitor.poll(v4only, v4Parms));
assertEquals(PollStatus.unavailable(), monitor.poll(v4only, v6Parms));
assertEquals(PollStatus.unavailable(), monitor.poll(v4only, bothParms));
assertEquals(PollStatus.available(), monitor.poll(v4only, eitherParms));
}
use of org.opennms.netmgt.poller.mock.MockMonitoredService in project opennms by OpenNMS.
the class SeleniumMonitorTest method testPollStatusNotNull.
// Requires Firefox to be installed to run
@Test
@JUnitHttpServer(port = 10342, webapps = @Webapp(context = "/opennms", path = "src/test/resources/testWar"))
public void testPollStatusNotNull() throws UnknownHostException {
MonitoredService monSvc = new MockMonitoredService(1, "papajohns", InetAddressUtils.addr("213.187.33.164"), "PapaJohnsSite");
Map<String, Object> params = new HashMap<String, Object>();
params.put("selenium-test", "SeleniumGroovyTest.groovy");
params.put("base-url", "localhost");
params.put("port", "10342");
SeleniumMonitor ajaxPSM = new SeleniumMonitor();
PollStatus pollStatus = ajaxPSM.poll(monSvc, params);
assertNotNull("PollStatus must not be null", pollStatus);
System.err.println("PollStatus message: " + pollStatus.getReason());
assertEquals(PollStatus.available(), pollStatus);
}
Aggregations