db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r1221423 - in /db/derby/code/trunk/java: engine/org/apache/derby/catalog/ engine/org/apache/derby/iapi/sql/dictionary/ engine/org/apache/derby/impl/sql/catalog/ storeless/org/apache/derby/impl/storeless/ testing/org/apache/derbyTesting/func...
Date Tue, 20 Dec 2011 18:44:34 GMT
Author: rhillegas
Date: Tue Dec 20 18:44:33 2011
New Revision: 1221423

URL: http://svn.apache.org/viewvc?rev=1221423&view=rev
Log:
DERBY-866: Add syscs_reset_password() and syscs_modify_password() system procedures.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSUSERSRowFactory.java
    db/derby/code/trunk/java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GrantRevokeDDLTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/NativeAuthProcs.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Changes10_9.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/CleanDatabaseTestSetup.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java?rev=1221423&r1=1221422&r2=1221423&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java Tue Dec
20 18:44:33 2011
@@ -2054,7 +2054,6 @@ public class SystemProcedures  {
             LanguageConnectionContext lcc = ConnectionUtil.getCurrentLCC();
             DataDictionary dd = lcc.getDataDictionary();
             TransactionController tc = lcc.getTransactionExecute();
-            DataDescriptorGenerator ddg = dd.getDataDescriptorGenerator();
 
             /*
             ** Inform the data dictionary that we are about to write to it.
@@ -2067,25 +2066,86 @@ public class SystemProcedures  {
             */
             dd.startWriting(lcc);
 
-            //
-            // FIXME: DERBY-866 Proper values need to be computed for the
-            // following variables once Knut is done reworking builtin hashing.
-            //
-            String  hashingScheme = "???????";
-            char[]  hashedPassword = password;
+            UserDescriptor  userDescriptor = makeUserDescriptor( lcc, userName, password
);
 
+            dd.addDescriptor( userDescriptor, null, DataDictionary.SYSUSERS_CATALOG_NUM,
false, tc );
             
-            Timestamp   currentTimestamp = new Timestamp( (new java.util.Date()).getTime()
);
+        } catch (StandardException se) { throw PublicAPI.wrapStandardException(se); }
+    }
+    private static  UserDescriptor  makeUserDescriptor
+        (
+         LanguageConnectionContext lcc,
+         String userName,
+         char[] password
+         )
+        throws StandardException
+    {
+        DataDictionary dd = lcc.getDataDictionary();
+        DataDescriptorGenerator ddg = dd.getDataDescriptorGenerator();
 
-            UserDescriptor  userDescriptor = ddg.newUserDescriptor
-                ( userName, hashingScheme, hashedPassword, currentTimestamp );
+        //
+        // FIXME: DERBY-866 Proper values need to be computed for the
+        // following variables once Knut is done reworking builtin hashing.
+        //
+        String  hashingScheme = "???????";
+        char[]  hashedPassword = password;
+            
+        Timestamp   currentTimestamp = new Timestamp( (new java.util.Date()).getTime() );
 
-            dd.addDescriptor( userDescriptor, null, DataDictionary.SYSUSERS_CATALOG_NUM,
false, tc );
+        UserDescriptor  userDescriptor = ddg.newUserDescriptor
+            ( userName, hashingScheme, hashedPassword, currentTimestamp );
+
+        return userDescriptor;
+    }
+  
+    /**
+     * Reset a user's password.
+     */
+    public static void SYSCS_RESET_PASSWORD
+        (
+         String userName,
+         char[] password
+         )
+        throws SQLException
+    {
+        try {
+            LanguageConnectionContext lcc = ConnectionUtil.getCurrentLCC();
+            DataDictionary dd = lcc.getDataDictionary();
+            TransactionController tc = lcc.getTransactionExecute();
+
+            /*
+            ** Inform the data dictionary that we are about to write to it.
+            ** There are several calls to data dictionary "get" methods here
+            ** that might be done in "read" mode in the data dictionary, but
+            ** it seemed safer to do this whole operation in "write" mode.
+            **
+            ** We tell the data dictionary we're done writing at the end of
+            ** the transaction.
+            */
+            dd.startWriting(lcc);
+
+            UserDescriptor  userDescriptor = makeUserDescriptor( lcc, userName, password
);
+
+            dd.updateUser( userDescriptor, tc );
             
         } catch (StandardException se) { throw PublicAPI.wrapStandardException(se); }
     }
   
     /**
+     * Change a user's password.
+     */
+    public static void SYSCS_MODIFY_PASSWORD
+        (
+         char[] password
+         )
+        throws SQLException
+    {
+        String currentUser = ConnectionUtil.getCurrentLCC().getStatementContext().getSQLSessionContext().getCurrentUser();
+
+        SYSCS_RESET_PASSWORD( currentUser, password );
+    }
+  
+    /**
      * Drop a user.
      */
     public static void SYSCS_DROP_USER

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java?rev=1221423&r1=1221422&r2=1221423&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java
Tue Dec 20 18:44:33 2011
@@ -1670,6 +1670,26 @@ public interface DataDictionary
 									TransactionController tc)
 			throws StandardException;
 
