mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/util/TestRemoteInterfaceUtilities.java
@Test
    public final void testCreateMessageReceivedEventResponse() throws InvalidProtocolBufferException
    {
        // construct a single message containing data within a namespace message
        ControllerInfoData systemInfoData = ControllerInfoData.newBuilder()
                .setName("test-name")
                .build();
        
        BaseNamespace baseNamespaceMessage = BaseNamespace.newBuilder()
                .setType(BaseMessageType.ControllerInfo)
                .setData(systemInfoData.toByteString())
                .build();
        
        TerraHarvestMessage message = 
                TerraHarvestMessageHelper.createTerraHarvestMessage(0, 1, Namespace.Base, 100, baseNamespaceMessage);
        TerraHarvestMessage responseMessage = message.toBuilder().setIsResponse(true).build();
        TerraHarvestPayload payload = TerraHarvestPayload.newBuilder().
                setNamespace(Namespace.Base).
                setNamespaceMessage(baseNamespaceMessage.toByteString()).
                build();
        RemoteChannel channel = mock(RemoteChannel.class);
        
        Event event = RemoteInterfaceUtilities.createMessageReceivedEvent(responseMessage, payload, 
            baseNamespaceMessage, BaseMessageType.ControllerInfo, systemInfoData, channel);
        
        // now test all properties and the topic
        assertThat((Boolean)event.getProperty(RemoteConstants.EVENT_PROP_MESSAGE_RESPONSE), 
                is(true));
    }
/**
     * Verify the response event property is stored properly if the message contains a specific value.
     */
Verify the response event property is stored properly if the message contains a specific value.
Verify the response event property is stored properly if the message contains a specific value .
@Test
    public final void testCreateMessageReceivedEventResponse() throws InvalidProtocolBufferException
    {
        ControllerInfoData systemInfoData = ControllerInfoData.newBuilder()
                .setName("test-name")
                .build();
        BaseNamespace baseNamespaceMessage = BaseNamespace.newBuilder()
                .setType(BaseMessageType.ControllerInfo)
                .setData(systemInfoData.toByteString())
                .build();
        TerraHarvestMessage message = 
                TerraHarvestMessageHelper.createTerraHarvestMessage(0, 1, Namespace.Base, 100, baseNamespaceMessage);
        TerraHarvestMessage responseMessage = message.toBuilder().setIsResponse(true).build();
        TerraHarvestPayload payload = TerraHarvestPayload.newBuilder().
                setNamespace(Namespace.Base).
                setNamespaceMessage(baseNamespaceMessage.toByteString()).
                build();
        RemoteChannel channel = mock(RemoteChannel.class);
        Event event = RemoteInterfaceUtilities.createMessageReceivedEvent(responseMessage, payload, 
            baseNamespaceMessage, BaseMessageType.ControllerInfo, systemInfoData, channel);
        assertThat((Boolean)event.getProperty(RemoteConstants.EVENT_PROP_MESSAGE_RESPONSE), 
                is(true));
    }
@ Test public final void testCreateMessageReceivedEventResponse ( ) throws InvalidProtocolBufferException { ControllerInfoData systemInfoData = ControllerInfoData . newBuilder ( ) . setName ( "test-name" ) . build ( ) ; BaseNamespace baseNamespaceMessage = BaseNamespace . newBuilder ( ) . setType ( BaseMessageType . ControllerInfo ) . setData ( systemInfoData . toByteString ( ) ) . build ( ) ; TerraHarvestMessage message = TerraHarvestMessageHelper . createTerraHarvestMessage ( 0 , 1 , Namespace . Base , 100 , baseNamespaceMessage ) ; TerraHarvestMessage responseMessage = message . toBuilder ( ) . setIsResponse ( true ) . build ( ) ; TerraHarvestPayload payload = TerraHarvestPayload . newBuilder ( ) . setNamespace ( Namespace . Base ) . setNamespaceMessage ( baseNamespaceMessage . toByteString ( ) ) . build ( ) ; RemoteChannel channel = mock ( RemoteChannel . class ) ; Event event = RemoteInterfaceUtilities . createMessageReceivedEvent ( responseMessage , payload , baseNamespaceMessage , BaseMessageType . ControllerInfo , systemInfoData , channel ) ; assertThat ( ( Boolean ) event . getProperty ( RemoteConstants . EVENT_PROP_MESSAGE_RESPONSE ) , is ( true ) ) ; }
Verify the response event property is stored properly if the message contains a specific value.
Verify the response event property is stored properly if the message contains a specific value .
// construct a single message containing data within a namespace message // now test all properties and the topic