db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r1595977 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SequenceGeneratorTest.java
Date Mon, 19 May 2014 17:52:31 GMT
Author: rhillegas
Date: Mon May 19 17:52:31 2014
New Revision: 1595977

URL: http://svn.apache.org/r1595977
Log:
DERBY-6553: Adding test cases to verify that we can create trigger-invoking sequences: commit
derby-6553-01-aa-verifyFix.diff.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SequenceGeneratorTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SequenceGeneratorTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SequenceGeneratorTest.java?rev=1595977&r1=1595976&r2=1595977&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SequenceGeneratorTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SequenceGeneratorTest.java
Mon May 19 17:52:31 2014
@@ -70,6 +70,7 @@ public class SequenceGeneratorTest  exte
     private static  final   String[]    LEGAL_USERS = { TEST_DBO, ALICE, RUTH  };
 
     private static  final   String      MISSING_ALLOCATOR = "X0Y85";
+    private static  final   String      DUPLICATE_SEQUENCE = "X0Y68";
 
     ///////////////////////////////////////////////////////////////////////////////////
     //
@@ -822,6 +823,38 @@ public class SequenceGeneratorTest  exte
         assertEquals( expectedValue, getScalarInteger( ps ) );
     }
     
+    /**
+     * <p>
+     * Verify that we don't get an internal error when creating a sequence-invoking trigger.
+     * See DERBY-6553.
+     * </p>
+     */
+    public void test_14_6553() throws Exception
+    {
+        Connection  dboConn = openUserConnection( TEST_DBO );
+
+        //
+        // The original DERBY-6553 test case.
+        //
+        goodStatement( dboConn, "create table t1_6553_1(x int, y int, z int)" );
+        goodStatement( dboConn, "create table t2_6553_1(x int, y int, z int)" );
+        goodStatement( dboConn, "create sequence seq_6553_1" );
+        goodStatement( dboConn, "values next value for seq_6553_1" );
+        goodStatement
+            ( dboConn, "create trigger tr1 after insert on t1_6553_1 insert into t2_6553_1(x)
values (next value for seq_6553_1)" );
+
+        //
+        // The abbreviated test case.
+        //
+        dboConn.setAutoCommit( false );
+        goodStatement( dboConn, "create sequence seq_6553" );
+        dboConn.commit();
+        goodStatement( dboConn, "values next value for seq_6553" );
+        expectExecutionError( dboConn, DUPLICATE_SEQUENCE, "create sequence seq_6553" );
+        dboConn.rollback();
+        dboConn.setAutoCommit( true );
+    }
+    
     ///////////////////////////////////////////////////////////////////////////////////
     //
     // MINIONS



Mime
View raw message