+	/**
+	 * Update a user. Changes all columns in the corresponding SYSUSERS row
+     * except for the user name.
+	 *
+	 * @param newDescriptor New values for columns in the SYSUSERS row.
+	 * @param tc					The TransactionController to use
+	 *
+	 * @exception StandardException		Thrown on failure
+	 */
+	public void updateUser( UserDescriptor newDescriptor,TransactionController tc )
+		throws StandardException;
+
+	/** 
+	 * Drop a User from the DataDictionary
+	 *
+	 * @param userName The user to drop.
+	 * @param tc	The TransactionController
+	 *
+	 * @exception StandardException		Thrown on failure
+	 */
 	public void dropUser( String userName, TransactionController tc )
         throws StandardException;
     

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java?rev=1221423&r1=1221422&r2=1221423&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
Tue Dec 20 18:44:33 2011
@@ -64,6 +64,7 @@ import org.apache.derby.iapi.sql.diction
 import org.apache.derby.iapi.sql.dictionary.SubKeyConstraintDescriptor;
 import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
 import org.apache.derby.iapi.sql.dictionary.TriggerDescriptor;
+import org.apache.derby.iapi.sql.dictionary.UserDescriptor;
 import org.apache.derby.iapi.sql.dictionary.ViewDescriptor;
 import org.apache.derby.iapi.sql.dictionary.SystemColumn;
 import org.apache.derby.iapi.sql.dictionary.SequenceDescriptor;
@@ -455,6 +456,7 @@ public final class	DataDictionaryImpl
 												"SYSCS_INPLACE_COMPRESS_TABLE",
 												"SYSCS_COMPRESS_TABLE",
 												"SYSCS_UPDATE_STATISTICS",
+												"SYSCS_MODIFY_PASSWORD",
 												};
 	
 	/**
@@ -7786,14 +7788,35 @@ public final class	DataDictionaryImpl
 
 	}
 
-	/** 
-	 * Drop a User from the DataDictionary
-	 *
-	 * @param userName The user to drop.
-	 * @param tc	The TransactionController
-	 *
-	 * @exception StandardException		Thrown on failure
-	 */
+	public void updateUser( UserDescriptor newDescriptor,TransactionController tc )
+		throws StandardException
+	{
+		ExecIndexRow				keyRow;
+		TabInfoImpl					ti = getNonCoreTI( SYSUSERS_CATALOG_NUM );
+
+		/* Set up the start/stop position for the scan */
+		keyRow = (ExecIndexRow) exFactory.getIndexableRow(1);
+		keyRow.setColumn( 1, new SQLVarchar( newDescriptor.getUserName() ) );
+
+		// this zeroes out the password in the UserDescriptor
+		ExecRow row = ti.getCatalogRowFactory().makeRow( newDescriptor, null );
+
+		boolean[] bArray = { false };
+
+		int[] colsToUpdate =
+            {
+                SYSUSERSRowFactory.HASHINGSCHEME_COL_NUM,
+                SYSUSERSRowFactory.PASSWORD_COL_NUM,
+                SYSUSERSRowFactory.LASTMODIFIED_COL_NUM,
+            };
+
+		ti.updateRow
+            (
+             keyRow, row,
+             SYSUSERSRowFactory.SYSUSERS_INDEX1_ID,
+             bArray, colsToUpdate, tc
+             );
+	}
 
 	public void dropUser( String userName, TransactionController tc )
 			throws StandardException
@@ -13045,6 +13068,67 @@ public final class	DataDictionaryImpl
         }
         
         //
