mil.dod.th.ose.remote.integration/src/mil/dod/th/ose/remote/integration/namespace/TestObservationStoreMessageService.java
@Test
    public void testFindObservation() throws IOException, InterruptedException
    {
        //message listener that will wait for responses
        MessageListener listener = new MessageListener(socket);

        SharedMessages.UUID observationUuid1 = AssetNamespaceUtils.requestDataCaptureReturnObsUuid(socket, assetUuid);
        SharedMessages.UUID observationUuid2 = AssetNamespaceUtils.requestDataCaptureReturnObsUuid(socket, assetUuid);

        //create get observation request
        FindObservationByUUIDRequestData obsResquest = FindObservationByUUIDRequestData.newBuilder()
            .addUuidOfObservation(observationUuid1)
            .addUuidOfObservation(observationUuid2).build();

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

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

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

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

        assertThat(getObsResponse.getObservationFormat(), is(RemoteTypesGen.LexiconFormat.Enum.NATIVE));
        assertThat(getObsResponse.getObservationNativeCount(), is(2));
        assertThat(getObsResponse.getObservationNativeList().get(0).getUuid(), is(observationUuid1));
        assertThat(getObsResponse.getObservationNativeList().get(0).getAssetType(), is(ASSET_TYPE));
        assertThat(getObsResponse.getObservationNativeList().get(0).getAssetUuid(), is(assetUuid));
        assertThat(getObsResponse.getObservationNativeList().get(1).getUuid(), is(observationUuid2));
        assertThat(getObsResponse.getObservationNativeList().get(1).getAssetType(), is(ASSET_TYPE));
        assertThat(getObsResponse.getObservationNativeList().get(1).getAssetUuid(), is(assetUuid));
    }
/**
     * Test finding observations from a remote system via UUID. 
     * 
     * Verify an observation is returned.
     */
Test finding observations from a remote system via UUID.

Verify an observation is returned.
Test finding observations from a remote system via UUID . Verify an observation is returned .
@Test
    public void testFindObservation() throws IOException, InterruptedException
    {
        MessageListener listener = new MessageListener(socket);
        SharedMessages.UUID observationUuid1 = AssetNamespaceUtils.requestDataCaptureReturnObsUuid(socket, assetUuid);
        SharedMessages.UUID observationUuid2 = AssetNamespaceUtils.requestDataCaptureReturnObsUuid(socket, assetUuid);
        FindObservationByUUIDRequestData obsResquest = FindObservationByUUIDRequestData.newBuilder()
            .addUuidOfObservation(observationUuid1)
            .addUuidOfObservation(observationUuid2).build();
        TerraHarvestMessage message = createObservationStoreMessage(
            ObservationStoreMessageType.FindObservationByUUIDRequest, obsResquest);
        message.writeDelimitedTo(socket.getOutputStream());
        Message response = listener.waitForMessage(Namespace.ObservationStore, 
            ObservationStoreMessageType.FindObservationByUUIDResponse, WAIT_TIME_MS);
        ObservationStoreNamespace obsNamespaceResponse = (ObservationStoreNamespace) response;
        FindObservationByUUIDResponseData getObsResponse = FindObservationByUUIDResponseData.parseFrom(
            obsNamespaceResponse.getData());
        assertThat(getObsResponse.getObservationFormat(), is(RemoteTypesGen.LexiconFormat.Enum.NATIVE));
        assertThat(getObsResponse.getObservationNativeCount(), is(2));
        assertThat(getObsResponse.getObservationNativeList().get(0).getUuid(), is(observationUuid1));
        assertThat(getObsResponse.getObservationNativeList().get(0).getAssetType(), is(ASSET_TYPE));
        assertThat(getObsResponse.getObservationNativeList().get(0).getAssetUuid(), is(assetUuid));
        assertThat(getObsResponse.getObservationNativeList().get(1).getUuid(), is(observationUuid2));
        assertThat(getObsResponse.getObservationNativeList().get(1).getAssetType(), is(ASSET_TYPE));
        assertThat(getObsResponse.getObservationNativeList().get(1).getAssetUuid(), is(assetUuid));
    }
@ Test public void testFindObservation ( ) throws IOException , InterruptedException { MessageListener listener = new MessageListener ( socket ) ; SharedMessages . UUID observationUuid1 = AssetNamespaceUtils . requestDataCaptureReturnObsUuid ( socket , assetUuid ) ; SharedMessages . UUID observationUuid2 = AssetNamespaceUtils . requestDataCaptureReturnObsUuid ( socket , assetUuid ) ; FindObservationByUUIDRequestData obsResquest = FindObservationByUUIDRequestData . newBuilder ( ) . addUuidOfObservation ( observationUuid1 ) . addUuidOfObservation ( observationUuid2 ) . build ( ) ; TerraHarvestMessage message = createObservationStoreMessage ( ObservationStoreMessageType . FindObservationByUUIDRequest , obsResquest ) ; message . writeDelimitedTo ( socket . getOutputStream ( ) ) ; Message response = listener . waitForMessage ( Namespace . ObservationStore , ObservationStoreMessageType . FindObservationByUUIDResponse , WAIT_TIME_MS ) ; ObservationStoreNamespace obsNamespaceResponse = ( ObservationStoreNamespace ) response ; FindObservationByUUIDResponseData getObsResponse = FindObservationByUUIDResponseData . parseFrom ( obsNamespaceResponse . getData ( ) ) ; assertThat ( getObsResponse . getObservationFormat ( ) , is ( RemoteTypesGen . LexiconFormat . Enum . NATIVE ) ) ; assertThat ( getObsResponse . getObservationNativeCount ( ) , is ( 2 ) ) ; assertThat ( getObsResponse . getObservationNativeList ( ) . get ( 0 ) . getUuid ( ) , is ( observationUuid1 ) ) ; assertThat ( getObsResponse . getObservationNativeList ( ) . get ( 0 ) . getAssetType ( ) , is ( ASSET_TYPE ) ) ; assertThat ( getObsResponse . getObservationNativeList ( ) . get ( 0 ) . getAssetUuid ( ) , is ( assetUuid ) ) ; assertThat ( getObsResponse . getObservationNativeList ( ) . get ( 1 ) . getUuid ( ) , is ( observationUuid2 ) ) ; assertThat ( getObsResponse . getObservationNativeList ( ) . get ( 1 ) . getAssetType ( ) , is ( ASSET_TYPE ) ) ; assertThat ( getObsResponse . getObservationNativeList ( ) . get ( 1 ) . getAssetUuid ( ) , is ( assetUuid ) ) ; }
Test finding observations from a remote system via UUID.
Test finding observations from a remote system via UUID .
//message listener that will wait for responses //create get observation request //send request //send request //wait for response //check observation is the observation expected