From f82b4f7e598ac5ca8e8d33fc4c0d19b3b084bdbe Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Thu, 09 Jun 2011 07:37:50 +0000
Subject: [PATCH] Partial fix OPENDJ-194: Minor improvements to change log content and configuration

---
 opendj-sdk/opends/resource/schema/03-changelog.ldif                                                           |    3 +
 opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ExternalChangeLogTest.java |   24 ++++++------
 opendj-sdk/opends/src/server/org/opends/server/workflowelement/externalchangelog/ECLSearchOperation.java      |   62 -------------------------------
 3 files changed, 14 insertions(+), 75 deletions(-)

diff --git a/opendj-sdk/opends/resource/schema/03-changelog.ldif b/opendj-sdk/opends/resource/schema/03-changelog.ldif
index 418c2f9..3fa0e70 100644
--- a/opendj-sdk/opends/resource/schema/03-changelog.ldif
+++ b/opendj-sdk/opends/resource/schema/03-changelog.ldif
@@ -78,7 +78,8 @@
   SINGLE-VALUE
   USAGE directoryOperation
   X-ORIGIN 'OpenDS Directory Server' )
-attributeTypes: ( 1.3.6.1.4.1.26027.1.1.590 NAME 'targetEntryUUID'
+attributeTypes: ( 1.3.6.1.4.1.26027.1.1.590
+  NAME ( 'targetEntryUUID' 'targetUniqueID' )
   DESC 'The OpenDS unique id of the entry targeted by the change'
   SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
   SINGLE-VALUE
diff --git a/opendj-sdk/opends/src/server/org/opends/server/workflowelement/externalchangelog/ECLSearchOperation.java b/opendj-sdk/opends/src/server/org/opends/server/workflowelement/externalchangelog/ECLSearchOperation.java
index c195824..9625ac4 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/workflowelement/externalchangelog/ECLSearchOperation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/workflowelement/externalchangelog/ECLSearchOperation.java
@@ -1192,42 +1192,6 @@
         operationalAttrs.put(aType, attrList);
       else
         uAttrs.put(aType, attrList);
-
-      if (draftChangenumber>0)
-      {
-        // compat mode
-        if((aType = DirectoryServer.getAttributeType("targetuniqueid")) == null)
-          aType = DirectoryServer.getDefaultAttributeType("targetUniqueID");
-        String dseeValue = null;
-        try
-        {
-          dseeValue = ECLSearchOperation.openDsToSunDseeNsUniqueId(targetUUID);
-        }
-        catch(Exception e)
-        {
-          Message errMessage =
-            NOTE_ERR_ENTRY_UID_DSEE_MAPPING.get(
-                targetDN.toNormalizedString(),
-                targetUUID,
-                e.getLocalizedMessage());
-          logError(errMessage);
-          if (debugEnabled())
-            TRACER.debugCaught(DebugLogLevel.ERROR, e);
-        }
-
-        // If the mapping fails, we don't want to stop the operation
-        // or not return this entry.
-        if (dseeValue != null)
-        {
-          a = Attributes.create(aType, dseeValue);
-          attrList = new ArrayList<Attribute>(1);
-          attrList.add(a);
-          if(aType.isOperational())
-            operationalAttrs.put(aType, attrList);
-          else
-            uAttrs.put(aType, attrList);
-        }
-      }
     }
 
     if((aType = DirectoryServer.getAttributeType("changelogcookie")) == null)
@@ -1314,32 +1278,6 @@
   }
 
   /**
-   * The unique identifier used in DSEE is named nsUniqueId and its format is
-   * HHHHHHHH-HHHHHHHH-HHHHHHHH-HHHHHHHH where H is a hex digit.
-   * An nsUniqueId value is for example 3970de28-08b311d9-8095b9bf-c4d9231c
-   * The unique identifier used in OpenDS is named entryUUID.
-   * Its value is for example entryUUID: 50dd9673-71e1-4478-b13c-dba387c4d7e1
-   * @param entryUid the OpenDS entry UID
-   * @return the Dsee format for the entry UID
-   */
-  private static String openDsToSunDseeNsUniqueId(String entryUid)
-  {
-    //  the conversion from one unique identifier to an other is
-    //  a question of formating : the last "-" is placed
-    StringBuilder buffer = new StringBuilder(entryUid);
-    //  Delete a "-" at 13 to get something like
-    buffer.deleteCharAt(13);
-
-    //  Delete a "-" at 23 to get something like
-    buffer.deleteCharAt(22);
-
-    //  Add the last "-" to get something like
-    buffer.insert(26,'-');
-
-    return buffer.toString();
-  }
-
-  /**
    * Traverse the provided search filter, looking for some conditions
    * on attributes that can be optimized in the ECL.
    * When found, populate the provided StartECLSessionMsg.
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ExternalChangeLogTest.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ExternalChangeLogTest.java
index 6489aa5..c5fb180 100644
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ExternalChangeLogTest.java
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ExternalChangeLogTest.java
@@ -251,7 +251,7 @@
     // First and last should be ok whenever a request has been done or not
     // in compat mode.
     ECLCompatTestLimits(1,4,true);replicationServer.clearDb();
-    
+
     // Test with a mix of domains, a mix of DSes
     ECLTwoDomains(); replicationServer.clearDb();
 
@@ -263,7 +263,7 @@
     int ts = ECLCompatWriteReadAllOps(1);
 
     ECLCompatNoControl(1);
-    
+
     // Write additional changes and read ECL from a provided draft change number
     ts = ECLCompatWriteReadAllOps(5);replicationServer.clearDb();
 
@@ -353,8 +353,8 @@
 
     // Test request from a provided change number - read 6
     ECLCompatReadFrom(6);
-    
-    // Test request from change number 1, just check that Cookie controls 
+
+    // Test request from change number 1, just check that Cookie controls
     // are not returned with entries, when not requested.
     ECLCompatNoControl(1);
 
@@ -2894,7 +2894,7 @@
           +  stackTraceToSingleLineString(e));
     }
   }
-  
+
   private int ECLCompatWriteReadAllOps(int firstDraftChangeNumber)
   {
     String tn = "ECLCompatWriteReadAllOps/" + String.valueOf(firstDraftChangeNumber);
@@ -3015,7 +3015,7 @@
             checkValue(resultEntry,"changelogcookie","o=test:"+cn1.toString()+";");
             checkValue(resultEntry,"targetentryuuid",user1entryUUID);
             checkValue(resultEntry,"changenumber",String.valueOf(firstDraftChangeNumber+0));
-            checkValue(resultEntry,"targetuniqueid","11111111-11121113-11141111-11111115");
+            checkValue(resultEntry,"targetuniqueid",user1entryUUID);
           } else if (i==2)
           {
             // check the ADD entry has the right content
@@ -3108,7 +3108,7 @@
             checkValue(resultEntry,"changelogcookie","o=test:"+cn1.toString()+";");
             checkValue(resultEntry,"targetentryuuid",user1entryUUID);
             checkValue(resultEntry,"changenumber",String.valueOf(firstDraftChangeNumber+0));
-            checkValue(resultEntry,"targetuniqueid","11111111-11121113-11141111-11111115");
+            checkValue(resultEntry,"targetuniqueid",user1entryUUID);
           } else if (i==2)
           {
             // check the ADD entry has the right content
@@ -3296,7 +3296,7 @@
           +  stackTraceToSingleLineString(e));
     }
     debugInfo(tn, "Ending test with success");
-    
+
   }
 
 
@@ -3588,7 +3588,7 @@
     }
     debugInfo(tn, "Ending test with success");
   }
-  
+
   private void ECLOperationalAttributesFailTest()
   {
     String tn = "ECLOperationalAttributesFailTest";
@@ -3598,7 +3598,7 @@
     try
     {
       LinkedHashSet<String> attributes = new LinkedHashSet<String>();
-      
+
       attributes.add("firstchangenumber");
       attributes.add("lastchangenumber");
       attributes.add("changelog");
@@ -3619,7 +3619,7 @@
             null);
       waitOpResult(searchOp, ResultCode.SUCCESS);
       assertEquals(searchOp.getSearchEntries().size(), 1);
-      
+
       LinkedList<SearchResultEntry> entries = searchOp.getSearchEntries();
       assertEquals(entries.size(), 1);
       for (SearchResultEntry resultEntry : entries)
@@ -3634,7 +3634,7 @@
           assertEquals(getAttributeValue(resultEntry, "lastExternalChangelogCookie"),
                 null);
       }
-  
+
       debugInfo(tn, "Ending test with success");
     }
     catch(Exception e)

--
Gitblit v1.10.0