/* * @see junit.framework.TestCase#tearDown() */ @After public void increCacheDataSetTearDown() throws Exception { dataEngine.shutdown(); // clear persistent cache to void conflict with other test cases getDataSetCacheManager(dataEngine).clearCache(dataSource, dataSet); getDataSetCacheManager((DataEngineImpl) dataEngine).resetForTest(); }
@Test public void testUpdateIncreCache() { try { assertEquals(8, getQueryResultCount()); getDataSetCacheManager((DataEngineImpl) dataEngine).resetForTest(); // append new data to the original data set Random random = new Random(); int count = random.nextInt(100) + 1; appendNewData(count); // populate the data set with the updated file prepareDataSet(getDataSourceInfo()); assertEquals(count + 8, getQueryResultCount()); assertTrue(getDataSetCacheManager(dataEngine).doesSaveToCache()); assertTrue(getDataSetCacheManager(dataEngine).doesLoadFromCache()); } catch (Exception e) { fail(e.getMessage()); } }
/** * @param dataEngine * @return */ private DataSetCacheManager getDataSetCacheManager(DataEngine dataEngine) { DataEngineImpl engine = (DataEngineImpl) dataEngine; return engine.getSession().getDataSetCacheManager(); }