+        // SYSCS_RESET_PASSWORD( IN USERNAME  VARCHAR(128), IN PASSWORD VARCHAR(32672) )
+        //
+		
+        {
+            // procedure argument names
+            String[] arg_names = { "userName", "password" };
+
+            // procedure argument types
+            TypeDescriptor[] arg_types =
+                {
+                    CATALOG_TYPE_SYSTEM_IDENTIFIER, 
+                    DataTypeDescriptor.getPasswordDataTypeDescriptor( false )
+                };
+
+            createSystemProcedureOrFunction
+                (
+                 "SYSCS_RESET_PASSWORD",
+                 sysUtilUUID,
+                 arg_names,
+                 arg_types,
+                 0,
+                 0,
+                 RoutineAliasInfo.MODIFIES_SQL_DATA,
+                 false,
+                 (TypeDescriptor) null,
+                 newlyCreatedRoutines,
+                 tc
+                 );
+        }
+        
+        //
+        // SYSCS_MODIFY_PASSWORD( IN PASSWORD VARCHAR(32672) )
+        //
+		
+        {
+            // procedure argument names
+            String[] arg_names = { "password" };
+
+            // procedure argument types
+            TypeDescriptor[] arg_types =
+                {
+                    DataTypeDescriptor.getPasswordDataTypeDescriptor( false )
+                };
+
+            createSystemProcedureOrFunction
+                (
+                 "SYSCS_MODIFY_PASSWORD",
+                 sysUtilUUID,
+                 arg_names,
+                 arg_types,
+                 0,
+                 0,
+                 RoutineAliasInfo.MODIFIES_SQL_DATA,
+                 false,
+                 (TypeDescriptor) null,
+                 newlyCreatedRoutines,
+                 tc
+                 );
+        }
+        
+        //
         // SYSCS_DROP_USER( IN USERNAME  VARCHAR(128) )
         //
 		

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSUSERSRowFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSUSERSRowFactory.java?rev=1221423&r1=1221422&r2=1221423&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSUSERSRowFactory.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSUSERSRowFactory.java
Tue Dec 20 18:44:33 2011
@@ -63,13 +63,10 @@ public class SYSUSERSRowFactory extends 
     private static final int		SYSUSERS_COLUMN_COUNT = 4;
 
 	/* Column #s (1 based) */
-    private static final int		USERNAME_COL_NUM = 1;
-
-    private static final int		HASHINGSCHEME_COL_NUM = 2;
-
+    public static final int		USERNAME_COL_NUM = 1;
+    public static final int		HASHINGSCHEME_COL_NUM = 2;
     public static final int		PASSWORD_COL_NUM = 3;
-
-    private static final int		LASTMODIFIED_COL_NUM = 4;
+    public static final int		LASTMODIFIED_COL_NUM = 4;
 
     static final int		SYSUSERS_INDEX1_ID = 0;
 

Modified: db/derby/code/trunk/java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java?rev=1221423&r1=1221422&r2=1221423&view=diff
==============================================================================
--- db/derby/code/trunk/java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java
(original)
+++ db/derby/code/trunk/java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java
Tue Dec 20 18:44:33 2011
@@ -60,6 +60,7 @@ import org.apache.derby.iapi.sql.diction
 import org.apache.derby.iapi.sql.dictionary.TablePermsDescriptor;
 import org.apache.derby.iapi.sql.dictionary.TriggerDescriptor;
 import org.apache.derby.iapi.sql.dictionary.TupleDescriptor;
+import org.apache.derby.iapi.sql.dictionary.UserDescriptor;
 import org.apache.derby.iapi.sql.dictionary.ViewDescriptor;
 import org.apache.derby.iapi.sql.execute.ExecutionFactory;
 import org.apache.derby.iapi.store.access.TransactionController;
@@ -668,6 +669,12 @@ public class EmptyDictionary implements 
 
 	}
 
+	public void updateUser( UserDescriptor newDescriptor,TransactionController tc )
+		throws StandardException
+	{
+		// TODO Auto-generated method stub
+    }
+
 	public void dropUser( String userName, TransactionController tc )
 			throws StandardException
 	{

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GrantRevokeDDLTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GrantRevokeDDLTest.java?rev=1221423&r1=1221422&r2=1221423&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GrantRevokeDDLTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GrantRevokeDDLTest.java
Tue Dec 20 18:44:33 2011
@@ -7232,6 +7232,7 @@ public final class GrantRevokeDDLTest ex
             {"PUBLIC", "TEST_DBO", "N"},
             {"PUBLIC", "TEST_DBO", "N"},
             {"PUBLIC", "TEST_DBO", "N"},
+            {"PUBLIC", "TEST_DBO", "N"},
             {"PUBLIC", "TEST_DBO", "N"}
         };
         
