You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by tv...@apache.org on 2014/06/06 20:47:24 UTC

svn commit: r1600980 - in /commons/proper/jcs/trunk/commons-jcs-core/src: main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/ test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/ test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/mysql/

Author: tv
Date: Fri Jun  6 18:47:24 2014
New Revision: 1600980

URL: http://svn.apache.org/r1600980
Log:
Sigh. As it goes, improving error handling makes errors visible...

Modified:
    commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCachePoolAccessManager.java
    commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManagerUnitTest.java
    commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheManagerUnitTest.java
    commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheUnitTest.java

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCachePoolAccessManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCachePoolAccessManager.java?rev=1600980&r1=1600979&r2=1600980&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCachePoolAccessManager.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCachePoolAccessManager.java Fri Jun  6 18:47:24 2014
@@ -150,6 +150,11 @@ public class JDBCDiskCachePoolAccessMana
     {
         JDBCDiskCachePoolAccess poolAccess = null;
 
+        if (driverClassName == null)
+        {
+            throw new SQLException("Driver class name is null");
+        }
+
         try
         {
             // com.mysql.jdbc.Driver
@@ -161,9 +166,7 @@ public class JDBCDiskCachePoolAccessMana
         }
 
         poolAccess = new JDBCDiskCachePoolAccess( poolName );
-
         poolAccess.setupDriver( fullURL, userName, password, maxActive );
-
         poolAccess.logDriverStats();
 
         if ( log.isInfoEnabled() )

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManagerUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManagerUnitTest.java?rev=1600980&r1=1600979&r2=1600980&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManagerUnitTest.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManagerUnitTest.java Fri Jun  6 18:47:24 2014
@@ -36,6 +36,8 @@ public class JDBCDiskCacheManagerUnitTes
         // SETUP
         String cacheName = "testGetCache_normal";
         JDBCDiskCacheAttributes defaultCacheAttributes = new JDBCDiskCacheAttributes();
+        // Just use something that exists
+        defaultCacheAttributes.setDriverClassName( "org.hsqldb.jdbcDriver" );
         defaultCacheAttributes.setDiskPath( "target/JDBCDiskCacheManagerUnitTest" );
 
         ICacheEventLogger cacheEventLogger = new MockCacheEventLogger();

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheManagerUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheManagerUnitTest.java?rev=1600980&r1=1600979&r2=1600980&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheManagerUnitTest.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheManagerUnitTest.java Fri Jun  6 18:47:24 2014
@@ -36,6 +36,8 @@ public class MySQLDiskCacheManagerUnitTe
         // SETUP
         String cacheName = "testGetCache_normal";
         MySQLDiskCacheAttributes defaultCacheAttributes = new MySQLDiskCacheAttributes();
+        // Just use something that exists
+        defaultCacheAttributes.setDriverClassName( "org.hsqldb.jdbcDriver" );
         defaultCacheAttributes.setDiskPath( "target/JDBCDiskCacheManagerUnitTest" );
 
         ICacheEventLogger cacheEventLogger = new MockCacheEventLogger();

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheUnitTest.java?rev=1600980&r1=1600979&r2=1600980&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheUnitTest.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheUnitTest.java Fri Jun  6 18:47:24 2014
@@ -42,21 +42,22 @@ public class MySQLDiskCacheUnitTest
      * <p>
      * This is a bit tricky since we don't want to have to have a mysql instance
      * running. Right now this doesn't really test much
-     * @throws SQLException 
+     * @throws SQLException
      */
     public void testBalkOnGet() throws SQLException
     {
         // SETUP
         MySQLDiskCacheAttributes attributes = new MySQLDiskCacheAttributes();
         String tableName = "JCS_TEST";
-        attributes.setDriverClassName( "com.mysql.jdbc.Driver" );
+        // Just use something that exists
+        attributes.setDriverClassName( "org.hsqldb.jdbcDriver" );
         attributes.setTableName( tableName );
         attributes.setBalkDuringOptimization( true );
 
         TableState tableState = new TableState( tableName );
         tableState.setState( TableState.OPTIMIZATION_RUNNING );
 
-        MySQLDiskCache<String, String> cache = new MySQLDiskCache<String, String>( attributes, tableState, 
+        MySQLDiskCache<String, String> cache = new MySQLDiskCache<String, String>( attributes, tableState,
         		CompositeCacheManager.getUnconfiguredInstance() );
 
         // DO WORK