From a4032f16e4e41e5a6e831b1c6132ae710a0793a2 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 07 Oct 2013 08:13:42 +0000
Subject: [PATCH] ReSyncTest.java: Fixing this test: the main problem was in classCleanUp() that was trying to remove non leaves entries, which ended up in a failure.
---
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ReSyncTest.java | 72 ++++++++++++++++--------------------
1 files changed, 32 insertions(+), 40 deletions(-)
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ReSyncTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ReSyncTest.java
index d517be3..c7f7dad 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ReSyncTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ReSyncTest.java
@@ -69,25 +69,21 @@
private static final String EXAMPLE_DN = "dc=example,dc=com";
private File reSyncTempDir;
- /**
- * Set up the environment for performing the tests in this Class.
- *
- * @throws Exception
- * If the environment could not be set up.
- */
- @BeforeClass
+ /**
+ * Set up the environment for performing the tests in this class:
+ * <ol>
+ * <li>Configure replication</li>
+ * <li>Do some changes</li>
+ * </ol>
+ */
+ @BeforeClass
public void setup() throws Exception
{
- super.setUp();
+ super.setUp();
- reSyncTempDir = TestCaseUtils.createTemporaryDirectory("resynctest");
+ reSyncTempDir = TestCaseUtils.createTemporaryDirectory("resynctest");
- /*
- * - Configure replication
- * - Do some changes.
- */
-
- int replServerPort = TestCaseUtils.findFreePort();
+ final int replServerPort = TestCaseUtils.findFreePort();
// This test uses restore task which does not work with memory backend
// (like the test backend we use in every tests): backend is disabled then
@@ -152,21 +148,19 @@
}
/**
- * Test re-synchronization after after backup/restore
+ * Test re-synchronization after after backup/restore:
+ * <ol>
+ * <li>Backup the server</li>
+ * <li>ADD an entry</li>
+ * <li>Restore the backup taken previously</li>
+ * <li>Check that entry has been added again in the LDAP server.</li>
+ * </ol>
*/
@Test(enabled=true, groups="slow")
public void testResyncAfterRestore() throws Exception
{
- /*
- * - Backup the server
- * - ADD an entry
- * - Restore the backup taken previously
- * - Check that entry has been added again in the LDAP server.
- */
-
// Delete the entry we are going to use to make sure that
// we do test something.
-
DN entryDN = DN.decode("dc=fooUniqueName1," + EXAMPLE_DN);
connection.processDelete(entryDN);
@@ -184,8 +178,7 @@
+ "objectClass: top\n" + "objectClass: domain\n");
debugInfo("testResyncAfterRestore: entry added");
- task("dn: ds-task-id=" + UUID.randomUUID()
- + ",cn=Scheduled Tasks,cn=Tasks\n"
+ task("dn: ds-task-id=" + UUID.randomUUID() + ",cn=Scheduled Tasks,cn=Tasks\n"
+ "objectclass: top\n"
+ "objectclass: ds-task\n"
+ "objectclass: ds-task-restore\n"
@@ -202,28 +195,25 @@
}
/**
- * Test re-synchronization after after backup/restore
+ * Test re-synchronization after after backup/restore:
+ * <ol>
+ * <li>Do an export to a LDIF file</li>
+ * <li>Add an entry</li>
+ * <li>Import LDIF file generated above.</li>
+ * <li>Check that entry has been added again in the LDAP server.</li>
+ * </ol>
*/
@Test(enabled=true, groups="slow")
public void testResyncAfterImport() throws Exception
{
- /*
- * - Do an export to a LDIF file
- * - Add an entry
- * - Import LDIF file generated above.
- * - Check that entry has been added again in the LDAP server.
- */
-
// delete the entry we are going to use to make sure that
// we do test something.
DN entryDN = DN.decode("dc=fooUniqueName2," + EXAMPLE_DN);
connection.processDelete(entryDN);
- String path = reSyncTempDir.getAbsolutePath() + File.pathSeparator +
- "ReSynchTest";
+ String path = reSyncTempDir.getAbsolutePath() + File.pathSeparator + "ReSynchTest";
- task("dn: ds-task-id=" + UUID.randomUUID()
- + ",cn=Scheduled Tasks,cn=Tasks\n"
+ task("dn: ds-task-id=" + UUID.randomUUID() + ",cn=Scheduled Tasks,cn=Tasks\n"
+ "objectclass: top\n"
+ "objectclass: ds-task\n"
+ "objectclass: ds-task-export\n"
@@ -236,8 +226,7 @@
+ "objectClass: top\n" + "objectClass: domain\n");
debugInfo("testResyncAfterImport: entry added");
- task("dn: ds-task-id=" + UUID.randomUUID()
- + ",cn=Scheduled Tasks,cn=Tasks\n"
+ task("dn: ds-task-id=" + UUID.randomUUID() + ",cn=Scheduled Tasks,cn=Tasks\n"
+ "objectclass: top\n"
+ "objectclass: ds-task\n"
+ "objectclass: ds-task-import\n"
@@ -260,6 +249,9 @@
public void classCleanUp() throws Exception
{
callParanoiaCheck = false;
+
+ // Do not try to remove non leaves
+ entriesToCleanup.remove(DN.decode(EXAMPLE_DN));
super.classCleanUp();
TestCaseUtils.clearJEBackend(false, "userRoot", EXAMPLE_DN);
--
Gitblit v1.10.0