db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oyste...@apache.org
Subject svn commit: r633466 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/
Date Tue, 04 Mar 2008 13:07:22 GMT
Author: oysteing
Date: Tue Mar  4 05:07:21 2008
New Revision: 633466

URL: http://svn.apache.org/viewvc?rev=633466&view=rev
Log:
DERBY-3126
1. Handle that startMaster now correctly gets "XRE04" while slave is not yet ready after startSlave.
2. Create {user.dir}/[db_master|db_slave] if not existing.
3. Start servers via rt.exec().
4. New ReplicationRun_Full which handles the distributed case with replication state tests
    and optional load on servers. 
Contributed by Ole Solberg

Added:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Full.java   (with props)
Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Distributed.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationTestRun.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/StandardTests.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/Utils.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun.java?rev=633466&r1=633465&r2=633466&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun.java Tue Mar  4 05:07:21 2008
@@ -20,20 +20,17 @@
  */
 package org.apache.derbyTesting.functionTests.tests.replicationTests;
 
-import java.nio.channels.FileChannel;
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
 import org.apache.derby.drda.NetworkServerControl;
 import java.net.InetAddress;
-import java.net.Inet6Address;
+import java.util.Properties;
 
 import java.sql.*;
 import java.io.*;
-import java.util.*;
 
 import org.apache.derbyTesting.junit.BaseTestCase;
