db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r639745 - in /db/derby/code/branches/10.3.2.1_test/java/testing/org/apache/derbyTesting: functionTests/tests/jdbc4/ functionTests/tests/tools/ junit/
Date Fri, 21 Mar 2008 18:20:16 GMT
Author: kmarsden
Date: Fri Mar 21 11:20:08 2008
New Revision: 639745

URL: http://svn.apache.org/viewvc?rev=639745&view=rev
Log:
java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTest.java
update for DERBY-2065 (587040) Network and embedded difference in SQLSTATE and message when
Connection.close() with open transaction.
java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestDbMetaData.java

update for DERBY-2983 (563172) The ResultSet returned by DatabaseMetaData.getFunctions() does
not contain a required column named FUNCTION_TYPE.

java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportProcedureTest.java
java/testing/org/apache/derbyTesting/junit/SupportFilesSetup.java

Update for DERBY-3068 (616085)  testImportExportProcedureNegative(org.apache.derbyTesting.functionTests.tests.tools.ImportExportProcedureTest)junit.framework.ComparisonFailure:
Unexpected SQL state. expected:<38000> but was:<XIE0S>


Modified:
    db/derby/code/branches/10.3.2.1_test/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTest.java
    db/derby/code/branches/10.3.2.1_test/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestDbMetaData.java
    db/derby/code/branches/10.3.2.1_test/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportProcedureTest.java
    db/derby/code/branches/10.3.2.1_test/java/testing/org/apache/derbyTesting/junit/SupportFilesSetup.java

Modified: db/derby/code/branches/10.3.2.1_test/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3.2.1_test/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTest.java?rev=639745&r1=639744&r2=639745&view=diff
==============================================================================
--- db/derby/code/branches/10.3.2.1_test/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTest.java
(original)
+++ db/derby/code/branches/10.3.2.1_test/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTest.java
Fri Mar 21 11:20:08 2008
@@ -166,11 +166,9 @@
             // The SQL State is incorrect in the embedded client, see
             // JIRA id DERBY-1168
             String expectedState;
