You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ma...@apache.org on 2007/08/02 21:21:11 UTC

svn commit: r562225 - in /directory/apacheds/trunk/mitosis/src: main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationServerContextHandler.java test/java/org/apache/directory/mitosis/service/ReplicationServiceITest.java

Author: malderson
Date: Thu Aug  2 12:21:09 2007
New Revision: 562225

URL: http://svn.apache.org/viewvc?view=rev&rev=562225
Log:
Re-committing 560042: "Fixed DIRSERVER-895, where a server will never accept replication logs until it is restarted if a connection is closed during a replication transaction (e.g. due to a message timeout).  No test for this yet as other issues would prevent it from being reliable."  Hopefully the fix for DIRSERVER-998 will have made the test stable.

Modified:
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationServerContextHandler.java
    directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/ReplicationServiceITest.java

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationServerContextHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationServerContextHandler.java?view=diff&rev=562225&r1=562224&r2=562225
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationServerContextHandler.java (original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationServerContextHandler.java Thu Aug  2 12:21:09 2007
@@ -69,7 +69,7 @@
     public synchronized void contextEnd( ReplicationContext ctx ) throws Exception
     {
         // Reset the mark if the context has the unfinished transaction.
-        if ( !ctx.getPeer().equals( replicaInTransaction ) )
+        if ( ctx.getPeer() != null && ctx.getPeer().equals( replicaInTransaction ) )
         {
             replicaInTransaction = null;
         }

Modified: directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/ReplicationServiceITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/ReplicationServiceITest.java?view=diff&rev=562225&r1=562224&r2=562225
==============================================================================
--- directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/ReplicationServiceITest.java (original)
+++ directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/ReplicationServiceITest.java Thu Aug  2 12:21:09 2007
@@ -80,10 +80,12 @@
 
     public void testOneWay() throws Exception
     {
-        String dn = "cn=test,ou=system";
-        testOneWayBind( dn );
-        testOneWayModify( dn );
-        testOneWayUnbind( dn );
+        String dn1 = "cn=test,ou=system";
+//        String dn2 = "cn=test2,ou=system";
+        testOneWayBind( dn1 );
+        testOneWayModify( dn1 );
+//        testOneWayRename( dn1, dn2 );
+        testOneWayUnbind( dn1 );
     }
     
     /**
@@ -168,6 +170,26 @@
         Assert.assertEquals( newValue, getAttributeValue( ctxB, dn, "ou" ) );
         Assert.assertEquals( newValue, getAttributeValue( ctxC, dn, "ou" ) );
     }
+
+//    private void testOneWayRename( String dn1, String dn2 ) throws Exception
+//    {
+//        LdapContext ctxA = getReplicaContext( "A" );
+//        LdapContext ctxB = getReplicaContext( "B" );
+//        LdapContext ctxC = getReplicaContext( "C" );
+//        
+//        ctxA.rename( dn1, dn2 );
+//        
+//        replicationServices.get( "A" ).replicate();
+//
+//        Thread.sleep( 5000 );
+//        
+//        assertNotExists( ctxA, dn1 );
+//        assertNotExists( ctxB, dn1 );
+//        assertNotExists( ctxC, dn1 );
+//        Assert.assertNotNull( ctxA.lookup( dn2 ) );
+//        Assert.assertNotNull( ctxB.lookup( dn2 ) );
+//        Assert.assertNotNull( ctxC.lookup( dn2 ) );
+//    }
     
     private void testOneWayUnbind( String dn ) throws Exception
     {
@@ -289,7 +311,7 @@
         {
             i.next().interruptConnectors();
         }
-        Thread.sleep( 1000 );
+        Thread.sleep( 5000 );
     }
 
     private LdapContext getReplicaContext( String name ) throws Exception