db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From myrn...@apache.org
Subject svn commit: r1156856 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests: master/ij2.out master/ij2b.out master/j9_foundation/ij2.out tests/tools/ij2.sql tests/tools/ij2Test.java tests/tools/ij2b.sql
Date Thu, 11 Aug 2011 22:58:18 GMT
Author: myrnavl
Date: Thu Aug 11 22:58:18 2011
New Revision: 1156856

URL: http://svn.apache.org/viewvc?rev=1156856&view=rev
Log:
DERBY-5368; Convert tools/ij2.sql to junit
  Splitting off an section of the test which gives a slightly different output
  with JSR169. Also reinstates ij.database property testing in that section
  of the test.

Added:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ij2b.out
  (with props)
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij2b.sql
  (with props)
Removed:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/ij2.out
Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ij2.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij2.sql
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij2Test.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=1156856&r1=1156855&r2=1156856&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
Thu Aug 11 22:58:18 2011
@@ -1,4 +1,4 @@
-ij> --
+ij(CONNECTION1)> --
 --   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.
@@ -19,181 +19,160 @@ ij> --
 
 create table t (i int);
 0 rows inserted/updated/deleted
-ij> insert into t values (3), (4);
+ij(CONNECTION1)> insert into t values (3), (4);
 2 rows inserted/updated/deleted
-ij> prepare s as 'select * from t';
-ij> execute s;
+ij(CONNECTION1)> prepare s as 'select * from t';
+ij(CONNECTION1)> execute s;
 I          
 -----------
 3          
 4          
-ij> remove s;
-ij> -- now it won't find s
+ij(CONNECTION1)> remove s;
+ij(CONNECTION1)> -- now it won't find s
 execute s;
-IJ ERROR: Unable to establish prepared statement S@CONNECTION0
-ij> prepare s as 'select * from t where i=?';
-ij> -- fails, needs parameter
+IJ ERROR: Unable to establish prepared statement S@CONNECTION1
+ij(CONNECTION1)> prepare s as 'select * from t where i=?';
+ij(CONNECTION1)> -- fails, needs parameter
 execute s;
 ERROR 07000: At least one parameter to the current statement is uninitialized.
-ij> -- works, finds value
+ij(CONNECTION1)> -- works, finds value
 execute s using 'values 3';
 IJ WARNING: Autocommit may close using result set
 I          
 -----------
 3          
-ij> prepare t as 'values 3';
-ij> -- same as last execute
+ij(CONNECTION1)> prepare t as 'values 3';
+ij(CONNECTION1)> -- same as last execute
 execute s using t;
 IJ WARNING: Autocommit may close using result set
 I          
 -----------
 3          
-ij> -- same as last execute
+ij(CONNECTION1)> -- same as last execute
 execute 'select * from t where i=?' using 'values 3';
 IJ WARNING: Autocommit may close using result set
 I          
 -----------
 3          
-ij> -- same as last execute
+ij(CONNECTION1)> -- same as last execute
 execute 'select * from t where i=?' using t;
 IJ WARNING: Autocommit may close using result set
 I          
 -----------
 3          
-ij> -- param that is not needed gets out of range message
+ij(CONNECTION1)> -- param that is not needed gets out of range message
 execute 'select * from t where i=?' using 'values (3,4)';
 IJ WARNING: Autocommit may close using result set
 ERROR XCL13: The parameter position '2' is out of range.  The number of parameters for this
prepared  statement is '1'.
-ij> -- ignores rows that are not needed
+ij(CONNECTION1)> -- ignores rows that are not needed
 execute 'select * from t where i=?' using 'values 3,4';
 IJ WARNING: Autocommit may close using result set
 I          
 -----------
 3          
-ij> -- with autocommit off, extra rows are processed and no warning results
+ij(CONNECTION1)> -- with autocommit off, extra rows are processed and no warning results
 autocommit off;
-ij> execute 'select * from t where i=?' using 'values 3,4';
+ij(CONNECTION1)> execute 'select * from t where i=?' using 'values 3,4';
 I          
 -----------
 3          
 I          
 -----------
 4          
-ij> execute 'select * from t where i=?' using 'values 3';
+ij(CONNECTION1)> execute 'select * from t where i=?' using 'values 3';
 I          
 -----------
 3          
-ij> autocommit on;
-ij> -- will say params not set when no rows in using values
+ij(CONNECTION1)> autocommit on;
+ij(CONNECTION1)> -- will say params not set when no rows in using values
 execute 'select * from t where i=?' using 'select * from t where i=9';
 IJ ERROR: Using clause had no results
-ij> -- will say params not set when using values is not a query
+ij(CONNECTION1)> -- will say params not set when using values is not a query
 execute 'select * from t where i=?' using 'create table s (i int)';
 IJ ERROR: Using clause had no results
-ij> -- note that the using part was, however, executed...
+ij(CONNECTION1)> -- note that the using part was, however, executed...
 drop table s;
 0 rows inserted/updated/deleted
