mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/asset/TestAssetMessageService.java
@Test
    public void testExecuteCommandResponse() throws IOException
    {
        ExecuteCommandResponseData response = ExecuteCommandResponseData.newBuilder().
                setUuid(SharedMessageUtils.convertUUIDToProtoUUID(m_AssetUuid)).
                setResponseType(CommandResponseEnumConverter
                        .convertJavaEnumToProto(CommandResponseEnum.SET_PAN_TILT_RESPONSE)).
                setResponse(SetPanTiltResponseGen.SetPanTiltResponse.getDefaultInstance().toByteString()).build();
        AssetNamespace assetMessage = AssetNamespace.newBuilder().
                setType(AssetMessageType.ExecuteCommandResponse).
                setData(response.toByteString()).
                build();
        
        TerraHarvestPayload payload = createPayload(assetMessage);
        TerraHarvestMessage message = createMessage(assetMessage);
        
        // mock the channel the message came from
        RemoteChannel channel = mock(RemoteChannel.class);
        
        // replay
        m_SUT.handleMessage(message, payload, channel);
        
        // verify the event contains the null data message
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin).postEvent(eventCaptor.capture());
        
        Event event = eventCaptor.getValue();
        assertThat(event.getProperty(RemoteConstants.EVENT_PROP_DATA_MESSAGE),
                is((Object)response));
    }
/**
     * Verify the execute command response message sends an event with null data message.
     */
Verify the execute command response message sends an event with null data message.
Verify the execute command response message sends an event with null data message .
@Test
    public void testExecuteCommandResponse() throws IOException
    {
        ExecuteCommandResponseData response = ExecuteCommandResponseData.newBuilder().
                setUuid(SharedMessageUtils.convertUUIDToProtoUUID(m_AssetUuid)).
                setResponseType(CommandResponseEnumConverter
                        .convertJavaEnumToProto(CommandResponseEnum.SET_PAN_TILT_RESPONSE)).
                setResponse(SetPanTiltResponseGen.SetPanTiltResponse.getDefaultInstance().toByteString()).build();
        AssetNamespace assetMessage = AssetNamespace.newBuilder().
                setType(AssetMessageType.ExecuteCommandResponse).
                setData(response.toByteString()).
                build();
        TerraHarvestPayload payload = createPayload(assetMessage);
        TerraHarvestMessage message = createMessage(assetMessage);
        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(event.getProperty(RemoteConstants.EVENT_PROP_DATA_MESSAGE),
                is((Object)response));
    }
@ Test public void testExecuteCommandResponse ( ) throws IOException { ExecuteCommandResponseData response = ExecuteCommandResponseData . newBuilder ( ) . setUuid ( SharedMessageUtils . convertUUIDToProtoUUID ( m_AssetUuid ) ) . setResponseType ( CommandResponseEnumConverter . convertJavaEnumToProto ( CommandResponseEnum . SET_PAN_TILT_RESPONSE ) ) . setResponse ( SetPanTiltResponseGen . SetPanTiltResponse . getDefaultInstance ( ) . toByteString ( ) ) . build ( ) ; AssetNamespace assetMessage = AssetNamespace . newBuilder ( ) . setType ( AssetMessageType . ExecuteCommandResponse ) . setData ( response . toByteString ( ) ) . build ( ) ; TerraHarvestPayload payload = createPayload ( assetMessage ) ; TerraHarvestMessage message = createMessage ( assetMessage ) ; 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 ( event . getProperty ( RemoteConstants . EVENT_PROP_DATA_MESSAGE ) , is ( ( Object ) response ) ) ; }
Verify the execute command response message sends an event with null data message.
Verify the execute command response message sends an event with null data message .
// mock the channel the message came from // replay // verify the event contains the null data message