@@ -7278,6 +7279,7 @@ public final class GrantRevokeDDLTest ex
             {"PUBLIC", "TEST_DBO", "N"},
             {"PUBLIC", "TEST_DBO", "N"},
             {"PUBLIC", "TEST_DBO", "N"},
+            {"PUBLIC", "TEST_DBO", "N"},
             {"USER2", "USER1", "N"}
         };
         

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/NativeAuthProcs.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/NativeAuthProcs.java?rev=1221423&r1=1221422&r2=1221423&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/NativeAuthProcs.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/NativeAuthProcs.java
Tue Dec 20 18:44:33 2011
@@ -25,6 +25,7 @@ import java.io.CharArrayReader;
 import java.sql.CallableStatement;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
+import java.sql.ResultSet;
 import java.util.Arrays;
 import junit.framework.Test;
 import junit.framework.TestSuite;
@@ -178,9 +179,42 @@ public class NativeAuthProcs extends Gen
         Connection  dboConnection = openUserConnection( TEST_DBO );
         Connection  janetConnection = openUserConnection( JANET );
 
+        if ( !dboExists( dboConnection ) )
+        {
+            goodStatement( dboConnection, "call syscs_util.syscs_create_user( 'TEST_DBO',
'test_dbopassword' )" );
+        }
+        goodStatement( dboConnection, "call syscs_util.syscs_create_user( 'JANET', 'janetpassword'
)" );
+
         createUserTests( dboConnection, janetConnection );
+        resetPasswordTests( dboConnection, janetConnection );
+        modifyPasswordTests( dboConnection, janetConnection );
+    }
+    private boolean dboExists( Connection conn )
+        throws Exception
+    {
+        PreparedStatement   ps = conn.prepareStatement( "select username from sys.sysusers"
);
+        ResultSet   rs = ps.executeQuery();
+
+        try {
+            while ( rs.next() )
+            {
+                if ( rs.getString( 1 ).equals( "TEST_DBO" ) ) { return true; }
+            }
+        }
+        finally
+        {
+            rs.close();
+            ps.close();
+        }
+
+        return false;
     }
 
+
+    //
+    // Create/Drop User
+    //
+    
     private void    createUserTests
         ( Connection dboConnection, Connection janetConnection )
         throws Exception
@@ -204,6 +238,8 @@ public class NativeAuthProcs extends Gen
              "select username from sys.sysusers order by  username",
              new String[][]
              {
+                 new String[] { "JANET" },
+                 new String[] { "TEST_DBO" },
                  new String[] { "ruth" },
              },
              true, null
@@ -222,6 +258,8 @@ public class NativeAuthProcs extends Gen
              "select username from sys.sysusers order by  username",
              new String[][]
              {
+                 new String[] { "JANET" },
+                 new String[] { "TEST_DBO" },
                  new String[] { "fred" },
              },
              true, "4251D"
@@ -236,7 +274,11 @@ public class NativeAuthProcs extends Gen
             (
              conn, shouldSucceed,
              "select username from sys.sysusers order by  username",
-             new String[][] {},
+             new String[][]
+             {
+                 new String[] { "JANET" },
+                 new String[] { "TEST_DBO" },
+             },
              true, "4251D"
              );
 
@@ -274,8 +316,109 @@ public class NativeAuthProcs extends Gen
         }
     }
 