-import org.apache.derbyTesting.junit.JDBC;
 
 /**
  * Framework to run replication tests.
@@ -166,7 +163,7 @@
         
         TestSuite suite = new TestSuite("Replication Suite");
         
-        suite.addTestSuite( ReplicationRun.class );
+        suite.addTestSuite( ReplicationRun.class ); // Make sure to rename in subclasses!
         
         return suite;
     }
@@ -190,296 +187,8 @@
     public void testReplication()
     throws Exception
     {
-        cleanAllTestHosts();
-        
-        initEnvironment();
-        
-        /* 'testReplication' steps through all states of the
-         * replication process.
-         * Tests required to be run in these states
-         * should be specified in the replicationtest.properties file.
-         */
-        if ( runUnReplicated )  // test.runUnReplicated
-        {
-            util.DEBUG("**** BEGIN Running test without replication.");
-            initMaster(masterServerHost,
-                    replicatedDb);
-            startServer(masterJvmVersion, derbyVersion, // No replication
-                    masterServerHost,
-                    ALL_INTERFACES, // masterServerHost, // "0.0.0.0", // All. or use masterServerHost for interfacesToListenOn,
-                    masterServerPort,
-                    masterDatabasePath +FS+ masterDbSubPath); // Distinguishing master/slave
-            runTest(replicationTest,
-                    jvmVersion,
-                    testClientHost,
-                    masterServerHost, masterServerPort,
-                    replicatedDb);
-            stopServer(masterJvmVersion, derbyMasterVersion,
-                    masterServerHost, masterServerPort);
-            util.DEBUG("**** END Running test without replication.");
-            // util.sleep(5000L, "End of runUnReplicated"); // Just for testing....
-        }
-        
-        ///////////////////////////////////////////////////////
-        // State: PreStartedMasterServer, PreStartedSlaveServer
-            if (state.testPreStartedMasterServer()) return;
-                
-        initMaster(masterServerHost,
-                replicatedDb); // Prototype V2: copy orig (possibly empty) db to db_master.
-        
-        masterServer = startServer(masterJvmVersion, derbyMasterVersion,
-                masterServerHost,
-                ALL_INTERFACES, // masterServerHost, // "0.0.0.0", // All. or use masterServerHost for interfacesToListenOn,
-                masterServerPort,
-                masterDatabasePath +FS+ masterDbSubPath); // Distinguishing master/slave
-        ///////////////////////////////////////////////////////
-        // State: PostStartedMasterServer, PreStartedSlaveServer
-        
-        startOptionalLoad(masterPreRepl,
-                masterDbSubPath,
-                masterServerHost,
-                masterServerPort);
-        
-            if (state.testPreStartedSlaveServer()) return; // + stop master server!
-        
-        // Thread.sleep(5000L); // Just for testing....
-        slaveServer = startServer(slaveJvmVersion, derbySlaveVersion,
-                slaveServerHost,
-                ALL_INTERFACES, // slaveServerHost, // "0.0.0.0", // All. or use slaveServerHost for interfacesToListenOn,
-                slaveServerPort,
-                slaveDatabasePath +FS+ slaveDbSubPath); // Distinguishing master/slave
-        ///////////////////////////////////////////////////////
-        // State: PostStartedMasterServer, PostStartedSlaveServer
-        //        PreStartedMaster,        PreStartedSlave
-        
-        // Thread.sleep(15000L); // Just for testing....
-        startServerMonitor(slaveServerHost);
-        
-        xFindServerPID(slaveServerHost, slaveServerPort); // JUST DEBUGGING!
-        
-        bootMasterDatabase(jvmVersion,
-                masterDatabasePath +FS+ masterDbSubPath,
-                replicatedDb,
-                masterServerHost, // Where the startreplication command must be given
-                masterServerPort, // master server interface accepting client requests
-                null // bootLoad, // The "test" to start when booting db.
-                );
-        
-        ///////////////////////////////////////////////////////
-        // State: PostStartedMasterServer, PostStartedSlaveServer
-        //        PostStartedMaster,       PreStartedSlave
-        
-        startOptionalLoad(masterPostRepl,
-                masterDbSubPath,
-                masterServerHost,
-                masterServerPort);
-        
-        startOptionalLoad(slavePreSlave,
-                slaveDbSubPath,
-                slaveServerHost,
-                slaveServerPort);
-        
-        // util.sleep(sleepTime, "Before initSlave"); // A. 'Something wrong with the instants!' if removed!
-        // 5secs is too little! 15secs is too little sometimes...!
-        // 30secs is too little w/ShutdownSlave!
-        
-        
-            if (state.testPreInitSlave()) return;
-
-        initSlave(/*slaveHost*/ slaveServerHost,
-                jvmVersion,
-                replicatedDb); // Trunk and Prototype V2: copy master db to db_slave.
-        
-
-            if (state.testPreStartedSlave()) return;
-                
-         startSlave(jvmVersion, replicatedDb,
-                slaveServerHost, // slaveClientInterface // where the slave db runs
-                slaveServerPort,
-                slaveServerHost, // for slaveReplInterface
-                slaveReplPort,
-                testClientHost);
-
-            if (state.testPreStartedMaster()) return;
-        
-       startMaster(jvmVersion, replicatedDb,
-                masterServerHost, // Where the startMaster command must be given
-                masterServerPort, // master server interface accepting client requests
-                masterServerHost, // An interface on the master: masterClientInterface (==masterServerHost),
-                slaveServerPort, // Not used since slave don't allow clients.
-                slaveServerHost, // for slaveReplInterface
-                slaveReplPort);
-        
-        ///////////////////////////////////////////////////////
-        // State: PostStartedMasterServer, PostStartedSlaveServer
-        //        PostStartedMaster,       PostStartedSlave
-        
-        startOptionalLoad(masterPostSlave,
-                masterDbSubPath,
-                masterServerHost,
-                masterServerPort);
-        
-        startOptionalLoad(slavePostSlave,
-                slaveDbSubPath,
-                slaveServerHost,
-                slaveServerPort);
-        
-        // Thread.sleep(5000L); // Just for testing....
-        // util.sleep(10000L, "Before runTest"); // Perf. testing....
-        
-            if (state.testPostStartedMasterAndSlave()) return;
-            // Could be run concurrently with runTest below?
-        
-        // Used to run positive tests? Handle negative testing in State.testPostStartedMasterAndSlave()?
-        // Observe that it will not be meaningful to do runTest if State.XXXX() 
-        // has led to incorrect replication state wrt. replicationTest.
-        runTest(replicationTest, // Returns immediatly if replicationTest is null.
-                jvmVersion,
-                testClientHost,
-                masterServerHost, masterServerPort,
-                replicatedDb);
-        
-        ///////////////////////////////////////////////////////
-        // State: PostStartedMasterServer, PostStartedSlaveServer
-        //        PostStartedMaster,       PostStartedSlave
-        //        PreStoppedMaster,        PreStoppedSlave
-            if (state.testPreStoppedMaster()) return;
-        
-// PoC        stopMaster(replicatedDb); // v7: RENAMED! FIXME! when 'stopMaster' cmd. available! // master..
-/*         stopMaster_ij(jvmVersion, replicatedDb,
-                masterServerHost,
-                masterServerPort,
-                testClientHost);
- */
-        ///////////////////////////////////////////////////////
-        // State: PostStartedMasterServer, PostStartedSlaveServer
-        //        PostStartedMaster,       PostStartedSlave
-        //        PostStoppedMaster,       PreStoppedSlave,       PreFailover
-        
-        // Thread.sleep(5000L); // Just for testing....
-        
-            if (state.testPreStoppedMasterServer()) return;
-        
-/* PoC        stopServer(masterJvmVersion, derbyMasterVersion, // v7: NA // PoC V2b: forces failover on slave
-                masterServerHost, masterServerPort);
- */
-        ///////////////////////////////////////////////////////
-        // State: PostStartedMasterServer, PostStartedSlaveServer
-        //        PostStartedMaster,       PostStartedSlave
-        //        PostStoppedMaster,       PreStoppedSlave
-        //        PostStoppedMasterServer, PreStoppedSlaveServer,  PoC:  PostFailover
-            if (state.testPreStoppedSlave()) return;
-        
-        // Thread.sleep(5000L); // Just for testing....
-// PoC        stopSlave(replicatedDb); // v7: NEW! FIXME! when 'stopSlave' cmd. available!
-/*         stopSlave_ij(jvmVersion, replicatedDb,
-                slaveServerHost,
-                slaveServerPort,
-                testClientHost);
- */
-        ///////////////////////////////////////////////////////
-        // State: PostStartedMasterServer, PostStartedSlaveServer
-        //        PostStartedMaster,       PostStartedSlave
-        //        PostStoppedMaster,       PostStoppedSlave
-        //        PostStoppedMasterServer, PreStoppedSlaveServer,  PreFailover // PoC:  PostFailover
-        
-        // Thread.sleep(5000L); // Just for testing....
-        failOver(jvmVersion, // On master, which is the normal case.
-            masterDatabasePath, masterDbSubPath, replicatedDb,
-            masterServerHost,  // Where the master db is run.
-            masterServerPort,
-            testClientHost);
-
-// PoC        failOver(replicatedDb); // FIXME! when 'failOver' cmd. available!
-
-        ///////////////////////////////////////////////////////
-        // State: PostStartedMasterServer, PostStartedSlaveServer
-        //        PostStartedMaster,       PostStartedSlave
-        //        PostStoppedMaster,       PostStoppedSlave
-        //        PostStoppedMasterServer, PreStoppedSlaveServer,  PostFailover
-        
-        // util.sleep(10000L, "After failover"); // Try to avoid DERBY-3463....
-        connectPing(slaveDatabasePath+FS+slaveDbSubPath+FS+replicatedDb,
-                slaveServerHost,slaveServerPort,
-                testClientHost);
-        
-        // If the slave server was shutdown, killed or died, start a "default" server on
-        // the same server and port to do the verification:
-        int slavePid = xFindServerPID(slaveServerHost, slaveServerPort);
-        if ( slavePid == -1 )
-        {
-            util.DEBUG("WARNING: slave server not available. Starting.");
-            slaveServer = startServer(jvmVersion, derbyVersion,
-                    slaveServerHost,
-                    ALL_INTERFACES, // slaveServerHost, // "0.0.0.0", // All. or use slaveServerHost for interfacesToListenOn,
-                    slaveServerPort,
-                    slaveDatabasePath +FS+ slaveDbSubPath); // Distinguishing master/slave
-        }
-        /* BEGIN Failover do not yet clean replication mode on slave! Must restart the server!*/
-        else{
-          if (true)
-          {
-            util.DEBUG("*********************** DERBY-3205/svn 630806. failover does now unset replication mode on slave.");
-          }
-          else // failover does not unset replication mode on slave.
-          {
-            util.DEBUG("*********************** DERBY-3205. failover does not unset replication mode on slave.");
-            /* That also blocks for connecting!:
-            // Do slave db shutdown (and reconnect) to unset... PRELIMINARY!!!
-            shutdownDb(slaveServerHost,slaveServerPort,
-                    slaveDatabasePath +FS+ slaveDbSubPath,replicatedDb);
-             */
-            /* */
-            restartServer(jvmVersion, derbyVersion, // restart server is too strong!
-                    slaveServerHost,
-                    ALL_INTERFACES,
-                    slaveServerPort,
-                    slaveDatabasePath +FS+ slaveDbSubPath); // Distinguishing master/slave
-            /* */
-          }
-        }/* END */
-        
-        verifySlave();
-        
-        // We should verify the master as well, at least to see that we still can connect.
-        // If the slave server was shutdown, killed or died, start a "default" server on
-        // the same server and port to do the verification:
-        int masterPid = xFindServerPID(masterServerHost, masterServerPort);
-        if ( masterPid == -1 )
-        {
-            util.DEBUG("WARNING: master server not available. Starting.");
-            masterServer = startServer(jvmVersion, derbyVersion,
-                    masterServerHost,
-                    ALL_INTERFACES, // masterServerHost, // "0.0.0.0", // All. or use slaveServerHost for interfacesToListenOn,
-                    masterServerPort,
-                    masterDatabasePath +FS+ masterDbSubPath); // Distinguishing master/slave
-        }
-        verifyMaster(); // NB NB Hangs here with localhost/ReplicationTestRun!
-        
-        xFindServerPID(slaveServerHost, slaveServerPort); // JUST DEBUGGING!
-        
-        // Thread.sleep(5000L); // Just for testing....
-        stopServer(jvmVersion, derbyVersion,
-                slaveServerHost, slaveServerPort);
-        ///////////////////////////////////////////////////////
-        // State: PostStartedMasterServer, PostStartedSlaveServer
-        //        PostStartedMaster,       PostStartedSlave
-        //        PostStoppedMaster,       PostStoppedSlave
-        //        PostStoppedMasterServer, PostStoppedSlaveServer,  PostFailover
-        
-            if (state.testPostStoppedSlaveServer()) return;
-        
-        // Shutdown master:
-        stopServer(jvmVersion, derbyVersion,
-                masterServerHost, masterServerPort);
-        // As of 2008-02-06 master does not accept shutdown after replication, so:
-        masterPid = xFindServerPID(masterServerHost, masterServerPort);
-        if ( masterPid != -1 )
-        {
-        util.DEBUG("*********************** DERBY-3394. master does not accept shutdown after failover.");
-        killMaster(masterServerHost,masterServerPort);
-        }
-        
+        System.out.println("WARNING: Override in subclass of ReplicationRun. "
+                + "See ReplicationRun_Local for an example.");
     }
 
     void connectPing(String fullDbPath, 
@@ -515,7 +224,7 @@
                 && (state.equalsIgnoreCase(expectedState) ) )
                 {
                     util.DEBUG("Failover not complete.");
-                    Thread.sleep(100L); // ms.
+                    Thread.sleep(200L); // ms.
                 }
                 else
                 {
@@ -524,7 +233,7 @@
                 }
             }
             
