mil.dod.th.ose.core.integration/src/mil/dod/th/ose/core/integration/TestPersistence.java
public void testPersistentDataStoreQueries() throws IllegalArgumentException, PersistenceFailedException,
        InterruptedException 
    {
        final ExampleNonLexiconData exampleDataType = new ExampleNonLexiconData(12345L, "testString");
        final ExampleNonLexiconData exampleDataType2 = new ExampleNonLexiconData(12345L, 
                "testString2");
        
        //clear out data store
        m_PersistentDataStore.removeMatching(ExampleNonLexiconData.class);
        
        //record the begin time and end time of the first entry
        Long startTime = System.currentTimeMillis();
        m_PersistentDataStore.persist(ExampleNonLexiconData.class, UUID.randomUUID(), "Long",
                exampleDataType);
        Long endTime = System.currentTimeMillis();
        
        //add one second delay before next data store entries
        Thread.sleep(1000);
        
        //add two more entries
        m_PersistentDataStore.persist(ExampleNonLexiconData.class, UUID.randomUUID(), "Long", 
                exampleDataType2);
        m_PersistentDataStore.persist(ExampleNonLexiconData.class, UUID.randomUUID(), "Short", 
                exampleDataType2);
        
        //query by context
        Collection<? extends PersistentData> pDataColl = m_PersistentDataStore.query(ExampleNonLexiconData.class);
        assertThat(pDataColl.size(), is(3));
        
        //query by context and description
        pDataColl = m_PersistentDataStore.query(ExampleNonLexiconData.class, "Long");        
        assertThat(pDataColl.size(), is(2));

        //query by context and date
        pDataColl = m_PersistentDataStore.query(ExampleNonLexiconData.class, new Date(startTime), new Date(endTime));
        assertThat(pDataColl.size(), is(1));
        
        //query by context, description, and date
        pDataColl = m_PersistentDataStore.query(ExampleNonLexiconData.class, "Short", new Date(startTime), 
                new Date(endTime));
        assertThat(pDataColl.size(), is(0));
    }
/**
     * Verify correct number of entries is returned based on queries.
     */
Verify correct number of entries is returned based on queries.
Verify correct number of entries is returned based on queries .
public void testPersistentDataStoreQueries() throws IllegalArgumentException, PersistenceFailedException,
        InterruptedException 
    {
        final ExampleNonLexiconData exampleDataType = new ExampleNonLexiconData(12345L, "testString");
        final ExampleNonLexiconData exampleDataType2 = new ExampleNonLexiconData(12345L, 
                "testString2");
        m_PersistentDataStore.removeMatching(ExampleNonLexiconData.class);
        Long startTime = System.currentTimeMillis();
        m_PersistentDataStore.persist(ExampleNonLexiconData.class, UUID.randomUUID(), "Long",
                exampleDataType);
        Long endTime = System.currentTimeMillis();
        Thread.sleep(1000);
        m_PersistentDataStore.persist(ExampleNonLexiconData.class, UUID.randomUUID(), "Long", 
                exampleDataType2);
        m_PersistentDataStore.persist(ExampleNonLexiconData.class, UUID.randomUUID(), "Short", 
                exampleDataType2);
        Collection<? extends PersistentData> pDataColl = m_PersistentDataStore.query(ExampleNonLexiconData.class);
        assertThat(pDataColl.size(), is(3));
         and description
        pDataColl = m_PersistentDataStore.query(ExampleNonLexiconData.class, "Long");        
        assertThat(pDataColl.size(), is(2));
         and date
        pDataColl = m_PersistentDataStore.query(ExampleNonLexiconData.class, new Date(startTime), new Date(endTime));
        assertThat(pDataColl.size(), is(1));
        , description, and date
        pDataColl = m_PersistentDataStore.query(ExampleNonLexiconData.class, "Short", new Date(startTime), 
                new Date(endTime));
        assertThat(pDataColl.size(), is(0));
    }
public void testPersistentDataStoreQueries ( ) throws IllegalArgumentException , PersistenceFailedException , InterruptedException { final ExampleNonLexiconData exampleDataType = new ExampleNonLexiconData ( 12345L , "testString" ) ; final ExampleNonLexiconData exampleDataType2 = new ExampleNonLexiconData ( 12345L , "testString2" ) ; m_PersistentDataStore . removeMatching ( ExampleNonLexiconData . class ) ; Long startTime = System . currentTimeMillis ( ) ; m_PersistentDataStore . persist ( ExampleNonLexiconData . class , UUID . randomUUID ( ) , "Long" , exampleDataType ) ; Long endTime = System . currentTimeMillis ( ) ; Thread . sleep ( 1000 ) ; m_PersistentDataStore . persist ( ExampleNonLexiconData . class , UUID . randomUUID ( ) , "Long" , exampleDataType2 ) ; m_PersistentDataStore . persist ( ExampleNonLexiconData . class , UUID . randomUUID ( ) , "Short" , exampleDataType2 ) ; Collection < ? extends PersistentData > pDataColl = m_PersistentDataStore . query ( ExampleNonLexiconData . class ) ; assertThat ( pDataColl . size ( ) , is ( 3 ) ) ; pDataColl = m_PersistentDataStore . query ( ExampleNonLexiconData . class , "Long" ) ; assertThat ( pDataColl . size ( ) , is ( 2 ) ) ; pDataColl = m_PersistentDataStore . query ( ExampleNonLexiconData . class , new Date ( startTime ) , new Date ( endTime ) ) ; assertThat ( pDataColl . size ( ) , is ( 1 ) ) ; pDataColl = m_PersistentDataStore . query ( ExampleNonLexiconData . class , "Short" , new Date ( startTime ) , new Date ( endTime ) ) ; assertThat ( pDataColl . size ( ) , is ( 0 ) ) ; }
Verify correct number of entries is returned based on queries.
Verify correct number of entries is returned based on queries .
//clear out data store //record the begin time and end time of the first entry //add one second delay before next data store entries //add two more entries //query by context //query by context and description //query by context and date //query by context, description, and date