mil.dod.th.ose.remote.integration/src/mil/dod/th/ose/remote/integration/namespace/TestObservationStoreMessageService.java
@Test
    public void testGetObservationAssetType() throws IOException, InterruptedException
    {
        //create observation
        AssetNamespaceUtils.requestDataCapture(socket, assetUuid);

        //message listener that will wait for responses
        MessageListener listener = new MessageListener(socket);

        //create get observation request
        Query query = Query.newBuilder().setAssetType(ASSET_TYPE).build();
        GetObservationRequestData obsResquest = GetObservationRequestData.newBuilder().
            setObsQuery(query).build();

        //send request
        TerraHarvestMessage message = createObservationStoreMessage(ObservationStoreMessageType.GetObservationRequest,
            obsResquest);

        //send request
        message.writeDelimitedTo(socket.getOutputStream());

        //wait for response
        Message response = listener.waitForMessage(Namespace.ObservationStore, 
            ObservationStoreMessageType.GetObservationResponse, WAIT_TIME_MS);

        //check observation is the observation expected
        ObservationStoreNamespace obsNamespaceResponse = (ObservationStoreNamespace) response;
        GetObservationResponseData getObsResponse = GetObservationResponseData.parseFrom(
            obsNamespaceResponse.getData());

        //greater than 1 because if this is running on a clean controller or if before other
        //tests the number of observations in the observation store for the asset type can be different.
        assertThat(getObsResponse.getObservationFormat(), is(RemoteTypesGen.LexiconFormat.Enum.NATIVE));
        assertThat(getObsResponse.getObservationNativeCount(), greaterThan(0));
        assertThat(getObsResponse.getObservationNativeList().get(0).getAssetType(), is(ASSET_TYPE));
    }
/**
     * Test getting observations from a remote system via AssetType. 
     * 
     * Verify observations are returned.
     */
Test getting observations from a remote system via AssetType.

Verify observations are returned.
Test getting observations from a remote system via AssetType . Verify observations are returned .
@Test
    public void testGetObservationAssetType() throws IOException, InterruptedException
    {
        AssetNamespaceUtils.requestDataCapture(socket, assetUuid);
        MessageListener listener = new MessageListener(socket);
        Query query = Query.newBuilder().setAssetType(ASSET_TYPE).build();
        GetObservationRequestData obsResquest = GetObservationRequestData.newBuilder().
            setObsQuery(query).build();
        TerraHarvestMessage message = createObservationStoreMessage(ObservationStoreMessageType.GetObservationRequest,
            obsResquest);
        message.writeDelimitedTo(socket.getOutputStream());
        Message response = listener.waitForMessage(Namespace.ObservationStore, 
            ObservationStoreMessageType.GetObservationResponse, WAIT_TIME_MS);
        ObservationStoreNamespace obsNamespaceResponse = (ObservationStoreNamespace) response;
        GetObservationResponseData getObsResponse = GetObservationResponseData.parseFrom(
            obsNamespaceResponse.getData());
        assertThat(getObsResponse.getObservationFormat(), is(RemoteTypesGen.LexiconFormat.Enum.NATIVE));
        assertThat(getObsResponse.getObservationNativeCount(), greaterThan(0));
        assertThat(getObsResponse.getObservationNativeList().get(0).getAssetType(), is(ASSET_TYPE));
    }
@ Test public void testGetObservationAssetType ( ) throws IOException , InterruptedException { AssetNamespaceUtils . requestDataCapture ( socket , assetUuid ) ; MessageListener listener = new MessageListener ( socket ) ; Query query = Query . newBuilder ( ) . setAssetType ( ASSET_TYPE ) . build ( ) ; GetObservationRequestData obsResquest = GetObservationRequestData . newBuilder ( ) . setObsQuery ( query ) . build ( ) ; TerraHarvestMessage message = createObservationStoreMessage ( ObservationStoreMessageType . GetObservationRequest , obsResquest ) ; message . writeDelimitedTo ( socket . getOutputStream ( ) ) ; Message response = listener . waitForMessage ( Namespace . ObservationStore , ObservationStoreMessageType . GetObservationResponse , WAIT_TIME_MS ) ; ObservationStoreNamespace obsNamespaceResponse = ( ObservationStoreNamespace ) response ; GetObservationResponseData getObsResponse = GetObservationResponseData . parseFrom ( obsNamespaceResponse . getData ( ) ) ; assertThat ( getObsResponse . getObservationFormat ( ) , is ( RemoteTypesGen . LexiconFormat . Enum . NATIVE ) ) ; assertThat ( getObsResponse . getObservationNativeCount ( ) , greaterThan ( 0 ) ) ; assertThat ( getObsResponse . getObservationNativeList ( ) . get ( 0 ) . getAssetType ( ) , is ( ASSET_TYPE ) ) ; }
Test getting observations from a remote system via AssetType.
Test getting observations from a remote system via AssetType .
//create observation //message listener that will wait for responses //create get observation request //send request //send request //wait for response //check observation is the observation expected //greater than 1 because if this is running on a clean controller or if before other //tests the number of observations in the observation store for the asset type can be different.