mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/observation/TestObservationMessageService.java
@Test
    public void testGetObservationCountResponse() throws IOException
    {
        GetObservationCountResponseData message = GetObservationCountResponseData.newBuilder().setCount(33L).build();
        
        ObservationStoreNamespace namespace = ObservationStoreNamespace.newBuilder()
                .setData(message.toByteString())
                .setType(ObservationStoreMessageType.GetObservationCountResponse).build();
        TerraHarvestPayload payload = createPayload(namespace);
        TerraHarvestMessage thMessage = createMessageObservationStore(namespace);
        
        RemoteChannel channel = mock(RemoteChannel.class);
        
        m_SUT.handleMessage(thMessage, payload, channel);
        
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin).postEvent(eventCaptor.capture());
        
        Event postedEvent = eventCaptor.getValue();
        
        assertThat(postedEvent.getTopic(), is(RemoteConstants.TOPIC_MESSAGE_RECEIVED));
        assertThat((TerraHarvestMessage)postedEvent.getProperty(RemoteConstants.EVENT_PROP_MESSAGE), is(thMessage));
        assertThat((String)postedEvent.getProperty(RemoteConstants.EVENT_PROP_MESSAGE_TYPE), 
            is(ObservationStoreMessageType.GetObservationCountResponse.toString()));
        
        GetObservationCountResponseData response = (GetObservationCountResponseData)
                postedEvent.getProperty(RemoteConstants.EVENT_PROP_DATA_MESSAGE);
        
        assertThat(response.getCount(), is(33L));
        assertThat((ObservationStoreNamespace)postedEvent.getProperty(RemoteConstants.EVENT_PROP_NAMESPACE_MESSAGE), 
            is(namespace));
        assertThat((RemoteChannel)postedEvent.getProperty(RemoteConstants.EVENT_PROP_CHANNEL), is(channel));
    }
/**
     * Verify that a GetObservationCountResponse message is properly handled.
     */
Verify that a GetObservationCountResponse message is properly handled.
Verify that a GetObservationCountResponse message is properly handled .
@Test
    public void testGetObservationCountResponse() throws IOException
    {
        GetObservationCountResponseData message = GetObservationCountResponseData.newBuilder().setCount(33L).build();
        ObservationStoreNamespace namespace = ObservationStoreNamespace.newBuilder()
                .setData(message.toByteString())
                .setType(ObservationStoreMessageType.GetObservationCountResponse).build();
        TerraHarvestPayload payload = createPayload(namespace);
        TerraHarvestMessage thMessage = createMessageObservationStore(namespace);
        RemoteChannel channel = mock(RemoteChannel.class);
        m_SUT.handleMessage(thMessage, payload, channel);
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin).postEvent(eventCaptor.capture());
        Event postedEvent = eventCaptor.getValue();
        assertThat(postedEvent.getTopic(), is(RemoteConstants.TOPIC_MESSAGE_RECEIVED));
        assertThat((TerraHarvestMessage)postedEvent.getProperty(RemoteConstants.EVENT_PROP_MESSAGE), is(thMessage));
        assertThat((String)postedEvent.getProperty(RemoteConstants.EVENT_PROP_MESSAGE_TYPE), 
            is(ObservationStoreMessageType.GetObservationCountResponse.toString()));
        GetObservationCountResponseData response = (GetObservationCountResponseData)
                postedEvent.getProperty(RemoteConstants.EVENT_PROP_DATA_MESSAGE);
        assertThat(response.getCount(), is(33L));
        assertThat((ObservationStoreNamespace)postedEvent.getProperty(RemoteConstants.EVENT_PROP_NAMESPACE_MESSAGE), 
            is(namespace));
        assertThat((RemoteChannel)postedEvent.getProperty(RemoteConstants.EVENT_PROP_CHANNEL), is(channel));
    }
@ Test public void testGetObservationCountResponse ( ) throws IOException { GetObservationCountResponseData message = GetObservationCountResponseData . newBuilder ( ) . setCount ( 33L ) . build ( ) ; ObservationStoreNamespace namespace = ObservationStoreNamespace . newBuilder ( ) . setData ( message . toByteString ( ) ) . setType ( ObservationStoreMessageType . GetObservationCountResponse ) . build ( ) ; TerraHarvestPayload payload = createPayload ( namespace ) ; TerraHarvestMessage thMessage = createMessageObservationStore ( namespace ) ; RemoteChannel channel = mock ( RemoteChannel . class ) ; m_SUT . handleMessage ( thMessage , payload , channel ) ; ArgumentCaptor < Event > eventCaptor = ArgumentCaptor . forClass ( Event . class ) ; verify ( m_EventAdmin ) . postEvent ( eventCaptor . capture ( ) ) ; Event postedEvent = eventCaptor . getValue ( ) ; assertThat ( postedEvent . getTopic ( ) , is ( RemoteConstants . TOPIC_MESSAGE_RECEIVED ) ) ; assertThat ( ( TerraHarvestMessage ) postedEvent . getProperty ( RemoteConstants . EVENT_PROP_MESSAGE ) , is ( thMessage ) ) ; assertThat ( ( String ) postedEvent . getProperty ( RemoteConstants . EVENT_PROP_MESSAGE_TYPE ) , is ( ObservationStoreMessageType . GetObservationCountResponse . toString ( ) ) ) ; GetObservationCountResponseData response = ( GetObservationCountResponseData ) postedEvent . getProperty ( RemoteConstants . EVENT_PROP_DATA_MESSAGE ) ; assertThat ( response . getCount ( ) , is ( 33L ) ) ; assertThat ( ( ObservationStoreNamespace ) postedEvent . getProperty ( RemoteConstants . EVENT_PROP_NAMESPACE_MESSAGE ) , is ( namespace ) ) ; assertThat ( ( RemoteChannel ) postedEvent . getProperty ( RemoteConstants . EVENT_PROP_CHANNEL ) , is ( channel ) ) ; }
Verify that a GetObservationCountResponse message is properly handled.
Verify that a GetObservationCountResponse message is properly handled .