Permalink
Browse files

tests: remove Class.forName(..driver..) from test code

  • Loading branch information...
vlsi committed Nov 12, 2016
1 parent 50b7fe0 commit c99507b5661804b5b1b2340ba747fe553dc37a68
@@ -35,17 +35,6 @@
* @author Aaron Mulder (ammulder@chariotsolutions.com)
*/
public abstract class BaseDataSource implements Referenceable {
// Load the normal driver, since we'll use it to actually connect to the
// database. That way we don't have to maintain the connecting code in
// multiple places.
static {
try {
Class.forName("org.postgresql.Driver");
} catch (ClassNotFoundException e) {
System.err.println("PostgreSQL DataSource unable to load PostgreSQL JDBC Driver");
}
}
// Needed to implement the DataSource/ConnectionPoolDataSource interfaces
private transient PrintWriter logger;
@@ -24,7 +24,6 @@
* The main entry point for JUnit
*/
public static TestSuite suite() throws Exception {
Class.forName("org.postgresql.Driver");
TestSuite suite = new TestSuite();
Connection connection = TestUtil.openDB();
@@ -50,7 +50,6 @@ public static int getSlavePort() {
* The main entry point for JUnit
*/
public static TestSuite suite() throws Exception {
Class.forName("org.postgresql.Driver");
TestSuite suite = new TestSuite();
try {
@@ -22,11 +22,5 @@
PoolingDataSourceTest.class,
CaseOptimiserDataSourceTest.class})
public class OptionalTestSuite extends TestSuite {
static {
try {
Class.forName("org.postgresql.Driver");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
}
@@ -19,7 +19,6 @@
* The main entry point for JUnit
*/
public static TestSuite suite() throws Exception {
Class.forName("org.postgresql.Driver");
TestSuite suite = new TestSuite();
try {
java.sql.Connection con = TestUtil.openDB();
@@ -24,7 +24,6 @@
* The main entry point for JUnit
*/
public static TestSuite suite() throws Exception {
Class.forName("org.postgresql.Driver");
TestSuite suite = new TestSuite();
suite.addTestSuite(DatabaseMetaDataTest.class);
@@ -20,12 +20,4 @@
)
public class Jdbc41TestSuite {
static {
try {
Class.forName("org.postgresql.Driver");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
}
@@ -106,11 +106,6 @@ protected Connection getConnection(Properties info) throws SQLException {
String url = getServerJdbcUrl();
info.setProperty("user", getUsername());
info.setProperty("password", getPassword());
try {
Class.forName("org.postgresql.Driver");
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
return DriverManager.getConnection(url, info);
}
@@ -15,7 +15,6 @@
public class XATestSuite extends TestSuite {
public static TestSuite suite() throws Exception {
Class.forName("org.postgresql.Driver");
TestSuite suite = new TestSuite();
Connection connection = TestUtil.openDB();

0 comments on commit c99507b

Please sign in to comment.