directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1152186 - in /directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication: ClientInitialRefreshIT.java MockSyncReplConsumer.java
Date Fri, 29 Jul 2011 12:43:57 GMT
Author: elecharny
Date: Fri Jul 29 12:43:56 2011
New Revision: 1152186

URL: http://svn.apache.org/viewvc?rev=1152186&view=rev
Log:
o Added a test that do the initial update, and then receive one more entry
o 

Modified:
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientInitialRefreshIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/MockSyncReplConsumer.java

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientInitialRefreshIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientInitialRefreshIT.java?rev=1152186&r1=1152185&r2=1152186&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientInitialRefreshIT.java
(original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientInitialRefreshIT.java
Fri Jul 29 12:43:56 2011
@@ -200,13 +200,11 @@ public class ClientInitialRefreshIT
      */
     private boolean waitForSyncReplClient( ReplicationConsumer consumer, int expected ) throws
Exception
     {
-        System.out.println( "NbAdded every 100ms : " );
+        System.out.println( "\nNbAdded every 100ms : " );
         boolean isFirst = true;
         
         for ( int i = 0; i < 50; i++ )
         {
-            Thread.sleep( 100 );
-            
             int nbAdded = ((MockSyncReplConsumer)consumer).getNbAdded();
             
             if ( isFirst )
@@ -224,6 +222,8 @@ public class ClientInitialRefreshIT
             {
                 return true;
             }
+            
+            Thread.sleep( 100 );
         }
         
         return false;
@@ -291,11 +291,32 @@ public class ClientInitialRefreshIT
      * First test : create a consumer, and see if it gets the 1000 entries
      */
     @Test
-    public void testInitialRefresh() throws Exception
+    public void testInitialRefreshLoad() throws Exception
     {
         ReplicationConsumer syncreplClient = createConsumer();
         
         // We should have 1000 entries plus the base entry = 1001
         assertTrue( waitForSyncReplClient( syncreplClient, 1001 ) ); 
     }
+    
+    
+    /**
+     * Test that we can load entries, then add one entry in the producer
+     * and see this entry present in the consumer
+     */
+    @Test
+    public void testInitialRefreshLoadAndAdd() throws Exception
+    {
+        ReplicationConsumer syncreplClient = createConsumer();
+        
+        // We should have 1000 entries plus the base entry = 1001
+        assertTrue( waitForSyncReplClient( syncreplClient, 1001 ) );
+        
+        // Injext a new intry in the producer
+        Entry addedEntry = createEntry();
+        providerSession.add( addedEntry );
+        
+        // Now check that the entry has been copied in the consumer
+        assertTrue( waitForSyncReplClient( syncreplClient, 1002 ) );
+    }
 }

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/MockSyncReplConsumer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/MockSyncReplConsumer.java?rev=1152186&r1=1152185&r2=1152186&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/MockSyncReplConsumer.java
(original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/MockSyncReplConsumer.java
Fri Jul 29 12:43:56 2011
@@ -529,7 +529,7 @@ public class MockSyncReplConsumer implem
         SearchFuture sf = connection.searchAsync( searchRequest );
 
         Response resp = sf.get();
-
+        
         while ( !( resp instanceof SearchResultDone ) && !sf.isCancelled() )
         {
             if ( resp instanceof SearchResultEntry )



Mime
View raw message