mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/observation/TestObservationMessageService.java
@Test
    public void testGetObservationCount() throws IOException
    {
        Query query = Query.getDefaultInstance();
        
        GetObservationCountRequestData message = GetObservationCountRequestData
                .newBuilder().setObsQuery(query).build();
        
        ObservationStoreNamespace namespace = ObservationStoreNamespace.newBuilder()
                .setData(message.toByteString())
                .setType(ObservationStoreMessageType.GetObservationCountRequest).build();
        TerraHarvestPayload payload = createPayload(namespace);
        TerraHarvestMessage thMessage = createMessageObservationStore(namespace);
        
        RemoteChannel channel = mock(RemoteChannel.class);
        
        ObservationQuery oQuery = mock(ObservationQuery.class);
        when(m_ObservationStore.newQuery()).thenReturn(oQuery);
        when(oQuery.getCount()).thenReturn(44L);
        
        m_SUT.handleMessage(thMessage, payload, channel);
        
        ArgumentCaptor<GetObservationCountResponseData> response = ArgumentCaptor
                .forClass(GetObservationCountResponseData.class);
        verify(m_MessageFactory).createObservationStoreResponseMessage(eq(thMessage), 
                eq(ObservationStoreMessageType.GetObservationCountResponse), response.capture());
        verify(m_ResponseWrapper).queue(channel);
        
        GetObservationCountResponseData responseData = response.getValue();
        assertThat(responseData.getCount(), is(44L));   
    }
/**
     * Verify that an observation count message is properly processed.
     */
Verify that an observation count message is properly processed.
Verify that an observation count message is properly processed .
@Test
    public void testGetObservationCount() throws IOException
    {
        Query query = Query.getDefaultInstance();
        GetObservationCountRequestData message = GetObservationCountRequestData
                .newBuilder().setObsQuery(query).build();
        ObservationStoreNamespace namespace = ObservationStoreNamespace.newBuilder()
                .setData(message.toByteString())
                .setType(ObservationStoreMessageType.GetObservationCountRequest).build();
        TerraHarvestPayload payload = createPayload(namespace);
        TerraHarvestMessage thMessage = createMessageObservationStore(namespace);
        RemoteChannel channel = mock(RemoteChannel.class);
        ObservationQuery oQuery = mock(ObservationQuery.class);
        when(m_ObservationStore.newQuery()).thenReturn(oQuery);
        when(oQuery.getCount()).thenReturn(44L);
        m_SUT.handleMessage(thMessage, payload, channel);
        ArgumentCaptor<GetObservationCountResponseData> response = ArgumentCaptor
                .forClass(GetObservationCountResponseData.class);
        verify(m_MessageFactory).createObservationStoreResponseMessage(eq(thMessage), 
                eq(ObservationStoreMessageType.GetObservationCountResponse), response.capture());
        verify(m_ResponseWrapper).queue(channel);
        GetObservationCountResponseData responseData = response.getValue();
        assertThat(responseData.getCount(), is(44L));   
    }
@ Test public void testGetObservationCount ( ) throws IOException { Query query = Query . getDefaultInstance ( ) ; GetObservationCountRequestData message = GetObservationCountRequestData . newBuilder ( ) . setObsQuery ( query ) . build ( ) ; ObservationStoreNamespace namespace = ObservationStoreNamespace . newBuilder ( ) . setData ( message . toByteString ( ) ) . setType ( ObservationStoreMessageType . GetObservationCountRequest ) . build ( ) ; TerraHarvestPayload payload = createPayload ( namespace ) ; TerraHarvestMessage thMessage = createMessageObservationStore ( namespace ) ; RemoteChannel channel = mock ( RemoteChannel . class ) ; ObservationQuery oQuery = mock ( ObservationQuery . class ) ; when ( m_ObservationStore . newQuery ( ) ) . thenReturn ( oQuery ) ; when ( oQuery . getCount ( ) ) . thenReturn ( 44L ) ; m_SUT . handleMessage ( thMessage , payload , channel ) ; ArgumentCaptor < GetObservationCountResponseData > response = ArgumentCaptor . forClass ( GetObservationCountResponseData . class ) ; verify ( m_MessageFactory ) . createObservationStoreResponseMessage ( eq ( thMessage ) , eq ( ObservationStoreMessageType . GetObservationCountResponse ) , response . capture ( ) ) ; verify ( m_ResponseWrapper ) . queue ( channel ) ; GetObservationCountResponseData responseData = response . getValue ( ) ; assertThat ( responseData . getCount ( ) , is ( 44L ) ) ; }
Verify that an observation count message is properly processed.
Verify that an observation count message is properly processed .