-            if ( this.usingDerbyNetClient() )
-                expectedState = SQLStateConstants.INVALID_TRANSACTION_STATE_ACTIVE_SQL_TRANSACTION;
-            else
-                expectedState = SQLStateConstants.INVALID_TRANSACTION_STATE_NO_SUBCLASS;
-            
+
+            expectedState = SQLStateConstants.INVALID_TRANSACTION_STATE_ACTIVE_SQL_TRANSACTION;
+        
             if ( ! expectedState.equals(sqle.getSQLState()) )
             {
                 System.err.println("ERROR: Unexpected SQL State encountered; "

Modified: db/derby/code/branches/10.3.2.1_test/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestDbMetaData.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3.2.1_test/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestDbMetaData.java?rev=639745&r1=639744&r2=639745&view=diff
==============================================================================
--- db/derby/code/branches/10.3.2.1_test/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestDbMetaData.java
(original)
+++ db/derby/code/branches/10.3.2.1_test/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestDbMetaData.java
Fri Mar 21 11:20:08 2008
@@ -27,6 +27,7 @@
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
+import java.sql.Types;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
@@ -44,6 +45,7 @@
 
     private DatabaseMetaData meta;
 
+    private static  final   Integer FUNCTION_NO_TABLE_VALUE = new Integer( DatabaseMetaData.functionNoTable
);
     public TestDbMetaData(String name) {
         super(name);
     }
@@ -99,7 +101,11 @@
     }
 
     public void testAutoCommitFailureClosesAllResultSets() throws SQLException {
-        assertFalse(meta.autoCommitFailureClosesAllResultSets());
+        if (usingEmbedded()) {
+            assertTrue(meta.autoCommitFailureClosesAllResultSets());
+        } else {
+            assertFalse(meta.autoCommitFailureClosesAllResultSets());
+        }
     }
 
     public void testGetClientInfoProperties() throws SQLException {
@@ -124,60 +130,64 @@
     /** Check that the column names are as expected from getFunctions(). */
     private void assertGetFunctionsRs(ResultSet rs) throws SQLException {
         JDBC.assertColumnNames(rs, new String[] {
-            "FUNCTION_CAT", "FUNCTION_SCHEM", "FUNCTION_NAME", "REMARKS",
-            "SPECIFIC_NAME" });
+                "FUNCTION_CAT", "FUNCTION_SCHEM", "FUNCTION_NAME", "REMARKS",
+                "FUNCTION_TYPE", "SPECIFIC_NAME" });
+            JDBC.assertColumnTypes(rs, new int[] {
+                Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
+                Types.SMALLINT, Types.VARCHAR });
+
     }
     
     private static final GeneratedId GENERIC_NAME = new GeneratedId();
 
     /** Expected rows from getFunctions() when all functions match. */
     private static final Object[][] ALL_FUNCTIONS = {
-        { null, "APP", "DUMMY1", "java.some.func", GENERIC_NAME },
-        { null, "APP", "DUMMY2", "java.some.func", GENERIC_NAME },
-        { null, "APP", "DUMMY3", "java.some.func", GENERIC_NAME },
-        { null, "APP", "DUMMY4", "java.some.func", GENERIC_NAME },
+        { null, "APP", "DUMMY1", "java.some.func", FUNCTION_NO_TABLE_VALUE, GENERIC_NAME
},
+        { null, "APP", "DUMMY2", "java.some.func", FUNCTION_NO_TABLE_VALUE, GENERIC_NAME
},
+        { null, "APP", "DUMMY3", "java.some.func", FUNCTION_NO_TABLE_VALUE, GENERIC_NAME
},
+        { null, "APP", "DUMMY4", "java.some.func", FUNCTION_NO_TABLE_VALUE, GENERIC_NAME
},
         { null, "SYSCS_UTIL", "SYSCS_CHECK_TABLE",
           "org.apache.derby.catalog.SystemProcedures.SYSCS_CHECK_TABLE",
-          GENERIC_NAME },
+          FUNCTION_NO_TABLE_VALUE, GENERIC_NAME },
         { null, "SYSCS_UTIL", "SYSCS_GET_DATABASE_PROPERTY",
           "org.apache.derby.catalog.SystemProcedures." +
-          "SYSCS_GET_DATABASE_PROPERTY", GENERIC_NAME },
+          "SYSCS_GET_DATABASE_PROPERTY", FUNCTION_NO_TABLE_VALUE, GENERIC_NAME },
         { null, "SYSCS_UTIL", "SYSCS_GET_RUNTIMESTATISTICS",
           "org.apache.derby.catalog.SystemProcedures." +
-          "SYSCS_GET_RUNTIMESTATISTICS", GENERIC_NAME },
+          "SYSCS_GET_RUNTIMESTATISTICS", FUNCTION_NO_TABLE_VALUE, GENERIC_NAME },
           { null, "SYSCS_UTIL", "SYSCS_GET_USER_ACCESS",
               "org.apache.derby.catalog.SystemProcedures." +
-              "SYSCS_GET_USER_ACCESS", GENERIC_NAME },
+              "SYSCS_GET_USER_ACCESS", FUNCTION_NO_TABLE_VALUE, GENERIC_NAME },
         { null, "SYSIBM", "BLOBCREATELOCATOR",
           "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
-          "BLOBCREATELOCATOR", GENERIC_NAME },
+          "BLOBCREATELOCATOR", FUNCTION_NO_TABLE_VALUE, GENERIC_NAME },
         { null, "SYSIBM", "BLOBGETBYTES",
           "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
-          "BLOBGETBYTES", GENERIC_NAME },
+          "BLOBGETBYTES", FUNCTION_NO_TABLE_VALUE, GENERIC_NAME },
         { null, "SYSIBM", "BLOBGETLENGTH",
           "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
-          "BLOBGETLENGTH", GENERIC_NAME },
+          "BLOBGETLENGTH", FUNCTION_NO_TABLE_VALUE, GENERIC_NAME },
         { null, "SYSIBM", "BLOBGETPOSITIONFROMBYTES",
           "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
-          "BLOBGETPOSITIONFROMBYTES", GENERIC_NAME },
+          "BLOBGETPOSITIONFROMBYTES", FUNCTION_NO_TABLE_VALUE, GENERIC_NAME },
         { null, "SYSIBM", "BLOBGETPOSITIONFROMLOCATOR",
           "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
-          "BLOBGETPOSITIONFROMLOCATOR", GENERIC_NAME },
+          "BLOBGETPOSITIONFROMLOCATOR", FUNCTION_NO_TABLE_VALUE, GENERIC_NAME },
         { null, "SYSIBM", "CLOBCREATELOCATOR",
           "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
-          "CLOBCREATELOCATOR", GENERIC_NAME },
+          "CLOBCREATELOCATOR", FUNCTION_NO_TABLE_VALUE, GENERIC_NAME },
         { null, "SYSIBM", "CLOBGETLENGTH",
           "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
-          "CLOBGETLENGTH", GENERIC_NAME },
+          "CLOBGETLENGTH", FUNCTION_NO_TABLE_VALUE, GENERIC_NAME },
         { null, "SYSIBM", "CLOBGETPOSITIONFROMLOCATOR",
           "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
-          "CLOBGETPOSITIONFROMLOCATOR", GENERIC_NAME },
+          "CLOBGETPOSITIONFROMLOCATOR", FUNCTION_NO_TABLE_VALUE, GENERIC_NAME },
         { null, "SYSIBM", "CLOBGETPOSITIONFROMSTRING",
           "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
-          "CLOBGETPOSITIONFROMSTRING", GENERIC_NAME },
+          "CLOBGETPOSITIONFROMSTRING", FUNCTION_NO_TABLE_VALUE, GENERIC_NAME },
         { null, "SYSIBM", "CLOBGETSUBSTRING",
           "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
-          "CLOBGETSUBSTRING", GENERIC_NAME },
+          "CLOBGETSUBSTRING", FUNCTION_NO_TABLE_VALUE, GENERIC_NAME },
 
     };
 

