db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fuzzylo...@apache.org
Subject svn commit: r156067 [1/2] - in incubator/derby/code/trunk/java/testing: ./ org/apache/derbyTesting/functionTests/harness/ org/apache/derbyTesting/functionTests/master/ org/apache/derbyTesting/functionTests/suites/ org/apache/derbyTesting/functionTests/tests/derbynet/
Date Thu, 03 Mar 2005 19:42:46 GMT
Author: fuzzylogic
Date: Thu Mar  3 11:42:40 2005
New Revision: 156067

URL: http://svn.apache.org/viewcvs?view=rev&rev=156067
Log:
Additional changes to enable encryption and unit tests. Additonal network
server tests. Updated testing README.

Committed for Myrna Van Lunteran <myrna@golux.com>

Added:
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetAutoStart.out
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetNewServer.out
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/encryptionKey.out
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetautostart.properties
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetautostart.runall
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetclientautostart.properties
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DerbyNetAutoStart.java
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DerbyNetNewServer.java
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DerbyNetNewServer_app.properties
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/connect.inc
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/excsat_accsecrd1.inc
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/excsat_accsecrd2.inc
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/excsat_secchk.inc
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/protocol.tests
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testProtocol.java
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testProtocol_app.properties
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/values1.inc
Modified:
    incubator/derby/code/trunk/java/testing/README.htm
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunList.java
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbyall.properties
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetclientmats.properties
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.properties
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/storeall.properties
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/storemats.properties
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/storeunit.properties
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/copyfiles.ant

Modified: incubator/derby/code/trunk/java/testing/README.htm
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/README.htm?view=diff&r1=156066&r2=156067
==============================================================================
--- incubator/derby/code/trunk/java/testing/README.htm (original)
+++ incubator/derby/code/trunk/java/testing/README.htm Thu Mar  3 11:42:40 2005
@@ -281,6 +281,17 @@
     <li>variety of tests, including some from derbylang suite</li>
     <li>tested on a variety of hardware takes from 15 to 30 minutes</li>
   </ul>
+  <li>derbynetautostart</li>
+  <ul>
+    <li>tests networkserver functionality without requiring
+networkserver framework<br>
+    </li>
+  </ul>
+  <li>propertyinfo</li>
+  <ul>
+    <li>runs test to get property information<br>
+    </li>
+  </ul>
   <li>storeall</li>
   <ul>
     <li>tests for storage area</li>
@@ -302,6 +313,18 @@
     <li>tested on a variety of hardware takes from 2 to 4 minutes<br>
     </li>
   </ul>
+  <li>storeunit</li>
+  <ul>
+    <li>tests store-related unit tests. Runs from 8 to 15 minutes<br>
+    </li>
+  </ul>
+  <li>unit <br>
+  </li>
+  <ul>
+    <li>tests 4 general functionality unit tests. runs from 5 to 10
+minutes<br>
+    </li>
+  </ul>
   <li>jdbcapi</li>
   <ul>
     <li>tests implementation of jdbc api such as Connection class
@@ -338,13 +361,54 @@
     <li>takes 5 to 10 minutes<br>
     </li>
   </ul>
-  <li>encryption</li>
+  <li>encryptionAll <br>
+  </li>
   <ul>
-    <li>runs the storemats suite in encryption scheme DESede<br>
-    </li>
-    <li>takes 25 to 40 minutes<br>
+    <li>takes 30 to 55 minutes</li>
+    <li>runs a few encryption tests plus the following encryption tests
+suites<br>
     </li>
   </ul>
+  <ul>
+    <ul>
+      <li>encryption</li>
+    </ul>
+    <ul>
+      <ul>
+        <li>runs the storemats, sysinfo and multi suites in encryption
+scheme DESede<br>
+        </li>
+      </ul>
+      <ul>
+        <li>takes 25 to 40 minutes</li>
+      </ul>
+    </ul>
+    <ul>
+      <li>encryptionAES - tests AES encryption scheme<br>
+      </li>
+    </ul>
+    <ul>
+      <li>encryptionBlowfish - tests Blowfish encryption scheme<br>
+      </li>
+    </ul>
+    <ul>
+      <li>encryptionCFB - tests CFB encryption scheme<br>
+      </li>
+    </ul>
+    <ul>
+      <li>encryptionDES - tests DES encryption scheme<br>
+      </li>
+    </ul>
+    <ul>
+      <li>encryptionECB - tests ECB encryption scheme<br>
+      </li>
+    </ul>
+    <ul>
+      <li>encryptionOFB - tests OFB encryption scheme</li>
+    </ul>
+  </ul>
+  <ul>
+  </ul>
   <li>multi</li>
   <ul>
     <li>runs a simple test case with 10 threads</li>
@@ -364,7 +428,7 @@
     </li>
   </ul>
   <ul>
-    <li>tested on a variety of hardware takes from 2.30 - 5.00 hours </li>
+    <li>tested on a variety of hardware takes from 3.00 - 6.00 hours </li>
   </ul>
   <li><a href="#Note1:"><small>See Note1</small></a><br>
   </li>
@@ -690,13 +754,22 @@
   <li>&nbsp;.java&nbsp;&nbsp;&nbsp; tests that run in a separate jvm.</li>
   <li>&nbsp;.sql &nbsp;&nbsp;&nbsp; tests that run using ij</li>
   <li>&nbsp;.sql2 &nbsp;&nbsp;&nbsp; related to .sql</li>
