directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1164522 - in /directory/apacheds/trunk: protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ server-integ/src/test/java/org/apache/directory/server/replication/
Date Fri, 02 Sep 2011 13:20:59 GMT
Author: elecharny
Date: Fri Sep  2 13:20:56 2011
New Revision: 1164522

URL: http://svn.apache.org/viewvc?rev=1164522&view=rev
Log:
o Fixed some bad logs
o added a loop in the rebootTest, fixed some logs

Modified:
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java?rev=1164522&r1=1164521&r2=1164522&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java
Fri Sep  2 13:20:56 2011
@@ -490,7 +490,7 @@ public class ReplicationConsumerImpl imp
         // read the cookie if persisted
         readCookie();
         
-        CONSUMER_LOG.debug( "Cookie read : ''", syncCookie );
+        CONSUMER_LOG.debug( "Cookie read : '{}'", syncCookie );
 
 
         if ( config.isRefreshNPersist() )

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java?rev=1164522&r1=1164521&r2=1164522&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java
(original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java
Fri Sep  2 13:20:56 2011
@@ -60,6 +60,8 @@ import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Ignore;
 import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Tests for replication subsystem in client-server mode.
@@ -68,6 +70,7 @@ import org.junit.Test;
  */
 public class ClientServerReplicationIT
 {
+    private static final Logger CONSUMER_LOG = LoggerFactory.getLogger( "CONSUMER_LOG" );
     private static LdapServer providerServer;
 
     private static LdapServer consumerServer;
@@ -108,8 +111,8 @@ public class ClientServerReplicationIT
             searchRequest.setScope( SearchScope.SUBTREE );
             searchRequest.addAttributes( "entryUuid" );
             
-            System.out.println( "-----------> Dumping the consumer <-----------" );
-            System.out.println( "-----------> Looking for " + entryDn.getNormName() +
" <-----------" );
+            CONSUMER_LOG.debug( "-----------> Dumping the server <-----------" );
+            CONSUMER_LOG.debug( "-----------> Looking for " + entryDn.getNormName() +
" <-----------" );
             
             EntryFilteringCursor cursor = session.search( searchRequest );
             
@@ -119,18 +122,18 @@ public class ClientServerReplicationIT
                 
                 if ( entry.getDn().equals( entryDn ) )
                 {
-                    System.out.println( "The searched entry exists !!!" );
-                    System.out.println( "found Entry " + entry.getDn().getNormName() + "
exists, entrtyUuid = " + entry.get( "entryUuid" ) );
-                    break;
+                    CONSUMER_LOG.debug( "The searched entry exists !!!" );
+                    CONSUMER_LOG.debug( "found Entry " + entry.getDn().getNormName() + "
exists, entrtyUuid = " + entry.get( "entryUuid" ) );
+                    continue;
                 }
                 
-                System.out.println( "Entry " + entry.getDn().getNormName() + " exists, entrtyUuid
= " + entry.get( "entryUuid" ) );
+                CONSUMER_LOG.debug( "Entry " + entry.getDn().getNormName() + " exists, entrtyUuid
= " + entry.get( "entryUuid" ) );
             }
             
             cursor.close();
 
-            System.out.println( "-----------> Dump done <-----------" );
-            new Exception().printStackTrace();
+            CONSUMER_LOG.debug( "-----------> Dump done <-----------" );
+            //new Exception().printStackTrace();
         }
         catch ( Exception le )
         {
@@ -389,40 +392,23 @@ public class ClientServerReplicationIT
     }
     
     
-    @Test
-    @Ignore( "we have some random failures" )
-    public void testRebootConsumer() throws Exception
+    private Entry restartConsumer( Entry provUser ) throws Exception
     {
-        System.out.println( "----> 1 testRebootConsumer started --------------------------------"
);
-        Entry provUser = createEntry();
-        
-        assertFalse( providerSession.exists(provUser.getDn() ) );
-        assertFalse( consumerSession.exists(provUser.getDn() ) );
-        
-        System.out.println( "----> 2 Adding entry " + provUser.getDn() +" in provider
--------------------------------" );
-        providerSession.add( provUser );
-        
-        assertTrue( checkEntryExistence( consumerSession, provUser.getDn() ) );
-        waitAndCompareEntries( provUser.getDn() );
-
-        System.out.println( "----> 3 entry " + provUser.getDn() +" present in consumer
--------------------------------" );
-
-        assertTrue( providerSession.exists(provUser.getDn() ) );
-        assertTrue( consumerSession.exists(provUser.getDn() ) );
-        
         // Now stop the consumer
-        System.out.println( "----> 4 Stopping the consumer --------------------------------"
);
+        CONSUMER_LOG.debug( "--------------------------------------------------------------"
);
+        CONSUMER_LOG.debug( "----> 1 Stopping the consumer --------------------------------"
);
+        CONSUMER_LOG.debug( "--------------------------------------------------------------"
);
         consumerServer.stop();
         
         // And delete the entry in the provider
         Dn deletedUserDn = provUser.getDn();
-        System.out.println( "----> 5 deleting entry " + deletedUserDn + " from provider
--------------------------------" );
+        //System.out.println( "----> 5 deleting entry " + deletedUserDn + " from provider
--------------------------------" );
         providerSession.delete( deletedUserDn );
         
         // Create a new entry
         provUser = createEntry();
         Dn addedUserDn = provUser.getDn();
-        System.out.println( "----> 6 adding entry " + provUser.getDn() + " into provider
--------------------------------" );
+        //System.out.println( "----> 6 adding entry " + provUser.getDn() + " into provider
--------------------------------" );
         providerSession.add( provUser );
         
         // let the provider log the events before the consumer sends a request
@@ -431,18 +417,57 @@ public class ClientServerReplicationIT
         Thread.sleep( 1000 );
         
         // Restart the consumer
-        System.out.println( "----> 7 Restarting the consumer --------------------------------"
);
+        CONSUMER_LOG.debug( "--------------------------------------------------------------"
);
+        CONSUMER_LOG.debug( "----> 2 Restarting the consumer --------------------------------"
);
+        CONSUMER_LOG.debug( "--------------------------------------------------------------"
);
         consumerServer.start();
         
         //assertTrue( consumerSession.exists( deletedUserDn ) );
-        System.out.println( "----> 7bis entry " + deletedUserDn + " is still present in
consumer --------------------------------" );
+        //System.out.println( "----> 7bis entry " + deletedUserDn + " is still present
in consumer --------------------------------" );
         
         assertTrue( checkEntryDeletion( consumerSession, deletedUserDn ) );
-        System.out.println( "----> 8 Entry " + deletedUserDn + " deleted from consumer
--------------------------------" );
+        //System.out.println( "----> 8 Entry " + deletedUserDn + " deleted from consumer
--------------------------------" );
         
         assertTrue( checkEntryExistence( consumerSession, addedUserDn ) );
         waitAndCompareEntries( addedUserDn );
-        System.out.println( "----> 8 Entry " + addedUserDn + " added into consumer --------------------------------"
);
+        //System.out.println( "----> 8 Entry " + addedUserDn + " added into consumer --------------------------------"
);
+
+        return provUser;
+    }
+    
+    
+    @Test
+    @Ignore( "we have some random failures" )
+    public void testRebootConsumer() throws Exception
+    {
+        System.out.println( "----> 1 testRebootConsumer started --------------------------------"
);
+        Entry provUser = createEntry();
+        
+        assertFalse( providerSession.exists(provUser.getDn() ) );
+        assertFalse( consumerSession.exists(provUser.getDn() ) );
+        
+        System.out.println( "----> 2 Adding entry " + provUser.getDn() +" in provider
--------------------------------" );
+        providerSession.add( provUser );
+        
+        assertTrue( checkEntryExistence( consumerSession, provUser.getDn() ) );
+        waitAndCompareEntries( provUser.getDn() );
+
+        System.out.println( "----> 3 entry " + provUser.getDn() +" present in consumer
--------------------------------" );
+
+        assertTrue( providerSession.exists(provUser.getDn() ) );
+        assertTrue( consumerSession.exists(provUser.getDn() ) );
+        
+        for ( int i = 0; i < 1000; i++ )
+        {
+            CONSUMER_LOG.debug( "=============================== Loop " + i );
+            System.out.println( "=============================== Loop " + i );
+            provUser = restartConsumer( provUser );
+        }
+        
+        CONSUMER_LOG.debug( "===========> Dumping the provider <===========" );
+        dump( providerSession, Dn.ROOT_DSE );
+        CONSUMER_LOG.debug( "===========> Dumping the consumer <===========" );
+        dump( consumerSession, Dn.ROOT_DSE );
     }
     
     



Mime
View raw message