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

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


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

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


    /**
     * converts the AddResponseCodec to AddResponse.
     */
    private AddResponse convert( AddResponseCodec addRespCodec )
    {
        AddResponse addResponse = new AddResponse();

        addResponse.setMessageId( addRespCodec.getMessageId() );
        addResponse.setLdapResult( convert( addRespCodec.getLdapResult() ) );

        return addResponse;
    }
View Full Code Here

                // Transform the response
                AddResponseCodec addRespCodec = (AddResponseCodec)response;
                addRespCodec.addControl( response.getCurrentControl() );
                addRespCodec.setMessageId( messageId );

                AddResponse addResponse = convert( addRespCodec );
               
                AddFuture addFuture = (AddFuture)responseFuture;

                if ( addFuture == null )
                {
                    LOG.error( "AddFuture is null" );
                    throw new LdapException( "AddFuture is null"  );
                }
               
                // remove the listener from the listener map
                if ( LOG.isDebugEnabled() )
                {
                    if ( addResponse.getLdapResult().getResultCode() == ResultCodeEnum.SUCCESS )
                    {
                        // Everything is fine, return the response
                        LOG.debug( "Add successful : {}", addResponse );
                    }
                    else
View Full Code Here

        entry.add( SchemaConstants.CN_AT, "testadd_cn" );
        entry.add( SchemaConstants.SN_AT, "testadd_sn" );
       
        assertFalse( session.exists( dn ) );
       
        AddResponse response = connection.add( entry );
        assertNotNull( response );
        assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
       
        assertTrue( session.exists( dn ) );
    }
View Full Code Here

        AddFuture addFuture = connection.addAsync( new AddRequest( entry ));

        try
        {
            AddResponse addResponse = addFuture.get( 1000, TimeUnit.MILLISECONDS );
           
            assertNotNull( addResponse );
            assertEquals( ResultCodeEnum.SUCCESS, addResponse.getLdapResult().getResultCode() );
            assertTrue( connection.isAuthenticated() );
            assertTrue( session.exists( dn ) );
        }
        catch ( TimeoutException toe )
        {
View Full Code Here

        subEntry.add( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.SUBENTRY_OC,
            SchemaConstants.ACCESS_CONTROL_SUBENTRY_OC );
        subEntry.add( SchemaConstants.SUBTREE_SPECIFICATION_AT, subtree );
        subEntry.add( SchemaConstants.PRESCRIPTIVE_ACI_AT, aciItem );

        AddResponse addResp = connection.add( subEntry );

        return addResp.getLdapResult().getResultCode();
    }
View Full Code Here

        entry.add( SchemaConstants.OBJECT_CLASS_AT, "person" );
        entry.add( SchemaConstants.OBJECT_CLASS_AT, "OrganizationalPerson" );
        entry.add( SchemaConstants.CN_AT, value );
        entry.add( SchemaConstants.SN_AT, value );
       
        AddResponse resp = getAdminConnection( ldapServer ).add( entry );
       
        return resp;
    }
View Full Code Here

        Entry aliasChild = new DefaultClientEntry( new DN( "ou=blah,cn=toanother,ou=system" ) );
        aliasChild.add( SchemaConstants.OBJECT_CLASS_AT, "organizationalUnit" );
        aliasChild.add( SchemaConstants.OU_AT, "blah" );

        AddResponse resp = connection.add( aliasChild );
        assertEquals( ResultCodeEnum.ALIAS_PROBLEM, resp.getLdapResult().getResultCode() );
    }
View Full Code Here

    @Test
    public void testFailAddEntryAlreadyExists() throws Exception
    {
        createSubContext( "ou", "blah");

        AddResponse resp = createSubContext( "ou", "blah");
        assertEquals( ResultCodeEnum.ENTRY_ALREADY_EXISTS, resp.getLdapResult().getResultCode() );
    }
View Full Code Here

    @Test
    public void testAddControl() throws Exception
    {
        LdapConnection connection = getAdminConnection( ldapServer );

        AddResponse resp = createSubContext( "ou", "blah");
        resp = createSubContext( new DN( "ou=blah,ou=system" ), "ou", "subctx");
        Entry entry = ( ( SearchResultEntry ) connection.lookup( "ou=subctx,ou=blah,ou=system" ) ).getEntry();
        assertNotNull( entry );
    }
View Full Code Here

TOP

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

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.