Package org.jboss.cache.loader

Source Code of org.jboss.cache.loader.DummyInMemoryCacheLoaderTest

package org.jboss.cache.loader;

import org.jboss.cache.CacheSPI;
import org.jboss.cache.config.CacheLoaderConfig;
import org.testng.annotations.Test;

/**
* Odd that we need a test for a test class, but if we intend to use the {@link org.jboss.cache.loader.DummyInMemoryCacheLoader} as a cache
* loader stub then we need to make sure it behaves as a valid cache loader.
*/
@Test(groups = {"functional"})
public class DummyInMemoryCacheLoaderTest extends CacheLoaderTestsBase
{
   protected void configureCache() throws Exception
   {
      CacheSPI<Object, Object> cache = cacheTL.get();
     
      // use the shared variation of the DIMCL so that state is persisted in a static variable in memory rather than an
      // instance one.           
      String bin = "DummyInMemoryCacheLoader-" + Thread.currentThread().getName();
      CacheLoaderConfig clc = getSingleCacheLoaderConfig("", DummySharedInMemoryCacheLoader.class.getName(), "bin=" + bin, false, true, false);
      cache.getConfiguration().setCacheLoaderConfig(clc);
   }
  
   @Override
   protected void cleanup()
   {
      DummySharedInMemoryCacheLoader loader = (DummySharedInMemoryCacheLoader) loaderTL.get();
      if (loader != null) {
         loader.wipeBin();
         loaderTL.set(null);
      }
   }
  
}
TOP

Related Classes of org.jboss.cache.loader.DummyInMemoryCacheLoaderTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.