TestEntry.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
*/
/**
* This class defines a set of tests for the {@link Entry} class.
* <p>
* At the moment this test suite only tests the parseAttribute method.
*/
public final class TestEntry extends TypesTestCase {
/**
* Create an entry with the specified single attribute type and value.
*
* @param type
* The attribute type.
* @param value
* The attribute value.
* @return The test entry.
*/
}
/**
* Create an entry with the specified attribute type and values.
*
* @param type
* The attribute type.
* @param values
* The array of attribute values.
* @return The test entry.
*/
// Construct entry DN.
try {
} catch (DirectoryException e) {
throw new RuntimeException(e);
}
// Get default object classes.
throw new RuntimeException("Unable to resolve object class top");
}
.getObjectClass("extensibleobject");
if (extensible == null) {
throw new RuntimeException(
"Unable to resolve object class extensibleObject");
}
// Construct the empty entry.
// Now add the attribute.
}
return testEntry;
}
/**
* Set up the environment for performing the tests in this suite.
*
* @throws Exception
* If the environment could not be set up.
*/
// This test suite depends on having the schema available, so we'll start
// the server.
}
/**
* Test the {@link Entry#parseAttribute(String)} method.
*/
@Test
public void testParseAttributeNotFound() throws Exception {
}
/**
* Test the {@link Entry#parseAttribute(String)} method.
*/
@Test
public void testParseAttributeBooleanTrue() throws Exception {
}
/**
* Test the {@link Entry#parseAttribute(String)} method.
*/
@Test
public void testParseAttributeBooleanFalse() throws Exception
{
}
/**
* Test the {@link Entry#parseAttribute(String)} method.
*/
public void testParseAttributeBooleanBad() throws Exception
{
throw new RuntimeException(
"An illegal boolean value did not throw an exception");
}
/**
* Test the {@link Entry#parseAttribute(String)} method.
*
* @throws Exception
* If the test failed unexpectedly.
*/
@Test
public void testParseAttributesInteger() throws Exception
{
.getAttributeType("supportedldapversion");
}
}
/**
* Test the {@link Entry#parseAttribute(String)} method.
*
* @throws Exception
* If the test failed unexpectedly.
*/
public void testParseAttributeIntegerBad() throws Exception
{
.getAttributeType("supportedldapversion");
}
/**
* Test the {@link Entry#parseAttribute(String)} method.
*/
@Test
public void testParseAttributesSubtreeSpecification()
throws Exception {
// Define a dummy attribute type, in case there is not one already
// in the core schema.
+ "SYNTAX 1.3.6.1.4.1.1466.115.121.1.45 )";
DirectoryServer.getSchema(), false);
// Test values.
"{ base \"dc=example, dc=com\", minimum 1, maximum 2 }",
"{ base \"dc=example, dc=com\", maximum 1 }",
"{ base \"dc=example, dc=com\", maximum 2 }" };
// Relative to the root DN.
}
for (Attribute a : attributes)
{
for (ByteString value : a)
{
}
}
}
/**
* Tests the {@code hasAttribute} method variants to ensure that they work
* properly for both attributes included directly, as well as attributes
* included as subtypes.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testHasAttribute()
throws Exception
{
"dn: cn=Test User,ou=People,dc=example,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"cn: Test User",
"cn;lang-en-US: Test User",
"givenName: Test",
"givenName;lang-en-US: Test",
"sn: User",
"sn;lang-en-US: User",
"creatorsName: cn=Directory Manager",
"createTimestamp: 20070101000000Z",
"modifiersName: cn=Directory Manager",
"modifyTimestamp: 20070101000001Z");
new LocalizableMessageBuilder()));
}
/**
* Tests the {@code hasUserAttribute} method variants to ensure that they work
* properly for both attributes included directly, as well as attributes
* included as subtypes.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testHasUserAttribute()
throws Exception
{
"dn: cn=Test User,ou=People,dc=example,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"cn: Test User",
"cn;lang-en-US: Test User",
"givenName: Test",
"givenName;lang-en-US: Test",
"sn: User",
"sn;lang-en-US: User",
"creatorsName: cn=Directory Manager",
"createTimestamp: 20070101000000Z",
"modifiersName: cn=Directory Manager",
"modifyTimestamp: 20070101000001Z");
new LocalizableMessageBuilder()));
}
/**
* Tests the {@code hasOperationalAttribute} method variants to ensure that
* they work properly for both attributes included directly, as well as
* attributes included as subtypes.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testHasOperationalAttribute()
throws Exception
{
"dn: cn=Test User,ou=People,dc=example,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"cn: Test User",
"cn;lang-en-US: Test User",
"givenName: Test",
"givenName;lang-en-US: Test",
"sn: User",
"sn;lang-en-US: User",
"creatorsName: cn=Directory Manager",
"createTimestamp: 20070101000000Z",
"modifiersName: cn=Directory Manager",
"modifyTimestamp: 20070101000001Z");
new LocalizableMessageBuilder()));
}
/**
* Tests the {@code getAttribute} method variants to ensure that they work
* properly for both attributes included directly, as well as attributes
* included as subtypes.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testGetAttribute()
throws Exception
{
"dn: cn=Test User,ou=People,dc=example,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"cn: Test User",
"cn;lang-en-US: Test User",
"givenName: Test",
"givenName;lang-en-US: Test",
"sn: User",
"sn;lang-en-US: User",
"creatorsName: cn=Directory Manager",
"createTimestamp: 20070101000000Z",
"modifiersName: cn=Directory Manager",
"modifyTimestamp: 20070101000001Z");
new LocalizableMessageBuilder()));
}
/**
* Tests the {@code getUserAttribute} method variants to ensure that they work
* properly for both attributes included directly, as well as attributes
* included as subtypes.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testGetUserAttribute()
throws Exception
{
"dn: cn=Test User,ou=People,dc=example,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"cn: Test User",
"cn;lang-en-US: Test User",
"givenName: Test",
"givenName;lang-en-US: Test",
"sn: User",
"sn;lang-en-US: User",
"creatorsName: cn=Directory Manager",
"createTimestamp: 20070101000000Z",
"modifiersName: cn=Directory Manager",
"modifyTimestamp: 20070101000001Z");
new LocalizableMessageBuilder()));
}
/**
* Tests the {@code getOperationalAttribute} method variants to ensure that
* they work properly for both attributes included directly, as well as
* attributes included as subtypes.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testGetOperationalAttribute()
throws Exception
{
"dn: cn=Test User,ou=People,dc=example,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"cn: Test User",
"cn;lang-en-US: Test User",
"givenName: Test",
"givenName;lang-en-US: Test",
"sn: User",
"sn;lang-en-US: User",
"creatorsName: cn=Directory Manager",
"createTimestamp: 20070101000000Z",
"modifiersName: cn=Directory Manager",
"modifyTimestamp: 20070101000001Z");
new LocalizableMessageBuilder()));
}
}