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

ludovicp
07.22.2010 5641c2d85f395b4d7c65c5635f0453295be23e12
Fix an issue with the replication repair commands. The control was looked at after some checks it was supposed to skip. This prevented some entries to be repared.
The changes are also updating the unit tests making sure the Replication Repair control is properly tested.
3 files modified
102 ■■■■ changed files
opendj-sdk/opends/resource/schema/02-config.ldif 1 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendAddOperation.java 19 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/ReplicationRepairControlTest.java 82 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/resource/schema/02-config.ldif
@@ -594,6 +594,7 @@
  NAME 'ds-sync-hist'
  ORDERING historicalCsnOrderingMatch
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.40
  NO-USER-MODIFICATION
  USAGE directoryOperation
  X-ORIGIN 'OpenDS Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.120
opendj-sdk/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendAddOperation.java
@@ -203,15 +203,6 @@
        break addProcessing;
      }
      objectClasses = getObjectClasses();
      userAttributes = getUserAttributes();
      operationalAttributes = getOperationalAttributes();
      if ((objectClasses == null ) || (userAttributes == null) ||
          (operationalAttributes == null))
      {
        break addProcessing;
      }
      // Check for a request to cancel this operation.
      checkIfCanceled(false);
@@ -304,6 +295,16 @@
          }
        }
        objectClasses = getObjectClasses();
        userAttributes = getUserAttributes();
        operationalAttributes = getOperationalAttributes();
        if ((objectClasses == null ) || (userAttributes == null) ||
            (operationalAttributes == null))
        {
          break addProcessing;
        }
        for (AttributeType at : userAttributes.keySet())
        {
          // If the attribute type is marked "NO-USER-MODIFICATION" then fail
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/ReplicationRepairControlTest.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2008 Sun Microsystems, Inc.
 *      Copyright 2008-2010 Sun Microsystems, Inc.
 */
package org.opends.server.replication.plugin;
@@ -40,23 +40,23 @@
         throws Exception
  {
    TestCaseUtils.initializeTestBackend(true);
    // Test that we can't add an entry with the entryuuid attribute
    // without specifying the replication repair control.
    // without specifying the replication repair control.
    String path = TestCaseUtils.createTempFile(
        "dn: uid=test.repair," + TEST_ROOT_DN_STRING + "\n" +
        "changetype: add\n" +
        "objectClass: top\n" +
        "objectClass: person" +
        "objectClass: organizationalPerson" +
        "objectClass: inetOrgPerson" +
        "uid: test.repair" +
        "givenName: Test" +
        "sn: User" +
        "cn: Test User" +
        "userPassword: password" +
        "entryuuid: d5b910d8-47cb-4ac0-9e5f-0f4a77de58d4");
        "objectClass: person\n" +
        "objectClass: organizationalPerson\n" +
        "objectClass: inetOrgPerson\n" +
        "uid: test.repair\n" +
        "givenName: Test\n" +
        "sn: User\n" +
        "cn: Test User\n" +
        "userPassword: password\n" +
        "entryuuid: d5b910d8-47cb-4ac0-9e5f-0f4a77de58d4\n");
    String[] args =
    {
      "-h", "127.0.0.1",
@@ -66,25 +66,25 @@
      "-a",
      "-f", path
    };
    assertEquals(LDAPModify.mainModify(args, false, null, null), 65);
    assertEquals(LDAPModify.mainModify(args, false, null, null), 53);
    // Test that we can't add an entry with the ds-sync-hist attribute
    // without specifying the replication repair control.
    // without specifying the replication repair control.
    String path1 = TestCaseUtils.createTempFile(
        "dn: uid=test.repair," + TEST_ROOT_DN_STRING + "\n" +
        "changetype: add\n" +
        "objectClass: top\n" +
        "objectClass: person" +
        "objectClass: organizationalPerson" +
        "objectClass: inetOrgPerson" +
        "uid: test.repair" +
        "givenName: Test" +
        "sn: User" +
        "cn: Test User" +
        "userPassword: password" +
        "ds-sync-hist: description:00000108b3a6cbb800000001:del:deleted_value");
        "objectClass: person\n" +
        "objectClass: organizationalPerson\n" +
        "objectClass: inetOrgPerson\n" +
        "uid: test.repair\n" +
        "givenName: Test\n" +
        "sn: User\n" +
        "cn: Test User\n" +
        "userPassword: password\n" +
        "ds-sync-hist: description:00000108b3a6cbb800000001:del:deleted_value\n");
    String[] args1 =
    {
      "-h", "127.0.0.1",
@@ -96,8 +96,8 @@
    };
    assertEquals(LDAPModify.mainModify(args1, false, null, null), 65);
    assertEquals(LDAPModify.mainModify(args1, false, null, null), 53);
    // Now Test specifying the replication repair control makes
    // possible to add an entry with the entryuuid and ds-sync-hist attributes
    // (notice the -J repairControlOid in the ldapmodify arguments)
@@ -106,27 +106,27 @@
        "changetype: add\n" +
        "objectClass: top\n" +
        "objectClass: person" +
        "objectClass: organizationalPerson" +
        "objectClass: inetOrgPerson" +
        "uid: test.repair" +
        "givenName: Test" +
        "sn: User" +
        "cn: Test User" +
        "userPassword: password" +
        "ds-sync-hist: description:00000108b3a6cbb800000001:del:deleted_value" +
        "entryuuid: d5b910d8-47cb-4ac0-9e5f-0f4a77de58d4");
        "objectClass: organizationalPerson\n" +
        "objectClass: inetOrgPerson\n" +
        "uid: test.repair\n" +
        "givenName: Test\n" +
        "sn: User\n" +
        "cn: Test User\n" +
        "userPassword: password\n" +
        "ds-sync-hist: description:00000108b3a6cbb800000001:del:deleted_value\n" +
        "entryuuid: d5b910d8-47cb-4ac0-9e5f-0f4a77de58d4\n");
    String[] args2 =
    {
      "-h", "127.0.0.1",
      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
      "-D", "cn=Directory Manager",
      "-w", "password",
      "-J", "1.3.6.1.4.1.26027.1.5.2",
      "-J", "1.3.6.1.4.1.26027.1.5.2",
      "-a",
      "-f", path2
    };
    assertEquals(LDAPModify.mainModify(args2, false, null, null), 0);
  }
  }
}