You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by ma...@apache.org on 2008/03/10 17:19:27 UTC
svn commit: r635588 - in /db/derby/code/branches/10.3/java:
testing/org/apache/derbyTesting/functionTests/master/
testing/org/apache/derbyTesting/functionTests/master/DerbyNet/
testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/
testin...
Author: mamta
Date: Mon Mar 10 09:19:23 2008
New Revision: 635588
URL: http://svn.apache.org/viewvc?rev=635588&view=rev
Log:
Merging revision 634037 into 10.3 codeline fore DERBY-3458. The commit comments for
634037 were as follows
Patch submitted by Stephan van Loendersloot. dblook should set the current schema to be
a system schema so that collation of system schema (UCS_BASIC) gets used when dealing
with queries using system table columns and character constants. Stephan has also
provided comprehensive test for the dblook code change.
Added:
db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/dblook_test_net_territory.out (props changed)
- copied unchanged from r634037, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/dblook_test_net_territory.out
db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/dblook_test_net_territory.out (props changed)
- copied unchanged from r634037, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/dblook_test_net_territory.out
db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/master/dblook_test_territory.out (props changed)
- copied unchanged from r634037, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/dblook_test_territory.out
db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/dblook_test_net_territory.java (props changed)
- copied unchanged from r634037, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/dblook_test_net_territory.java
db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/dblook_test_net_territory_app.properties (props changed)
- copied unchanged from r634037, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/dblook_test_net_territory_app.properties
db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test_territory.java (props changed)
- copied unchanged from r634037, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test_territory.java
db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test_territory_app.properties (props changed)
- copied unchanged from r634037, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test_territory_app.properties
db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test_territory_sed.properties (props changed)
- copied unchanged from r634037, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test_territory_sed.properties
Modified:
db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientRemote.exclude
db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientUseprocess.exclude
db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetRemote.exclude
db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetUseprocess.exclude
db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall
db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/derbytools.runall
db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/j9derbynetmats.runall
db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NetHarnessJavaTest.java
db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/dblook_test_net.java
db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test.java
db/derby/code/branches/10.3/java/tools/org/apache/derby/tools/dblook.java
Propchange: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/dblook_test_net_territory.out
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/dblook_test_net_territory.out
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/master/dblook_test_territory.out
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientRemote.exclude
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientRemote.exclude?rev=635588&r1=635587&r2=635588&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientRemote.exclude (original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientRemote.exclude Mon Mar 10 09:19:23 2008
@@ -7,6 +7,8 @@
# a database cannot be loaded by 2 different instances.
# derbynet/dblook_test_net because it tries to search derby.log, which is on
# the server machine
+# derbynet/dblook_test_net_territory because it tries to search derby.log, which is on
+# the server machine
# derbynet/getCurrentProperties for it exercises NetworkServerControl statements
# that are only supported on localhost
# derbynet/maxthreads - tries to use NetworkServerControl statements
@@ -24,6 +26,7 @@
#
store/bootLock.java
derbynet/dblook_test_net.java
+derbynet/dblook_test_net_territory.java
derbynet/getCurrentProperties.java
derbynet/maxthreads.java
derbynet/runtimeinfo.java
Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientUseprocess.exclude
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientUseprocess.exclude?rev=635588&r1=635587&r2=635588&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientUseprocess.exclude (original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientUseprocess.exclude Mon Mar 10 09:19:23 2008
@@ -8,6 +8,7 @@
# junitTests/derbyNet/CompatibilityTest.java - exits the suite
# derbynet/DerbyNetAutoStart.java - exits the suite...
# derbynet/dblook_test_net.java - expects different dir structure
+# derbynet/dblook_test_net_territory.java - expects different dir structure
# stress/stress.multi - exits suite
# derbynet/getCurrentProperties.java - fails, different sessions
# derbynet/runtimeinfo.java - different sessions
@@ -27,6 +28,7 @@
junitTests/derbyNet/CompatibilityTest.java
derbynet/DerbyNetAutoStart.java
derbynet/dblook_test_net.java
+derbynet/dblook_test_net_territory.java
derbynet/getCurrentProperties.java
derbynet/runtimeinfo.java
derbynet/sysinfo.java
Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetRemote.exclude
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetRemote.exclude?rev=635588&r1=635587&r2=635588&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetRemote.exclude (original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetRemote.exclude Mon Mar 10 09:19:23 2008
@@ -7,6 +7,8 @@
# a database cannot be loaded by 2 different instances.
# derbynet/dblook_test_net because it tries to search derby.log, which is on
# the server machine
+# derbynet/dblook_test_net_territory because it tries to search derby.log, which is on
+# the server machine
# derbynet/getCurrentProperties for it exercises NetworkServerControl statements
# that are only supported on localhost
# derbynet/maxthreads - tries to use NetworkServerControl statements
@@ -23,6 +25,7 @@
#
store/bootLock.java
derbynet/dblook_test_net.java
+derbynet/dblook_test_net_territory.java
derbynet/getCurrentProperties.java
derbynet/maxthreads.java
derbynet/runtimeinfo.java
Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetUseprocess.exclude
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetUseprocess.exclude?rev=635588&r1=635587&r2=635588&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetUseprocess.exclude (original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetUseprocess.exclude Mon Mar 10 09:19:23 2008
@@ -9,6 +9,7 @@
# derbynet/DerbyNetAutoStart.java - exits suite...
# derbynet/getCurrentProperties.java - fails with different sessions
# derbynet/dblook_test_net.java - fails, test misses properties
+# derbynet/dblook_test_net_territory.java - fails, test misses properties
# derbynet/runtimeinfo.java - fails with already existing threads (maybe intermittent)
# derbynet/sysinfo.java - fails because not access to java.class.path
# derbynet/sysinfo_withproperties.java - fails because not access to java.class.path
@@ -25,6 +26,7 @@
derbynet/DerbyNetAutoStart.java
derbynet/getCurrentProperties.java
derbynet/dblook_test_net.java
+derbynet/dblook_test_net_territory.java
derbynet/runtimeinfo.java
derbynet/sysinfo.java
derbynet/sysinfo_withproperties.java
Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall?rev=635588&r1=635587&r2=635588&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall (original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall Mon Mar 10 09:19:23 2008
@@ -1,4 +1,5 @@
derbynet/dblook_test_net.java
+derbynet/dblook_test_net_territory.java
derbynet/DerbyNetAutoStart.java
derbynet/getCurrentProperties.java
derbynet/maxthreads.java
Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/derbytools.runall
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/derbytools.runall?rev=635588&r1=635587&r2=635588&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/derbytools.runall (original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/derbytools.runall Mon Mar 10 09:19:23 2008
@@ -1,4 +1,5 @@
tools/dblook_test.java
+tools/dblook_test_territory.java
tools/derbyrunjartest.java
tools/importExportThruIJ.sql
tools/ij.sql
Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/j9derbynetmats.runall
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/j9derbynetmats.runall?rev=635588&r1=635587&r2=635588&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/j9derbynetmats.runall (original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/j9derbynetmats.runall Mon Mar 10 09:19:23 2008
@@ -1,4 +1,5 @@
derbynet/dblook_test_net.java
+derbynet/dblook_test_net_territory.java
derbynet/getCurrentProperties.java
derbynet/maxthreads.java
derbynet/runtimeinfo.java
Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NetHarnessJavaTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NetHarnessJavaTest.java?rev=635588&r1=635587&r2=635588&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NetHarnessJavaTest.java (original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NetHarnessJavaTest.java Mon Mar 10 09:19:23 2008
@@ -38,6 +38,7 @@
*
* dblook_test_net - filters output
* dataSourcePermissions_net - InvocationTargetException, needs investigation
+ * dblook_test_net_territory - filters output
* getCurrentProperties - ExceptionInInitializerError, needs investigation
* maxthreads - forks VM
* runtimeinfo" - filters output
Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/dblook_test_net.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/dblook_test_net.java?rev=635588&r1=635587&r2=635588&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/dblook_test_net.java (original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/dblook_test_net.java Mon Mar 10 09:19:23 2008
@@ -35,6 +35,7 @@
testDirectory = "dblook_test_net/";
new dblook_test_net().doTest();
System.out.println("\n[ Done. ]\n");
+ renameDbLookLog("dblook_test_net");
}
Propchange: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/dblook_test_net_territory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/dblook_test_net_territory_app.properties
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test.java?rev=635588&r1=635587&r2=635588&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test.java (original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test.java Mon Mar 10 09:19:23 2008
@@ -63,13 +63,15 @@
private static final char TEST_DELIMITER='#';
protected static String testDirectory = "dblook_test";
- protected static final String testDBName = "wombat";
+ protected static String testDBName = "wombat";
protected static String separator;
private static String dbPath;
private static int duplicateCounter = 0;
private static int sysNameCount = 0;
private static String jdbcProtocol;
+ protected static String territoryBased = "";
+ protected static String expectedCollation = "UCS_BASIC";
/* **********************************************
* main:
@@ -80,6 +82,7 @@
separator = System.getProperty("file.separator");
new dblook_test().doTest();
System.out.println("\n[ Done. ]\n");
+ renameDbLookLog("dblook_test");
}
@@ -720,7 +723,29 @@
Connection conn = DriverManager.getConnection(
"jdbc:derby:" + dbName);
conn.setAutoCommit(false);
+
+ // Set the system schema to ensure that UCS_BASIC collation is used.
Statement stmt = conn.createStatement();
+ stmt.executeUpdate("SET SCHEMA SYS");
+
+ // Ensure that the database has the expected collation type.
+ ResultSet rs = null;
+ try {
+ rs = stmt.executeQuery("VALUES SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY('derby.database.collation')");
+ rs.next();
+ String collation = rs.getString(1);
+ if (collation == null || !collation.equals(expectedCollation)) {
+ throw new SQLException("Collation doesn't match with the expected type " +
+ expectedCollation);
+ }
+ } catch (Exception e) {
+ System.out.println("FAILED: incorrect database collation\n");
+ System.out.println(e.getMessage());
+ } finally {
+ if (rs != null) {
+ rs.close();
+ }
+ }
// Load any id-to-name mappings that will be useful
// when dumping the catalogs.
@@ -731,7 +756,7 @@
// won't cause diffs.
writeOut("\n========== SYSALIASES ==========\n");
- ResultSet rs =
+ rs =
stmt.executeQuery("select schemaid, sys.sysaliases.* from sys.sysaliases");
dumpResultSet(rs, idToNameMap, null);
@@ -1187,7 +1212,7 @@
"' from ddl script '" + scriptName + "'");
Connection conn = DriverManager.getConnection(
- "jdbc:derby:" + newDBName + ";create=true");
+ "jdbc:derby:" + newDBName + ";create=true" + territoryBased);
Statement stmt = conn.createStatement();
BufferedReader ddlScript =
@@ -1503,6 +1528,39 @@
return;
+ }
+
+ /* **********************************************
+ * renameDbLookLog:
+ * Checks if the logfile of dblook exists and
+ * tries to rename it to prevent possible
+ * next tests from failing. The log should not be
+ * deleted because the output may be examined in
+ * case a test fails.
+ * The new name of dblook.log should be dblook_testname#.log,
+ * where # is a 'version' number. The 'version' number is
+ * needed because the same test may be run multiple
+ * times with different parameters.
+ * @param nameOfTest Name of the finished test.
+ ****/
+
+ protected static void renameDbLookLog(String nameOfTest)
+ {
+ File dbLookTestLog = new File("dblook.log");
+ if (dbLookTestLog.exists()) {
+ int i = 0;
+ String renamedLogName = nameOfTest + i + ".log";
+ File renamedLog = new File(renamedLogName);
+ while (renamedLog.exists()) {
+ i++;
+ renamedLogName = nameOfTest + i + ".log";
+ renamedLog = new File(renamedLogName);
+ }
+ if (!dbLookTestLog.renameTo(renamedLog)) {
+ System.out.println("Failed to rename dblook.org to " +
+ renamedLogName);
+ }
+ }
}
/* **********************************************
Propchange: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test_territory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test_territory_app.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test_territory_sed.properties
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/derby/code/branches/10.3/java/tools/org/apache/derby/tools/dblook.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/tools/org/apache/derby/tools/dblook.java?rev=635588&r1=635587&r2=635588&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/tools/org/apache/derby/tools/dblook.java (original)
+++ db/derby/code/branches/10.3/java/tools/org/apache/derby/tools/dblook.java Mon Mar 10 09:19:23 2008
@@ -584,13 +584,16 @@
// have multiple ResultSets open on the same connection).
this.conn.setAutoCommit(false);
+ // Set the system schema to ensure that UCS_BASIC collation is used.
+ Statement stmt = conn.createStatement();
+ stmt.executeUpdate("SET SCHEMA SYS");
+
// Prepare statements.
getColNameFromNumberQuery = conn.prepareStatement(
"SELECT COLUMNNAME FROM SYS.SYSCOLUMNS WHERE " +
"REFERENCEID = ? AND COLUMNNUMBER = ?");
// Load list of user tables and table ids, for general use.
- Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT T.TABLEID, T.TABLENAME, " +
"S.SCHEMANAME FROM SYS.SYSTABLES T, SYS.SYSSCHEMAS S " +
"WHERE T.TABLETYPE = 'T' AND T.SCHEMAID = S.SCHEMAID");