mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/ccomms/TestCustomCommsMessageService.java
@Test
    public void testCreatePhysicalLinkResponse() throws IOException
    {
        FactoryObjectInfo info = FactoryObjectInfo.newBuilder()
                .setUuid(SharedMessageUtils.convertUUIDToProtoUUID(testUuid))
                .setPid("physPid")
                .setProductType("testPhysicalLayer")
                .build();
        
        Message response = CreatePhysicalLinkResponseData.newBuilder()
                .setInfo(info)
                .build();
        
        CustomCommsNamespace ccommMessage = CustomCommsNamespace.newBuilder()
                .setType(CustomCommsMessageType.CreatePhysicalLinkResponse)
                .setData(response.toByteString())
                .build();
        
        TerraHarvestPayload payload = createPayload(ccommMessage);
        TerraHarvestMessage message = createCustomCommsMessage(ccommMessage);
                
        // mock the channel the message came from
        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 event = eventCaptor.getValue();
        
        assertThat((Message)event.getProperty(RemoteConstants.EVENT_PROP_DATA_MESSAGE),
                is(response));
    }
/**
     * Verify event posted for response message, verify event property key in the posted event is the correct response 
     * for the message that was sent.
     */
Verify event posted for response message, verify event property key in the posted event is the correct response
for the message that was sent.
Verify event posted for response message verify event property key in the posted event is the correct response for the message that was sent .
@Test
    public void testCreatePhysicalLinkResponse() throws IOException
    {
        FactoryObjectInfo info = FactoryObjectInfo.newBuilder()
                .setUuid(SharedMessageUtils.convertUUIDToProtoUUID(testUuid))
                .setPid("physPid")
                .setProductType("testPhysicalLayer")
                .build();
        Message response = CreatePhysicalLinkResponseData.newBuilder()
                .setInfo(info)
                .build();
        CustomCommsNamespace ccommMessage = CustomCommsNamespace.newBuilder()
                .setType(CustomCommsMessageType.CreatePhysicalLinkResponse)
                .setData(response.toByteString())
                .build();
        TerraHarvestPayload payload = createPayload(ccommMessage);
        TerraHarvestMessage message = createCustomCommsMessage(ccommMessage);
        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 event = eventCaptor.getValue();
        assertThat((Message)event.getProperty(RemoteConstants.EVENT_PROP_DATA_MESSAGE),
                is(response));
    }
@ Test public void testCreatePhysicalLinkResponse ( ) throws IOException { FactoryObjectInfo info = FactoryObjectInfo . newBuilder ( ) . setUuid ( SharedMessageUtils . convertUUIDToProtoUUID ( testUuid ) ) . setPid ( "physPid" ) . setProductType ( "testPhysicalLayer" ) . build ( ) ; Message response = CreatePhysicalLinkResponseData . newBuilder ( ) . setInfo ( info ) . build ( ) ; CustomCommsNamespace ccommMessage = CustomCommsNamespace . newBuilder ( ) . setType ( CustomCommsMessageType . CreatePhysicalLinkResponse ) . setData ( response . toByteString ( ) ) . build ( ) ; TerraHarvestPayload payload = createPayload ( ccommMessage ) ; TerraHarvestMessage message = createCustomCommsMessage ( ccommMessage ) ; 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 event = eventCaptor . getValue ( ) ; assertThat ( ( Message ) event . getProperty ( RemoteConstants . EVENT_PROP_DATA_MESSAGE ) , is ( response ) ) ; }
Verify event posted for response message, verify event property key in the posted event is the correct response
 for the message that was sent.
Verify event posted for response message verify event property key in the posted event is the correct response for the message that was sent .
// mock the channel the message came from // verify event is posted