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

Matthew Swift
25.45.2015 99b80cd414fd73af73dfa07be202fd32e9bc498d
OPENDJ-2404: add back support for modify DN operations which just change case

Only check that the new DN does not exist if it is not the same as the
old DN. Added a unit test to the pluggable backend test case.
2 files modified
23 ■■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/EntryContainer.java 5 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/PluggableBackendImplTestCase.java 18 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/EntryContainer.java
@@ -2023,7 +2023,10 @@
                                           getMatchedDN(txn, newSuperiorDN),
                                           null);
            }
            if (dn2id.get(txn, newTargetDN) != null)
            // Check that an entry with the new name does not already exist, but take care to handle the case where
            // the user is renaming the entry with an equivalent name, e.g. "cn=matt" to "cn=Matt".
            if (!oldTargetDN.equals(newTargetDN) && dn2id.get(txn, newTargetDN) != null)
            {
              throw new DirectoryException(ResultCode.ENTRY_ALREADY_EXISTS,
                                           ERR_MODIFYDN_ALREADY_EXISTS.get(newTargetDN));
opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/PluggableBackendImplTestCase.java
@@ -692,6 +692,24 @@
    assertEquals(dbEntry.getName(), prevDN, "Original entry has not been renamed");
  }
  @Test(description = "OPENDJ-2404")
  public void testRenameEntrySameDNDifferentCase() throws Exception
  {
    DN prevDN = DN.valueOf("uid=user.0,ou=People," + testBaseDN);
    DN newDN = DN.valueOf("uid=USER.0,ou=People," + testBaseDN);
    Entry renameEntry = backend.getEntry(prevDN).duplicate(false);
    renameEntry.setDN(newDN);
    backend.renameEntry(prevDN, renameEntry, null);
    Entry dbEntry = backend.getEntry(newDN);
    assertEquals(dbEntry.getName().rdn().toString(), "uid=USER.0");
    renameEntry.setDN(prevDN);
    backend.renameEntry(newDN, renameEntry, null);
    dbEntry = backend.getEntry(prevDN);
    assertEquals(dbEntry.getName().rdn().toString(), "uid=user.0");
  }
  @Test
  public void testDeleteEntry() throws Exception
  {