mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/comms/TestCommsMgrImpl.java
@Test
    public void testRemoteLinkStatusChange()
    {
        // Mini test setup
        m_SUT.getLinksAsync(systemId1);
        Event link = mockGetLayersResponse(systemId1, "link");
        
        m_EventHelperComms.handleEvent(link);
        
        Event layerStatusEvent = mockGetStatusResponse(systemId1, CustomCommsTypes.LinkStatus.OK);
        Event remoteLayerStatusChanged = mockEventLinkStatusChanged(systemId1, LinkStatus.LOST);

        m_EventHelperLink.handleEvent(layerStatusEvent);
        m_EventHelper.handleEvent(remoteLayerStatusChanged);

        List<CommsLayerLinkModelImpl> links = m_SUT.getLinksAsync(systemId1);
        assertThat(links.get(0).getStatus(), is(LinkLayer.LinkStatus.LOST)); 
        
        m_EventHelper.handleEvent(remoteLayerStatusChanged);
        remoteLayerStatusChanged = mockEventLinkStatusChanged(systemId1, LinkStatus.OK);
        m_EventHelper.handleEvent(remoteLayerStatusChanged);
        links = m_SUT.getLinksAsync(systemId1);
        assertThat(links.get(0).getStatus(), is(LinkLayer.LinkStatus.OK));    
        
        ArgumentCaptor<Event> captor = ArgumentCaptor.forClass(Event.class);
        //verify push event for get status response
        verify(m_EventAdmin, times(5)).postEvent(captor.capture());
        assertThat(captor.getValue().getTopic(), is(CommsMgr.TOPIC_COMMS_LAYER_UPDATED));
    }
/**
     * Verify proper handling of remote link status change event.
     */
Verify proper handling of remote link status change event.
Verify proper handling of remote link status change event .
@Test
    public void testRemoteLinkStatusChange()
    {
        m_SUT.getLinksAsync(systemId1);
        Event link = mockGetLayersResponse(systemId1, "link");
        m_EventHelperComms.handleEvent(link);
        Event layerStatusEvent = mockGetStatusResponse(systemId1, CustomCommsTypes.LinkStatus.OK);
        Event remoteLayerStatusChanged = mockEventLinkStatusChanged(systemId1, LinkStatus.LOST);
        m_EventHelperLink.handleEvent(layerStatusEvent);
        m_EventHelper.handleEvent(remoteLayerStatusChanged);
        List<CommsLayerLinkModelImpl> links = m_SUT.getLinksAsync(systemId1);
        assertThat(links.get(0).getStatus(), is(LinkLayer.LinkStatus.LOST)); 
        m_EventHelper.handleEvent(remoteLayerStatusChanged);
        remoteLayerStatusChanged = mockEventLinkStatusChanged(systemId1, LinkStatus.OK);
        m_EventHelper.handleEvent(remoteLayerStatusChanged);
        links = m_SUT.getLinksAsync(systemId1);
        assertThat(links.get(0).getStatus(), is(LinkLayer.LinkStatus.OK));    
        ArgumentCaptor<Event> captor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin, times(5)).postEvent(captor.capture());
        assertThat(captor.getValue().getTopic(), is(CommsMgr.TOPIC_COMMS_LAYER_UPDATED));
    }
@ Test public void testRemoteLinkStatusChange ( ) { m_SUT . getLinksAsync ( systemId1 ) ; Event link = mockGetLayersResponse ( systemId1 , "link" ) ; m_EventHelperComms . handleEvent ( link ) ; Event layerStatusEvent = mockGetStatusResponse ( systemId1 , CustomCommsTypes . LinkStatus . OK ) ; Event remoteLayerStatusChanged = mockEventLinkStatusChanged ( systemId1 , LinkStatus . LOST ) ; m_EventHelperLink . handleEvent ( layerStatusEvent ) ; m_EventHelper . handleEvent ( remoteLayerStatusChanged ) ; List < CommsLayerLinkModelImpl > links = m_SUT . getLinksAsync ( systemId1 ) ; assertThat ( links . get ( 0 ) . getStatus ( ) , is ( LinkLayer . LinkStatus . LOST ) ) ; m_EventHelper . handleEvent ( remoteLayerStatusChanged ) ; remoteLayerStatusChanged = mockEventLinkStatusChanged ( systemId1 , LinkStatus . OK ) ; m_EventHelper . handleEvent ( remoteLayerStatusChanged ) ; links = m_SUT . getLinksAsync ( systemId1 ) ; assertThat ( links . get ( 0 ) . getStatus ( ) , is ( LinkLayer . LinkStatus . OK ) ) ; ArgumentCaptor < Event > captor = ArgumentCaptor . forClass ( Event . class ) ; verify ( m_EventAdmin , times ( 5 ) ) . postEvent ( captor . capture ( ) ) ; assertThat ( captor . getValue ( ) . getTopic ( ) , is ( CommsMgr . TOPIC_COMMS_LAYER_UPDATED ) ) ; }
Verify proper handling of remote link status change event.
Verify proper handling of remote link status change event .
// Mini test setup //verify push event for get status response