mil.dod.th.ose.remote.integration/src/mil/dod/th/ose/remote/integration/namespace/TestObservationStoreMessageService.java
@Test
    public void testGetObservationAssetUuid() throws IOException, InterruptedException
    {
        //request that the created asset captures data
        SharedMessages.UUID observationUuid = AssetNamespaceUtils.requestDataCaptureReturnObsUuid(socket, assetUuid);

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

        //create get observation request
        Query query = Query.newBuilder()
                .setAssetUuid(assetUuid)
                .addObservationSubType(ObservationSubTypeEnumConverter
                        .convertJavaEnumToProto(ObservationSubTypeEnum.DETECTION))
                .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());

        assertThat(getObsResponse.getObservationFormat(), is(RemoteTypesGen.LexiconFormat.Enum.NATIVE));
        assertThat(getObsResponse.getObservationNativeCount(), is(1));
        assertThat(getObsResponse.getObservationNativeList().get(0).getAssetUuid().getLeastSignificantBits(), 
            is(assetUuid.getLeastSignificantBits()));
        assertThat(getObsResponse.getObservationNativeList().get(0).getAssetUuid().getMostSignificantBits(), 
                is(assetUuid.getMostSignificantBits()));
        assertThat(getObsResponse.getObservationNativeList().get(0).getUuid(), is(observationUuid));
    }
/**
     * Test getting observations from a remote system via asset ID. 
     * 
     * Verify observations are returned.
     */
Test getting observations from a remote system via asset ID.

Verify observations are returned.
Test getting observations from a remote system via asset ID . Verify observations are returned .
@Test
    public void testGetObservationAssetUuid() throws IOException, InterruptedException
    {
        SharedMessages.UUID observationUuid = AssetNamespaceUtils.requestDataCaptureReturnObsUuid(socket, assetUuid);
        MessageListener listener = new MessageListener(socket);
        Query query = Query.newBuilder()
                .setAssetUuid(assetUuid)
                .addObservationSubType(ObservationSubTypeEnumConverter
                        .convertJavaEnumToProto(ObservationSubTypeEnum.DETECTION))
                .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(), is(1));
        assertThat(getObsResponse.getObservationNativeList().get(0).getAssetUuid().getLeastSignificantBits(), 
            is(assetUuid.getLeastSignificantBits()));
        assertThat(getObsResponse.getObservationNativeList().get(0).getAssetUuid().getMostSignificantBits(), 
                is(assetUuid.getMostSignificantBits()));
        assertThat(getObsResponse.getObservationNativeList().get(0).getUuid(), is(observationUuid));
    }
@ Test public void testGetObservationAssetUuid ( ) throws IOException , InterruptedException { SharedMessages . UUID observationUuid = AssetNamespaceUtils . requestDataCaptureReturnObsUuid ( socket , assetUuid ) ; MessageListener listener = new MessageListener ( socket ) ; Query query = Query . newBuilder ( ) . setAssetUuid ( assetUuid ) . addObservationSubType ( ObservationSubTypeEnumConverter . convertJavaEnumToProto ( ObservationSubTypeEnum . DETECTION ) ) . 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 ( ) , is ( 1 ) ) ; assertThat ( getObsResponse . getObservationNativeList ( ) . get ( 0 ) . getAssetUuid ( ) . getLeastSignificantBits ( ) , is ( assetUuid . getLeastSignificantBits ( ) ) ) ; assertThat ( getObsResponse . getObservationNativeList ( ) . get ( 0 ) . getAssetUuid ( ) . getMostSignificantBits ( ) , is ( assetUuid . getMostSignificantBits ( ) ) ) ; assertThat ( getObsResponse . getObservationNativeList ( ) . get ( 0 ) . getUuid ( ) , is ( observationUuid ) ) ; }
Test getting observations from a remote system via asset ID.
Test getting observations from a remote system via asset ID .
//request that the created asset captures data //message listener that will wait for responses //create get observation request //send request //send request //wait for response //check observation is the observation expected