mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Matthew Swift
09.37.2011 7b0c543e99d6a93ec8ea3472eb0eb9fd8fac460e
Partial fix OPENDJ-194: Minor improvements to change log content and configuration

Remove targetUniqueID attribute and instead declare it as an alias of targetEntryUUID.
3 files modified
89 ■■■■ changed files
opends/resource/schema/03-changelog.ldif 3 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/workflowelement/externalchangelog/ECLSearchOperation.java 62 ●●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ExternalChangeLogTest.java 24 ●●●● patch | view | raw | blame | history
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
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.
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)