From 1b8ce118499248cac94195f9702fe255298cb1d1 Mon Sep 17 00:00:00 2001
From: pgamba <pgamba@localhost>
Date: Thu, 13 Mar 2008 10:01:22 +0000
Subject: [PATCH] An update sent by a replicated LDAP server is tagged with a ChangeNumber generated by a ChangeNumberGenerator. One component of the ChangeNumber is a timestamp, Because we want the timestamp of the ChangeNumbers to be consistently growing across the whole topology and not only inside each server independently, the ChangeNumberGenerator must be adjusted with the timestamp of the updates received from the other servers of the topology. The code was already here but erroneously used.
---
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ProtocolWindowTest.java | 31 +++++++++++++++++++++++++------
1 files changed, 25 insertions(+), 6 deletions(-)
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ProtocolWindowTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ProtocolWindowTest.java
index 6be17f5..6d76786 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ProtocolWindowTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ProtocolWindowTest.java
@@ -28,12 +28,15 @@
package org.opends.server.replication;
import static org.opends.server.loggers.ErrorLogger.logError;
+import static org.opends.server.loggers.debug.DebugLogger.getTracer;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
+import org.opends.server.loggers.debug.DebugTracer;
import java.net.ServerSocket;
import java.net.SocketTimeoutException;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
import org.opends.messages.Category;
@@ -54,6 +57,7 @@
import org.opends.server.replication.protocol.ReplicationMessage;
import org.opends.server.types.DN;
import org.opends.server.types.Entry;
+import org.opends.server.types.SearchResultEntry;
import org.opends.server.types.LDAPException;
import org.opends.server.types.Modification;
import org.opends.server.types.Operation;
@@ -62,6 +66,7 @@
import org.opends.server.types.SearchScope;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
+import org.opends.server.types.Attribute;
/**
* Test the contructors, encoders and decoders of the Replication AckMsg,
@@ -147,7 +152,7 @@
Thread.sleep(500);
// check that the replicationServer only sent WINDOW_SIZE messages
- assertTrue(searchUpdateSent());
+ searchUpdateSent();
int rcvCount=0;
try
@@ -209,15 +214,16 @@
* And that the number of waiting changes is accurate.
* Do this by checking the monitoring information.
*/
- private boolean searchUpdateSent() throws Exception
+ private void searchUpdateSent() throws Exception
{
InternalSearchOperation op = connection.processSearch(
new ASN1OctetString("cn=monitor"),
SearchScope.WHOLE_SUBTREE,
LDAPFilter.decode("(update-sent=" + WINDOW_SIZE + ")"));
+
assertEquals(op.getResultCode(), ResultCode.SUCCESS);
- if (op.getEntriesSent() != 1)
- return false;
+ assertEquals(op.getEntriesSent(), 1,
+ "Entries#=" + op.getEntriesSent());
op = connection.processSearch(
new ASN1OctetString("cn=monitor"),
@@ -225,8 +231,21 @@
LDAPFilter.decode("(missing-changes=" +
(REPLICATION_QUEUE_SIZE + WINDOW_SIZE) + ")"));
assertEquals(op.getResultCode(), ResultCode.SUCCESS);
-
- return (op.getEntriesSent() == 1);
+
+ Iterator<SearchResultEntry> entriesit = op.getSearchEntries().iterator();
+ while(entriesit.hasNext())
+ {
+ SearchResultEntry e = entriesit.next();
+ Iterator<Attribute> attit = e.getAttributes().iterator();
+ while (attit.hasNext())
+ {
+ Attribute attr = attit.next();
+ logError(Message.raw(Category.SYNC, Severity.INFORMATION,
+ e.getDN() + "= " + attr.getName() + " " + attr.getValues().iterator()
+ .next().getStringValue()));
+ }
+ }
+ assertEquals(op.getEntriesSent(), 1, "Entries#=" + op.getEntriesSent());
}
/**
--
Gitblit v1.10.0