mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/comms/TestAddCommsMessageControllerImpl.java
@Test
    public void testSubmitNewCommsStackRequest()
    {
        //physical link uuid
        UUID uuid_phys = UUID.randomUUID();
        
        //mock link layer handler
        RemoteCreateLinkLayerHandler handler = mock(RemoteCreateLinkLayerHandler.class);
        
        //comms service  behavior
        when(m_CommsMgr.getPhysicalUuidByName("fizzyPhys", 0)).thenReturn(uuid_phys);
        when(m_CommsMgr.createLinkLayerHandler(Mockito.any(CreateTransportLayerRequestData.Builder.class))).
            thenReturn(handler);
        
        m_SUT.submitNewCommsStackRequest(0, getCompleteModel(PhysicalLinkTypeEnum.I_2_C));
        
        //capture the message sent and built message for the transport layer
        ArgumentCaptor<CreateLinkLayerRequestData> linkMessageCap = 
                ArgumentCaptor.forClass(CreateLinkLayerRequestData.class);
        verify(m_MessageFactory).createCustomCommsMessage(
                eq(CustomCommsMessageType.CreateLinkLayerRequest), linkMessageCap.capture());
        ArgumentCaptor<CreateTransportLayerRequestData.Builder> transMessageCap = 
                ArgumentCaptor.forClass(CreateTransportLayerRequestData.Builder.class);
        verify(m_CommsMgr).createLinkLayerHandler(transMessageCap.capture());
        verify(m_MessageWrapper).queue(0, handler);
        
        //inspect transport layer message builder that was captured
        CreateTransportLayerRequestData.Builder transCapBuilder = transMessageCap.getValue();
        assertThat(transCapBuilder.getTransportLayerName(), is("transyTrans"));
        assertThat(transCapBuilder.getTransportLayerProductType(), is("example.trans.type"));
        
        //inspect link layer captured message
        CreateLinkLayerRequestData linkRequest = linkMessageCap.getValue();
        assertThat(linkRequest.getLinkLayerProductType(), is("example.link.type"));
        assertThat(linkRequest.getLinkLayerName(), is("linkyLink"));
        assertThat(linkRequest.getPhysicalLinkUuid(), is(SharedMessageUtils.convertUUIDToProtoUUID(uuid_phys)));
    }
/**
     * Verify that when presented a model and controller ID, that requests to create comms layers are sent.
     */
Verify that when presented a model and controller ID, that requests to create comms layers are sent.
Verify that when presented a model and controller ID that requests to create comms layers are sent .
@Test
    public void testSubmitNewCommsStackRequest()
    {
        UUID uuid_phys = UUID.randomUUID();
        RemoteCreateLinkLayerHandler handler = mock(RemoteCreateLinkLayerHandler.class);
        when(m_CommsMgr.getPhysicalUuidByName("fizzyPhys", 0)).thenReturn(uuid_phys);
        when(m_CommsMgr.createLinkLayerHandler(Mockito.any(CreateTransportLayerRequestData.Builder.class))).
            thenReturn(handler);
        m_SUT.submitNewCommsStackRequest(0, getCompleteModel(PhysicalLinkTypeEnum.I_2_C));
        ArgumentCaptor<CreateLinkLayerRequestData> linkMessageCap = 
                ArgumentCaptor.forClass(CreateLinkLayerRequestData.class);
        verify(m_MessageFactory).createCustomCommsMessage(
                eq(CustomCommsMessageType.CreateLinkLayerRequest), linkMessageCap.capture());
        ArgumentCaptor<CreateTransportLayerRequestData.Builder> transMessageCap = 
                ArgumentCaptor.forClass(CreateTransportLayerRequestData.Builder.class);
        verify(m_CommsMgr).createLinkLayerHandler(transMessageCap.capture());
        verify(m_MessageWrapper).queue(0, handler);
        CreateTransportLayerRequestData.Builder transCapBuilder = transMessageCap.getValue();
        assertThat(transCapBuilder.getTransportLayerName(), is("transyTrans"));
        assertThat(transCapBuilder.getTransportLayerProductType(), is("example.trans.type"));
        CreateLinkLayerRequestData linkRequest = linkMessageCap.getValue();
        assertThat(linkRequest.getLinkLayerProductType(), is("example.link.type"));
        assertThat(linkRequest.getLinkLayerName(), is("linkyLink"));
        assertThat(linkRequest.getPhysicalLinkUuid(), is(SharedMessageUtils.convertUUIDToProtoUUID(uuid_phys)));
    }
@ Test public void testSubmitNewCommsStackRequest ( ) { UUID uuid_phys = UUID . randomUUID ( ) ; RemoteCreateLinkLayerHandler handler = mock ( RemoteCreateLinkLayerHandler . class ) ; when ( m_CommsMgr . getPhysicalUuidByName ( "fizzyPhys" , 0 ) ) . thenReturn ( uuid_phys ) ; when ( m_CommsMgr . createLinkLayerHandler ( Mockito . any ( CreateTransportLayerRequestData . Builder . class ) ) ) . thenReturn ( handler ) ; m_SUT . submitNewCommsStackRequest ( 0 , getCompleteModel ( PhysicalLinkTypeEnum . I_2_C ) ) ; ArgumentCaptor < CreateLinkLayerRequestData > linkMessageCap = ArgumentCaptor . forClass ( CreateLinkLayerRequestData . class ) ; verify ( m_MessageFactory ) . createCustomCommsMessage ( eq ( CustomCommsMessageType . CreateLinkLayerRequest ) , linkMessageCap . capture ( ) ) ; ArgumentCaptor < CreateTransportLayerRequestData . Builder > transMessageCap = ArgumentCaptor . forClass ( CreateTransportLayerRequestData . Builder . class ) ; verify ( m_CommsMgr ) . createLinkLayerHandler ( transMessageCap . capture ( ) ) ; verify ( m_MessageWrapper ) . queue ( 0 , handler ) ; CreateTransportLayerRequestData . Builder transCapBuilder = transMessageCap . getValue ( ) ; assertThat ( transCapBuilder . getTransportLayerName ( ) , is ( "transyTrans" ) ) ; assertThat ( transCapBuilder . getTransportLayerProductType ( ) , is ( "example.trans.type" ) ) ; CreateLinkLayerRequestData linkRequest = linkMessageCap . getValue ( ) ; assertThat ( linkRequest . getLinkLayerProductType ( ) , is ( "example.link.type" ) ) ; assertThat ( linkRequest . getLinkLayerName ( ) , is ( "linkyLink" ) ) ; assertThat ( linkRequest . getPhysicalLinkUuid ( ) , is ( SharedMessageUtils . convertUUIDToProtoUUID ( uuid_phys ) ) ) ; }
Verify that when presented a model and controller ID, that requests to create comms layers are sent.
Verify that when presented a model and controller ID that requests to create comms layers are sent .
//physical link uuid //mock link layer handler //comms service  behavior //capture the message sent and built message for the transport layer //inspect transport layer message builder that was captured //inspect link layer captured message