You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by da...@apache.org on 2009/06/16 11:50:21 UTC

svn commit: r785131 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/

Author: dag
Date: Tue Jun 16 09:50:21 2009
New Revision: 785131

URL: http://svn.apache.org/viewvc?rev=785131&view=rev
Log:
DERBY-4246 .replicationTests.ReplicationRun_Local_3_p5).testReplication_Local_3_p5_DERBY_3878()' fails w/ "Could not perform operation 'stopSlave' because the database '...' has not been booted

Patch derby-4246-2 adds extra logic to the stop slave action after the
master is killed. This logic anticipates the slave's state changes
before its down. This logic was also present in
ReplicationRun_Local_StateTest_part1_1, so this patch factors this out
into a new method to stopSlave in ReplicationRun.


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_Local_3.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_3_p1.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_3_p5.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_StateTest_part1_1.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_StateTest_part2.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=785131&r1=785130&r2=785131&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 Jun 16 09:50:21 2009
@@ -49,7 +49,11 @@
      */
     final static String REPLICATIONTEST_PROPFILE = "replicationtest.properties";
     
-    final static String REPLICATION_MASTER_TIMED_OUT = "XRE06";
+    final static String REPLICATION_MASTER_TIMED_OUT           = "XRE06";
+    final static String REPLICATION_SLAVE_STARTED_OK           = "XRE08";
+    final static String REPLICATION_DB_NOT_BOOTED              = "XRE11";
+    final static String SLAVE_OPERATION_DENIED_WHILE_CONNECTED = "XRE41";
+    final static String REPLICATION_SLAVE_SHUTDOWN_OK          = "XRE42";
 
     static String testUser = null;
     
@@ -1275,48 +1279,7 @@
             util.DEBUG("startSlave_direct exit.");
     }
     
-    private void stopSlave(String dbName)
-    {
-        util.DEBUG("Simulating '... stopslave -db "+dbName);
-    }
-    private void stopSlave_ij(String jvmVersion,
-            String dbName,
-            String slaveHost,  // Where the slave db is run.
-            int slaveServerPort,
-            
-            String testClientHost)
-            throws Exception
-    {
-        
-        String masterClassPath = derbyMasterVersion +FS+ "derbynet.jar";
-                
-        String URL = slaveURL(dbName)
-                +";stopSlave=true";
-        String ijClassPath = derbyVersion +FS+ "derbyclient.jar"
-                + PS + derbyVersion +FS+ "derbytools.jar";
-        if ( slaveHost.equals("localhost") )
-        { // Use full classpath when running locally. Can not vary server versions!
-            ijClassPath = classPath;
-        }
-        
-        String clientJvm = BaseTestCase.getJavaExecutableName();
-        
-        String command = clientJvm // "java"
-                + " -Dij.driver=" + DRIVER_CLASS_NAME
-                + " -Dij.connection.stopSlave=\"" + URL + "\""
-                + " -classpath " + ijClassPath + " org.apache.derby.tools.ij"
-                + " " + "/home/os136789/Replication/testing/exit.sql"
-                ;
-        
-        // Execute the ij command on the testClientHost as testUser
-        String results =
-                runUserCommandRemotely(command,
-                testClientHost,
-                testUser,
-                "stopSlave_ij ");
-        util.DEBUG(results);
-    }
-    
+
     void failOver(String jvmVersion,
             String dbPath, String dbSubPath, String dbName,
             String host,  // Where the db is run.
@@ -3501,4 +3464,110 @@
                 +useEncryption(false);
     }
 
