LDAPSearchTestCase.java revision 1224
1N/A * The contents of this file are subject to the terms of the 1N/A * Common Development and Distribution License, Version 1.0 only 1N/A * (the "License"). You may not use this file except in compliance 1N/A * You can obtain a copy of the license at 1N/A * See the License for the specific language governing permissions 1N/A * and limitations under the License. 1N/A * When distributing Covered Code, include this CDDL HEADER in each 1N/A * file and include the License file at 1N/A * add the following below this CDDL HEADER, with the fields enclosed 1N/A * by brackets "[]" replaced with your own identifying information: 1N/A * Portions Copyright [yyyy] [name of copyright owner] 1N/A * Portions Copyright 2006-2007 Sun Microsystems, Inc. 1N/A * A set of test cases for the LDAPSearch tool. 1N/A // The path to a file containing an invalid bind password. 1N/A // The path to a file containing a valid bind password. 1N/A * Ensures that the Directory Server is running and performs other necessary 1N/A * @throws Exception If an unexpected problem occurs. 1N/A * Retrieves sets of invalid arguments that may not be used to initialize 1N/A * the LDAPSearch tool. 1N/A * @return Sets of invalid arguments that may not be used to initialize the "--assertionFilter",
"(invalidfilter)",
"--matchedValuesFilter",
"(invalidfilter)",
"-D",
"cn=Directory Manager",
"-D",
"cn=Directory Manager",
"-J",
"1.2.3.4:invalidcriticality",
"-C",
"ps:add,delete,modify,modifydn,invalid",
"-C",
"ps:all:1:invalid",
* 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. * Tests a simple LDAPv2 search. "-D",
"cn=Directory Manager",
* Tests a simple LDAPv3 search. "-D",
"cn=Directory Manager",
* Tests a simple invocation using the "--dry-run" option with a valid argument "-h",
"doesnt.need.to.resolve",
"-D",
"cn=Directory Manager",
* Tests a simple invocation using the "--dry-run" option with an invalid "-h",
"doesnt.need.to.resolve",
"-D",
"cn=Directory Manager",
* Tests a simple LDAP search over SSL using blind trust. * Tests a simple LDAP search over SSL using a trust store. * Tests a simple LDAP search using StartTLS with blind trust. * Tests a simple LDAP search using StartTLS with a trust store. * Tests a simple LDAP search over SSL using a trust store and SASL EXTERNAL * @throws Exception If an unexpected problem occurs. "dn: cn=Test User,o=test",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
* 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. "dn: cn=Test User,o=test",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
* 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. "dn: cn=Test User,o=test",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
* Tests a simple LDAP search using StartTLS with a trust store and SASL * EXTERNAL authentication. * @throws Exception If an unexpected problem occurs. "dn: cn=Test User,o=test",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
* Tests a simple search operation using CRAM-MD5 authentication. * @throws Exception If an unexpected problem occurs. "dn: uid=test.user,o=test",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"userPassword: password",
"ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," +
"cn=Password Policies,cn=config");
"-o",
"authid=u:test.user",
* Tests a simple search operation using CRAM-MD5 authentication. * @throws Exception If an unexpected problem occurs. "dn: uid=test.user,o=test",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"userPassword: password",
"ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," +
"cn=Password Policies,cn=config");
"-o",
"authid=u:test.user",
"-o",
"authzid=u:test.user",
* Tests a simple search operation using PLAIN authentication. * @throws Exception If an unexpected problem occurs. "-o",
"authid=dn:cn=Directory Manager",
* Tests a search with a malformed bind DN. * Tests a search with a nonexistent bind DN. "-D",
"cn=Does Not Exist",
* Tests a search with an invalid password. "-D",
"cn=Directory Manager",
* Tests a search with a valid password read from a file. * @throws Exception If an unexpected problem occurs. "-D",
"cn=Directory Manager",
* Tests a search with an invalid password read from a file. * @throws Exception If an unexpected problem occurs. "-D",
"cn=Directory Manager",
* Tests a search with a malformed base DN. * Tests a search with a nonexistent base DN. "-b",
"o=does not exist",
* Retrieves the set of valid search scopes. * @return The set of valid search scopes. 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. * Retrieves the set of valid alias dereferencing policies. * @return The set of valid alias dereferencing policies. * 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. * Tests with the typesOnly option. * Tests with the reportAuthzID option for an unauthenticated search. * Tests with the reportAuthzID option for an authenticated search. "-D",
"cn=Directory Manager",
* Tests with the usePasswordPolicyControl option for an authenticated search. "-D",
"cn=Directory Manager",
"--usePasswordPolicyControl",
* Tests with the account usability control for an authenticated search. "-D",
"cn=Directory Manager",
* Tests with the account usability control with an alternate name for an "-D",
"cn=Directory Manager",
"-J",
"accountusable:true",
* Tests with the LDAP assertion control in which the assertion is true. "-D",
"cn=Directory Manager",
"--assertionFilter",
"(objectClass=top)",
* Tests with the LDAP assertion control in which the assertion is false. "-D",
"cn=Directory Manager",
"--assertionFilter",
"(objectClass=doesNotMatch)",
* Tests with the LDAP matched values control. "-D",
"cn=Directory Manager",
"--matchedValuesFilter",
"(objectClass=*person)",
* Tests the use of the LDAP subentries control. * @throws Exception If an unexpected problem occurs. "objectClass: ldapSubEntry",
"-D",
"cn=Directory Manager",
"-D",
"cn=Directory Manager",
"-D",
"cn=Directory Manager",
* Tests the inclusion of multiple arbitrary controls in the request to the * @throws Exception If an unexpectd problem occurs. "-D",
"cn=Directory Manager",
* Tests the use of the simple paged results control. * @throws Exception If an unexpectd problem occurs. "dn: cn=device 1,dc=example,dc=com",
"dn: cn=device 2,dc=example,dc=com",
"dn: cn=device 3,dc=example,dc=com",
"dn: cn=device 4,dc=example,dc=com",
"dn: cn=device 5,dc=example,dc=com",
"-D",
"cn=Directory Manager",
"-b",
"dc=example,dc=com",
* Tests the use of both the server-side sort control and the simple paged * @throws Exception If an unexpectd problem occurs. "dn: uid=albert.zimmerman,dc=example,dc=com",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"dn: uid=albert.smith,dc=example,dc=com",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"dn: uid=aaron.zimmerman,dc=example,dc=com",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"dn: uid=mary.jones,dc=example,dc=com",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"dn: uid=margaret.jones,dc=example,dc=com",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"cn: Maggie Jones-Smith",
"dn: uid=aaccf.johnson,dc=example,dc=com",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"dn: uid=sam.zweck,dc=example,dc=com",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"dn: uid=lowercase.mcgee,dc=example,dc=com",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"dn: uid=zorro,dc=example,dc=com",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"-D",
"cn=Directory Manager",
"-b",
"dc=example,dc=com",
"-D",
"cn=Directory Manager",
"-b",
"dc=example,dc=com",
* Tests the use of the server-side sort control with valid sort criteria. * @throws Exception If an unexpectd problem occurs. "dn: uid=albert.zimmerman,dc=example,dc=com",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"dn: uid=albert.smith,dc=example,dc=com",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"dn: uid=aaron.zimmerman,dc=example,dc=com",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"-D",
"cn=Directory Manager",
"-b",
"dc=example,dc=com",
* Tests the use of the server-side sort control with valid sort criteria. * @throws Exception If an unexpectd problem occurs. "dn: uid=albert.zimmerman,dc=example,dc=com",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"dn: uid=albert.smith,dc=example,dc=com",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"dn: uid=aaron.zimmerman,dc=example,dc=com",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"-D",
"cn=Directory Manager",
"-b",
"dc=example,dc=com",
* Tests the use of the server-side sort control with valid sort criteria. * @throws Exception If an unexpectd problem occurs. "dn: uid=albert.zimmerman,dc=example,dc=com",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"dn: uid=albert.smith,dc=example,dc=com",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"dn: uid=aaron.zimmerman,dc=example,dc=com",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"-D",
"cn=Directory Manager",
"-b",
"dc=example,dc=com",
"-S",
"givenName:caseExactOrderingMatch",
* Tests the use of the server-side sort control with valid sort criteria. * @throws Exception If an unexpectd problem occurs. "dn: uid=albert.zimmerman,dc=example,dc=com",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"dn: uid=albert.smith,dc=example,dc=com",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"dn: uid=aaron.zimmerman,dc=example,dc=com",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"-D",
"cn=Directory Manager",
"-b",
"dc=example,dc=com",
* Tests the use of the server-side sort control with valid sort criteria. * @throws Exception If an unexpectd problem occurs. "dn: uid=albert.zimmerman,dc=example,dc=com",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"dn: uid=albert.smith,dc=example,dc=com",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"dn: uid=aaron.zimmerman,dc=example,dc=com",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"-D",
"cn=Directory Manager",
"-b",
"dc=example,dc=com",
* Tests the use of the server-side sort control with an empty sort order. * @throws Exception If an unexpectd problem occurs. "-D",
"cn=Directory Manager",
"-b",
"dc=example,dc=com",
* 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. "-D",
"cn=Directory Manager",
"-b",
"dc=example,dc=com",
* 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. "-D",
"cn=Directory Manager",
"-b",
"dc=example,dc=com",
* Tests the use of the server-side sort control with an undefined attribute. * @throws Exception If an unexpectd problem occurs. "-D",
"cn=Directory Manager",
"-b",
"dc=example,dc=com",
* Tests the use of the server-side sort control with an undefined ordering * @throws Exception If an unexpectd problem occurs. "-D",
"cn=Directory Manager",
"-b",
"dc=example,dc=com",
"-S",
"givenName:undefined",
* Tests the use of the virtual list view control without the server-side sort * @throws Exception If an unexpected problem occurs. "-D",
"cn=Directory Manager",
"-b",
"dc=example,dc=com",
* Tests the use of the server-side sort control with both the simple paged * results and virtual list view controls. * @throws Exception If an unexpectd problem occurs. "-D",
"cn=Directory Manager",
"-b",
"dc=example,dc=com",
* Tests the use of the virtual list view control with an invalid descriptor * @throws Exception If an unexpected problem occurs. "-D",
"cn=Directory Manager",
"-b",
"dc=example,dc=com",
* Tests the use of the virtual list view control with an invalid descriptor * @throws Exception If an unexpected problem occurs. "-D",
"cn=Directory Manager",
"-b",
"dc=example,dc=com",
"-G",
"invalid:9:invalid",
* Tests the use of the virtual list view control with an invalid descriptor * @throws Exception If an unexpected problem occurs. "-D",
"cn=Directory Manager",
"-b",
"dc=example,dc=com",
* Tests the use of both the server-side sort control and the virtual list * @throws Exception If an unexpectd problem occurs. "dn: uid=albert.zimmerman,dc=example,dc=com",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"dn: uid=albert.smith,dc=example,dc=com",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"dn: uid=aaron.zimmerman,dc=example,dc=com",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"dn: uid=mary.jones,dc=example,dc=com",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"dn: uid=margaret.jones,dc=example,dc=com",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"cn: Maggie Jones-Smith",
"dn: uid=aaccf.johnson,dc=example,dc=com",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"dn: uid=sam.zweck,dc=example,dc=com",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"dn: uid=lowercase.mcgee,dc=example,dc=com",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"dn: uid=zorro,dc=example,dc=com",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"-D",
"cn=Directory Manager",
"-b",
"dc=example,dc=com",
* Tests the LDAPSearch tool with the "--help" option.