mil.dod.th.ose.core.integration/src/mil/dod/th/ose/core/integration/TestPersistence.java
public void testQueryByCreatedTime() throws Exception
    {
        //create one observation now
        final Observation observation = createObservation();
        m_ObservationStore.persist(observation);
        
        // wait between persisting so the previous observation is not included in the query
        Thread.sleep(1000);
        
        //time when collection of observations started
        final Date startTime = new Date();
        //create observations
        for (int i = 0; i < 4; i++)
        {
            m_ObservationStore.persist(createObservation());
        }
        //time when creation stopped
        final Date stopTime = new Date();
        
        //query by asset type
        final Collection<Observation> observationCollection1 = m_ObservationStore.queryByAssetType(ASSETTYPE);
        assertThat(observationCollection1, is(notNullValue()));
        //created 4 above, and one previously
        assertThat(observationCollection1.size(), is(5));

        //query by creation time and ensure that the same observations are returned, minus the one created before
        //the start time
        final Collection<Observation> observationCollection2 = m_ObservationStore.newQuery()
                    .withAssetType(ASSETTYPE)
                    .withTimeCreatedRange(startTime, stopTime)
                    .withMaxObservations(20)
                    .withSubType(ObservationSubTypeEnum.WEATHER)
                    .execute();
        
        assertThat(observationCollection2, is(notNullValue()));
        assertThat(observationCollection2.size(), is(4));

        //query by observed time and ensure that no observations are returned since observed field is not set
        final Collection<Observation> observationCollection3 = m_ObservationStore.newQuery()
                    .withTimeObservedRange(startTime, stopTime)
                    .withMaxObservations(20)
                    .execute();
        
        assertThat(observationCollection3, is(notNullValue()));
        assertThat(observationCollection3.size(), is(0));
    }
/**
     * Verify that observation can be queried for within a specific time frame (createdTime), and that ONLY those
     * observations are returned. Also, query both other things at the same time.
     */
Verify that observation can be queried for within a specific time frame (createdTime), and that ONLY those
observations are returned. Also, query both other things at the same time.
Verify that observation can be queried for within a specific time frame ( createdTime ) and that ONLY those observations are returned . Also query both other things at the same time .
public void testQueryByCreatedTime() throws Exception
    {
        final Observation observation = createObservation();
        m_ObservationStore.persist(observation);
        Thread.sleep(1000);
        final Date startTime = new Date();
        for (int i = 0; i < 4; i++)
        {
            m_ObservationStore.persist(createObservation());
        }
        final Date stopTime = new Date();
        final Collection<Observation> observationCollection1 = m_ObservationStore.queryByAssetType(ASSETTYPE);
        assertThat(observationCollection1, is(notNullValue()));
        assertThat(observationCollection1.size(), is(5));
        final Collection<Observation> observationCollection2 = m_ObservationStore.newQuery()
                    .withAssetType(ASSETTYPE)
                    .withTimeCreatedRange(startTime, stopTime)
                    .withMaxObservations(20)
                    .withSubType(ObservationSubTypeEnum.WEATHER)
                    .execute();
        assertThat(observationCollection2, is(notNullValue()));
        assertThat(observationCollection2.size(), is(4));
        final Collection<Observation> observationCollection3 = m_ObservationStore.newQuery()
                    .withTimeObservedRange(startTime, stopTime)
                    .withMaxObservations(20)
                    .execute();
        assertThat(observationCollection3, is(notNullValue()));
        assertThat(observationCollection3.size(), is(0));
    }
public void testQueryByCreatedTime ( ) throws Exception { final Observation observation = createObservation ( ) ; m_ObservationStore . persist ( observation ) ; Thread . sleep ( 1000 ) ; final Date startTime = new Date ( ) ; for ( int i = 0 ; i < 4 ; i ++ ) { m_ObservationStore . persist ( createObservation ( ) ) ; } final Date stopTime = new Date ( ) ; final Collection < Observation > observationCollection1 = m_ObservationStore . queryByAssetType ( ASSETTYPE ) ; assertThat ( observationCollection1 , is ( notNullValue ( ) ) ) ; assertThat ( observationCollection1 . size ( ) , is ( 5 ) ) ; final Collection < Observation > observationCollection2 = m_ObservationStore . newQuery ( ) . withAssetType ( ASSETTYPE ) . withTimeCreatedRange ( startTime , stopTime ) . withMaxObservations ( 20 ) . withSubType ( ObservationSubTypeEnum . WEATHER ) . execute ( ) ; assertThat ( observationCollection2 , is ( notNullValue ( ) ) ) ; assertThat ( observationCollection2 . size ( ) , is ( 4 ) ) ; final Collection < Observation > observationCollection3 = m_ObservationStore . newQuery ( ) . withTimeObservedRange ( startTime , stopTime ) . withMaxObservations ( 20 ) . execute ( ) ; assertThat ( observationCollection3 , is ( notNullValue ( ) ) ) ; assertThat ( observationCollection3 . size ( ) , is ( 0 ) ) ; }
Verify that observation can be queried for within a specific time frame (createdTime), and that ONLY those
 observations are returned.
Verify that observation can be queried for within a specific time frame ( createdTime ) and that ONLY those observations are returned .
//create one observation now // wait between persisting so the previous observation is not included in the query //time when collection of observations started //create observations //time when creation stopped //query by asset type //created 4 above, and one previously //query by creation time and ensure that the same observations are returned, minus the one created before //the start time //query by observed time and ensure that no observations are returned since observed field is not set