From 03f65a7c05764a658f156f8406ab5a81595205b8 Mon Sep 17 00:00:00 2001
From: ludovicp <ludovicp@localhost>
Date: Mon, 31 May 2010 13:02:21 +0000
Subject: [PATCH] Fix issue #2604 - Unit-tests should wait for TimeThread to increment before testing the modify timestamp attribute. This also fixes another unit-test which fails on Windows.

---
 opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDIFDiffTestCase.java         |    6 +++---
 opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/SchemaBackendTestCase.java |    7 +++++--
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/SchemaBackendTestCase.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/SchemaBackendTestCase.java
index ebe436d..36f159f 100644
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/SchemaBackendTestCase.java
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/SchemaBackendTestCase.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Copyright 2006-2009 Sun Microsystems, Inc.
+ *      Copyright 2006-2010 Sun Microsystems, Inc.
  */
 package org.opends.server.backends;
 
@@ -5359,7 +5359,7 @@
    *
    * @throws  Exception  If an unexpected problem occurs.
    */
-  @Test(enabled=false)
+  @Test
   public void testLastModAttributes()
          throws Exception
   {
@@ -5401,6 +5401,9 @@
       "-f", path
     };
 
+    // Sleep longer than the TimeThread delay to ensure the modifytimestamp
+    // will be different.
+    Thread.sleep(600);
     assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
 
     schemaEntry = DirectoryServer.getEntry(DN.decode("cn=schema"));
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDIFDiffTestCase.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDIFDiffTestCase.java
index 96294c1..12aa771 100644
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDIFDiffTestCase.java
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDIFDiffTestCase.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Copyright 2006-2008 Sun Microsystems, Inc.
+ *      Copyright 2006-2010 Sun Microsystems, Inc.
  */
 package org.opends.server.tools;
 
@@ -614,7 +614,7 @@
       "-O"
     };
 
-    if (ignoreAttributesFile.endsWith("/does-not-exist"))
+    if (ignoreAttributesFile.endsWith("does-not-exist"))
     {
       // We expect this to fail, so just make sure that it does.
       assertEquals(LDIFDiff.mainDiff(args, true, System.out, System.err), 1);
@@ -701,7 +701,7 @@
       "-O"
     };
 
-    if (ignoreEntriesFile.endsWith("/does-not-exist"))
+    if (ignoreEntriesFile.endsWith("does-not-exist"))
     {
       // We expect this to fail, so just make sure that it does.
       assertEquals(LDIFDiff.mainDiff(args, true, System.out, System.err), 1);

--
Gitblit v1.10.0