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 my...@apache.org on 2008/02/04 23:32:28 UTC
svn commit: r618472 - in /db/derby/code/trunk:
java/testing/org/apache/derbyTesting/functionTests/master/
java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/
java/testing/org/apache/derbyTesting/functionTests/util/ tools/release/
Author: myrnavl
Date: Mon Feb 4 14:32:28 2008
New Revision: 618472
URL: http://svn.apache.org/viewvc?rev=618472&view=rev
Log:
DERBY-3088 - rewrite NetIjTest.java (which uses canon testclientij.out) to
not use ij.main, but ij.runScript, so it no longer prints the version into
the output.
Remove regex.masters target from tools/release/build.xml
Modified:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/testclientij.out
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NetIjTest.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/IjTestCase.java
db/derby/code/trunk/tools/release/build.xml
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/testclientij.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/testclientij.out?rev=618472&r1=618471&r2=618472&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/testclientij.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/testclientij.out Mon Feb 4 14:32:28 2008
@@ -1,4 +1,3 @@
-ij version 10.4
ij> --
-- Licensed to the Apache Software Foundation (ASF) under one or more
-- contributor license agreements. See the NOTICE file distributed with
@@ -18,21 +17,17 @@
driver 'org.apache.derby.jdbc.ClientDriver';
ij> --Bug 4632 Make the db italian to make sure string selects are working
connect 'jdbc:derby://localhost:1527/testij;create=true;territory=it' USER 'dbadmin' PASSWORD 'dbadmin';
-ij> connect 'jdbc:derby://localhost:1527/testij' USER 'dbadmin' PASSWORD 'dbadbmin';
-ij(CONNECTION1)> -- this is a comment, a comment in front of a select should not cause an error
+ij(CONNECTION1)> connect 'jdbc:derby://localhost:1527/testij' USER 'dbadmin' PASSWORD 'dbadbmin';
+ij(CONNECTION2)> -- this is a comment, a comment in front of a select should not cause an error
select * from sys.systables where 1=0;
TABLEID |TABLENAME |&|SCHEMAID |&
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-
-0 rows selected
-ij(CONNECTION1)> -- this is a comment, a comment in front of a values clauses should not cause an error
+ij(CONNECTION2)> -- this is a comment, a comment in front of a values clauses should not cause an error
values(1);
1
-----------
1
-
-1 row selected
-ij(CONNECTION1)> -- Try some URL attributes
+ij(CONNECTION2)> -- Try some URL attributes
disconnect all;
ij> connect 'jdbc:derby://localhost:1527/testij2;create=true' USER 'dbadmin' PASSWORD 'dbadbmin';
ij> select * from APP.notthere;
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NetIjTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NetIjTest.java?rev=618472&r1=618471&r2=618472&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NetIjTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NetIjTest.java Mon Feb 4 14:32:28 2008
@@ -23,26 +23,84 @@
import junit.framework.Test;
import junit.framework.TestSuite;
-import org.apache.derbyTesting.functionTests.util.IjTestCase;
-import org.apache.derbyTesting.junit.SupportFilesSetup;
+import org.apache.derbyTesting.functionTests.util.ScriptTestCase;
+import org.apache.derbyTesting.junit.CleanDatabaseTestSetup;
import org.apache.derbyTesting.junit.TestConfiguration;
/**
* Network client .sql tests to run via ij.
*/
-public class NetIjTest extends IjTestCase {
-
- private NetIjTest(String name) {
- super(name);
- }
-
- public static Test suite() {
-
- TestSuite suite = new TestSuite("NetIjTests");
- suite.addTest(new SupportFilesSetup(
- TestConfiguration.clientServerDecorator(
- new NetIjTest("testclientij"))));
-
+/**
+ * NetScripts runs ij scripts (.sql files) in the derbynet package
+ * and compares the output to a canon file in the standard master package.
+ * <BR>
+ * Its suite() method returns a set of tests where each test is an instance of
+ * this class for an individual script wrapped in a clean database decorator.
+ * <BR>
+ * It can also be used as a command line program to run one or more
+ * ij scripts as tests.
+ *
+ */
+public final class NetIjTest extends ScriptTestCase {
+
+ /**
+ * scripts (.sql files) - only run in client.
+ */
+ private static final String[] CLIENT_TESTS = {
+ "testclientij",
+ };
+
+ /**
+ * Run a set of scripts (.sql files) passed in on the
+ * command line. Note the .sql suffix must not be provided as
+ * part of the script name.
+ * <code>
+ * example
+ * java org.apache.derbyTesting.functionTests.tests.derbynet.NetIjTest case union
+ * </code>
+ */
+ public static void main(String[] args)
+ {
+ junit.textui.TestRunner.run(getSuite(args));
+ }
+
+ /**
+ * Return the suite that runs all the derbynet scripts.
+ */
+ public static Test suite() {
+
+ TestSuite suite = new TestSuite("NetScripts");
+
+ // Set up the scripts run with the network client
+ TestSuite clientTests = new TestSuite("NetScripts:client");
+ clientTests.addTest(getSuite(CLIENT_TESTS));
+ Test client = TestConfiguration.clientServerDecorator(clientTests);
+
+ // add those client tests into the top-level suite.
+ suite.addTest(client);
+
return suite;
}
-}
+
+ /*
+ * A single JUnit test that runs a single derbynet script.
+ */
+ private NetIjTest(String netTest){
+ super(netTest);
+ }
+
+ /**
+ * Return a suite of derbynet tests from the list of
+ * script names. Each test is surrounded in a decorator
+ * that cleans the database.
+ */
+ private static Test getSuite(String[] list) {
+ TestSuite suite = new TestSuite("Net scripts");
+ for (int i = 0; i < list.length; i++)
+ suite.addTest(
+ new CleanDatabaseTestSetup(
+ new NetIjTest(list[i])));
+
+ return getIJConfig(suite);
+ }
+}
\ No newline at end of file
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/IjTestCase.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/IjTestCase.java?rev=618472&r1=618471&r2=618472&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/IjTestCase.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/IjTestCase.java Mon Feb 4 14:32:28 2008
@@ -70,8 +70,11 @@
/**
* Run a .sql test, calling ij's main method.
- * Then, take the output filre and read it into our OutputStream
+ * Then, take the output file and read it into our OutputStream
* so that it can be compared via compareCanon().
+ * TODO:
+ * Note that the output will include a version number;
+ * this should get filtered/ignored in compareCanon
*/
public void runTest() throws Throwable {
String [] args = { "-fr", scriptName };
Modified: db/derby/code/trunk/tools/release/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/tools/release/build.xml?rev=618472&r1=618471&r2=618472&view=diff
==============================================================================
--- db/derby/code/trunk/tools/release/build.xml (original)
+++ db/derby/code/trunk/tools/release/build.xml Mon Feb 4 14:32:28 2008
@@ -409,20 +409,6 @@
<arg value="${basedir}/tools/ant/properties/release.properties"/>
<arg value="${basedir}/tools/release/maintversion.properties"/>
</java>
- <antcall target="regex.masters"/>
- </target>
-
- <!-- this target contains the list of test masters which contain the version string. -->
- <target name="regex.masters">
- <property file="${basedir}/tools/release/maintversion.properties"/>
- <antcall target="regex.version">
- <param name="regex.file" value="java/testing/org/apache/derbyTesting/functionTests/master/testclientij.out"/>
- </antcall>
- </target>
-
- <target name="regex.version">
- <replaceregexp file="${regex.file}" match="${major}\.${minor}\.\d+\.\d+"
- replace="${major}.${minor}.${interim}.${point}" flags="g"/>
</target>
</project>