ArrayList<RawModification> mods = new ArrayList<RawModification>();
mods.add(new LDAPModification(ModificationType.REPLACE,
new LDAPAttribute("ds-cfg-match-base-dn",
values)));
ModifyOperation modifyOperation =
conn.processModify(ByteString.valueOf(mapperDNString), mods);
assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
// Verify that we can't find the user anymore.
mappedEntry = mapper.getEntryForID("test");
assertNull(mappedEntry);
// Change the base DN to "o=test".
values.set(0, ByteString.valueOf("o=test"));
modifyOperation =
conn.processModify(ByteString.valueOf(mapperDNString), mods);
assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
// Verify that we can retrieve the user again.
mappedEntry = mapper.getEntryForID("test");
assertNotNull(mappedEntry);
assertEquals(mappedEntry.getDN(), DN.decode("uid=test,o=test"));
// Change the configuration back to its original setting.
values.clear();
modifyOperation =
conn.processModify(ByteString.valueOf(mapperDNString), mods);
assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
// Verify that we can still retrieve the user.
mappedEntry = mapper.getEntryForID("test");
assertNotNull(mappedEntry);