use of com.unboundid.ldap.sdk.experimental.DraftZeilengaLDAPNoOp12RequestControl in project ldapsdk by pingidentity.
the class InMemoryDirectoryControlsTestCase method testNoOperationControl.
/**
* Provides test coverage for the no-operation request control.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testNoOperationControl() throws Exception {
final InMemoryDirectoryServer ds = getTestDS(true, true);
final LDAPConnection conn = ds.getConnection();
// Test an add with a no-operation control.
final AddRequest addRequest = new AddRequest("dn: ou=test,dc=example,dc=com", "objectClass: top", "objectClass: organizationalUnit", "ou: test");
addRequest.setControls(new DraftZeilengaLDAPNoOp12RequestControl());
assertResultCodeEquals(conn, addRequest, ResultCode.NO_OPERATION);
// Test a delete with a no-operation control.
final DeleteRequest deleteRequest = new DeleteRequest("uid=test.user,ou=People,dc=example,dc=com");
deleteRequest.setControls(new DraftZeilengaLDAPNoOp12RequestControl());
assertResultCodeEquals(conn, deleteRequest, ResultCode.NO_OPERATION);
// Test a modify with a no-operation control.
final ModifyRequest modifyRequest = new ModifyRequest("dn: ou=People,dc=example,dc=com", "changetype: modify", "replace: description", "description: foo");
modifyRequest.setControls(new DraftZeilengaLDAPNoOp12RequestControl());
assertResultCodeEquals(conn, modifyRequest, ResultCode.NO_OPERATION);
// Test a modify DN with a no-operation control.
final ModifyDNRequest modifyDNRequest = new ModifyDNRequest("uid=test.user,ou=People,dc=example,dc=com", "cn=Test User", false);
modifyDNRequest.setControls(new DraftZeilengaLDAPNoOp12RequestControl());
assertResultCodeEquals(conn, modifyDNRequest, ResultCode.NO_OPERATION);
// Test a search with a no-operation control.
final SearchRequest searchRequest = new SearchRequest("dc=example,dc=com", SearchScope.SUB, "(objectClass=*)");
searchRequest.setControls(new DraftZeilengaLDAPNoOp12RequestControl());
assertResultCodeEquals(conn, searchRequest, ResultCode.UNAVAILABLE_CRITICAL_EXTENSION);
conn.close();
}
Aggregations