From 3a9e211d36ee94ff99941943b3b51e0f768624f5 Mon Sep 17 00:00:00 2001
From: mrossign <mrossign@localhost>
Date: Fri, 06 Nov 2009 09:11:40 +0000
Subject: [PATCH] In order to support a more clever algorithm for the DS to choose his RS, we introduce:
---
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/UpdateOperationTest.java | 55 ++++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 46 insertions(+), 9 deletions(-)
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/UpdateOperationTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/UpdateOperationTest.java
index 884fa51..e98164b 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/UpdateOperationTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/UpdateOperationTest.java
@@ -67,6 +67,7 @@
import org.opends.server.replication.protocol.ReplicationMsg;
import org.opends.server.schema.DirectoryStringSyntax;
import org.opends.server.types.*;
+import org.opends.server.util.StaticUtils;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -300,6 +301,9 @@
logError(Message.raw(Category.SYNC, Severity.INFORMATION,
"Starting synchronization test : toggleReceiveStatus"));
+ // Clean replication server database from previous run
+ cleanUpReplicationServersDB();
+
final DN baseDn = DN.decode("ou=People," + TEST_ROOT_DN_STRING);
/*
@@ -379,6 +383,9 @@
logError(Message.raw(Category.SYNC, Severity.INFORMATION,
"Starting replication test : lostHeartbeatFailover"));
+ // Clean replication server database from previous run
+ cleanUpReplicationServersDB();
+
final DN baseDn = DN.decode("ou=People," + TEST_ROOT_DN_STRING);
/*
@@ -483,6 +490,9 @@
DirectoryServer.getAttributeType("entryuuid");
String monitorAttr = "resolved-modify-conflicts";
+ // Clean replication server database from previous run
+ cleanUpReplicationServersDB();
+
/*
* Open a session to the replicationServer using the broker API.
* This must use a different serverId to that of the directory server.
@@ -610,6 +620,9 @@
String resolvedMonitorAttr = "resolved-naming-conflicts";
String unresolvedMonitorAttr = "unresolved-naming-conflicts";
+ // Clean replication server database from previous run
+ cleanUpReplicationServersDB();
+
/*
* Open a session to the replicationServer using the ReplicationServer broker API.
* This must use a serverId different from the LDAP server ID
@@ -1302,6 +1315,18 @@
return new Object[][] { { false }, {true} };
}
+ private void cleanupTest() {
+ try
+ {
+ classCleanUp();
+ setUp();
+ } catch (Exception e)
+ {
+ fail("Test cleanup failed: " + e.getClass().getName() + " : " +
+ e.getMessage() + " : " + StaticUtils.stackTraceToSingleLineString(e));
+ }
+ }
+
/**
* Tests done using directly the ReplicationBroker interface.
*/
@@ -1312,6 +1337,9 @@
Category.SYNC, Severity.INFORMATION,
"Starting replication test : updateOperations " + assured));
+ // Cleanup from previous run
+ cleanupTest();
+
final DN baseDn = DN.decode("ou=People," + TEST_ROOT_DN_STRING);
ReplicationBroker broker =
@@ -1341,15 +1369,15 @@
// Check if the client has received the msg
ReplicationMsg msg = broker.receive();
assertTrue(msg instanceof AddMsg,
- "The received replication message is not an ADD msg");
+ "The received replication message is not an ADD msg : " + msg);
AddMsg addMsg = (AddMsg) msg;
Operation receivedOp = addMsg.createOperation(connection);
assertTrue(OperationType.ADD.compareTo(receivedOp.getOperationType()) == 0,
- "The received replication message is not an ADD msg");
+ "The received replication message is not an ADD msg : " + addMsg);
assertEquals(DN.decode(addMsg.getDn()),personEntry.getDN(),
- "The received ADD replication message is not for the excepted DN");
+ "The received ADD replication message is not for the excepted DN : " + addMsg);
}
// Modify the entry
@@ -1364,12 +1392,12 @@
// See if the client has received the msg
ReplicationMsg msg = broker.receive();
assertTrue(msg instanceof ModifyMsg,
- "The received replication message is not a MODIFY msg");
+ "The received replication message is not a MODIFY msg : " + msg);
ModifyMsg modMsg = (ModifyMsg) msg;
modMsg.createOperation(connection);
assertTrue(DN.decode(modMsg.getDn()).compareTo(personEntry.getDN()) == 0,
- "The received MODIFY replication message is not for the excepted DN");
+ "The received MODIFY replication message is not for the excepted DN : " + modMsg);
// Modify the entry DN
DN newDN = DN.decode("uid= new person,ou=People," + TEST_ROOT_DN_STRING) ;
@@ -1387,12 +1415,12 @@
// See if the client has received the msg
msg = broker.receive();
assertTrue(msg instanceof ModifyDNMsg,
- "The received replication message is not a MODIFY DN msg");
+ "The received replication message is not a MODIFY DN msg : " + msg);
ModifyDNMsg moddnMsg = (ModifyDNMsg) msg;
moddnMsg.createOperation(connection);
assertTrue(DN.decode(moddnMsg.getDn()).compareTo(personEntry.getDN()) == 0,
- "The received MODIFY_DN message is not for the excepted DN");
+ "The received MODIFY_DN message is not for the excepted DN : " + moddnMsg);
// Delete the entry
DeleteOperationBasis delOp = new DeleteOperationBasis(connection,
@@ -1406,12 +1434,12 @@
// See if the client has received the msg
msg = broker.receive();
assertTrue(msg instanceof DeleteMsg,
- "The received replication message is not a MODIFY DN msg");
+ "The received replication message is not a MODIFY DN msg : " + msg);
DeleteMsg delMsg = (DeleteMsg) msg;
delMsg.createOperation(connection);
assertTrue(DN.decode(delMsg.getDn()).compareTo(DN
.decode("uid= new person,ou=People," + TEST_ROOT_DN_STRING)) == 0,
- "The received DELETE message is not for the excepted DN");
+ "The received DELETE message is not for the excepted DN : " + delMsg);
/*
* Now check that when we send message to the ReplicationServer
@@ -1512,6 +1540,9 @@
logError(Message.raw(Category.SYNC, Severity.INFORMATION,
"Starting replication test : deleteNoSuchObject"));
+ // Clean replication server database from previous run
+ cleanUpReplicationServersDB();
+
DN dn = DN.decode("cn=No Such Object,ou=People," + TEST_ROOT_DN_STRING);
DeleteOperationBasis op =
new DeleteOperationBasis(connection,
@@ -1535,6 +1566,9 @@
final DN baseDn = DN.decode("ou=People," + TEST_ROOT_DN_STRING);
+ // Clean replication server database from previous run
+ cleanUpReplicationServersDB();
+
Thread.sleep(2000);
ReplicationBroker broker =
openReplicationSession(baseDn, 11, 100, replServerPort, 1000, true);
@@ -1675,6 +1709,9 @@
final DN baseDn = DN.decode("ou=People," + TEST_ROOT_DN_STRING);
+ // Clean replication server database from previous run
+ cleanUpReplicationServersDB();
+
/*
* Open a session to the replicationServer using the broker API.
* This must use a different serverId to that of the directory server.
--
Gitblit v1.10.0