-            assertTrue("Failover did not succeed.", count++ < 100); // 100*100ms = 10s.
+            assertTrue("Failover did not succeed.", count++ < 100); // 100*200ms = 20s.
         }
     }
     
@@ -1105,7 +814,7 @@
                     int errCode = se.getErrorCode();
                     String msg = se.getMessage();
                     String state = se.getSQLState();
-                    String expectedState = "XJ001"; // Currently NPE! FIXME! when ready "XRE??";
+                    String expectedState = "XRE04";
                     util.DEBUG("startSlave Got SQLException: " + errCode + " " + state + " " + msg);
                     if ( (errCode == -1)
                     && (state.equalsIgnoreCase(expectedState) ) )
@@ -2128,13 +1837,6 @@
     void initMaster(String host, String dbName)
     throws Exception
     {
-        // Should this just be "connect ...;create=true"?
-        /*
-         * FIXME! PoC code requires something like:
-         * cd /home/user/Replication/testing/db_master
-         * rm -rf test derby.log ij_master
-         * cp -r ../origdb/test/ .
-         */
         
         util.DEBUG("initMaster");
         
@@ -2144,10 +1846,12 @@
         if ( host.equalsIgnoreCase("localhost") || localEnv )
         {
             String dir = masterDatabasePath+FS+masterDbSubPath;
+            util.mkDirs(dir); // Create the dir if non-existing.
             util.cleanDir(dir, false); // false: do not delete the directory itself.
             
             // Ditto for slave:
             dir = slaveDatabasePath+FS+slaveDbSubPath;
+            util.mkDirs(dir); // Create the dir if non-existing.
             util.cleanDir(dir, false); // false: do not delete the directory itself.
             
             // util.writeToFile(derbyProperties, dir+FS+"derby.properties");
@@ -2350,15 +2054,18 @@
         }
         
         String shellCmd = null;
-        if ( serverHost.equalsIgnoreCase("localhost") /* && false Need a property: startServer_direct */ )
+        /*
+        if ( serverHost.equalsIgnoreCase("localhost") )
         {
-            // Can not select jvm or Derby version in this case.
+            // 1. Can not select jvm or Derby version in this case.
+            // 2. Master and slave would run in same VM. Mixing derby.logs!
             return startServer_direct(serverHost, 
                     interfacesToListenOn, serverPort, 
                     fullDbDirPath,
                     securityOption);
         }
-        else if ( serverHost.equalsIgnoreCase("localhost") ) // NEVER USED! Historical reasons...
+        else */
+        if ( serverHost.equalsIgnoreCase("localhost") )
         {
             util.DEBUG(debugId+"Starting server on localhost "+ serverHost);
             shellCmd = fullCmd;
@@ -2368,8 +2075,7 @@
             util.DEBUG(debugId+"Starting server on non-local host "+ serverHost);
             
             String[] shEnvElements = {"setenv CLASS_PATH "+serverClassPath
-                    , "setenv PATH "+serverVM+FS+".."+FS+"bin:${PATH}"
-                    };
+                    , "setenv PATH "+serverVM+FS+".."+FS+"bin:${PATH}"};
             String shellEnv = "";
             for ( int i=0;i<shEnvElements.length;i++)
             {shellEnv = shellEnv + shEnvElements[i] + ";";}
@@ -2427,24 +2133,27 @@
             String fullDbDirPath,
             String securityOption) // FIXME? true/false?
     throws Exception
