mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/asset/TestAssetMessageService.java
@Test
    public final void testCaptureDataResponse() throws IOException
    {    
        Message response = CaptureDataResponseData.newBuilder()
                .setAssetUuid(SharedMessageUtils.convertUUIDToProtoUUID(UUID.randomUUID()))
                .build();
        AssetNamespace assetMessage = AssetNamespace.newBuilder()
                .setType(AssetMessageType.CaptureDataResponse)
                .setData(response.toByteString()).build();
        TerraHarvestPayload payload = createPayload(assetMessage);
        TerraHarvestMessage message = createMessage(assetMessage);

        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 capture data response message when handled will set the data event property.
     */
Verify capture data response message when handled will set the data event property.
Verify capture data response message when handled will set the data event property .
@Test
    public final void testCaptureDataResponse() throws IOException
    {    
        Message response = CaptureDataResponseData.newBuilder()
                .setAssetUuid(SharedMessageUtils.convertUUIDToProtoUUID(UUID.randomUUID()))
                .build();
        AssetNamespace assetMessage = AssetNamespace.newBuilder()
                .setType(AssetMessageType.CaptureDataResponse)
                .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 postedEvent = eventCaptor.getValue();
        assertThat((Message)postedEvent.getProperty(RemoteConstants.EVENT_PROP_DATA_MESSAGE), is(response));
    }
@ Test public final void testCaptureDataResponse ( ) throws IOException { Message response = CaptureDataResponseData . newBuilder ( ) . setAssetUuid ( SharedMessageUtils . convertUUIDToProtoUUID ( UUID . randomUUID ( ) ) ) . build ( ) ; AssetNamespace assetMessage = AssetNamespace . newBuilder ( ) . setType ( AssetMessageType . CaptureDataResponse ) . 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 postedEvent = eventCaptor . getValue ( ) ; assertThat ( ( Message ) postedEvent . getProperty ( RemoteConstants . EVENT_PROP_DATA_MESSAGE ) , is ( response ) ) ; }
Verify capture data response message when handled will set the data event property.
Verify capture data response message when handled will set the data event property .
// verify event is posted