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

Examples of org.apache.directory.ldap.client.api.LdapConnection.modify()


        "userPassword: 12345" );

    connection.add( entry );

    // Now modify the entry : we should add two null values
    connection.modify( new Dn( "uid=12345,ou=system" ),
        new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, "userPassword", Strings.EMPTY_BYTES ),
        new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, "mail", ( String ) null )
        );

    // Get back the entry
View Full Code Here


    connection.add( entry );

    // Now modify the entry : we should replace the password with a null value
    // and add a mail Attribute with a null value
    connection.modify( new Dn( "uid=12345,ou=system" ),
        new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, "userPassword", Strings.EMPTY_BYTES ),
        new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, "mail", ( String ) null )
        );

    // Get back the entry
View Full Code Here

    assertEquals( 1, found.get( "userPassword" ).size() );
    assertTrue( found.contains( "mail", Strings.EMPTY_BYTES ) );
    assertTrue( found.contains( "userPassword", "" ) );

    // Now, do a replace with no value. We should not anymore have a mail
    connection.modify( new Dn( "uid=12345,ou=system" ),
        new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, "mail" )
        );

    // Get back the entry
    found = connection.lookup( "uid=12345,ou=system" );
View Full Code Here

       
        Attribute pwdAt = new DefaultAttribute( pwdAtType );
        pwdAt.add( plainPwd );
       
        Modification mod = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, pwdAt );
        connection.modify( dn, mod );
       
        Entry entry = connection.lookup( dn );
        pwdAt = entry.get( pwdAtType );
       
        assertFalse( Arrays.equals( plainPwd, pwdAt.getBytes() ) );
View Full Code Here

       
        Attribute pwdAt = new DefaultAttribute( pwdAtType );
        pwdAt.add( hashedPwd );
       
        Modification mod = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, pwdAt );
        connection.modify( dn, mod );
       
        Entry entry = connection.lookup( dn );
        pwdAt = entry.get( pwdAtType );
       
        assertTrue( Arrays.equals( hashedPwd, pwdAt.getBytes() ) );
View Full Code Here

        assertPresent( sysRoot, "ou=test5,ou=system" );

        // modify the test entry to add description and test new attr appears
        ModifyRequest modReq = new ModifyRequest( entry.getDn() );
        modReq.add( "description", "a desc value" );
        sysRoot.modify( modReq );

        Entry resusitated = ( ( SearchResultEntry ) sysRoot.lookup( "ou=test5,ou=system" ) ).getEntry();
        assertNotNull( resusitated );
        EntryAttribute description = resusitated.get( "description" );
        assertNotNull( description );
View Full Code Here

        // -------------------------------------------------------------------

        // add the attribute again and make sure it is old value
        modReq = new ModifyRequest( resusitated.getDn() );
        modReq.add( "description", "old value" );
        sysRoot.modify( modReq );
        resusitated = ( ( SearchResultEntry ) sysRoot.lookup( "ou=test5,ou=system" ) ).getEntry();
        assertNotNull( resusitated );
        description = resusitated.get( "description" );
        assertNotNull( description );
        assertEquals( description.getString(), "old value" );
View Full Code Here

        // now tag then replace the value to "new value" and confirm
        Tag t1 = service.getChangeLog().tag();
        modReq = new ModifyRequest( resusitated.getDn() );
        modReq.replace( "description", "new value" );
        sysRoot.modify( modReq );

        resusitated = ( ( SearchResultEntry ) sysRoot.lookup( "ou=test5,ou=system" ) ).getEntry();
        assertNotNull( resusitated );
        description = resusitated.get( "description" );
        assertNotNull( description );
View Full Code Here

        // -------------------------------------------------------------------

        Tag t2 = service.getChangeLog().tag();
        modReq = new ModifyRequest( resusitated.getDn() );
        modReq.remove( "description", "old value" );
        sysRoot.modify( modReq );

        resusitated = ( ( SearchResultEntry ) sysRoot.lookup( "ou=test5,ou=system" ) ).getEntry();
        assertNotNull( resusitated );
        description = resusitated.get( "description" );
        assertNull( description );
View Full Code Here

        // -------------------------------------------------------------------

        // add a userPassword attribute so we can test replacing it
        modReq = new ModifyRequest( resusitated.getDn() );
        modReq.add( "userPassword", "to be replaced" );
        sysRoot.modify( modReq );
        resusitated = ( ( SearchResultEntry ) sysRoot.lookup( "ou=test5,ou=system" ) ).getEntry();
        assertPassword( resusitated, "to be replaced" );

        modReq = new ModifyRequest( resusitated.getDn() );
        modReq.remove( "description", "old value" );
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.