package org.jboss.cache.passivation;

import junit.framework.Test;
import junit.framework.TestSuite;
import org.jboss.cache.TreeCache;
import org.jboss.cache.loader.DelegatingCacheLoader;
import org.jboss.cache.loader.LocalDelegatingCacheLoader;

/**
 * Runs a test against using delegated cache loader
 * 
 * @author <a href="mailto:{hmesha@novell.com}">{Hany Mesha}</a>
 * @version $Id: PassivationToLocalDelegatingCacheLoaderTest.java,v 1.3 2006/01/10 23:41:18 msurtani Exp $
 */
public class PassivationToLocalDelegatingCacheLoaderTest extends PassivationTestsBase {
   TreeCache delegating_cache;
   DelegatingCacheLoader cache_loader;


   protected void configureCache() throws Exception {
      delegating_cache=new TreeCache();
      delegating_cache.setCacheMode(TreeCache.LOCAL);
      delegating_cache.createService();
      delegating_cache.startService();
      cache_loader=new LocalDelegatingCacheLoader(delegating_cache);
       // configure first ...
       cache.setCacheLoaderConfiguration(getCacheLoaderConfig("", "org.jboss.cache.loader.LocalDelegatingCacheLoader", "", false, false));

       cache.setCacheLoader(cache_loader);
   }

   protected void tearDown() throws Exception {
      super.tearDown();
      delegating_cache.stopService();
      delegating_cache.destroyService();
   }


   public static Test suite() {
      return new TestSuite(PassivationToLocalDelegatingCacheLoaderTest.class);
   }


   public static void main(String[] args) {
      junit.textui.TestRunner.run(suite());
   }

}
