Table t = RealMetadataFactory.exampleBQT().getGroupID("bqt1.smalla");
cc.accessedDataObject(t);
plan.setContext(cc);
results.setResults(tb, plan);
results.setCommand(new Query());
Cache cache = new DefaultCache("dummy"); //$NON-NLS-1$
long ts = results.getAccessInfo().getCreationTime();
// simulate the jboss-cache remote transport, where the batches are remotely looked up
// in cache
for (int row=1; row<=tb.getRowCount();row+=4) {
cache.put(results.getId()+","+row, tb.getBatch(row), null); //$NON-NLS-1$
}
results.prepare(cache, bm);
CachedResults cachedResults = UnitTestUtil.helpSerialize(results);
FakeMetadataFactory.buildWorkContext(RealMetadataFactory.exampleBQT());
cachedResults.restore(cache, bm);
// since restored, simulate a async cache flush
cache.clear();
TupleBuffer cachedTb = cachedResults.getResults();
assertTrue(cachedTb.isFinal());
assertEquals(tb.getRowCount(), cachedTb.getRowCount());