PasswordControlTest.java revision 530e312594f469609337996570cf0ea504554a68
/*
* 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 2014 ForgeRock AS
*/
/**
* Test password control
*/
public class PasswordControlTest
extends ControlsTestCase
{
/**
* Create values for PasswordPolicyErrorType
*/
public Object[][] createPasswordPolicyErrorTypeData()
{
return new Object[][]
{
{ values } };
}
/**
* Test if int value are ok
*/
public void checkIntValuePasswordPolicyErrorTypeTest(
{
{
}
}
/**
* Test If we have only the required values
*/
public void checkRequiredValuesPasswordPolicyErrorTypeTest(
{
// Retrieve the values
// Check if we have the correct munber
// Check if we have the correct int value
{
}
}
/**
* Test invalid int values
*/
public void checkInvalidIntPasswordPolicyErrorTypeTest(
{
for (int i=-10 ; i< 10 ; i++)
{
}
}
/**
* Create correct values
*/
public Object[][] createPasswordPolicyWarningTypeData()
{
return new Object[][]
{
{ values } };
}
/**
* Test if byte values are ok
*/
public void checkIntValuePasswordPolicyWarningTypeTest(
{
for (byte i : expectedValues.keySet())
{
}
}
/**
* Test If we have only the required values
*/
public void checkRequiredValuesPasswordPolicyWarningTypeTest(
{
// Retrieve the values
// Check if we have the correct munber
// Check if we have the correct byte value
{
}
}
/**
* Test invalid int values
*/
public void checkInvalidIntPasswordPolicyWarningTypeTest(
{
for (int i = 0x70; i < 0x90; i++)
{
{
continue;
}
else
{
}
}
}
/**
* Create values for PasswordExpiredControl
*/
public Object[][] createPasswordExpiredControlData()
{
return new Object[][] {
{ true },
{ false },
};
}
/**
* Test OID
*/
@Test()
public void checkPasswordOID() throws Exception
{
//assertEquals(OID_PASSWORD_POLICY_CONTROL, "");
}
/**
* Test "Netscape password expired control" implementation
*/
public void passwordExpiredControlTest(
boolean isCritical) throws Exception
{
// Check default constructor
// Check constructor with oid and boolean
// Check the decode
try
{
assertTrue(false,
"should be allow to create a passwordExpiredControl with value");
}
catch (DirectoryException e)
{
// Normal case
assertTrue(true,
"should be allow to create a passwordExpiredControl with value");
}
// Check toString
// Check encode
}
/**
* Create values for PasswordControl
*/
public Object[][] createPasswordExpiringControlData()
{
return new Object[][] {
{ true, 1},
{ false, 2},
};
}
/**
* Test "Netscape password expired control" implementation
*/
public void passwordExpiringControlTest(
{
// Check constructor with int
// Check constructor with oid, boolean and int
// Check the decode
try
{
assertTrue(false,
"shouldn't be allow to create PasswordExpiringControl without value");
}
catch (DirectoryException e)
{
// Normal case
assertTrue(true,
"shouldn't be allow to create PasswordExpiringControl without value");
}
try
{
assertTrue(false,
"shouldn't be allow to create PasswordExpiringControl with a wrong value");
}
catch (DirectoryException e)
{
// Normal case
assertTrue(true,
"shouldn't be allow to create PasswordExpiringControl with a wrong value");
}
}
/**
* Create values for PasswordControl
*/
public Object[][] createPasswordPolicyRequestControlData()
{
return new Object[][] {
{ true},
{ false},
};
}
/**
* Test PasswordPolicyRequestControl
*/
public void passwordPolicyRequestControlTest(
boolean isCritical) throws Exception
{
// Check default constructor
// Check constructor with oid and boolean
try
{
assertTrue(false,
"should be allow to create a PasswordPolicyRequestControl with value");
}
catch (DirectoryException e)
{
// Normal case
assertTrue(true,
"should be allow to create a PasswordPolicyRequestControl with value");
}
// Check toString
}
/**
* Create values for PasswordControl
*/
public Object[][] createPasswordPolicyResponseControlData()
{
return new Object[][] {
{ true , -1},
{ false , -1},
{ true , 0},
{ false , 0}
};
}
/**
* Test PasswordPolicyResponseControl
*/
public void passwordPolicyResponseControlTest(
boolean isCritical, int warningValue)
throws Exception
{
// Check default constructor
// check constructor PasswordPolicyResponseControl
// (PasswordPolicyWarningType warningType,
// int warningValue,
// PasswordPolicyErrorType errorType)
{
{
}
}
// check constructor PasswordPolicyResponseControl
// (PString oid, boolean isCritical,
// PasswordPolicyWarningType warningType,
// warningValue,
// PasswordPolicyErrorType errorType)
{
.values())
{
}
}
{
.values())
{
// check to String
"PasswordPolicyResponseControl(" +
warningType.toString() +
"=" +
", " +
")" ;
// check null value for the control
try
{
assertTrue(false,"the control should have a value");
}
catch (DirectoryException e)
{
// normal case
assertTrue(true,"the control should have a value");
}
// check null warning type
try
{
}
catch (DirectoryException e)
{
assertTrue(false,"We should be able to decode the control");
}
// check null error type
try
{
}
catch (DirectoryException e)
{
assertTrue(false,"We should be able to decode the control");
}
}
}
}
}