{
CacheSPI<Object, Object> cache = cacheTL.get();
CacheLoader loader = loaderTL.get();
Fqn fqn = Fqn.fromString("/mypojo");
SamplePojo pojo = new SamplePojo(39, "Hany");
pojo.getHobbies().add("Running");
pojo.getHobbies().add("Beerathlon");
pojo.getHobbies().add("Triathlon");
cache.put(fqn, 322649, pojo);// put in memory
addDelay();
assertNotNull(cache.get(fqn, 322649));// get from memory
cache.evict(fqn, false);// passivate node
try
{
assertTrue(loader.exists(fqn));
}
catch (Exception e)
{
fail(e.toString());
}
SamplePojo pojo2 = (SamplePojo) cache.get(fqn, 322649);// activate node
try
{
assertFalse(loader.exists(fqn));
}
catch (Exception e)
{
fail(e.toString());
}
assertNotNull(pojo2);
assertEquals(39, pojo2.getAge());
assertEquals("Hany", pojo2.getName());
assertEquals(3, pojo2.getHobbies().size());
}