-ij> -- DERBY-2558: Verify that we get a reasonable message when the 'dimension'
+ij(CONNECTION1)> -- DERBY-2558: Verify that we get a reasonable message when the 'dimension'
 -- of the 'using-set' does not match the 'dimension' of the prepared statement:
 create table t2558 (i int);
 0 rows inserted/updated/deleted
-ij> insert into t2558 values (3), (4);
+ij(CONNECTION1)> insert into t2558 values (3), (4);
 2 rows inserted/updated/deleted
-ij> -- First two statements below should fail. Third one should work.
+ij(CONNECTION1)> -- First two statements below should fail. Third one should work.
 execute 'select * from t2558 where i = ?' using 'values (3,4)';
 IJ WARNING: Autocommit may close using result set
 ERROR XCL13: The parameter position '2' is out of range.  The number of parameters for this
prepared  statement is '1'.
-ij> execute 'select * from t2558 where i in (?,?,?)' using 'values (3,4)';
+ij(CONNECTION1)> execute 'select * from t2558 where i in (?,?,?)' using 'values (3,4)';
 IJ WARNING: Autocommit may close using result set
 ERROR 07000: At least one parameter to the current statement is uninitialized.
-ij> execute 'select * from t2558 where i = ? or i = ?' using 'values (3,4)';
+ij(CONNECTION1)> execute 'select * from t2558 where i = ? or i = ?' using 'values (3,4)';
 IJ WARNING: Autocommit may close using result set
 I          
 -----------
 3          
 4          
-ij> -- bug 5926 - make sure the using clause result set got closed
+ij(CONNECTION1)> -- bug 5926 - make sure the using clause result set got closed
 drop table t;
 0 rows inserted/updated/deleted
-ij> create table t(c1 int);
+ij(CONNECTION1)> create table t(c1 int);
 0 rows inserted/updated/deleted
-ij> insert into t values(1);
+ij(CONNECTION1)> insert into t values(1);
 1 row inserted/updated/deleted
-ij> execute 'select * from t where c1=?' using 'select * from t where c1=1';
+ij(CONNECTION1)> execute 'select * from t where c1=?' using 'select * from t where c1=1';
 IJ WARNING: Autocommit may close using result set
 C1         
 -----------
 1          
-ij> drop table t;
+ij(CONNECTION1)> drop table t;
 0 rows inserted/updated/deleted
-ij> create table t(c1 int);
+ij(CONNECTION1)> create table t(c1 int);
 0 rows inserted/updated/deleted
-ij> insert into t values(1);
+ij(CONNECTION1)> insert into t values(1);
 1 row inserted/updated/deleted
-ij> insert into t values(2);
+ij(CONNECTION1)> insert into t values(2);
 1 row inserted/updated/deleted
-ij> execute 'select * from t where c1=?' using 'select * from t where c1>=1';
+ij(CONNECTION1)> execute 'select * from t where c1=?' using 'select * from t where c1>=1';
 IJ WARNING: Autocommit may close using result set
 C1         
 -----------
 1          
-ij> drop table t;
+ij(CONNECTION1)> drop table t;
 0 rows inserted/updated/deleted
-ij> -- Bug 4694 Test automatic rollback with close of connection
+ij(CONNECTION1)> -- Bug 4694 Test automatic rollback with close of connection
 -- in ij
 connect 'wombat';
-ij(CONNECTION1)> autocommit off;
-ij(CONNECTION1)> create table a (a int);
+ij(CONNECTION2)> autocommit off;
+ij(CONNECTION2)> create table a (a int);
 0 rows inserted/updated/deleted
-ij(CONNECTION1)> select count(*) from a;
+ij(CONNECTION2)> select count(*) from a;
 1          
 -----------
 0          
-ij(CONNECTION1)> disconnect;
+ij(CONNECTION2)> disconnect;
 ij> set connection connection0;
-ij> select count(*) from a;
+WARNING 01J01: Database 'wombat' not created, connection made to existing database instead.
+ij(CONNECTION0)> select count(*) from a;
 ERROR 42X05: Table/View 'A' does not exist.
-ij> create table t ( c char(50));
+ij(CONNECTION0)> create table t ( c char(50));
 0 rows inserted/updated/deleted
-ij> insert into t values('hello');
+ij(CONNECTION0)> insert into t values('hello');
 1 row inserted/updated/deleted
-ij> select cast(c as varchar(20)) from t;
+ij(CONNECTION0)> select cast(c as varchar(20)) from t;
 1                   
 --------------------
 hello               
-ij> drop table t;
+ij(CONNECTION0)> 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:wombat1
-WOMBAT* - 	jdbc:derby:wombat
-* = current connection
-ij(WOMBAT)> set connection connection0;
-ij(CONNECTION0)> show connections;
-CONNECTION0* - 	jdbc:derby:wombat1
-WOMBAT - 	jdbc:derby:wombat
-* = current connection
-ij(CONNECTION0)> set connection wombat;
-ij(WOMBAT)> disconnect;
-ij> show connections;
-CONNECTION0 - 	jdbc:derby:wombat1
-No current connection
-ij> set connection connection0;
-ij> show connections;
-CONNECTION0* - 	jdbc:derby:wombat1
-* = current connection
-ij> -- DERBY-3408: Unknown command error should suggest referring to server docs:
+ij(CONNECTION0)> -- DERBY-3408: Unknown command error should suggest referring to server
docs:
 show schema;
 ERROR 42X01: Syntax error: Encountered "show" at line 2, column 1.
 Issue the 'help' command for general information on IJ command syntax.
 Any unrecognized commands are treated as potential SQL commands and executed directly.
 Consult your DBMS server reference documentation for details of the SQL syntax supported
