Search in sources :

Example 1 with JnaPinger

use of org.opennms.netmgt.icmp.jna.JnaPinger in project opennms by OpenNMS.

the class IcmpDetectorTest method testDetectorSuccess.

@Test(timeout = 20000)
@IfProfileValue(name = "runPingTests", value = "true")
public void testDetectorSuccess() throws Exception {
    getPingerFactory().setInstance(0, true, new JnaPinger());
    m_icmpDetector = m_detectorFactory.createDetector();
    assertTrue("ICMP could not be detected on localhost", m_icmpDetector.isServiceDetected(InetAddress.getLocalHost()));
}
Also used : JnaPinger(org.opennms.netmgt.icmp.jna.JnaPinger) Test(org.junit.Test) IfProfileValue(org.springframework.test.annotation.IfProfileValue)

Example 2 with JnaPinger

use of org.opennms.netmgt.icmp.jna.JnaPinger in project opennms by OpenNMS.

the class IcmpDetectorTest method testDetectorFail.

@Test(timeout = 20000)
@IfProfileValue(name = "runPingTests", value = "true")
public void testDetectorFail() throws Exception {
    getPingerFactory().setInstance(0, true, new JnaPinger());
    m_icmpDetector = m_detectorFactory.createDetector();
    assertFalse("ICMP was incorrectly identified on " + InetAddressUtils.UNPINGABLE_ADDRESS.getHostAddress(), m_icmpDetector.isServiceDetected(InetAddressUtils.UNPINGABLE_ADDRESS));
}
Also used : JnaPinger(org.opennms.netmgt.icmp.jna.JnaPinger) Test(org.junit.Test) IfProfileValue(org.springframework.test.annotation.IfProfileValue)

Example 3 with JnaPinger

use of org.opennms.netmgt.icmp.jna.JnaPinger in project opennms by OpenNMS.

the class IcmpDetectorTest method testDetectorSuccessDscp.

@Test(timeout = 20000)
@IfProfileValue(name = "runPingTests", value = "true")
public void testDetectorSuccessDscp() throws Exception {
    getPingerFactory().setInstance(0x24, true, new JnaPinger());
    m_icmpDetector = m_detectorFactory.createDetector();
    assertTrue("ICMP could not be detected on localhost", m_icmpDetector.isServiceDetected(InetAddress.getLocalHost()));
}
Also used : JnaPinger(org.opennms.netmgt.icmp.jna.JnaPinger) Test(org.junit.Test) IfProfileValue(org.springframework.test.annotation.IfProfileValue)

Aggregations

Test (org.junit.Test)3 JnaPinger (org.opennms.netmgt.icmp.jna.JnaPinger)3 IfProfileValue (org.springframework.test.annotation.IfProfileValue)3