String dnStr = "cn=Default Password Policy,cn=Password Policies,cn=config";
String attr = "ds-cfg-allow-pre-encoded-passwords";
ArrayList<Modification> mods = new ArrayList<Modification>();
mods.add(new Modification(ModificationType.REPLACE,
Attributes.create(attr, "true")));
ModifyOperation modifyOperation =
conn.processModify(DN.decode(dnStr), mods);
assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
String[] args =
{
"--noPropertiesFile",
"-h", "127.0.0.1",
"-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
"-D", "cn=Directory Manager",
"-w", "password",
"-a", "dn:uid=test.user,o=test",
"-n", "{SSHA}Fv4b7f4AnRMUiGqBi9QA1xJrTtRTqS3WpRi81g=="
};
int exitCode =
LDAPPasswordModify.mainPasswordModify(args, false, null, null);
assertEquals(exitCode, 0);
mods.clear();
mods.add(new Modification(ModificationType.REPLACE,
Attributes.create(attr, "false")));
modifyOperation = conn.processModify(DN.decode(dnStr), mods);
assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
}