db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bpendle...@apache.org
Subject svn commit: r1143062 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests: master/ij4.out suites/derbytools.runall tests/tools/_Suite.java tests/tools/ij4.sql tests/tools/ij4Test.java tests/tools/ij4_app.properties
Date Tue, 05 Jul 2011 13:53:17 GMT
Author: bpendleton
Date: Tue Jul  5 13:53:16 2011
New Revision: 1143062

URL: http://svn.apache.org/viewvc?rev=1143062&view=rev
Log:
DERBY-5311: Convert tools/ij4.sql to junit

This patch was contributed by Houx Zhang (houxzhang at gmail dot com)

This patch adds a simple JUnit test case which extends ScriptTestCase
and runs ij4.sql. Note that in this situation, we are retaining ij4.sql
and ij4.out, even though we now run them only via JUnit, because we
are testing the behavior of the ij tool itself, and the way it runs
scripts, rather than testing the underlying Derby engine behaviors.


Added:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij4Test.java
  (with props)
Removed:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij4_app.properties
Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ij4.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/_Suite.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij4.sql

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ij4.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ij4.out?rev=1143062&r1=1143061&r2=1143062&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ij4.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ij4.out
Tue Jul  5 13:53:16 2011
@@ -14,8 +14,7 @@ ij> --
 --   See the License for the specific language governing permissions and
 --   limitations under the License.
 --
-connect 'jdbc:derby:wombat;create=true';
-ij> -- test maximum display width
+-- test maximum display width
 values cast('1' as varchar(512));
 1                                                                                       
                                       
 --------------------------------------------------------------------------------------------------------------------------------

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=1143062&r1=1143061&r2=1143062&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
Tue Jul  5 13:53:16 2011
@@ -4,7 +4,6 @@ tools/derbyrunjartest.java
 tools/ij.sql
 tools/ij2.sql
 tools/ij3.sql
-tools/ij4.sql
 tools/ij5.sql
 tools/ij6.sql
 tools/URLCheck.sql

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=1143062&r1=1143061&r2=1143062&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
Tue Jul  5 13:53:16 2011
@@ -58,6 +58,7 @@ public class _Suite extends BaseTestCase
         suite.addTest(IjConnNameTest.suite());
         suite.addTest(RollBackWrappingWhenFailOnImportTest.suite());
         suite.addTest(ConnectWrongSubprotocolTest.suite());
+        suite.addTest(ij4Test.suite());
         
         // SysinfoAPITest currently fails when run against jars, so is
         // disabled. Only the first jar file on the classpath properly

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij4.sql
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij4.sql?rev=1143062&r1=1143061&r2=1143062&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij4.sql
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij4.sql
Tue Jul  5 13:53:16 2011
@@ -14,8 +14,6 @@
 --   See the License for the specific language governing permissions and
 --   limitations under the License.
 --
-connect 'jdbc:derby:wombat;create=true';
-
 -- test maximum display width
 values cast('1' as varchar(512));
 maximumdisplaywidth 40;

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij4Test.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij4Test.java?rev=1143062&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij4Test.java
(added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij4Test.java
Tue Jul  5 13:53:16 2011
@@ -0,0 +1,65 @@
+/*
+
+Derby - Class org.apache.derbyTesting.functionTests.tests.tools.ij4Test
+
+    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.Properties;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.derbyTesting.functionTests.util.ScriptTestCase;
+import org.apache.derbyTesting.junit.CleanDatabaseTestSetup;
+import org.apache.derbyTesting.junit.JDBC;
+import org.apache.derbyTesting.junit.SecurityManagerSetup;
+import org.apache.derbyTesting.junit.SystemPropertyTestSetup;
+
+public class ij4Test extends ScriptTestCase {
+
+    public ij4Test(String script) {
+        super(script, true);
+    }
+
+    public static Test suite() {
+        TestSuite suite = new TestSuite("ij4Test");
+        
+        // Test does not run on J2ME
+        if (JDBC.vmSupportsJSR169())
+            return suite;
+        
+        Properties props = createSystemProperties();       
+        
+        Test test = new SystemPropertyTestSetup(new ij4Test("ij4"), props);
+        test = SecurityManagerSetup.noSecurityManager(test);
+        test = new CleanDatabaseTestSetup(test);   
+        
+        return getIJConfig(test); 
+    }
+
+    private static Properties createSystemProperties() {
+        Properties props = new Properties();
+        
+        props.setProperty("ij.showNoConnectionsAtStart", "true");        
+        props.setProperty("ij.showNoCountForSelect", "true");
+        
+        return props;        
+    }
+}

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij4Test.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message