public void testOffHeapExceedMemory()
throws IOException {
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
CacheManager cacheManager = CacheManager.getInstance();
Ehcache ehcache = cacheManager.getEhcache("testCache");
Element element = null;
try {
for (int i = 0; i < 3000000; i++) {
if ((i % 1000) == 0) {
System.out.println("heatbeat 2 " + i);
stats(ehcache);
}
element = new Element(i, new byte[1024]);
ehcache.put(element);
}
Assert.fail("CacheException expected for DirectMemory OffHeap Memory Exceeded");
} catch (CacheException e) {
stats(ehcache);