db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r473366 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting: functionTests/util/TestDataSourceFactory.java junit/BaseJDBCTestCase.java junit/TestConfiguration.java
Date Fri, 10 Nov 2006 15:26:59 GMT
Author: djd
Date: Fri Nov 10 07:26:58 2006
New Revision: 473366

URL: http://svn.apache.org/viewvc?view=rev&rev=473366
Log:
DERBY-2047 Remove TestDataSourceFactory and clean up associated code. Functionality
has been replaced by JDBCDataSource and J2EEDataSource which allows clean separation
for JSR169 which does not include the XA and connection pooling data sources.

Removed:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/TestDataSourceFactory.java
Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java?view=diff&rev=473366&r1=473365&r2=473366
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java Fri
Nov 10 07:26:58 2006
@@ -194,13 +194,6 @@
         return conn;
     }
     
-    public Connection openConnection(String databaseName) throws SQLException
-    {
-        Connection conn = getTestConfiguration().openConnection(databaseName);
-        initializeConnection(conn);
-        return conn;        
-    }
-    
     /**
      * Run a SQL script through ij discarding the output
      * using this object's default connection. Intended for

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java?view=diff&rev=473366&r1=473365&r2=473366
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java
Fri Nov 10 07:26:58 2006
@@ -32,8 +32,6 @@
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
-import org.apache.derbyTesting.functionTests.util.TestDataSourceFactory;
-
 /**
  * Class which holds information about the configuration of a Test.
  */
@@ -624,48 +622,6 @@
     }
     
     /**
-     * Open a connection to a database.
-     * If the database does not exist, it will be created.
-     * A default username and password will be used for the connection.
-     *
-     * @param databaseName database to connect to
-     *
-     * @return connection to database.
-     */
-    Connection openConnection (String databaseName) throws SQLException {
-        return getConnection(databaseName, "create=true");
-    }
-    
-    /**
-     * Get a connection to a database using the specified connection 
-     * attributes.
-     * 
-     * @param databaseName database to connect to
-     * @param connAttrs connection attributes
-     * @return connection to database.
-     * @throws SQLException
-     */
-    private Connection getConnection (String databaseName, String connAttrs) 
-    	throws SQLException {
-        Connection con = null;
-        JDBCClient client =getJDBCClient();
-        if (JDBC.vmSupportsJDBC2()) {            
-            loadJDBCDriver(client.getJDBCDriverName());
-            {
-                con = DriverManager.getConnection(
-                        getJDBCUrl(databaseName) + ";" + connAttrs,
-                        getUserName(),
-                        getUserPassword());
-            }
-        } else {
-            //Use DataSource for JSR169
-            Properties attrs = getDataSourcePropertiesForDatabase(databaseName, connAttrs);
-            con = TestDataSourceFactory.getDataSource(attrs).getConnection();
-        }
-        return con;
-    }
-    
-    /**
      * Shutdown the database for this configuration
      * assuming it is booted.
      *
@@ -806,65 +762,6 @@
      * this configuration.
      */
     private Connector connector;
-    
-
-    /**
-     * Generate properties which can be set on a
-     * <code>DataSource</code> in order to connect to the default
-     * database. If the database does not exist, it will be created.
-     *
-     * @return a <code>Properties</code> object containing server
-     * name, port number, database name and other attributes needed to
-     * connect to the default database
-     */
-    public static Properties getDefaultDataSourceProperties() {
-        return getDataSourcePropertiesForDatabase(
-                getCurrent().getDatabaseName(), "create=true");
-    }
-    
-    /**
-     * Generate properties which can be set on a <code>DataSource</code> 
-     * in order to connect to a database using the specified connection 
-     * attributes.
-     * 
-     * @param databaseName database to connect to
-     * @param connAttrs connection attributes
-     * @return
-     */
-    private static Properties getDataSourcePropertiesForDatabase
-    	(String databaseName, String connAttrs) 
-    {
-        Properties attrs = new Properties();
-        if (!getCurrent().getJDBCClient().isEmbedded()) {
-            attrs.setProperty("serverName", getCurrent().getHostName());
-            attrs.setProperty("portNumber", Integer.toString(getCurrent().getPort()));
-        }
-        attrs.setProperty("databaseName", databaseName);
-        attrs.setProperty("connectionAttributes", connAttrs);
-        return attrs;
-    }
-
-    /**
-     * Load the specified JDBC driver
-     *
-     * @param driverClass name of the JDBC driver class.
-     * @throws SQLException if loading the driver fails.
-     */
-    private static void loadJDBCDriver(String driverClass) 
-        throws SQLException {
-        try {
-            Class.forName(driverClass).newInstance();
-        } catch (ClassNotFoundException cnfe) {
-            throw new SQLException("Failed to load JDBC driver '" + 
-                                    driverClass + "': " + cnfe.getMessage());
-        } catch (IllegalAccessException iae) {
-            throw new SQLException("Failed to load JDBC driver '" +
-                                    driverClass + "': " + iae.getMessage());
-        } catch (InstantiationException ie) {
-            throw new SQLException("Failed to load JDBC driver '" +
-                                    driverClass + "': " + ie.getMessage());
-        }
-    }
     
     /*
      * SecurityManager related configuration.



Mime
View raw message