Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2013-01-16 04:06:35 -0500
committerEike Stepper2013-01-16 04:06:35 -0500
commit184b04efaa0b07d2f1f29d41eb919667d07b60dc (patch)
tree18d0067a8b4165aaee18be7a45f64a500530edfa
parent041b6932a1df491b398b585f82d290e5054104e5 (diff)
downloadcdo-184b04efaa0b07d2f1f29d41eb919667d07b60dc.tar.gz
cdo-184b04efaa0b07d2f1f29d41eb919667d07b60dc.tar.xz
cdo-184b04efaa0b07d2f1f29d41eb919667d07b60dc.zip
[398167] [DB] Remove JDBC driver dependencies from DBAdapter bundles
https://bugs.eclipse.org/bugs/show_bug.cgi?id=398167
-rw-r--r--plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/AbstractDBTest.java9
-rw-r--r--plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/DerbyTest.java8
-rw-r--r--plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/HsqldbTest.java10
3 files changed, 16 insertions, 11 deletions
diff --git a/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/AbstractDBTest.java b/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/AbstractDBTest.java
index 72158ca5af..69d0a170d1 100644
--- a/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/AbstractDBTest.java
+++ b/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/AbstractDBTest.java
@@ -28,21 +28,18 @@ import java.util.Set;
/**
* @author Eike Stepper
*/
-public abstract class AbstractDBTest<DATA_SOURCE extends DataSource> extends AbstractOMTest
+public abstract class AbstractDBTest extends AbstractOMTest
{
protected IDBAdapter dbAdapter;
protected IDBConnectionProvider dbConnectionProvider;
- @SuppressWarnings("unchecked")
@Override
protected void doSetUp() throws Exception
{
dbAdapter = createDBAdapter();
- // TODO Clarify if these tests are still needed/wanted. The following deprecation now requires a different setup
- DATA_SOURCE dataSource = (DATA_SOURCE)dbAdapter.createJDBCDataSource();
- configureDataSource(dataSource);
+ DataSource dataSource = createDataSource();
dbConnectionProvider = DBUtil.createConnectionProvider(dataSource);
}
@@ -53,7 +50,7 @@ public abstract class AbstractDBTest<DATA_SOURCE extends DataSource> extends Abs
protected abstract IDBAdapter createDBAdapter();
- protected abstract void configureDataSource(DATA_SOURCE dataSource);
+ protected abstract DataSource createDataSource();
protected Connection getConnection()
{
diff --git a/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/DerbyTest.java b/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/DerbyTest.java
index 23d4b260a9..52ad5ef007 100644
--- a/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/DerbyTest.java
+++ b/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/DerbyTest.java
@@ -16,12 +16,14 @@ import org.eclipse.net4j.util.io.TMPUtil;
import org.apache.derby.jdbc.EmbeddedDataSource;
+import javax.sql.DataSource;
+
import java.io.File;
/**
* @author Eike Stepper
*/
-public class DerbyTest extends AbstractDBTest<EmbeddedDataSource>
+public class DerbyTest extends AbstractDBTest
{
private File dbFolder;
@@ -32,14 +34,16 @@ public class DerbyTest extends AbstractDBTest<EmbeddedDataSource>
}
@Override
- protected void configureDataSource(EmbeddedDataSource dataSource)
+ protected DataSource createDataSource()
{
dbFolder = TMPUtil.createTempFolder("derby_"); //$NON-NLS-1$
deleteDBFolder();
msg("Using DB folder: " + dbFolder.getAbsolutePath()); //$NON-NLS-1$
+ EmbeddedDataSource dataSource = new EmbeddedDataSource();
dataSource.setDatabaseName(dbFolder.getAbsolutePath());
dataSource.setCreateDatabase("create"); //$NON-NLS-1$
+ return dataSource;
}
@Override
diff --git a/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/HsqldbTest.java b/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/HsqldbTest.java
index 66ccdbebdb..edebd301d3 100644
--- a/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/HsqldbTest.java
+++ b/plugins/org.eclipse.net4j.db.tests/src/org/eclipse/net4j/db/tests/HsqldbTest.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Eike Stepper - initial API and implementation
*/
@@ -13,10 +13,12 @@ package org.eclipse.net4j.db.tests;
import org.eclipse.net4j.db.IDBAdapter;
import org.eclipse.net4j.db.hsqldb.HSQLDBDataSource;
+import javax.sql.DataSource;
+
/**
* @author Eike Stepper
*/
-public class HsqldbTest extends AbstractDBTest<HSQLDBDataSource>
+public class HsqldbTest extends AbstractDBTest
{
@Override
protected IDBAdapter createDBAdapter()
@@ -25,9 +27,11 @@ public class HsqldbTest extends AbstractDBTest<HSQLDBDataSource>
}
@Override
- protected void configureDataSource(HSQLDBDataSource dataSource)
+ protected DataSource createDataSource()
{
+ HSQLDBDataSource dataSource = new HSQLDBDataSource();
dataSource.setDatabase("jdbc:hsqldb:mem:dbtest"); //$NON-NLS-1$
dataSource.setUser("sa"); //$NON-NLS-1$
+ return dataSource;
}
}

Back to the top