Search in sources :

Example 41 with PollStatus

use of org.opennms.netmgt.poller.PollStatus in project opennms by OpenNMS.

the class MailTransportMonitorTest method readOnlyTest.

/*
     * requires a gmail account that has a message in the INBOX subject: READTEST
     */
@Test
@Ignore("requires real mail server")
public void readOnlyTest() throws Exception {
    m_params.put("timeout", "3000");
    m_params.put("retry", "1");
    m_params.put("strict-timeouts", "true");
    m_params.put("mail-transport-test", "    <mail-transport-test >\n" + "      <mail-test>\n" + "        <readmail-test attempt-interval=\"2000\" mail-folder=\"INBOX\" subject-match=\"READTEST\" >\n" + "          <readmail-host host=\"imap.gmail.com\" port=\"993\">\n" + "            <readmail-protocol ssl-enable=\"true\" transport=\"imaps\" />\n" + "          </readmail-host>\n" + "          <user-auth user-name=\"username\" password=\"password\"/>\n" + "        </readmail-test>\n" + "      </mail-test>\n" + "    </mail-transport-test>\n");
    PollStatus status = m_monitor.poll(getMailService("127.0.0.1"), m_params);
    assertEquals(PollStatus.SERVICE_AVAILABLE, status.getStatusCode());
}
Also used : PollStatus(org.opennms.netmgt.poller.PollStatus) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 42 with PollStatus

use of org.opennms.netmgt.poller.PollStatus in project opennms by OpenNMS.

the class NetScalerGroupHealthMonitorTest method testAvailable.

@Test
public void testAvailable() throws Exception {
    PollStatus status = monitor.poll(createMonitor(), createBasicParams());
    Assert.assertTrue(status.isAvailable());
}
Also used : PollStatus(org.opennms.netmgt.poller.PollStatus) Test(org.junit.Test)

Example 43 with PollStatus

use of org.opennms.netmgt.poller.PollStatus in project opennms by OpenNMS.

the class HostResourceSWRunMonitorTest method testMaxServices.

@Test
public void testMaxServices() throws Exception {
    Map<String, Object> parameters = createBasicParams();
    parameters.put("max-services", "5");
    PollStatus status = monitor.poll(createMonitor(), parameters);
    Assert.assertTrue(status.isAvailable());
}
Also used : PollStatus(org.opennms.netmgt.poller.PollStatus) Test(org.junit.Test)

Example 44 with PollStatus

use of org.opennms.netmgt.poller.PollStatus in project opennms by OpenNMS.

the class HostResourceSWRunMonitorTest method testUnknownService.

@Test
public void testUnknownService() throws Exception {
    Map<String, Object> parameters = createBasicParams();
    parameters.put("service-name", "this service does not exist!");
    PollStatus status = monitor.poll(createMonitor(), parameters);
    Assert.assertFalse(status.isAvailable());
    log(status.getReason());
}
Also used : PollStatus(org.opennms.netmgt.poller.PollStatus) Test(org.junit.Test)

Example 45 with PollStatus

use of org.opennms.netmgt.poller.PollStatus in project opennms by OpenNMS.

the class HostResourceSWRunMonitorTest method testMinServices.

@Test
public void testMinServices() throws Exception {
    Map<String, Object> parameters = createBasicParams();
    parameters.put("min-services", "2");
    PollStatus status = monitor.poll(createMonitor(), parameters);
    Assert.assertTrue(status.isAvailable());
}
Also used : PollStatus(org.opennms.netmgt.poller.PollStatus) Test(org.junit.Test)

Aggregations

PollStatus (org.opennms.netmgt.poller.PollStatus)209 Test (org.junit.Test)98 MonitoredService (org.opennms.netmgt.poller.MonitoredService)57 ServiceMonitor (org.opennms.netmgt.poller.ServiceMonitor)53 InetAddress (java.net.InetAddress)40 HashMap (java.util.HashMap)36 MockMonitoredService (org.opennms.netmgt.poller.mock.MockMonitoredService)36 ConcurrentSkipListMap (java.util.concurrent.ConcurrentSkipListMap)32 TimeoutTracker (org.opennms.core.utils.TimeoutTracker)29 JUnitHttpServer (org.opennms.core.test.http.annotations.JUnitHttpServer)18 IOException (java.io.IOException)17 Socket (java.net.Socket)17 InputStreamReader (java.io.InputStreamReader)16 SnmpAgentConfig (org.opennms.netmgt.snmp.SnmpAgentConfig)14 SnmpValue (org.opennms.netmgt.snmp.SnmpValue)14 BufferedReader (java.io.BufferedReader)13 SnmpObjId (org.opennms.netmgt.snmp.SnmpObjId)12 InterruptedIOException (java.io.InterruptedIOException)11 ConnectException (java.net.ConnectException)11 NoRouteToHostException (java.net.NoRouteToHostException)11