ModifyOperationTestCase.java revision 9aa1482c49865483f798f91ef7d16f03cc3ec811
/*
* 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-2011 Sun Microsystems, Inc.
* Portions Copyright 2011-2015 ForgeRock AS
*/
/**
* A set of test cases for modify operations.
*/
@SuppressWarnings("javadoc")
public class ModifyOperationTestCase
extends OperationTestCase
{
public void restartServer() throws Exception {
}
/** Some of the tests disable the backends, so we reenable them here. */
@AfterMethod(alwaysRun=true)
public void reenableBackend() throws DirectoryException {
{
}
}
/**
* Retrieves a set of modify operations that may be used for testing.
*
* @return A set of modify operations that may be used for testing.
*
* @throws Exception If an unexpected problem occurs.
*/
{
{
}
return objArray;
}
{
return new ModifyOperationBasis(
}
{
return new ModifyOperationBasis(
}
public Object[][] getBaseDNs()
{
return new Object[][] {
{ "o=test"}
};
}
public void clearTestBackend() throws Exception
{
}
/** {@inheritDoc} */
{
{
}
return ops;
}
/**
* Tests the <CODE>getRawEntryDN</CODE> and <CODE>setRawEntryDN</CODE>
* methods.
*
* @param modifyOperation The modify operation to be tested.
*/
{
}
/**
* Tests the <CODE>getEntryDN</CODE> method that should decode
* the raw entry dn and return a non-null DN.
*/
@Test
public void testGetEntryDNInitiallyNull()
{
}
{
}
/**
* Tests the <CODE>getEntryDN</CODE> method for the case in which we expect
* the DN to be initially non-null.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testGetEntryDNInitiallyNonNull() throws Exception
{
}
/**
* Tests the <CODE>getEntryDN</CODE> method for the case in which we expect
* the DN to be initially non-null, then is null after the raw DN is
* changed, but becomes non-null after the call to <CODE>getEntryDN</CODE>.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testGetEntryDNNonNullChangedToNull() throws Exception
{
}
/**
* Tests the <CODE>getRawModifications</CODE>,
* <CODE>addRawModification</CODE>, and <CODE>setRawModifications</CODE>
* methods.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
}
/**
* Invokes methods to retrieve members of a modify operation after it has
* completed successfully.
*
* @param modifyOperation The modify operation to examine. It should have
* completed successfully.
*/
private void retrieveSuccessfulOperationElements(
{
@SuppressWarnings("unchecked")
(List<LocalBackendModifyOperation>) modifyOperation.getAttachment(Operation.LOCALBACKENDOPERATIONS);
{
}
}
/**
* Invokes methods to retrieve members of a modify operation after it has
* completed unsuccessfully.
*
* @param modifyOperation The modify operation to examine. It should have
* completed failed.
*/
private void retrieveFailedOperationElements(
{
}
/**
* Tests the <CODE>getModifications</CODE> and <CODE>addModification</CODE>
* methods.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testGetAndAddModifications() throws Exception
{
}
/**
* Tests to ensure that a modify attempt fails if an invalid DN is provided.
*/
@Test
public void testFailInvalidDN()
{
}
/**
* Tests to ensure that a modify attempt fails if the target DN is a suffix
* that doesn't exist.
*/
@Test
public void testFailNoSuchSuffix()
{
}
/**
* Tests to ensure that a modify attempt fails if the target DN doesn't have a
* parent.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
ModifyOperation modifyOperation = processModify("cn=test,ou=nosuchparent," + baseDN, replace(attr));
}
/**
* Tests to ensure that a modify attempt fails if the target entry doesn't
* exist.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
}
/**
* Tests to ensure that a modify attempt fails if the modification doesn't
* contain any changes.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
}
/**
* Tests the ability to perform a modification that adds a new attribute to an
* entry.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testSuccessAddAttribute() throws Exception
{
}
/**
* Tests the ability to perform a modification that adds a new value to an
* existing attribute.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testSuccessAddAttributeValue() throws Exception
{
}
/**
* Tests the ability to perform a modification that adds a new attribute with
* options to an entry.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
}
{
int count = 0;
{
}
return count;
}
/**
* Tests to ensure that a modify attempt fails if an attempt is made to add a
* second value to a single-valued attribute.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password");
}
/**
* Tests to ensure that a modify attempt fails if an attempt is made to add a
* second value to a single-valued operational attribute.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password",
"ds-pwp-account-disabled: true");
}
/**
* Tests to ensure that a modify attempt fails if an attempt is made to
* replace a single-valued attribute with multiple values.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password");
}
/**
* Tests to ensure that a modify attempt fails if an attempt is made to
* replace a single-valued operational attribute with multiple values.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password");
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
/**
* Tests to ensure that a modify attempt fails if an attempt is made to add a
* value that matches one that already exists.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password");
}
/**
* Tests to ensure that a modify attempt fails if an attempt is made to
* replace an attribute with a set of values that contains a duplicate.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password");
}
/**
* Tests to ensure that a modify attempt fails if an attempt is made to
* replace with a value that violates the attribute syntax.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password",
"manager: cn=boss," + baseDN);
}
/**
* Tests to ensure that a modify attempt fails if an attempt is made to add a
* value that violates the attribute syntax.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password");
}
/**
* Tests to ensure that a modify attempt fails if an attempt is made to add an
* attribute that is not allowed by any objectclass.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password");
}
/**
* Tests to ensure that a modify attempt succeeds if an attempt is made to add
* an attribute that is not allowed by any objectclass but the
* extensibleObject objectclass is also added.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password");
}
/**
* Tests to ensure that a modify attempt fails if an attempt is made to
* replace the RDN attribute.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password");
}
/**
* Tests to ensure that a modify attempt fails if an attempt is made to
* remove the RDN attribute.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password");
}
/**
* Tests to ensure that a modify attempt fails if an attempt is made to
* remove the RDN attribute value.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password");
}
/**
* Tests to ensure that a modify attempt fails if an attempt is made to
* replace an RDN attribute in a multivalued RDN.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: givenName=Test+sn=User," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password");
}
/**
* Tests to ensure that a modify attempt fails if an attempt is made to
* remove an RDN attribute value from a multivalued RDN.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: givenName=Test+sn=User," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password");
}
/**
* Tests the ability to perform a modification that removes a complete
* attribute from an entry.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password");
}
/**
* Tests the ability to perform a modification that removes one of multiple
* values from an entry.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password",
"mail: foo",
"mail: bar");
}
/**
* Tests the ability to perform a modification that removes the only value of
* an existing attribute.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password",
"mail: foo");
}
/**
* Tests the ability to perform a modification that removes all of multiple
* values from an existing attribute.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password",
"mail: foo",
"mail: bar");
}
/**
* Tests to ensure that a modify attempt fails if an attempt is made to remove
* a required attribute.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password");
}
/**
* Tests to ensure that a modify attempt fails if an attempt is made to remove
* the only value for a required attribute.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password");
}
/**
* Tests the ability to perform a modification that replaces an existing
* attribute with something else.
*
* @throws Exception If an unexpected problem occurs.
*/
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password",
"mail: foo");
}
/**
* Tests the ability to perform a modification that replaces an existing
* attribute with the same value.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password",
"mail: foo");
}
/**
* Tests the ability to perform a modification that deletes a value then
* adds the same value in a single operation.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password",
"mail: foo");
ModifyOperation modifyOperation = processModify("uid=test.user," + baseDN, delete(attr), add(attr));
}
/**
* Tests the ability to perform a modification that deletes one value of an
* attribute containing two values, the values are the same but the attribute
* options differ.
*
* @throws Exception If an unexpected problem occurs.
*/
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"givenName;lang-de: X",
"givenName;lang-fr: X",
"displayName: Test User",
"userPassword: password",
"mail: foo");
SearchRequest request = newSearchRequest(baseDN, SearchScope.WHOLE_SUBTREE, "(givenName;lang-de=X)");
}
/**
* Tests the ability to perform a modification that replaces an existing
* attribute with nothing.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password",
"mail: foo");
}
/**
* Tests the ability to perform a modification that replaces a nonexistent
* attribute with nothing.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password");
}
/**
* Tests the ability to perform a modification that replaces a nonexistent
* attribute with a new attribute.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password");
}
/**
* Tests the ability to perform a modification that removes the only existing
* value and adds a new value.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password",
"mail: foo");
ModifyOperation modifyOperation = processModify("uid=test.user," + baseDN, delete(attr), add(attr2));
}
/**
* Tests the ability to perform a modification that removes one of many values
* and adds a new value.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password",
"mail: foo",
"mail: bar");
ModifyOperation modifyOperation = processModify("uid=test.user," + baseDN, delete(attr), add(attr2));
}
/**
* Tests the ability to perform a modification that removes one of many values
* existing value and adds multiple new values.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password",
"mail: foo");
ModifyOperation modifyOperation = processModify("uid=test.user," + baseDN, delete(attr), add(attr2));
}
/**
* Tests to ensure that a modify attempt fails if an attempt is made to remove
* a nonexistent attribute.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"userPassword: password");
}
/**
* Tests to ensure that a modify attempt fails if an attempt is made to remove
* a nonexistent attribute value.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password");
}
/**
* Tests to ensure that a modify attempt fails if an attempt is made to remove
* all objectclasses from an entry.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password");
}
/**
* Tests to ensure that a modify attempt fails if an attempt is made to
* replace all objectclasses in an entry with nothing.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password");
}
/**
* Tests to ensure that a modify attempt fails if an attempt is made to remove
* the structural objectclass from an entry.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: ou=People," + baseDN,
"objectClass: top",
"objectClass: organizationalUnit",
"objectClass: extensibleObject",
"ou: People");
}
/**
* Tests to ensure that a modify attempt fails if an attempt is made to add a
* second structural objectclass.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: ou=People," + baseDN,
"objectClass: top",
"objectClass: organizationalUnit",
"objectClass: extensibleObject",
"ou: People");
}
/**
* Tests the ability to perform a modification that increments a single-valued
* integer attribute by one.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password",
"mail: foo",
"employeeNumber: 1");
}
/**
* Tests the ability to perform a modification that increments a single-valued
* integer attribute by ten.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password",
"mail: foo",
"employeeNumber: 1");
}
/**
* Tests the ability to perform a modification that increments a single-valued
* integer attribute by negative one.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password",
"mail: foo",
"employeeNumber: 1");
}
{
boolean found = false;
{
for (ByteString v : a)
{
found = true;
}
}
}
/**
* Tests to ensure that a modify attempt fails if an attempt is made to
* increment a non-numeric attribute.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password");
}
/**
* Tests to ensure that a modify attempt fails if an attempt is made to
* increment a non-numeric attribute.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password",
"mail: 1");
}
/**
* Tests the ability to perform a modification that increments a multivalued
* integer attribute.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password",
"roomNumber: 1",
"roomNumber: 2");
}
/**
* Tests to ensure that a modify attempt fails if an attempt is made to
* perform an increment with no increment values in the request.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password",
"roomNumber: 1");
}
/**
* Tests to ensure that a modify attempt fails if an attempt is made to
* perform an increment with multiple increment values in the request.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password",
"roomNumber: 1");
}
/**
* Tests to ensure that a modify attempt fails if an attempt is made to
* increment a non existing attribute.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password");
}
/**
* Tests the ability to perform a modification that removes an unneeded
* auxiliary objectclass.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"objectClass: extensibleObject",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password",
"mail: foo",
"employeeNumber: 1");
}
/**
* Tests the ability to perform a modification that adds an auxiliary
* objectclass.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password",
"mail: foo",
"employeeNumber: 1");
}
/**
* Tests that an attempt to add an objectclass that already exists will fail.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password",
"mail: foo",
"employeeNumber: 1");
}
/**
* Tests that an attempt to remove an objectclass that does not exist will fail.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password",
"mail: foo",
"employeeNumber: 1");
}
/**
* Tests to ensure that a modify attempt fails if an attempt is made to
* alter an attribute marked NO-USER-MODIFICATION.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password");
LDAPWriter w = new LDAPWriter(s);
w.writeMessage(message);
message = r.readMessage();
w.writeMessage(message);
message = r.readMessage();
}
/**
* Tests to ensure that a modify attempt fails if the server is completely
* read-only.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password",
"mail: foo",
"employeeNumber: 1");
}
/**
* Tests to ensure that an internal modify attempt succeeds when the server is
* in an internal-only writability mode.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password",
"mail: foo",
"employeeNumber: 1");
}
/**
* Tests to ensure that an external modify attempt fails when the server is in
* an internal-only writability mode.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password",
"mail: foo",
"employeeNumber: 1");
LDAPWriter w = new LDAPWriter(s);
w.writeMessage(message);
message = r.readMessage();
w.writeMessage(message);
message = r.readMessage();
}
/**
* Tests to ensure that a modify attempt fails if the backend is completely
* read-only.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password",
"mail: foo",
"employeeNumber: 1");
}
/**
* Tests to ensure that an internal modify attempt succeeds when the backend
* is in an internal-only writability mode.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password",
"mail: foo",
"employeeNumber: 1");
}
/**
* Tests to ensure that an external modify attempt fails when the backend is
* in an internal-only writability mode.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password",
"mail: foo",
"employeeNumber: 1");
LDAPWriter w = new LDAPWriter(s);
w.writeMessage(message);
message = r.readMessage();
w.writeMessage(message);
message = r.readMessage();
}
/**
* Tests to ensure that change listeners are properly notified for a
* successful modify operation.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testSuccessNotifyChangeListeners() throws Exception
{
try
{
}
finally
{
}
}
/**
* Tests to ensure that change listeners are not notified for a failed modify
* modify operation.
*
* @throws Exception If an unexpected problem occurs.
*/
{
try
{
}
finally
{
}
}
/**
* Tests a modify operation that gets canceled before startup.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
}
/**
* Tests a modify operation that gets canceled before startup.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
}
/**
* Tests a modify operation in which the server cannot obtain a lock on the
* target entry because there is already a read lock held on it.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
try
{
}
finally
{
}
}
/**
* Tests a modify operation that should be disconnected in a pre-parse plugin.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
LDAPWriter w = new LDAPWriter(s);
w.writeMessage(message);
message = r.readMessage();
w.writeMessage(message);
message = r.readMessage();
{
// If we got an element back, then it must be a notice of disconnect
// unsolicited notification.
}
StaticUtils.close(s);
}
/**
* Tests a modify operation that should be disconnected in a pre-operation
* plugin.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testDisconnectInPreOperationModify() throws Exception
{
LDAPWriter w = new LDAPWriter(s);
w.writeMessage(message);
message = r.readMessage();
"PreOperation"));
w.writeMessage(message);
message = r.readMessage();
{
// If we got an element back, then it must be a notice of disconnect
// unsolicited notification.
}
StaticUtils.close(s);
}
/**
* Tests a modify operation that should be disconnected in a post-operation
* plugin.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
LDAPWriter w = new LDAPWriter(s);
w.writeMessage(message);
message = r.readMessage();
"PostOperation"));
w.writeMessage(message);
// The operation should NOT be aborted at the post operation stage. While
// the plugin can disconnect the client, the modify should have already
// been committed to the backend and a SUCCESS COULD get back to the
// client.
while (true)
{
message = r.readMessage();
{
// The connection has been closed.
break responseLoop;
}
switch (message.getProtocolOpType())
{
case OP_TYPE_MODIFY_RESPONSE:
// This was expected. The disconnect didn't happen until after the
// response was sent.
break;
// The server is notifying us that it will be closing the connection.
break responseLoop;
default:
// This is a problem. It's an unexpected response.
StaticUtils.close(s);
" encountered in " +
"testDisconnectInPostOperationModify");
}
}
StaticUtils.close(s);
}
/**
* Tests a modify operation that should be disconnected in a post-response
* plugin.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
LDAPWriter w = new LDAPWriter(s);
w.writeMessage(message);
message = r.readMessage();
"PostResponse"));
w.writeMessage(message);
while (true)
{
message = r.readMessage();
{
// The connection has been closed.
break responseLoop;
}
switch (message.getProtocolOpType())
{
case OP_TYPE_MODIFY_RESPONSE:
// This was expected. The disconnect didn't happen until after the
// response was sent.
break;
// The server is notifying us that it will be closing the connection.
break responseLoop;
default:
// This is a problem. It's an unexpected response.
StaticUtils.close(s);
" encountered in " +
"testDisconnectInPostResponseModify");
}
}
StaticUtils.close(s);
}
{
return newArrayList(mods);
}
{
return newArrayList(mods);
}
/**
* Tests a modify operation that attempts to set a value for an attribute type
* that is marked OBSOLETE in the server schema.
*
* @param baseDN The base DN for the test backend.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: cn=schema",
"changetype: modify",
"add: attributeTypes",
"attributeTypes: ( testmodifyobsoleteattribute-oid " +
"NAME 'testModifyObsoleteAttribute' OBSOLETE " +
"SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE " +
"X-ORGIN 'SchemaBackendTestCase' )");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-f", path
};
"dn: " + baseDN,
"changetype: modify",
"add: objectClass",
"objectClass: extensibleObject",
"-",
"replace: testModifyObsoleteAttribute",
"testModifyObsoleteAttribute: foo");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-f", path
};
}
/**
* Tests a modify operation that attemtps to add an OBSOLETE object class to
* an entry.
*
* @param baseDN The base DN for the test backend.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: cn=schema",
"changetype: modify",
"add: objectClasses",
"objectClasses: ( testmodifyaddobsoleteobjectclass-oid " +
"NAME 'testModifyAddObsoleteObjectClass' OBSOLETE " +
"AUXILIARY MAY description X-ORGIN 'SchemaBackendTestCase' )");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-f", path
};
"dn: " + baseDN,
"changetype: modify",
"add: objectClass",
"objectClass: testModifyAddObsoleteObjectClass");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-f", path
};
}
/**
* Tests the behavior of the server when short-circuiting out of a modify
* operation in the pre-parse phase with a success result code.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testShortCircuitInPreParse() throws Exception
{
}
/**
* Tests modify operation with the Permissive Modify control.
*/
/**
* Test to ensure that a modify operation with the Permissive Modify control
* succeeds when an attempt is made to add a value that matches one
* that already exists.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password");
}
/**
* Test to ensure that a modify operation with the Permissive Modify control
* succeeds when an attempt is made to delete a non existent value.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password");
}
/**
* Test to ensure that a modify operation with the Permissive Modify control
* succeeds when an attempt is made to delete a non existent attribute.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password");
}
/**
* Tests a modify operation that attempts change the user password doing
* a delete of all values followed of an add of a new value.
*
* @param baseDN The base DN for the test backend.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=testPassword01.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password");
"dn: uid=testPassword01.user," + baseDN,
"changetype: modify",
"delete: userPassword",
"-",
"add: userPassword",
"userPassword: aNewPassword");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-f", path
};
}
/**
* Tests a modify operation that attempts change the user password doing
* a delete of a clear text value followed of an add of a new value.
*
* @param baseDN The base DN for the test backend.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: uid=testPassword02.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password");
"dn: uid=testPassword02.user," + baseDN,
"changetype: modify",
"delete: userPassword",
"userPassword: password",
"-",
"add: userPassword",
"userPassword: aNewPassword");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-f", path
};
}
/**
* Tests a modify operation that attempts change the user password doing
* a delete of an encrypted value followed of an add of a new value.
*
* @param baseDN The base DN for the test backend.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
"dn: " + dn,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password");
{
for (ByteString v : a)
{
}
}
"dn: " + dn,
"changetype: modify",
"delete: userPassword",
"userPassword: " + passwd,
"-",
"add: userPassword",
"userPassword: aNewPassword");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-f", path
};
}
/**
* Tests that it is possible to delete userPassword attributes which have
* options. Options are not allowed for passwords, but we should allow users
* to clean them up, for example, after an import of legacy data.
*
* @throws Exception
* If an unexpected problem occurs.
*/
@Test
public void testModifyDelPasswordAttributeWithOption() throws Exception
{
// @formatter:off
"dn: cn=Test User,o=test",
"objectClass: top",
"objectClass: person",
"sn: User",
"cn: Test User",
"userPassword: password",
"userPassword;deleted: oldpassword");
// Constraint violation.
"dn: cn=Test User,o=test",
"changetype: modify",
"delete: userPassword;deleted",
"-"
), 0);
// @formatter:on
}
/**
* Tests that it is possible to delete userPassword attributes using an empty
* replace which have options. Options are not allowed for passwords, but we
* should allow users to clean them up, for example, after an import of legacy
* data.
*
* @throws Exception
* If an unexpected problem occurs.
*/
@Test
public void testModifyReplaceEmptyPasswordAttributeWithOption() throws Exception
{
// @formatter:off
"dn: cn=Test User,o=test",
"objectClass: top",
"objectClass: person",
"sn: User",
"cn: Test User",
"userPassword: password",
"userPassword;deleted: oldpassword");
// Constraint violation.
"dn: cn=Test User,o=test",
"changetype: modify",
"replace: userPassword;deleted",
"-"
), 0);
// @formatter:on
}
/**
* Tests that it is not possible to add userPassword attributes which have
* options. Options are not allowed for passwords.
*
* @throws Exception
* If an unexpected problem occurs.
*/
@Test
public void testModifyAddPasswordAttributeWithOption() throws Exception
{
// @formatter:off
"dn: cn=Test User,o=test",
"objectClass: top",
"objectClass: person",
"sn: User",
"cn: Test User",
"userPassword: password");
// Constraint violation.
"dn: cn=Test User,o=test",
"changetype: modify",
"add: userPassword;added",
"userPassword;added: newpassword",
"-"
), 19);
// @formatter:on
}
/**
* Tests that it is not possible to add userPassword attributes which have
* options. Options are not allowed for passwords.
*
* @throws Exception
* If an unexpected problem occurs.
*/
@Test
public void testModifyReplaceWithValuesPasswordAttributeWithOption() throws Exception
{
// @formatter:off
"dn: cn=Test User,o=test",
"objectClass: top",
"objectClass: person",
"sn: User",
"cn: Test User",
"userPassword: password");
// Constraint violation.
"dn: cn=Test User,o=test",
"changetype: modify",
"replace: userPassword;added",
"userPassword;added: newpassword",
"-"
), 19);
// @formatter:on
}
/**
* Tests that the binary option is automatically added to modifications if it
* is missing and required.
*
* @throws Exception
* If an unexpected problem occurs.
*/
{
"dn: uid=test.user," + baseDN,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"displayName: Test User",
"userPassword: password",
"mail: foo",
"employeeNumber: 1");
"BAYTAlVTMRMwEQYDVQQHEwpDdXBlcnRpb25lMRwwGgYDVQQLExNQcm9kdWN0IERl" +
"dmVsb3BtZW50MRQwEgYDVQQDEwtCYWJzIEplbnNlbjAeFw0xMjA1MDIxNjM0MzVa" +
"Fw0xMjEyMjExNjM0MzVaMFYxCzAJBgNVBAYTAlVTMRMwEQYDVQQHEwpDdXBlcnRp" +
"b25lMRwwGgYDVQQLExNQcm9kdWN0IERldmVsb3BtZW50MRQwEgYDVQQDEwtCYWJz" +
"IEplbnNlbjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEApysa0c9qc8FB8gIJ" +
"mKeNUPitwiKOjoFDmtimcZ4bx5UTAYLbbHMpEdwSpMC5iF2UioM7qdiwpAfZBd6Z" +
"69vqNxuUJ6tP+hxtr/aSgMH2i8ECAwEAAaN7MHkwCQYDVR0TBAIwADAsBglghkgB" +
"hvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYE" +
"FLlZD3aKDa8jdhzoByOFMAJDs2osMB8GA1UdIwQYMBaAFLlZD3aKDa8jdhzoByOF" +
"MAJDs2osMA0GCSqGSIb3DQEBBQUAA4GBAE5vccY8Ydd7by2bbwiDKgQqVyoKrkUg" +
"6CD0WRmc2pBeYX2z94/PWO5L3Fx+eIZh2wTxScF+FdRWJzLbUaBuClrxuy0Y5ifj" +
"axuJ8LFNbZtsp1ldW3i84+F5+SYT+xI67ZcoAtwx/VFVI9s5I/Gkmu9f9nxjPpK7" +
"1AIUXiE3Qcck";
}
/**
* Tests to ensure that the compressed schema is refreshed after an object
* class is changed (OPENDJ-169).
*
* @throws Exception
* If an unexpected problem occurs.
*/
@Test
public void testCompressedSchemaRefresh() throws Exception
{
"objectClass: top", "objectClass: person",
"objectClass: organizationalPerson", "sn: User", "cn: Test User");
// First check that adding "dc" fails because it is not allowed by
// inetOrgPerson.
int res = applyModifications(
false,
"dn: cn=schema",
"changetype: modify",
"delete: objectclasses",
"objectClasses: ( 2.5.6.6 NAME 'person' SUP top STRUCTURAL MUST ( sn $ cn )"
+ " MAY ( userPassword $ telephoneNumber $ seeAlso $ description )"
+ " X-ORIGIN 'RFC 4519' )",
"-",
"add: objectclasses",
"objectClasses: ( 2.5.6.6 NAME 'person' SUP top STRUCTURAL MUST ( sn $ cn )"
+ " MAY ( dc $ userPassword $ telephoneNumber $ seeAlso $ description )"
+ " X-ORIGIN 'RFC 4519' )");
try
{
// Modify existing entry.
// Add new entry and modify.
"objectClass: top", "objectClass: person",
"objectClass: organizationalPerson", "sn: User2", "cn: Test User2");
}
finally
{
int result = applyModifications(
false,
"dn: cn=schema",
"changetype: modify",
"delete: objectclasses",
"objectClasses: ( 2.5.6.6 NAME 'person' SUP top STRUCTURAL MUST ( sn $ cn )"
+ " MAY ( dc $ userPassword $ telephoneNumber $ seeAlso $ description )"
+ " X-ORIGIN 'RFC 4519' )",
"-",
"add: objectclasses",
"objectClasses: ( 2.5.6.6 NAME 'person' SUP top STRUCTURAL MUST ( sn $ cn )"
+ " MAY ( userPassword $ telephoneNumber $ seeAlso $ description )"
+ " X-ORIGIN 'RFC 4519' )");
// Add new entry and modify (this time it should fail).
"objectClass: top", "objectClass: person",
"objectClass: organizationalPerson", "sn: User3", "cn: Test User3");
}
}
}