mil.dod.th.ose.core.integration/src/mil/dod/th/ose/core/integration/TestPersistence.java
public void testObservationRemoval()
        throws ValidationFailedException, IllegalArgumentException, PersistenceFailedException
    {
        List<Observation> expectedObs = new ArrayList<>();
        for (int i = 0; i < 20; i++)
        {
            Observation obs = createObservation();
            obs.setCreatedTimestamp((long)i);
            expectedObs.add(obs);
            m_ObservationStore.persist(expectedObs.get(i));
        }
        
        long obsRemoved = m_ObservationStore.newQuery().withAssetType(ASSETTYPE).remove();
        assertThat(obsRemoved, is((long)expectedObs.size()));
        List<Observation> obsLeft = new ArrayList<>(m_ObservationStore.newQuery().withAssetType(ASSETTYPE).execute());
        
        //should be the 0 left
        assertThat(obsLeft.size(), is(0));
    }
/**
     * Verify can use some of the same query methods to remove observations
     */
Verify can use some of the same query methods to remove observations
Verify can use some of the same query methods to remove observations
public void testObservationRemoval()
        throws ValidationFailedException, IllegalArgumentException, PersistenceFailedException
    {
        List<Observation> expectedObs = new ArrayList<>();
        for (int i = 0; i < 20; i++)
        {
            Observation obs = createObservation();
            obs.setCreatedTimestamp((long)i);
            expectedObs.add(obs);
            m_ObservationStore.persist(expectedObs.get(i));
        }
        long obsRemoved = m_ObservationStore.newQuery().withAssetType(ASSETTYPE).remove();
        assertThat(obsRemoved, is((long)expectedObs.size()));
        List<Observation> obsLeft = new ArrayList<>(m_ObservationStore.newQuery().withAssetType(ASSETTYPE).execute());
        assertThat(obsLeft.size(), is(0));
    }
public void testObservationRemoval ( ) throws ValidationFailedException , IllegalArgumentException , PersistenceFailedException { List < Observation > expectedObs = new ArrayList < > ( ) ; for ( int i = 0 ; i < 20 ; i ++ ) { Observation obs = createObservation ( ) ; obs . setCreatedTimestamp ( ( long ) i ) ; expectedObs . add ( obs ) ; m_ObservationStore . persist ( expectedObs . get ( i ) ) ; } long obsRemoved = m_ObservationStore . newQuery ( ) . withAssetType ( ASSETTYPE ) . remove ( ) ; assertThat ( obsRemoved , is ( ( long ) expectedObs . size ( ) ) ) ; List < Observation > obsLeft = new ArrayList < > ( m_ObservationStore . newQuery ( ) . withAssetType ( ASSETTYPE ) . execute ( ) ) ; assertThat ( obsLeft . size ( ) , is ( 0 ) ) ; }
Verify can use some of the same query methods to remove observations
Verify can use some of the same query methods to remove observations
//should be the 0 left