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 km...@apache.org on 2008/07/10 23:47:10 UTC
svn commit: r675775 - in
/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests:
master/testclientij.out tests/derbynet/NetIjTest.java util/IjTestCase.java
Author: kmarsden
Date: Thu Jul 10 14:47:10 2008
New Revision: 675775
URL: http://svn.apache.org/viewvc?rev=675775&view=rev
Log:
DERBY-3772 testclientij (NetIjTest) failed on Zos with derby10.3
port rewrite of NetIjTest (revision 618472) from trunk.
Contributed by Myrna Van Lunteren.
Modified:
db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/master/testclientij.out
db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NetIjTest.java
db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/util/IjTestCase.java
Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/master/testclientij.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/master/testclientij.out?rev=675775&r1=675774&r2=675775&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/master/testclientij.out (original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/master/testclientij.out Thu Jul 10 14:47:10 2008
@@ -1,4 +1,3 @@
-ij version 10.3
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/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NetIjTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NetIjTest.java?rev=675775&r1=675774&r2=675775&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NetIjTest.java (original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NetIjTest.java Thu Jul 10 14:47:10 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/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/util/IjTestCase.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/util/IjTestCase.java?rev=675775&r1=675774&r2=675775&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/util/IjTestCase.java (original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/util/IjTestCase.java Thu Jul 10 14:47:10 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 };