From e93172cb4535ac4f1e6152895676b24dcb33fac4 Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Tue, 02 Oct 2007 06:43:22 +0000
Subject: [PATCH] Enable some of the total update replication tests
---
opends/src/server/org/opends/server/replication/plugin/ReplicationBroker.java | 4 +
opends/src/server/org/opends/server/replication/server/ReplicationBackend.java | 31 ----------
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/InitOnLineTest.java | 107 +++++++++++++++++++----------------
3 files changed, 63 insertions(+), 79 deletions(-)
diff --git a/opends/src/server/org/opends/server/replication/plugin/ReplicationBroker.java b/opends/src/server/org/opends/server/replication/plugin/ReplicationBroker.java
index 1fa3f6c..e561fb7 100644
--- a/opends/src/server/org/opends/server/replication/plugin/ReplicationBroker.java
+++ b/opends/src/server/org/opends/server/replication/plugin/ReplicationBroker.java
@@ -358,6 +358,10 @@
Message message = ERR_CANNOT_RECOVER_CHANGES.get(
baseDn.toNormalizedString());
logError(message);
+ replicationServer = ServerAddr.toString();
+ maxSendWindow = replServerStartMsg.getWindowSize();
+ connected = true;
+ startHeartBeat();
}
else
{
diff --git a/opends/src/server/org/opends/server/replication/server/ReplicationBackend.java b/opends/src/server/org/opends/server/replication/server/ReplicationBackend.java
index dccbd64..fc2bb7c 100644
--- a/opends/src/server/org/opends/server/replication/server/ReplicationBackend.java
+++ b/opends/src/server/org/opends/server/replication/server/ReplicationBackend.java
@@ -128,9 +128,6 @@
// The base DNs for this backend.
private DN[] baseDNs;
- // The mapping between parent DNs and their immediate children.
- private HashMap<DN,HashSet<DN>> childDNs;
-
// The base DNs for this backend, in a hash set.
private HashSet<DN> baseDNSet;
@@ -229,8 +226,6 @@
baseDNSet.add(dn);
}
- childDNs = new HashMap<DN,HashSet<DN>>();
-
supportedControls = new HashSet<String>();
supportedFeatures = new HashSet<String>();
@@ -1090,32 +1085,6 @@
}
}
- /**
- * Export the changes for a given ReplicationCache.
- */
- private void searchContainer2(ReplicationCache rc,
- SearchOperation searchOperation)
- throws DirectoryException
- {
- // Walk through the servers
- for (Short serverId : rc.getServers())
- {
- ReplicationIterator ri = rc.getChangelogIterator(serverId,
- null);
-
- if (ri == null)
- break;
-
- // Walk through the changes
- while (ri.getChange() != null)
- {
- UpdateMessage msg = ri.getChange();
- processChange(msg, null, null, searchOperation);
- if (!ri.next())
- break;
- }
- }
- }
/**
* Retrieves the replication server associated to this backend.
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/InitOnLineTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/InitOnLineTest.java
index 91d9762..da2fd33 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/InitOnLineTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/InitOnLineTest.java
@@ -552,6 +552,11 @@
log("Broker " + serverID + " receives and trashes " + msg);
}
}
+ catch (SocketTimeoutException e)
+ {
+ log("SocketTimeoutException while waiting fro entries" +
+ stackTraceToSingleLineString(e));
+ }
catch(Exception e)
{
log("receiveUpdatedEntries" + stackTraceToSingleLineString(e));
@@ -645,6 +650,7 @@
DirectoryServer.getConfigHandler().addEntry(synchroServerEntry, null);
assertNotNull(DirectoryServer.getConfigEntry(synchroServerEntry.getDN()),
"Unable to add the synchronized server");
+ super.configEntryList.add(synchroServerEntry.getDN());
replDomain = ReplicationDomain.retrievesReplicationDomain(baseDn);
@@ -690,7 +696,7 @@
/**
* Tests the import side of the Initialize task
*/
- @Test(enabled=false)
+ @Test(enabled=true)
public void initializeImport() throws Exception
{
String testCase = "InitializeImport";
@@ -746,7 +752,7 @@
/**
* Tests the export side of the Initialize task
*/
- @Test(enabled=false)
+ @Test(enabled=true)
public void initializeExport() throws Exception
{
String testCase = "Replication/InitializeExport";
@@ -780,7 +786,7 @@
/**
* Tests the import side of the InitializeTarget task
*/
- @Test(enabled=false)
+ @Test(enabled=true)
public void initializeTargetExport() throws Exception
{
String testCase = "Replication/InitializeTargetExport";
@@ -820,7 +826,7 @@
/**
* Tests the import side of the InitializeTarget task
*/
- @Test(enabled=false)
+ @Test(enabled=true)
public void initializeTargetExportAll() throws Exception
{
String testCase = "Replication/InitializeTargetExportAll";
@@ -840,7 +846,8 @@
server2 = openReplicationSession(DN.decode("dc=example,dc=com"),
server2ID, 100, getChangelogPort(changelog1ID), 1000, emptyOldChanges);
- ReplicationBroker server3 = openReplicationSession(DN.decode("dc=example,dc=com"),
+ if (server3==null)
+ server3 = openReplicationSession(DN.decode("dc=example,dc=com"),
server3ID, 100, getChangelogPort(changelog1ID), 1000, emptyOldChanges);
Thread.sleep(1000);
@@ -864,7 +871,7 @@
/**
* Tests the import side of the InitializeTarget task
*/
- @Test(enabled=false)
+ @Test(enabled=true)
public void initializeTargetImport() throws Exception
{
String testCase = "InitializeTargetImport";
@@ -959,7 +966,7 @@
/**
* Tests the import side of the InitializeTarget task
*/
- @Test(enabled=false)
+ @Test(enabled=true)
public void initializeConfigErrors() throws Exception
{
String testCase = "InitializeConfigErrors";
@@ -1047,7 +1054,7 @@
* ReplServerInfoMessage(s) exchanged by the replication
* servers.
*/
- @Test(enabled=false)
+ @Test(enabled=true)
public void testReplServerInfos() throws Exception
{
String testCase = "Replication/TestReplServerInfos";
@@ -1061,7 +1068,7 @@
// Connects lDAP1 to replServer1
connectServer1ToChangelog(changelog1ID);
-
+
// Connects lDAP2 to replServer2
ReplicationBroker broker2 =
openReplicationSession(DN.decode("dc=example,dc=com"),
@@ -1122,50 +1129,54 @@
@Test(enabled=false)
public void initializeTargetExportMultiSS() throws Exception
{
- String testCase = "Replication/InitializeTargetExportMultiSS";
-
- log("Starting " + testCase);
-
- // Create 2 changelogs
- changelog1 = createChangelogServer(changelog1ID);
-
- changelog2 = createChangelogServer(changelog2ID);
-
- // Creates config to synchronize suffix
- connectServer1ToChangelog(changelog1ID);
-
- // Add in S1 the entries to be exported
- addTestEntriesToDB();
-
- // S1 is the server we are running in, S2 is simulated by a broker
- // connected to changelog2
- if (server2 == null)
+ try
{
- server2 = openReplicationSession(DN.decode("dc=example,dc=com"),
- server2ID, 100, getChangelogPort(changelog2ID), 1000, emptyOldChanges);
+ String testCase = "Replication/InitializeTargetExportMultiSS";
+
+ log("Starting " + testCase);
+
+ // Create 2 changelogs
+ changelog1 = createChangelogServer(changelog1ID);
+
+ changelog2 = createChangelogServer(changelog2ID);
+
+ // Creates config to synchronize suffix
+ connectServer1ToChangelog(changelog1ID);
+
+ // Add in S1 the entries to be exported
+ addTestEntriesToDB();
+
+ // S1 is the server we are running in, S2 is simulated by a broker
+ // connected to changelog2
+ if (server2 == null)
+ {
+ server2 = openReplicationSession(DN.decode("dc=example,dc=com"),
+ server2ID, 100, getChangelogPort(changelog2ID), 1000, emptyOldChanges);
+ }
+
+ Thread.sleep(1000);
+
+ // Launch in S1 the task that will initialize S2
+ addTask(taskInitTargetS2, ResultCode.SUCCESS, null);
+
+ // Wait for task completion
+ waitTaskState(taskInitTargetS2, TaskState.COMPLETED_SUCCESSFULLY, null);
+
+ // Tests that entries have been received by S2
+ receiveUpdatedEntries(server2, server2ID, updatedEntries);
+
+ log("Successfully ending " + testCase);
}
+ finally
+ {
+ afterTest();
- Thread.sleep(1000);
-
- // Launch in S1 the task that will initialize S2
- addTask(taskInitTargetS2, ResultCode.SUCCESS, null);
-
- // Wait for task completion
- waitTaskState(taskInitTargetS2, TaskState.COMPLETED_SUCCESSFULLY, null);
-
- // Tests that entries have been received by S2
- receiveUpdatedEntries(server2, server2ID, updatedEntries);
-
- afterTest();
-
- changelog2.shutdown();
- changelog2 = null;
-
- log("Successfully ending " + testCase);
-
+ changelog2.shutdown();
+ changelog2 = null;
+ }
}
- @Test(enabled=false)
+ @Test(enabled=true)
public void initializeExportMultiSS() throws Exception
{
String testCase = "Replication/InitializeExportMultiSS";
--
Gitblit v1.10.0