db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r729329 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang: GeneratedColumnsTest.java build.xml t_bi_1.dat
Date Wed, 24 Dec 2008 16:08:54 GMT
Author: rhillegas
Date: Wed Dec 24 08:08:54 2008
New Revision: 729329

URL: http://svn.apache.org/viewvc?rev=729329&view=rev
Log:
DERBY-481: Add tests for bulk import of generated columns.

Added:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/t_bi_1.dat
  (with props)
Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GeneratedColumnsTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/build.xml

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GeneratedColumnsTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GeneratedColumnsTest.java?rev=729329&r1=729328&r2=729329&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GeneratedColumnsTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GeneratedColumnsTest.java
Wed Dec 24 08:08:54 2008
@@ -40,6 +40,7 @@
 import org.apache.derbyTesting.junit.TestConfiguration;
 import org.apache.derbyTesting.junit.CleanDatabaseTestSetup;
 import org.apache.derbyTesting.junit.JDBC;
+import org.apache.derbyTesting.junit.SupportFilesSetup;
 
 import org.apache.derby.catalog.types.RoutineAliasInfo;
 
@@ -56,6 +57,8 @@
     //
     ///////////////////////////////////////////////////////////////////////////////////
 
+    private static  final   String  IMPORT_FILE_NAME = "t_bi_1.dat";
+
     ///////////////////////////////////////////////////////////////////////////////////
     //
     // STATE
@@ -98,8 +101,18 @@
     public static Test suite()
     {
         TestSuite suite = (TestSuite) TestConfiguration.embeddedSuite(GeneratedColumnsTest.class);
+        Test        cleanDatabaseSuite = new CleanDatabaseTestSetup( suite );
 
-        return new CleanDatabaseTestSetup( suite );
+        //
+        // Copies the data file to a location which can be read.
+        //
+        Test        result = new SupportFilesSetup
+            (
+             cleanDatabaseSuite,
+             new String [] { "functionTests/tests/lang/" + IMPORT_FILE_NAME }
+             );
+
+        return result;
     }
 
     ///////////////////////////////////////////////////////////////////////////////////
@@ -5025,6 +5038,69 @@
 
     }
     
+    /**
+     * <p>
+     * Test that bulk import works with generated columns.
+     * </p>
+     */
+    public  void    test_028_bulkImport()
+        throws Exception
+    {
+        Connection  conn = getConnection();
+
+        //
+        // Initial setup
+        //
+        goodStatement
+            (
+             conn,
+             "create table t_bi_1( a int, b int, c generated always as ( a + b ) )"
+             );
+
+        //
+        // Should fail because we can't override the value of a generated column.
+        //
+        expectExecutionError
+            (
+             conn,
+             CANT_OVERRIDE_GENERATION_CLAUSE,
+             "call syscs_util.syscs_import_table( null, 'T_BI_1', 'extin/" + IMPORT_FILE_NAME
+ "', null, null, null, 0 )"
+             );
+
+        //
+        // Should be able to import partial column list which doesn't include
+        // generated column. In this case, one of the referenced columns is not
+        // imported so it is stuffed with a null, which then propagates through
+        // the generation clause.
+        //
+        goodStatement
+            (
+             conn,
+             "call syscs_util.syscs_import_data( null, 'T_BI_1', 'A', '1',  'extin/" + IMPORT_FILE_NAME
+ "', null, null, null, 0 )"
+             );
+
+        //
+        // Partial import including all of the referenced columns.
+        //
+        goodStatement
+            (
+             conn,
+             "call syscs_util.syscs_import_data( null, 'T_BI_1', 'A, B', '1, 2', 'extin/"
+ IMPORT_FILE_NAME + "', null, null, null, 0 )"
+             );
+
+        assertResults
+            (
+             conn,
+             "select * from t_bi_1 order by a, b",
+             new String[][]
+             {
+                 { "2", "3", "5", },
+                 { "2", null, null, },
+             },
+             false
+             );
+    }
+
     ///////////////////////////////////////////////////////////////////////////////////
     //
     // MINIONS

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/build.xml?rev=729329&r1=729328&r2=729329&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/build.xml
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/build.xml
Wed Dec 24 08:08:54 2008
@@ -171,7 +171,7 @@
   <target name="copyfiles">
     <copy todir="${out.dir}/${derby.testing.functest.dir}/tests/lang">
       <fileset dir="${derby.testing.src.dir}/${derby.testing.functest.dir}/tests/lang"

-        includes="*.sql,*.properties,*.subsql,*.policy,*.jar,*.tstlog,xmlTestFiles/*"/>
 
+        includes="*.sql,*.properties,*.subsql,*.policy,*.jar,*.dat,*.tstlog,xmlTestFiles/*"/>
 
     </copy>
   </target> 
 

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/t_bi_1.dat
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/t_bi_1.dat?rev=729329&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/t_bi_1.dat
(added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/t_bi_1.dat
Wed Dec 24 08:08:54 2008
@@ -0,0 +1 @@
+2,3,6

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/t_bi_1.dat
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message