From 1e011bd3bb3875ba7a62df410e43ac050ed6f543 Mon Sep 17 00:00:00 2001
From: pgamba <pgamba@localhost>
Date: Thu, 22 Oct 2009 16:17:09 +0000
Subject: [PATCH] Remove useless MultimasterReplication plugin from unit tests

---
 opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/DependencyTest.java                   |   32 ++--------------
 opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/PersistentServerStateTest.java |    8 ---
 opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/IsolationTest.java             |   10 ----
 opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ExternalChangeLogTest.java            |   12 ++++--
 opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/NamingConflictTest.java        |    1 
 5 files changed, 15 insertions(+), 48 deletions(-)

diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/DependencyTest.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/DependencyTest.java
index 79ef965..8713e99 100644
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/DependencyTest.java
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/DependencyTest.java
@@ -92,7 +92,6 @@
     ReplicationServer replServer = null;
     LDAPReplicationDomain domain = null;
     DN baseDn = DN.decode(TEST_ROOT_DN_STRING);
-    SynchronizationProvider replicationPlugin = null;
     int brokerId = 2;
     int serverId = 1;
     int replServerId = 81;
@@ -127,8 +126,6 @@
       int replServerPort = socket.getLocalPort();
       socket.close();
 
-      replicationPlugin = new MultimasterReplication();
-      DirectoryServer.registerSynchronizationProvider(replicationPlugin);
       ReplServerFakeConfiguration conf =
         new ReplServerFakeConfiguration(replServerPort, "dependencyTestAddModDelDependencyTestDb",
                                         0, replServerId, 0,
@@ -174,7 +171,7 @@
       domainConf.setHeartbeatInterval(100000);
 
       domain = MultimasterReplication.createNewDomain(domainConf);
-      replicationPlugin.completeSynchronizationProvider();
+      domain.start();
 
       // check that last entry in sequence got added.
       Entry lastEntry = getEntry(DN.decode(addDn), 30000, true);
@@ -239,9 +236,6 @@
 
       if (domain != null)
         MultimasterReplication.deleteDomain(baseDn);
-
-      if (replicationPlugin != null)
-        DirectoryServer.deregisterSynchronizationProvider(replicationPlugin);
     }
   }
 
@@ -257,7 +251,6 @@
     ReplicationServer replServer = null;
     LDAPReplicationDomain domain = null;
     DN baseDn = DN.decode(TEST_ROOT_DN_STRING);
-    SynchronizationProvider replicationPlugin = null;
     int brokerId = 2;
     int serverId = 1;
     int replServerId = 82;
@@ -284,8 +277,6 @@
       int replServerPort = socket.getLocalPort();
       socket.close();
 
-      replicationPlugin = new MultimasterReplication();
-      DirectoryServer.registerSynchronizationProvider(replicationPlugin);
       ReplServerFakeConfiguration conf =
         new ReplServerFakeConfiguration(replServerPort, "dependencyTestModdnDelDependencyTestDb",
                                         0, replServerId, 0,
@@ -301,7 +292,7 @@
 
       Thread.sleep(2000);
       domain = MultimasterReplication.createNewDomain(domainConf);
-      replicationPlugin.completeSynchronizationProvider();
+      domain.start();
 
       ReplicationBroker broker =
         openReplicationSession(baseDn, brokerId, 1000, replServerPort, 1000,
@@ -364,9 +355,6 @@
 
       if (domain != null)
         MultimasterReplication.deleteDomain(baseDn);
-
-      if (replicationPlugin != null)
-        DirectoryServer.deregisterSynchronizationProvider(replicationPlugin);
     }
 
   }
@@ -415,7 +403,6 @@
     ReplicationServer replServer = null;
     LDAPReplicationDomain domain = null;
     DN baseDn = DN.decode(TEST_ROOT_DN_STRING);
-    SynchronizationProvider replicationPlugin = null;
     int brokerId = 2;
     int serverId = 1;
     int replServerId = 83;
@@ -437,8 +424,6 @@
       int replServerPort = socket.getLocalPort();
       socket.close();
 
