Search in sources :

Example 1 with DraftZeilengaLDAPNoOp12RequestControl

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();
}
Also used : AddRequest(com.unboundid.ldap.sdk.AddRequest) ModifyDNRequest(com.unboundid.ldap.sdk.ModifyDNRequest) SearchRequest(com.unboundid.ldap.sdk.SearchRequest) DraftZeilengaLDAPNoOp12RequestControl(com.unboundid.ldap.sdk.experimental.DraftZeilengaLDAPNoOp12RequestControl) LDAPConnection(com.unboundid.ldap.sdk.LDAPConnection) ModifyRequest(com.unboundid.ldap.sdk.ModifyRequest) DeleteRequest(com.unboundid.ldap.sdk.DeleteRequest) Test(org.testng.annotations.Test)

Aggregations

AddRequest (com.unboundid.ldap.sdk.AddRequest)1 DeleteRequest (com.unboundid.ldap.sdk.DeleteRequest)1 LDAPConnection (com.unboundid.ldap.sdk.LDAPConnection)1 ModifyDNRequest (com.unboundid.ldap.sdk.ModifyDNRequest)1 ModifyRequest (com.unboundid.ldap.sdk.ModifyRequest)1 SearchRequest (com.unboundid.ldap.sdk.SearchRequest)1 DraftZeilengaLDAPNoOp12RequestControl (com.unboundid.ldap.sdk.experimental.DraftZeilengaLDAPNoOp12RequestControl)1 Test (org.testng.annotations.Test)1