"userPassword: password");
String dnStr = "cn=Error Log Handler,cn=Account Status Notification " +
"Handlers,cn=config";
DN handlerDN = DN.decode(dnStr);
AccountStatusNotificationHandler handler =
DirectoryServer.getAccountStatusNotificationHandler(handlerDN);
assertNotNull(handler);
Entry userEntry =
DirectoryServer.getEntry(DN.decode("uid=test.user,o=test"));
PasswordPolicyState pwPolicyState =
new PasswordPolicyState(userEntry, false);
PasswordPolicy policy = pwPolicyState.getPolicy();
HashMap<AccountStatusNotificationProperty,List<String>>
notificationProperties =
new HashMap<AccountStatusNotificationProperty,List<String>>();
ArrayList<String> propList = new ArrayList<String>(1);
propList.add(policy.getConfigEntryDN().toString());
notificationProperties.put(PASSWORD_POLICY_DN, propList);
if (notificationType == ACCOUNT_TEMPORARILY_LOCKED)
{
propList = new ArrayList<String>(1);
propList.add("300");
notificationProperties.put(SECONDS_UNTIL_UNLOCK, propList);
propList = new ArrayList<String>(1);
propList.add("5 minutes");
notificationProperties.put(TIME_UNTIL_UNLOCK, propList);
propList = new ArrayList<String>(1);
propList.add(new Date(System.currentTimeMillis() + 300000L).toString());
notificationProperties.put(ACCOUNT_UNLOCK_TIME, propList);
}
else if (notificationType == PASSWORD_EXPIRING)
{
propList = new ArrayList<String>(1);
propList.add("86400");
notificationProperties.put(SECONDS_UNTIL_EXPIRATION, propList);
propList = new ArrayList<String>(1);
propList.add("1 day");
notificationProperties.put(TIME_UNTIL_EXPIRATION, propList);
propList = new ArrayList<String>(1);
propList.add(new Date(System.currentTimeMillis() + 86400000L).toString());
notificationProperties.put(PASSWORD_EXPIRATION_TIME, propList);
}
else if ((notificationType == PASSWORD_CHANGED) ||
(notificationType == PASSWORD_RESET))
{
propList = new ArrayList<String>(1);
propList.add("oldpassword");
notificationProperties.put(OLD_PASSWORD, propList);
propList = new ArrayList<String>(1);
propList.add("newpassword");
notificationProperties.put(NEW_PASSWORD, propList);
}
AccountStatusNotification notification =
new AccountStatusNotification(notificationType, userEntry,
Message.raw("Test Modification"),
notificationProperties);
handler.handleStatusNotification(notification);
}