@Test public void dwoNotifyConfigChangeCallsDoNotifyConfigChange() throws InterruptedException { m_adapter.nodeConfigChanged(1); Assert.assertEquals(1, m_adapter.getOperationQueue().getOperationQueueForNode(1).size()); Thread.sleep(3000); Assert.assertEquals(0, m_adapter.getOperationQueue().getOperationQueueForNode(1).size()); }
@Test public void dwoUpdateNodeCallsDoUpdateNode() throws InterruptedException { m_adapter.updateNode(1); Assert.assertEquals(1, m_adapter.getOperationQueue().getOperationQueueForNode(1).size()); Thread.sleep(3000); Assert.assertEquals(0, m_adapter.getOperationQueue().getOperationQueueForNode(1).size()); }
@Test public void dwoUpdateEndPoint1EndPoint2Exists() { expect(m_nodeLinkService.getNodeId(END_POINT_1)).andStubReturn(1); expect(m_nodeLinkService.getNodeId(END_POINT_2)).andStubReturn(2); m_nodeLinkService.createLink(1, 2); replay(); m_adapter.setLinkMatchResolver(m_matchResolver); m_adapter.setNodeLinkService(m_nodeLinkService); m_adapter.doAddNode(1); verify(); }
@Test public void dwoTestUpdateEndPoint1() { expect(m_nodeLinkService.getNodeId(END_POINT_1)).andStubReturn(1); // we make node2 return null the first time so when node1 is added it appear node2 is not there expect(m_nodeLinkService.getNodeId(END_POINT_2)).andReturn(null).andStubReturn(2); m_nodeLinkService.createLink(1, 2); replay(); m_adapter.setLinkMatchResolver(m_matchResolver); m_adapter.setNodeLinkService(m_nodeLinkService); m_adapter.doAddNode(1); m_adapter.doAddNode(2); verify(); }
@Test public void dwoDataLinkFailedEventEndPoint1() { expect(m_nodeLinkService.getNodeId(END_POINT_1)).andStubReturn(1); expect(m_nodeLinkService.getNodeId(END_POINT_2)).andStubReturn(2); m_nodeLinkService.updateLinkStatus(1, 2, FAILED_STATUS); replay(); EventBuilder eventBuilder = new EventBuilder(EventConstants.DATA_LINK_FAILED_EVENT_UEI, null); eventBuilder.setParam("endPoint1", END_POINT_1); eventBuilder.setParam("endPoint2", END_POINT_2); m_adapter.setLinkMatchResolver(m_matchResolver); m_adapter.setNodeLinkService(m_nodeLinkService); m_adapter.dataLinkFailed(eventBuilder.getEvent()); verify(); }