db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r907654 [2/2] - in /db/derby/code/trunk/java: engine/org/apache/derby/iapi/reference/ engine/org/apache/derby/iapi/sql/dictionary/ engine/org/apache/derby/impl/sql/catalog/ engine/org/apache/derby/impl/sql/compile/ engine/org/apache/derby/i...
Date Mon, 08 Feb 2010 13:51:37 GMT
Added: 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=907654&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SequenceGeneratorTest.java
(added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SequenceGeneratorTest.java
Mon Feb  8 13:51:35 2010
@@ -0,0 +1,660 @@
+/*
+
+   Derby - Class org.apache.derbyTesting.functionTests.tests.lang.SequenceGeneratorTest
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to you under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ */
+
+package org.apache.derbyTesting.functionTests.tests.lang;
+
+import java.math.BigDecimal;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.sql.Connection;
+import java.sql.ParameterMetaData;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.Timestamp;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.TestConfiguration;
+import org.apache.derbyTesting.junit.DatabasePropertyTestSetup;
+import org.apache.derbyTesting.junit.CleanDatabaseTestSetup;
+import org.apache.derbyTesting.junit.JDBC;
+
+import org.apache.derby.impl.sql.catalog.SequenceGenerator;
+import org.apache.derby.impl.sql.catalog.SequenceUpdater;
+import org.apache.derby.iapi.types.SQLLongint;
+import org.apache.derby.iapi.store.access.TransactionController;
+
+/**
+ * <p>
+ * Test sequence generators. See DERBY-712.
+ * </p>
+ */
+public class SequenceGeneratorTest  extends GeneratedColumnsHelper
+{
+    ///////////////////////////////////////////////////////////////////////////////////
+    //
+    // CONSTANTS
+    //
+    ///////////////////////////////////////////////////////////////////////////////////
+
+    // number of pre-allocated values in a sequence generator
+    private static final long ALLOCATION_COUNT = 5L;
+
+    private static  final   String      TEST_DBO = "TEST_DBO";
+    private static  final   String      RUTH = "RUTH";
+    private static  final   String      ALICE = "ALICE";
+    private static  final   String[]    LEGAL_USERS = { TEST_DBO, ALICE, RUTH  };
+
+    ///////////////////////////////////////////////////////////////////////////////////
+    //
+    // STATE
+    //
+    ///////////////////////////////////////////////////////////////////////////////////
+
+    private static boolean _fullDebug = false;
+
+    ///////////////////////////////////////////////////////////////////////////////////
+    //
+    // CONSTRUCTOR
+    //
+    ///////////////////////////////////////////////////////////////////////////////////
+
+
+    /**
+     * Create a new instance.
+     */
+
+    public SequenceGeneratorTest(String name)
+    {
+        super(name);
+    }
+
+    ///////////////////////////////////////////////////////////////////////////////////
+    //
+    // JUnit BEHAVIOR
+    //
+    ///////////////////////////////////////////////////////////////////////////////////
+
+
+    /**
+     * Construct top level suite in this JUnit test
+     */
+    public static Test suite()
+    {
+        TestSuite suite = (TestSuite) TestConfiguration.embeddedSuite(SequenceGeneratorTest.class);
+        Test        cleanTest = new CleanDatabaseTestSetup( suite );
+        Test        authenticatedTest = DatabasePropertyTestSetup.builtinAuthentication
+            ( cleanTest, LEGAL_USERS, "sequenceGenerator" );
+        Test        authorizedTest = TestConfiguration.sqlAuthorizationDecorator( authenticatedTest
);
+
+        return authorizedTest;
+    }
+
+    ///////////////////////////////////////////////////////////////////////////////////
+    //
+    // TESTS
+    //
+    ///////////////////////////////////////////////////////////////////////////////////
+
+    /**
+     * <p>
+     * Test basic incrementing and pre-allocating of sequence values on disk.
+     * </p>
+     */
+    public void test_01_basic() throws Exception
+    {
+        Connection  conn = openUserConnection( TEST_DBO );
+
+        int initialValue = Integer.MIN_VALUE;
+
+        goodStatement( conn, "create sequence seq_01\n" );
+
+        assertEquals( (long) initialValue, getCurrentValue( TEST_DBO, "SEQ_01" ) );
+
+        // first run is allocated
+        int seq_01_value = initialValue;
+        long seq_01_upperBound = seq_01_value + ALLOCATION_COUNT;
+        for ( int i = 0; i < ALLOCATION_COUNT; i++ )
+        {
+            vetBumping( conn, TEST_DBO, "SEQ_01", seq_01_value++, seq_01_upperBound );
+        }
+
+        // another run is allocated
+        seq_01_upperBound += ALLOCATION_COUNT;
+        vetBumping( conn, TEST_DBO, "SEQ_01", seq_01_value++, seq_01_upperBound );
+
+        // DDL flushes the metadata cache
+        goodStatement( conn, "create sequence seq_01_a\n" );
+
+        int seq_01_a_value = initialValue;
+        long seq_01_a_upperBound = seq_01_a_value + ALLOCATION_COUNT;
+        // check the other sequence
+        for ( int i = 0; i < 2; i++ )
+        {
+            vetBumping( conn, TEST_DBO, "SEQ_01_A", seq_01_a_value++, seq_01_a_upperBound
);
+        }
+
+        //
+        // The cache was flushed when seq_01_a was created. This
+        // restarts the generator for that sequence and allocates a new range.
+        //
+        seq_01_upperBound = seq_01_value + ALLOCATION_COUNT;
+        vetBumping( conn, TEST_DBO, "SEQ_01", seq_01_value++, seq_01_upperBound );
+    }
+    private void vetBumping( Connection conn, String schemaName, String sequenceName, int
expectedValue, long expectedValueOnDisk )
+        throws Exception
+    {
+        PreparedStatement ps = chattyPrepare( conn, "values( next value for " + schemaName
+ '.' + sequenceName + " )\n" );
+
+        assertEquals( expectedValue, getScalarInteger( ps ) );
+        assertEquals( expectedValueOnDisk, getCurrentValue( schemaName, sequenceName ) );
+    }
+
+    /**
+     * <p>
+     * Test boundary conditions in sequence generators.
+     * </p>
+     */
+    public void test_02_boundary() throws Exception
+    {
+        T_SequenceUpdater updater;
+
+        updater = new T_SequenceUpdater
+            ( new Long(  Integer.MIN_VALUE ), true, 1L, (long) Integer.MAX_VALUE, (long)
Integer.MIN_VALUE, (long) Integer.MIN_VALUE );
+
+        assertEquals( -2147483648L, updater.getValueOnDisk().longValue() );
+
+        vetBumping( updater, -2147483648L, -2147483643L );
+        vetBumping( updater, -2147483647L, -2147483643L );
+        vetBumping( updater, -2147483646L, -2147483643L );
+        vetBumping( updater, -2147483645L, -2147483643L );
+        vetBumping( updater, -2147483644L, -2147483643L );
+        vetBumping( updater, -2147483643L, -2147483638L );
+
+        vetBoundaries( Short.MAX_VALUE, Short.MIN_VALUE );
+        vetBoundaries( Integer.MAX_VALUE, Integer.MIN_VALUE );
+        vetBoundaries( Long.MAX_VALUE, Long.MIN_VALUE );
+
+        vetBoundaries( Short.MAX_VALUE/2, Short.MIN_VALUE/2 );
+        vetBoundaries( Integer.MAX_VALUE/2, Integer.MIN_VALUE/2 );
+        vetBoundaries( Long.MAX_VALUE/2, Long.MIN_VALUE/2 );
+    }
+    private void vetBoundaries
+        (
+         long maxValue,
+         long minValue
+         )
+        throws Exception
+    {
+        long biggestStep = 2 * ALLOCATION_COUNT;
+        
+        for ( long i = 1L; i <= biggestStep; i++ )
+        {
+            vetUpperBoundary( maxValue, minValue, i );
+            vetLowerBoundary( maxValue, minValue, i );
+        }
+    }
+    private void vetUpperBoundary
+        (
+         long maxValue,
+         long minValue,
+         long stepSize
+         )
+        throws Exception
+    {
+        long restartValue = minValue;
+        long firstValue;
+
+        long initValue = maxValue - (ALLOCATION_COUNT * stepSize);
+
+        for ( long i = initValue; (i > 0) && (i <= maxValue); i++ )
+        {
+            firstValue = i;
+            vetBoundaries( maxValue, minValue, stepSize, firstValue, restartValue );
+        }
+    }
+    private void vetLowerBoundary
+        (
+         long maxValue,
+         long minValue,
+         long stepSize
+         )
+        throws Exception
+    {
+        long restartValue = maxValue;
+        long firstValue;
+
+        long initValue = minValue + (ALLOCATION_COUNT * stepSize);
+
+        for ( long i = initValue; (i < 0) && (i >= minValue); i-- )
+        {
+            firstValue = i;
+            vetBoundaries( maxValue, minValue, -stepSize, firstValue, restartValue );
+        }
+    }
+    private void vetBoundaries
+        (
+         long maxValue,
+         long minValue,
+         long stepSize,
+         long firstValue,
+         long restartValue
+         )
+        throws Exception
+    {
+        long bumps = (2 * ALLOCATION_COUNT) + 1;
+        
+        vetBumping( firstValue, true, stepSize, maxValue, minValue, restartValue, bumps );
+        vetBumping( firstValue, false, stepSize, maxValue, minValue, restartValue, bumps
);
+    }
+    private void vetBumping
+        (
+         long firstValue,
+         boolean canCycle,
+         long stepSize,
+         long maxValue,
+         long minValue,
+         long restartValue,
+         long bumps
+         )
+        throws Exception
+    {
+        if ( _fullDebug) { println( "stepSize = " + stepSize + " and firstValue = " + firstValue
+ " and canCycle = " + canCycle ); }
+        
+        SGVetter vetter = new SGVetter
+            ( new Long(  firstValue ), canCycle, stepSize, maxValue, minValue, restartValue,
ALLOCATION_COUNT );           
+        T_SequenceUpdater updater = new T_SequenceUpdater
+            ( new Long(  firstValue ), canCycle, stepSize, maxValue, minValue, restartValue
);
+
+        if ( _fullDebug) { println( "" ); }
+        for ( long i = 0; i < bumps; i++ ) { vetBump( vetter, updater ); }
+    }
+    private void vetBump( SGVetter vetter, T_SequenceUpdater updater ) throws Exception
+    {
+        assertLongEquals( vetter.getUpperBound(), updater.getValueOnDisk() );
+
+        Long vetterValue = vetter.getNextValue();
+
+        if ( _fullDebug ) { println( "Expecting value = " + vetterValue + " and expecting
ValueOnDisk = " + vetter.getUpperBound() ); }
+        
+        if ( vetterValue != null )
+        {
+            long updaterValue = updater.getCurrentValueAndAdvance();
+
+            assertEquals( vetterValue.longValue(), updaterValue );
+        }
+        else
+        {
+            try {
+                updater.getCurrentValueAndAdvance();
+                fail( "Expected to catch cycle exception." );
+            }
+            catch (Exception e)
+            {}
+        }
+
+        assertLongEquals( vetter.getUpperBound(), updater.getValueOnDisk() );
+    }
+    private void assertLongEquals( Long left, Long right )
+    {
+        if ( left == null ) { assertNull( right ); }
+        else
+        {
+            assertNotNull( right );
+            assertEquals( left.longValue(), right.longValue() );
+        }
+    }
+    
+    private void vetBumping( T_SequenceUpdater updater, long expectedValue, long expectedValueOnDisk
)
+        throws Exception
+    {
+        long actualValue = updater.getCurrentValueAndAdvance();
+        long actualValueOnDisk = updater.getValueOnDisk().longValue();
+        
+        println( "Expected value = " + expectedValue + " vs actual value = " + actualValue
);
+        println( "    Expected value on disk = " + expectedValue + " vs actual value on disk
= " + actualValueOnDisk );
+        
+        assertEquals( expectedValue, actualValue );
+        assertEquals( expectedValueOnDisk, actualValueOnDisk );
+    }
+    
+    /**
+     * <p>
+     * Test non cycling sequence generators.
+     * </p>
+     */
+    public void test_03_nonCycling() throws Exception
+    {
+        vetNonCycling( Short.MAX_VALUE, Short.MIN_VALUE );
+        vetNonCycling( Integer.MAX_VALUE, Integer.MIN_VALUE );
+        vetNonCycling( Long.MAX_VALUE, Long.MIN_VALUE );
+    }
+    private void vetNonCycling
+        (
+         long maxValue,
+         long minValue
+         )
+        throws Exception
+    {
+        vetNonCycling( maxValue, minValue, 1L );
+        vetNonCycling( maxValue, minValue, -1L );
+    }
+    private void vetNonCycling
+        (
+         long maxValue,
+         long minValue,
+         long stepSize
+         )
+        throws Exception
+    {
+        long bumps = 3;
+        long firstValue;
+        long restartValue;
+
+        if ( stepSize > 0 )
+        {
+            firstValue = maxValue - bumps;
+            restartValue = minValue;
+        }
+        else
+        {
+            firstValue = minValue + bumps;
+            restartValue = maxValue;
+        }
+
+        SGVetter vetter = new SGVetter
+            ( new Long(  firstValue ), false, stepSize, maxValue, minValue, restartValue,
ALLOCATION_COUNT );           
+        T_SequenceUpdater updater = new T_SequenceUpdater
+            ( new Long(  firstValue ), false, stepSize, maxValue, minValue, restartValue
);
+
+        // make sure we can survive trying to bust the cycle more than once
+        long extraBumps = bumps + 2;
+        for ( long i = 0; i <= extraBumps; i++ )
+        {
+            vetBump( vetter, updater );
+        }
+    }
+    
+    /**
+     * <p>
+     * Test that when you reboot the database, you pick up the sequence
+     * number on disk, not the last version in memory.
+     * </p>
+     */
+    public void test_04_reboot() throws Exception
+    {
+        Connection  conn = openUserConnection( TEST_DBO );
+        
+        int initialValue = Integer.MIN_VALUE;
+
+        goodStatement( conn, "create sequence seq_04\n" );
+
+        int seq_04_value = initialValue;
+        long seq_04_upperBound = seq_04_value + ALLOCATION_COUNT;
+        vetBumping( conn, TEST_DBO, "SEQ_04", seq_04_value++, seq_04_upperBound );
+        vetBumping( conn, TEST_DBO, "SEQ_04", seq_04_value++, seq_04_upperBound );
+
+        getTestConfiguration().shutdownDatabase();
+        conn = openUserConnection( TEST_DBO );
+        seq_04_value = (int) seq_04_upperBound;
+        seq_04_upperBound = seq_04_value + ALLOCATION_COUNT;
+        vetBumping( conn, TEST_DBO, "SEQ_04", seq_04_value++, seq_04_upperBound );
+
+        getTestConfiguration().shutdownDatabase();
+        conn = openUserConnection( TEST_DBO );
+        seq_04_value = (int) seq_04_upperBound;
+        seq_04_upperBound = seq_04_value + ALLOCATION_COUNT;
+        vetBumping( conn, TEST_DBO, "SEQ_04", seq_04_value++, seq_04_upperBound );
+    }
+    
+    /**
+     * <p>
+     * Test that multiple transactions can access the same sequence generator
+     * and not block.
+     * </p>
+     */
+    public void test_05_concurrency() throws Exception
+    {
+        Connection  conn = openUserConnection( TEST_DBO );
+        
+        int initialValue = Integer.MIN_VALUE;
+
+        goodStatement( conn, "create sequence seq_05\n" );
+        goodStatement( conn, "grant usage on sequence seq_05 to public\n" );
+
+        int seq_05_value = initialValue;
+        long seq_05_upperBound = seq_05_value;
+
+        Connection  ruthConnection = openUserConnection( "RUTH" );
+        Connection  aliceConnection = openUserConnection( "ALICE" );
+
+        ruthConnection.setAutoCommit( false );
+        aliceConnection.setAutoCommit( false );
+
+        long loopCount = 2 * ALLOCATION_COUNT;
+        for ( long i = 0; i < loopCount; i++ )
+        {
+            Connection loopConn = ( i % 2 == 0 ) ? ruthConnection : aliceConnection;
+
+            if ( (i % ALLOCATION_COUNT) == 0 ) { seq_05_upperBound += ALLOCATION_COUNT; }
+
+            vetBumping( loopConn, TEST_DBO, "SEQ_05", seq_05_value++, seq_05_upperBound );
+        }
+
+        ruthConnection.commit();
+        aliceConnection.commit();
+    }
+    
+    /**
+     * <p>
+     * Test big step sizes.
+     * </p>
+     */
+    public void test_06_bigStepSize() throws Exception
+    {
+        T_SequenceUpdater updater;
+        long stepSize = (Long.MAX_VALUE / ALLOCATION_COUNT) * 3;
+
+        updater = new T_SequenceUpdater
+            ( new Long(  Long.MIN_VALUE ), true, stepSize, (long) Long.MAX_VALUE, (long)
Long.MIN_VALUE, (long) Long.MIN_VALUE );
+
+        long nextValue = updater.getCurrentValueAndAdvance();
+        long currentValueOnDisk = updater.getValueOnDisk().longValue();
+        long rangeSize = currentValueOnDisk - nextValue;
+
+        // allocation count truncated to 1 because the step size is so large
+        assertEquals( stepSize, rangeSize );
+
+        vetBigStep( Short.MAX_VALUE, Short.MIN_VALUE );
+        vetBigStep( Integer.MAX_VALUE, Integer.MIN_VALUE );
+        vetBigStep( Long.MAX_VALUE, Long.MIN_VALUE );
+
+        vetBigStep( ALLOCATION_COUNT, 0L );
+    }
+    private void vetBigStep( long maxValue, long minValue )
+        throws Exception
+    {
+        Long firstValue = new Long( minValue );
+        long restartValue = minValue;
+        long stepSize = maxValue - 1;
+        boolean canCycle = true;
+        long truncatedAllocationCount = 1L;
+        
+        SGVetter vetter = new SGVetter
+            ( firstValue, canCycle, stepSize, maxValue, minValue, restartValue, truncatedAllocationCount
);           
+        T_SequenceUpdater updater = new T_SequenceUpdater
+            ( firstValue, canCycle, stepSize, maxValue, minValue, restartValue );
+
+        for ( long i = 0; i < ALLOCATION_COUNT; i++ )
+        {
+            vetBump( vetter, updater );
+        }
+    }
+    
+    /**
+     * <p>
+     * Test that cache flushing doesn't prevent us from dropping
+     * a sequence generator.
+     * </p>
+     */
+    public void test_07_dropSequence() throws Exception
+    {
+        Connection  conn = getConnection();
+
+        goodStatement( conn, "create sequence seq_07\n" );
+        
+        int initialValue = Integer.MIN_VALUE;
+        int seq_07_value = initialValue;
+        long seq_07_upperBound = seq_07_value + ALLOCATION_COUNT;
+        for ( int i = 0; i < ALLOCATION_COUNT; i++ )
+        {
+            vetBumping( conn, TEST_DBO, "SEQ_07", seq_07_value++, seq_07_upperBound );
+        }
+
+        goodStatement( conn, "values( next value for seq_07 )\n" );
+        goodStatement( conn, "drop sequence seq_07\n" );
+        
+        expectCompilationError( OBJECT_DOES_NOT_EXIST, "values ( next value for seq_07 )\n"
);
+    }
+    
+    ///////////////////////////////////////////////////////////////////////////////////
+    //
+    // MINIONS
+    //
+    ///////////////////////////////////////////////////////////////////////////////////
+
+    /** Get the current value from a sequence */
+    private long getCurrentValue( String schemaName, String sequenceName )
+        throws Exception
+    {
+        Connection  conn = openUserConnection( TEST_DBO );
+        
+        PreparedStatement ps = chattyPrepare
+            ( conn,
+              "select currentvalue from sys.syssequences seq, sys.sysschemas s where s.schemaname
= ? and seq.sequencename = ? and s.schemaid = seq.schemaid" );
+        ps.setString( 1, schemaName );
+        ps.setString( 2, sequenceName );
+
+        long retval = getScalarLong( ps );
+
+        conn.commit();
+        
+        return retval;
+    }
+    
+    /** Get a scalar integer result from a query */
+    private int getScalarInteger( PreparedStatement ps ) throws Exception
+    {
+        ResultSet rs = ps.executeQuery();
+        rs.next();
+        int retval = rs.getInt( 1 );
+
+        rs.close();
+        ps.close();
+
+        return retval;
+    }
+
+    /** Get a scalar long result from a query */
+    private long getScalarLong( PreparedStatement ps ) throws Exception
+    {
+        ResultSet rs = ps.executeQuery();
+        rs.next();
+        long retval = rs.getLong( 1 );
+
+        rs.close();
+        ps.close();
+
+        return retval;
+    }
+
+    ///////////////////////////////////////////////////////////////////////////////////
+    //
+    // INNER CLASSES
+    //
+    ///////////////////////////////////////////////////////////////////////////////////
+
+    /**
+     * <p>
+     * Machine for testing sequence generators standalone.
+     * </p>
+     */
+    public static final class T_SequenceUpdater extends SequenceUpdater
+    {
+        private Long _valueOnDisk;
+        
+        public T_SequenceUpdater
+            (
+             Long currentValue,
+             boolean canCycle,
+             long increment,
+             long maxValue,
+             long minValue,
+             long restartValue
+             )
+        {
+            _valueOnDisk = currentValue;
+            
+            _sequenceGenerator = new SequenceGenerator
+                (
+                 currentValue,
+                 canCycle,
+                 increment,
+                 maxValue,
+                 minValue,
+                 restartValue,
+                 "DUMMY_SEQUENCE"
+                 );
+        }
+        
+        public Long getValueOnDisk() { return _valueOnDisk; }
+        
+        public long getCurrentValueAndAdvance() throws Exception
+        {
+            SQLLongint nextValue = new SQLLongint();
+            
+            getCurrentValueAndAdvance( nextValue );
+            
+            return nextValue.getLong();
+        }
+        
+        // SequenceUpdater BEHAVIOR
+        protected SequenceGenerator createSequenceGenerator( TransactionController readOnlyTC
) { return _sequenceGenerator; }
+        
+        protected boolean updateCurrentValueOnDisk( TransactionController tc, Long oldValue,
Long newValue, boolean wait )
+        {
+            _valueOnDisk = newValue;
+
+            return true;
+        }
+        
+        // override so the tests don't get a null pointer exception looking up the lcc
+        public boolean updateCurrentValueOnDisk( Long oldValue, Long newValue )
+        {
+            return updateCurrentValueOnDisk( null, oldValue, newValue, false );
+        }
+    }
+
+}
+

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

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SequenceTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SequenceTest.java?rev=907654&r1=907653&r2=907654&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SequenceTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SequenceTest.java
Mon Feb  8 13:51:35 2010
@@ -69,18 +69,18 @@
         return authorizedTest;
     }
 
-    public void testCreateSequence() throws SQLException {
+    public void test_01_CreateSequence() throws SQLException {
         Statement s = createStatement();
         s.executeUpdate("CREATE SEQUENCE mySeq");
     }
 
-    public void testDropSequence() throws SQLException {
+    public void test_02_DropSequence() throws SQLException {
         Statement s = createStatement();
         s.executeUpdate("CREATE SEQUENCE mySeq1");
         s.executeUpdate("DROP SEQUENCE mySeq1");
     }
 
-    public void testDuplicateCreationFailure() throws SQLException {
+    public void test_03_DuplicateCreationFailure() throws SQLException {
         Statement s = null;
         try {
             s = createStatement();
@@ -93,7 +93,7 @@
         }
     }
 
-    public void testImplicitSchemaCreation() throws SQLException {
+    public void test_04_ImplicitSchemaCreation() throws SQLException {
         Connection adminCon = openUserConnection(TEST_DBO);
 
         Connection alphaCon = openUserConnection(ALPHA);
@@ -107,7 +107,7 @@
         adminCon.close();
     }
 
-    public void testCreateWithSchemaSpecified() throws SQLException {
+    public void test_05CreateWithSchemaSpecified() throws SQLException {
 
         // create DB
         Connection alphaCon = openUserConnection(ALPHA);
@@ -120,7 +120,7 @@
         alphaCon.close();
     }
 
-    public void testCreateWithSchemaSpecifiedCreateTrue() throws SQLException {
+    public void test_06_CreateWithSchemaSpecifiedCreateTrue() throws SQLException {
         Connection alphaCon = openUserConnection(ALPHA);
         Statement stmt = alphaCon.createStatement();
 
@@ -131,7 +131,7 @@
         alphaCon.close();
     }
 
-    public void testCreateWithSchemaDropWithNoSchema() throws SQLException {
+    public void test_07_CreateWithSchemaDropWithNoSchema() throws SQLException {
         Connection alphaCon = openUserConnection(ALPHA);
         Statement stmt = alphaCon.createStatement();
 
@@ -145,7 +145,7 @@
     /**
      * Test trying to drop a sequence in a schema that doesn't belong to one
      */
-    public void testDropOtherSchemaSequence() throws SQLException {
+    public void test_08_DropOtherSchemaSequence() throws SQLException {
         Connection adminCon = openUserConnection(TEST_DBO);
 
         Connection alphaCon = openUserConnection(ALPHA);
@@ -171,7 +171,7 @@
     /**
      * Test trying to create a sequence in a schema that doesn't belong to one
      */
-    public void testCreateOtherSchemaSequence() throws SQLException {
+    public void test_09_CreateOtherSchemaSequence() throws SQLException {
         // create DB
         Connection adminCon = openUserConnection(TEST_DBO);
 
@@ -291,7 +291,7 @@
      * initial test for next value
      * @throws SQLException on error
      */
-    public void testNextValue() throws SQLException {
+    public void test_10_NextValue() throws SQLException {
         Statement s = createStatement();
         s.executeUpdate("CREATE SEQUENCE mySeq1");
         s.execute("SELECT NEXT VALUE FOR mySeq1 from sys.systables");

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UDTTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UDTTest.java?rev=907654&r1=907653&r2=907654&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UDTTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UDTTest.java
Mon Feb  8 13:51:35 2010
@@ -53,7 +53,6 @@
     ///////////////////////////////////////////////////////////////////////////////////
 
     public static final String OBJECT_EXISTS = "X0Y68";
-    public static final String NONEXISTENT_OBJECT = "42Y55";
     public static final String SYNTAX_ERROR = "42X01";
     public static final String VIEW_DEPENDS_ON_TYPE = "X0Y23";
     public static final String TRIGGER_DEPENDS_ON_TYPE = "X0Y24";

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java?rev=907654&r1=907653&r2=907654&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
Mon Feb  8 13:51:35 2010
@@ -208,6 +208,7 @@
         suite.addTest(OffsetFetchNextTest.suite());
         suite.addTest(SequenceTest.suite());
         suite.addTest(SequencePermsTest.suite());
+        suite.addTest(SequenceGeneratorTest.suite());
         suite.addTest(OLAPTest.suite());
         suite.addTest(OrderByAndOffsetFetchInSubqueries.suite());
 



Mime
View raw message