directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1155258 - /directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java
Date Tue, 09 Aug 2011 08:31:12 GMT
Author: elecharny
Date: Tue Aug  9 08:31:11 2011
New Revision: 1155258

URL: http://svn.apache.org/viewvc?rev=1155258&view=rev
Log:
o Added a dump method in case of error

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

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=1155258&r1=1155257&r2=1155258&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
Tue Aug  9 08:31:11 2011
@@ -39,6 +39,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.annotations.CreateIndex;
 import org.apache.directory.server.core.annotations.CreatePartition;
 import org.apache.directory.server.core.factory.DSAnnotationProcessor;
+import org.apache.directory.server.core.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.apache.directory.server.factory.ServerAnnotationProcessor;
 import org.apache.directory.server.ldap.LdapServer;
@@ -49,6 +50,9 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.message.ModifyRequest;
 import org.apache.directory.shared.ldap.model.message.ModifyRequestImpl;
+import org.apache.directory.shared.ldap.model.message.SearchRequest;
+import org.apache.directory.shared.ldap.model.message.SearchRequestImpl;
+import org.apache.directory.shared.ldap.model.message.SearchScope;
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.apache.directory.shared.ldap.model.name.Rdn;
 import org.apache.directory.shared.ldap.model.schema.SchemaManager;
@@ -91,6 +95,47 @@ public class ClientServerReplicationIT
         consumerServer.stop();
         providerServer.stop();
     }
+    
+    
+    private void dump( CoreSession session, Dn entryDn )
+    {
+        try
+        {
+            SearchRequest searchRequest = new SearchRequestImpl();
+            
+            searchRequest.setBase( new Dn( schemaManager, "dc=example,dc=com" ) );
+            searchRequest.setFilter( "(objectClass=*)" );
+            searchRequest.setScope( SearchScope.SUBTREE );
+            
+            System.out.println( "-----------> Dumping the consumer <-----------" );
+            System.out.println( "-----------> Looking for " + entryDn.getNormName() +
" <-----------" );
+            
+            EntryFilteringCursor cursor = session.search( searchRequest );
+            
+            while ( cursor.next() )
+            {
+                Entry entry = cursor.get();
+                
+                if ( entry.getDn().equals( entryDn ) )
+                {
+                    System.out.println( "The searched entry exists !!!" );
+                    break;
+                }
+                
+                System.out.println( "Entry " + entry.getDn().getNormName() + " exists" );
+            }
+            
+            cursor.close();
+
+            System.out.println( "-----------> Dump done <-----------" );
+            new Exception().printStackTrace();
+        }
+        catch ( Exception le )
+        {
+            // Do nothing
+            le.printStackTrace();
+        }
+    }
 
     
     /**
@@ -112,6 +157,11 @@ public class ClientServerReplicationIT
             }
         }
         
+        if ( replicated == false )
+        {
+            dump( session, entryDn );
+        }
+        
         return replicated;
     }
     
@@ -137,6 +187,11 @@ public class ClientServerReplicationIT
             }
         }
         
+        if ( !exists || !deleted )
+        {
+            dump( session, entryDn );
+        }
+        
         return exists && deleted;
     }
 
@@ -171,7 +226,7 @@ public class ClientServerReplicationIT
         assertFalse( consumerSession.exists( provUser.getDn() ) );
         
         providerSession.add( provUser ); // 1
-     
+        
         Dn usersContainer = new Dn( schemaManager, "ou=users,dc=example,dc=com" );
         
         DefaultEntry entry = new DefaultEntry( schemaManager, usersContainer,



Mime
View raw message