From 472ab9f6983def2889f0a4d29a477b1de6349e90 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Tue, 30 Jan 2007 17:27:58 +0000
Subject: [PATCH] Make sure that the modifyTimestamp in the schema entry gets updated when the add schema file task is used to update the server schema.

---
 opends/tests/unit-tests-testng/src/server/org/opends/server/tasks/AddSchemaFileTaskTestCase.java |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/tasks/AddSchemaFileTaskTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/tasks/AddSchemaFileTaskTestCase.java
index e68ca5a..b957fa1 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/tasks/AddSchemaFileTaskTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/tasks/AddSchemaFileTaskTestCase.java
@@ -80,6 +80,15 @@
   public void testAddValidSchemaFile()
          throws Exception
   {
+    // Get the last modified timestamp from the schema and then sleep for two
+    // milliseconds to make sure that any potential updates to the last
+    // modification time that it won't have any chance of happening in the same
+    // millisecond as the last update.
+    long beforeModifyTimestamp =
+              DirectoryServer.getSchema().getYoungestModificationTime();
+    Thread.sleep(2);
+
+
     SchemaTestMatchingRule matchingRule =
          new SchemaTestMatchingRule("testAddValidSchemaFileMatch",
                                     "1.3.6.1.4.1.26027.1.999.23");
@@ -144,6 +153,8 @@
 
     Task task = getCompletedTask(DN.decode(taskDNStr));
     assertEquals(task.getTaskState(), TaskState.COMPLETED_SUCCESSFULLY);
+    assertFalse(DirectoryServer.getSchema().getYoungestModificationTime() ==
+                     beforeModifyTimestamp);
   }
 
 
@@ -158,6 +169,15 @@
   public void testAddMultipleValidSchemaFiles()
          throws Exception
   {
+    // Get the last modified timestamp from the schema and then sleep for two
+    // milliseconds to make sure that any potential updates to the last
+    // modification time that it won't have any chance of happening in the same
+    // millisecond as the last update.
+    long beforeModifyTimestamp =
+              DirectoryServer.getSchema().getYoungestModificationTime();
+    Thread.sleep(2);
+
+
     String schemaDirectory = SchemaConfigManager.getSchemaDirectoryPath();
 
 
@@ -267,6 +287,8 @@
 
     Task task = getCompletedTask(DN.decode(taskDNStr));
     assertEquals(task.getTaskState(), TaskState.COMPLETED_SUCCESSFULLY);
+    assertFalse(DirectoryServer.getSchema().getYoungestModificationTime() ==
+                     beforeModifyTimestamp);
   }
 
 
@@ -351,6 +373,15 @@
   public void testAddEmptySchemaFile()
          throws Exception
   {
+    // Get the last modified timestamp from the schema and then sleep for two
+    // milliseconds to make sure that any potential updates to the last
+    // modification time that it won't have any chance of happening in the same
+    // millisecond as the last update.
+    long beforeModifyTimestamp =
+              DirectoryServer.getSchema().getYoungestModificationTime();
+    Thread.sleep(2);
+
+
     String schemaDirectory = SchemaConfigManager.getSchemaDirectoryPath();
 
     File emptyFile = new File(schemaDirectory, "05-empty.ldif");
@@ -380,6 +411,8 @@
 
     Task task = getCompletedTask(DN.decode(taskDNStr));
     assertEquals(task.getTaskState(), TaskState.COMPLETED_SUCCESSFULLY);
+    assertFalse(DirectoryServer.getSchema().getYoungestModificationTime() ==
+                     beforeModifyTimestamp);
   }
 
 

--
Gitblit v1.10.0