-  <li>&nbsp;.multi &nbsp;&nbsp;&nbsp; multi threaded tests. There are
-no
-multi threaded tests in the first contribution to apache, and the
-sections pertaining to such tests have been commented out</li>
-  <li>&nbsp;.unit &nbsp;&nbsp;&nbsp; unit tests. Currently there are no
-hooks for unit tests in the harness and no unit tests are contributed
-initially.</li>
+  <li>&nbsp;.multi &nbsp;&nbsp;&nbsp; multi threaded tests. There is
+currently only 1 test being run. The multi test functions a little
+differently from .java and .sql* tests in that RunTest starts a
+separate harness class called MultiTest to control the details of the
+run. Also, the actual test files live under
+org/apache/derbyTesting/functionTests/multiTests, rather than
+org/apache/derbyTesting/functionTests/tests. <br>
+  </li>
+  <li>&nbsp;.unit &nbsp;&nbsp;&nbsp; unit tests. The unit tests
+actually refer to &lt;testname&gt;_derby.properties files under
+org/apache/derbyTesting/functionTests/tests/unit that activate the
+actual unit test harness and tests under
+org/apache/derbyTesting/unitTests. These tests test more underlying
+functionality than the (rest of the) functionTests, which are more
+geared toward how end-users might use functionality.<br>
+  </li>
 </ul>
 <br>
 <h3><a class="mozTocH3" name="mozTocId809770"></a>4.2 <a name="ov2"></a>Supporting

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunList.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunList.java?view=diff&r1=156066&r2=156067
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunList.java (original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunList.java Thu Mar  3 11:42:40 2005
@@ -973,6 +973,7 @@
 	excludedFromJCC = false;
 	needIBMjvm = null;
 
+
 	// Determine if this is jdk12 or higher (with or without extensions)
         if (iminor >= 2) isJdk12 = true;
 	if ( System.getProperty("java.version").startsWith("1.1.8") ) isJdk118 = true;
@@ -1002,10 +1003,6 @@
 	if (runwithjvm != null && runwithjvm.equals("false"))
 	{
 	    return true;
-	}
-	if (runwithj9 != null && runwithj9.equals("false"))
-	{
-	    return false ;
 	}
 
         if ( (framework != null) && (framework.length()>0) )

Added: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetAutoStart.out
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetAutoStart.out?view=auto&rev=156067
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetAutoStart.out (added)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetAutoStart.out Thu Mar  3 11:42:40 2005
@@ -0,0 +1,6 @@
+Starting test case 1.
+Starting test case 2.
+Starting test case 3.
+Starting test case 4.
+Starting test case 5.
+PASSED.

Added: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetNewServer.out
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetNewServer.out?view=auto&rev=156067
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetNewServer.out (added)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetNewServer.out Thu Mar  3 11:42:40 2005
@@ -0,0 +1,3 @@
+Testing non-null PrintWriter
+Testing null PrintWriter
+PASSED.

Added: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/encryptionKey.out
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/encryptionKey.out?view=auto&rev=156067
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/encryptionKey.out (added)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/encryptionKey.out Thu Mar  3 11:42:40 2005
@@ -0,0 +1,116 @@
+ij> ------------------------------------------------------------------------------------
+-- This test file contains test cases for testing encryptionKey  property in the connection
+-- url
+--
+-- Case 1: use external encryption key and create
+--        connect using correct key
+--        connect using wrong key ( different length, different key)
+--        connect again using correct key
+-- Case 2: backup database
+--        connect to original db after backup
+-- Case 3: createFrom backedup database
+--        with wrong key
+--        with right key
+--        with wrong key
+--        with right key
+--        test restoreFrom
+--
+------------------------------------------------------------------------------------
+-- case1:      give external encryptionKey instead of bootpassword
+connect 'jdbc:derby:encdbcbc_key;create=true;dataEncryption=true;encryptionAlgorithm=DES/CBC/NoPadding;encryptionKey=61626364656667686961626364656568';
+ij> create table t1(i1 int);
+0 rows inserted/updated/deleted
+ij> insert into t1 values(1);
+1 row inserted/updated/deleted
+ij> select * from t1;
+I1
+-----------
+1
+ij> commit;
+ij> connect 'jdbc:derby:encdbcbc_key;shutdown=true';
+ERROR 08006: Database 'encdbcbc_key' shutdown.
+ij> -- case 1.1 - right key
+connect 'jdbc:derby:encdbcbc_key;create=true;dataEncryption=true;encryptionAlgorithm=DES/CBC/NoPadding;encryptionKey=61626364656667686961626364656568';
+WARNING 01J01: Database 'encdbcbc_key' not created, connection made to existing database instead.
+ij(CONNECTION1)> select * from t1;
+I1
+-----------
+1
+ij(CONNECTION1)> connect 'jdbc:derby:encdbcbc_key;shutdown=true';
+ERROR 08006: Database 'encdbcbc_key' shutdown.
+ij(CONNECTION1)> -- (-ve case) connect without the encryptionKey
+--  connect with encryptionKey and keylength ( will ignore the keylength value)
+--  wrong length
+connect 'jdbc:derby:encdbcbc_key;create=true;dataEncryption=true;encryptionAlgorithm=DES/CBC/NoPadding;encryptionKey=616364656667686961626364656568';
+ERROR XJ040: Failed to start database 'encdbcbc_key', see the next exception for details.
+ERROR XBCXK: The given encryption key does not match the encryption key used when creating the database. Please ensure that you are using the correct encryption key and re-try.
+ij(CONNECTION1)> -- wrong key
+connect 'jdbc:derby:encdbcbc_key;create=true;dataEncryption=true;encryptionAlgorithm=DES/CBC/NoPadding;encryptionKey=68626364656667686961626364656568';
+ERROR XJ040: Failed to start database 'encdbcbc_key', see the next exception for details.
+ERROR XBCXK: The given encryption key does not match the encryption key used when creating the database. Please ensure that you are using the correct encryption key and re-try.
+ij(CONNECTION1)> select * from t1;
+ERROR 08003: No current connection.
+ij(CONNECTION1)> -- correct key
+connect 'jdbc:derby:encdbcbc_key;create=true;dataEncryption=true;encryptionAlgorithm=DES/CBC/NoPadding;encryptionKey=61626364656667686961626364656568';
+WARNING 01J01: Database 'encdbcbc_key' not created, connection made to existing database instead.
+ij(CONNECTION2)> select * from t1;
+I1
+-----------
+1
+ij(CONNECTION2)> -- case 2 backup
+CALL SYSCS_UTIL.SYSCS_BACKUP_DATABASE('extinout/bkup1');
+0 rows inserted/updated/deleted
+ij(CONNECTION2)> connect 'jdbc:derby:encdbcbc_key;shutdown=true';
+ERROR 08006: Database 'encdbcbc_key' shutdown.
+ij(CONNECTION2)> -- connect to original db after backup
+connect 'jdbc:derby:encdbcbc_key;create=true;dataEncryption=true;encryptionAlgorithm=DES/CBC/NoPadding;encryptionKey=61626364656667686961626364656568';
+WARNING 01J01: Database 'encdbcbc_key' not created, connection made to existing database instead.
+ij(CONNECTION3)> select * from t1;
+I1
+-----------
+1
+ij(CONNECTION3)> -- case 3 :create db from backup using correct key
+connect 'jdbc:derby:encdbcbc_key2;createFrom=extinout/bkup1/encdbcbc_key;dataEncryption=true;encryptionAlgorithm=DES/CBC/NoPadding;encryptionKey=61626364656667686961626364656568';
+ij(CONNECTION4)> select * from t1;
+I1
+-----------
+1
+ij(CONNECTION4)> connect 'jdbc:derby:encdbcbc_key2;shutdown=true';
+ERROR 08006: Database 'encdbcbc_key2' shutdown.
+ij(CONNECTION4)> -- create db from backup using wrong key
+connect 'jdbc:derby:encdbcbc_key3;createFrom=extinout/bkup1/encdbcbc_key;dataEncryption=true;encryptionAlgorithm=DES/CBC/NoPadding;encryptionKey=61226364656667686961626364656568';
+ERROR XJ040: Failed to start database 'encdbcbc_key3', see the next exception for details.
+ERROR XBCXK: The given encryption key does not match the encryption key used when creating the database. Please ensure that you are using the correct encryption key and re-try.
+ij(CONNECTION4)> select * from t1;
+ERROR 08003: No current connection.
+ij(CONNECTION4)> connect 'jdbc:derby:encdbcbc_key3;shutdown=true';
+ERROR XJ004: Database 'encdbcbc_key3' not found.
+ij(CONNECTION4)> -- create db from backup using correct key
+connect 'jdbc:derby:encdbcbc_12;createFrom=extinout/bkup1/encdbcbc_key;dataEncryption=true;encryptionAlgorithm=DES/CBC/NoPadding;encryptionKey=61626364656667686961626364656568';
+ij(CONNECTION5)> select * from t1;
+I1
+-----------
+1
+ij(CONNECTION5)> connect 'jdbc:derby:encdbcbc_key12;shutdown=true';
+ERROR XJ004: Database 'encdbcbc_key12' not found.
+ij(CONNECTION5)> connect 'jdbc:derby:encdb;create=true;dataEncryption=true;encryptionAlgorithm=DES/CBC/NoPadding;encryptionKey=61626364656667686961626364656568';
+ij(CONNECTION6)> create table t1(i1 int ,c2 char(20));
+0 rows inserted/updated/deleted
+ij(CONNECTION6)> insert into t1 values(1,'a');
+1 row inserted/updated/deleted
+ij(CONNECTION6)> select * from t1;
+I1         |C2
+--------------------------------
+1          |a
+ij(CONNECTION6)> call SYSCS_UTIL.SYSCS_BACKUP_DATABASE('extinout/mybackup2');
+0 rows inserted/updated/deleted
+ij(CONNECTION6)> connect 'jdbc:derby:encdb;shutdown=true';
+ERROR 08006: Database 'encdb' shutdown.
+ij(CONNECTION6)> disconnect;
+ij> connect 'jdbc:derby:encdb;restoreFrom=extinout/mybackup2/encdb;dataEncryption=true;encryptionAlgorithm=DES/CBC/NoPadding;encryptionKey=61626364656667686961626364656568';
+ij(CONNECTION6)> select * from t1;
+I1         |C2
+--------------------------------
+1          |a
+ij(CONNECTION6)> disconnect;
+ij>

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbyall.properties
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbyall.properties?view=diff&r1=156066&r2=156067
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbyall.properties (original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbyall.properties Thu Mar  3 11:42:40 2005
@@ -1,3 +1,3 @@
-suites=derbylang derbynetmats storeall xa derbytools jdbc20 jdk14 jdbcapi encryption nist demo multi
+suites=derbylang derbynetmats derbynetautostart storeall xa derbytools jdbc20 jdk14 jdbcapi encryptionAll nist demo multi unit
 derby.debug.true=enableBtreeConsistencyCheck
 derby.stream.error.logSeverityLevel=0

Added: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetautostart.properties
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetautostart.properties?view=auto&rev=156067
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetautostart.properties (added)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetautostart.properties Thu Mar  3 11:42:40 2005
@@ -0,0 +1,6 @@
+framework=DerbyNet
+startServer=false
+suites=derbynetautostart
+jdk12test=true
+runwithj9=false
+timeout=60

Added: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetautostart.runall
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetautostart.runall?view=auto&rev=156067
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetautostart.runall (added)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetautostart.runall Thu Mar  3 11:42:40 2005
@@ -0,0 +1,2 @@
+derbynet/DerbyNetAutoStart.java
+derbynet/DerbyNetNewServer.java

Added: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetclientautostart.properties
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetclientautostart.properties?view=auto&rev=156067
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetclientautostart.properties (added)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetclientautostart.properties Thu Mar  3 11:42:40 2005
@@ -0,0 +1,6 @@
+framework=DerbyNetClient
+startServer=false
+suites=derbynetautostart
+jdk12test=true
+runwithj9=false
+timeout=60

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetclientmats.properties
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetclientmats.properties?view=diff&r1=156066&r2=156067
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetclientmats.properties (original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetclientmats.properties Thu Mar  3 11:42:40 2005
@@ -1,5 +1,5 @@
 framework=DerbyNetClient
-suites=derbynetmats
+suites=derbynetmats derbynetclientautostart multi
 jdk12test=true
 runwithj9=false
 timeout=60

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.properties
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.properties?view=diff&r1=156066&r2=156067
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.properties (original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.properties Thu Mar  3 11:42:40 2005
@@ -1,5 +1,5 @@
 framework=DerbyNet
-suites=derbynetmats jdbcapi jdbc20
+suites=derbynetmats jdbcapi jdbc20 multi
 jdk12test=true
 runwithj9=false
 timeout=60

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall?view=diff&r1=156066&r2=156067
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall (original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall Thu Mar  3 11:42:40 2005
@@ -11,6 +11,7 @@
 derbynet/prepStmt.java
 derbynet/runtimeinfo.java
 derbynet/sysinfo.java
+derbynet/testProtocol.java
 derbynet/testProperties.java
 derbynet/testconnection.java
 derbynet/testij.java

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/storeall.properties
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/storeall.properties?view=diff&r1=156066&r2=156067
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/storeall.properties (original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/storeall.properties Thu Mar  3 11:42:40 2005
@@ -5,14 +5,16 @@
 #        storemats
 #        storemore
 #        storetests
+#        storeunit
 #
 #    Each store test should only appear ONCE in one of the following, this is
 #    so that the nightly run doesn't run tests twice.
 #
 #    store*.runall files:
-#        storemore.runall       - any other store test not to be included in
-#                                 storemats, but to be run nightly.
 #        storemats.runall       - all other store tests to be run in storemats
+#        storemore.runall       - any other store function test not to be included in
+#                                 storemats, but to be run nightly.
 #        storetests.runall      - set of store tests that use one database 
+#        storeunit.runall       - set of store unit tests 
 #        
-suites=storemore storemats storetests
+suites=storemore storemats storetests storeunit

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/storemats.properties
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/storemats.properties?view=diff&r1=156066&r2=156067
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/storemats.properties (original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/storemats.properties Thu Mar  3 11:42:40 2005
@@ -5,15 +5,17 @@
 #        storemats
 #        storemore
 #        storetests
+#        storeunit
 #
 #    Each store test should only appear ONCE in one of the following, this is
 #    so that the nightly run doesn't run tests twice.
 #
 #    store*.runall files:
+#        storemats.runall   - all other store tests to be run in storemats
 #        storemore.runall   - any other store test not to be included in
 #                                 storemats, but to be run nightly.
-#        storemats.runall   - all other store tests to be run in storemats
 #        storetests.runall  - a set of tests that share the same database
+#        storeunit.runall   - a set of store unit tests
 #
 #        
 suites=storemats

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/storeunit.properties
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/storeunit.properties?view=diff&r1=156066&r2=156067
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/storeunit.properties (original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/storeunit.properties Thu Mar  3 11:42:40 2005
@@ -2,12 +2,13 @@
 #
 #    The store suites include each other, and are set up as follows:
 #    storeall
-#        xa
-#        storemats
-#            storeunit
-#        storetests
+#        storemats - basic set
+#        storemore - more tests
+#        storetests- use 1 database
+#        storeunit - unit tests
+#    xa - xa tests (partially store, partially language tests)
 #
-#    Each store test should only appear ONCE in one of the following, this is
-#    so that the nightly run doesn't run tests twice.
+#    Each store test should in principle only appear ONCE , this is
+#    so that the nightly run doesn't unnecessarily run tests twice.
 #        
 usesystem=storeunit

Added: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DerbyNetAutoStart.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DerbyNetAutoStart.java?view=auto&rev=156067
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DerbyNetAutoStart.java (added)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DerbyNetAutoStart.java Thu Mar  3 11:42:40 2005
@@ -0,0 +1,682 @@
+/*
+
+   Derby - Class org.apache.derbyTesting.functionTests.tests.derbynet.DerbyNetAutoStart
+
+   Copyright 2003, 2005 The Apache Software Foundation or its licensors, as applicable.
+
+   Licensed 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.derbynet;
+
+import org.apache.derby.iapi.reference.Property;
+import org.apache.derby.drda.NetworkServerControl;
+
+import org.apache.derbyTesting.functionTests.harness.jvm;
+import org.apache.derby.tools.ij;
+import org.apache.derbyTesting.functionTests.util.TestUtil;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.FileOutputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.io.RandomAccessFile;
+import java.io.FileReader;
+import java.io.FileInputStream;
+
+import java.net.InetAddress;
+
+import java.sql.DriverManager;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import java.util.Enumeration;
+import java.util.Properties;
+import java.util.Vector;
+
+/**
+ * Test the network server derby.drda.startNetworkServer property.
+ *
+ * Test that:
+ *<ul>
+ *<li>The network server is started when the property value is true.
+ *<li>The network server is not started when the property value is false.
+ *<li>The default port number is used when the port property is not specified.
+ *<li>The server uses a non-default port when a port property is set.
+ *<li>A message is printed to derby.log when the server is already started.
+ *</ul>
+ */
+public class DerbyNetAutoStart
+{
+
+    protected static boolean passed = true;
+
+    private static final String JUST_START_SERVER_ARG = "justStartServer=";
+    private static Connection drdaConn;
+    private static Connection embeddedConn;
+    private static int testNumber = 0;
+    private static int portNumber;
+    private static String homeDir;
+    private static String databaseName;
+    private static Properties baseProperties = new Properties();
+    private static StringBuffer basePropertiesSB = new StringBuffer();
+    private static File derbyPropertiesFile;
+    private static final Properties authenticationProperties;
+    static
+    {
+        authenticationProperties = new Properties();
+        authenticationProperties.put ("user", "admin");
+        authenticationProperties.put ("password", "admin");
+    }
+    private static PrintStream realSystemOut;
+    private static ByteArrayOutputStream serverOutputBOS = new ByteArrayOutputStream();
+    private static PrintStream serverOutputOut = new PrintStream( serverOutputBOS);
+    
+    public static void main( String[] args)
+    {
+        setup( args);
+        runAllTests();
+        if( passed)
+        {
+            System.out.println( "PASSED.");
+            System.exit(0);
+        }
+        else
+        {
+            System.out.println( "FAILED.");
+            System.exit(1);
+        }
+    } // end of main
+
+    protected static void setup( String[] args)
+    {
+        realSystemOut = System.out;
+        try
+        {
+			TestUtil.loadDriver();
+
+			ij.getPropertyArg(args);
+            homeDir = System.getProperty( "derby.system.home", ".");
+            
+            for( int i = 0; i < args.length; i++)
+            {
+                if( args[i].startsWith( JUST_START_SERVER_ARG))
+                {
+                    PrintStream out = getPrintStream( homeDir + File.separatorChar + "serverOutput.txt");
+                    System.setOut( out);
+                    System.setErr( out);
+
+                    Class.forName( "org.apache.derby.jdbc.EmbeddedDriver").newInstance();
+                    try
+                    {
+                        portNumber = Integer.parseInt( args[i].substring( JUST_START_SERVER_ARG.length()));
+                    }
+                    catch( Exception e)
+                    {
+                        portNumber = -1; // use the default
+                    }
+                    if( portNumber <= 0)
+                        portNumber = NetworkServerControl.DEFAULT_PORTNUMBER;
+                    
+                    NetworkServerControl server = new NetworkServerControl(InetAddress.getByName("localhost"),portNumber);
+                    server.start(null);
+					// Wait for server to come up 
+					for (int j = 0; j < 60; j++)
+					{
+						Thread.sleep(1000);
+						if (isServerStarted(server))
+							break;
+					}
+					// Block so other process can get connections
+					while (isServerStarted(server))
+						Thread.sleep(500);
+                    System.exit(0);
+                }
+            }
+            
+            derbyPropertiesFile = new File( homeDir + File.separatorChar + "derby.properties");
+
+            try
+            {
+                FileReader propertiesReader = new FileReader( derbyPropertiesFile);
+                for( int c; (c = propertiesReader.read()) != -1;)
+                    basePropertiesSB.append( (char) c);
+                baseProperties.load( new FileInputStream( derbyPropertiesFile));
+            }
+            catch( IOException ioe){}
+        }
+        catch( Exception e)
+        {
+            System.out.println( e.getClass().getName() + " thrown: " + e.getMessage());
+            e.printStackTrace();
+            passed = false;
+        }
+        if( ! passed)
+            System.exit(1);
+    } // end of setup
+
+    protected static void runAllTests()
+    {
+        testNumber = 0;
+        try
+        {
+            portNumber = NetworkServerControl.DEFAULT_PORTNUMBER;
+            if( startTest( new String[] { Property.START_DRDA, "true"}))
+            {
+                endTest(true);
+            }
+
+            portNumber = 31415;
+            if( startTest( new String[] { Property.START_DRDA, "true",
+                                          Property.DRDA_PROP_PORTNUMBER, String.valueOf( portNumber)}))
+            {
+                endTest(true);
+            }
+
+            portNumber = -1;
+            if( startTest( new String[] { Property.START_DRDA, "false"}))
+            {
+                deleteDir( homeDir + File.separatorChar + databaseName);
+
+                try
+                {
+                    drdaConn = DriverManager.getConnection( TestUtil.getJdbcUrlPrefix() + databaseName,
+                                                            authenticationProperties);
+                    passed = false;
+                    System.out.println( "  The network server was started though " + Property.START_DRDA
+                                        + "=false.");
+                }
+                catch( SQLException sqle){}
+                endTest( false);
+            }
+
+            if( startTest( new String[] { }))
+            {
+                try
+                {
+                    drdaConn =
+						DriverManager.getConnection(TestUtil.getJdbcUrlPrefix()+
+													"database" + 
+													testNumber,
+													authenticationProperties);
+                    passed = false;
+                    System.out.println( "  The network server was started though " + Property.START_DRDA
+                                        + " was not set.");
+                }
+                catch( SQLException sqle){}
+                endTest( false);
+            }
+            // Start the network server in a different JVM and check that autostart handles it.
+            testExtantNetServer();
+        }
+        catch( Exception e)
+        {
+            System.out.println( e.getClass().getName() + " thrown: " + e.getMessage());
+            e.printStackTrace();
+            passed = false;
+        }
+    }
+
+    private static PrintStream getPrintStream( String fileName)
+    {
+        try
+        {
+            return new PrintStream( new FileOutputStream( fileName));
+        }
+        catch( Exception e)
+        {
+            System.out.println( "Could not create " + fileName);
+            System.out.println( e.getMessage());
+            System.exit(1);
+            return null;
+        }
+    } // end of getPrintStream
+
+    private static final String logFileProperty = "derby.stream.error.file";
+    
+    private static void testExtantNetServer() throws Exception
+    {
+        RandomAccessFile logFile;
+        String portStr;
+        String logFileName = homeDir + File.separator + "derby.log";
+
+        announceTest();
+
+        long startLogFileLength = getLogFileLength( logFileName);
+        String logAppendProp = System.getProperty( Property.LOG_FILE_APPEND);
+        if( logAppendProp == null)
+            logAppendProp = baseProperties.getProperty( Property.LOG_FILE_APPEND);
+        boolean appendingToLog = ( logAppendProp != null && (new Boolean( logAppendProp).booleanValue()));
+        
+        if( ! writeDerbyProperties( new String[]{}))
+            return;
+        
+        // Start the network server in another process
+        jvm jvm = null;
+        try
+        {
+            jvm = jvm.getCurrentJvm();
+        }
+        catch( Exception e)
+        {
+
+            passed = false;
+            System.out.println( " Could not get the current JVM:");
+            System.out.println( "   " + e.getMessage());
+            return;
+        }
+        portNumber = -1;
+        Vector vCmd = jvm.getCommandLine();
+        Properties systemProperties = System.getProperties();
+        String cmd[] = new String[ vCmd.size() + systemProperties.size() + 3];
+        int i;
+        for( i = 0; i < vCmd.size(); i++)
+            cmd[i] = (String) vCmd.elementAt(i);
+        for( Enumeration enum = systemProperties.keys(); enum.hasMoreElements();)
+        {
+            String propName = (String) enum.nextElement();
+            if( ! propName.equals( logFileProperty))
+                cmd[i++] = "-D" + propName + "=" + (String) systemProperties.get( propName);
+        }
+        cmd[i++] = "-D" + logFileProperty + "=derbynet.log";
+        cmd[i++] = "org.apache.derbyTesting.functionTests.tests.derbynet.DerbyNetAutoStart";
+        if( portNumber > 0)
+        {
+            portStr = String.valueOf( portNumber);
+            cmd[i++] = JUST_START_SERVER_ARG + ((portNumber > 0) ? String.valueOf( portNumber) : "");
+            portStr = ":" + portStr;
+        }
+        else
+        {
+            portStr = "1527";
+            cmd[i++] = JUST_START_SERVER_ARG;
+        }
+		/*
+		System.out.println("Cmd:");
+		for (int c = 0; c < cmd.length;c++)
+			System.out.print(cmd[c] + " ");
+		System.out.println("");
+		*/
+
+        Process serverProcess = Runtime.getRuntime().exec( cmd);
+        // Wait for to start
+        String dbUrl = TestUtil.getJdbcUrlPrefix("localhost",
+												 Integer.parseInt(portStr)) +
+			"database1";
+        Connection drdaConn = null;
+        for( int ntries = 1; ; ntries++)
+        {
+            try
+            {
+                Thread.sleep(500);
+            }
+            catch( InterruptedException ie){};
+
+            try
+            {
+                drdaConn = DriverManager.getConnection( dbUrl, authenticationProperties);
+                break;
+            }
+            catch( SQLException sqle)
+            {
+                if( ntries > 20)
+                {
+                    System.out.println( "Server start failed: " +
+										sqle.getMessage());
+					sqle.printStackTrace();
+                    passed = false;
+                    return;
+                }
+            }
+
+        }
+
+
+        try
+        {
+            String[] properties;
+            if( portNumber <= 0)
+                properties = new String[] {Property.START_DRDA, "true"};
+            else
+                properties = new String[] {Property.START_DRDA, "true",
+                                           Property.DRDA_PROP_PORTNUMBER, 
+										   String.valueOf( portNumber)};
+            portNumber = -1;
+            if( runTest( properties))
+            {
+                checkConn( drdaConn, "network");
+                checkConn( embeddedConn, "embedded");
+                drdaConn.close();
+                    
+                endTest( false);
+
+                // There should be a warning in the derby.log file.
+                try
+                {
+                    // The network server is started in a different thread, so give it a little time
+                    // to write the message
+                    Thread.sleep(1000);
+                    logFile = new RandomAccessFile( logFileName, "r");
+                    if( appendingToLog)
+                        logFile.seek( startLogFileLength);
+                }
+                catch( Exception e)
+                {
+                    System.out.println( "Cannot open derby.log: " + e.getMessage());
+                    passed = false;
+                    drdaConn.close();
+                    stopServer( serverProcess);
+                    return;
+                }
+                if( !checkLog( logFile, new String[] {"An exception was thrown during network server startup"}))
+                {
+                    // Was the network server started? Print out the names of the threads
+                    System.out.println( "Active threads:");
+                    ThreadGroup tg = Thread.currentThread().getThreadGroup();
+                    while( tg.getParent() != null)
+                        tg = tg.getParent();
+                    Thread[] activeThreads = new Thread[ 16*Thread.activeCount()];
+                    int threadCount = tg.enumerate( activeThreads, true);
+                    for( int idx = 0; idx < threadCount; idx++)
+                        System.out.println( "  " + activeThreads[idx].getName());
+                    // Is the server process still running?
+                    try
+                    {
+                        int ev = serverProcess.exitValue();
+                        System.out.println( "The separate server process exited prematurely with code " + ev);
+                    }
+                    catch( IllegalThreadStateException itse)
+                    {
+                        System.out.println( "The server process seems to be running.");
+                    }
+                }
+            }
+        }
+        catch( Exception e)
+        {
+            e.printStackTrace();
+            passed = false;
+        }
+        stopServer( serverProcess);
+    } // end of testExtantNetServer
+
+    private static long getLogFileLength( String logFileName)
+    {
+        try
+        {
+            RandomAccessFile logFile = new RandomAccessFile( logFileName, "r");
+            long length = logFile.length();
+            logFile.close();
+            return length;
+        }
+        catch( Exception e){ return 0;}
+    }
+
+    private static void checkConn( Connection conn, String label)
+    {
+        try
+        {
+            DatabaseMetaData dbmd = conn.getMetaData();
+            ResultSet rs = dbmd.getSchemas();
+            while( rs.next());
+            rs.close();
+        }
+        catch( SQLException sqle)
+        {
+            passed = false;
+            System.out.println( "Could not use the " + label + " connection:");
+            System.out.println( "  " + sqle.getMessage());
+        }
+    } // end of checkConn
+
+    private static void stopServer( Process serverProcess)
+    {
+        try
+        {
+            NetworkServerControl server =
+				new NetworkServerControl(InetAddress.getByName("localhost"),
+									 portNumber);
+			server.shutdown();
+            Thread.sleep(5000);
+        }
+        catch( Exception e)
+        {
+            System.out.println( "  Exception thrown while trying to shutdown the remote server.");
+            System.out.println( "    " + e.getMessage());
+            passed = false;
+        }
+        serverProcess.destroy();
+    } // end of stopServer
+        
+    private static boolean checkLog( RandomAccessFile logFile, String[] expected) throws IOException
+    {
+        boolean allFound = true;
+        boolean[] found = new boolean[ expected.length];
+        while( logFile.getFilePointer() < logFile.length())
+        {
+            String logLine = logFile.readLine();
+            for( int i = 0; i < expected.length; i++)
+            {
+                if( (! found[i]) && logLine.indexOf( expected[i]) >= 0)
+                    found[i] = true;
+            }
+        }
+        for( int i = 0; i < expected.length; i++)
+        {
+            if( ! found[i])
+            {
+                passed = false;
+                System.out.println( "Derby.log does not contain\n  '" + expected[i] + "'.");
+                allFound = false;
+            }
+        }
+        return allFound;
+    } // end of checkLog
+
+    private static boolean startTest( String[] properties)
+    {
+        announceTest();
+        return runTest( properties);
+    }
+
+    private static boolean runTest( String[] properties)
+    {
+        drdaConn = null;
+        embeddedConn = null;
+
+        if( !writeDerbyProperties( properties))
+            return false;
+        
+        deleteDir( homeDir + File.separatorChar + databaseName);
+        try
+        {
+            System.setOut( serverOutputOut);
+            Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
+            embeddedConn = DriverManager.getConnection( "jdbc:derby:" + databaseName + ";create=true");
+            System.setOut( realSystemOut);
+        }
+        catch( SQLException sqle)
+        {
+            System.setOut( realSystemOut);
+            passed = false;
+            System.out.println( "  Could not create an embedded database.");
+            System.out.println( "    " + sqle.getMessage());
+            return false;
+        }
+        catch( Exception e)
+        {
+            System.setOut( realSystemOut);
+            passed = false;
+            System.out.println( "  Could not start the Derby client driver.");
+            System.out.println( "    " + e.getMessage());
+            return false;
+        }
+
+        if( portNumber > 0)
+        {
+            for( int ntries = 1; ; ntries++)
+            {
+                try
+                {
+                    Thread.sleep(1000); // Give the server more time to start
+                }
+                catch( InterruptedException ie) {}
+                try
+                {
+                    drdaConn = DriverManager.getConnection(
+														   TestUtil.getJdbcUrlPrefix("localhost",portNumber) + databaseName,
+														   authenticationProperties);
+                    break;
+                }
+                catch( SQLException sqle)
+                {
+                    if( ntries > 5)
+                    {
+                        passed = false;
+                        System.out.println( "  Could not access database through the network server.");
+                        System.out.println( "    " + sqle.getMessage());
+                        return false;
+                    }
+                }
+            }
+        }
+        return true;
+    } // end of startTest
+
+    private static boolean writeDerbyProperties( String[] properties)
+    {
+        derbyPropertiesFile.delete();
+        try
+        {
+            derbyPropertiesFile.createNewFile();
+            PrintStream propertyWriter = new PrintStream( new FileOutputStream( derbyPropertiesFile));
+            propertyWriter.print( basePropertiesSB.toString());
+            for( int i = 0; i < properties.length - 1; i += 2)
+                propertyWriter.println( properties[i] + "=" + properties[i + 1]);
+
+            propertyWriter.close();
+            return true;
+        }
+        catch( IOException ioe)
+        {
+            passed = false;
+            System.out.println( "  Could not create derby.properties: " + ioe.getMessage());
+            return false;
+        }
+    } // end of writeDerbyProperties
+
+    private static void deleteDir( String dirName)
+    {
+        deleteDir( new File( dirName));
+    }
+
+    private static void deleteDir( File parent)
+    {
+        if( ! parent.exists())
+            return;
+        if( parent.isDirectory())
+        {
+            String[] child = parent.list();
+            for( int i = 0; i < child.length; i++)
+                deleteDir( new File( parent, child[i]));
+        }
+        parent.delete();
+    }
+
+    private static void announceTest()
+    {
+        testNumber++;
+        System.out.println( "Starting test case " + testNumber + ".");
+        databaseName = "database" + testNumber;
+    }
+        
+    private static void endTest( boolean autoStarted)
+    {
+        try
+        {
+            if( drdaConn != null)
+            {
+                drdaConn.close();
+                drdaConn = null;
+            }
+            if( embeddedConn != null)
+            {
+                embeddedConn.close();
+                embeddedConn = null;
+            }
+        }
+        catch( SQLException sqle)
+        {
+            passed = false;
+            System.out.println( "  Connection close failed:");
+            System.out.println( "    " + sqle.getMessage());
+        }
+        try
+        {
+            DriverManager.getConnection( "jdbc:derby:;shutdown=true");
+        }
+        catch( SQLException sqle)
+        {
+            if( ! sqle.getSQLState().equals( "XJ015"))
+            {
+                passed = false;
+                System.out.println( "  System shutdown failed:");
+                System.out.println( "    " + sqle.getMessage());
+            }
+        }
+        serverOutputOut.flush();
+        if( serverOutputBOS.size() > 0)
+        {
+            passed = false;
+            System.out.println( "The auto-started server wrote to System.out.");
+        }
+        serverOutputBOS.reset();
+        if( autoStarted && databaseName != null)
+        {
+            try
+            {
+                // Give the server thread time to shutdown, then check that it has done so.
+                try
+                {
+                    Thread.sleep( 500);
+                }
+                catch( InterruptedException ie){};
+                drdaConn = DriverManager.getConnection(
+													   TestUtil.getJdbcUrlPrefix("localhost", portNumber) +  databaseName,
+                                                        authenticationProperties);
+                passed = false;
+                System.out.println( "Was able to connect to the network server after Derby shut down.");
+                drdaConn.close();
+                drdaConn = null;
+            }
+            catch( SQLException sqle){};
+        }
+    } // end of endTest
+
+	private static boolean isServerStarted(NetworkServerControl server)
+	{
+		try {
+			server.ping();
+		}
+		catch (Exception e) {
+			return false;
+		}
+		return true;
+	}
+}

Added: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DerbyNetNewServer.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DerbyNetNewServer.java?view=auto&rev=156067
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DerbyNetNewServer.java (added)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DerbyNetNewServer.java Thu Mar  3 11:42:40 2005
@@ -0,0 +1,177 @@
+/*
+
+   Derby - Class org.apache.derbyTesting.functionTests.tests.derbynet.DerbyNetNewServer
+
+   Copyright 2003, 2005 The Apache Software Foundation or its licensors, as applicable.
+
+   Licensed 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.derbynet;
+
+import org.apache.derby.drda.NetworkServerControl;
+
+import org.apache.derbyTesting.functionTests.harness.jvm;
+import org.apache.derby.tools.ij;
+
+import java.util.Properties;
+
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+
+import java.sql.DriverManager;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import org.apache.derbyTesting.functionTests.util.TestUtil;
+
+/**
+ * Test NetworkServerControl.start(PrintWriter) writes to the print Writer
+ *
+ * test:
+ *<ul>
+ *<li> start( printWriter)
+ *<li> start( (PrintWriter) null)
+ *</ul>
+ */
+
+public class DerbyNetNewServer extends Thread
+{
+
+    private static final String DATABASE_NAME = "wombat";
+    private static boolean passed = true;
+    private static final Properties authenticationProperties;
+    static
+    {
+        authenticationProperties = new Properties();
+        authenticationProperties.put ("user", "admin");
+        authenticationProperties.put ("password", "admin");
+    }
+
+    private NetworkServerControl server;
+    
+    public static void main( String[] args)
+    {
+        try
+        {
+			TestUtil.loadDriver();
+            Class.forName( "org.apache.derby.jdbc.EmbeddedDriver").newInstance();
+            
+			ij.getPropertyArg(args);
+
+            ByteArrayOutputStream bos = new ByteArrayOutputStream();
+
+            testServer(new NetworkServerControl(), bos, "non-null PrintWriter");
+            testServer(new NetworkServerControl(), null, "null PrintWriter");
+        }
+        catch( Exception e)
+        {
+            e.printStackTrace();
+            passed = false;
+        }
+        if( passed)
+            System.out.println( "PASSED.");
+        else
+            System.out.println( "FAILED.");
+    }
+
+    private static void testServer( NetworkServerControl server, 
+									ByteArrayOutputStream bos, String label)
+		throws Exception
+    {
+		PrintWriter writer = null;
+
+        System.out.println( "Testing " + label);
+        if( bos != null)
+		{
+            bos.reset();
+			writer = new PrintWriter(bos,true);        
+		}
+		server.start(writer);
+        Connection conn = null;
+        
+        // Wait for it to start
+        for( int ntries = 1;; ntries++)
+        {
+            try
+            {
+                Thread.sleep(500);
+            }
+            catch( InterruptedException ie){};
+            
+            try
+            {
+                conn = DriverManager.getConnection(TestUtil.getJdbcUrlPrefix()
+												   + DATABASE_NAME + 
+												   ";create=true",
+                                                    authenticationProperties);
+
+                break;
+            }
+            catch( SQLException sqle)
+            {
+                if( ntries > 10)
+                {
+                    System.out.println( "Server start failed: " + sqle.getMessage());
+                    if( bos != null)
+                    {
+                        System.out.println( "Server log:");
+                        System.out.println( bos.toString());
+                    }
+                    passed = false;
+                    break;
+                }
+            }
+        }
+        if( conn != null)
+        {
+            try
+            {
+                conn.close();
+            }
+            catch( SQLException sqle)
+            {
+                passed = false;
+                System.out.println( "SQLException thrown in close: " + sqle.getMessage());
+            }
+        }
+        try
+        {
+            server.shutdown();
+        }
+        catch( Exception e)
+        {
+            passed = false;
+            System.out.println( "Server shutdown failed: " + e.getMessage());
+        }
+
+        if( bos != null)
+        {
+            if( bos.size() == 0)
+            {
+                passed = false;
+                System.out.println( "Nothing written to the server log.");
+            }
+        }
+    } // end of testServer
+
+    private DerbyNetNewServer( NetworkServerControl server)
+    {
+        this.server = server;
+    }
+
+}

Added: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DerbyNetNewServer_app.properties
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DerbyNetNewServer_app.properties?view=auto&rev=156067
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DerbyNetNewServer_app.properties (added)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DerbyNetNewServer_app.properties Thu Mar  3 11:42:40 2005
@@ -0,0 +1,3 @@
+# the test exercises a known JDK 1.3.1 bug. Fixed with the 1.4 jvms. 
+runwithjdk13=false
+runwithibm13=false

Added: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/connect.inc
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/connect.inc?view=auto&rev=156067
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/connect.inc (added)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/connect.inc Thu Mar  3 11:42:40 2005
@@ -0,0 +1,43 @@
+// this include file has all the protocol needed to make a connection
+// to the wombat database at sqlam 7
+createDssRequest
+startDdm EXCSAT
+writeScalarString EXTNAM "test"
+startDdm MGRLVLLS
+writeCodePoint4Bytes SQLAM 7
+endDdm
+endDdm
+endDss
+flush
+createDssRequest
+startDdm ACCSEC
+writeScalar2Bytes SECMEC 3 //  userid password
+writeScalarString RDBNAM "wombat            " 
+endDdm
+endDss
+flush
+skipDss		// don't care about the EXCSATRM so just skip
+skipDss		// don't care about the ACCSECRD so just skip
+createDssRequest
+startDdm  SECCHK
+writeScalar2Bytes SECMEC 3 // userid password
+writeScalarString RDBNAM "wombat            " 
+writeScalarString USRID test
+writeScalarString PASSWORD test
+endDdm
+endDss
+createDssRequest
+startDdm ACCRDB
+writeScalar2Bytes RDBACCCL SQLAM
+writeScalarBytes CRRTKN "0xd5c6f0f0f0f0f0f14bc7c3c2f600ec774aa60e"
+writeScalarString PRDID "TST01000"
+writeScalarString TYPDEFNAM "QTDSQLASC"
+startDdm TYPDEFOVR
+writeScalar2Bytes CCSIDSBC	1208
+writeScalar2Bytes CCSIDMBC	1208
+endDdm
+endDdm
+endDss
+flush
+skipDss // don't care about SECCHKRM so just skip
+skipDss // don't care about ACCRDBRM so just skip

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/copyfiles.ant
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/copyfiles.ant?view=diff&r1=156066&r2=156067
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/copyfiles.ant (original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/copyfiles.ant Thu Mar  3 11:42:40 2005
@@ -1,3 +1,4 @@
+DerbyNetNewServer_app.properties
 NSinSameJVM_app.properties
 badConnection_sed.properties
 dblook_test_net_app.properties
@@ -14,3 +15,10 @@
 testclientij.sql
 testij_app.properties
 testij_sed.properties
+testProtocol_app.properties
+protocol.tests
+excsat_accsecrd1.inc
+excsat_accsecrd2.inc
+excsat_secchk.inc
+connect.inc
+values1.inc

Added: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/excsat_accsecrd1.inc
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/excsat_accsecrd1.inc?view=auto&rev=156067
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/excsat_accsecrd1.inc (added)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/excsat_accsecrd1.inc Thu Mar  3 11:42:40 2005
@@ -0,0 +1,14 @@
+createDssRequest
+startDdm EXCSAT
+writeScalarString EXTNAM "test"
+endDdm
+endDss
+createDssRequest
+startDdm ACCSEC
+writeScalar2Bytes SECMEC 3 // userid password
+writeScalarPaddedBytes RDBNAM test 18
+endDdm
+endDss
+flush
+skipDss		// don't care about the EXCSATRM so just skip
+skipDss		// don't care about the ACCSECRD so just skip

Added: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/excsat_accsecrd2.inc
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/excsat_accsecrd2.inc?view=auto&rev=156067
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/excsat_accsecrd2.inc (added)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/excsat_accsecrd2.inc Thu Mar  3 11:42:40 2005
@@ -0,0 +1,14 @@
+createDssRequest
+startDdm EXCSAT
+writeScalarString EXTNAM "test"
+endDdm
+endDss
+createDssRequest
+startDdm ACCSEC
+writeScalar2Bytes SECMEC 3 // userid password
+writeScalarPaddedBytes RDBNAM test 18
+endDdm
+endDss
+flush
+skipDss		// don't care about the EXCSATRM so just skip
+skipDss		// don't care about the ACCSECRD so just skip

Added: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/excsat_secchk.inc
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/excsat_secchk.inc?view=auto&rev=156067
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/excsat_secchk.inc (added)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/excsat_secchk.inc Thu Mar  3 11:42:40 2005
@@ -0,0 +1,24 @@
+
+createDssRequest
+startDdm EXCSAT
+writeScalarString EXTNAM "test"
+endDdm
+endDss
+flush
+createDssRequest
+startDdm ACCSEC
+writeScalar2Bytes SECMEC 3 //  userid password
+writeScalarString RDBNAM "wombat;create=true            " 
+endDdm
+endDss
+flush
+skipDss		// don't care about the EXCSATRM so just skip
+skipDss		// don't care about the ACCSECRD so just skip
+createDssRequest
+startDdm  SECCHK
+writeScalar2Bytes SECMEC 3 // userid password
+writeScalarString RDBNAM "wombat;create=true            " 
+writeScalarString USRID test
+writeScalarString PASSWORD test
+endDdm
+endDss



Mime
View raw message