-      replicationPlugin = new MultimasterReplication();
-      DirectoryServer.registerSynchronizationProvider(replicationPlugin);
       ReplServerFakeConfiguration conf =
         new ReplServerFakeConfiguration(replServerPort, "dependencyTestAddDelAddDependencyTestDb", 0,
                                         replServerId,
@@ -491,7 +476,7 @@
         new DomainFakeCfg(baseDn, serverId, replServers);
 
       domain = MultimasterReplication.createNewDomain(domainConf);
-      replicationPlugin.completeSynchronizationProvider();
+      domain.start();
 
       // check that all entries have been deleted and added
       // again by checking that they do have the correct entryuuid
@@ -531,9 +516,6 @@
 
       if (domain != null)
         MultimasterReplication.deleteDomain(baseDn);
-
-      if (replicationPlugin != null)
-        DirectoryServer.deregisterSynchronizationProvider(replicationPlugin);
     }
   }
 
@@ -548,7 +530,6 @@
     ReplicationServer replServer = null;
     LDAPReplicationDomain domain = null;
     DN baseDn = DN.decode(TEST_ROOT_DN_STRING);
-    SynchronizationProvider replicationPlugin = null;
     int brokerId = 2;
     int serverId = 1;
     int replServerId = 84;
@@ -571,8 +552,6 @@
       int replServerPort = socket.getLocalPort();
       socket.close();
 
-      replicationPlugin = new MultimasterReplication();
-      DirectoryServer.registerSynchronizationProvider(replicationPlugin);
       ReplServerFakeConfiguration conf =
         new ReplServerFakeConfiguration(replServerPort, "dependencyTestAddModdnDependencyTestDb", 0,
                                         replServerId,
@@ -617,7 +596,7 @@
         new DomainFakeCfg(baseDn, serverId, replServers);
 
       domain = MultimasterReplication.createNewDomain(domainConf);
-      replicationPlugin.completeSynchronizationProvider();
+      domain.start();
 
       // check that all entries have been renamed
       for (sequence = 1; sequence<=AddSequenceLength; sequence ++)
@@ -646,9 +625,6 @@
 
       if (domain != null)
         MultimasterReplication.deleteDomain(baseDn);
-
-      if (replicationPlugin != null)
-        DirectoryServer.deregisterSynchronizationProvider(replicationPlugin);
     }
   }
 
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ExternalChangeLogTest.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ExternalChangeLogTest.java
index 83e0032..b0c2cc3 100644
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ExternalChangeLogTest.java
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ExternalChangeLogTest.java
@@ -639,8 +639,7 @@
       DomainFakeCfg domainConf =
         new DomainFakeCfg(baseDn2,  1602, replServers);
       LDAPReplicationDomain domain2 = MultimasterReplication.createNewDomain(domainConf);
-      SynchronizationProvider replicationPlugin = new MultimasterReplication();
-      replicationPlugin.completeSynchronizationProvider();
+      domain2.start();
       sleep(1000);
       Entry e = createEntry(baseDn2);
       addEntry(e);
@@ -741,8 +740,6 @@
       // Cleaning
       if (domain2 != null)
         MultimasterReplication.deleteDomain(baseDn2);
-      if (replicationPlugin != null)
-        DirectoryServer.deregisterSynchronizationProvider(replicationPlugin);
       removeTestBackend2(backend2);
 
       server01.stop();
@@ -3464,6 +3461,7 @@
       includeAttributes.add("sn");
       domainConf.setEclIncludes(includeAttributes);
       domain2 = MultimasterReplication.createNewDomain(domainConf);
+      domain2.start();
 
       backend3 = initializeTestBackend(false,
           TEST_ROOT_DN_STRING3, TEST_BACKEND_ID3);
@@ -3474,6 +3472,7 @@
       includeAttributes.add("objectclass");
       domainConf.setEclIncludes(includeAttributes);
       domain3 = MultimasterReplication.createNewDomain(domainConf);
+      domain3.start();
 
       domainConf =
         new DomainFakeCfg(baseDn2, 1704, replServers);
