@@ -0,0 +1,2403 @@
+package org.opennms.web.services;%0A%0Aimport static org.easymock.EasyMock.*;%0A%0Aimport org.easymock.IAnswer;%0Aimport org.opennms.netmgt.EventConstants;%0Aimport org.opennms.netmgt.capsd.EventUtils;%0Aimport org.opennms.netmgt.model.OnmsIpInterface;%0Aimport org.opennms.netmgt.model.OnmsMonitoredService;%0Aimport org.opennms.netmgt.model.OnmsNode;%0Aimport org.opennms.netmgt.model.OnmsServiceType;%0Aimport org.opennms.netmgt.utils.EventProxy;%0Aimport org.opennms.netmgt.utils.EventProxyException;%0Aimport org.opennms.netmgt.xml.event.Event;%0A%0Aimport junit.framework.TestCase;%0A%0Apublic class PollerServiceTest extends TestCase %7B%0A%09%0A%09DefaultPollerService m_pollerService;%0A%09EventProxy m_eventProxy;%0A%09%0A%09%0A%09%0A%09%0A%09@Override%0A%09protected void setUp() throws Exception %7B%0A%09%09m_eventProxy = createMock(EventProxy.class);%0A%09%09%0A%09%09m_pollerService = new DefaultPollerService();%0A%09%09m_pollerService.setEventProxy(m_eventProxy);%0A%09%7D%0A%0A%09public void testPoll() throws EventProxyException %7B%0A%09%09%0A%09%09final int expectedPolldId = 7;%0A%09%09%0A%09%09OnmsServiceType svcType = new OnmsServiceType();%0A%09%09svcType.setId(3);%0A%09%09svcType.setName(%22HTTP%22);%0A%09%09OnmsNode node = new OnmsNode();%0A%09%09node.setId(1);%0A%09%09OnmsIpInterface iface = new OnmsIpInterface(%22192.168.1.1%22, node);%0A%09%09iface.setIfIndex(1);%0A%09%09final OnmsMonitoredService monSvc = new OnmsMonitoredService(iface, svcType);%0A%0A%09%09m_eventProxy.send(isA(Event.class));%0A%09%09expectLastCall().andAnswer(new IAnswer%3CObject%3E() %7B%0A%0A%09%09%09public Object answer() throws Throwable %7B%0A%09%09%09%09Event event = (Event)getCurrentArguments()%5B0%5D;%0A%09%09%09%09assertEquals(%22Incorrect uei for demandPollService event%22, EventConstants.DEMAND_POLL_SERVICE_EVENT_UEI, event.getUei());%0A%09%09%09%09assertEquals(%22Incorrect nodeid for demandPollService event%22, monSvc.getNodeId().longValue(), event.getNodeid());%0A%09%09%09%09assertEquals(%22Incorrect ipadr for demandPollService event%22, monSvc.getIpAddress(), event.getInterface());%0A%09%09%09%09assertEquals(%22Incorrect ifIndex for demandPollService event%22, monSvc.getIfIndex().toString(), event.getIfIndex());%0A%09%09%09%09assertEquals(%22Incorrect service for demandPollService event%22, monSvc.getServiceType().getName(), event.getService());%0A%09%09%09%09EventUtils.requireParm(event, EventConstants.PARM_DEMAND_POLL_ID);%0A%09%09%09%09assertEquals(expectedPolldId, EventUtils.getIntParm(event, EventConstants.PARM_DEMAND_POLL_ID, -1));%0A%09%09%09%09return null;%0A%09%09%09%7D%0A%09%09%09%0A%09%09%7D);%0A%09%09%0A%09%09replay(m_eventProxy);%0A%09%09%0A%09%09m_pollerService.poll(monSvc, expectedPolldId);%0A%09%09%0A%09%09verify(m_eventProxy);%0A%09%7D%0A%0A%7D%0A%0A

move opennms-webapp-ng to opennms-webapp