-}
+    //
+    // Reset Password
+    //
+    
+    private void    resetPasswordTests
+        ( Connection dboConnection, Connection janetConnection )
+        throws Exception
+    {
+        goodStatement( dboConnection, "call syscs_util.syscs_create_user( 'resetuser', 'resetuserpassword_rev1'
)" );
+
+        long lastModified = getLastModified( dboConnection );
+
+        lastModified = vetResetPassword( dboConnection, dboConnection, lastModified, true
);
+        lastModified = vetResetPassword( dboConnection, janetConnection, lastModified, !authorizationIsOn()
);
+                 
+        // Make sure that we can reset a password in the approved fashion.
+        char[]  password = new char[] { 'r','u','t','h','p','a','s','s','w','o','r','d' };
+        CharArrayReader reader = new CharArrayReader( password );
+
+        CallableStatement cs = dboConnection.prepareCall( "call syscs_util.syscs_reset_password(
'resetuser', ? )" );
+        cs.setCharacterStream( 1, reader, password.length );
+        cs.execute();
+        cs.close();
+        Arrays.fill( password, (char) 0 );
+        
+        long    newLastModified = getLastModified( dboConnection );
+        assertTrue( newLastModified > lastModified );
+
+        goodStatement( dboConnection, "call syscs_util.syscs_drop_user( 'resetuser' )" );
+    }
+    private long    vetResetPassword( Connection dboConnection, Connection conn, long oldLastModified,
boolean shouldSucceed )
+        throws Exception
+    {
+        // pause so that when we check timestamps, we will see a change
+        Thread.sleep( 1L );
+        
+        vetExecution
+            (
+             conn, shouldSucceed,
+             "call syscs_util.syscs_reset_password( 'resetuser', 'resetuserpassword_rev2'
)",
+             NO_EXECUTE_PERMISSION
+             );
+
+        long    newLastModified = getLastModified( dboConnection );
+        if ( shouldSucceed ) { assertTrue( newLastModified > oldLastModified ); }
+        else { assertTrue( newLastModified == oldLastModified ); }
+
+        return newLastModified;
+    }
+    private long    getLastModified( Connection conn )
+        throws Exception
+    {
+        PreparedStatement   ps = conn.prepareStatement( "select max( lastmodified ) from
sys.sysusers" );
+        ResultSet rs = ps.executeQuery();
 
+        rs.next();
 
+        long    result = rs.getTimestamp( 1 ).getTime();
 
+        rs.close();
+        ps.close();
 
+        return result;
+    }
+    
+    //
+    // Modify Password
+    //
+    
+    private void    modifyPasswordTests
+        ( Connection dboConnection, Connection janetConnection )
+        throws Exception
+    {
+        long    lastModified = getLastModified( dboConnection );
+
+        lastModified = vetModifyPassword( dboConnection, dboConnection, lastModified );
+        lastModified = vetModifyPassword( dboConnection, janetConnection, lastModified );
+    }
+    private long    vetModifyPassword( Connection dboConnection, Connection conn, long oldLastModified
)
+        throws Exception
+    {
+        // pause so that when we check timestamps, we will see a change
+        Thread.sleep( 1L );
+        
+        goodStatement( conn, "call syscs_util.syscs_modify_password( 'newpassword' )" );
+                       
+        long    newLastModified = getLastModified( dboConnection );
+        assertTrue( newLastModified > oldLastModified );
+
+        // Make sure that we can modify a password in the approved fashion.
+        char[]  password = new char[] { 'r','u','t','h','p','a','s','s','w','o','r','d' };
+        CharArrayReader reader = new CharArrayReader( password );
+
+        CallableStatement cs = conn.prepareCall( "call syscs_util.syscs_modify_password(
? )" );
+        cs.setCharacterStream( 1, reader, password.length );
+        cs.execute();
+        cs.close();
+        Arrays.fill( password, (char) 0 );
+        
+        long    newerLastModified = getLastModified( dboConnection );
+        assertTrue( newerLastModified > newLastModified );
+
+        return newerLastModified;
+    }
+    
+}

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Changes10_9.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Changes10_9.java?rev=1221423&r1=1221422&r2=1221423&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Changes10_9.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Changes10_9.java
Tue Dec 20 18:44:33 2011
@@ -208,6 +208,12 @@ public class Changes10_9 extends Upgrade
             ResultSet   rs = s.executeQuery( "select username from sys.sysusers order by
username" );
             rs.next();
             assertEquals( "fred", rs.getString( 1 ) );
+
+            // does nothing
+            s.execute( "call syscs_util.syscs_modify_password( 'test_dbo_password_rev0' )"
);
+
+            s.execute( "call syscs_util.syscs_reset_password( 'fred', 'fredpassword_rev2'
)" );
+
             
             s.execute( "call syscs_util.syscs_drop_user( 'fred' )" );
             

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/CleanDatabaseTestSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/CleanDatabaseTestSetup.java?rev=1221423&r1=1221422&r2=1221423&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/CleanDatabaseTestSetup.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/CleanDatabaseTestSetup.java
Tue Dec 20 18:44:33 2011
@@ -279,7 +279,16 @@ public class CleanDatabaseTestSetup exte
         for ( int i = 0; i < users.size(); i++ )
         {
             ps.setString( 1, (String) users.get( i ) );
-            ps.executeUpdate();
+
+            // you can't drop the DBO's credentials. sorry.
+            try {
+                ps.executeUpdate();
+            }
+            catch (SQLException se)
+            {
+                if ( "4251F".equals( se.getSQLState() ) ) { continue; }
+                else { throw se; }
+            }
         }
 
         ps.close();



Mime
View raw message