From 3f79a9684ec8839697180446fe64d86aa579ed7b Mon Sep 17 00:00:00 2001
From: abobrov <abobrov@localhost>
Date: Fri, 25 Jan 2008 15:58:08 +0000
Subject: [PATCH] - do in-core restart in AfterClass to make sure all replication tests cleanup good and proper.  

---
 opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ReplicationTestCase.java |   43 +++++++++++++++++++++++--------------------
 1 files changed, 23 insertions(+), 20 deletions(-)

diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ReplicationTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ReplicationTestCase.java
index 27300c7..13315c9 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ReplicationTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ReplicationTestCase.java
@@ -163,7 +163,7 @@
       ReplicationDomain replDomain = ReplicationDomain.retrievesReplicationDomain(baseDn);
       genId = replDomain.getGenerationId();
     }
-    catch(Exception e) {}  
+    catch(Exception e) {}
     return genId;
   }
 
@@ -176,11 +176,11 @@
       final DN baseDn, short serverId, int window_size,
       int port, int timeout, boolean emptyOldChanges)
           throws Exception, SocketException
-  {    
+  {
     return openReplicationSession(baseDn, serverId, window_size,
         port, timeout, emptyOldChanges, getGenerationId(baseDn));
   }
-  
+
   /**
    * Open a replicationServer session to the local ReplicationServer
    * providing the generationId.
@@ -198,7 +198,7 @@
        state = new ServerState();
 
     ReplicationBroker broker = new ReplicationBroker(
-        state, baseDn, serverId, 0, 0, 0, 0, 
+        state, baseDn, serverId, 0, 0, 0, 0,
         window_size, 0, generationId, getReplSessionSecurity());
     ArrayList<String> servers = new ArrayList<String>(1);
     servers.add("localhost:" + port);
@@ -247,11 +247,11 @@
       final DN baseDn, short serverId, int window_size,
       int port, int timeout, ServerState state)
     throws Exception, SocketException
-  {   
+  {
     return openReplicationSession(baseDn, serverId, window_size,
         port, timeout, state, getGenerationId(baseDn));
   }
-  
+
   /**
    * Open a new session to the ReplicationServer
    * starting with a given ServerState.
@@ -285,10 +285,10 @@
       throws Exception, SocketException
   {
     return openReplicationSession(baseDn, serverId, window_size,
-        port, timeout, maxSendQueue, maxRcvQueue, emptyOldChanges, 
+        port, timeout, maxSendQueue, maxRcvQueue, emptyOldChanges,
         getGenerationId(baseDn));
   }
-  
+
   protected ReplicationBroker openReplicationSession(
       final DN baseDn, short serverId, int window_size,
         int port, int timeout, int maxSendQueue, int maxRcvQueue,
@@ -352,7 +352,7 @@
       while (true)
       {
         DN dn = configEntryList.removeLast();
-        
+
         logError(Message.raw(Category.SYNC, Severity.NOTICE,
                  "cleaning config entry " + dn));
 
@@ -392,14 +392,14 @@
       {
         DN dn = entryList.removeLast();
 
-        op = new DeleteOperationBasis(connection, 
-               InternalClientConnection.nextOperationID(), 
-               InternalClientConnection.nextMessageID(), 
+        op = new DeleteOperationBasis(connection,
+               InternalClientConnection.nextOperationID(),
+               InternalClientConnection.nextMessageID(),
                null,
                dn);
 
         op.run();
-        
+
         if ((op.getResultCode() != ResultCode.SUCCESS) &&
             (op.getResultCode() != ResultCode.NO_SUCH_OBJECT))
         {
@@ -429,6 +429,9 @@
 
     entryList = null;
     configEntryList = null;
+
+    // In-core restart to cleanup.
+    TestCaseUtils.restartServer();
   }
 
   /**
@@ -886,7 +889,7 @@
       fail("waitTaskState Exception:"+ e.getMessage() + " " + stackTraceToSingleLineString(e));
     }
   }
-  
+
   /**
    * Add to the current DB the entries necessary to the test
    */
@@ -903,12 +906,12 @@
         Entry entry = TestCaseUtils.entryFromLdifString(ldifEntry);
         AddOperationBasis addOp = new AddOperationBasis(
             connection,
-            InternalClientConnection.nextOperationID(), 
-            InternalClientConnection.nextMessageID(), 
-            null, 
-            entry.getDN(), 
+            InternalClientConnection.nextOperationID(),
+            InternalClientConnection.nextMessageID(),
+            null,
+            entry.getDN(),
             entry.getObjectClasses(),
-            entry.getUserAttributes(), 
+            entry.getUserAttributes(),
             entry.getOperationalAttributes());
         addOp.setInternalOperation(true);
         addOp.run();
@@ -920,7 +923,7 @@
         else
         {
           TRACER.debugInfo(entry.getDN() +
-              " added " + addOp.getResultCode());          
+              " added " + addOp.getResultCode());
         }
         // They will be removed at the end of the test
         entryList.addLast(entry.getDN());

--
Gitblit v1.10.0