mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/comms/TestCommsMgrImpl.java
@Test
    public void testHandleGetLayersResponseMergeLayers()
    {    
        m_SUT.getPhysicalsAsync(systemId1);
        m_SUT.getLinksAsync(systemId1);
        m_SUT.getTransportsAsync(systemId1);
        Event event = mockGetLayersResponse(systemId1, "transport");
        Event event2 = mockGetLayersResponse(systemId1, "link");
        Event event3 = mockGetLayersResponse(systemId1, "physical");
                
        m_EventHelperComms.handleEvent(event);        
        List<CommsLayerBaseModel> transModels = m_SUT.getTransportsAsync(systemId1);        
        assertThat(transModels.size(), is(1)); 
        
        m_EventHelperComms.handleEvent(event2);        
        List<CommsLayerLinkModelImpl> linkModels = m_SUT.getLinksAsync(systemId1);        
        assertThat(linkModels.size(), is(2));
        
        m_EventHelperComms.handleEvent(event3);        
        List<CommsLayerBaseModel> physModels = m_SUT.getPhysicalsAsync(systemId1);        
        assertThat(physModels.size(), is(3));    
        
        UUID transUuid = UUID.randomUUID();
        UUID linkUuid = UUID.randomUUID();
        UUID physUuid = UUID.randomUUID();
        
        Event event4 = mockGetLayersResponseMergeLayers(systemId1, "transport", transUuid, "transPid");
        Event event5 = mockGetLayersResponseMergeLayers(systemId1, "link", linkUuid, "linkPid");
        Event event6 = mockGetLayersResponseMergeLayers(systemId1, "physical", physUuid, "physPid");
        
        m_EventHelperComms.handleEvent(event4);
        transModels = m_SUT.getTransportsAsync(systemId1);
        assertThat(transModels.size(), is(1));
        assertThat(transModels.get(0).getUuid(), is(transUuid));
        assertThat(transModels.get(0).getPid(), is("transPid"));
        
        m_EventHelperComms.handleEvent(event5);
        linkModels = m_SUT.getLinksAsync(systemId1);
        assertThat(linkModels.size(), is(1));
        assertThat(linkModels.get(0).getUuid(), is(linkUuid));
        assertThat(linkModels.get(0).getPid(), is("linkPid"));
        
        m_EventHelperComms.handleEvent(event6);
        physModels = m_SUT.getPhysicalsAsync(systemId1);
        assertThat(physModels.size(), is(1));
        assertThat(physModels.get(0).getUuid(), is(physUuid));
        assertThat(physModels.get(0).getPid(), is("physPid"));
        
        Event event7 = mockGetLayersResponseMergeLayersEmpty(systemId1, "transport");
        Event event8 = mockGetLayersResponseMergeLayersEmpty(systemId1, "link");
        Event event9 = mockGetLayersResponseMergeLayersEmpty(systemId1, "physical");
        
        m_EventHelperComms.handleEvent(event7);
        transModels = m_SUT.getTransportsAsync(systemId1);
        assertThat(transModels.size(), is(0));
        
        m_EventHelperComms.handleEvent(event8);
        linkModels = m_SUT.getLinksAsync(systemId1);
        assertThat(linkModels.size(), is(0));
        
        m_EventHelperComms.handleEvent(event9);
        physModels = m_SUT.getPhysicalsAsync(systemId1);
        assertThat(physModels.size(), is(0));
    }
/**
     * Test the handling of a GetTopMostLayers request.
     * Verify that top layers are added to the appropriate system id as new comms stacks.
     * Verify that GetChildLayers requests are sent for transport and link layers.  
     */
Test the handling of a GetTopMostLayers request.
Verify that top layers are added to the appropriate system id as new comms stacks.
Verify that GetChildLayers requests are sent for transport and link layers.
Test the handling of a GetTopMostLayers request . Verify that top layers are added to the appropriate system id as new comms stacks . Verify that GetChildLayers requests are sent for transport and link layers .
@Test
    public void testHandleGetLayersResponseMergeLayers()
    {    
        m_SUT.getPhysicalsAsync(systemId1);
        m_SUT.getLinksAsync(systemId1);
        m_SUT.getTransportsAsync(systemId1);
        Event event = mockGetLayersResponse(systemId1, "transport");
        Event event2 = mockGetLayersResponse(systemId1, "link");
        Event event3 = mockGetLayersResponse(systemId1, "physical");
        m_EventHelperComms.handleEvent(event);        
        List<CommsLayerBaseModel> transModels = m_SUT.getTransportsAsync(systemId1);        
        assertThat(transModels.size(), is(1)); 
        m_EventHelperComms.handleEvent(event2);        
        List<CommsLayerLinkModelImpl> linkModels = m_SUT.getLinksAsync(systemId1);        
        assertThat(linkModels.size(), is(2));
        m_EventHelperComms.handleEvent(event3);        
        List<CommsLayerBaseModel> physModels = m_SUT.getPhysicalsAsync(systemId1);        
        assertThat(physModels.size(), is(3));    
        UUID transUuid = UUID.randomUUID();
        UUID linkUuid = UUID.randomUUID();
        UUID physUuid = UUID.randomUUID();
        Event event4 = mockGetLayersResponseMergeLayers(systemId1, "transport", transUuid, "transPid");
        Event event5 = mockGetLayersResponseMergeLayers(systemId1, "link", linkUuid, "linkPid");
        Event event6 = mockGetLayersResponseMergeLayers(systemId1, "physical", physUuid, "physPid");
        m_EventHelperComms.handleEvent(event4);
        transModels = m_SUT.getTransportsAsync(systemId1);
        assertThat(transModels.size(), is(1));
        assertThat(transModels.get(0).getUuid(), is(transUuid));
        assertThat(transModels.get(0).getPid(), is("transPid"));
        m_EventHelperComms.handleEvent(event5);
        linkModels = m_SUT.getLinksAsync(systemId1);
        assertThat(linkModels.size(), is(1));
        assertThat(linkModels.get(0).getUuid(), is(linkUuid));
        assertThat(linkModels.get(0).getPid(), is("linkPid"));
        m_EventHelperComms.handleEvent(event6);
        physModels = m_SUT.getPhysicalsAsync(systemId1);
        assertThat(physModels.size(), is(1));
        assertThat(physModels.get(0).getUuid(), is(physUuid));
        assertThat(physModels.get(0).getPid(), is("physPid"));
        Event event7 = mockGetLayersResponseMergeLayersEmpty(systemId1, "transport");
        Event event8 = mockGetLayersResponseMergeLayersEmpty(systemId1, "link");
        Event event9 = mockGetLayersResponseMergeLayersEmpty(systemId1, "physical");
        m_EventHelperComms.handleEvent(event7);
        transModels = m_SUT.getTransportsAsync(systemId1);
        assertThat(transModels.size(), is(0));
        m_EventHelperComms.handleEvent(event8);
        linkModels = m_SUT.getLinksAsync(systemId1);
        assertThat(linkModels.size(), is(0));
        m_EventHelperComms.handleEvent(event9);
        physModels = m_SUT.getPhysicalsAsync(systemId1);
        assertThat(physModels.size(), is(0));
    }
