/*
 * JBoss, the OpenSource J2EE webOS
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */
package org.jboss.cache.loader;

import java.util.Properties;

import junit.framework.Test;
import junit.framework.TestSuite;

/**
 * This test has MySQL hard-coded. To run it, run MySQL first: mysqld -u=root
 * @author <a href="mailto:alex@jboss.org">Alexey Loubyansky</a>
 * @version <tt>$Revision$</tt>
 */
public class JDBCExtendedCacheLoaderTestCase
   extends ExtendedCacheLoaderTestsBase
{

    protected void configureCache() throws Exception
    {
       Properties prop = new Properties();
       try
       {
          prop.load(this.getClass().getClassLoader().getResourceAsStream("cache-jdbc.properties"));
       }
       catch(Exception e){
          System.out.println("Error loading jdbc properties ");
       }
       String props = "cache.jdbc.driver =" + prop.getProperty("cache.jdbc.driver") + "\n" +
                      "cache.jdbc.url=" + prop.getProperty("cache.jdbc.url") +"\n" +
                      "cache.jdbc.user=" + prop.getProperty("cache.jdbc.user") + "\n" +
                      "cache.jdbc.password=" + prop.getProperty("cache.jdbc.password") + "\n" +
                      "cache.jdbc.node.type=" + prop.getProperty("cache.jdbc.node.type");
       cache.setCacheLoaderConfiguration( getSingleCacheLoaderConfig("", "org.jboss.cache.loader.JDBCCacheLoader", props, false, true, false) );
    }

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