コード例 #1
0
  public void testSetInitialPollTime() throws Exception {

    Date start = new Date(1200000000000L);

    setRegistered();

    anticipateAfterPropertiesSet();

    int polledServiceId = pollConfig().getFirstId();

    anticipateSetInitialPollTime();

    anticipateGetServicePollState();

    //      expect(m_settings.getMonitorId()).andReturn(1).atLeastOnce();

    //      anticipateNewConfig(pollConfig());

    //      expect(m_backEnd.pollerStarting(1, getPollerDetails())).andReturn(true);

    m_mock.replayAll();

    m_frontEnd.afterPropertiesSet();

    m_frontEnd.setInitialPollTime(polledServiceId, start);

    assertEquals(start, m_frontEnd.getServicePollState(polledServiceId).getNextPollTime());

    m_mock.verifyAll();
  }
コード例 #2
0
  private void testAfterPropertiesSetWithRegisteredId(Integer registeredId) throws Exception {
    setRegisteredId(registeredId);

    anticipateAfterPropertiesSet();

    m_mock.replayAll();

    m_frontEnd.afterPropertiesSet();

    m_mock.verifyAll();
  }
コード例 #3
0
  public void testNotYetRegistered() throws Exception {
    setRegisteredId(null);

    anticipateAfterPropertiesSet();

    m_mock.replayAll();

    m_frontEnd.afterPropertiesSet();

    assertFalse(m_frontEnd.isRegistered());

    m_mock.verifyAll();
  }
コード例 #4
0
  public void testAlreadyRegistered() throws Exception {

    setRegistered();

    anticipateAfterPropertiesSet();

    m_mock.replayAll();

    m_frontEnd.afterPropertiesSet();

    assertTrue(m_frontEnd.isRegistered());

    m_mock.verifyAll();
  }
コード例 #5
0
  public void testConfigCheck() throws Exception {

    setRegistered();

    anticipateAfterPropertiesSet();

    anticipateCheckConfig();

    m_mock.replayAll();

    m_frontEnd.afterPropertiesSet();

    m_frontEnd.checkConfig();

    m_mock.verifyAll();
  }
コード例 #6
0
  public void testRegisterNewMonitor() throws Exception {

    anticipateAfterPropertiesSet();

    anticiapateRegister();

    m_mock.replayAll();

    m_frontEnd.afterPropertiesSet();

    assertFalse(m_frontEnd.isRegistered());

    m_frontEnd.register("OAK");

    assertTrue(m_frontEnd.isRegistered());

    m_mock.verifyAll();
  }
コード例 #7
0
  public void testStop() throws Exception {

    setRegistered();

    anticipateAfterPropertiesSet();

    anticipateStop();

    m_mock.replayAll();

    m_frontEnd.afterPropertiesSet();

    assertTrue(m_frontEnd.isStarted());

    m_frontEnd.stop();

    assertFalse(m_frontEnd.isStarted());

    m_mock.verifyAll();
  }
コード例 #8
0
  public void testPoll() throws Exception {

    setRegistered();

    anticipateAfterPropertiesSet();

    anticipatePollService();

    anticipateGetServicePollState();

    m_mock.replayAll();

    m_frontEnd.afterPropertiesSet();

    m_frontEnd.pollService(pollConfig().getFirstId());

    ServicePollState pollState = m_frontEnd.getServicePollState(pollConfig().getFirstId());

    m_mock.verifyAll();

    assertEquals(PollStatus.SERVICE_AVAILABLE, pollState.getLastPoll().getStatusCode());
  }
コード例 #9
0
  public void testDisconnect() throws Exception {
    setRegistered();

    anticipateAfterPropertiesSet();

    setMonitorStatus(MonitorStatus.DISCONNECTED);

    anticipateCheckConfig();

    setMonitorStatus(MonitorStatus.STARTED);

    anticipateCheckConfig();

    m_mock.replayAll();

    m_frontEnd.afterPropertiesSet();

    m_frontEnd.checkConfig();

    m_frontEnd.checkConfig();

    m_mock.verifyAll();
  }