+
+    SQLException stopSlave(
+        String slaveServerHost,
+        int slaveServerPort,
+        String slaveDatabasePath,
+        String replicatedDb,
+        boolean masterServerAlive)
+        throws Exception
+    {
+        return stopSlave(slaveServerHost,
+                         slaveServerPort,
+                         slaveDatabasePath,
+                         ReplicationRun.slaveDbSubPath,
+                         replicatedDb,
+                         masterServerAlive);
+    }
+
+
+    SQLException stopSlave(
+        String slaveServerHost,
+        int slaveServerPort,
+        String slaveDatabasePath,
+        String subPath,
+        String replicatedDb,
+        boolean masterServerAlive)
+        throws Exception
+    {
+        util.DEBUG("stopSlave");
+        String dbPath = slaveDatabasePath + FS + subPath + FS + replicatedDb;
+
+        String connectionURL = "jdbc:derby:"
+            + "//" + slaveServerHost + ":" + slaveServerPort + "/"
+            + dbPath
+            + ";stopSlave=true"
+            + useEncryption(false);
+
+        if (masterServerAlive) {
+            try {
+                Connection conn = DriverManager.getConnection(connectionURL);
+                conn.close();
+                return null; // If successful.
+            } catch (SQLException se) {
+                return se;
+            }
+        } else {
+            // We use a loop below, to allow for intermediate states before the
+            // expected final state REPLICATION_DB_NOT_BOOTED.
+            //
+            // If we get here quick enough we see these error states (in order):
+            //     a) SLAVE_OPERATION_DENIED_WHILE_CONNECTED
+            //     b) REPLICATION_SLAVE_SHUTDOWN_OK
+            //
+            SQLException gotEx = null;
+            int tries = 20;
+
+            while (tries-- > 0) {
+                gotEx = null;
+
+                try {
+                    DriverManager.getConnection(connectionURL);
+                    fail("Unexpectedly connected");
+                } catch (SQLException se) {
+                    if (se.getSQLState().
+                            equals(SLAVE_OPERATION_DENIED_WHILE_CONNECTED)) {
+                        // Try again, shutdown did not complete yet..
+                        gotEx = se;
+                        util.DEBUG
+                            ("got SLAVE_OPERATION_DENIED_WHILE_CONNECTED, " +
+                             "sleep");
+                        Thread.sleep(1000L);
+                        continue;
+
+                    } else if (se.getSQLState().
+                                   equals(REPLICATION_SLAVE_SHUTDOWN_OK)) {
+                        // Try again, shutdown started but did not complete yet.
+                        gotEx = se;
+                        util.DEBUG("got REPLICATION_SLAVE_SHUTDOWN_OK, " +
+                                   "sleep..");
+                        Thread.sleep(1000L);
+                        continue;
+
+                    } else if (se.getSQLState().
+                                   equals(REPLICATION_DB_NOT_BOOTED)) {
+                        // All is fine, so proceed
+                        util.DEBUG("Got REPLICATION_DB_NOT_BOOTED as expected");
+                        break;
+
+                    } else {
+                        // Something else, so report.
+                        gotEx = se;
+                        break;
+                    }
+                }
+            }
+
+            if (gotEx != null) {
+                // We did not get what we expected as the final state
+                // (REPLICATION_DB_NOT_BOOTED) in reasonable time, or we saw
+                // something that is not a legal intermediate state, so we fail
+                // now:
+                throw gotEx;
+            }
+
+            return null;
+        }
+    }
 }

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_3.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_3.java?rev=785131&r1=785130&r2=785131&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_3.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_3.java Tue Jun 16 09:50:21 2009
@@ -116,25 +116,4 @@
             return se;
         }       
     }
-
-    SQLException _stopSlave(String slaveServerHost, int slaveServerPort,
-            String dbPath) 
-        throws SQLException
-    {
-        util.DEBUG("_stopSlave");
-        ClientDataSource ds = new org.apache.derby.jdbc.ClientDataSource();
-        ds.setDatabaseName(dbPath);
-        ds.setServerName(slaveServerHost);
-        ds.setPortNumber(slaveServerPort);
-        ds.setConnectionAttributes("stopSlave=true"
-                +useEncryption(false));
-        try {
-            Connection conn = ds.getConnection();
-            conn.close();
-            return null; // If successfull.
-        } catch (SQLException se) {
-            return se;
-        }       
-    }
-    
 }

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_3_p1.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_3_p1.java?rev=785131&r1=785130&r2=785131&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_3_p1.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_3_p1.java Tue Jun 16 09:50:21 2009
@@ -140,8 +140,11 @@
         // 1. separate test
         // slave: stopSlave
         assertException(
-            _stopSlave(slaveServerHost, slaveServerPort,
-                slaveDatabasePath + FS + slaveDbSubPath + FS + replicatedDb),
+            stopSlave(slaveServerHost,
+                      slaveServerPort,
+                      slaveDatabasePath,
+                      replicatedDb,
+                      true),
             "XRE41"); // SLAVE_OPERATION_DENIED_WHILE_CONNECTED // OK to continue
        
         // 2. separate test
