Package org.apache.directory.api.ldap.model.entry

Examples of org.apache.directory.api.ldap.model.entry.Modification


        Attribute description = new DefaultAttribute( "description", sb.toString() );

        try
        {
            Modification modification = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, description );
            connection.modify( "cn=the person, ou=system", modification );
            fail();
        }
        catch ( Exception e )
        {
View Full Code Here


        assertNull( "the c-ou collective attribute should not be present", c_ou );

        // -------------------------------------------------------------------
        // now modify entries included by the subentry to have collectiveExclusions
        // -------------------------------------------------------------------
        Modification modification = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE,
            new DefaultAttribute( "collectiveExclusions", "c-ou" ) );
        connection.modify( "ou=services,ou=configuration, ou=system", modification );

        // entry should not show the c-ou collective attribute anymore
        entry = connection.lookup( "ou=services,ou=configuration,ou=system" );
View Full Code Here

        assertNull( "the c-ou collective attribute should not be present", c_ou );

        // -------------------------------------------------------------------
        // now modify entries included by the subentry to have collectiveExclusions
        // -------------------------------------------------------------------
        Modification modification = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE,
            new DefaultAttribute( "collectiveExclusions", "c-ou" ) );
        connection.modify( "ou=services,ou=configuration, ou=system", modification );

        System.out.println( "----- Checking exclusions" );
        entries = getAllEntries( connection, true );
View Full Code Here

            SchemaConstants.USER_PASSWORD_AT );

        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 );
View Full Code Here

            SchemaConstants.USER_PASSWORD_AT );

        Attribute pwdAt = new DefaultAttribute( pwdAtType );
        pwdAt.add( ( byte[] ) null );

        Modification mod = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, pwdAt );
        connection.modify( dn, mod );

        Entry entry = connection.lookup( dn );
        pwdAt = entry.get( pwdAtType );
View Full Code Here

            SchemaConstants.USER_PASSWORD_AT );

        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 );
View Full Code Here

    public static void disableSchema( DirectoryService service, String schemaName ) throws Exception
    {
        LdapConnection connection = getAdminConnection( service );

        // now enable the test schema
        Modification mod = new DefaultModification(
            ModificationOperation.REPLACE_ATTRIBUTE, "m-disabled", "TRUE" );

        connection.modify( "cn=" + schemaName + ",ou=schema", mod );
    }
View Full Code Here

        Dn dn = new Dn( schemaManager, "cn=JOhnny WAlkeR,ou=Sales,o=Good Times Co." );

        Attribute attrib = new DefaultAttribute( SchemaConstants.OU_AT, OU_AT );
        attrib.add( "Engineering" );

        Modification add = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, attrib );

        store.modify( dn, add );
    }
View Full Code Here

        Attribute attrib = new DefaultAttribute( "sn", SN_AT );

        String attribVal = "Walker";
        attrib.add( attribVal );

        Modification add = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, attrib );

        Entry lookedup = store.fetch( store.getEntryId( dn ), dn );

        store.modify( dn, add );
        assertTrue( lookedup.get( "sn" ).contains( attribVal ) );
View Full Code Here

        Attribute attrib = new DefaultAttribute( SchemaConstants.SN_AT, SN_AT );

        String attribVal = "Johnny";
        attrib.add( attribVal );

        Modification add = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, attrib );

        Entry lookedup = store.fetch( store.getEntryId( dn ), dn );

        assertEquals( "WAlkeR", lookedup.get( "sn" ).get().getString() ); // before replacing

        lookedup = store.modify( dn, add );
        assertEquals( attribVal, lookedup.get( "sn" ).get().getString() );

        // testing the store.modify( dn, mod, entry ) API
        Modification replace = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, SN_AT, "JWalker" );

        lookedup = store.modify( dn, replace );
        assertEquals( "JWalker", lookedup.get( "sn" ).get().getString() );
        assertEquals( 1, lookedup.get( "sn" ).size() );
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.api.ldap.model.entry.Modification

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.