by your server.
-ij> xxx;
+ij(CONNECTION0)> xxx;
 ERROR 42X01: Syntax error: Encountered "xxx" at line 1, column 1.
 Issue the 'help' command for general information on IJ command syntax.
 Any unrecognized commands are treated as potential SQL commands and executed directly.
 Consult your DBMS server reference documentation for details of the SQL syntax supported
by your server.
-ij> 
+ij(CONNECTION0)> 
\ No newline at end of file

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ij2b.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ij2b.out?rev=1156856&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ij2b.out
(added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ij2b.out
Thu Aug 11 22:58:18 2011
@@ -0,0 +1,45 @@
+ij(CONNECTION1)> --
+--   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.
+--
+
+-- 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
+CONNECTION1 - 	jdbc:derby:wombat1
+WOMBAT* - 	jdbc:derby:wombat
+* = current connection
+WARNING 01J01: Database 'wombat' not created, connection made to existing database instead.
+ij(WOMBAT)> set connection connection0;
+ij(CONNECTION0)> show connections;
+CONNECTION0* - 	jdbc:derby:wombat
+CONNECTION1 - 	jdbc:derby:wombat1
+WOMBAT - 	jdbc:derby:wombat
+* = current connection
+ij(CONNECTION0)> set connection wombat;
+ij(WOMBAT)> disconnect;
+ij> show connections;
+CONNECTION0 - 	jdbc:derby:wombat
+CONNECTION1 - 	jdbc:derby:wombat1
+No current connection
+ij> set connection connection0;
+ij(CONNECTION0)> show connections;
+CONNECTION0* - 	jdbc:derby:wombat
+CONNECTION1 - 	jdbc:derby:wombat1
+* = current connection
+ij(CONNECTION0)> 
\ No newline at end of file

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ij2b.out
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij2.sql
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij2.sql?rev=1156856&r1=1156855&r2=1156856&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij2.sql
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij2.sql
Thu Aug 11 22:58:18 2011
@@ -105,27 +105,6 @@ insert into t values('hello');
 select cast(c as varchar(20)) from t;
 drop table t;
 
--- show multiconnect ability; db name is wombat, reuse it...
--- assumes ij.protocol is appropriately set...
-
-connect 'wombat' as wombat;
-
-show connections;
-
-set connection connection0;
-
-show connections;
-
-set connection wombat;
-
-disconnect;
-
-show connections;
-
-set connection connection0;
-
-show connections;
-
 -- DERBY-3408: Unknown command error should suggest referring to server docs:
 show schema;
 xxx;

Modified: 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=1156856&r1=1156855&r2=1156856&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij2Test.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij2Test.java
Thu Aug 11 22:58:18 2011
@@ -25,6 +25,7 @@ import java.util.Locale;
 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;
@@ -41,9 +42,6 @@ public class ij2Test extends ScriptTestC
     
     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.
@@ -54,11 +52,28 @@ public class ij2Test extends ScriptTestC
             props.setProperty("ij.dataSource.createDatabase", "create");
         }
 
+        props.setProperty("derby.infolog.append", "true");  
+        props.setProperty("ij.protocol", "jdbc:derby:");
+        props.setProperty("ij.database", "wombat;create=true");
+
         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); 
+
+        TestSuite suite = new TestSuite("ij2Scripts");
+        suite.addTest(test);
+
+        if (JDBC.vmSupportsJDBC3()) {
+            props.setProperty("ij.protocol", "jdbc:derby:");
+            props.setProperty("ij.showNoConnectionsAtStart", "true");
+            
+            Test testb = new SystemPropertyTestSetup(new ij2Test("ij2b"), props);
+            testb = new LocaleTestSetup(testb, Locale.ENGLISH);   
+            testb = TestConfiguration.singleUseDatabaseDecorator(testb, "wombat1");
+            testb = new CleanDatabaseTestSetup(testb);
+            suite.addTest(testb);
+        }
+        return getIJConfig(suite); 
     }   
 }

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij2b.sql
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij2b.sql?rev=1156856&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij2b.sql
(added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ij2b.sql
Thu Aug 11 22:58:18 2011
@@ -0,0 +1,38 @@
+--
+--   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.
+--
+
+-- show multiconnect ability; db name is wombat, reuse it...
+-- assumes ij.protocol is appropriately set...
+
+connect 'wombat' as wombat;
+
+show connections;
+
+set connection connection0;
+
+show connections;
+
+set connection wombat;
+
+disconnect;
+
+show connections;
+
+set connection connection0;
+
+show connections;
+

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



Mime
View raw message