mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/ccomms/TestCustomCommsMessageService.java
@Test
    public final void testGetLinkLayerCapabilitiesResponse() throws IOException
    {
        Message capsGen = LinkLayerCapabilitiesGen.LinkLayerCapabilities.newBuilder().
                setBase(BaseCapabilitiesGen.BaseCapabilities.newBuilder().
                    setManufacturer("LinkCaps Response Makers").
                    setDescription("A responsive link layer.").
                    setProductName("CapsResponseLinkLayer")).
                setPhysicalLinkRequired(false).
                setPerformBITSupported(false).
                setModality(CustomCommTypesGen.LinkLayerType.Enum.LINE_OF_SIGHT).
                setStaticMtu(false).
                setSupportsAddressing(false).build();
        Message response = GetCapabilitiesResponseData.newBuilder().
                setLinkCapabilities((LinkLayerCapabilitiesGen.LinkLayerCapabilities) capsGen).
                setCommType(CommType.Linklayer).
                setProductType(LinkLayer.class.getName()).build();
        CustomCommsNamespace linkLayerMessage = CustomCommsNamespace.newBuilder().
                setType(CustomCommsMessageType.GetCapabilitiesResponse).
                setData(response.toByteString()).build();
        TerraHarvestPayload payload = createPayload(linkLayerMessage);
        TerraHarvestMessage message = createCustomCommsMessage(linkLayerMessage);
        
        RemoteChannel channel = mock(RemoteChannel.class);
        m_SUT.handleMessage(message, payload, channel);
        
        //verify event is posted
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin).postEvent(eventCaptor.capture());
        Event postedEvent = eventCaptor.getValue();
        assertThat((Message)postedEvent.getProperty(RemoteConstants.EVENT_PROP_DATA_MESSAGE), is(response));
    }
/**
     * Verify get capabilities response message will set the data event property correctly when handled
     * for link layers.
     */
Verify get capabilities response message will set the data event property correctly when handled
for link layers.
Verify get capabilities response message will set the data event property correctly when handled for link layers .
@Test
    public final void testGetLinkLayerCapabilitiesResponse() throws IOException
    {
        Message capsGen = LinkLayerCapabilitiesGen.LinkLayerCapabilities.newBuilder().
                setBase(BaseCapabilitiesGen.BaseCapabilities.newBuilder().
                    setManufacturer("LinkCaps Response Makers").
                    setDescription("A responsive link layer.").
                    setProductName("CapsResponseLinkLayer")).
                setPhysicalLinkRequired(false).
                setPerformBITSupported(false).
                setModality(CustomCommTypesGen.LinkLayerType.Enum.LINE_OF_SIGHT).
                setStaticMtu(false).
                setSupportsAddressing(false).build();
        Message response = GetCapabilitiesResponseData.newBuilder().
                setLinkCapabilities((LinkLayerCapabilitiesGen.LinkLayerCapabilities) capsGen).
                setCommType(CommType.Linklayer).
                setProductType(LinkLayer.class.getName()).build();
        CustomCommsNamespace linkLayerMessage = CustomCommsNamespace.newBuilder().
                setType(CustomCommsMessageType.GetCapabilitiesResponse).
                setData(response.toByteString()).build();
        TerraHarvestPayload payload = createPayload(linkLayerMessage);
        TerraHarvestMessage message = createCustomCommsMessage(linkLayerMessage);
        RemoteChannel channel = mock(RemoteChannel.class);
        m_SUT.handleMessage(message, payload, channel);
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin).postEvent(eventCaptor.capture());
        Event postedEvent = eventCaptor.getValue();
        assertThat((Message)postedEvent.getProperty(RemoteConstants.EVENT_PROP_DATA_MESSAGE), is(response));
    }
@ Test public final void testGetLinkLayerCapabilitiesResponse ( ) throws IOException { Message capsGen = LinkLayerCapabilitiesGen . LinkLayerCapabilities . newBuilder ( ) . setBase ( BaseCapabilitiesGen . BaseCapabilities . newBuilder ( ) . setManufacturer ( "LinkCaps Response Makers" ) . setDescription ( "A responsive link layer." ) . setProductName ( "CapsResponseLinkLayer" ) ) . setPhysicalLinkRequired ( false ) . setPerformBITSupported ( false ) . setModality ( CustomCommTypesGen . LinkLayerType . Enum . LINE_OF_SIGHT ) . setStaticMtu ( false ) . setSupportsAddressing ( false ) . build ( ) ; Message response = GetCapabilitiesResponseData . newBuilder ( ) . setLinkCapabilities ( ( LinkLayerCapabilitiesGen . LinkLayerCapabilities ) capsGen ) . setCommType ( CommType . Linklayer ) . setProductType ( LinkLayer . class . getName ( ) ) . build ( ) ; CustomCommsNamespace linkLayerMessage = CustomCommsNamespace . newBuilder ( ) . setType ( CustomCommsMessageType . GetCapabilitiesResponse ) . setData ( response . toByteString ( ) ) . build ( ) ; TerraHarvestPayload payload = createPayload ( linkLayerMessage ) ; TerraHarvestMessage message = createCustomCommsMessage ( linkLayerMessage ) ; RemoteChannel channel = mock ( RemoteChannel . class ) ; m_SUT . handleMessage ( message , payload , channel ) ; ArgumentCaptor < Event > eventCaptor = ArgumentCaptor . forClass ( Event . class ) ; verify ( m_EventAdmin ) . postEvent ( eventCaptor . capture ( ) ) ; Event postedEvent = eventCaptor . getValue ( ) ; assertThat ( ( Message ) postedEvent . getProperty ( RemoteConstants . EVENT_PROP_DATA_MESSAGE ) , is ( response ) ) ; }
Verify get capabilities response message will set the data event property correctly when handled
 for link layers.
Verify get capabilities response message will set the data event property correctly when handled for link layers .
//verify event is posted