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 oy...@apache.org on 2008/02/29 17:10:27 UTC

svn commit: r632371 [4/5] - in /db/derby/code/trunk/java/testing: ./ org/apache/derbyTesting/functionTests/tests/replicationTests/

Added: 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=632371&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/StandardTests.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/StandardTests.java Fri Feb 29 08:10:21 2008
@@ -0,0 +1,188 @@
+/*
+
+Derby - Class org.apache.derbyTesting.functionTests.tests.replicationTests.StandardTests
+
+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 java.sql.SQLException;
+import java.sql.Statement;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.derbyTesting.functionTests.suites.AllPackages;
+import org.apache.derbyTesting.functionTests.suites.EncryptionSuite;
+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.CleanDatabaseTestSetup;
+import org.apache.derbyTesting.junit.JDBCClient;
+import org.apache.derbyTesting.junit.TestConfiguration;
+
+/**
+ * Wrap some JUnit tests in TestConfiguration.existingServerSuite() to
+ * run these tests against an already started server on a given host
+ * using a given port.
+ *
+ * Initially used in testing replication functionality - DERBY-2872.
+ */
+
+public class StandardTests extends BaseJDBCTestCase
+{
+    
+    /* Creates a new instance of StandardTests */
+    public StandardTests(String testcaseName)
+    {
+        super(testcaseName);
+    }
+    
+    /*
+     * Template  which adds this class to the *existing server* suite.
+     */
+    /* BEGIN Template
+    public static Test simpleTest(String serverHost, int serverPort)
+    {
+        Test t = TestConfiguration.existingServerSuite(SimpleTest.class,false,serverHost,serverPort);
+        System.out.println("*** Done TestConfiguration.defaultExistingServerSuite(SimpleTest.class,false)");
+        return t;
+        
+        // /* Common pattern as below, but since we do not need to decorate her, just skip. 
+        CleanDatabaseTestSetup cdts = 
+                new CleanDatabaseTestSetup(t, 
+                        true,// Use networkclient when running setUp/decorateSQL
+                        serverHost,
+                        serverPort
+                    ) {
+            public void decorateSQL(Statement s)
+                    throws SQLException {
+                s.executeUpdate(".....");
+                .  
+                .  
+                }            
+        };
+        return cdts;
+         //
+    }
+    END Template*/
+
+
+     /*
+      * Adds this class to the *existing server* suite.
+      */
+    public static Test simpleTest(String serverHost, int serverPort)
+    {
+        return TestConfiguration.existingServerSuite(SimpleTest.class,
+                false,serverHost,serverPort);
+        // return DatabasePropertyTestSetup.setLockTimeouts(suite,3,3); ??
+    }
+    
+    public static Test prepareStatementTest(String hostName, int portNo)
+    {
+        return TestConfiguration.existingServerSuite(PrepareStatementTest.class,
+                false,hostName, portNo);
+    }
+
+    public static Test ansiTrimTest(String serverHost, int serverPort)
+    {
+        Test t = TestConfiguration.existingServerSuite(AnsiTrimTest.class, false, // false: because adds clean/decorate below
+                serverHost,serverPort); 
+        CleanDatabaseTestSetup cdts = 
+                new CleanDatabaseTestSetup(t, 
+                        true,// Use networkclient when running setUp/decorateSQL
+                        serverHost,
+                        serverPort
+                    ) 
+        {
+            public void decorateSQL(Statement s)
+                    throws SQLException 
+            {
+                AnsiTrimTest.decorate(s);
+            }            
+        };
+        return cdts;
+    }
+    
+    public static Test createTableFromQueryTest(String serverHost, int serverPort)
+    {
+        Test t = TestConfiguration.existingServerSuite(CreateTableFromQueryTest.class, false, // false: because adds clean/decorate below
+                serverHost,serverPort);
+        CleanDatabaseTestSetup cdts = 
+                new CleanDatabaseTestSetup(t, 
+                        true,// Use networkclient when running setUp/decorateSQL
+                        serverHost,
+                        serverPort
+                    ) 
+        {
+            protected void decorateSQL(Statement stmt) 
+                throws SQLException
+            {
+                CreateTableFromQueryTest.decorate(stmt);
+            }
+        };
+        return cdts;
+    }
+    
+    /* All the above are pure Tests. To handle suites
+     * we will have to duplicate the .suite() structure starting at .suites.all!
+     *
+     * The following is WORK IN PROGRESS: NOT READY FOR USE! FIXME!
+     */
+    public static Test all(String serverHost, int serverPort) 
+        throws Exception 
+    {
+
+        TestSuite suite = new TestSuite("All_"+serverHost+":"+serverPort);
+
+        // All package tests 
+        // This won't work as there are no 'testXXXX' methods 
+        // in AllPackages. Must create a suite() following the pattern of suites.All suite().
+        // This is probably correct anyway as we presumably won't use all
+        // tests in the replication testing?
+        // Problem is we get a parallell structure which needs maintenance!
+        
+        suite.addTest(TestConfiguration.existingServerSuite(AllPackages.class, false, // false: because adds clean/decorate below
+                serverHost,serverPort));
+        // Instead:
+        suite.addTest(TestConfiguration.existingServerSuite(allPackagesSuite(), false, // false: because adds clean/decorate below
+                serverHost,serverPort));
+        
+        // Encrypted tests
+        suite.addTest(TestConfiguration.existingServerSuite(EncryptionSuite.class, false, // false: because adds clean/decorate below
+                serverHost,serverPort));
+        CleanDatabaseTestSetup cdts = 
+                new CleanDatabaseTestSetup(suite, 
+                        true,// Use networkclient when running setUp/decorateSQL
+                        serverHost,
+                        serverPort
+                    ) 
+        {
+            public void decorateSQL(Statement s)
+                    throws SQLException {
+                // decorate(s);
+            }            
+        };
+        return cdts;
+    }
+
+    private static Class allPackagesSuite()
+    {
+        return null;
+    }
+}

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

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPostStartedMasterAndSlave_Failover.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPostStartedMasterAndSlave_Failover.java?rev=632371&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPostStartedMasterAndSlave_Failover.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPostStartedMasterAndSlave_Failover.java Fri Feb 29 08:10:21 2008
@@ -0,0 +1,161 @@
+/*
+ 
+Derby - Class org.apache.derbyTesting.functionTests.tests.replicationTests.TestPostStartedMasterAndSlave_Failover
+ 
+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 java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.TestConfiguration;
+
+/**
+ * Test that failover is allowed against master but not against slave.
+ */
+public class TestPostStartedMasterAndSlave_Failover extends ClientRunner
+{
+    private static ReplicationRun repRun = new ReplicationRun("TestPostStartedMasterAndSlave_Failover");
+    
+    public TestPostStartedMasterAndSlave_Failover(String testcaseName)
+    {
+        super(testcaseName);
+    }
+    
+    public static Test suite()
+        throws Exception
+    {
+        System.out.println("**** TestPostStartedMasterAndSlave_Failover.suite()");
+        
+        initEnvironment();
+        
+        // String masterHostName = System.getProperty("test.serverHost", "localhost");
+        // int masterPortNo = Integer.parseInt(System.getProperty("test.serverPort", "1527"));
+        
+        TestSuite suite = new TestSuite("TestPostStartedMasterAndSlave_Failover");
+                
+        suite.addTest(TestPostStartedMasterAndSlave_Failover.suite(slaveServerHost, slaveServerPort)); // master?
+        System.out.println("*** Done suite.addTest(TestPostStartedMasterAndSlave_Failover.suite())");
+        
+        return (Test)suite;
+    }
+
+    /**
+     * Adds this class to the *existing server* suite.
+     */
+    public static Test suite(String serverHost, int serverPort)
+    {
+        System.out.println("*** TestPostStartedMasterAndSlave_Failover.suite(serverHost,serverPort)");
+     
+        Test t = TestConfiguration.existingServerSuite(TestPostStartedMasterAndSlave_Failover.class,false,serverHost,serverPort);
+        System.out.println("*** Done TestConfiguration.existingServerSuite(TestPostStartedMasterAndSlave_Failover.class,false,serverHost,serverPort)");
+        return t;
+   }
+    
+    /**
+     *
+     *
+     * @throws SQLException, IOException, InterruptedException
+     */
+    public void testFailOver()
+    throws SQLException, IOException, InterruptedException
+    {
+        System.out.println("**** TestPostStartedMasterAndSlave_Failover.testFailOver() "
+                +getTestConfiguration().getJDBCClient().getJDBCDriverName());
+        
+        Connection conn = null;
+        String db = slaveDatabasePath +"/"+ReplicationRun.slaveDbSubPath +"/"+ replicatedDb;
+        String connectionURL = "jdbc:derby:"  
+                + "//" + slaveServerHost + ":" + slaveServerPort + "/"
+                + db
+                + ";failover=true";
+        System.out.println(connectionURL);
+        try
+        {
+            // System.out.println("**** Will hang with PoC code!! so skip... ****");System.out.flush();
+            if ( true ) // "if ( !PoC )""
+            {
+                conn = DriverManager.getConnection(connectionURL); // From anywhere against slaveServerHost?
+                System.out.println("Successfully connected as: " + connectionURL);
+                assertTrue("Successfully connected as: " + connectionURL, false);
+            }
+            else
+            {
+                // PoC "simulates" failover doing stop/kill master
+                repRun.stopServer(jvmVersion, derbyVersion,
+                        masterServerHost, masterServerPort);
+            }
+        }
+        catch (SQLException se)
+        {
+            int ec = se.getErrorCode();
+            String ss = se.getSQLState();
+            String msg = "As expected: Failover on slave should fail: " + ec + " " + ss + " " + se.getMessage();
+            System.out.println(msg);
+        }
+        
+        // Failover on master should succeed:
+        db = masterDatabasePath +"/"+ReplicationRun.masterDbSubPath +"/"+ replicatedDb;
+        connectionURL = "jdbc:derby:"  
+                + "//" + masterServerHost + ":" + masterServerPort + "/"
+                + db
+                + ";failover=true";
+        System.out.println(connectionURL);
+        try
+        {
+            // System.out.println("**** Will hang with PoC code!! so skip... ****");System.out.flush();
+            if ( true ) // "if ( !PoC )""
+            {
+                conn = DriverManager.getConnection(connectionURL); // From anywhere against masterServerHost?
+                System.out.println("Unexpectedly connected as: " + connectionURL);
+                assertTrue("Unexpectedly connected as: " + connectionURL, false);
+            }
+            else
+            {
+                // PoC "simulates" failover doing stop/kill master
+                repRun.stopServer(jvmVersion, derbyVersion,
+                        masterServerHost, masterServerPort);
+            }
+        }
+        catch (SQLException se)
+        {
+            int ec = se.getErrorCode();
+            String ss = se.getSQLState();
+            String msg = ec + " " + ss + " " + se.getMessage();
+            // Failover OK: SQLCODE: -1, SQLSTATE: XRE20
+            assertSQLState(msg, "XRE20", se);
+            System.out.println("Failover on master succeeded: " + connectionURL + " " + msg);
+        }
+        
+                
+    }
+    
+    public void verify()
+    throws SQLException, IOException, InterruptedException
+    {
+
+    }
+}

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

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPostStartedMasterAndSlave_StopMaster.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPostStartedMasterAndSlave_StopMaster.java?rev=632371&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPostStartedMasterAndSlave_StopMaster.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPostStartedMasterAndSlave_StopMaster.java Fri Feb 29 08:10:21 2008
@@ -0,0 +1,189 @@
+/*
+ 
+Derby - Class org.apache.derbyTesting.functionTests.tests.replicationTests.TestPostStartedMasterAndSlave
+ 
+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 java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.TestConfiguration;
+
+/**
+ * Test behaviour when doing stopMaster after master and slave 
+ * has got into replication mode.
+ */
+public class TestPostStartedMasterAndSlave_StopMaster extends ClientRunner
+{
+    
+    public TestPostStartedMasterAndSlave_StopMaster(String testcaseName)
+    {
+        super(testcaseName);
+    }
+    
+    public static Test suite()
+        throws Exception
+    {
+        System.out.println("**** TestPostStartedMasterAndSlave_StopMaster.suite()");
+        
+        initEnvironment();
+        
+        // String masterHostName = System.getProperty("test.serverHost", "localhost");
+        // int masterPortNo = Integer.parseInt(System.getProperty("test.serverPort", "1527"));
+        
+        TestSuite suite = new TestSuite("TestPostStartedMasterAndSlave_StopMaster");
+                
+        suite.addTest(TestPostStartedMasterAndSlave_StopMaster.suite(slaveServerHost, slaveServerPort)); // master?
+        System.out.println("*** Done suite.addTest(TestPostStartedMasterAndSlave_StopMaster.suite())");
+        
+        return (Test)suite;
+    }
+
+    /**
+     * Adds this class to the *existing server* suite.
+     */
+    public static Test suite(String serverHost, int serverPort)
+    {
+        System.out.println("*** TestPostStartedMasterAndSlave_StopMaster.suite(serverHost,serverPort)");
+     
+        Test t = TestConfiguration.existingServerSuite(TestPostStartedMasterAndSlave_StopMaster.class,false,serverHost,serverPort);
+        System.out.println("*** Done TestConfiguration.existingServerSuite(TestPostStartedMasterAndSlave_StopMaster.class,false,serverHost,serverPort)");
+        return t;
+   }
+
+    /**
+     *
+     *
+     * @throws SQLException, IOException, InterruptedException
+     */
+    public void testStopMaster()
+    throws SQLException, IOException, InterruptedException
+    {
+        System.out.println("**** TestPostStartedMasterAndSlave_StopMaster.testStopMaster() "+
+                getTestConfiguration().getJDBCClient().getJDBCDriverName());
+        
+        Connection conn = null;
+        String db = null;
+        String connectionURL = null;
+        
+        // 1. Add attempt to perform stopMaster on slave. Should fail.
+        db = slaveDatabasePath +"/"+ReplicationRun.slaveDbSubPath +"/"+ replicatedDb;
+        connectionURL = "jdbc:derby:"  
+                + "//" + slaveServerHost + ":" + slaveServerPort + "/"
+                + db
+                + ";stopMaster=true";
+        System.out.println("1. " + connectionURL);
+        try
+        {
+            conn = DriverManager.getConnection(connectionURL); // From anywhere against masterServerHost?
+            System.out.println("Unexpectedly connected as: " + connectionURL);
+            assertTrue("Unexpectedly connected as: " + connectionURL,false);
+        }
+        catch (SQLException se)
+        {
+            int ec = se.getErrorCode();
+            String ss = se.getSQLState();
+            String msg = ec + " " + ss + " " + se.getMessage();
+            //  SQLCODE: -1, SQLSTATE: 08004
+            assertSQLState(msg, "08004", se);
+            System.out.println("stopMaster on slave failed as expected: " + connectionURL + " " + msg);
+        }
+        
+        // 2. stopMaster on master: OK
+        db = masterDatabasePath +"/"+ReplicationRun.masterDbSubPath +"/"+ replicatedDb;
+        connectionURL = "jdbc:derby:"  
+                + "//" + masterServerHost + ":" + masterServerPort + "/"
+                + db
+                + ";stopMaster=true";
+        System.out.println("2. " + connectionURL);
+        try
+        {
+            conn = DriverManager.getConnection(connectionURL); // From anywhere against masterServerHost?
+            System.out.println("Connected as expected: " + connectionURL);
+        }
+        catch (SQLException se)
+        {
+            int ec = se.getErrorCode();
+            String ss = se.getSQLState();
+            String msg = ec + " " + ss + " " + se.getMessage();
+            assertTrue("stopMaster on master failed: " + connectionURL + " " + msg,false);
+            System.out.println("stopMaster on master failed: " + connectionURL + " " + msg);
+        }
+        
+        // 3. stopMaster on slave which now is in non-replicating mode should fail.
+        db = slaveDatabasePath +"/"+ReplicationRun.slaveDbSubPath +"/"+ replicatedDb;
+        connectionURL = "jdbc:derby:"  
+                + "//" + slaveServerHost + ":" + slaveServerPort + "/"
+                + db
+                + ";stopMaster=true";
+        System.out.println("3. " + connectionURL);
+        try
+        {
+            conn = DriverManager.getConnection(connectionURL); // From anywhere against masterServerHost?
+            System.out.println("Unexpectedly connected: " + connectionURL);
+            assertTrue("Unexpectedly connected: " + connectionURL,false);
+        }
+        catch (SQLException se)
+        {
+            int ec = se.getErrorCode();
+            String ss = se.getSQLState();
+            String msg = ec + " " + ss + " " + se.getMessage();
+            System.out.println("DERBY-????: stopMaster on slave failed: " + connectionURL + " " + msg); // FIXME when DERBY-????
+            //  DERBY-????: SQLCODE: 40000, SQLSTATE: 08004
+            assertSQLState(msg, "08004", se); // assertTrue("stopMaster on slave failed: " + connectionURL + " " + msg, false);
+        }
+        
+        // 4. Attempt to do stopmaster on master which now is in non-replicating mode should fail.
+        db = masterDatabasePath +"/"+ReplicationRun.masterDbSubPath +"/"+ replicatedDb;
+        connectionURL = "jdbc:derby:"  
+                + "//" + masterServerHost + ":" + masterServerPort + "/"
+                + db
+                + ";stopMaster=true";
+        System.out.println("4. " + connectionURL);
+        try
+        {
+            conn = DriverManager.getConnection(connectionURL); // From anywhere against masterServerHost?
+            System.out.println("DERBY-????: Unexpectedly connected: " + connectionURL); // FIXME when DERBY-????
+            // DERBY-???? - assertTrue("Unexpectedly connected: " + connectionURL,false);
+        }
+        catch (SQLException se)
+        {
+            int ec = se.getErrorCode();
+            String ss = se.getSQLState();
+            String msg = ec + " " + ss + " " + se.getMessage();
+            assertTrue("stopMaster on server not in master mode failed as expected: " + connectionURL + " " + msg,false);
+            System.out.println("stopMaster on server not in master mode failed as expected: " + connectionURL + " " + msg);
+        }
+        
+    }
+    
+    public void verify()
+    throws SQLException, IOException, InterruptedException
+    {
+
+    }
+}

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

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPostStartedMasterAndSlave_StopSlave.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPostStartedMasterAndSlave_StopSlave.java?rev=632371&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPostStartedMasterAndSlave_StopSlave.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPostStartedMasterAndSlave_StopSlave.java Fri Feb 29 08:10:21 2008
@@ -0,0 +1,222 @@
+/*
+ 
+Derby - Class org.apache.derbyTesting.functionTests.tests.replicationTests.TestPostStartedMasterAndSlave
+ 
+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 java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.TestConfiguration;
+
+/**
+ * Test behaviour when doing stopSlave after master and slave 
+ * has got into replication mode.
+ */
+public class TestPostStartedMasterAndSlave_StopSlave extends ClientRunner
+{
+    
+    private static ReplicationRun repRun = new ReplicationRun("TestPostStartedMasterAndSlave_StopSlave");
+
+    public TestPostStartedMasterAndSlave_StopSlave(String testcaseName)
+    {
+        super(testcaseName);
+    }
+    
+    public static Test suite()
+        throws Exception
+    {
+        System.out.println("**** TestPostStartedMasterAndSlave_StopSlave.suite()");
+        
+        initEnvironment();
+        
+        // String masterHostName = System.getProperty("test.serverHost", "localhost");
+        // int masterPortNo = Integer.parseInt(System.getProperty("test.serverPort", "1527"));
+        
+        TestSuite suite = new TestSuite("TestPostStartedMasterAndSlave_StopSlave");
+                
+        suite.addTest(TestPostStartedMasterAndSlave_StopSlave.suite(slaveServerHost, slaveServerPort)); // master?
+        System.out.println("*** Done suite.addTest(TestPostStartedMasterAndSlave_StopSlave.suite())");
+        
+        return (Test)suite;
+    }
+
+    /**
+     * Adds this class to the *existing server* suite.
+     */
+    public static Test suite(String serverHost, int serverPort)
+    {
+        System.out.println("*** TestPostStartedMasterAndSlave_StopSlave.suite(serverHost,serverPort)");
+     
+        Test t = TestConfiguration.existingServerSuite(TestPostStartedMasterAndSlave_StopSlave.class,false,serverHost,serverPort);
+        System.out.println("*** Done TestConfiguration.existingServerSuite(TestPostStartedMasterAndSlave_StopSlave.class,false,serverHost,serverPort)");
+        return t;
+   }
+    
+    /**
+     *
+     *
+     * @throws SQLException, IOException, InterruptedException
+     */
+    public void testStopSlave()
+    throws SQLException, IOException, InterruptedException
+    {
+        System.out.println("**** TestPostStartedMasterAndSlave_StopSlave.testStopSlave "+
+                getTestConfiguration().getJDBCClient().getJDBCDriverName());
+        
+        String db = null;
+        String connectionURL = null;  
+        Connection conn = null;
+        
+        // 1. stopSlave to slave with connection to master should fail.
+        db = slaveDatabasePath +"/"+ReplicationRun.slaveDbSubPath +"/"+ replicatedDb;
+        connectionURL = "jdbc:derby:"  
+                + "//" + slaveServerHost + ":" + slaveServerPort + "/"
+                + db
+                + ";stopSlave=true";
+        System.out.println("1. " + connectionURL);
+        try
+        {
+            if ( true ) // "if ( !PoC )""
+            {
+                conn = DriverManager.getConnection(connectionURL); // From anywhere against slaveServerHost?
+                System.out.println("Unexpectdly connected as: " + connectionURL);
+                // DERBY-???? - assertTrue("Unexpectedly connected: " + connectionURL,false);
+            }
+            else
+            {
+                // System.out.println("**** Will hang with PoC code!! so skip... ****");System.out.flush();
+            }
+        }
+        catch (SQLException se)
+        {
+            int ec = se.getErrorCode();
+            String ss = se.getSQLState();
+            String msg = ec + " " + ss + " " + se.getMessage();
+            // SQLCODE: -1, SQLSTATE: XRE41
+            assertSQLState(connectionURL +  " failed: ", "XRE41", se);
+            System.out.println("1. Failed as expected: " + connectionURL +  " " + msg);
+        }
+        
+        // 2. stopSlave to a master server should fail:
+        db = masterDatabasePath +"/"+ReplicationRun.masterDbSubPath +"/"+ replicatedDb;
+        connectionURL = "jdbc:derby:"  
+                + "//" + masterServerHost + ":" + masterServerPort + "/"
+                + db
+                + ";stopSlave=true";
+        System.out.println("2. " + connectionURL);
+        try
+        {
+            if ( true ) // "if ( !PoC )""
+            {
+                conn = DriverManager.getConnection(connectionURL); // From anywhere against slaveServerHost?
+                System.out.println("Unexpectdly connected as: " + connectionURL);
+                // DERBY-???? - assertTrue("Unexpectedly connected: " + connectionURL,false);
+            }
+            else
+            {
+                // System.out.println("**** Will hang with PoC code!! so skip... ****");System.out.flush();
+            }
+        }
+        catch (SQLException se)
+        {
+            int ec = se.getErrorCode();
+            String ss = se.getSQLState();
+            String msg = ec + " " + ss + " " + se.getMessage();
+            // SSQLCODE: -1, SQLSTATE: XRE40
+            assertSQLState(connectionURL +  " failed: ", "XRE40", se);
+            System.out.println("2. Failed as expected: " + connectionURL +  " " + msg);
+        }
+        
+        // Replication should still be up.
+        
+        // Take down master - slave connection:
+        // By OS kill:
+        repRun.killMaster(masterServerHost, masterServerPort);
+        
+        // 3.  stopSlave on slave should now be allowed. Observe that the database shall be shutdown.
+        db = slaveDatabasePath +"/"+ReplicationRun.slaveDbSubPath +"/"+ replicatedDb;
+        connectionURL = "jdbc:derby:"  
+                + "//" + slaveServerHost + ":" + slaveServerPort + "/"
+                + db
+                + ";stopSlave=true";
+        boolean stopSlaveCorrect = false;
+        System.out.println("3. " + connectionURL);
+        try
+        {
+            if ( true ) // "if ( !PoC )""
+            {
+                conn = DriverManager.getConnection(connectionURL); // From anywhere against slaveServerHost?
+                System.out.println("Unexpectedly connected: " + connectionURL);
+                assertTrue("Unexpectedly connected: " + connectionURL,false);
+            }
+            else
+            {
+                // System.out.println("**** Will hang with PoC code!! so skip... ****");System.out.flush();
+            }
+        }
+        catch (SQLException se)
+        {
+            int ec = se.getErrorCode();
+            String ss = se.getSQLState();
+            String msg = ec + " " + ss + " " + se.getMessage();
+            // SQLCODE: -1, SQLSTATE: XRE41, SQLERRMC: XRE41 // db is shut down.
+            assertSQLState(connectionURL +  " failed: ", "XRE41", se);
+            System.out.println("3. Failed as expected: " + connectionURL +  " " + msg);
+            stopSlaveCorrect = true;
+        }
+        
+        if ( stopSlaveCorrect )
+        {
+            // 4. Try a normal connection:
+            connectionURL = "jdbc:derby:"
+                    + "//" + slaveServerHost + ":" + slaveServerPort + "/"
+                    + db;
+           System.out.println("4. " + connectionURL);
+            try
+            {
+                conn = DriverManager.getConnection(connectionURL); // From anywhere against slaveServerHost?
+                System.out.println("4. Connected as expected: " + connectionURL);
+            }
+            catch (SQLException se)
+            {
+                int ec = se.getErrorCode();
+                String ss = se.getSQLState();
+                String msg = ec + " " + ss + " " + se.getMessage();
+                System.out.println("DERBY-???: 4. Unexpectedly failed to connect: " + connectionURL +  " " + msg);
+                // DERBY-???: assertTrue("Unexpectedly failed to connect: " + connectionURL +  " " + msg, false);
+            }
+        }
+    
+    }
+    
+    public void verify()
+    throws SQLException, IOException, InterruptedException
+    {
+
+    }
+}

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

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPostStoppedSlaveServer.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPostStoppedSlaveServer.java?rev=632371&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPostStoppedSlaveServer.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPostStoppedSlaveServer.java Fri Feb 29 08:10:21 2008
@@ -0,0 +1,122 @@
+/*
+ 
+Derby - Class org.apache.derbyTesting.functionTests.tests.replicationTests.TestPostStoppedSlaveServer
+ 
+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 java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.TestConfiguration;
+
+/**
+ * Test behaviour of master after slave server is stopped.
+ */
+public class TestPostStoppedSlaveServer extends ClientRunner
+{
+    
+    public TestPostStoppedSlaveServer(String testcaseName)
+    {
+        super(testcaseName);
+    }
+    
+    public static Test suite()
+        throws Exception
+    {
+        System.out.println("**** TestPostStoppedSlaveServer.suite()");
+        
+        initEnvironment();
+        
+        // String masterHostName = System.getProperty("test.serverHost", "localhost");
+        // int masterPortNo = Integer.parseInt(System.getProperty("test.serverPort", "1527"));
+        
+        TestSuite suite = new TestSuite("TestPostStoppedSlaveServer");
+                
+        suite.addTest(TestPostStoppedSlaveServer.suite(slaveServerHost, slaveServerPort));
+        System.out.println("*** Done suite.addTest(TestPostStoppedSlaveServer.suite())");
+        
+        return (Test)suite;
+    }
+
+    /**
+     * Adds this class to the *existing server* suite.
+     */
+    public static Test suite(String serverHost, int serverPort)
+    {
+        System.out.println("*** TestPostStoppedSlaveServer.suite(serverHost,serverPort)");
+     
+        Test t = TestConfiguration.existingServerSuite(TestPostStoppedSlaveServer.class,false,serverHost,serverPort);
+        System.out.println("*** Done TestConfiguration.existingServerSuite(TestPostStoppedSlaveServer.class,false,serverHost,serverPort)");
+        return t;
+   }
+
+    
+    /**
+     *
+     *
+     * @throws SQLException, IOException, InterruptedException
+     */
+    public void test()
+    throws SQLException, IOException, InterruptedException
+    {
+        System.out.println("**** EMPTY!!! TestPostStoppedSlaveServer.test() "+
+                getTestConfiguration().getJDBCClient().getJDBCDriverName());
+        
+        /*
+        Connection conn = null;
+        String db = slaveDatabasePath +"/"+ReplicationRun.slaveDbSubPath +"/"+ replicatedDb;
+        String connectionURL = "jdbc:derby:"  
+                + "//" + slaveServerHost + ":" + slaveServerPort + "/"
+                + db
+                + ";startMaster=true"
+                + ";slavehost=" + slaveServerHost 
+                + ";slaveport=" + slaveServerPort;
+        System.out.println(connectionURL);
+        // First StartSlave connect ok:
+        try
+        {
+            conn = DriverManager.getConnection(connectionURL);
+            System.out.println("1. Successfully connected as: " + connectionURL);
+        }
+        catch (SQLException se)
+        {
+            int ec = se.getErrorCode();
+            String ss = se.getSQLState();
+            String msg = ec + " " + ss + " " + se.getMessage();
+            System.out.println(msg);
+            throw se; // FIXME!?
+        }
+         */
+        
+    }
+    
+    public void verifyTest()
+    throws SQLException, IOException, InterruptedException
+    {
+
+    }
+}

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

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPreInitSlave.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPreInitSlave.java?rev=632371&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPreInitSlave.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPreInitSlave.java Fri Feb 29 08:10:21 2008
@@ -0,0 +1,147 @@
+/*
+ 
+Derby - Class org.apache.derbyTesting.functionTests.tests.replicationTests.TestPreInitSlave
+ 
+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 java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.TestConfiguration;
+
+/**
+ * Test behaviour of stopMaster and stopSlave on a system
+ * before the slave db is copied in.
+ */
+public class TestPreInitSlave extends ClientRunner
+{
+    
+    public TestPreInitSlave(String testcaseName)
+    {
+        super(testcaseName);
+    }
+    
+    public static Test suite()
+        throws Exception
+    {
+        System.out.println("**** TestPreInitSlave.suite()");
+        
+        initEnvironment();
+        
+        // String masterHostName = System.getProperty("test.serverHost", "localhost");
+        // int masterPortNo = Integer.parseInt(System.getProperty("test.serverPort", "1527"));
+        
+        TestSuite suite = new TestSuite("TestPreInitSlave");
+                
+        suite.addTest(TestPreInitSlave.suite(slaveServerHost, slaveServerPort));
+        System.out.println("*** Done suite.addTest(TestPreInitSlave.suite())");
+        
+        return (Test)suite;
+    }
+
+    /**
+     * Adds this class to the *existing server* suite.
+     */
+    public static Test suite(String serverHost, int serverPort)
+    {
+        System.out.println("*** TestPreInitSlave.suite(serverHost,serverPort)");
+     
+        Test t = TestConfiguration.existingServerSuite(TestPreInitSlave.class,false,serverHost,serverPort);
+        System.out.println("*** Done TestConfiguration.existingServerSuite(TestPreInitSlave.class,false,serverHost,serverPort)");
+        return t;
+   }
+
+    
+    /**
+     *
+     *
+     * @throws SQLException, IOException, InterruptedException
+     */
+    public void test()
+    throws SQLException, IOException, InterruptedException
+    {
+        System.out.println("**** TestPreInitSlave.testStartSlaveConnect_OK() "+
+                getTestConfiguration().getJDBCClient().getJDBCDriverName());
+        String db = null;
+        String connectionURL = null;
+        Connection conn = null;
+        
+        // 1.  stopMaster on master: fail
+        db = masterDatabasePath +"/"+ReplicationRun.masterDbSubPath +"/"+ replicatedDb;
+        connectionURL = "jdbc:derby:"  
+                + "//" + masterServerHost + ":" + masterServerPort + "/"
+                + db
+                + ";stopMaster=true";
+        System.out.println("1. " + connectionURL);
+        try
+        {
+            conn = DriverManager.getConnection(connectionURL); // From anywhere against masterServerHost?
+            System.out.println("Unexpectedly connected: " + connectionURL);
+            assertTrue("Unexpectedly connected: " + connectionURL,false);
+        }
+        catch (SQLException se)
+        {
+            int ec = se.getErrorCode();
+            String ss = se.getSQLState();
+            String msg = ec + " " + ss + " " + se.getMessage();
+            // SQLCODE: -1, SQLSTATE: XRE07
+            assertSQLState("stopMaster on master failed: " + connectionURL + " " + msg, "XRE07", se);
+            System.out.println("stopMaster on master failed as expected: " + connectionURL + " " + msg);
+        }
+        
+        // 2. stopSlave on slave: fail
+        db = slaveDatabasePath +"/"+ReplicationRun.slaveDbSubPath +"/"+ replicatedDb;
+        connectionURL = "jdbc:derby:"  
+                + "//" + slaveServerHost + ":" + slaveServerPort + "/"
+                + db
+                + ";stopSlave=true";
+        System.out.println("2. " + connectionURL);
+        try
+        {
+            conn = DriverManager.getConnection(connectionURL); // From anywhere against slaveServerHost?
+            System.out.println("Unexpectedly connected: " + connectionURL);
+            assertTrue("Unexpectedly connected: " + connectionURL,false);
+        }
+        catch (SQLException se)
+        {
+            int ec = se.getErrorCode();
+            String ss = se.getSQLState();
+            String msg = ec + " " + ss + " " + se.getMessage();
+            // SQLCODE: 40000 SQLSTATE: 08004
+            // FIXME: Is this correct? 'The connection was refused because the database /home/os136789/Replication/testing/db_slave/test;stopSlave=true was not found''
+            assertSQLState("stopSlave on slave failed: " + connectionURL + " " + msg, "08004", se);
+            System.out.println("stopSlave on slave failed as expected: " + connectionURL + " " + msg);
+        }
+        
+    }
+    
+    public void verifyTestStartSlaveConnect_OK()
+    throws SQLException, IOException, InterruptedException
+    {
+
+    }
+}

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

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPreStartedMaster.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPreStartedMaster.java?rev=632371&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPreStartedMaster.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPreStartedMaster.java Fri Feb 29 08:10:21 2008
@@ -0,0 +1,165 @@
+/*
+ 
+Derby - Class org.apache.derbyTesting.functionTests.tests.replicationTests.TestPreStartedMaster
+ 
+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 java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.TestConfiguration;
+
+/**
+ * Test that after startMaster, new attempts for startMaster or startSlave do fail.
+ */
+public class TestPreStartedMaster extends ClientRunner
+{
+    
+    public TestPreStartedMaster(String testcaseName)
+    {
+        super(testcaseName);
+    }
+    
+    public static Test suite()
+        throws Exception
+    {
+        System.out.println("**** TestPreStartedMaster.suite()");
+        
+        initEnvironment();
+        
+        // String masterHostName = System.getProperty("test.serverHost", "localhost");
+        // int masterPortNo = Integer.parseInt(System.getProperty("test.serverPort", "1527"));
+        
+        TestSuite suite = new TestSuite("TestPreStartedMaster");
+                
+        suite.addTest(TestPreStartedMaster.suite(masterServerHost, masterServerPort));
+        System.out.println("*** Done suite.addTest(TestPreStartedMaster.suite())");
+        
+        return (Test)suite;
+    }
+
+    /**
+     * Adds this class to the *existing server* suite.
+     */
+    public static Test suite(String serverHost, int serverPort)
+    {
+        System.out.println("*** TestPreStartedMaster.suite(serverHost,serverPort)");
+     
+        Test t = TestConfiguration.existingServerSuite(TestPreStartedMaster.class,false,serverHost,serverPort);
+        System.out.println("*** Done TestConfiguration.existingServerSuite(TestPreStartedMaster.class,false,serverHost,serverPort)");
+        return t;
+   }
+
+    
+    /**
+     *
+     *
+     * @throws SQLException, IOException, InterruptedException
+     */
+    public void testStartMasterConnect_OK()
+    throws SQLException, IOException, InterruptedException
+    {
+        System.out.println("**** TestPreStartedMaster.testStartMasterConnect_OK() "+
+                getTestConfiguration().getJDBCClient().getJDBCDriverName());
+        
+        Connection conn = null;
+        String db = masterDatabasePath +"/"+ReplicationRun.masterDbSubPath +"/"+ replicatedDb;
+        String connectionURL = "jdbc:derby:"  
+                + "//" + masterServerHost + ":" + masterServerPort + "/"
+                + db
+                + ";startMaster=true"
+                + ";slaveHost=" + slaveServerHost 
+                + ";slavePort=" + slaveReplPort;
+        System.out.println(connectionURL);
+        // First StartMaster connect ok:
+        try
+        {
+            conn = DriverManager.getConnection(connectionURL);
+            System.out.println("1. startMaster Successfully connected as: " + connectionURL);
+        }
+        catch (SQLException se)
+        {
+            int ec = se.getErrorCode();
+            String ss = se.getSQLState();
+            String msg = ec + " " + ss + " " + se.getMessage();
+            System.out.println(msg);
+            throw se;
+        }
+        
+        System.out.println("2. startMaster attempt should fail on: " + connectionURL);
+        System.out.println("********************'' 2. CURRENTLY HANGS!!!! Skipping.");
+        if (false){ // FIXME! PRELIM Hangs!!
+        // A 2. StartMaster connect should fail:
+        try
+        {
+            conn = DriverManager.getConnection(connectionURL); // FIXME! PRELIM Hangs!!
+            System.out.println("2. Unexpectedly connected as: " + connectionURL);
+            assertTrue("2. Unexpectedly connected as: " + connectionURL, false);
+        }
+        catch (SQLException se)
+        {
+            int ec = se.getErrorCode();
+            String ss = se.getSQLState();
+            String msg = ec + " " + ss + " " + se.getMessage();
+            System.out.println("2. startMaster No connection as expected: " + msg);
+            assertSQLState("2. startMaster Unexpected SQLException: " + msg, "XJ004", se);
+        }
+        }
+        
+        // A 2. StartSlave connect should fail:
+        db = slaveDatabasePath +"/"+ReplicationRun.slaveDbSubPath +"/"+ replicatedDb;
+        connectionURL = "jdbc:derby:"  
+                + "//" + slaveServerHost + ":" + slaveServerPort + "/"
+                + db
+                + ";startSlave=true"
+                + ";slaveHost=" + slaveServerHost 
+                + ";slavePort=" + slaveReplPort;
+        System.out.println(connectionURL);
+        try
+        {
+            conn = DriverManager.getConnection(connectionURL);
+            System.out.println("2. startSlave Unexpectedly connected as: " + connectionURL);
+            assertTrue("2. startSlave Unexpectedly connected as: " + connectionURL, false);
+        }
+        catch (SQLException se)
+        {
+            int ec = se.getErrorCode();
+            String ss = se.getSQLState();
+            String msg = ec + " " + ss + " " + se.getMessage();
+            System.out.println("2. startSlave No connection as expected: " + msg);
+            // SQLCODE: -1, SQLSTATE: XRE09
+            assertSQLState("2. startSlave Unexpected SQLException: " + msg, "XRE09", se);
+        }
+ 
+    }
+    
+    public void verifyTestStartMasterConnect_OK()
+    throws SQLException, IOException, InterruptedException
+    {
+
+    }
+}

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

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPreStartedMasterServer.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPreStartedMasterServer.java?rev=632371&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPreStartedMasterServer.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPreStartedMasterServer.java Fri Feb 29 08:10:21 2008
@@ -0,0 +1,117 @@
+/*
+ 
+Derby - Class org.apache.derbyTesting.functionTests.tests.replicationTests.TestPreStartedMasterServer
+ 
+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 java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.TestConfiguration;
+
+public class TestPreStartedMasterServer extends ClientRunner
+{
+    
+    public TestPreStartedMasterServer(String testcaseName)
+    {
+        super(testcaseName);
+    }
+    
+    public static Test suite()
+        throws Exception
+    {
+        System.out.println("**** TestPreStartedMasterServer.suite()");
+        
+        initEnvironment();
+        
+        // String masterHostName = System.getProperty("test.serverHost", "localhost");
+        // int masterPortNo = Integer.parseInt(System.getProperty("test.serverPort", "1527"));
+        
+        TestSuite suite = new TestSuite("TestPreStartedMasterServer");
+                
+        suite.addTest(TestPreStartedMasterServer.suite(masterServerHost, masterServerPort));
+        System.out.println("*** Done suite.addTest(TestPreStartedMasterServer.suite())");
+        
+        return (Test)suite;
+    }
+
+    /**
+     * Adds this class to the *existing server* suite.
+     */
+    public static Test suite(String serverHost, int serverPort)
+    {
+        System.out.println("*** TestPreStartedMasterServer.suite(serverHost,serverPort)");
+     
+        Test t = TestConfiguration.existingServerSuite(TestPreStartedMasterServer.class,false,serverHost,serverPort);
+        System.out.println("*** Done TestConfiguration.existingServerSuite(TestPreStartedMasterServer.class,false,serverHost,serverPort)");
+        return t;
+   }
+
+    
+    /**
+     *
+     *
+     * @throws SQLException, IOException, InterruptedException
+     */
+    public void testStartMasterConnect_Illegal()
+    throws SQLException, IOException, InterruptedException
+    {
+        System.out.println("**** TestPreStartedMasterServer.testStartMasterConnect_Illegal() "+
+                getTestConfiguration().getJDBCClient().getJDBCDriverName());
+        
+        Connection conn = null;
+        String db = masterDatabasePath +"/"+ReplicationRun.masterDbSubPath +"/"+ replicatedDb;
+        String connectionURL = "jdbc:derby:" 
+                + "//" + masterServerHost + ":" + masterServerPort + "/"
+                + db
+                + ";startMaster=true"
+                + ";slavehost=" + slaveServerHost 
+                + ";slaveport=" + slaveServerPort;
+        System.out.println(connectionURL);
+        try
+        {
+            conn = DriverManager.getConnection(connectionURL);
+        }
+        catch (SQLException se)
+        {
+            int ec = se.getErrorCode();
+            String ss = se.getSQLState();
+            String msg = ec + " " + ss + " " + se.getMessage();
+            System.out.println("testStartMasterConnect_Illegal: " + msg);
+            // 40000 08001
+            assertSQLState("Unexpected SQLException: " + msg, "08001", se);
+            return;
+        }
+        assertTrue("Expected SQLException: '-4499 08001 " + db + "'",false);
+    }
+    
+    public void verifyTestStartMasterConnect_Illegal()
+    throws SQLException, IOException, InterruptedException
+    {
+
+    }
+}

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

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPreStartedSlave.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPreStartedSlave.java?rev=632371&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPreStartedSlave.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPreStartedSlave.java Fri Feb 29 08:10:21 2008
@@ -0,0 +1,139 @@
+/*
+ 
+Derby - Class org.apache.derbyTesting.functionTests.tests.replicationTests.TestPreStartedSlave
+ 
+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 java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.TestConfiguration;
+
+/**
+ * Test correct behaviour on successive startSlave commands.
+ */
+public class TestPreStartedSlave extends ClientRunner
+{
+    
+    public TestPreStartedSlave(String testcaseName)
+    {
+        super(testcaseName);
+    }
+    
+    public static Test suite()
+        throws Exception
+    {
+        System.out.println("**** TestPreStartedSlave.suite()");
+        
+        initEnvironment();
+        
+        // String masterHostName = System.getProperty("test.serverHost", "localhost");
+        // int masterPortNo = Integer.parseInt(System.getProperty("test.serverPort", "1527"));
+        
+        TestSuite suite = new TestSuite("TestPreStartedSlave");
+                
+        suite.addTest(TestPreStartedSlave.suite(slaveServerHost, slaveServerPort));
+        System.out.println("*** Done suite.addTest(TestPreStartedSlave.suite())");
+        
+        return (Test)suite;
+    }
+
+    /**
+     * Adds this class to the *existing server* suite.
+     */
+    public static Test suite(String serverHost, int serverPort)
+    {
+        System.out.println("*** TestPreStartedSlave.suite(serverHost,serverPort)");
+     
+        Test t = TestConfiguration.existingServerSuite(TestPreStartedSlave.class,false,serverHost,serverPort);
+        System.out.println("*** Done TestConfiguration.existingServerSuite(TestPreStartedSlave.class,false,serverHost,serverPort)");
+        return t;
+   }
+
+    
+    /**
+     *
+     *
+     * @throws SQLException, IOException, InterruptedException
+     */
+    // Due to the startSlave-startMaster interdependency, what we try to test here
+    // now must be tested on an already running slave db (and master db).
+    public void testStartSlaveConnect_OK()
+    throws SQLException, IOException, InterruptedException
+    {
+        System.out.println("**** TestPreStartedSlave.testStartSlaveConnect_OK() "+
+                getTestConfiguration().getJDBCClient().getJDBCDriverName());
+        
+        Connection conn = null;
+        String db = slaveDatabasePath +"/"+ReplicationRun.slaveDbSubPath +"/"+ replicatedDb;
+        String connectionURL = "jdbc:derby:"  
+                + "//" + slaveServerHost + ":" + slaveServerPort + "/"
+                + db
+                + ";startSlave=true"
+                + ";slaveHost=" + slaveServerHost 
+                + ";slavePort=" + slaveReplPort;
+        System.out.println("Test moved to TestPostStartedMasterAndSlave! " + connectionURL);
+        if (true) return;
+        // First StartSlave connect ok:
+        try
+        {
+            conn = DriverManager.getConnection(connectionURL); // Will hang until startMaster!
+            System.out.println("1. Successfully connected as: " + connectionURL);
+        }
+        catch (SQLException se)
+        {
+            int ec = se.getErrorCode();
+            String ss = se.getSQLState();
+            String msg = ec + " " + ss + " " + se.getMessage();
+            System.out.println(msg);
+            assertSQLState("1. Unexpected SQLException: " + msg, "XRE08", se); // -1, XRE08
+        }
+        
+        // Next StartSlave connect should fail:
+        try
+        {
+            conn = DriverManager.getConnection(connectionURL);
+            System.out.println("2. Unexpectedly connected as: " + connectionURL);
+            assertTrue("2. Unexpectedly connected as: " + connectionURL, false);
+        }
+        catch (SQLException se)
+        {
+            int ec = se.getErrorCode();
+            String ss = se.getSQLState();
+            String msg = ec + " " + ss + " " + se.getMessage();
+            System.out.println(msg);
+            assertSQLState("2. Unexpected SQLException: " + msg, "08004", se); // 40000, 08004
+        }
+        
+    }
+    
+    public void verifyTestStartSlaveConnect_OK()
+    throws SQLException, IOException, InterruptedException
+    {
+
+    }
+}

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

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPreStartedSlaveServer.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPreStartedSlaveServer.java?rev=632371&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPreStartedSlaveServer.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPreStartedSlaveServer.java Fri Feb 29 08:10:21 2008
@@ -0,0 +1,117 @@
+/*
+ 
+Derby - Class org.apache.derbyTesting.functionTests.tests.replicationTests.TestPreStartedSlaveServer
+ 
+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 java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.TestConfiguration;
+
+public class TestPreStartedSlaveServer extends ClientRunner
+{
+    
+    public TestPreStartedSlaveServer(String testcaseName)
+    {
+        super(testcaseName);
+    }
+    
+    public static Test suite()
+        throws Exception
+    {
+        System.out.println("**** TestPreStartedSlaveServer.suite()");
+        
+        initEnvironment();
+        
+        // String masterHostName = System.getProperty("test.serverHost", "localhost");
+        // int masterPortNo = Integer.parseInt(System.getProperty("test.serverPort", "1527"));
+        
+        TestSuite suite = new TestSuite("TestPreStartedSlaveServer");
+                
+        suite.addTest(TestPreStartedSlaveServer.suite(slaveServerHost, slaveServerPort));
+        System.out.println("*** Done suite.addTest(TestPreStartedSlaveServer.suite())");
+        
+        return (Test)suite;
+    }
+
+    /**
+     * Adds this class to the *existing server* suite.
+     */
+    public static Test suite(String serverHost, int serverPort)
+    {
+        System.out.println("*** TestPreStartedSlaveServer.suite(serverHost,serverPort)");
+     
+        Test t = TestConfiguration.existingServerSuite(TestPreStartedSlaveServer.class,false,serverHost,serverPort);
+        System.out.println("*** Done TestConfiguration.existingServerSuite(TestPreStartedSlaveServer.class,false,serverHost,serverPort)");
+        return t;
+   }
+
+    
+    /**
+     *
+     *
+     * @throws SQLException, IOException, InterruptedException
+     */
+    public void testStartSlaveConnect_Illegal()
+    throws SQLException, IOException, InterruptedException
+    {
+        System.out.println("**** TestPreStartedSlaveServer.testStartSlaveConnect_Illegal() "+
+                getTestConfiguration().getJDBCClient().getJDBCDriverName());
+        
+        Connection conn = null;
+        String db = slaveDatabasePath +"/"+ReplicationRun.slaveDbSubPath +"/"+ replicatedDb;
+        String connectionURL = "jdbc:derby:"  
+                + "//" + slaveServerHost + ":" + slaveServerPort + "/"
+                + db
+                + ";startSlave=true"
+                + ";slavehost=" + slaveServerHost 
+                + ";slaveport=" + slaveServerPort;
+        System.out.println(connectionURL);
+        try
+        {
+            conn = DriverManager.getConnection(connectionURL);
+        }
+        catch (SQLException se)
+        {
+            int ec = se.getErrorCode();
+            String ss = se.getSQLState();
+            String msg = ec + " " + ss + " " + se.getMessage();
+            System.out.println("testStartSlaveConnect_Illegal: " + msg);
+            // 40000 08001
+            assertSQLState("Unexpected SQLException: " + msg, "08001", se);
+            return;
+        }
+        assertTrue("Expected SQLException: '40000 08001 " + db + "'",false);
+    }
+    
+    public void verifyTestStartSlaveConnect_Illegal()
+    throws SQLException, IOException, InterruptedException
+    {
+
+    }
+}

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

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPreStoppedMaster.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPreStoppedMaster.java?rev=632371&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPreStoppedMaster.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPreStoppedMaster.java Fri Feb 29 08:10:21 2008
@@ -0,0 +1,119 @@
+/*
+ 
+Derby - Class org.apache.derbyTesting.functionTests.tests.replicationTests.TestPreStoppedMaster
+ 
+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 java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.TestConfiguration;
+
+public class TestPreStoppedMaster extends ClientRunner
+{
+    
+    public TestPreStoppedMaster(String testcaseName)
+    {
+        super(testcaseName);
+    }
+    
+    public static Test suite()
+        throws Exception
+    {
+        System.out.println("**** TestPreStoppedMaster.suite()");
+        
+        initEnvironment();
+        
+        // String masterHostName = System.getProperty("test.serverHost", "localhost");
+        // int masterPortNo = Integer.parseInt(System.getProperty("test.serverPort", "1527"));
+        
+        TestSuite suite = new TestSuite("TestPreStoppedMaster");
+                
+        suite.addTest(TestPreStoppedMaster.suite(slaveServerHost, slaveServerPort));
+        System.out.println("*** Done suite.addTest(TestPreStoppedMaster.suite())");
+        
+        return (Test)suite;
+    }
+
+    /**
+     * Adds this class to the *existing server* suite.
+     */
+    public static Test suite(String serverHost, int serverPort)
+    {
+        System.out.println("*** TestPreStoppedMaster.suite(serverHost,serverPort)");
+     
+        Test t = TestConfiguration.existingServerSuite(TestPreStoppedMaster.class,false,serverHost,serverPort);
+        System.out.println("*** Done TestConfiguration.existingServerSuite(TestPreStoppedMaster.class,false,serverHost,serverPort)");
+        return t;
+   }
+
+    
+    /**
+     *
+     *
+     * @throws SQLException, IOException, InterruptedException
+     */
+    public void test()
+    throws SQLException, IOException, InterruptedException
+    {
+        System.out.println("**** EMPTY!!! TestPreStoppedMaster.test() "+
+                getTestConfiguration().getJDBCClient().getJDBCDriverName());
+        
+        /*
+        Connection conn = null;
+        String db = slaveDatabasePath +"/"+ReplicationRun.slaveDbSubPath +"/"+ replicatedDb;
+        String connectionURL = "jdbc:derby:"  
+                + "//" + slaveServerHost + ":" + slaveServerPort + "/"
+                + db
+                + ";startMaster=true"
+                + ";slavehost=" + slaveServerHost 
+                + ";slaveport=" + slaveServerPort;
+        System.out.println(connectionURL);
+        // First StartSlave connect ok:
+        try
+        {
+            conn = DriverManager.getConnection(connectionURL);
+            System.out.println("1. Successfully connected as: " + connectionURL);
+        }
+        catch (SQLException se)
+        {
+            int ec = se.getErrorCode();
+            String ss = se.getSQLState();
+            String msg = ec + " " + ss + " " + se.getMessage();
+            System.out.println(msg);
+            throw se; // FIXME!?
+        }
+         */
+        
+    }
+    
+    public void verifyTest()
+    throws SQLException, IOException, InterruptedException
+    {
+
+    }
+}

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

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPreStoppedMasterServer.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPreStoppedMasterServer.java?rev=632371&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPreStoppedMasterServer.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPreStoppedMasterServer.java Fri Feb 29 08:10:21 2008
@@ -0,0 +1,119 @@
+/*
+ 
+Derby - Class org.apache.derbyTesting.functionTests.tests.replicationTests.TestPreStoppedMasterServer
+ 
+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 java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.TestConfiguration;
+
+public class TestPreStoppedMasterServer extends ClientRunner
+{
+    
+    public TestPreStoppedMasterServer(String testcaseName)
+    {
+        super(testcaseName);
+    }
+    
+    public static Test suite()
+        throws Exception
+    {
+        System.out.println("**** TestPreStoppedMasterServer.suite()");
+        
+        initEnvironment();
+        
+        // String masterHostName = System.getProperty("test.serverHost", "localhost");
+        // int masterPortNo = Integer.parseInt(System.getProperty("test.serverPort", "1527"));
+        
+        TestSuite suite = new TestSuite("TestPreStoppedMasterServer");
+                
+        suite.addTest(TestPreStoppedMasterServer.suite(slaveServerHost, slaveServerPort));
+        System.out.println("*** Done suite.addTest(TestPreStoppedMasterServer.suite())");
+        
+        return (Test)suite;
+    }
+
+    /**
+     * Adds this class to the *existing server* suite.
+     */
+    public static Test suite(String serverHost, int serverPort)
+    {
+        System.out.println("*** TestPreStoppedMasterServer.suite(serverHost,serverPort)");
+     
+        Test t = TestConfiguration.existingServerSuite(TestPreStoppedMasterServer.class,false,serverHost,serverPort);
+        System.out.println("*** Done TestConfiguration.existingServerSuite(TestPreStoppedMasterServer.class,false,serverHost,serverPort)");
+        return t;
+   }
+
+    
+    /**
+     *
+     *
+     * @throws SQLException, IOException, InterruptedException
+     */
+    public void test()
+    throws SQLException, IOException, InterruptedException
+    {
+        System.out.println("**** EMPTY!!! TestPreStoppedMasterServer.test() "+
+                getTestConfiguration().getJDBCClient().getJDBCDriverName());
+        
+        /*
+        Connection conn = null;
+        String db = slaveDatabasePath +"/"+ReplicationRun.slaveDbSubPath +"/"+ replicatedDb;
+        String connectionURL = "jdbc:derby:"  
+                + "//" + slaveServerHost + ":" + slaveServerPort + "/"
+                + db
+                + ";startMaster=true"
+                + ";slavehost=" + slaveServerHost 
+                + ";slaveport=" + slaveServerPort;
+        System.out.println(connectionURL);
+        // First StartSlave connect ok:
+        try
+        {
+            conn = DriverManager.getConnection(connectionURL);
+            System.out.println("1. Successfully connected as: " + connectionURL);
+        }
+        catch (SQLException se)
+        {
+            int ec = se.getErrorCode();
+            String ss = se.getSQLState();
+            String msg = ec + " " + ss + " " + se.getMessage();
+            System.out.println(msg);
+            throw se; // FIXME!?
+        }
+         */
+        
+    }
+    
+    public void verifyTest()
+    throws SQLException, IOException, InterruptedException
+    {
+
+    }
+}

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

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPreStoppedSlave.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPreStoppedSlave.java?rev=632371&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPreStoppedSlave.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/TestPreStoppedSlave.java Fri Feb 29 08:10:21 2008
@@ -0,0 +1,122 @@
+/*
+ 
+Derby - Class org.apache.derbyTesting.functionTests.tests.replicationTests.TestPreStoppedSlave
+ 
+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 java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.TestConfiguration;
+
+/**
+ * Test replication commands against an operational slave database.
+ */
+public class TestPreStoppedSlave extends ClientRunner
+{
+    
+    public TestPreStoppedSlave(String testcaseName)
+    {
+        super(testcaseName);
+    }
+    
+    public static Test suite()
+        throws Exception
+    {
+        System.out.println("**** TestPreStoppedSlave.suite()");
+        
+        initEnvironment();
+        
+        // String masterHostName = System.getProperty("test.serverHost", "localhost");
+        // int masterPortNo = Integer.parseInt(System.getProperty("test.serverPort", "1527"));
+        
+        TestSuite suite = new TestSuite("TestPreStoppedSlave");
+                
+        suite.addTest(TestPreStoppedSlave.suite(slaveServerHost, slaveServerPort));
+        System.out.println("*** Done suite.addTest(TestPreStoppedSlave.suite())");
+        
+        return (Test)suite;
+    }
+
+    /**
+     * Adds this class to the *existing server* suite.
+     */
+    public static Test suite(String serverHost, int serverPort)
+    {
+        System.out.println("*** TestPreStoppedSlave.suite(serverHost,serverPort)");
+     
+        Test t = TestConfiguration.existingServerSuite(TestPreStoppedSlave.class,false,serverHost,serverPort);
+        System.out.println("*** Done TestConfiguration.existingServerSuite(TestPreStoppedSlave.class,false,serverHost,serverPort)");
+        return t;
+   }
+
+    
+    /**
+     *
+     *
+     * @throws SQLException, IOException, InterruptedException
+     */
+    public void test()
+    throws SQLException, IOException, InterruptedException
+    {
+        System.out.println("**** EMPTY!!! TestPreStoppedSlave.test() "+
+                getTestConfiguration().getJDBCClient().getJDBCDriverName());
+        
+        /*
+        Connection conn = null;
+        String db = slaveDatabasePath +"/"+ReplicationRun.slaveDbSubPath +"/"+ replicatedDb;
+        String connectionURL = "jdbc:derby:"  
+                + "//" + slaveServerHost + ":" + slaveServerPort + "/"
+                + db
+                + ";startMaster=true"
+                + ";slavehost=" + slaveServerHost 
+                + ";slaveport=" + slaveServerPort;
+        System.out.println(connectionURL);
+        // First StartSlave connect ok:
+        try
+        {
+            conn = DriverManager.getConnection(connectionURL);
+            System.out.println("1. Successfully connected as: " + connectionURL);
+        }
+        catch (SQLException se)
+        {
+            int ec = se.getErrorCode();
+            String ss = se.getSQLState();
+            String msg = ec + " " + ss + " " + se.getMessage();
+            System.out.println(msg);
+            throw se; // FIXME!?
+        }
+         */
+        
+    }
+    
+    public void verifyTest()
+    throws SQLException, IOException, InterruptedException
+    {
+
+    }
+}

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