Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 96150 invoked from network); 11 Aug 2006 20:57:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 11 Aug 2006 20:57:41 -0000 Received: (qmail 41824 invoked by uid 500); 11 Aug 2006 20:57:40 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 41801 invoked by uid 500); 11 Aug 2006 20:57:40 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 41790 invoked by uid 99); 11 Aug 2006 20:57:40 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Aug 2006 13:57:40 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Aug 2006 13:57:40 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 027281A981D; Fri, 11 Aug 2006 13:57:20 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r430894 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests: tests/lang/LangScripts.java util/ScriptTestCase.java Date: Fri, 11 Aug 2006 20:57:19 -0000 To: derby-commits@db.apache.org From: djd@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060811205720.027281A981D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: djd Date: Fri Aug 11 13:57:18 2006 New Revision: 430894 URL: http://svn.apache.org/viewvc?rev=430894&view=rev Log: Junit improvements, have the ScriptTestCase use the openTestResource method in BaseTestCase to get the script file to avoid exceptions with a security manager. Added a couple more tests to the language scripts and added the clean database decorator to each test run. Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LangScripts.java db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/ScriptTestCase.java Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LangScripts.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LangScripts.java?rev=430894&r1=430893&r2=430894&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LangScripts.java (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LangScripts.java Fri Aug 11 13:57:18 2006 @@ -22,6 +22,7 @@ import junit.framework.Test; import junit.framework.TestSuite; +import org.apache.derbyTesting.functionTests.util.CleanDatabaseTestSetup; import org.apache.derbyTesting.functionTests.util.ScriptTestCase; public final class LangScripts extends ScriptTestCase { @@ -33,6 +34,9 @@ "arithmetic", "bit2", "case", + "constantExpression", + "depend", + "derived", "union", }; @@ -65,13 +69,16 @@ /** * Return a suite of language SQL tests from the list of - * script names. + * script names. Each test is surrounded in a decorator + * that cleans the database. */ private static Test getSuite(String[] list) { TestSuite suite = new TestSuite(); for (int i = 0; i < list.length; i++) - suite.addTest(new LangScripts(list[i])); + suite.addTest( + new CleanDatabaseTestSetup( + new LangScripts(list[i]))); return getIJConfig(suite); } Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/ScriptTestCase.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/ScriptTestCase.java?rev=430894&r1=430893&r2=430894&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/ScriptTestCase.java (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/ScriptTestCase.java Fri Aug 11 13:57:18 2006 @@ -40,9 +40,15 @@ private final String inputEncoding; private final String outputEncoding = "US-ASCII"; + + /** + * Default connection. + */ + private Connection conn; /** - * Create a ScriptTestCase to run a single test. + * Create a ScriptTestCase to run a single test + * using a connection obtained from getConnection() * @param script Base name of the .sql script * excluding the .sql suffix. */ @@ -105,14 +111,14 @@ URL sql = getTestResource(resource); assertNotNull("SQL script missing: " + resource, sql); - InputStream sqlIn = sql.openStream(); + InputStream sqlIn = openTestResource(sql); ByteArrayOutputStream rawBytes = new ByteArrayOutputStream(20 * 1024); PrintStream printOut = new PrintStream(rawBytes); - Connection conn = getConnection(); + conn = getConnection(); org.apache.derby.tools.ij.runScript( conn, sqlIn, @@ -120,7 +126,8 @@ printOut, outputEncoding); - conn.close(); + if (!conn.isClosed() && !conn.getAutoCommit()) + conn.commit(); printOut.flush(); printOut.close(); @@ -176,5 +183,14 @@ outFile.close(); throw t; } + } + + /** + * Clean up the connection on teardown. + */ + protected void tearDown() throws Exception + { + JDBC.cleanup(conn); + super.tearDown(); } }