@ Test public void testHandleGetLayersResponseMergeLayers ( ) { m_SUT . getPhysicalsAsync ( systemId1 ) ; m_SUT . getLinksAsync ( systemId1 ) ; m_SUT . getTransportsAsync ( systemId1 ) ; Event event = mockGetLayersResponse ( systemId1 , "transport" ) ; Event event2 = mockGetLayersResponse ( systemId1 , "link" ) ; Event event3 = mockGetLayersResponse ( systemId1 , "physical" ) ; m_EventHelperComms . handleEvent ( event ) ; List < CommsLayerBaseModel > transModels = m_SUT . getTransportsAsync ( systemId1 ) ; assertThat ( transModels . size ( ) , is ( 1 ) ) ; m_EventHelperComms . handleEvent ( event2 ) ; List < CommsLayerLinkModelImpl > linkModels = m_SUT . getLinksAsync ( systemId1 ) ; assertThat ( linkModels . size ( ) , is ( 2 ) ) ; m_EventHelperComms . handleEvent ( event3 ) ; List < CommsLayerBaseModel > physModels = m_SUT . getPhysicalsAsync ( systemId1 ) ; assertThat ( physModels . size ( ) , is ( 3 ) ) ; UUID transUuid = UUID . randomUUID ( ) ; UUID linkUuid = UUID . randomUUID ( ) ; UUID physUuid = UUID . randomUUID ( ) ; Event event4 = mockGetLayersResponseMergeLayers ( systemId1 , "transport" , transUuid , "transPid" ) ; Event event5 = mockGetLayersResponseMergeLayers ( systemId1 , "link" , linkUuid , "linkPid" ) ; Event event6 = mockGetLayersResponseMergeLayers ( systemId1 , "physical" , physUuid , "physPid" ) ; m_EventHelperComms . handleEvent ( event4 ) ; transModels = m_SUT . getTransportsAsync ( systemId1 ) ; assertThat ( transModels . size ( ) , is ( 1 ) ) ; assertThat ( transModels . get ( 0 ) . getUuid ( ) , is ( transUuid ) ) ; assertThat ( transModels . get ( 0 ) . getPid ( ) , is ( "transPid" ) ) ; m_EventHelperComms . handleEvent ( event5 ) ; linkModels = m_SUT . getLinksAsync ( systemId1 ) ; assertThat ( linkModels . size ( ) , is ( 1 ) ) ; assertThat ( linkModels . get ( 0 ) . getUuid ( ) , is ( linkUuid ) ) ; assertThat ( linkModels . get ( 0 ) . getPid ( ) , is ( "linkPid" ) ) ; m_EventHelperComms . handleEvent ( event6 ) ; physModels = m_SUT . getPhysicalsAsync ( systemId1 ) ; assertThat ( physModels . size ( ) , is ( 1 ) ) ; assertThat ( physModels . get ( 0 ) . getUuid ( ) , is ( physUuid ) ) ; assertThat ( physModels . get ( 0 ) . getPid ( ) , is ( "physPid" ) ) ; Event event7 = mockGetLayersResponseMergeLayersEmpty ( systemId1 , "transport" ) ; Event event8 = mockGetLayersResponseMergeLayersEmpty ( systemId1 , "link" ) ; Event event9 = mockGetLayersResponseMergeLayersEmpty ( systemId1 , "physical" ) ; m_EventHelperComms . handleEvent ( event7 ) ; transModels = m_SUT . getTransportsAsync ( systemId1 ) ; assertThat ( transModels . size ( ) , is ( 0 ) ) ; m_EventHelperComms . handleEvent ( event8 ) ; linkModels = m_SUT . getLinksAsync ( systemId1 ) ; assertThat ( linkModels . size ( ) , is ( 0 ) ) ; m_EventHelperComms . handleEvent ( event9 ) ; physModels = m_SUT . getPhysicalsAsync ( systemId1 ) ; assertThat ( physModels . size ( ) , is ( 0 ) ) ; }
Test the handling of a GetTopMostLayers request.
Test the handling of a GetTopMostLayers request .