db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krist...@apache.org
Subject svn commit: r1071783 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/AutomaticIndexStatisticsTest.java
Date Thu, 17 Feb 2011 21:00:07 GMT
Author: kristwaa
Date: Thu Feb 17 21:00:07 2011
New Revision: 1071783

URL: http://svn.apache.org/viewvc?rev=1071783&view=rev
Log:
DERBY-5040: On Windows, cascade of errors after failed test AutomaticIndexStatisticsTest

Rewrote failing test (deleting the database directory fails) to use a separate
database instead of the default db wombat. This should eliminate the cascade
of errors.

Patch file: derby-5040-1a-use_separate_db.diff

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/AutomaticIndexStatisticsTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/AutomaticIndexStatisticsTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/AutomaticIndexStatisticsTest.java?rev=1071783&r1=1071782&r2=1071783&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/AutomaticIndexStatisticsTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/AutomaticIndexStatisticsTest.java
Thu Feb 17 21:00:07 2011
@@ -104,21 +104,28 @@ public class AutomaticIndexStatisticsTes
      */
     public void testStatsCreatedOnGrowthThenDeleteDb()
             throws SQLException {
+        String db = "singleUse/newCleanDb";
+        DataSource ds = JDBCDataSource.getDataSource();
+        JDBCDataSource.setBeanProperty(ds, "databaseName", db);
+        JDBCDataSource.setBeanProperty(ds, "createDatabase", "create");
+        Connection con = ds.getConnection();
         String TAB = "TEST_GROWTH_EMPTY";
-        createAndInsertSimple(TAB, 300);
+        createAndInsertSimple(con, TAB, 300);
         // This should trigger creation of statistics.
-        prepareStatement("select * from " + TAB + " where id = ?");
+        PreparedStatement ps = con.prepareStatement(
+                "select * from " + TAB + " where id = ?");
+        ps.close();
 
         // Get statistics
-        IdxStats[] myStats = stats.getStatsTable(TAB, 1);
+        IdxStats[] myStats = new IndexStatsUtil(
+                ds.getConnection(), DEFAULT_TIMEOUT).getStatsTable(TAB, 1);
         assertEquals(1, myStats.length);
         assertTrue(myStats[0].rows == 300);
         assertTrue(myStats[0].card == 300);
 
         // Shutdown database and try to delete it.
-        TestConfiguration.getCurrent().shutdownDatabase();
-        assertDirectoryDeleted(constructDbPath(
-                getTestConfiguration().getDefaultDatabaseName()));
+        JDBCDataSource.shutdownDatabase(ds);
+        assertDirectoryDeleted(constructDbPath(db));
     }
 
     /** Make sure stats are updated when the table grows. */



Mime
View raw message