mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/ccomms/TestCustomCommsMessageService.java
@SuppressWarnings("unchecked")
    @Test
    public void testCreateLinkLayer_NoPhysicalLink() throws IOException, CCommException
    {
        CreateLinkLayerRequestData request = CreateLinkLayerRequestData.newBuilder()
                .setLinkLayerProductType("meow")
                .setLinkLayerName("woof")
                .build();
        
        CustomCommsNamespace ccommMessage = CustomCommsNamespace.newBuilder()
                .setType(CustomCommsMessageType.CreateLinkLayerRequest)
                .setData(request.toByteString())
                .build();
        
        TerraHarvestPayload payload = createPayload(ccommMessage);
        TerraHarvestMessage message = createCustomCommsMessage(ccommMessage);
        
        // mock the channel the message came from
        RemoteChannel channel = mock(RemoteChannel.class);
        
        LinkLayer createdLinkLayer = mock(LinkLayer.class);
        when(m_CustomCommsService.createLinkLayer(anyString(), anyString(), Mockito.any(Map.class))).thenReturn(
                createdLinkLayer);
        when(createdLinkLayer.getUuid()).thenReturn(testUuid2);
        when(createdLinkLayer.getPid()).thenReturn("linkPid");
        when(createdLinkLayer.getFactory()).thenReturn(m_LinkLayerFactory);
        
        when(m_CustomCommsService.getPhysicalLinkName(testUuid)).thenReturn("chirp");
        
        m_SUT.handleMessage(message, payload, channel);
        
        Map<String, Object> properties = new HashMap<String, Object>();
        verify(m_CustomCommsService).createLinkLayer("meow", "woof", properties);
    }
/**
     * Verify if no physical link UUID is provided, then the property is not passed to the custom comm service.
     */
Verify if no physical link UUID is provided, then the property is not passed to the custom comm service.
Verify if no physical link UUID is provided then the property is not passed to the custom comm service .
@SuppressWarnings("unchecked")
    @Test
    public void testCreateLinkLayer_NoPhysicalLink() throws IOException, CCommException
    {
        CreateLinkLayerRequestData request = CreateLinkLayerRequestData.newBuilder()
                .setLinkLayerProductType("meow")
                .setLinkLayerName("woof")
                .build();
        CustomCommsNamespace ccommMessage = CustomCommsNamespace.newBuilder()
                .setType(CustomCommsMessageType.CreateLinkLayerRequest)
                .setData(request.toByteString())
                .build();
        TerraHarvestPayload payload = createPayload(ccommMessage);
        TerraHarvestMessage message = createCustomCommsMessage(ccommMessage);
        RemoteChannel channel = mock(RemoteChannel.class);
        LinkLayer createdLinkLayer = mock(LinkLayer.class);
        when(m_CustomCommsService.createLinkLayer(anyString(), anyString(), Mockito.any(Map.class))).thenReturn(
                createdLinkLayer);
        when(createdLinkLayer.getUuid()).thenReturn(testUuid2);
        when(createdLinkLayer.getPid()).thenReturn("linkPid");
        when(createdLinkLayer.getFactory()).thenReturn(m_LinkLayerFactory);
        when(m_CustomCommsService.getPhysicalLinkName(testUuid)).thenReturn("chirp");
        m_SUT.handleMessage(message, payload, channel);
        Map<String, Object> properties = new HashMap<String, Object>();
        verify(m_CustomCommsService).createLinkLayer("meow", "woof", properties);
    }
@ SuppressWarnings ( "unchecked" ) @ Test public void testCreateLinkLayer_NoPhysicalLink ( ) throws IOException , CCommException { CreateLinkLayerRequestData request = CreateLinkLayerRequestData . newBuilder ( ) . setLinkLayerProductType ( "meow" ) . setLinkLayerName ( "woof" ) . build ( ) ; CustomCommsNamespace ccommMessage = CustomCommsNamespace . newBuilder ( ) . setType ( CustomCommsMessageType . CreateLinkLayerRequest ) . setData ( request . toByteString ( ) ) . build ( ) ; TerraHarvestPayload payload = createPayload ( ccommMessage ) ; TerraHarvestMessage message = createCustomCommsMessage ( ccommMessage ) ; RemoteChannel channel = mock ( RemoteChannel . class ) ; LinkLayer createdLinkLayer = mock ( LinkLayer . class ) ; when ( m_CustomCommsService . createLinkLayer ( anyString ( ) , anyString ( ) , Mockito . any ( Map . class ) ) ) . thenReturn ( createdLinkLayer ) ; when ( createdLinkLayer . getUuid ( ) ) . thenReturn ( testUuid2 ) ; when ( createdLinkLayer . getPid ( ) ) . thenReturn ( "linkPid" ) ; when ( createdLinkLayer . getFactory ( ) ) . thenReturn ( m_LinkLayerFactory ) ; when ( m_CustomCommsService . getPhysicalLinkName ( testUuid ) ) . thenReturn ( "chirp" ) ; m_SUT . handleMessage ( message , payload , channel ) ; Map < String , Object > properties = new HashMap < String , Object > ( ) ; verify ( m_CustomCommsService ) . createLinkLayer ( "meow" , "woof" , properties ) ; }
Verify if no physical link UUID is provided, then the property is not passed to the custom comm service.
Verify if no physical link UUID is provided then the property is not passed to the custom comm service .
// mock the channel the message came from