Пример #1
0
  @Test(timeout = 90000)
  public void testDetectorFailWrongPort() throws Exception {
    m_detector.setPort(2000);
    m_server = createServer(serverOKResponse);

    assertFalse(doCheck(m_detector.isServiceDetected(m_server.getInetAddress())));
  }
Пример #2
0
  @Test(timeout = 90000)
  public void testDetectorSuccess() throws Exception {
    m_server = createServer(serverOKResponse);

    m_detector.setPort(m_server.getLocalPort());
    m_detector.init();
    assertTrue(doCheck(m_detector.isServiceDetected(m_server.getInetAddress())));
  }
Пример #3
0
  @Test(timeout = 90000)
  public void testDetectorSucessCheckCodeTrue() throws Exception {
    m_detector.setCheckRetCode(true);
    m_detector.setUrl("http://localhost/");
    m_detector.init();
    m_detector.setIdleTime(1000);
    m_server = createServer(getServerOKResponse());
    m_detector.setPort(m_server.getLocalPort());

    assertTrue(doCheck(m_detector.isServiceDetected(m_server.getInetAddress())));
  }
Пример #4
0
  @Test(timeout = 90000)
  public void testDetectorMaxRetCode600() throws Exception {
    m_detector.setCheckRetCode(true);
    m_detector.setMaxRetCode(600);
    m_detector.init();

    m_server = createServer(getServerOKResponse());
    m_detector.setPort(m_server.getLocalPort());

    assertTrue(doCheck(m_detector.isServiceDetected(m_server.getInetAddress())));
  }
Пример #5
0
  @Test(timeout = 90000)
  public void testDetectorSucessMaxRetCode399() throws Exception {
    m_detector.setCheckRetCode(true);
    m_detector.setUrl("/blog");
    m_detector.setMaxRetCode(399);

    m_server = createServer(serverOKResponse);
    m_detector.setPort(m_server.getLocalPort());
    m_detector.init();
    assertTrue(doCheck(m_detector.isServiceDetected(m_server.getInetAddress())));
  }
Пример #6
0
  @Test(timeout = 90000)
  public void testDetectorFailMaxRetCodeBelow200() throws Exception {
    m_detector.setCheckRetCode(true);
    m_detector.setUrl("/blog");
    m_detector.setMaxRetCode(199);
    m_detector.init();

    m_server = createServer(getServerOKResponse());
    m_detector.setPort(m_server.getLocalPort());

    assertFalse(doCheck(m_detector.isServiceDetected(m_server.getInetAddress())));
  }