/*
 * Copyright 2006-2012 The Scriptella Project Team.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package scriptella.core;

import scriptella.AbstractTestCase;

/**
 * Tests for {@link scriptella.core.DriverFactory}.
 *
 * @author Fyodor Kupolov
 * @version 1.0
 */
public class DriverFactoryTest extends AbstractTestCase {
    /**
     * Tests correct handling of drivers in bootstrap classpath.
     */
    public void testGetBootstrapDriver() throws ClassNotFoundException {
        //JDBC-ODBC
        DriverFactory.getDriver("sun.jdbc.odbc.JdbcOdbcDriver", null);
    }

    /**
     * Tests correct handling of drivers in classpath(e.g. lib directory).
     */
    public void testClassPathDriver() throws ClassNotFoundException {
        DriverFactory.getDriver("org.hsqldb.jdbcDriver", getClass().getClassLoader());
        //Bootstrap classes should also be loaded using the classloader scriptella jars.
        DriverFactory.getDriver("sun.jdbc.odbc.JdbcOdbcDriver", getClass().getClassLoader());
    }


}

@@ -693,16 +693,52 @@
 ase;%0D%0A%0D%0A
+import java.util.logging.Logger;%0D%0A%0D%0A
 /**%0D%0A * 
@@ -895,24 +895,573 @@
 TestCase %7B%0D%0A
+    private static final Logger logger = Logger.getLogger(DriverFactoryTest.class.getName());%0D%0A    public static final String SUN_JDBC_ODBC_JDBC_ODBC_DRIVER = %22sun.jdbc.odbc.JdbcOdbcDriver%22;%0D%0A    private static boolean skipJdbcOdbc;%0D%0A%0D%0A    static %7B%0D%0A        try %7B%0D%0A            Class.forName(SUN_JDBC_ODBC_JDBC_ODBC_DRIVER);%0D%0A        %7D catch (ClassNotFoundException e) %7B%0D%0A            skipJdbcOdbc = true;%0D%0A            logger.warning(SUN_JDBC_ODBC_JDBC_ODBC_DRIVER + %22 not available starting from JDK8 - skipping related tests%22);%0D%0A        %7D%0D%0A    %7D%0D%0A%0D%0A
     /**%0D%0A   
@@ -1598,32 +1598,66 @@
 undException %7B%0D%0A
+        if (!skipJdbcOdbc) %7B%0D%0A    
         //JDBC-O
@@ -1661,16 +1661,20 @@
 C-ODBC%0D%0A
+    
         
@@ -1733,24 +1733,35 @@
 r%22, null);%0D%0A
+        %7D%0D%0A
     %7D%0D%0A%0D%0A   
@@ -2006,24 +2006,58 @@
 Loader());%0D%0A
+        if (!skipJdbcOdbc) %7B%0D%0A    
         //Bo
@@ -2134,32 +2134,36 @@
  jars.%0D%0A        
+   
+ 
 DriverFactory.ge
@@ -2237,18 +2237,25 @@
 );%0D%0A    
-%7D%0D%0A%0D%0A
+    %7D%0D%0A    %7D
 %0D%0A%7D%0D%0A

Fix for missing JdbcOdbc driver on JDK8 #1