ErrorLogAccountStatusNotificationHandlerTestCase.java revision ea1068c292e9b341af6d6b563cd8988a96be20a9
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at legal-notices/CDDLv1_0.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
* Portions Copyright 2011-2015 ForgeRock AS.
*/
/**
* A set of test cases for the error log account status notification handler.
*/
public class ErrorLogAccountStatusNotificationHandlerTestCase
extends ExtensionsTestCase
{
/**
* Ensures that the Directory Server is running.
*
* @throws Exception If an unexpected problem occurs.
*/
public void startServer()
throws Exception
{
}
/**
* Retrieves a set of invalid configuration entries that should cause the
* notification handler initialization to fail.
*
* @return A set of invalid configuration entries that should cause the
* notification handler initialization to fail.
*
* @throws Exception If an unexpected problem occurs.
*/
public Object[][] getInvalidConfigs()
throws Exception
{
"dn: cn=Error Log Handler,cn=Account Status Notification Handlers," +
"cn=config",
"objectClass: top",
"objectClass: ds-cfg-account-status-notification-handler",
"objectClass: ds-cfg-error-log-account-status-notification-handler",
"cn: Error Log Handler",
"ds-cfg-java-class: org.opends." +
"server.extensions.ErrorLogAccountStatusNotificationHandler",
"ds-cfg-enabled: true",
"",
"dn: cn=Error Log Handler,cn=Account Status Notification Handlers," +
"cn=config",
"objectClass: top",
"objectClass: ds-cfg-account-status-notification-handler",
"objectClass: ds-cfg-error-log-account-status-notification-handler",
"cn: Error Log Handler",
"ds-cfg-java-class: org.opends." +
"server.extensions.ErrorLogAccountStatusNotificationHandler",
"ds-cfg-enabled: true",
"ds-cfg-account-status-notification-type: invalid",
"",
"dn: cn=Error Log Handler,cn=Account Status Notification Handlers," +
"cn=config",
"objectClass: top",
"objectClass: ds-cfg-account-status-notification-handler",
"objectClass: ds-cfg-error-log-account-status-notification-handler",
"cn: Error Log Handler",
"ds-cfg-java-class: org.opends." +
"server.extensions.ErrorLogAccountStatusNotificationHandler",
"ds-cfg-enabled: true",
"ds-cfg-account-status-notification-type: password-reset",
"ds-cfg-account-status-notification-type: invalid");
{
}
return configEntries;
}
/**
* Tests to ensure that the notification handler initialization fails with an
* invalid configuration.
*
* @param e The configuration entry to use to initialize the account status
* notificaton handler.
*
* @throws Exception If an unexpected problem occurs.
*/
expectedExceptions = { ConfigException.class,
InitializationException.class })
public void testInalidConfigs(Entry e)
throws Exception
{
);
}
/**
* Tests to ensure that the error log account status notification handler is
* configured and enabled within the Directory Server.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testHandlerEnabled()
throws Exception
{
"Handlers,cn=config";
}
/**
* Retrieves the set of valid notification types that may be used with an
* account status notification handler.
*
* @return The set of valid notification types that may be used with an
* account status notification handler.
*/
public Object[][] getNotificationTypes()
{
{
}
return typeArray;
}
/**
* Tests the <CODE>handleStatusNotification</CODE> method.
*
* @param notificationType The account status notification type to be
* tested.
*
* @throws Exception If an unexpected problem occurs.
*/
public void testHandleStatusNotification(
throws Exception
{
"dn: uid=test.user,o=test",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"userPassword: password");
"Handlers,cn=config";
userEntry, false);
{
}
else if (notificationType == PASSWORD_EXPIRING)
{
}
else if ((notificationType == PASSWORD_CHANGED) ||
{
}
}
}