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(); }
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()); }