Package org.apache.directory.ldap.client.api.message

Examples of org.apache.directory.ldap.client.api.message.DeleteResponse


    public void testNormalDeleteFailContextNotEmpty() throws Exception
    {
        LdapConnection conn = getClientApiConnection( ldapServer );
       
        // delete failure on non-leaf entry
        DeleteResponse resp = conn.delete( "uid=akarasulu,ou=users,ou=system" );
        assertEquals( ResultCodeEnum.NOT_ALLOWED_ON_NON_LEAF, resp.getLdapResult().getResultCode() );

        conn.unBind();
    }
View Full Code Here


       
        // delete success
        conn.delete( "ou=computers,uid=akarasulu,ou=users,ou=system" );

        // delete failure non-existant entry
        DeleteResponse resp = conn.delete( "uid=elecharny,ou=users,ou=system" );
        assertEquals( ResultCodeEnum.NO_SUCH_OBJECT, resp.getLdapResult().getResultCode() );
       
        conn.unBind();
    }
View Full Code Here

    public void testDeleteNonExistent() throws Exception
    {
        LdapConnection conn = getClientApiConnection( ldapServer );
       
        // delete failure non-existent entry
        DeleteResponse resp = conn.delete( "uid=elecharny,ou=users,ou=system" );
        assertEquals( ResultCodeEnum.NO_SUCH_OBJECT, resp.getLdapResult().getResultCode() );
       
        conn.unBind();
    }
View Full Code Here

                // Transform the response
                DelResponseCodec delRespCodec = (DelResponseCodec)response;
                delRespCodec.addControl( response.getCurrentControl() );
                delRespCodec.setMessageId( messageId );

                DeleteResponse deleteResponse = convert( delRespCodec );
               
                DeleteFuture deleteFuture = (DeleteFuture)responseFuture;

                if ( deleteFuture == null )
                {
                    LOG.error( "DeleteFuture is null" );
                    throw new LdapException( "DeleteFuture is null"  );
                }
               
                if ( LOG.isDebugEnabled() )
                {
                    if ( deleteResponse.getLdapResult().getResultCode() == ResultCodeEnum.SUCCESS )
                    {
                        // Everything is fine, return the response
                        LOG.debug( "Delete successful : {}", deleteResponse );
                    }
                    else
View Full Code Here

     */
    private DeleteResponse deleteRecursive( DN dn, Map<DN, Cursor<SearchResponse>> cursorMap,
        DeleteListener listener ) throws LdapException
    {
        LOG.debug( "searching for {}", dn.getName() );
        DeleteResponse delResponse = null;
        Cursor<SearchResponse> cursor = null;

        try
        {
            if ( cursorMap == null )
View Full Code Here

        {
            // Read the response, waiting for it if not available immediately
            long timeout = getTimeout( deleteRequest.getTimeout() );

            // Get the response, blocking
            DeleteResponse delResponse = ( DeleteResponse ) deleteFuture.get( timeout, TimeUnit.MILLISECONDS );
           
            if ( delResponse == null )
            {
                // We didn't received anything : this is an error
                LOG.error( "Delete failed : timeout occured" );
                throw new LdapException( TIME_OUT_ERROR );
            }
           
            if ( delResponse.getLdapResult().getResultCode() == ResultCodeEnum.SUCCESS )
            {
                // Everything is fine, return the response
                LOG.debug( "Delete successful : {}", delResponse );
            }
            else
View Full Code Here

    /**
     * converts the DeleteResponseCodec to DeleteResponse object.
     */
    private DeleteResponse convert( DelResponseCodec delRespCodec )
    {
        DeleteResponse response = new DeleteResponse();

        response.setMessageId( delRespCodec.getMessageId() );
        response.setLdapResult( convert( delRespCodec.getLdapResult() ) );

        return response;
    }
View Full Code Here

    {
        DN dn = new DN( "cn=grand_child12,cn=child1,cn=parent,ou=system" );
       
        assertTrue( session.exists( dn ) );
       
        DeleteResponse response = connection.delete( dn.getName() );
        assertNotNull( response );
        assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
       
        assertFalse( session.exists( dn ) );
    }
View Full Code Here

    public void testDeleteNonLeafFailure() throws Exception
    {
        DN dn = new DN( "cn=child1,cn=parent,ou=system" ); // has children
        assertTrue( session.exists( dn ) );
        DeleteResponse response = connection.delete( dn.getName() );
        assertNotNull( response );
        assertEquals( ResultCodeEnum.NOT_ALLOWED_ON_NON_LEAF, response.getLdapResult().getResultCode() );
       
        assertTrue( session.exists( dn ) );
    }
View Full Code Here

       
        assertTrue( session.exists( dn ) );
       
        if ( connection.isControlSupported( "1.2.840.113556.1.4.805" ) )
        {
            DeleteResponse response = connection.deleteTree( dn );
            assertNotNull( response );
            assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
           
            assertFalse( session.exists( dn ) );
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.ldap.client.api.message.DeleteResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.