[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/passivation ...

Manik Surtani msurtani at belmont.prod.atl2.jboss.com
Wed Aug 30 11:14:33 EDT 2006


  User: msurtani
  Date: 06/08/30 11:14:33

  Added:       tests/functional/org/jboss/cache/passivation  
                        PassivationToJDBCCacheLoaderTest.java
  Removed:     tests/functional/org/jboss/cache/passivation  
                        PassivationToJDBCCacheLoaderTestCase.java
  Log:
  Fixed a bunch of passivation test failures, removed unnecessary and misleading "TestCase" classes
  
  Revision  Changes    Path
  1.1      date: 2006/08/30 15:14:33;  author: msurtani;  state: Exp;JBossCache/tests/functional/org/jboss/cache/passivation/PassivationToJDBCCacheLoaderTest.java
  
  Index: PassivationToJDBCCacheLoaderTest.java
  ===================================================================
  /*
   * JBoss, the OpenSource J2EE webOS
   *
   * Distributable under LGPL license.
   * See terms of license at gnu.org.
   */
  package org.jboss.cache.passivation;
  
  import junit.framework.Test;
  import junit.framework.TestSuite;
  import org.jboss.cache.xml.XmlHelper;
  import org.w3c.dom.Element;
  
  import java.util.Properties;
  
  /**
   * Tests passivation using JDBC Cache Loader.
   * This test has MySQL hard-coded. To run it, run MySQL first: mysqld -u=root
   *
   * @author <a href="mailto:{hmesha at novell.com}">{Hany Mesha}</a>
   * @version $Id: PassivationToJDBCCacheLoaderTest.java,v 1.1 2006/08/30 15:14:33 msurtani Exp $
   */
  public class PassivationToJDBCCacheLoaderTest extends PassivationTestsBase
  {
  
  
     protected Element getCacheLoaderConfig() throws Exception
     {
        String xml = "            <config>\n" +
                "                \n" +
                "                <passivation>true</passivation>\n" +
                "                <preload></preload>\n" +
                "\n" +
                "                <cacheloader>\n" +
                "                    <class>org.jboss.cache.loader.JDBCCacheLoader</class>\n" +
                "                    <properties>\n" +
                getJDBCProps() +
                "                    </properties>\n" +
                "                    <async>false</async>\n" +
                "                    <fetchPersistentState>false</fetchPersistentState>\n" +
                "                    <ignoreModifications>false</ignoreModifications>\n" +
                "                </cacheloader>\n" +
                "                \n" +
                "            </config>";
        return XmlHelper.stringToElement(xml);
     }
  
  
     protected String getJDBCProps() 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 ");
        }
        return "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");
     }
  
     protected void configureCache() throws Exception
     {
        cache.getConfiguration().setCacheLoaderConfiguration(getCacheLoaderConfig());
     }
  
     public static Test suite()
     {
        return new TestSuite(PassivationToJDBCCacheLoaderTest.class);
     }
  
     public static void main(String[] args)
     {
        junit.textui.TestRunner.run(suite());
     }
  }
  
  
  



More information about the jboss-cvs-commits mailing list