-    { // Only partly tested!
+    { // Wotk in progress. Not currently used! Only partly tested!
         util.DEBUG("startServer_direct " + serverHost 
                 + " " + interfacesToListenOn +  " " + serverPort
                 + " " + fullDbDirPath);
         assertTrue("Attempt to start server on non-localhost: " + serverHost, 
                 serverHost.equalsIgnoreCase("localhost"));
-        Properties p = System.getProperties();
-        p.setProperty("derby.system.home", fullDbDirPath);
+        
+        System.setProperty("derby.system.home", fullDbDirPath);
+        System.setProperty("user.dir", fullDbDirPath);
+        
         NetworkServerControl server = new NetworkServerControl(
                 InetAddress.getByName(interfacesToListenOn), serverPort);
+        
         server.start(null); 
         pingServer(serverHost, serverPort, 5);
+        
         Properties sp = server.getCurrentProperties();
         sp.setProperty("noSecurityManager", 
                 securityOption.equalsIgnoreCase("-noSecurityManager")?"true":"false");
-        sp.setProperty("derby.system.home",fullDbDirPath);
-        sp.setProperty("derby.infolog.append","true");
         // derby.log for both master and slave ends up in masters system!
+        // Both are run in the same VM! Not a good idea?
         return server;
     }
 
@@ -2736,7 +2445,7 @@
         
     }
 
-    private void startOptionalLoad(Load load,
+    void startOptionalLoad(Load load,
             String dbSubPath,
             String serverHost,
             int serverPort)
@@ -2750,7 +2459,7 @@
                 serverHost,
                 serverPort);
     }
-    private void startLoad(String load,
+    void startLoad(String load,
             String dbSubPath,
             String database,
             boolean existingDB,
@@ -2925,7 +2634,7 @@
                     + testPostStoppedSlaveServerReturn);
         }
         