@@ -149,8 +152,12 @@
         // master: stopMaster
         // slave: stopSlave
         assertException(
-            _stopSlave(masterServerHost, masterServerPort,
-                masterDatabasePath + FS + masterDbSubPath + FS + replicatedDb),
+            stopSlave(masterServerHost,
+                      masterServerPort,
+                      masterDatabasePath,
+                      masterDbSubPath,
+                      replicatedDb,
+                      true),
             "XRE40"); //  REPLICATION_NOT_IN_SLAVE_MODE // OK to continue
         assertException(
             _stopMaster(masterServerHost, masterServerPort,
@@ -166,8 +173,11 @@
                 slaveDatabasePath + FS + slaveDbSubPath + FS + replicatedDb, 
                 slaveServerHost, slaveServerPort);
         assertException(
-            _stopSlave(slaveServerHost, slaveServerPort,
-                slaveDatabasePath + FS + slaveDbSubPath + FS + replicatedDb),
+            stopSlave(slaveServerHost,
+                      slaveServerPort,
+                      slaveDatabasePath,
+                      replicatedDb,
+                      true),
             "XRE40"); // REPLICATION_NOT_IN_SLAVE_MODE // OK to continue
         /* showCurrentState("Post stopMaster, stopSlave", 0L,
             slaveDatabasePath + FS + slaveDbSubPath + FS + replicatedDb, 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_3_p5.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_3_p5.java?rev=785131&r1=785130&r2=785131&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_3_p5.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_3_p5.java Tue Jun 16 09:50:21 2009
@@ -41,6 +41,7 @@
 public class ReplicationRun_Local_3_p5 extends ReplicationRun_Local_3
 {
     
+
     /**
      * Creates a new instance of ReplicationRun_Local
      * @param testcaseName Identifying the test.
@@ -88,18 +89,14 @@
                 replicatedDb);
                 
         _killMasterServer(); // "Crash" master.
-        
-        Thread.sleep(5000L); // Need time to settle down if we had load.
-        // With this sleep we always have REPLICATION_SLAVE_SHUTDOWN_OK
-        String expected = "XRE42"; // REPLICATION_SLAVE_SHUTDOWN_OK
-        // if ( replicationTest != null ) expected = "XRE41"; // SLAVE_OPERATION_DENIED_WHILE_CONNECTED  = "XRE41" if had load and no sleep
-        assertException( 
-            _stopSlave(slaveServerHost, slaveServerPort, 
-                slaveDatabasePath +FS+ slaveDbSubPath +FS+ replicatedDb), // OK when master is gone.
-            expected);
-        
+
+        stopSlave(slaveServerHost,
+                  slaveServerPort,
+                  slaveDatabasePath,
+                  replicatedDb,
+                  false); // master server dead
+
         // Try to re-establish replication mode:
-        // No change. Thread.sleep(5000L); // Need time to settle down if we had load?
         masterServer = startServer(masterJvmVersion, derbyMasterVersion,
                 masterServerHost,
                 ALL_INTERFACES,
@@ -128,14 +125,8 @@
                 jvmVersion,
                 replicatedDb);
 
-        /* Slave server still running, so do not need: 
-        slaveServer = startServer(slaveJvmVersion, derbySlaveVersion,
-                slaveServerHost,
-                ALL_INTERFACES,
-                slaveServerPort,
-                slaveDbSubPath); */
+        /* Slave server still running, so no need to start slave server */
         
-        Thread.sleep(5000L); // Need time to settle down if we had load.
         startSlave(jvmVersion, replicatedDb, // should cause an address-already-in-use exception without the fix for DERBY-3878
                 slaveServerHost,             // Verified that we get 'Address already in use' and then hangs!
                 slaveServerPort,             // without the fix for DERBY-3878
@@ -152,7 +143,7 @@
                 slaveReplPort);
         // Should now be back in "normal" replication mode state.
         
-        assertSqlStateSlaveConn("XRE08"); // REPLICATION_SLAVE_STARTED_OK
+        assertSqlStateSlaveConn(REPLICATION_SLAVE_STARTED_OK);
         
         failOver(jvmVersion,
                 masterDatabasePath, masterDbSubPath, replicatedDb,

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_StateTest_part1_1.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_StateTest_part1_1.java?rev=785131&r1=785130&r2=785131&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_StateTest_part1_1.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_StateTest_part1_1.java Tue Jun 16 09:50:21 2009
@@ -142,168 +142,76 @@
     }
 
     private void _testPostStartedMasterAndSlave_StopSlave()
-            throws InterruptedException, SQLException
+            throws Exception
     {
-        String db = null;
-        String connectionURL = null;  
-        Connection conn = null;
-        
         // 1. stopSlave to slave with connection to master should fail.
-        db = slaveDatabasePath +FS+ReplicationRun.slaveDbSubPath +FS+ replicatedDb;
-        connectionURL = "jdbc:derby:"  
-                + "//" + slaveServerHost + ":" + slaveServerPort + "/"
-                + db
-                + ";stopSlave=true";
-        util.DEBUG("1. testPostStartedMasterAndSlave_StopSlave: " + connectionURL);
-        try
-        {
-            conn = DriverManager.getConnection(connectionURL);
-            util.DEBUG("Unexpectdly connected as: " + connectionURL);
-            assertTrue("Unexpectedly connected: " + connectionURL,false);
-        }
-        catch (SQLException se)
-        {
-            int ec = se.getErrorCode();
-            String ss = se.getSQLState();
-            String msg = ec + " " + ss + " " + se.getMessage();
-            BaseJDBCTestCase.assertSQLState(
-                connectionURL + " failed: ",
-                SLAVE_OPERATION_DENIED_WHILE_CONNECTED,
-                se);
-            util.DEBUG("1. Failed as expected: " + connectionURL +  " " + msg);
-        }
+        util.DEBUG("1. testPostStartedMasterAndSlave_StopSlave");
+
+        assertException(
+            stopSlave(slaveServerHost,
+                      slaveServerPort,
+                      slaveDatabasePath,
+                      replicatedDb,
+                      true),
+            SLAVE_OPERATION_DENIED_WHILE_CONNECTED);
+
         // Default replication test sequence still OK.
-        
+
         // 2. stopSlave to a master server should fail:
-        db = masterDatabasePath +FS+ReplicationRun.masterDbSubPath +FS+ replicatedDb;
-        connectionURL = "jdbc:derby:"  
-                + "//" + masterServerHost + ":" + masterServerPort + "/"
-                + db
-                + ";stopSlave=true";
-        util.DEBUG("2. testPostStartedMasterAndSlave_StopSlave: " + connectionURL);
-        try
-        {
-            conn = DriverManager.getConnection(connectionURL); // From anywhere against slaveServerHost?
-            util.DEBUG("Unexpectdly connected as: " + connectionURL);
-            // DERBY-???? - assertTrue("Unexpectedly connected: " + connectionURL,false);
-       }
-        catch (SQLException se)
-        {
-            int ec = se.getErrorCode();
-            String ss = se.getSQLState();
-            String msg = ec + " " + ss + " " + se.getMessage();
-            // SSQLCODE: -1, SQLSTATE: XRE40
-            BaseJDBCTestCase.assertSQLState(
-                connectionURL + " failed: ",
-                REPLICATION_NOT_IN_SLAVE_MODE,
-                se);
-            util.DEBUG("2. Failed as expected: " + connectionURL +  " " + msg);
-        }
+        util.DEBUG("2. testPostStartedMasterAndSlave_StopSlave");
+
+        assertException(
+            stopSlave(masterServerHost,
+                      masterServerPort,
+                      masterDatabasePath,
+                      masterDbSubPath,
+                      replicatedDb,
+                      true),
+            REPLICATION_NOT_IN_SLAVE_MODE);
+
         // Default replication test sequence still OK.
-        
+
         // Replication should still be up.
-        
+
         // Take down master - slave connection:
         killMaster(masterServerHost, masterServerPort);
-        
+
         // 3.  stopSlave on slave should now result in an exception stating that
         //     the slave database has been shutdown. A master shutdown results
         //     in a behaviour that is similar to what happens when a stopMaster
         //     is called.
-        db = slaveDatabasePath +FS+ReplicationRun.slaveDbSubPath +FS+ replicatedDb;
-        connectionURL = "jdbc:derby:"  
-                + "//" + slaveServerHost + ":" + slaveServerPort + "/"
-                + db
-                + ";stopSlave=true";
-        boolean stopSlaveCorrect = false;
-        util.DEBUG("3. testPostStartedMasterAndSlave_StopSlave: " + connectionURL);
-
-        // We use a loop below, to allow for intermediate states before the
-        // expected final state.
-        //
-        // If we get here quick enough we see these error states (in order):
-        //     a) SLAVE_OPERATION_DENIED_WHILE_CONNECTED
-        //     b) REPLICATION_SLAVE_SHUTDOWN_OK
-        //
-        // The final end state is expected to be REPLICATION_DB_NOT_BOOTED.
-        //
-        SQLException gotEx = null;
-        int tries = 20;
-
-        while (tries-- > 0) {
-            gotEx = null;
-
-            try {
-                // From anywhere against slaveServerHost?
-                conn = DriverManager.getConnection(connectionURL); 
-                util.DEBUG("Unexpectedly connected: " + connectionURL);
-                assertTrue("Unexpectedly connected: " + connectionURL,false);
-
-            } catch (SQLException se) {
-                if (se.getSQLState().
-                        equals(SLAVE_OPERATION_DENIED_WHILE_CONNECTED)) {
-                    // Try again, shutdown did not complete yet..
-                    gotEx = se;
-                    util.DEBUG
-                        ("got SLAVE_OPERATION_DENIED_WHILE_CONNECTED, sleep");
-                    Thread.sleep(1000L);
-                    continue;
-
-                } else if (se.getSQLState().
-                               equals(REPLICATION_SLAVE_SHUTDOWN_OK)) {
-                    // Try again, shutdown started but did not complete yet.
-                    gotEx = se;
-                    util.DEBUG("got REPLICATION_SLAVE_SHUTDOWN_OK, sleep..");
-                    Thread.sleep(1000L);
-                    continue;
-
-                } else if (se.getSQLState().equals(REPLICATION_DB_NOT_BOOTED)) {
-                    // All is fine, so proceed
-                    util.DEBUG("Got REPLICATION_DB_NOT_BOOTED as expected");
-                    stopSlaveCorrect = true;
-                    break;
-
-                } else {
-                    // Something else, so report.
-                    gotEx = se;
-                    break;
-                }
-            }
-        }
+        util.DEBUG("3. testPostStartedMasterAndSlave_StopSlave");
+
+        stopSlave(slaveServerHost,
+                  slaveServerPort,
+                  slaveDatabasePath,
+                  replicatedDb,
+                  false); // master server is dead
 
-        if (gotEx != null) {
-            // We did not get what we expected as the final state
-            // (REPLICATION_DB_NOT_BOOTED) in reasonable time, or we saw
-            // something that is not a legal intermediate state, so we fail
-            // now:
-            throw gotEx;
-        }
-        
         // Default replication test sequence will NOT be OK after this point.
-        
-        if ( stopSlaveCorrect )
-        {
-            // 4. Try a normal connection:
-            connectionURL = "jdbc:derby:"
-                    + "//" + slaveServerHost + ":" + slaveServerPort + "/"
-                    + db;
-            util.DEBUG("4. testPostStartedMasterAndSlave_StopSlave: " + connectionURL);
-
-            try
-            {
-                conn = DriverManager.getConnection(connectionURL);
-                util.DEBUG("4. Connected as expected: " + connectionURL);
-            }
-            catch (SQLException se)
-            {
-                int ec = se.getErrorCode();
-                String ss = se.getSQLState();
-                String msg = ec + " " + ss + " " + se.getMessage();
-                util.DEBUG("4. Unexpectedly failed to connect: " + connectionURL +  " " + msg);
-                assertTrue("Unexpectedly failed to connect: " + connectionURL +  " " + msg, false);
-            }
+
+        // 4. Try a normal connection:
+        String db = slaveDatabasePath + FS + slaveDbSubPath + FS + replicatedDb;
+
+        String connectionURL = "jdbc:derby:"
+            + "//" + slaveServerHost + ":" + slaveServerPort + "/"
+            + db;
+
+        util.DEBUG("4. testPostStartedMasterAndSlave_StopSlave: " +
+                   connectionURL);
+
+        try {
+            DriverManager.getConnection(connectionURL).close();
+            util.DEBUG("4. Connected as expected: " + connectionURL);
+
+        } catch (SQLException se) {
+            int ec = se.getErrorCode();
+            String ss = se.getSQLState();
+            String msg = ec + " " + ss + " " + se.getMessage();
+            util.DEBUG("4. Unexpectedly failed to connect: " +
+                       connectionURL +  " " + msg);
+            assertTrue("Unexpectedly failed to connect: " +
+                       connectionURL +  " " + msg, false);
         }
     }
-
-    
 }

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_StateTest_part2.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_StateTest_part2.java?rev=785131&r1=785130&r2=785131&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_StateTest_part2.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_StateTest_part2.java Tue Jun 16 09:50:21 2009
@@ -191,7 +191,7 @@
     }
 
     private void _testPreStoppedSlave(Connection mConn)
