package org.jboss.cache.loader;

import junit.framework.Test;
import junit.framework.TestSuite;
import org.jboss.cache.TreeCache;

/**
 * Created by IntelliJ IDEA.
 * User: bela
 * Date: Jun 9, 2004
 * Time: 9:05:19 AM
 */
public class LocalDelegatingCacheLoaderTest extends CacheLoaderTestsBase {
   TreeCache delegating_cache;

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

      // force our own cache loader instance
      LocalDelegatingCacheLoader cacheLoader = new LocalDelegatingCacheLoader( delegating_cache );
      cache.setCacheLoader( cacheLoader );
   }

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


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


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

}
