use of org.opennms.netmgt.provision.DetectFuture in project opennms by OpenNMS.
the class CitrixDetectorTest method testDetectorSuccess.
@Test(timeout = 20000)
public void testDetectorSuccess() throws Exception {
m_detector.setPort(m_server.getLocalPort());
m_detector.setIdleTime(10000);
m_detector.init();
// assertTrue(m_detector.isServiceDetected(m_server.getInetAddress()));
DetectFuture future = m_detector.isServiceDetected(m_server.getInetAddress());
assertNotNull(future);
future.awaitForUninterruptibly();
assertTrue(future.isServiceDetected());
}
use of org.opennms.netmgt.provision.DetectFuture in project opennms by OpenNMS.
the class CitrixDetectorTest method testDetectorFailWrongPort.
@Test(timeout = 20000)
public void testDetectorFailWrongPort() throws Exception {
m_detector.setPort(65535);
m_detector.setIdleTime(10000);
m_detector.init();
// assertFalse(m_detector.isServiceDetected(m_server.getInetAddress()));
DetectFuture future = m_detector.isServiceDetected(m_server.getInetAddress());
assertNotNull(future);
future.awaitForUninterruptibly();
assertFalse(future.isServiceDetected());
}
use of org.opennms.netmgt.provision.DetectFuture in project opennms by OpenNMS.
the class HttpsDetectorTest method doCheck.
/**
* @param serviceDetected
* @return
* @throws InterruptedException
*/
private boolean doCheck(DetectFuture serviceDetected) throws InterruptedException {
DetectFuture future = serviceDetected;
future.awaitFor();
return future.isServiceDetected();
}
use of org.opennms.netmgt.provision.DetectFuture in project opennms by OpenNMS.
the class ImapDetectorTest method testDetectorFailUnexpectedLogoutResponse.
@Test(timeout = 20000)
public void testDetectorFailUnexpectedLogoutResponse() throws Exception {
m_server = new SimpleServer() {
@Override
public void onInit() {
setBanner("* NOT OK THIS IS A BANNER FOR IMAP");
addResponseHandler(contains("LOGOUT"), singleLineRequest("* NOT OK"));
}
};
m_server.init();
m_server.startServer();
try {
m_detector.setPort(m_server.getLocalPort());
// assertFalse(m_detector.isServiceDetected(m_server.getInetAddress()));
DetectFuture future = m_detector.isServiceDetected(m_server.getInetAddress());
assertNotNull(future);
future.awaitForUninterruptibly();
assertFalse(future.isServiceDetected());
} finally {
m_server.stopServer();
}
}
use of org.opennms.netmgt.provision.DetectFuture in project opennms by OpenNMS.
the class ImapDetectorTest method testDetectorFailUnexpectedBanner.
@Test(timeout = 20000)
public void testDetectorFailUnexpectedBanner() throws Exception {
m_server = new SimpleServer() {
@Override
public void onInit() {
setBanner("* NOT OK THIS IS A BANNER FOR IMAP");
}
};
m_server.init();
m_server.startServer();
try {
m_detector.setPort(m_server.getLocalPort());
// assertFalse(m_detector.isServiceDetected(m_server.getInetAddress()));
DetectFuture future = m_detector.isServiceDetected(m_server.getInetAddress());
assertNotNull(future);
future.awaitForUninterruptibly();
assertFalse(future.isServiceDetected());
} finally {
m_server.stopServer();
}
}
Aggregations