return cache;
}
public void testPassivationLocal() throws Exception
{
CacheSPI cache = createLocalCache();
CacheLoader loader = cache.getCacheLoaderManager().getCacheLoader();
// clean up
cache.removeNode(fqn);
loader.remove(fqn);
assertNull(loader.get(fqn));
DummyTransactionManager mgr = DummyTransactionManager.getInstance();
// put something in the cache
mgr.begin();
cache.put(fqn, key, value);
mgr.commit();
// should be nothing in the loader
assertEquals(value, cache.get(fqn, key));
assertNull(loader.get(fqn));
// evict from cache
mgr.begin();
cache.evict(fqn);
mgr.commit();
mgr.begin();
// should now be passivated in the loader
// don't do a cache.get() first as this will activate this node from the loader again!
// assertNull( cache.get( fqn ) );
assertEquals(value, loader.get(fqn).get(key));
// now do a cache.get()...
assertEquals(value, cache.get(fqn, key));
// and the object should now be removed from the loader
assertNull(loader.get(fqn));
mgr.commit();
// clean up
mgr.begin();
cache.removeNode(fqn);
loader.remove(fqn);
mgr.commit();
}