-        throws SQLException
+        throws Exception
     {
         util.DEBUG("_testPreStoppedSlave");
         /*  
@@ -211,9 +211,9 @@
                 "XRE09");
 
         assertException(
-                _stopSlave(slaveServerHost,slaveServerPort,
-                    slaveDatabasePath, replicatedDb,
-                    slaveReplPort),
+                stopSlave(slaveServerHost,slaveServerPort,
+                          slaveDatabasePath, replicatedDb,
+                          true),
                 "XRE40");
         
         assertException(
@@ -309,29 +309,6 @@
         }
     }
 
-    SQLException _stopSlave(String slaveServerHost, int slaveServerPort, 
-            String slaveDatabasePath, String replicatedDb, 
-            int slaveReplPort)
-    {
-        String db = slaveDatabasePath +FS+ReplicationRun.slaveDbSubPath +FS+ replicatedDb;
-        String connectionURL = "jdbc:derby:"  
-                + "//" + slaveServerHost + ":" + slaveServerPort + "/"
-                + db
-                + ";stopSlave=true"
-                + ";slaveHost=" + slaveServerHost 
-                + ";slavePort=" + slaveReplPort;
-        util.DEBUG(connectionURL);
-        try
-        {
-            Connection conn = DriverManager.getConnection(connectionURL);
-            util.DEBUG("stopSlave Unexpectedly connected as: " + connectionURL);
-            return new SQLException("stopSlave Unexpectedly connected");
-        }
-        catch (SQLException se)
-        {
-            return se;
-        }
-    }
 
     SQLException _failOver(String serverHost, int serverPort, 
             String databasePath, String dbSubPath, String replicatedDb)