db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mi...@apache.org
Subject svn commit: r1469000 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java
Date Wed, 17 Apr 2013 17:06:19 GMT
Author: mikem
Date: Wed Apr 17 17:06:19 2013
New Revision: 1469000

URL: http://svn.apache.org/r1469000
Log:
DERBY-6154 add non-order by cases to the BlobClob4BlobTest

While debugging DERBY-6092 it was noted that some other code
paths could be exercised by adding non order by queries to
one of the test cases. This change just reruns one of the
test cases with order by queries and then again with non-order by
queries.

This change adds non-order by test runs based on the
testPositionAgressive() test case.


Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java?rev=1469000&r1=1468999&r2=1469000&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java
Wed Apr 17 17:06:19 2013
@@ -992,7 +992,17 @@ public class BlobClob4BlobTest extends B
     /**
      * Test Clob.position()
      */
-    public void testPositionAgressive() throws Exception {
+    public void testPositionAgressiveUseOrderBy() 
+        throws Exception {
+            baseTestPositionAgressive(true);
+    }
+    public void testPositionAgressiveDoNotUseOrderBy() 
+        throws Exception {
+            baseTestPositionAgressive(false);
+    }
+
+    public void baseTestPositionAgressive(boolean useOrderBy) 
+        throws Exception {
         Statement s = createStatement();
 
         s.execute("CREATE TABLE C8.T8POS" +
@@ -1053,12 +1063,12 @@ public class BlobClob4BlobTest extends B
         psp.setString(1, pstr);
         psp.executeUpdate();
 
-        checkClob8(s, pstr);
+        checkClob8(s, pstr, useOrderBy);
         commit();
 
         ResultSet rsc = s.executeQuery("SELECT PATT FROM C8.T8PATT");
         rsc.next();
-        checkClob8(s, rsc.getClob(1));
+        checkClob8(s, rsc.getClob(1), useOrderBy);
 
         rsc.close();
 
@@ -1086,12 +1096,12 @@ public class BlobClob4BlobTest extends B
         commit();
 
 
-        checkClob8(s, pstr);
+        checkClob8(s, pstr, useOrderBy);
         commit();
 
         rsc = s.executeQuery("SELECT PATT FROM C8.T8PATT");
         rsc.next();
-        checkClob8(s, rsc.getClob(1));
+        checkClob8(s, rsc.getClob(1), useOrderBy);
 
         s.execute("DELETE FROM C8.T8POS");
         s.execute("DELETE FROM C8.T8PATT");
@@ -1113,12 +1123,12 @@ public class BlobClob4BlobTest extends B
         commit();
 
 
-        checkClob8(s, pstr);
+        checkClob8(s, pstr, useOrderBy);
         commit();
 
         rsc = s.executeQuery("SELECT PATT FROM C8.T8PATT");
         rsc.next();
-        checkClob8(s, rsc.getClob(1));
+        checkClob8(s, rsc.getClob(1), useOrderBy);
 
         s.execute("DELETE FROM C8.T8POS");
         s.execute("DELETE FROM C8.T8PATT");
@@ -1199,11 +1209,24 @@ public class BlobClob4BlobTest extends B
         return pos;
     }
 
-    private static void checkClob8(Statement s, String pstr) throws SQLException
+    private static void checkClob8(
+    Statement   s, 
+    String      pstr,
+    boolean     useOrderBy) 
+        throws SQLException
     {
+        ResultSet rs = null;
 
-        ResultSet rs = s.executeQuery(
-                "SELECT ID, DD, POS, L FROM C8.T8POS ORDER BY 1");
+        if (useOrderBy)
+        {
+            rs = s.executeQuery(
+                    "SELECT ID, DD, POS, L FROM C8.T8POS ORDER BY 1");
+        }
+        else
+        {
+            rs = s.executeQuery(
+                    "SELECT ID, DD, POS, L FROM C8.T8POS");
+        }
 
         while (rs.next()) {
 
@@ -1221,9 +1244,25 @@ public class BlobClob4BlobTest extends B
         rs.close();
     }
 
-    private static void checkClob8(Statement s, Clob pstr) throws SQLException {
-        ResultSet rs = s.executeQuery(
+    private static void checkClob8(
+    Statement   s, 
+    Clob        pstr,
+    boolean     useOrderBy) 
+        throws SQLException {
+
+
+        ResultSet rs = null;
+
+        if (useOrderBy)
+        {
+            rs = s.executeQuery(
                 "SELECT ID, DD, POS, L FROM C8.T8POS ORDER BY 1");
+        }
+        else
+        {
+            rs = s.executeQuery(
+                "SELECT ID, DD, POS, L FROM C8.T8POS");
+        }
 
         while (rs.next()) {
 



Mime
View raw message