-    private boolean testPreStartedMasterServer()
+    boolean testPreStartedMasterServer()
         throws Exception
     {
         /*
@@ -2949,7 +2658,7 @@
         return testPreStartedMasterServerReturn;
     }
 
-    private boolean testPreStartedSlaveServer()
+    boolean testPreStartedSlaveServer()
         throws Exception
     {
         /*
@@ -2971,7 +2680,7 @@
         return testPreStartedSlaveServerReturn;
     }
 
-    private boolean testPreStartedMaster()
+    boolean testPreStartedMaster()
         throws Exception
     {
         /*
@@ -2994,7 +2703,7 @@
         return testPreStartedMasterReturn;
     }
 
-    private boolean testPreInitSlave()
+    boolean testPreInitSlave()
         throws Exception
     {
         /*
@@ -3017,7 +2726,7 @@
         return testPreInitSlaveReturn;
     }
 
-    private boolean testPreStartedSlave()
+    boolean testPreStartedSlave()
         throws Exception
     {
         /*
@@ -3040,7 +2749,7 @@
         return testPreStartedSlaveReturn;
     }
 
-    private boolean testPostStartedMasterAndSlave()
+    boolean testPostStartedMasterAndSlave()
         throws Exception
     {
         /*
@@ -3064,7 +2773,7 @@
         return testPostStartedMasterAndSlaveReturn;
     }
 
-    private boolean testPreStoppedMaster()
+    boolean testPreStoppedMaster()
         throws Exception
     {
         /*
@@ -3087,7 +2796,7 @@
         return testPreStoppedMasterReturn;
     }
 
-    private boolean testPreStoppedMasterServer()
+    boolean testPreStoppedMasterServer()
         throws Exception
     {
         /*
@@ -3110,7 +2819,7 @@
         return testPreStoppedMasterServerReturn;
     }
 
-    private boolean testPreStoppedSlave()
+    boolean testPreStoppedSlave()
         throws Exception
     {
         /*
@@ -3133,7 +2842,7 @@
         return testPreStoppedSlaveReturn;
     }
 
-    private boolean testPreStoppedSlaveServer()
+    boolean testPreStoppedSlaveServer()
         throws Exception
     {
         /*
@@ -3156,7 +2865,7 @@
         return testPreStoppedSlaveServerReturn;
     }
 
-    private boolean testPostStoppedSlaveServer()
+    boolean testPostStoppedSlaveServer()
         throws Exception
     {
         /*

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Distributed.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Distributed.java?rev=633466&r1=633465&r2=633466&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Distributed.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Distributed.java Tue Mar  4 05:07:21 2008
@@ -49,16 +49,6 @@
         super(testcaseName);
     }
     
-    protected void setUp() throws Exception
-    {
-        super.setUp();
-    }
-    
-    protected void tearDown() throws Exception
-    {
-        super.tearDown();
-    }
-    
     public static Test suite()
     {
         TestSuite suite = new TestSuite("ReplicationRun_Distributed Suite");

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Full.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Full.java?rev=633466&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Full.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Full.java Tue Mar  4 05:07:21 2008
@@ -0,0 +1,359 @@
+/*
+ 
+Derby - Class org.apache.derbyTesting.functionTests.tests.replicationTests.ReplicationRun
+ 
+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.replicationTests;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class ReplicationRun_Full extends ReplicationRun
+{
+    
+    public ReplicationRun_Full(String testcaseName)
+    {
+        super(testcaseName);
+        
+        LF = System.getProperties().getProperty("line.separator");
+    }
+        
+    public static Test suite()
+    {
+        
+        TestSuite suite = new TestSuite("Replication_Full Suite");
+        
+        suite.addTestSuite( ReplicationRun_Full.class );
+        
+        return suite;
+    }
+    
+    //////////////////////////////////////////////////////////////
+    ////
+    //// The replication test framework (testReplication()):
+    //// a) "clean" replication run starting master and slave servers,
+    ////     preparing master and slave databases,
+    ////     starting and stopping replication and doing
+    ////     failover for a "normal"/"failure free" replication
+    ////     test run.
+    //// b)  Running (positive and negative) tests at the various states 
+    ////     of replication to test what is and is not accepted compared to
+    ////     the functional specification.
+    //// c)  Adding additional load on master and slave servers in 
+    ////     different states of replication.
+    ////
+    //////////////////////////////////////////////////////////////
+    
+    public void testReplication()
+    throws Exception
+    {
+        cleanAllTestHosts();
+        
+        initEnvironment();
+        
+        /* 'testReplication' steps through all states of the
+         * replication process.
+         * Tests required to be run in these states
+         * should be specified in the replicationtest.properties file.
+         */
+        if ( runUnReplicated )  // test.runUnReplicated
+        {
+            util.DEBUG("**** BEGIN Running test without replication.");
+            initMaster(masterServerHost,
+                    replicatedDb);
+            startServer(masterJvmVersion, derbyVersion, // No replication
+                    masterServerHost,
+                    ALL_INTERFACES, // masterServerHost, // "0.0.0.0", // All. or use masterServerHost for interfacesToListenOn,
+                    masterServerPort,
+                    masterDatabasePath +FS+ masterDbSubPath); // Distinguishing master/slave
+            runTest(replicationTest,
+                    jvmVersion,
+                    testClientHost,
+                    masterServerHost, masterServerPort,
+                    replicatedDb);
+            stopServer(masterJvmVersion, derbyMasterVersion,
+                    masterServerHost, masterServerPort);
+            util.DEBUG("**** END Running test without replication.");
+            // util.sleep(5000L, "End of runUnReplicated"); // Just for testing....
+        }
+        
+        ///////////////////////////////////////////////////////
+        // State: PreStartedMasterServer, PreStartedSlaveServer
+            if (state.testPreStartedMasterServer()) return;
+                
+        initMaster(masterServerHost,
+                replicatedDb); // Prototype V2: copy orig (possibly empty) db to db_master.
+        
+        masterServer = startServer(masterJvmVersion, derbyMasterVersion,
+                masterServerHost,
+                ALL_INTERFACES, // masterServerHost, // "0.0.0.0", // All. or use masterServerHost for interfacesToListenOn,
+                masterServerPort,
+                masterDatabasePath +FS+ masterDbSubPath); // Distinguishing master/slave
+        ///////////////////////////////////////////////////////
+        // State: PostStartedMasterServer, PreStartedSlaveServer
+        
+        startOptionalLoad(masterPreRepl,
+                masterDbSubPath,
+                masterServerHost,
+                masterServerPort);
+        
+            if (state.testPreStartedSlaveServer()) return; // + stop master server!
+        
+        // Thread.sleep(5000L); // Just for testing....
+        slaveServer = startServer(slaveJvmVersion, derbySlaveVersion,
+                slaveServerHost,
+                ALL_INTERFACES, // slaveServerHost, // "0.0.0.0", // All. or use slaveServerHost for interfacesToListenOn,
+                slaveServerPort,
+                slaveDatabasePath +FS+ slaveDbSubPath); // Distinguishing master/slave
+        ///////////////////////////////////////////////////////
+        // State: PostStartedMasterServer, PostStartedSlaveServer
+        //        PreStartedMaster,        PreStartedSlave
+        
+        // Thread.sleep(15000L); // Just for testing....
+        startServerMonitor(slaveServerHost);
+        
+        xFindServerPID(slaveServerHost, slaveServerPort); // JUST DEBUGGING!
+        
+        bootMasterDatabase(jvmVersion,
+                masterDatabasePath +FS+ masterDbSubPath,
+                replicatedDb,
+                masterServerHost, // Where the startreplication command must be given
+                masterServerPort, // master server interface accepting client requests
+                null // bootLoad, // The "test" to start when booting db.
+                );
+        
+        ///////////////////////////////////////////////////////
+        // State: PostStartedMasterServer, PostStartedSlaveServer
+        //        PostStartedMaster,       PreStartedSlave
+        
+        startOptionalLoad(masterPostRepl,
+                masterDbSubPath,
+                masterServerHost,
+                masterServerPort);
+        
+        startOptionalLoad(slavePreSlave,
+                slaveDbSubPath,
+                slaveServerHost,
+                slaveServerPort);
+        
+        // util.sleep(sleepTime, "Before initSlave"); // A. 'Something wrong with the instants!' if removed!
+        // 5secs is too little! 15secs is too little sometimes...!
+        // 30secs is too little w/ShutdownSlave!
+        
+        
+            if (state.testPreInitSlave()) return;
+
+        initSlave(/*slaveHost*/ slaveServerHost,
+                jvmVersion,
+                replicatedDb); // Trunk and Prototype V2: copy master db to db_slave.
+        
+
+            if (state.testPreStartedSlave()) return;
+                
+         startSlave(jvmVersion, replicatedDb,
+                slaveServerHost, // slaveClientInterface // where the slave db runs
+                slaveServerPort,
+                slaveServerHost, // for slaveReplInterface
+                slaveReplPort,
+                testClientHost);
+
+            if (state.testPreStartedMaster()) return;
+        
+       startMaster(jvmVersion, replicatedDb,
+                masterServerHost, // Where the startMaster command must be given
+                masterServerPort, // master server interface accepting client requests
+                masterServerHost, // An interface on the master: masterClientInterface (==masterServerHost),
+                slaveServerPort, // Not used since slave don't allow clients.
+                slaveServerHost, // for slaveReplInterface
+                slaveReplPort);
+        
+        ///////////////////////////////////////////////////////
+        // State: PostStartedMasterServer, PostStartedSlaveServer
+        //        PostStartedMaster,       PostStartedSlave
+        
+        startOptionalLoad(masterPostSlave,
+                masterDbSubPath,
+                masterServerHost,
+                masterServerPort);
+        
+        startOptionalLoad(slavePostSlave,
+                slaveDbSubPath,
+                slaveServerHost,
+                slaveServerPort);
+        
+        // Thread.sleep(5000L); // Just for testing....
+        // util.sleep(10000L, "Before runTest"); // Perf. testing....
+        
+            if (state.testPostStartedMasterAndSlave()) return;
+            // Could be run concurrently with runTest below?
+        
+        // Used to run positive tests? Handle negative testing in State.testPostStartedMasterAndSlave()?
+        // Observe that it will not be meaningful to do runTest if State.XXXX() 
+        // has led to incorrect replication state wrt. replicationTest.
+        runTest(replicationTest, // Returns immediatly if replicationTest is null.
+                jvmVersion,
+                testClientHost,
+                masterServerHost, masterServerPort,
+                replicatedDb);
+        
+        ///////////////////////////////////////////////////////
+        // State: PostStartedMasterServer, PostStartedSlaveServer
+        //        PostStartedMaster,       PostStartedSlave
+        //        PreStoppedMaster,        PreStoppedSlave
+            if (state.testPreStoppedMaster()) return;
+        
+// PoC        stopMaster(replicatedDb); // v7: RENAMED! FIXME! when 'stopMaster' cmd. available! // master..
+/*         stopMaster_ij(jvmVersion, replicatedDb,
+                masterServerHost,
+                masterServerPort,
+                testClientHost);
+ */
+        ///////////////////////////////////////////////////////
+        // State: PostStartedMasterServer, PostStartedSlaveServer
+        //        PostStartedMaster,       PostStartedSlave
+        //        PostStoppedMaster,       PreStoppedSlave,       PreFailover
+        
+        // Thread.sleep(5000L); // Just for testing....
+        
+            if (state.testPreStoppedMasterServer()) return;
+        
+/* PoC        stopServer(masterJvmVersion, derbyMasterVersion, // v7: NA // PoC V2b: forces failover on slave
+                masterServerHost, masterServerPort);
+ */
+        ///////////////////////////////////////////////////////
+        // State: PostStartedMasterServer, PostStartedSlaveServer
+        //        PostStartedMaster,       PostStartedSlave
+        //        PostStoppedMaster,       PreStoppedSlave
+        //        PostStoppedMasterServer, PreStoppedSlaveServer,  PoC:  PostFailover
+            if (state.testPreStoppedSlave()) return;
+        
+        // Thread.sleep(5000L); // Just for testing....
+// PoC        stopSlave(replicatedDb); // v7: NEW! FIXME! when 'stopSlave' cmd. available!
+/*         stopSlave_ij(jvmVersion, replicatedDb,
+                slaveServerHost,
+                slaveServerPort,
+                testClientHost);
+ */
+        ///////////////////////////////////////////////////////
+        // State: PostStartedMasterServer, PostStartedSlaveServer
+        //        PostStartedMaster,       PostStartedSlave
+        //        PostStoppedMaster,       PostStoppedSlave
+        //        PostStoppedMasterServer, PreStoppedSlaveServer,  PreFailover // PoC:  PostFailover
+        
+        // Thread.sleep(5000L); // Just for testing....
+        failOver(jvmVersion, // On master, which is the normal case.
+            masterDatabasePath, masterDbSubPath, replicatedDb,
+            masterServerHost,  // Where the master db is run.
+            masterServerPort,
+            testClientHost);
+
+// PoC        failOver(replicatedDb); // FIXME! when 'failOver' cmd. available!
+
+        ///////////////////////////////////////////////////////
+        // State: PostStartedMasterServer, PostStartedSlaveServer
+        //        PostStartedMaster,       PostStartedSlave
+        //        PostStoppedMaster,       PostStoppedSlave
+        //        PostStoppedMasterServer, PreStoppedSlaveServer,  PostFailover
+        
+        // util.sleep(10000L, "After failover"); // Try to avoid DERBY-3463....
+        connectPing(slaveDatabasePath+FS+slaveDbSubPath+FS+replicatedDb,
+                slaveServerHost,slaveServerPort,
+                testClientHost);
+        
+        // If the slave server was shutdown, killed or died, start a "default" server on
+        // the same server and port to do the verification:
+        int slavePid = xFindServerPID(slaveServerHost, slaveServerPort);
+        if ( slavePid == -1 )
+        {
+            util.DEBUG("WARNING: slave server not available. Starting.");
+            slaveServer = startServer(jvmVersion, derbyVersion,
+                    slaveServerHost,
+                    ALL_INTERFACES, // slaveServerHost, // "0.0.0.0", // All. or use slaveServerHost for interfacesToListenOn,
+                    slaveServerPort,
+                    slaveDatabasePath +FS+ slaveDbSubPath); // Distinguishing master/slave
+        }
+        /* BEGIN Failover do not yet clean replication mode on slave! Must restart the server!*/
+        else{
+          if (true)
+          {
+            util.DEBUG("*********************** DERBY-3205/svn 630806. failover does now unset replication mode on slave.");
+          }
+          else // failover does not unset replication mode on slave.
+          {
+            util.DEBUG("*********************** DERBY-3205. failover does not unset replication mode on slave.");
+            /* That also blocks for connecting!:
+            // Do slave db shutdown (and reconnect) to unset... PRELIMINARY!!!
+            shutdownDb(slaveServerHost,slaveServerPort,
+                    slaveDatabasePath +FS+ slaveDbSubPath,replicatedDb);
+             */
+            /* */
+            restartServer(jvmVersion, derbyVersion, // restart server is too strong!
+                    slaveServerHost,
+                    ALL_INTERFACES,
+                    slaveServerPort,
+                    slaveDatabasePath +FS+ slaveDbSubPath); // Distinguishing master/slave
+            /* */
+          }
+        }/* END */
+        
+        verifySlave();
+        
+        // We should verify the master as well, at least to see that we still can connect.
+        // If the slave server was shutdown, killed or died, start a "default" server on
+        // the same server and port to do the verification:
+        int masterPid = xFindServerPID(masterServerHost, masterServerPort);
+        if ( masterPid == -1 )
+        {
+            util.DEBUG("WARNING: master server not available. Starting.");
+            masterServer = startServer(jvmVersion, derbyVersion,
+                    masterServerHost,
+                    ALL_INTERFACES, // masterServerHost, // "0.0.0.0", // All. or use slaveServerHost for interfacesToListenOn,
+                    masterServerPort,
+                    masterDatabasePath +FS+ masterDbSubPath); // Distinguishing master/slave
+        }
+        verifyMaster(); // NB NB Hangs here with localhost/ReplicationTestRun!
+        
+        xFindServerPID(slaveServerHost, slaveServerPort); // JUST DEBUGGING!
+        
+        // Thread.sleep(5000L); // Just for testing....
+        stopServer(jvmVersion, derbyVersion,
+                slaveServerHost, slaveServerPort);
+        ///////////////////////////////////////////////////////
+        // State: PostStartedMasterServer, PostStartedSlaveServer
+        //        PostStartedMaster,       PostStartedSlave
+        //        PostStoppedMaster,       PostStoppedSlave
+        //        PostStoppedMasterServer, PostStoppedSlaveServer,  PostFailover
+        
+            if (state.testPostStoppedSlaveServer()) return;
+        
+        // Shutdown master:
+        stopServer(jvmVersion, derbyVersion,
+                masterServerHost, masterServerPort);
+        // As of 2008-02-06 master does not accept shutdown after replication, so:
+        masterPid = xFindServerPID(masterServerHost, masterServerPort);
+        if ( masterPid != -1 )
+        {
+        util.DEBUG("*********************** DERBY-3394. master does not accept shutdown after failover.");
+        killMaster(masterServerHost,masterServerPort);
+        }
+        
+    }
+
+
+    
+}

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

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local.java?rev=633466&r1=633465&r2=633466&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local.java Tue Mar  4 05:07:21 2008
@@ -133,7 +133,6 @@
         replicationTest = "org.apache.derbyTesting.functionTests.tests.replicationTests.ReplicationTestRun";
         util.DEBUG("replicationTest: " + replicationTest);
         replicationVerify = "org.apache.derbyTesting.functionTests.tests.replicationTests.ReplicationTestRun_Verify";
