From 76b8bb967a0e20ef38750dbffd893baa117c1f34 Mon Sep 17 00:00:00 2001
From: mrossign <mrossign@localhost>
Date: Fri, 09 Jan 2009 10:06:40 +0000
Subject: [PATCH] - Assured replication (Safe Read) bug fixes - Some assured replication (Safe Read) unit tests

---
 opends/src/server/org/opends/server/replication/service/ReplicationDomain.java |   28 ++++++++++++++++++++++++++--
 1 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/service/ReplicationDomain.java b/opends/src/server/org/opends/server/replication/service/ReplicationDomain.java
index 1f54b7f..5c5fef1 100644
--- a/opends/src/server/org/opends/server/replication/service/ReplicationDomain.java
+++ b/opends/src/server/org/opends/server/replication/service/ReplicationDomain.java
@@ -331,6 +331,29 @@
   }
 
   /**
+   * Creates a ReplicationDomain with the provided parameters.
+   * (for unit test purpose only)
+   *
+   * @param serviceID  The identifier of the Replication Domain to which
+   *                   this object is participating.
+   * @param serverID   The identifier of the server that is participating
+   *                   to the Replication Domain.
+   *                   This identifier should be different for each server that
+   *                   is participating to a given Replication Domain.
+   * @param serverState The serverState to use
+   */
+  public ReplicationDomain(String serviceID, short serverID,
+    ServerState serverState)
+  {
+    this.serviceID = serviceID;
+    this.serverID = serverID;
+    this.state = serverState;
+    this.generator = new ChangeNumberGenerator(serverID, state);
+
+    domains.put(serviceID, this);
+  }
+
+  /**
    * Set the initial status of the domain and perform necessary initializations.
    * This method will be called by the Broker each time the ReplicationBroker
    * establish a new session to a Replication Server.
@@ -773,8 +796,9 @@
     }
 
     numRcvdUpdates.incrementAndGet();
-    if (update.isAssured() && (update.getAssuredMode() ==
-      AssuredMode.SAFE_READ_MODE))
+     byte rsGroupId = broker.getRsGroupId();
+    if ( update.isAssured() && (update.getAssuredMode() ==
+      AssuredMode.SAFE_READ_MODE) && (rsGroupId == groupId) )
     {
       receivedAssuredSrUpdates.incrementAndGet();
     }

--
Gitblit v1.10.0