LDAPSearchTestCase.java revision 1211
/*
* 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
*
*
* Portions Copyright 2006-2007 Sun Microsystems, Inc.
*/
/**
* A set of test cases for the LDAPSearch tool.
*/
public class LDAPSearchTestCase
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;
/**
* Ensures that the Directory Server is running and performs other necessary
* setup.
*
* @throws Exception If an unexpected problem occurs.
*/
@BeforeClass()
public void startServerAndCreatePasswordFiles()
throws Exception
{
fileWriter.close();
fileWriter.close();
}
/**
* Retrieves sets of invalid arguments that may not be used to initialize
* the LDAPSearch tool.
*
* @return Sets of invalid arguments that may not be used to initialize the
* LDAPSearch tool.
*/
public Object[][] getInvalidArgumentLists()
{
{
"-b"
};
{
"-D"
};
{
"-w"
};
{
"-j"
};
{
"-Y"
};
{
"-i"
};
{
"-K"
};
{
"-P"
};
{
"-W"
};
{
"-h"
};
{
"-p"
};
{
"-V"
};
{
"-f"
};
{
"-J"
};
{
"-z"
};
{
"-l"
};
{
"-s"
};
{
"-a"
};
{
"-o"
};
{
"-c"
};
{
"--assertionFilter"
};
{
"--matchedValuesFilter"
};
{
"-I"
};
{
"--invalidLongArgument"
};
{
"(objectClass=*)"
};
{
"-b", ""
};
{
"-b", "",
"(invalidfilter)"
};
{
"-b", "",
"--assertionFilter", "(invalidfilter)",
"(objectClass=*)"
};
{
"-b", "",
"--matchedValuesFilter", "(invalidfilter)",
"(objectClass=*)"
};
{
"-D", "cn=Directory Manager",
"-j", "no.such.file",
"-b", "",
"(objectClass=*)"
};
{
"-D", "cn=Directory Manager",
"-w", "password",
"-j", validPasswordFile,
"-b", "",
"(objectClass=*)"
};
{
"-b", "",
"-V", "nonnumeric",
"(objectClass=*)"
};
{
"-b", "",
"-V", "1",
"(objectClass=*)"
};
{
"-b", "",
"-f", "no.such.file"
};
{
"-b", "",
"-J", "1.2.3.4:invalidcriticality",
"(objectClass=*)"
};
{
"-b", "",
"-s", "invalid",
"(objectClass=*)"
};
{
"-b", "",
"-a", "invalid",
"(objectClass=*)"
};
{
"-b", "",
"-C", "invalid",
"(objectClass=*)"
};
{
"-b", "",
"-C", "ps:invalid",
"(objectClass=*)"
};
{
"-b", "",
"-C", "ps:add,delete,modify,modifydn,invalid",
"(objectClass=*)"
};
{
"-b", "",
"-C", "ps:all:invalid",
"(objectClass=*)"
};
{
"-b", "",
"-C", "ps:all:1:invalid",
"(objectClass=*)"
};
{
"-p", "nonnumeric",
"-b", "",
"(objectClass=*)"
};
{
"-p", "999999",
"-b", "",
"(objectClass=*)"
};
{
"-z", "nonnumeric",
"-b", "",
"(objectClass=*)"
};
{
"-l", "nonnumeric",
"-b", "",
"(objectClass=*)"
};
{
"-r",
"-b", "",
"-K", "key.store.file",
"(objectClass=*)"
};
{
"-Z",
"-r",
"-b", "",
"(objectClass=*)"
};
{
}
return returnArray;
}
/**
* Tests the LDAPSearch tool with sets of invalid arguments.
*
* @param args The set of arguments to use for the LDAPSearch tool.
* @param invalidReason The reason that the set of arguments is not valid.
*/
{
"Should have been invalid because: " + invalidReason);
}
/**
* Tests a simple LDAPv2 search.
*/
@Test()
public void testSimpleLDAPv2Search()
{
{
"-h", "127.0.0.1",
"-V", "2",
"-D", "cn=Directory Manager",
"-w", "password",
"-b", "",
"-s", "base",
"(objectClass=*)"
};
}
/**
* Tests a simple LDAPv3 search.
*/
@Test()
public void testSimpleLDAPv3Search()
{
{
"-h", "127.0.0.1",
"-V", "3",
"-D", "cn=Directory Manager",
"-w", "password",
"-b", "",
"-s", "base",
"(objectClass=*)"
};
}
/**
* Tests a simple invocation using the "--dry-run" option with a valid argument
* set.
*/
@Test()
public void testNoOpSearchValidArguments()
{
{
"-h", "doesnt.need.to.resolve",
"-V", "3",
"-D", "cn=Directory Manager",
"-w", "password",
"-b", "",
"-s", "base",
"--dry-run",
"(objectClass=*)"
};
}
/**
* Tests a simple invocation using the "--dry-run" option with an invalid
* argument set.
*/
@Test()
public void testNoOpSearchInvalidArguments()
{
{
"-h", "doesnt.need.to.resolve",
"-V", "3",
"-D", "cn=Directory Manager",
"-w", "password",
"-b", "",
"-s", "invalid",
"--dry-run",
"(objectClass=*)"
};
}
/**
* Tests a simple LDAP search over SSL using blind trust.
*/
@Test()
public void testSimpleSearchSSLBlindTrust()
{
{
"-h", "127.0.0.1",
"-Z",
"-X",
"-b", "",
"-s", "base",
"(objectClass=*)"
};
}
/**
* Tests a simple LDAP search over SSL using a trust store.
*/
@Test()
public void testSimpleSearchSSLTrustStore()
{
{
"-h", "127.0.0.1",
"-Z",
"-P", trustStorePath,
"-b", "",
"-s", "base",
"(objectClass=*)"
};
}
/**
* Tests a simple LDAP search using StartTLS with blind trust.
*/
@Test()
public void testSimpleSearchStartTLSBlindTrust()
{
{
"-h", "127.0.0.1",
"-q",
"-X",
"-b", "",
"-s", "base",
"(objectClass=*)"
};
}
/**
* Tests a simple LDAP search using StartTLS with a trust store.
*/
@Test()
public void testSimpleSearchStartTLSTrustStore()
{
{
"-h", "127.0.0.1",
"-q",
"-P", trustStorePath,
"-b", "",
"-s", "base",
"(objectClass=*)"
};
}
/**
* Tests a simple LDAP search over SSL using a trust store and SASL EXTERNAL
* authentication.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testSimpleSearchSSLTrustStoreSASLExternal()
throws Exception
{
"dn: cn=Test User,o=test",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"cn: Test User",
"givenName: Test",
"sn: User");
e.getOperationalAttributes());
{
"-h", "127.0.0.1",
"-Z",
"-K", keyStorePath,
"-W", "password",
"-P", trustStorePath,
"-r",
"-b", "",
"-s", "base",
"(objectClass=*)"
};
}
/**
* Tests a simple LDAP search over SSL using a trust store and SASL EXTERNAL
* authentication when explicitly specifying a valid client certificate.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testSimpleSearchSSLTrustStoreSASLExternalValidClientCert()
throws Exception
{
"dn: cn=Test User,o=test",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"cn: Test User",
"givenName: Test",
"sn: User");
e.getOperationalAttributes());
{
"-h", "127.0.0.1",
"-Z",
"-K", keyStorePath,
"-W", "password",
"-N", "client-cert",
"-P", trustStorePath,
"-r",
"-b", "",
"-s", "base",
"(objectClass=*)"
};
}
/**
* Tests a simple LDAP search over SSL using a trust store and SASL EXTERNAL
* authentication when explicitly specifying an invalid client certificate.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
throws Exception
{
"dn: cn=Test User,o=test",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"cn: Test User",
"givenName: Test",
"sn: User");
e.getOperationalAttributes());
{
"-h", "127.0.0.1",
"-Z",
"-K", keyStorePath,
"-W", "password",
"-N", "invalid",
"-P", trustStorePath,
"-r",
"-b", "",
"-s", "base",
"(objectClass=*)"
};
}
/**
* Tests a simple LDAP search using StartTLS with a trust store and SASL
* EXTERNAL authentication.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testSimpleSearchStartTLSTrustStoreSASLExternal()
throws Exception
{
"dn: cn=Test User,o=test",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"cn: Test User",
"givenName: Test",
"sn: User");
e.getOperationalAttributes());
{
"-h", "127.0.0.1",
"-q",
"-K", keyStorePath,
"-W", "password",
"-P", trustStorePath,
"-r",
"-b", "",
"-s", "base",
"(objectClass=*)"
};
}
/**
* Tests a simple search 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",
"userPassword: password",
"ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," +
"cn=Password Policies,cn=config");
e.getOperationalAttributes());
{
"-h", "127.0.0.1",
"-o", "mech=CRAM-MD5",
"-o", "authid=u:test.user",
"-w", "password",
"-b", "",
"-s", "base",
"(objectClass=*)"
};
}
/**
* Tests a simple search operation using CRAM-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",
"userPassword: password",
"ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," +
"cn=Password Policies,cn=config");
e.getOperationalAttributes());
{
"-h", "127.0.0.1",
"-o", "mech=DIGEST-MD5",
"-o", "authid=u:test.user",
"-o", "authzid=u:test.user",
"-o", "realm=o=test",
"-w", "password",
"-b", "",
"-s", "base",
"(objectClass=*)"
};
}
/**
* Tests a simple search 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",
"-b", "",
"-s", "base",
"(objectClass=*)"
};
}
/**
* Tests a search with a malformed bind DN.
*/
@Test()
public void testMalformedBindDN()
{
{
"-h", "127.0.0.1",
"-D", "malformed",
"-w", "password",
"-b", "",
"-s", "base",
"(objectClass=*)"
};
}
/**
* Tests a search with a nonexistent bind DN.
*/
@Test()
public void testNonExistentBindDN()
{
{
"-h", "127.0.0.1",
"-D", "cn=Does Not Exist",
"-w", "password",
"-b", "",
"-s", "base",
"(objectClass=*)"
};
}
/**
* Tests a search with an invalid password.
*/
@Test()
public void testInvalidBindPassword()
{
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "wrongPassword",
"-b", "",
"-s", "base",
"(objectClass=*)"
};
}
/**
* Tests a search with a valid password read from a file.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testValidPasswordFromFile()
throws Exception
{
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-j", validPasswordFile,
"-b", "",
"-s", "base",
"(objectClass=*)"
};
}
/**
* Tests a search with an invalid password read from a file.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testInvalidPasswordFromFile()
throws Exception
{
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-j", invalidPasswordFile,
"-b", "",
"-s", "base",
"(objectClass=*)"
};
}
/**
* Tests a search with a malformed base DN.
*/
@Test()
public void testMalformedBaseDN()
{
{
"-h", "127.0.0.1",
"-b", "malformed",
"-s", "base",
"(objectClass=*)"
};
}
/**
* Tests a search with a nonexistent base DN.
*/
@Test()
public void testNonExistentBaseDN()
{
{
"-h", "127.0.0.1",
"-b", "o=does not exist",
"-s", "base",
"(objectClass=*)"
};
}
/**
* Retrieves the set of valid search scopes.
*
* @return The set of valid search scopes.
*/
public Object[][] getSearchScopes()
{
return new Object[][]
{
new Object[] { "base" },
new Object[] { "one" },
new Object[] { "sub" },
new Object[] { "subordinate" },
};
}
/**
* Tests searches with the various allowed search scopes.
*
* @param scope The scope to use for the search.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
{
"-h", "127.0.0.1",
"-b", "o=test",
"-s", scope,
"(objectClass=*)"
};
}
/**
* Retrieves the set of valid alias dereferencing policies.
*
* @return The set of valid alias dereferencing policies.
*/
public Object[][] getDerefPolicies()
{
return new Object[][]
{
new Object[] { "never" },
new Object[] { "always" },
new Object[] { "search" },
new Object[] { "find" },
};
}
/**
* Tests searches with the various allowed dereference policy values.
*
* @param derefPolicy The alias dereferencing policy for the search.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
{
"-h", "127.0.0.1",
"-b", "o=test",
"-s", "base",
"-a", derefPolicy,
"(objectClass=*)"
};
}
/**
* Tests with the typesOnly option.
*/
@Test()
public void testTypesOnly()
throws Exception
{
{
"-h", "127.0.0.1",
"-b", "o=test",
"-s", "base",
"-A",
"(objectClass=*)"
};
}
/**
* Tests with the reportAuthzID option for an unauthenticated search.
*/
@Test()
public void testReportAuthzIDUnauthenticated()
throws Exception
{
{
"-h", "127.0.0.1",
"-b", "o=test",
"-s", "base",
"--reportAuthzID",
"(objectClass=*)"
};
}
/**
* Tests with the reportAuthzID option for an authenticated search.
*/
@Test()
public void testReportAuthzIDAuthenticated()
throws Exception
{
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-b", "o=test",
"-s", "base",
"--reportAuthzID",
"(objectClass=*)"
};
}
/**
* Tests with the usePasswordPolicyControl option for an authenticated search.
*/
@Test()
public void testUsePasswordPolicyControl()
throws Exception
{
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-b", "o=test",
"-s", "base",
"--usePasswordPolicyControl",
"(objectClass=*)"
};
}
/**
* Tests with the account usability control for an authenticated search.
*/
@Test()
public void testAccountUsabilityControl()
throws Exception
{
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-b", "o=test",
"-s", "base",
"(objectClass=*)"
};
}
/**
* Tests with the account usability control with an alternate name for an
* authenticated search.
*/
@Test()
public void testAccountUsabilityControlAltName()
throws Exception
{
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-b", "o=test",
"-s", "base",
"-J", "accountusable:true",
"(objectClass=*)"
};
}
/**
* Tests with the LDAP assertion control in which the assertion is true.
*/
@Test()
public void testLDAPAssertionControlTrue()
throws Exception
{
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-b", "o=test",
"-s", "base",
"--assertionFilter", "(objectClass=top)",
"(objectClass=*)"
};
}
/**
* Tests with the LDAP assertion control in which the assertion is false.
*/
@Test()
public void testLDAPAssertionControlFalse()
throws Exception
{
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-b", "o=test",
"-s", "base",
"--assertionFilter", "(objectClass=doesNotMatch)",
"(objectClass=*)"
};
}
/**
* Tests with the LDAP matched values control.
*/
@Test()
public void testMatchedValuesControl()
throws Exception
{
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-b", "o=test",
"-s", "base",
"--matchedValuesFilter", "(objectClass=*person)",
"(objectClass=*)",
"objectClass"
};
}
/**
* Tests the use of the LDAP subentries control.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testSubentriesControl()
throws Exception
{
"objectClass: top",
"objectClass: ldapSubEntry",
"cn: test");
e.getOperationalAttributes());
{
"-D", "cn=Directory Manager",
"-w", "password",
"-h", "127.0.0.1",
"-b", "o=test",
"-s", "sub",
"--countEntries",
"(objectClass=*)"
};
{
"-D", "cn=Directory Manager",
"-w", "password",
"-h", "127.0.0.1",
"-b", "o=test",
"-s", "sub",
"--countEntries",
"(objectClass=*)"
};
{
"-D", "cn=Directory Manager",
"-w", "password",
"-h", "127.0.0.1",
"-b", "o=test",
"-s", "sub",
"--countEntries",
"-J", "subentries:true",
"(objectClass=*)"
};
}
/**
* 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
{
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-b", "o=test",
"-s", "base",
"(objectClass=*)"
};
}
/**
* Tests the use of the simple paged results control.
*
* @throws Exception If an unexpectd problem occurs.
*/
@Test()
public void testSimplePagedResults()
throws Exception
{
"dn: cn=device 1,dc=example,dc=com",
"objectClass: top",
"objectClass: device",
"cn: device 1",
"",
"dn: cn=device 2,dc=example,dc=com",
"objectClass: top",
"objectClass: device",
"cn: device 2",
"",
"dn: cn=device 3,dc=example,dc=com",
"objectClass: top",
"objectClass: device",
"cn: device 3",
"",
"dn: cn=device 4,dc=example,dc=com",
"objectClass: top",
"objectClass: device",
"cn: device 4",
"",
"dn: cn=device 5,dc=example,dc=com",
"objectClass: top",
"objectClass: device",
"cn: device 5");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-b", "dc=example,dc=com",
"-s", "one",
"--simplePageSize", "2",
"--countEntries",
"(objectClass=*)"
};
}
/**
* Tests the use of both the server-side sort control and the simple paged
* results control.
*
* @throws Exception If an unexpectd problem occurs.
*/
@Test()
public void testSortWithPagedResults()
throws Exception
{
"dn: uid=albert.zimmerman,dc=example,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: albert.zimmerman",
"givenName: Albert",
"sn: Zimmerman",
"cn: Albert Zimmerman",
"",
"dn: uid=albert.smith,dc=example,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: albert.smith",
"givenName: Albert",
"sn: Smith",
"cn: Albert Smith",
"",
"dn: uid=aaron.zimmerman,dc=example,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: albert.zimmerman",
"givenName: Aaron",
"givenName: Zeke",
"sn: Zimmerman",
"cn: Aaron Zimmerman",
"",
"dn: uid=mary.jones,dc=example,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: mary.jones",
"givenName: Mary",
"sn: Jones",
"cn: Mary Jones",
"",
"dn: uid=margaret.jones,dc=example,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: margaret.jones",
"givenName: Margaret",
"givenName: Maggie",
"sn: Jones",
"sn: Smith",
"cn: Maggie Jones-Smith",
"",
"dn: uid=aaccf.johnson,dc=example,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: aaccf.johnson",
"givenName: Aaccf",
"sn: Johnson",
"cn: Aaccf Johnson",
"",
"dn: uid=sam.zweck,dc=example,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: sam.zweck",
"givenName: Sam",
"sn: Zweck",
"cn: Sam Zweck",
"",
"dn: uid=lowercase.mcgee,dc=example,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: lowercase.mcgee",
"givenName: lowercase",
"sn: mcgee",
"cn: lowercase mcgee",
"",
"dn: uid=zorro,dc=example,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: zorro",
"sn: Zorro",
"cn: Zorro");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-b", "dc=example,dc=com",
"-s", "sub",
"-S", "givenName",
"--simplePageSize", "2",
"--countEntries",
"(objectClass=*)"
};
String[] unpagedArgs =
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-b", "dc=example,dc=com",
"-s", "sub",
"-S", "givenName",
"--countEntries",
"(objectClass=*)"
};
}
/**
* Tests the use of the server-side sort control with valid sort criteria.
*
* @throws Exception If an unexpectd problem occurs.
*/
@Test()
public void testSortValidGivenNameAscending()
throws Exception
{
"dn: uid=albert.zimmerman,dc=example,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: albert.zimmerman",
"givenName: Albert",
"sn: Zimmerman",
"cn: Albert Zimmerman",
"",
"dn: uid=albert.smith,dc=example,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: albert.smith",
"givenName: Albert",
"sn: Smith",
"cn: Albert Smith",
"",
"dn: uid=aaron.zimmerman,dc=example,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: albert.zimmerman",
"givenName: Aaron",
"givenName: Zeke",
"sn: Zimmerman",
"cn: Aaron Zimmerman");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-b", "dc=example,dc=com",
"-s", "sub",
"-S", "givenName",
"(objectClass=*)"
};
}
/**
* Tests the use of the server-side sort control with valid sort criteria.
*
* @throws Exception If an unexpectd problem occurs.
*/
@Test()
public void testSortValidGivenNameDescending()
throws Exception
{
"dn: uid=albert.zimmerman,dc=example,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: albert.zimmerman",
"givenName: Albert",
"sn: Zimmerman",
"cn: Albert Zimmerman",
"",
"dn: uid=albert.smith,dc=example,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: albert.smith",
"givenName: Albert",
"sn: Smith",
"cn: Albert Smith",
"",
"dn: uid=aaron.zimmerman,dc=example,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: albert.zimmerman",
"givenName: Aaron",
"givenName: Zeke",
"sn: Zimmerman",
"cn: Aaron Zimmerman");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-b", "dc=example,dc=com",
"-s", "sub",
"-S", "-givenName",
"(objectClass=*)"
};
}
/**
* Tests the use of the server-side sort control with valid sort criteria.
*
* @throws Exception If an unexpectd problem occurs.
*/
@Test()
public void testSortValidGivenNameAscendingCaseExactOrderingMatch()
throws Exception
{
"dn: uid=albert.zimmerman,dc=example,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: albert.zimmerman",
"givenName: Albert",
"sn: Zimmerman",
"cn: Albert Zimmerman",
"",
"dn: uid=albert.smith,dc=example,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: albert.smith",
"givenName: Albert",
"sn: Smith",
"cn: Albert Smith",
"",
"dn: uid=aaron.zimmerman,dc=example,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: albert.zimmerman",
"givenName: Aaron",
"givenName: Zeke",
"sn: Zimmerman",
"cn: Aaron Zimmerman");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-b", "dc=example,dc=com",
"-s", "sub",
"-S", "givenName:caseExactOrderingMatch",
"(objectClass=*)"
};
}
/**
* Tests the use of the server-side sort control with valid sort criteria.
*
* @throws Exception If an unexpectd problem occurs.
*/
@Test()
public void testSortValidSnAscendingGivenNameAscending()
throws Exception
{
"dn: uid=albert.zimmerman,dc=example,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: albert.zimmerman",
"givenName: Albert",
"sn: Zimmerman",
"cn: Albert Zimmerman",
"",
"dn: uid=albert.smith,dc=example,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: albert.smith",
"givenName: Albert",
"sn: Smith",
"cn: Albert Smith",
"",
"dn: uid=aaron.zimmerman,dc=example,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: albert.zimmerman",
"givenName: Aaron",
"givenName: Zeke",
"sn: Zimmerman",
"cn: Aaron Zimmerman");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-b", "dc=example,dc=com",
"-s", "sub",
"-S", "sn,givenName",
"(objectClass=*)"
};
}
/**
* Tests the use of the server-side sort control with valid sort criteria.
*
* @throws Exception If an unexpectd problem occurs.
*/
@Test()
public void testSortValidSnAscendingGivenNameDescending()
throws Exception
{
"dn: uid=albert.zimmerman,dc=example,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: albert.zimmerman",
"givenName: Albert",
"sn: Zimmerman",
"cn: Albert Zimmerman",
"",
"dn: uid=albert.smith,dc=example,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: albert.smith",
"givenName: Albert",
"sn: Smith",
"cn: Albert Smith",
"",
"dn: uid=aaron.zimmerman,dc=example,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: albert.zimmerman",
"givenName: Aaron",
"givenName: Zeke",
"sn: Zimmerman",
"cn: Aaron Zimmerman");
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-b", "dc=example,dc=com",
"-s", "sub",
"-S", "sn,-givenName",
"(objectClass=*)"
};
}
/**
* Tests the use of the server-side sort control with an empty sort order.
*
* @throws Exception If an unexpectd problem occurs.
*/
@Test()
public void testSortEmptySortOrder()
throws Exception
{
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-b", "dc=example,dc=com",
"-s", "sub",
"-S", "",
"(objectClass=*)"
};
}
/**
* Tests the use of the server-side sort control with a sort order containing
* a key with no attribute type.
*
* @throws Exception If an unexpectd problem occurs.
*/
@Test()
public void testSortSortOrderMissingType()
throws Exception
{
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-b", "dc=example,dc=com",
"-s", "sub",
"-S", "-,sn",
"(objectClass=*)"
};
}
/**
* Tests the use of the server-side sort control with a sort order containing
* a key with a colon but no matching rule.
*
* @throws Exception If an unexpectd problem occurs.
*/
@Test()
public void testSortSortOrderMissingMatchingRule()
throws Exception
{
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-b", "dc=example,dc=com",
"-s", "sub",
"-S", "-sn:",
"(objectClass=*)"
};
}
/**
* Tests the use of the server-side sort control with an undefined attribute.
*
* @throws Exception If an unexpectd problem occurs.
*/
@Test()
public void testSortUndefinedAttribute()
throws Exception
{
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-b", "dc=example,dc=com",
"-s", "sub",
"-S", "undefined",
"(objectClass=*)"
};
}
/**
* Tests the use of the server-side sort control with an undefined ordering
* rule.
*
* @throws Exception If an unexpectd problem occurs.
*/
@Test()
public void testSortUndefinedOrderingRule()
throws Exception
{
{
"-h", "127.0.0.1",
"-D", "cn=Directory Manager",
"-w", "password",
"-b", "dc=example,dc=com",
"-s", "sub",
"-S", "givenName:undefined",
"(objectClass=*)"
};
}
/**
* Tests the LDAPSearch tool with the "--help" option.
*/
@Test()
public void testHelp()
{
}
}