mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/comms/TestCommsMgrImpl.java
@Test
    public void testHandleIsActivatedResponse()
    {
        // Mini test setup
        m_SUT.getPhysicalsAsync(systemId1);
        m_SUT.getLinksAsync(systemId1);
        m_SUT.getTransportsAsync(systemId1);
        Event transport = mockGetLayersResponse(systemId1, "transport");
        Event link = mockGetLayersResponse(systemId1, "link");
        Event physical = mockGetLayersResponse(systemId1, "physical");
        
        m_EventHelperComms.handleEvent(transport);    
        m_EventHelperComms.handleEvent(link);
        m_EventHelperComms.handleEvent(physical);
        
        //test activate response after mini set up
        Event event = mockIsActivatedResponse(systemId1, true);
        m_EventHelperLink.handleEvent(event);
        
        List<CommsLayerLinkModelImpl> links = m_SUT.getLinksAsync(systemId1);
        assertThat(links.get(0).isActivated(), is(true)); 
        
        //test null case
        event = mockIsActivatedResponse(systemId1, null);
        try
        {
            m_EventHelperLink.handleEvent(event);
            ArgumentCaptor<Event> captor = ArgumentCaptor.forClass(Event.class);
            //verify push event for local link layer activate response
            verify(m_EventAdmin, times(5)).postEvent(captor.capture());
            assertThat(captor.getValue().getTopic(), is(CommsMgr.TOPIC_COMMS_LAYER_UPDATED));
        }
        catch(Exception e)
        {
            fail("Unexpected exception caught: " + e.getMessage());
        }
    }
/**
     * Test proper handling of IsActivated request for the link layer namespace.
     * Verify that the appropriate link layer from the comms stack is set with the correct isActivated value.
     */
Test proper handling of IsActivated request for the link layer namespace.
Verify that the appropriate link layer from the comms stack is set with the correct isActivated value.
Test proper handling of IsActivated request for the link layer namespace . Verify that the appropriate link layer from the comms stack is set with the correct isActivated value .
@Test
    public void testHandleIsActivatedResponse()
    {
        m_SUT.getPhysicalsAsync(systemId1);
        m_SUT.getLinksAsync(systemId1);
        m_SUT.getTransportsAsync(systemId1);
        Event transport = mockGetLayersResponse(systemId1, "transport");
        Event link = mockGetLayersResponse(systemId1, "link");
        Event physical = mockGetLayersResponse(systemId1, "physical");
        m_EventHelperComms.handleEvent(transport);    
        m_EventHelperComms.handleEvent(link);
        m_EventHelperComms.handleEvent(physical);
        Event event = mockIsActivatedResponse(systemId1, true);
        m_EventHelperLink.handleEvent(event);
        List<CommsLayerLinkModelImpl> links = m_SUT.getLinksAsync(systemId1);
        assertThat(links.get(0).isActivated(), is(true)); 
        event = mockIsActivatedResponse(systemId1, null);
        try
        {
            m_EventHelperLink.handleEvent(event);
            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));
        }
        catch(Exception e)
        {
            fail("Unexpected exception caught: " + e.getMessage());
        }
    }
@ Test public void testHandleIsActivatedResponse ( ) { m_SUT . getPhysicalsAsync ( systemId1 ) ; m_SUT . getLinksAsync ( systemId1 ) ; m_SUT . getTransportsAsync ( systemId1 ) ; Event transport = mockGetLayersResponse ( systemId1 , "transport" ) ; Event link = mockGetLayersResponse ( systemId1 , "link" ) ; Event physical = mockGetLayersResponse ( systemId1 , "physical" ) ; m_EventHelperComms . handleEvent ( transport ) ; m_EventHelperComms . handleEvent ( link ) ; m_EventHelperComms . handleEvent ( physical ) ; Event event = mockIsActivatedResponse ( systemId1 , true ) ; m_EventHelperLink . handleEvent ( event ) ; List < CommsLayerLinkModelImpl > links = m_SUT . getLinksAsync ( systemId1 ) ; assertThat ( links . get ( 0 ) . isActivated ( ) , is ( true ) ) ; event = mockIsActivatedResponse ( systemId1 , null ) ; try { m_EventHelperLink . handleEvent ( event ) ; 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 ) ) ; } catch ( Exception e ) { fail ( "Unexpected exception caught: " + e . getMessage ( ) ) ; } }
Test proper handling of IsActivated request for the link layer namespace.
Test proper handling of IsActivated request for the link layer namespace .
// Mini test setup //test activate response after mini set up //test null case //verify push event for local link layer activate response