SizePropertyDefinitionTest.java revision e75c2484bff064fbbf51e92aed4f37b08e6427b7
/*
* 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
* 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
* trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2008 Sun Microsystems, Inc.
*/
/**
* SizePropertyDefinition Tester.
*/
public class SizePropertyDefinitionTest extends DirectoryServerTestCase {
/**
* Sets up tests
*
* @throws Exception
* If the server could not be initialized.
*/
// This test suite depends on having the schema available, so
// we'll start the server.
}
/**
* Tests creation of builder succeeds
*/
@Test
public void testCreateBuilder() {
}
/**
*/
@Test
public void testLowerLimit1() {
}
/**
* Creates data for testing string-based limit values
* @return data
*/
public Object[][] createStringLimitData() {
return new Object[][]{
{"1 b", 1L},
// { null, 0 }
};
}
/**
* Creates data for testing limit values
* @return data
*/
public Object[][] createIllegalLimitData() {
return new Object[][]{
{-1L, 0L, true}, // lower, upper, lower first
{0L, -1L, false},
{2L, 1L, true},
{2L, 1L, false}
};
}
/**
* @param limit unit limit
* @param expectedValue to compare
*/
}
/**
*/
@Test
public void testUpperLimit1() {
}
/**
* @param limit upper limit
* @param expectedValue to compare
*/
}
/**
* @param upper upper limit
* @param lower lower limit
* @param lowerFirst when true sets the lower limit property first
*/
if (lowerFirst) {
} else {
}
}
/**
* Tests the allowUnlimited property
*/
@Test
public void testIsAllowUnlimited1() {
builder.setAllowUnlimited(true);
}
/**
* Tests the allowUnlimited property
*/
public void testIsAllowUnlimited2() {
builder.setAllowUnlimited(false);
}
/**
* Tests the allowUnlimited property
*/
public void testIsAllowUnlimited3() {
builder.setAllowUnlimited(false);
}
/**
* Creates illegal data for validate value
* @return data
*/
public Object[][] createvalidateValueData() {
return new Object[][]{
{5L, 10L, false, 7L},
{5L, 10L, true, -1L},
};
}
/**
* Tests that validateValue works
* @param value to validate
* @param allowUnlimited when true allows unlimited
* @param high upper limit
* @param low lower limit
*/
}
/**
* Creates illegal data for validate value
* @return data
*/
public Object[][] createIllegalValidateValueData() {
return new Object[][]{
{5L, 10L, false, 1L},
{5L, 10L, false, 11L},
{5L, 10L, false, -1L},
{5L, 10L, true, 2L},
{5L, 10L, true, 11L}
};
}
/**
* Tests that validateValue throws exceptions
* @param value to validate
* @param low lower limit
* @param high upper limit
* @param allowUnlimited when true allows unlimited
*/
expectedExceptions = {AssertionError.class,NullPointerException.class,IllegalPropertyValueException.class})
}
/**
* Creates encode test data
* @return data
*/
public Object[][] createEncodeValueData() {
return new Object[][]{
{-1L, "unlimited"},
{0L, "0 b"},
{1L, "1 b"},
{2L, "2 b"},
{999L, "999 b"},
{1000L, "1 kb"},
{1001L, "1001 b"},
{1023L, "1023 b"},
{1024L, "1 kib"},
{1025L, "1025 b"},
{1000L * 1000L, "1 mb"},
{1000L * 1000L * 1000L, "1 gb"},
{1024L * 1024L * 1024L, "1 gib"},
{1000L * 1000L * 1000L * 1000L, "1 tb"}
};
}
/**
* Tests encode value
* @param value to encode
* @param expectedValue to compare
*/
builder.setAllowUnlimited(true);
}
/**
* Test that accept doesn't throw and exception
*/
@Test
public void testAccept() {
builder.setAllowUnlimited(true);
Void o) {
return true;
}
throws UnknownPropertyDefinitionException {
return false;
}
};
}
/**
* Make sure toString doesn't barf
*/
@Test
public void testToString() {
builder.setAllowUnlimited(true);
}
/**
* Test comparator method.
*/
@Test
public void testCompare() {
builder.setAllowUnlimited(true);
}
/**
* Tests default behavior.
*/
@Test
public void testSetDefaultBehaviorProvider() {
builder.setAllowUnlimited(true);
return null;
}
});
}
/**
* Tests option setting.
*/
@Test
public void testSetOption() {
}
}
return builder.getInstance();
}
}