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 bp...@apache.org on 2011/08/08 05:52:40 UTC
svn commit: r1154813 - in
/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests:
master/ suites/ tests/tools/
Author: bpendleton
Date: Mon Aug 8 03:52:40 2011
New Revision: 1154813
URL: http://svn.apache.org/viewvc?rev=1154813&view=rev
Log:
DERBY-5368: Convert tools/ij2.sql to junit
This patch was contributed by Houx Zhang (houxzhang at gmail dot com)
This patch adds the new ij2Test.java test program to the tools JUnit suite,
and removes the old ij2.sql test program from the derbytools.runall suite.
Added:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij2Test.java (with props)
Removed:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij2_app.properties
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij2_derby.properties
Modified:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ij2.out
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbytools.runall
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportIJTest.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/_Suite.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ij2.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ij2.out?rev=1154813&r1=1154812&r2=1154813&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ij2.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ij2.out Mon Aug 8 03:52:40 2011
@@ -14,7 +14,9 @@ ij> --
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
+
-- this test shows some ij abilities against an active database
+
create table t (i int);
0 rows inserted/updated/deleted
ij> insert into t values (3), (4);
@@ -163,24 +165,25 @@ ij> drop table t;
0 rows inserted/updated/deleted
ij> -- show multiconnect ability; db name is wombat, reuse it...
-- assumes ij.protocol is appropriately set...
+
connect 'wombat' as wombat;
ij(WOMBAT)> show connections;
-CONNECTION0 - jdbc:derby:wombat
+CONNECTION0 - jdbc:derby:wombat1
WOMBAT* - jdbc:derby:wombat
* = current connection
ij(WOMBAT)> set connection connection0;
ij(CONNECTION0)> show connections;
-CONNECTION0* - jdbc:derby:wombat
+CONNECTION0* - jdbc:derby:wombat1
WOMBAT - jdbc:derby:wombat
* = current connection
ij(CONNECTION0)> set connection wombat;
ij(WOMBAT)> disconnect;
ij> show connections;
-CONNECTION0 - jdbc:derby:wombat
+CONNECTION0 - jdbc:derby:wombat1
No current connection
ij> set connection connection0;
ij> show connections;
-CONNECTION0* - jdbc:derby:wombat
+CONNECTION0* - jdbc:derby:wombat1
* = current connection
ij> -- DERBY-3408: Unknown command error should suggest referring to server docs:
show schema;
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbytools.runall
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbytools.runall?rev=1154813&r1=1154812&r2=1154813&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbytools.runall (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbytools.runall Mon Aug 8 03:52:40 2011
@@ -1,5 +1,4 @@
tools/dblook_test.java
tools/dblook_test_territory.java
tools/derbyrunjartest.java
-tools/ij.sql
-tools/ij2.sql
\ No newline at end of file
+tools/ij.sql
\ No newline at end of file
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportIJTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportIJTest.java?rev=1154813&r1=1154812&r2=1154813&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportIJTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportIJTest.java Mon Aug 8 03:52:40 2011
@@ -52,6 +52,7 @@ public final class ImportExportIJTest ex
*/
public static Test suite() {
TestSuite suite = new TestSuite("importExportIJ");
+
// only run with embedded
// network server makes slightly different output
// ('statement executed' instead of '# rows inserted/deteled', etc.)
@@ -60,9 +61,18 @@ public final class ImportExportIJTest ex
// server side, and import would be looking on the client.
// Also, running client & embedded would require some cleanup magic to
// remove the exported files (see e.g. ImportExportTest).
- suite.addTest(new CleanDatabaseTestSetup(
- new ImportExportIJTest("importExportIJ")));
- Test tst = new SupportFilesSetup(suite, new String[] {
+ Test test = new ImportExportIJTest("importExportIJ");
+
+ // This test should run in English locale since it compares error
+ // messages against a canon based on the English message text. Also,
+ // run the test in a fresh database, since the language of the message
+ // text is determined when the database is created.
+ test = new LocaleTestSetup(test, Locale.ENGLISH);
+ test = TestConfiguration.singleUseDatabaseDecorator(test);
+
+ suite.addTest(new CleanDatabaseTestSetup(test));
+
+ return new SupportFilesSetup(suite, new String[] {
"functionTests/testData/ImportExport/TwoLineBadEOF.dat",
"functionTests/testData/ImportExport/NoEOR.dat",
"functionTests/testData/ImportExport/Access1.txt",
@@ -77,12 +87,5 @@ public final class ImportExportIJTest ex
"functionTests/testData/ImportExport/derby-2193-linenumber.txt"
}
);
-
- // This test should run in English locale since it compares error
- // messages against a canon based on the English message text. Also,
- // run the test in a fresh database, since the language of the message
- // text is determined when the database is created.
- tst = TestConfiguration.singleUseDatabaseDecorator(tst);
- return new LocaleTestSetup(tst, Locale.ENGLISH);
}
}
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/_Suite.java?rev=1154813&r1=1154812&r2=1154813&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/_Suite.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/_Suite.java Mon Aug 8 03:52:40 2011
@@ -51,6 +51,7 @@ public class _Suite extends BaseTestCase
suite.addTest(ImportExportLobTest.suite());
suite.addTest(ImportExportProcedureTest.suite());
suite.addTest(ImportExportIJTest.suite());
+ suite.addTest(ij2Test.suite());
suite.addTest(ToolScripts.suite());
suite.addTest(SysinfoCPCheckTest.suite());
suite.addTest(SysinfoLocaleTest.suite());
@@ -58,6 +59,7 @@ public class _Suite extends BaseTestCase
suite.addTest(IjConnNameTest.suite());
suite.addTest(RollBackWrappingWhenFailOnImportTest.suite());
suite.addTest(ConnectWrongSubprotocolTest.suite());
+
suite.addTest(ij3Test.suite());
suite.addTest(ij5Test.suite());
Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij2Test.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij2Test.java?rev=1154813&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij2Test.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij2Test.java Mon Aug 8 03:52:40 2011
@@ -0,0 +1,64 @@
+/*
+
+ Derby - Class org.apache.derbyTesting.functionTests.tests.tools.ij2Test
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ */
+
+package org.apache.derbyTesting.functionTests.tests.tools;
+
+import java.util.Locale;
+import java.util.Properties;
+
+import junit.framework.Test;
+
+import org.apache.derbyTesting.functionTests.util.ScriptTestCase;
+import org.apache.derbyTesting.junit.CleanDatabaseTestSetup;
+import org.apache.derbyTesting.junit.JDBC;
+import org.apache.derbyTesting.junit.LocaleTestSetup;
+import org.apache.derbyTesting.junit.SystemPropertyTestSetup;
+import org.apache.derbyTesting.junit.TestConfiguration;
+
+public class ij2Test extends ScriptTestCase {
+
+ public ij2Test(String script) {
+ super(script, true);
+ }
+
+ public static Test suite() {
+ Properties props = new Properties();
+
+ props.setProperty("derby.infolog.append", "true");
+ props.setProperty("ij.protocol", "jdbc:derby:");
+
+ // When running on JSR-169 platforms, we need to use a data source
+ // instead of a JDBC URL since DriverManager isn't available.
+ if (JDBC.vmSupportsJSR169()) {
+ props.setProperty("ij.dataSource",
+ "org.apache.derby.jdbc.EmbeddedSimpleDataSource");
+ props.setProperty("ij.dataSource.databaseName", "wombat");
+ props.setProperty("ij.dataSource.createDatabase", "create");
+ }
+
+ Test test = new SystemPropertyTestSetup(new ij2Test("ij2"), props);
+ test = new LocaleTestSetup(test, Locale.ENGLISH);
+ test = TestConfiguration.singleUseDatabaseDecorator(test, "wombat1");
+ test = new CleanDatabaseTestSetup(test);
+
+ return getIJConfig(test);
+ }
+}
Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij2Test.java
------------------------------------------------------------------------------
svn:eol-style = native