You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by rh...@apache.org on 2018/03/31 19:54:19 UTC

svn commit: r1828120 - in /db/derby/code/trunk: java/testing/ java/testing/org/apache/derbyTesting/functionTests/tests/lang/ tools/ant/properties/

Author: rhillegas
Date: Sat Mar 31 19:54:19 2018
New Revision: 1828120

URL: http://svn.apache.org/viewvc?rev=1828120&view=rev
Log:
DERBY-6945: Fix NativeAuthenticationServiceTest; commit derby-6945-24-aa-fixNativeAuthenticationServiceTest.diff.

Modified:
    db/derby/code/trunk/java/testing/build.xml
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/NativeAuthenticationServiceTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/nast1.jar
    db/derby/code/trunk/tools/ant/properties/dirs.properties

Modified: db/derby/code/trunk/java/testing/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/build.xml?rev=1828120&r1=1828119&r2=1828120&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/build.xml (original)
+++ db/derby/code/trunk/java/testing/build.xml Sat Mar 31 19:54:19 2018
@@ -268,6 +268,7 @@
       <classpath>
         <pathelement path="${out.tools.dir}"/>
         <pathelement path="${out.shared.dir}"/>
+        <pathelement path="${out.engine.dir}"/>
       </classpath>
       <arg value="${lang-test-dir}/nast_init.sql"/>
     </java>

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/NativeAuthenticationServiceTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/NativeAuthenticationServiceTest.java?rev=1828120&r1=1828119&r2=1828120&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/NativeAuthenticationServiceTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/NativeAuthenticationServiceTest.java Sat Mar 31 19:54:19 2018
@@ -28,6 +28,7 @@ import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.SQLWarning;
+import java.util.ArrayList;
 import java.util.Properties;
 import javax.sql.DataSource;
 import junit.framework.Test;
@@ -1581,14 +1582,20 @@ public class NativeAuthenticationService
                 SQLException se = (SQLException) t;
                 StringBuffer    buffer = new StringBuffer();
 
+                ArrayList<String> actualSQLStates = new ArrayList<String>();
+
                 //  ok if the sqlstate is one of the expected ones
                 for ( int i = 0; i < expectedSQLStates.length; i++ )
                 {
                     String  expected = expectedSQLStates[ i ];
                     buffer.append( " " + expected );
-                    if ( vetSQLState( se, expected ) ) { return null; }
+                    if ( vetSQLState( se, expected, actualSQLStates ) ) { return null; }
                 }
-                fail( tagError( "SQLState not in expected list: " + buffer.toString() ) );
+                fail
+                  (
+                   tagError
+                   ( "SQLState(s) " + actualSQLStates + " not in expected list: " + buffer.toString() )
+                  );
             }
             else
             {
@@ -1600,20 +1607,24 @@ public class NativeAuthenticationService
         return conn;
     }
     // look for a sql state in a SQLException and its chained exceptions. returns true if found
-    private boolean    vetSQLState( SQLException actual, String expectedSQLState )
+    private boolean    vetSQLState
+      ( SQLException actual, String expectedSQLState, ArrayList<String> actualSQLStates )
         throws Exception
     {
         if ( actual == null ) { return false; }
 
-        if ( expectedSQLState.equals( actual.getSQLState() ) ) { return true; }
+        String actualSQLState = actual.getSQLState();
+        actualSQLStates.add(actualSQLState);
+
+        if ( expectedSQLState.equals( actualSQLState ) ) { return true; }
 
         Throwable   t = actual.getCause();
         if ( t instanceof SQLException )
         {
-            if ( vetSQLState( (SQLException) t, expectedSQLState ) ) { return true; }
+            if ( vetSQLState( (SQLException) t, expectedSQLState, actualSQLStates ) ) { return true; }
         }
 
-        return vetSQLState( actual.getNextException(), expectedSQLState );
+        return vetSQLState( actual.getNextException(), expectedSQLState, actualSQLStates );
     }
 
     // connect but expect a warning that the password is about to expire

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/nast1.jar
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/nast1.jar?rev=1828120&r1=1828119&r2=1828120&view=diff
==============================================================================
Binary files - no diff available.

Modified: db/derby/code/trunk/tools/ant/properties/dirs.properties
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/tools/ant/properties/dirs.properties?rev=1828120&r1=1828119&r2=1828120&view=diff
==============================================================================
--- db/derby/code/trunk/tools/ant/properties/dirs.properties (original)
+++ db/derby/code/trunk/tools/ant/properties/dirs.properties Sat Mar 31 19:54:19 2018
@@ -46,7 +46,6 @@ out.javadoc.dir=${out.base}/javadoc
 out.testdir=${out.base}/testout_${jdk}
 drdaloc.dir=${out.drda.dir}/org/apache/derby/loc/drda
 jarsdist.dir=${out.base}/jars
-metadata.out.dir=${out.engine.dir}/org/apache/derby/impl/jdbc
 
 out.build.dir=${out.dir}/build
 out.client.dir=${out.dir}/client
@@ -64,6 +63,8 @@ out.locales.dir=${out.dir}/locales
 
 out.all.dir=${out.build.dir}:${out.client.dir}:${out.demo.dir}:${out.drda.dir}:${out.engine.dir}:${out.optional.dir}:${out.run.dir}:${out.shared.dir}:${out.storeless.dir}:${out.stubs.dir}:${out.testing.dir}:${out.tools.dir}:${out.locales.dir}
 
+metadata.out.dir=${out.engine.dir}/org/apache/derby/impl/jdbc
+
 loc.engine.dir=${out.engine.dir}/org/apache/derby/loc
 loc.client.dir=${out.client.dir}/org/apache/derby/loc
 loc.locales.dir=${out.locales.dir}/org/apache/derby/loc