mil.dod.th.ose.remote.integration/src/mil/dod/th/ose/remote/integration/base/TestRemoteObservationListener.java
@Test
    public void testRemoteObservationListenerDisabled() throws IOException, InterruptedException
    {
        //disable the listener
        enableRemoteObservationStore(false);

        Thread.sleep(1000); //allow time for the component to unregister

        //get an observation 
        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, 800);

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

        assertThat(responseData.getObservationFormat(), is(RemoteTypesGen.LexiconFormat.Enum.NATIVE));
        assertThat(responseData.getObservationNativeCount(), is(0));
    }
/**
     * Test that the listener can be disabled and that then observations are not added when remote observation
     * messages are received.
     */
Test that the listener can be disabled and that then observations are not added when remote observation
messages are received.
Test that the listener can be disabled and that then observations are not added when remote observation messages are received .
@Test
    public void testRemoteObservationListenerDisabled() throws IOException, InterruptedException
    {
        enableRemoteObservationStore(false);
        Thread.sleep(1000); 
        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, 800);
        ObservationStoreNamespace namespace = (ObservationStoreNamespace) responseRcvd;
        FindObservationByUUIDResponseData responseData = 
            FindObservationByUUIDResponseData.parseFrom(namespace.getData());
        assertThat(responseData.getObservationFormat(), is(RemoteTypesGen.LexiconFormat.Enum.NATIVE));
        assertThat(responseData.getObservationNativeCount(), is(0));
    }
@ Test public void testRemoteObservationListenerDisabled ( ) throws IOException , InterruptedException { enableRemoteObservationStore ( false ) ; Thread . sleep ( 1000 ) ; 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 , 800 ) ; ObservationStoreNamespace namespace = ( ObservationStoreNamespace ) responseRcvd ; FindObservationByUUIDResponseData responseData = FindObservationByUUIDResponseData . parseFrom ( namespace . getData ( ) ) ; assertThat ( responseData . getObservationFormat ( ) , is ( RemoteTypesGen . LexiconFormat . Enum . NATIVE ) ) ; assertThat ( responseData . getObservationNativeCount ( ) , is ( 0 ) ) ; }
Test that the listener can be disabled and that then observations are not added when remote observation
 messages are received.
Test that the listener can be disabled and that then observations are not added when remote observation messages are received .
//disable the listener //allow time for the component to unregister //get an observation  //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