@@ -3481,6 +3480,7 @@
       includeAttributes.add("cn");
       domainConf.setEclIncludes(includeAttributes);
       domain21 = MultimasterReplication.createNewDomain(domainConf);
+      domain21.start();
 
       sleep(1000);
 
@@ -3649,6 +3649,9 @@
         waitOpResult(delOp, ResultCode.SUCCESS);
 
         // Cleaning
+        if (domain21 != null)
+          domain21.shutdown();
+
         if (domain2 != null)
           MultimasterReplication.deleteDomain(baseDn2);
         removeTestBackend2(backend2);
@@ -3656,6 +3659,7 @@
         if (domain3 != null)
           MultimasterReplication.deleteDomain(baseDn3);
         removeTestBackend2(backend3);    
+
       }
       catch(Exception e) {}
     }
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/IsolationTest.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/IsolationTest.java
index c3b286b..d4b10a4 100644
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/IsolationTest.java
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/IsolationTest.java
@@ -62,15 +62,12 @@
   {
     LDAPReplicationDomain domain = null;
     DN baseDn = DN.decode(TEST_ROOT_DN_STRING);
-    SynchronizationProvider replicationPlugin = null;
     int serverId = 1;
 
     try
     {
       // configure and start replication of TEST_ROOT_DN_STRING on the server
       // using a replication server that is not started
-      replicationPlugin = new MultimasterReplication();
-      DirectoryServer.registerSynchronizationProvider(replicationPlugin);
 
       // find  a free port for the replicationServer
       ServerSocket socket = TestCaseUtils.bindFreePort();
@@ -82,6 +79,7 @@
         new DomainFakeCfg(baseDn, serverId, replServers);
       domainConf.setHeartbeatInterval(100000);
       domain = MultimasterReplication.createNewDomain(domainConf);
+      domain.start();
 
       // check that the updates fail with the unwilling to perform error.
       InternalClientConnection conn =
@@ -108,12 +106,6 @@
     {
       if (domain != null)
         MultimasterReplication.deleteDomain(baseDn);
-
-      if (replicationPlugin != null)
-      {
-        replicationPlugin.finalizeSynchronizationProvider();
-        DirectoryServer.deregisterSynchronizationProvider(replicationPlugin);
-      }
     }
   }
 }
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/NamingConflictTest.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/NamingConflictTest.java
index 3cf1fa9..be76ec6 100644
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/NamingConflictTest.java
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/NamingConflictTest.java
@@ -74,6 +74,7 @@
 
     LDAPReplicationDomain domain =
       MultimasterReplication.createNewDomain(conf, queue);
+    domain.start();
 
     try
     {
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/PersistentServerStateTest.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/PersistentServerStateTest.java
index ad8243e..1606058 100644
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/PersistentServerStateTest.java
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/PersistentServerStateTest.java
@@ -123,7 +123,6 @@
   public void translateRuvEntryTest()
          throws Exception
   {
-    SynchronizationProvider replicationPlugin = null;
     LDAPReplicationDomain replDomain = null;
 
     try
@@ -154,12 +153,10 @@
 
       assertTrue(addOp.getResultCode() == ResultCode.SUCCESS);
 
-      replicationPlugin = new MultimasterReplication();
-      DirectoryServer.registerSynchronizationProvider(replicationPlugin);
       DomainFakeCfg domainConf =
         new DomainFakeCfg("o=test", 1, "localhost:3389");
       replDomain = MultimasterReplication.createNewDomain(domainConf);
-      replicationPlugin.completeSynchronizationProvider();
+      replDomain.start();
 
       // Then check serverSate and GenId
       assertTrue(replDomain.getGenerationID() == 1225361491);
@@ -175,9 +172,6 @@
     {
       if (replDomain != null)
         MultimasterReplication.deleteDomain(DN.decode("o=test"));
-
-      if (replicationPlugin != null)
-        DirectoryServer.deregisterSynchronizationProvider(replicationPlugin);
     }
   }
 }

--
Gitblit v1.10.0