mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/asset/TestAssetMessageService.java
@Test
    public final void testGetStatusResponse() throws IOException
    {
        UUID uuid = UUID.randomUUID();
        ObservationGen.Observation stat = TerraHarvestMessageHelper.getProtoObs().toBuilder().
                setStatus(Status.newBuilder().
                        setSummaryStatus(OperatingStatus.newBuilder().
                        setDescription("asdf").
                        setSummary(StatusTypesGen.SummaryStatus.Enum.OFF).build()).build()).build();
        Message response = GetLastStatusResponseData.newBuilder().setStatusObservationNative(stat)
                .setAssetUuid(SharedMessageUtils.convertUUIDToProtoUUID(uuid)).build();
        AssetNamespace assetMessage = AssetNamespace.newBuilder().
                setType(AssetMessageType.GetLastStatusResponse).
                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 get status response message when handled will set the data event property.
     */
Verify get status response message when handled will set the data event property.
Verify get status response message when handled will set the data event property .
@Test
    public final void testGetStatusResponse() throws IOException
    {
        UUID uuid = UUID.randomUUID();
        ObservationGen.Observation stat = TerraHarvestMessageHelper.getProtoObs().toBuilder().
                setStatus(Status.newBuilder().
                        setSummaryStatus(OperatingStatus.newBuilder().
                        setDescription("asdf").
                        setSummary(StatusTypesGen.SummaryStatus.Enum.OFF).build()).build()).build();
        Message response = GetLastStatusResponseData.newBuilder().setStatusObservationNative(stat)
                .setAssetUuid(SharedMessageUtils.convertUUIDToProtoUUID(uuid)).build();
        AssetNamespace assetMessage = AssetNamespace.newBuilder().
                setType(AssetMessageType.GetLastStatusResponse).
                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 testGetStatusResponse ( ) throws IOException { UUID uuid = UUID . randomUUID ( ) ; ObservationGen . Observation stat = TerraHarvestMessageHelper . getProtoObs ( ) . toBuilder ( ) . setStatus ( Status . newBuilder ( ) . setSummaryStatus ( OperatingStatus . newBuilder ( ) . setDescription ( "asdf" ) . setSummary ( StatusTypesGen . SummaryStatus . Enum . OFF ) . build ( ) ) . build ( ) ) . build ( ) ; Message response = GetLastStatusResponseData . newBuilder ( ) . setStatusObservationNative ( stat ) . setAssetUuid ( SharedMessageUtils . convertUUIDToProtoUUID ( uuid ) ) . build ( ) ; AssetNamespace assetMessage = AssetNamespace . newBuilder ( ) . setType ( AssetMessageType . GetLastStatusResponse ) . 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 get status response message when handled will set the data event property.
Verify get status response message when handled will set the data event property .
// verify event is posted