mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/asset/TestAssetDirectoryMessageService.java
@Test
    public final void testGetCapabilitiesResponse() throws IOException
    {
        Message capsGen = AssetCapabilitiesGen.AssetCapabilities.newBuilder().
                setNominalFov(22.0).
                setBase(BaseCapabilitiesGen.BaseCapabilities.newBuilder().
                    setManufacturer("teamAwesome").
                    setDescription("does stuff").
                    setProductName("Bill")).
                build();
        Message response = GetCapabilitiesResponseData.newBuilder().
                setCapabilities((AssetCapabilitiesGen.AssetCapabilities)capsGen).
                setProductType(AssetProxy.class.getName()).build();
        AssetDirectoryServiceNamespace assetMessage = AssetDirectoryServiceNamespace.newBuilder().
                setType(AssetDirectoryServiceMessageType.GetCapabilitiesResponse).
                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 capabilities response message when handled will set the data event property.
     */
Verify get capabilities response message when handled will set the data event property.
Verify get capabilities response message when handled will set the data event property .
@Test
    public final void testGetCapabilitiesResponse() throws IOException
    {
        Message capsGen = AssetCapabilitiesGen.AssetCapabilities.newBuilder().
                setNominalFov(22.0).
                setBase(BaseCapabilitiesGen.BaseCapabilities.newBuilder().
                    setManufacturer("teamAwesome").
                    setDescription("does stuff").
                    setProductName("Bill")).
                build();
        Message response = GetCapabilitiesResponseData.newBuilder().
                setCapabilities((AssetCapabilitiesGen.AssetCapabilities)capsGen).
                setProductType(AssetProxy.class.getName()).build();
        AssetDirectoryServiceNamespace assetMessage = AssetDirectoryServiceNamespace.newBuilder().
                setType(AssetDirectoryServiceMessageType.GetCapabilitiesResponse).
                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 testGetCapabilitiesResponse ( ) throws IOException { Message capsGen = AssetCapabilitiesGen . AssetCapabilities . newBuilder ( ) . setNominalFov ( 22.0 ) . setBase ( BaseCapabilitiesGen . BaseCapabilities . newBuilder ( ) . setManufacturer ( "teamAwesome" ) . setDescription ( "does stuff" ) . setProductName ( "Bill" ) ) . build ( ) ; Message response = GetCapabilitiesResponseData . newBuilder ( ) . setCapabilities ( ( AssetCapabilitiesGen . AssetCapabilities ) capsGen ) . setProductType ( AssetProxy . class . getName ( ) ) . build ( ) ; AssetDirectoryServiceNamespace assetMessage = AssetDirectoryServiceNamespace . newBuilder ( ) . setType ( AssetDirectoryServiceMessageType . GetCapabilitiesResponse ) . 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 capabilities response message when handled will set the data event property.
Verify get capabilities response message when handled will set the data event property .
// verify event is posted