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 ka...@apache.org on 2014/03/06 17:23:29 UTC

svn commit: r1574946 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/Test_6496.java

Author: kahatlen
Date: Thu Mar  6 16:23:29 2014
New Revision: 1574946

URL: http://svn.apache.org/r1574946
Log:
DERBY-6496: Simplify the test case

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

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/Test_6496.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/Test_6496.java?rev=1574946&r1=1574945&r2=1574946&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/Test_6496.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/Test_6496.java Thu Mar  6 16:23:29 2014
@@ -40,8 +40,6 @@ public class Test_6496 extends Generated
     //
     ///////////////////////////////////////////////////////////////////////////////////
 
-    private static  final   String      TEST_DBO = "TEST_DBO";
-
     private static  final   String      LOAD_METADATA_TOOL = "call syscs_util.syscs_register_tool( 'databaseMetaData', true )";
     private static  final   String      UNLOAD_METADATA_TOOL = "call syscs_util.syscs_register_tool( 'databaseMetaData', false )";
 
@@ -100,21 +98,6 @@ public class Test_6496 extends Generated
     public  void    test_001_metadata()
         throws Exception
     {
-        metadataTester();
-    }
-
-    /**
-     * <p>
-     * Test that we can load the metadata tool twice without popping an NPE.
-     * </p>
-     */
-    public  void    test_002_metadata()
-        throws Exception
-    {
-        metadataTester();
-    }
-    private void    metadataTester() throws Exception
-    {
         toolTester( LOAD_METADATA_TOOL, UNLOAD_METADATA_TOOL );
     }
 
@@ -123,24 +106,9 @@ public class Test_6496 extends Generated
      * Test that we can load the optimizer tool twice without popping an NPE.
      * </p>
      */
-    public  void    test_003_optimizer()
+    public  void    test_002_optimizer()
         throws Exception
     {
-        optimizerTester();
-    }
-
-    /**
-     * <p>
-     * Test that we can load the optimizer tool twice without popping an NPE.
-     * </p>
-     */
-    public  void    test_004_optimizer()
-        throws Exception
-    {
-        optimizerTester();
-    }
-    private void    optimizerTester() throws Exception
-    {
         toolTester( LOAD_OPTIMIZER_TOOL, UNLOAD_OPTIMIZER_TOOL );
     }
 
@@ -152,9 +120,16 @@ public class Test_6496 extends Generated
 
     private void    toolTester( String loadTool, String unloadTool ) throws Exception
     {
-        Connection  dboConnection = openUserConnection( TEST_DBO );
-
-        goodStatement( dboConnection, loadTool );
-        goodStatement( dboConnection, unloadTool );
+        Connection c1 = openDefaultConnection();
+        goodStatement( c1, loadTool );
+        goodStatement( c1, unloadTool );
+
+        // Loading the tool a second time in a fresh connection, with the
+        // exact same statement text so that the compiled statement is found
+        // in the statement cache, used to result in a NullPointerException
+        // because there was no CompilerContext on the stack.
+        Connection c2 = openDefaultConnection();
+        goodStatement( c2, loadTool );
+        goodStatement( c2, unloadTool );
     }
 }