Modified: db/derby/code/branches/10.3.2.1_test/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportProcedureTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3.2.1_test/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportProcedureTest.java?rev=639745&r1=639744&r2=639745&view=diff
==============================================================================
--- db/derby/code/branches/10.3.2.1_test/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportProcedureTest.java
(original)
+++ db/derby/code/branches/10.3.2.1_test/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportProcedureTest.java
Fri Mar 21 11:20:08 2008
@@ -1922,8 +1922,6 @@
             + "'extout/nodir/t1.dat' , null, null, null) ");
         assertStatementError("XIE0I", cSt);
 	
-	//DERBY-2925: need to delete existing files first.
-        SupportFilesSetup.deleteFile("extinout/t1.dat");
 
         //export table not found
         
@@ -1943,7 +1941,7 @@
         assertStatementError("38000", cSt);
        
 	//DERBY-2925: need to delete existing files first.
-        SupportFilesSetup.deleteFile("extout/t1.dat");
+        SupportFilesSetup.deleteFile("extinout/t1.dat");
  
         //export query is invalid (syntax error)
         
@@ -2048,7 +2046,7 @@
             "call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , "
             + "'extinout/t1.dat' , '\\a', '\\', null) ");
         assertStatementError("XIE0J", cSt);
-        
+                
         //DO A VALID EXPORT AND  IMPORT
         
         st.executeUpdate(
@@ -2070,6 +2068,8 @@
             + "'extinout/t1.dat' , null, null, 'utf-8', 0) ");
         assertUpdateCount(cSt, 0);
         
+        //  DERBY-2925: need to delete existing files 
+        SupportFilesSetup.deleteFile("extinout/t1.dat");
         rs = st.executeQuery(
             " select * from t1");
         

Modified: db/derby/code/branches/10.3.2.1_test/java/testing/org/apache/derbyTesting/junit/SupportFilesSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3.2.1_test/java/testing/org/apache/derbyTesting/junit/SupportFilesSetup.java?rev=639745&r1=639744&r2=639745&view=diff
==============================================================================
--- db/derby/code/branches/10.3.2.1_test/java/testing/org/apache/derbyTesting/junit/SupportFilesSetup.java
(original)
+++ db/derby/code/branches/10.3.2.1_test/java/testing/org/apache/derbyTesting/junit/SupportFilesSetup.java
Fri Mar 21 11:20:08 2008
@@ -30,6 +30,7 @@
 import java.security.PrivilegedActionException;
 
 import junit.extensions.TestSetup;
+import junit.framework.Assert;
 import junit.framework.Test;
 
 /**
@@ -268,17 +269,20 @@
     }
 
 
-    public static boolean deleteFile(final String fileName) 
+    public static void deleteFile(final String fileName) 
     {
-        Boolean ret = (Boolean) AccessController.doPrivileged
+        AccessController.doPrivileged
             (new java.security.PrivilegedAction() {
                         
                     public Object run() {
-                        return Boolean.valueOf((new File(fileName)).delete());
+                        File delFile = new File(fileName);
+                        if (!delFile.exists())
+                                return null;
+                         Assert.assertTrue(delFile.delete());
+                         return null;
                     }
                 }
              );
             
-        return ret.booleanValue();
     }
 }



Mime
View raw message