mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/comms/TestCommsMgrImpl.java
@Test
    public void testRemoteLinkNameChange()
    {
        // add controller and layer
        m_SUT.getLinksAsync(systemId1);
        Event link = mockGetLayersResponse(systemId1, "link");
        
        m_EventHelperComms.handleEvent(link);
        
        List<CommsLayerLinkModelImpl> links = m_SUT.getLinksAsync(systemId1);
        //link with uuid2 is changed verify assumption that it is the first layer
        assertThat(links.get(0).getUuid(), is(uuid2));
        String name = links.get(0).getName();
        
        //name change events
        Event nameChange = mockEventNameUpdated(systemId1, "link");
        
        //handle event
        m_EventHelper.handleEvent(nameChange);

        links = m_SUT.getLinksAsync(systemId1);
        assertThat(links.get(0).getUuid(), is(uuid2));
        assertThat(links.get(0).getName(), is("linky"));
        assertThat(name, is(not("linky")));
        
        ArgumentCaptor<Event> captor = ArgumentCaptor.forClass(Event.class);
        //verify push event for get layers response
        verify(m_EventAdmin, times(2)).postEvent(captor.capture());
        assertThat(captor.getValue().getTopic(), is(CommsMgr.TOPIC_COMMS_LAYER_UPDATED));
    }
/**
     * Verify proper handling of remote link name change event.
     */
Verify proper handling of remote link name change event.
Verify proper handling of remote link name change event .
@Test
    public void testRemoteLinkNameChange()
    {
        m_SUT.getLinksAsync(systemId1);
        Event link = mockGetLayersResponse(systemId1, "link");
        m_EventHelperComms.handleEvent(link);
        List<CommsLayerLinkModelImpl> links = m_SUT.getLinksAsync(systemId1);
        assertThat(links.get(0).getUuid(), is(uuid2));
        String name = links.get(0).getName();
        Event nameChange = mockEventNameUpdated(systemId1, "link");
        m_EventHelper.handleEvent(nameChange);
        links = m_SUT.getLinksAsync(systemId1);
        assertThat(links.get(0).getUuid(), is(uuid2));
        assertThat(links.get(0).getName(), is("linky"));
        assertThat(name, is(not("linky")));
        ArgumentCaptor<Event> captor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin, times(2)).postEvent(captor.capture());
        assertThat(captor.getValue().getTopic(), is(CommsMgr.TOPIC_COMMS_LAYER_UPDATED));
    }
@ Test public void testRemoteLinkNameChange ( ) { m_SUT . getLinksAsync ( systemId1 ) ; Event link = mockGetLayersResponse ( systemId1 , "link" ) ; m_EventHelperComms . handleEvent ( link ) ; List < CommsLayerLinkModelImpl > links = m_SUT . getLinksAsync ( systemId1 ) ; assertThat ( links . get ( 0 ) . getUuid ( ) , is ( uuid2 ) ) ; String name = links . get ( 0 ) . getName ( ) ; Event nameChange = mockEventNameUpdated ( systemId1 , "link" ) ; m_EventHelper . handleEvent ( nameChange ) ; links = m_SUT . getLinksAsync ( systemId1 ) ; assertThat ( links . get ( 0 ) . getUuid ( ) , is ( uuid2 ) ) ; assertThat ( links . get ( 0 ) . getName ( ) , is ( "linky" ) ) ; assertThat ( name , is ( not ( "linky" ) ) ) ; ArgumentCaptor < Event > captor = ArgumentCaptor . forClass ( Event . class ) ; verify ( m_EventAdmin , times ( 2 ) ) . postEvent ( captor . capture ( ) ) ; assertThat ( captor . getValue ( ) . getTopic ( ) , is ( CommsMgr . TOPIC_COMMS_LAYER_UPDATED ) ) ; }
Verify proper handling of remote link name change event.
Verify proper handling of remote link name change event .
// add controller and layer //link with uuid2 is changed verify assumption that it is the first layer //name change events //handle event //verify push event for get layers response