mil.dod.th.ose.remote.integration/src/mil/dod/th/ose/remote/integration/base/TestRemoteObservationListener.java
@Test
    public void testRemoteObservation() throws IOException, InterruptedException
    {
        //observation message
        ObservationGen.Observation obs = createProtoObservation();

        //get observation responses
        GetObservationResponseData response = GetObservationResponseData.newBuilder().
            addObservationNative(obs).build();
        TerraHarvestMessage message = 
            TestObservationStoreMessageService.createObservationStoreMessage(
                ObservationStoreMessageType.GetObservationResponse, response);

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

        //wait for observation to be loaded
        Thread.sleep(1000);

        //check observation was added
        FindObservationByUUIDRequestData request = FindObservationByUUIDRequestData.newBuilder().
            addUuidOfObservation(obs.getUuid()).build();
        message = TestObservationStoreMessageService.createObservationStoreMessage(
            ObservationStoreMessageType.FindObservationByUUIDRequest, request);

        //message listener to get the find request message
        MessageListener listener = new MessageListener(socket);

        //send request to get observations
        message.writeDelimitedTo(socket.getOutputStream());

        Message responseRcvd = listener.waitForMessage(Namespace.ObservationStore, 
            ObservationStoreMessageType.FindObservationByUUIDResponse, 1000);

        //parse response
        ObservationStoreNamespace namespace = (ObservationStoreNamespace) responseRcvd;
        FindObservationByUUIDResponseData responseData = 
            FindObservationByUUIDResponseData.parseFrom(namespace.getData());

        assertThat(responseData.getObservationFormat(), is(RemoteTypesGen.LexiconFormat.Enum.NATIVE));
        assertThat(responseData.getObservationNativeCount(), is(1));
        assertThat(responseData.getObservationNativeList().get(0), is(obs));
    }
/**
     * Test that if a remote observation message is remotely received that the observation is persisted on the 
     * controller.
     */
Test that if a remote observation message is remotely received that the observation is persisted on the
controller.
Test that if a remote observation message is remotely received that the observation is persisted on the controller .
@Test
    public void testRemoteObservation() throws IOException, InterruptedException
    {
        ObservationGen.Observation obs = createProtoObservation();
        GetObservationResponseData response = GetObservationResponseData.newBuilder().
            addObservationNative(obs).build();
        TerraHarvestMessage message = 
            TestObservationStoreMessageService.createObservationStoreMessage(
                ObservationStoreMessageType.GetObservationResponse, response);
        message.writeDelimitedTo(socket.getOutputStream());
        Thread.sleep(1000);
        FindObservationByUUIDRequestData request = FindObservationByUUIDRequestData.newBuilder().
            addUuidOfObservation(obs.getUuid()).build();
        message = TestObservationStoreMessageService.createObservationStoreMessage(
            ObservationStoreMessageType.FindObservationByUUIDRequest, request);
        MessageListener listener = new MessageListener(socket);
        message.writeDelimitedTo(socket.getOutputStream());
        Message responseRcvd = listener.waitForMessage(Namespace.ObservationStore, 
            ObservationStoreMessageType.FindObservationByUUIDResponse, 1000);
        ObservationStoreNamespace namespace = (ObservationStoreNamespace) responseRcvd;
        FindObservationByUUIDResponseData responseData = 
            FindObservationByUUIDResponseData.parseFrom(namespace.getData());
        assertThat(responseData.getObservationFormat(), is(RemoteTypesGen.LexiconFormat.Enum.NATIVE));
        assertThat(responseData.getObservationNativeCount(), is(1));
        assertThat(responseData.getObservationNativeList().get(0), is(obs));
    }
@ Test public void testRemoteObservation ( ) throws IOException , InterruptedException { ObservationGen . Observation obs = createProtoObservation ( ) ; GetObservationResponseData response = GetObservationResponseData . newBuilder ( ) . addObservationNative ( obs ) . build ( ) ; TerraHarvestMessage message = TestObservationStoreMessageService . createObservationStoreMessage ( ObservationStoreMessageType . GetObservationResponse , response ) ; message . writeDelimitedTo ( socket . getOutputStream ( ) ) ; Thread . sleep ( 1000 ) ; FindObservationByUUIDRequestData request = FindObservationByUUIDRequestData . newBuilder ( ) . addUuidOfObservation ( obs . getUuid ( ) ) . build ( ) ; message = TestObservationStoreMessageService . createObservationStoreMessage ( ObservationStoreMessageType . FindObservationByUUIDRequest , request ) ; MessageListener listener = new MessageListener ( socket ) ; message . writeDelimitedTo ( socket . getOutputStream ( ) ) ; Message responseRcvd = listener . waitForMessage ( Namespace . ObservationStore , ObservationStoreMessageType . FindObservationByUUIDResponse , 1000 ) ; ObservationStoreNamespace namespace = ( ObservationStoreNamespace ) responseRcvd ; FindObservationByUUIDResponseData responseData = FindObservationByUUIDResponseData . parseFrom ( namespace . getData ( ) ) ; assertThat ( responseData . getObservationFormat ( ) , is ( RemoteTypesGen . LexiconFormat . Enum . NATIVE ) ) ; assertThat ( responseData . getObservationNativeCount ( ) , is ( 1 ) ) ; assertThat ( responseData . getObservationNativeList ( ) . get ( 0 ) , is ( obs ) ) ; }
Test that if a remote observation message is remotely received that the observation is persisted on the
 controller.
Test that if a remote observation message is remotely received that the observation is persisted on the controller .
//observation message //get observation responses //send observation //wait for observation to be loaded //check observation was added //message listener to get the find request message //send request to get observations //parse response