db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1149054 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/largedata: LobLimitsLiteTest.java LobLimitsTest.java
Date Thu, 21 Jul 2011 07:34:15 GMT
Author: kahatlen
Date: Thu Jul 21 07:34:13 2011
New Revision: 1149054

URL: http://svn.apache.org/viewvc?rev=1149054&view=rev
Log:
DERBY-1903: Convert largedata/LobLimits.java to junit

Force a particular ordering of the test cases since they are not
independent of each other.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/largedata/LobLimitsLiteTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/largedata/LobLimitsTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/largedata/LobLimitsLiteTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/largedata/LobLimitsLiteTest.java?rev=1149054&r1=1149053&r2=1149054&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/largedata/LobLimitsLiteTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/largedata/LobLimitsLiteTest.java
Thu Jul 21 07:34:13 2011
@@ -21,14 +21,9 @@ limitations under the License.
 
 package org.apache.derbyTesting.functionTests.tests.largedata;
 
-import java.sql.SQLException;
-import java.sql.Statement;
-
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
-import org.apache.derbyTesting.junit.CleanDatabaseTestSetup;
-import org.apache.derbyTesting.junit.SupportFilesSetup;
 import org.apache.derbyTesting.junit.TestConfiguration;
 
 
@@ -52,16 +47,7 @@ public class LobLimitsLiteTest extends L
     static final int _100K = 1024 *100;
     
     public static Test suite() {
-        // Right now run just with embeddded.
-        Test test = new CleanDatabaseTestSetup(
-                new TestSuite(LobLimitsTest.class)) {
-                    protected void decorateSQL(Statement s)
-                            throws SQLException {
-                        setupTables(s,_1MB, _100K);
-                    }
-                };
-                
-        test = new SupportFilesSetup(test);
+        Test test = LobLimitsTest.baseSuite(_1MB, _100K);
         TestSuite suite = new TestSuite("LobLimitsLiteTest");
         suite.addTest(test);
         suite.addTest(TestConfiguration.clientServerDecorator(test));

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/largedata/LobLimitsTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/largedata/LobLimitsTest.java?rev=1149054&r1=1149053&r2=1149054&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/largedata/LobLimitsTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/largedata/LobLimitsTest.java
Thu Jul 21 07:34:13 2011
@@ -39,7 +39,6 @@ import java.sql.SQLException;
 import java.sql.Statement;
 
 import junit.framework.Test;
-import junit.framework.TestSuite;
 
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
 import org.apache.derbyTesting.junit.CleanDatabaseTestSetup;
@@ -124,11 +123,24 @@ public class LobLimitsTest extends BaseJ
 
     public static Test suite() {
         // Right now run just with embeddded.
+        return baseSuite(_2GB, _100MB);
+    }
+
+    /**
+     * Create an instance of the {@code LobLimitsTest} suite.
+     *
+     * @param biggestSize the size of the biggest LOB to test
+     * @param bigSize the size of a typical big LOB to test
+     * @return a test suite
+     */
+    static Test baseSuite(final int biggestSize, final int bigSize) {
+        // Some of the test cases depend on certain other test cases to run
+        // first, so force the test cases to run in lexicographical order.
         Test suite = new CleanDatabaseTestSetup(
-                new TestSuite(LobLimitsTest.class)) {
+                TestConfiguration.orderedSuite(LobLimitsTest.class)) {
             protected void decorateSQL(Statement s)
                            throws SQLException {
-                setupTables(s, _2GB, _100MB);
+                setupTables(s, biggestSize, bigSize);
             }
         };
 
@@ -139,7 +151,7 @@ public class LobLimitsTest extends BaseJ
      * tests specific for blobs
      * @throws Exception
      */
-    public void testBlob() throws Exception {
+    public void test_01_Blob() throws Exception {
         Connection conn = getConnection();
         conn.setAutoCommit(false);
         PreparedStatement insertBlob =
@@ -216,7 +228,7 @@ public class LobLimitsTest extends BaseJ
         deleteTable(conn, deleteBlob, 3);
     }
 
-    public void testBlobNegative() throws SQLException {
+    public void test_02_BlobNegative() throws SQLException {
         // Negative Test, use setBlob api to insert a 4GB blob.
         Connection conn = getConnection();
         conn.setAutoCommit(false);
@@ -251,7 +263,7 @@ public class LobLimitsTest extends BaseJ
      * 
      * @throws Exception
      */
-    public void testClob1() throws Exception {
+    public void test_03_Clob1() throws Exception {
         Connection conn = getConnection();
         setAutoCommit(false);
         PreparedStatement insertClob =
@@ -277,7 +289,7 @@ public class LobLimitsTest extends BaseJ
     /**
      * @throws Exception
      */
-    public void testClob2() throws Exception {
+    public void test_04_Clob2() throws Exception {
         Connection conn = getConnection();
         conn.setAutoCommit(false);
         PreparedStatement selectClob =
@@ -326,7 +338,7 @@ public class LobLimitsTest extends BaseJ
 
     }
 
-    public void testClobNegative() throws Exception {
+    public void test_05_ClobNegative() throws Exception {
         Connection conn = getConnection();
         conn.setAutoCommit(false);
         PreparedStatement insertClob =



Mime
View raw message