-        // replicationVerify = "/home/os136789/Replication/testing/verify_ReplicationTestRun.sql";
         util.DEBUG("replicationVerify: " + replicationVerify);
 
         runTest(replicationTest, // Returns immediatly if replicationTest is null.

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationTestRun.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationTestRun.java?rev=633466&r1=633465&r2=633466&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationTestRun.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationTestRun.java Tue Mar  4 05:07:21 2008
@@ -23,13 +23,7 @@
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
-import org.apache.derbyTesting.functionTests.tests.derbynet.PrepareStatementTest;
-import org.apache.derbyTesting.functionTests.tests.lang.AnsiTrimTest;
-import org.apache.derbyTesting.functionTests.tests.lang.CreateTableFromQueryTest;
-import org.apache.derbyTesting.functionTests.tests.lang.SimpleTest;
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
-import org.apache.derbyTesting.junit.JDBCClient;
-import org.apache.derbyTesting.junit.TestConfiguration;
 
 public class ReplicationTestRun extends BaseJDBCTestCase
 {
@@ -54,10 +48,8 @@
         suite.addTest(StandardTests.simpleTest(masterHostName, masterPortNo));
         System.out.println("*** Done suite.addTest(StandardTests.simpleTest())");
         
-        /* PoC: Gives 'Something wrong with the instants!' Seems to be volume related? * /
         suite.addTest(StandardTests.prepareStatementTest(masterHostName, masterPortNo)); 
         System.out.println("*** Done suite.addTest(StandardTests.prepareStatementTest())");
-        / * */
         
         suite.addTest(StandardTests.ansiTrimTest(masterHostName, masterPortNo)); // Something wrong with the instants!
         System.out.println("*** Done suite.addTest(StandardTests.ansiTrimTest())");
@@ -65,13 +57,29 @@
         suite.addTest(StandardTests.createTableFromQueryTest(masterHostName, masterPortNo));
         System.out.println("*** Done suite.addTest(StandardTests.createTableFromQueryTest())");
         
+        /* Need decoration?
+        suite.addTest(StandardTests.databaseClassLoadingTest(masterHostName, masterPortNo));
+        System.out.println("*** Done suite.addTest(StandardTests.databaseClassLoadingTest())"); */
+        
+        /* Need decoration!
+        suite.addTest(StandardTests.dynamicLikeOptimizationTest(masterHostName, masterPortNo));
+        System.out.println("*** Done suite.addTest(StandardTests.dynamicLikeOptimizationTest())"); */
+
+        // suite.addTest(ExistsWithSetOpsTest.suite()); GONE!
+        
+        /* Need decoration!
+        suite.addTest(StandardTests.grantRevokeTest(masterHostName, masterPortNo));
+        System.out.println("*** Done suite.addTest(StandardTests.grantRevokeTest())"); */
+        
+        /* Need decoration!
+        suite.addTest(StandardTests.groupByExpressionTest(masterHostName, masterPortNo));
+        System.out.println("*** Done suite.addTest(StandardTests.groupByExpressionTest())"); */
+      
+        /* Need decoration?
+        suite.addTest(StandardTests.langScripts(masterHostName, masterPortNo));
+        System.out.println("*** Done suite.addTest(StandardTests.langScripts())"); */
+        
         /*
-        suite.addTest(DatabaseClassLoadingTest.suite());
-        suite.addTest(DynamicLikeOptimizationTest.suite());
-        suite.addTest(ExistsWithSetOpsTest.suite());
-        suite.addTest(GrantRevokeTest.suite());
-        suite.addTest(GroupByExpressionTest.suite());
-		suite.addTest(LangScripts.suite());
         suite.addTest(MathTrigFunctionsTest.suite());
         suite.addTest(PrepareExecuteDDL.suite());
         suite.addTest(RoutineSecurityTest.suite());

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/StandardTests.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/StandardTests.java?rev=633466&r1=633465&r2=633466&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/StandardTests.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/StandardTests.java Tue Mar  4 05:07:21 2008
@@ -30,10 +30,11 @@
 import org.apache.derbyTesting.functionTests.tests.derbynet.PrepareStatementTest;
 import org.apache.derbyTesting.functionTests.tests.lang.AnsiTrimTest;
 import org.apache.derbyTesting.functionTests.tests.lang.CreateTableFromQueryTest;
+import org.apache.derbyTesting.functionTests.tests.lang.DatabaseClassLoadingTest;
+import org.apache.derbyTesting.functionTests.tests.lang.LangScripts;
 import org.apache.derbyTesting.functionTests.tests.lang.SimpleTest;
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
 import org.apache.derbyTesting.junit.CleanDatabaseTestSetup;
-import org.apache.derbyTesting.junit.JDBCClient;
 import org.apache.derbyTesting.junit.TestConfiguration;
 
 /**
@@ -138,6 +139,47 @@
         };
         return cdts;
     }
+    
+    public static Test databaseClassLoadingTest(String hostName, int portNo)
+    {
+        return TestConfiguration.existingServerSuite(DatabaseClassLoadingTest.class,
+                false,hostName, portNo);
+    }
+    
+    public static Test dynamicLikeOptimizationTest(String hostName, int portNo)
+    {
+        System.out.println("********* FIXME!");return null;
+        /* factor out DynamicLikeOptimizationTest.decorate()
+        return TestConfiguration.existingServerSuite(DynamicLikeOptimizationTest.class,
+                false,hostName, portNo);
+         */
+    }
+    public static Test grantRevokeTest(String hostName, int portNo)
+    {
+        System.out.println("********* FIXME!");return null;
+        /* factor out GrantRevokeTest.decorate()
+        return TestConfiguration.existingServerSuite(GrantRevokeTest.class,
+                false,hostName, portNo);
+        */
+    }
+    
+    public static Test groupByExpressionTest(String hostName, int portNo)
+    {
+        System.out.println("********* FIXME!");return null;
+        /* factor out GrantRevokeTest.decorate() 
+        return TestConfiguration.existingServerSuite(GroupByExpressionTest.class,
+                false,hostName, portNo);
+        */
+    }
+
+    public static Test langScripts(String hostName, int portNo)
+    {
+        // System.out.println("********* FIXME!");return null;
+        /* factor out GrantRevokeTest.decorate() */
+        return TestConfiguration.existingServerSuite(LangScripts.class,
+                false,hostName, portNo);
+    }
+
     
     /* All the above are pure Tests. To handle suites
      * we will have to duplicate the .suite() structure starting at .suites.all!

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/Utils.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/Utils.java?rev=633466&r1=633465&r2=633466&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/Utils.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/Utils.java Tue Mar  4 05:07:21 2008
@@ -21,19 +21,8 @@
 package org.apache.derbyTesting.functionTests.tests.replicationTests;
 
 import java.nio.channels.FileChannel;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.apache.derby.drda.NetworkServerControl;
-import java.net.InetAddress;
-import java.net.Inet6Address;
-
-import java.sql.*;
 import java.io.*;
-import java.util.*;
 
-import org.apache.derbyTesting.junit.BaseTestCase;
-import org.apache.derbyTesting.junit.JDBC;
 
 /**
  * Utilities for replication test framework:
@@ -56,7 +45,6 @@
      * NB! May also delete subdirectories!
      * @param dir where to delete files.
      * @param deleteRootDirectory if true deletes also the given root directory.
-     * @return number of files/directories deleted.
      * @throws IOException if operation fails.
      */
     void cleanDir(String dir, boolean deleteRootDirectory)
@@ -129,7 +117,6 @@
      * Copy directory sourcePath into directory destPath
      * @param sourcePath Directory to copy
      * @param destPath Directory to copy into
-     * @return number of files copied.
      * @throws IOException If copying failed.
      */
     void copyDir(String sourcePath, String destPath)
@@ -142,13 +129,12 @@
     * @param srcPath Directory or file to copy from
     * @param destPath Directory or file to copy to
     * @throws IOException If copying failed.
-    * @return number of files copied.
     */
-    void copyFiles(String srcDir, String destDir) 
+    void copyFiles(String srcPath, String destPath) 
     throws IOException
     {
-        File src = new File(srcDir);
-        File dest = new File(destDir);
+        File src = new File(srcPath);
+        File dest = new File(destPath);
         
         if (src.isDirectory())
         {
@@ -199,6 +185,12 @@
         FileWriter out = new FileWriter(outFile);
         out.write(text);
         out.close();
+    }
+
+    void mkDirs(String dirPath)
+    {
+        File dir = new File(dirPath);
+        dir.mkdirs();
     }
     
     ///////////////////////////////////////////////////////////////////////////////////



Mime
View raw message