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

Mircea Markus mircea.markus at gmail.com
Tue Feb 20 06:35:48 EST 2007


  User: mmarkus 
  Date: 07/02/20 06:35:48

  Modified:    tests/functional/org/jboss/cache/loader 
                        DataSourceIntegrationTest.java
  Log:
  test fixed - the new JDBC cache loader needs a valid conection on start so that it performs a backward compatibility check. The connection passed in was null so it failed
  
  Revision  Changes    Path
  1.14      +27 -5     JBossCache/tests/functional/org/jboss/cache/loader/DataSourceIntegrationTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: DataSourceIntegrationTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/loader/DataSourceIntegrationTest.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -b -r1.13 -r1.14
  --- DataSourceIntegrationTest.java	7 Feb 2007 22:06:49 -0000	1.13
  +++ DataSourceIntegrationTest.java	20 Feb 2007 11:35:48 -0000	1.14
  @@ -18,6 +18,8 @@
   import java.io.PrintWriter;
   import java.sql.Connection;
   import java.sql.SQLException;
  +import java.sql.DriverManager;
  +import java.util.Properties;
   
   public class DataSourceIntegrationTest extends AbstractCacheLoaderTestBase
   {
  @@ -38,8 +40,9 @@
   
      protected CacheLoaderConfig getCacheLoaderConfig(String jndi) throws Exception
      {
  -      String props = "cache.jdbc.datasource=" + jndi + "\ncache.jdbc.table.create=false\ncache.jdbc.table.drop=false";
  -      return getSingleCacheLoaderConfig("", "org.jboss.cache.loader.JDBCCacheLoader", props, false, false, false);
  +      String props = "cache.jdbc.datasource=" + jndi + "\ncache.jdbc.table.create=true\ncache.jdbc.table.drop=true";
  +       CacheLoaderConfig cacheLoaderConfig = getSingleCacheLoaderConfig("", "org.jboss.cache.loader.JDBCCacheLoader", props, false, false, false);
  +       return cacheLoaderConfig;
      }
   
      /**
  @@ -99,15 +102,34 @@
   
      private static class MockDataSource implements DataSource
      {
  +       private String userName;
  +       private String jdbcUrl;
  +       private String jdbcPassword;
  +
  +     public MockDataSource() {
  +       Properties properties = new Properties();
  +       try
  +       {
  +          properties.load(this.getClass().getClassLoader().getResourceAsStream("cache-jdbc.properties"));
  +          Class.forName(properties.getProperty("cache.jdbc.driver"));
  +       }
  +       catch (Exception e)
  +       {
  +          throw new IllegalStateException("Error loading jdbc properties ", e);
  +       }
  +       userName = properties.getProperty("cache.jdbc.user");
  +       jdbcUrl = properties.getProperty("cache.jdbc.url");
  +       jdbcPassword = properties.getProperty("cache.jdbc.password");
  +     }
   
         public Connection getConnection() throws SQLException
         {
  -         return null;
  +         return DriverManager.getConnection(jdbcUrl, userName, jdbcPassword);
         }
   
         public Connection getConnection(String user, String password) throws SQLException
         {
  -         return null;
  +         return DriverManager.getConnection(jdbcUrl, userName, jdbcPassword);
         }
   
         public int getLoginTimeout() throws SQLException
  
  
  



More information about the jboss-cvs-commits mailing list