LDAPModifyTestCase.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 2014-2015 ForgeRock AS
*/
/**
* A set of test cases for the LDAPModify tool.
*/
@SuppressWarnings("javadoc")
public class LDAPModifyTestCase
extends ToolsTestCase
{
/** The path to a file containing an invalid bind password. */
private String invalidPasswordFile;
/** The path to a file containing a valid bind password. */
private String validPasswordFile;
/** The path to a file containing a simple, valid modification. */
private String modifyFilePath;
/**
* Ensures that the Directory Server is running and performs other necessary
* setup.
*
* @throws Exception If an unexpected problem occurs.
*/
public void startServerAndCreatePasswordFiles()
throws Exception
{
"set-sasl-mechanism-handler-prop",
"--handler-name", "DIGEST-MD5",
"--set", "server-fqdn:" + "127.0.0.1");
fileWriter.close();
fileWriter.close();
"changetype: modify",
"replace: description",
"description: foo");
}
"set-sasl-mechanism-handler-prop",
"--handler-name", "DIGEST-MD5",
"--remove", "server-fqdn:" + "127.0.0.1");
}
/**
* Retrieves sets of invalid arguments that may not be used to initialize
* the LDAPModify tool.
*
* @return Sets of invalid arguments that may not be used to initialize the
* LDAPModify tool.
*/
public Object[][] getInvalidArgumentLists()
{
{
"-D"
};
{
"-w"
};
{
"-j"
};
{
"-Y"
};
{
"-i"
};
{
"-K"
};
{
"-P"
};
{
"-W"
};
{
"-h"
};
{
"-p"
};
{
"-V"
};
{
"-f"
};
{
"-J"
};
{
"-o"
};
{
"-assertionFilter"
};
{
"--preReadAttributes"
};
{
"--postReadAttributes"
};
{
"-D", "cn=Directory Manager",
"-j", "no.such.file",
};
{
"-D", "cn=Directory Manager",
"-w", "password",
"-j", validPasswordFile,
};
{
"-V", "nonnumeric",
};
{
"-V", "1",
};
{
"-J", "1.2.3.4:invalidcriticality",
};
{
"-p", "nonnumeric",
};
{
"-p", "999999",
};
{
"-r",
"-K", "key.store.file",
};
{
"-Z",
"-r",
};
{
"--assertionFilter", "(invalid)"
};
{
"-f", "no.such.file"
};
{
}
return returnArray;
}
/**
* Tests the LDAPModify tool with sets of invalid arguments.
*
* @param args The set of arguments to use for the LDAPModify tool.
* @param invalidReason The reason the provided arguments were invalid.
*/
{
"Should have been invalid because: " + invalidReason);
}
/**
* Tests a simple modify operation using LDAPv2.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testLDAPv2Modify()
throws Exception
{
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-V", "2",
"--noPropertiesFile",
"-f", modifyFilePath
};
}
/**
* Tests a simple modify operation using LDAPv3.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testLDAPv3Modify()
throws Exception
{
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-V", "3",
"--noPropertiesFile",
"-f", modifyFilePath
};
}
/**
* Tests a simple modify operation over SSL using blind trust.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testSSLBlindTrust()
throws Exception
{
{
"-h", "127.0.0.1",
"-Z",
"-X",
"-D", "cn=Directory Manager",
"-w", "password",
"--noPropertiesFile",
"-f", modifyFilePath
};
}
/**
* Tests a simple modify operation over SSL using a trust store.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testSSLTrustStore()
throws Exception
{
{
"-h", "127.0.0.1",
"-Z",
"-P", trustStorePath,
"-D", "cn=Directory Manager",
"-w", "password",
"--noPropertiesFile",
"-f", modifyFilePath
};
}
/**
* Tests a simple modify operation with StartTSL using blind trust.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testStartTLSBlindTrust()
throws Exception
{
{
"-h", "127.0.0.1",
"-q",
"-X",
"-D", "cn=Directory Manager",
"-w", "password",
"--noPropertiesFile",
"-f", modifyFilePath
};
}
/**
* Tests a simple modify operation with StartTLS using a trust store.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testStartTLSTrustStore()
throws Exception
{
{
"-h", "127.0.0.1",
"-q",
"-P", trustStorePath,
"-D", "cn=Directory Manager",
"-w", "password",
"--noPropertiesFile",
"-f", modifyFilePath
};
}
/**
* Tests a simple modify operation over SSL using a trust store and SASL
* EXTERNAL.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testSSLTrustStoreSASLExternal()
throws Exception
{
"dn: cn=Test User,o=test",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"cn: Test User",
"givenName: Test",
"ds-privilege-name: bypass-acl",
"sn: User");
{
"-h", "127.0.0.1",
"-Z",
"-K", keyStorePath,
"-W", "password",
"-P", trustStorePath,
"-r",
"--noPropertiesFile",
"-f", modifyFilePath
};
}
/**
* Tests a simple modify operation over SSL using a trust store and SASL
* EXTERNAL while explicitly specifying a valid client certificate.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testSSLTrustStoreSASLExternalValidClientCert()
throws Exception
{
"dn: cn=Test User,o=test",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"cn: Test User",
"givenName: Test",
"ds-privilege-name: bypass-acl",
"sn: User");
{
"-h", "127.0.0.1",
"-Z",
"-K", keyStorePath,
"-W", "password",
"-N", "client-cert",
"-P", trustStorePath,
"-r",
"--noPropertiesFile",
"-f", modifyFilePath
};
}
/**
* Tests a simple modify operation over SSL using a trust store and SASL
* EXTERNAL while explicitly specifying an invalid client certificate.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testSSLTrustStoreSASLExternalInvalidClientCert()
throws Exception
{
"dn: cn=Test User,o=test",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"cn: Test User",
"givenName: Test",
"ds-privilege-name: bypass-acl",
"sn: User");
{
"-h", "127.0.0.1",
"-Z",
"-K", keyStorePath,
"-W", "password",
"-N", "invalid",
"-P", trustStorePath,
"-r",
"--noPropertiesFile",
"-f", modifyFilePath
};
}
/**
* Tests a simple modify operation with StartTLS using a trust store and SASL
* EXTERNAL.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testStartTLSTrustStoreSASLExternal()
throws Exception
{
"dn: cn=Test User,o=test",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"cn: Test User",
"givenName: Test",
"ds-privilege-name: bypass-acl",
"sn: User");
{
"-h", "127.0.0.1",
"-q",
"-K", keyStorePath,
"-W", "password",
"-P", trustStorePath,
"-r",
"--noPropertiesFile",
"-f", modifyFilePath
};
}
/**
* Tests a simple modify operation using CRAM-MD5 authentication.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testCRAMMD5()
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",
"ds-privilege-name: bypass-acl",
"userPassword: password",
"ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," +
"cn=Password Policies,cn=config");
{
"-h", "127.0.0.1",
"-o", "mech=CRAM-MD5",
"-o", "authid=u:test.user",
"-w", "password",
"--noPropertiesFile",
"-f", modifyFilePath
};
}
/**
* Tests a simple modify operation using DIGEST-MD5 authentication.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testDigestMD5()
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",
"ds-privilege-name: bypass-acl",
"userPassword: password",
"ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," +
"cn=Password Policies,cn=config");
{
"-h", "127.0.0.1",
"-o", "mech=DIGEST-MD5",
"-o", "authid=u:test.user",
"-o", "authzid=u:test.user",
"-w", "password",
"--noPropertiesFile",
"-f", modifyFilePath
};
}
/**
* Tests a simple modify operation using PLAIN authentication.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testPLAIN()
throws Exception
{
{
"-h", "127.0.0.1",
"-o", "mech=PLAIN",
"-o", "authid=dn:cn=Directory Manager",
"-w", "password",
"--noPropertiesFile",
"-f", modifyFilePath
};
}
/**
* Tests a simple modify operation using the --dry-run client-side option.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testModifyClientSideNoOp()
throws Exception
{
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"--dry-run",
"--noPropertiesFile",
"-f", modifyFilePath
};
}
/**
* Tests a simple add operation using the --dry-run client-side option.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testAddClientSideNoOp()
throws Exception
{
"dn: ou=People,o=test",
"changetype: add",
"objectClass: top",
"objectClass: organizationalUnit",
"o: test");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"--dry-run",
"--noPropertiesFile",
"-f", path
};
}
/**
* Tests a simple delete operation using the --dry-run client-side option.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testDeleteClientSideNoOp()
throws Exception
{
"dn: o=test",
"changetype: delete");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"--dry-run",
"--noPropertiesFile",
"-f", path
};
}
/**
* Tests a simple modify DN operation using the --dry-run client-side option.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testModifyDNClientSideNoOp()
throws Exception
{
"dn: ou=People,o=test",
"changetype: moddn",
"newRDN: ou=Users",
"deleteOldRDN: 1");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"--dry-run",
"--noPropertiesFile",
"-f", path
};
}
/**
* Tests a simple modify operation using LDAP No-Op control.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testModifyLDAPNoOp()
throws Exception
{
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"--noPropertiesFile",
"-f", modifyFilePath
};
}
/**
* Tests a simple modify operation using LDAP No-Op control with an alternate
* name.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testModifyLDAPNoOpAltName()
throws Exception
{
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-J", "no-op:true",
"--noPropertiesFile",
"-f", modifyFilePath
};
}
/**
* Tests a simple add operation using LDAP No-Op control.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testAddLDAPNoOp()
throws Exception
{
"dn: ou=People,o=test",
"changetype: add",
"objectClass: top",
"objectClass: organizationalUnit",
"ou: People");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"--noPropertiesFile",
"-f", path
};
}
/**
* Tests a simple add operation using LDAP No-Op control with an alternate
* name.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testAddLDAPNoOpAltName()
throws Exception
{
"dn: ou=People,o=test",
"changetype: add",
"objectClass: top",
"objectClass: organizationalUnit",
"ou: People");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-J", "no-op:true",
"--noPropertiesFile",
"-f", path
};
}
/**
* Tests a simple delete operation using LDAP No-Op control.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testDeleteLDAPNoOp()
throws Exception
{
"dn: o=test",
"changetype: delete");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"--noPropertiesFile",
"-f", path
};
}
/**
* Tests a simple delete operation using LDAP No-Op control with an alternate
* name.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testDeleteLDAPNoOpAltName()
throws Exception
{
"dn: o=test",
"changetype: delete");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-J", "no-op:true",
"--noPropertiesFile",
"-f", path
};
}
/**
* Tests a simple modify DN operation using LDAP No-Op control.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testModifyDNLDAPNoOp()
throws Exception
{
"dn: ou=People,o=test",
"objectClass: top",
"objectClass: organizationalUnit",
"ou: People");
"dn: ou=People,o=test",
"changetype: moddn",
"newRDN: ou=Users",
"deleteOldRDN: 1");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"--noPropertiesFile",
"-f", path
};
}
/**
* Tests a simple modify DN operation using LDAP No-Op control with an
* alternate name.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testModifyDNLDAPNoOpAltName()
throws Exception
{
"dn: ou=People,o=test",
"objectClass: top",
"objectClass: organizationalUnit",
"ou: People");
"dn: ou=People,o=test",
"changetype: moddn",
"newRDN: ou=Users",
"deleteOldRDN: 1");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-J", "no-op:true",
"--noPropertiesFile",
"-f", path
};
}
/**
* Tests a simple modify operation using the LDAP assertion control in which
* the assertion is true.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testModifyLDAPAssertionTrue()
throws Exception
{
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"--assertionFilter", "(o=test)",
"--noPropertiesFile",
"-f", modifyFilePath
};
}
/**
* Tests a simple modify operation using the LDAP assertion control in which
* the assertion is not true.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testModifyLDAPAssertionFalse()
throws Exception
{
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"--assertionFilter", "(o=foo)",
"--noPropertiesFile",
"-f", modifyFilePath
};
}
/**
* Tests a simple delete operation using the LDAP assertion control in which
* the assertion is true.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testDeleteLDAPAssertionTrue()
throws Exception
{
"changetype: delete");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"--assertionFilter", "(o=test)",
"--noPropertiesFile",
"-f", path
};
}
/**
* Tests a simple modify DN operation using the LDAP assertion control in
* which the assertion is true.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testModifyDNLDAPAssertionTrue()
throws Exception
{
"dn: ou=People,o=test",
"objectClass: top",
"objectClass: organizationalUnit",
"ou: People");
"changetype: moddn",
"newRDN: ou=Users",
"deleteOldRDN: 1");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"--assertionFilter", "(ou=People)",
"--noPropertiesFile",
"-f", path
};
}
/**
* Tests a simple modify operation using the LDAP pre-read control with a
* single attribute.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testModifyLDAPPreReadSingleAttribute()
throws Exception
{
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"--preReadAttributes", "o",
"--noPropertiesFile",
"-f", modifyFilePath
};
}
/**
* Tests a simple modify operation using the LDAP pre-read control with a
* single attribute.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testModifyLDAPPreReadMultipleAttributes()
throws Exception
{
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"--preReadAttributes", "o,objectClass",
"--noPropertiesFile",
"-f", modifyFilePath
};
}
/**
* Tests a simple delete operation using the LDAP pre-read control with a
* single attribute.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testDeleteLDAPPreReadSingleAttribute()
throws Exception
{
"changetype: delete");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"--preReadAttributes", "o",
"--noPropertiesFile",
"-f", path
};
}
/**
* Tests a simple modify DN operation using the LDAP pre-read control with a
* single attribute.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testModifyDNLDAPPreReadSingleAttribute()
throws Exception
{
"dn: ou=People,o=test",
"objectClass: top",
"objectClass: organizationalUnit",
"ou: People");
"changetype: moddn",
"newRDN: ou=Users",
"deleteOldRDN: 1");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"--preReadAttributes", "o",
"--noPropertiesFile",
"-f", path
};
}
/**
* Tests a simple modify operation using the LDAP post-read control with a
* single attribute.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testModifyLDAPostReadSingleAttribute()
throws Exception
{
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"--postReadAttributes", "o",
"--noPropertiesFile",
"-f", modifyFilePath
};
}
/**
* Tests a simple modify operation using the LDAP post-read control with a
* single attribute.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testModifyLDAPPostReadMultipleAttributes()
throws Exception
{
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"--postReadAttributes", "o,objectClass",
"--noPropertiesFile",
"-f", modifyFilePath
};
}
/**
* Tests a simple add operation using the LDAP post-read control with a
* single attribute.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testAddLDAPostReadSingleAttribute()
throws Exception
{
"dn: ou=People,o=test",
"changetype: add",
"objectClass: top",
"objectClass: organizationalUnit",
"ou: People");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"--postReadAttributes", "o",
"--noPropertiesFile",
"-f", path
};
}
/**
* Tests a simple modify DN operation using the LDAP post-read control with a
* single attribute.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testModifyDNLDAPostReadSingleAttribute()
throws Exception
{
"dn: ou=People,o=test",
"objectClass: top",
"objectClass: organizationalUnit",
"ou: People");
"changetype: moddn",
"newRDN: ou=Users",
"deleteOldRDN: 1");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"--postReadAttributes", "o",
"--noPropertiesFile",
"-f", path
};
}
/**
* Tests a modify operation that will fail on the server side.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testServerSideModifyFailure()
throws Exception
{
"dn: ou=People,o=test",
"changetype: modify",
"replace: description",
"description: foo");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"--postReadAttributes", "o,objectClass",
"--noPropertiesFile",
"-f", path
};
}
/**
* Tests performing an add operation with an explicit changetype.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testAddExplicitChangeType()
throws Exception
{
"dn: ou=People,o=test",
"changetype: add",
"objectClass: top",
"objectClass: organizationalUnit",
"ou: People");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"--noPropertiesFile",
"-f", path
};
}
/**
* Tests performing an add operation with an implied changetype.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testAddImplicitChangeType()
throws Exception
{
"dn: ou=People,o=test",
"objectClass: top",
"objectClass: organizationalUnit",
"ou: People");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-a",
"--noPropertiesFile",
"-f", path
};
}
/**
* Tests performing a modify DN operation.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testModifyDN()
throws Exception
{
"dn: ou=People,o=test",
"changetype: add",
"objectClass: top",
"objectClass: organizationalUnit",
"ou: People",
"",
"dn: ou=People,o=test",
"changetype: moddn",
"newRDN: ou=Users",
"deleteOldRDN: 1");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"--noPropertiesFile",
"-f", path
};
}
/**
* Tests performing a delete operation.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testDelete()
throws Exception
{
"dn: ou=People,o=test",
"changetype: add",
"objectClass: top",
"objectClass: organizationalUnit",
"ou: People",
"",
"dn: ou=People,o=test",
"changetype: delete");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"--noPropertiesFile",
"-f", path
};
}
/**
* Tests the inclusion of multiple arbitrary controls in the request to the
* server.
*
* @throws Exception If an unexpectd problem occurs.
*/
@Test
public void testMultipleRequestControls()
throws Exception
{
"dn: o=test",
"changetype: delete");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"--noPropertiesFile",
"-f", path
};
}
/**
* Tests with various forms of malformed LDIF changes.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testMalformedLDIF()
throws Exception
{
"dn: o=test",
"description: No Changetype",
"",
"dn: o=test",
"changetype: invalid",
"replace: description",
"description: Invalid Changetype",
"",
"dn: o=test",
"changetype: modify",
"invalid: description",
"description: Invalid Attribute Modification",
"",
"dn: ou=People,o=test",
"",
"dn: ou=People,o=test",
"changetype: add",
"",
"dn: ou=People,o=test",
"changetype: moddn",
"",
"dn: ou=People,o=test",
"changetype: moddn",
"newrdn: invalid",
"deleteOldRDN: 1",
"",
"dn: ou=People,o=test",
"changetype: moddn",
"newrdn: ou=Users",
"deleteOldRDN: invalid");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-c",
"--noPropertiesFile",
"-f", path
};
}
/**
* Tests a modify attempt failure without continueOnError.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testMalformedLDIFNoContinueOnError()
throws Exception
{
"dn: o=test",
"description: No Changetype",
"",
"dn: o=test",
"changetype: invalid",
"replace: description",
"description: Invalid Changetype");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"--noPropertiesFile",
"-f", path
};
}
/**
* Tests the LDAPModify tool with the "--help" option.
*/
@Test
public void testHelp()
{
}
}