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.
| | |
| | | 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)); |
| | |
| | | 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 |
| | | { |