db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krist...@apache.org
Subject svn commit: r620480 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting: functionTests/tests/jdbcapi/ functionTests/tests/lang/ functionTests/tests/upgradeTests/ junit/
Date Mon, 11 Feb 2008 13:02:41 GMT
Author: kristwaa
Date: Mon Feb 11 05:02:38 2008
New Revision: 620480

URL: http://svn.apache.org/viewvc?rev=620480&view=rev
Log:
DERBY-3306: jdbc4.StatementEventsTest cannot be run individually in a clean environment. This
is in fact a more general fix for tests using a DataSource obtained through the JUnit framework
utility classes to create connections. The connections will now default to create the database
if it does not exists. The accompanying test changes were required to get a clean suites.All
run, and falls into three categories; test doesn't want to create db, asserting on zero warnings
or uses connection attributes that conflict with db creation.
Patch file: derby-3306-1c-create_db_by_default_and_test_fixes.diff

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DataSourceTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DboPowersTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/PoolXADSCreateShutdownDBTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/DatabaseClassLoadingTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/PhaseChanger.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBCDataSource.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DataSourceTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DataSourceTest.java?rev=620480&r1=620479&r2=620480&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DataSourceTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DataSourceTest.java
Mon Feb 11 05:02:38 2008
@@ -841,6 +841,7 @@
             assertTenConnectionsUnique();
 
         DataSource dscs = JDBCDataSource.getDataSource();
+        JDBCDataSource.setBeanProperty(dscs, "createDatabase", "false");
         if (usingEmbedded()) 
                 assertToString(dscs);
 
@@ -893,6 +894,8 @@
         aes1.resetState();
 
         XADataSource dsx = J2EEDataSource.getXADataSource();
+        JDBCDataSource.setBeanProperty(dsx, "createDatabase", "false");
+
         if (usingEmbedded())
             assertToString(dsx);
 
@@ -1872,6 +1875,7 @@
     public void testJira95ds() throws SQLException {
         try {
             DataSource ds = JDBCDataSource.getDataSource();
+            JDBCDataSource.setBeanProperty(ds, "createDatabase", "false");
             // non-existent database
             JDBCDataSource.setBeanProperty(ds, "databaseName", "jdbc:derby:wombat");
             ds.getConnection();
@@ -2244,6 +2248,7 @@
 
         // DataSource
         DataSource ds = JDBCDataSource.getDataSource();
+        JDBCDataSource.setBeanProperty(ds, "createDatabase", "false");
 
         // DataSource - setTransationAttributes
         traceFile = "trace1.out";

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DboPowersTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DboPowersTest.java?rev=620480&r1=620479&r2=620480&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DboPowersTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DboPowersTest.java
Mon Feb 11 05:02:38 2008
@@ -440,6 +440,7 @@
         String bootPassword="12345678";
         DataSource ds = JDBCDataSource.getDataSource();
 
+        JDBCDataSource.setBeanProperty(ds, "createDatabase", "false");
         JDBCDataSource.setBeanProperty(ds, "connectionAttributes",
                                        "dataEncryption=true;bootPassword=" +
                                            bootPassword);
@@ -497,6 +498,7 @@
         String newBootPassword="87654321";
         DataSource ds = JDBCDataSource.getDataSource();
 
+        JDBCDataSource.setBeanProperty(ds, "createDatabase", "false");
         JDBCDataSource.setBeanProperty(ds, "connectionAttributes",
                                        "bootPassword=" + bootPassword +
                                        ";newBootPassword=" + newBootPassword);
@@ -696,6 +698,8 @@
         String password = getTestConfiguration().getUserPassword();
 
         DataSource ds = JDBCDataSource.getDataSource();
+
+        JDBCDataSource.setBeanProperty(ds, "createDatabase", "false");
         JDBCDataSource.setBeanProperty(
             ds, "connectionAttributes", "upgrade=true");
         JDBCDataSource.setBeanProperty(ds, "user", user);

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/PoolXADSCreateShutdownDBTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/PoolXADSCreateShutdownDBTest.java?rev=620480&r1=620479&r2=620480&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/PoolXADSCreateShutdownDBTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/PoolXADSCreateShutdownDBTest.java
Mon Feb 11 05:02:38 2008
@@ -172,6 +172,7 @@
         assertUpdateCount(createStatement(), 0, "set schema APP");
    
         // check that first the value is null
+        JDBCDataSource.setBeanProperty(ds, "createDatabase", "false");
         assertGetNull(ds, dbName);
         // check that we can set & that when set we can get
         // doesn't actually open connections so a little silly.

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/DatabaseClassLoadingTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/DatabaseClassLoadingTest.java?rev=620480&r1=620479&r2=620480&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/DatabaseClassLoadingTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/DatabaseClassLoadingTest.java
Mon Feb 11 05:02:38 2008
@@ -639,6 +639,7 @@
     {
         String dbName = "classpath:dbro";
         DataSource ds = JDBCDataSource.getDataSource(dbName);
+        JDBCDataSource.setBeanProperty(ds, "createDatabase", "false");
         
         try {
             ds.getConnection();

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/PhaseChanger.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/PhaseChanger.java?rev=620480&r1=620479&r2=620480&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/PhaseChanger.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/PhaseChanger.java
Mon Feb 11 05:02:38 2008
@@ -84,6 +84,7 @@
             break;
             
         case UpgradeChange.PH_HARD_UPGRADE:
+            JDBCDataSource.setBeanProperty(ds, "createDatabase", "false");
             JDBCDataSource.setBeanProperty(ds, "connectionAttributes",
                     "upgrade=true");
             break;

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBCDataSource.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBCDataSource.java?rev=620480&r1=620479&r2=620480&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBCDataSource.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBCDataSource.java Mon
Feb 11 05:02:38 2008
@@ -37,8 +37,9 @@
     
     /**
      * Return a new DataSource corresponding to the current
-     * configuration. The getConnection() method will return
-     * a connection identical to TestConfiguration.openDefaultConnection().
+     * configuration.
+     * <p>The getConnection() method will return a connection identical to
+     * {@link TestConfiguration#openDefaultConnection}.
      */
     public static javax.sql.DataSource getDataSource()
     {
@@ -84,6 +85,10 @@
      * Create a new DataSource object setup from the passed in TestConfiguration.
      * The getConnection() method will return a connection identical to
      * TestConfiguration.openDefaultConnection().
+     * <p>
+     * If no properties are passed in, defaults are obtained from the
+     * current <code>TestConfiguration</code> and the data source will be
+     * configured to create the specified database if it does not exist.
      */
     static javax.sql.DataSource getDataSource(TestConfiguration config,
             HashMap beanProperties)
@@ -96,6 +101,10 @@
      * Create a new DataSource object setup from the passed in
      * TestConfiguration using the received properties and data
      * source class name.
+     * <p>
+     * If no properties are passed in, defaults are obtained from the
+     * current <code>TestConfiguration</code> and the data source will be
+     * configured to create the specified database if it does not exist.
      */
     static Object getDataSource(TestConfiguration config,
         HashMap beanProperties, String dsClassName)
@@ -123,6 +132,8 @@
         beanProperties.put("databaseName", config.getDefaultDatabaseName());
         beanProperties.put("user", config.getUserName());
         beanProperties.put("password", config.getUserPassword());
+        // By default non-existing databases will be created.
+        beanProperties.put("createDatabase", "create");
 
         
         return beanProperties;



Mime
View raw message