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

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


    @Test
    public void testModifyAddOUAttrib() throws Exception
    {
        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


    @Test
    public void testModifyAdd() throws Exception
    {
        Dn dn = new Dn( schemaManager, "cn=JOhnny WAlkeR,ou=Sales,o=Good Times Co." );

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

    @Test
    public void testModifyReplace() throws Exception
    {
        Dn dn = new Dn( schemaManager, "cn=JOhnny WAlkeR,ou=Sales,o=Good Times Co." );

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

    @Test
    public void testModifyRemove() throws Exception
    {
        Dn dn = new Dn( schemaManager, "cn=JOhnny WAlkeR,ou=Sales,o=Good Times Co." );

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

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

        Entry lookedup = store.fetch( store.getEntryId( dn ), dn );
View Full Code Here

            "entryUUID", UUID.randomUUID().toString() );

        AddOperationContext addContext = new AddOperationContext( null, entry );
        store.add( addContext );

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

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

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

        Entry lookedup = store.fetch( store.getEntryId( dn ), dn );
View Full Code Here

    }


    private void addModification( ModificationOperation modOp, String attributeName, byte[]... attributeValue )
    {
        Attribute attr = new DefaultAttribute( attributeName, attributeValue );
        addModification( attr, modOp );
    }
View Full Code Here

    }


    private void addModification( ModificationOperation modOp, String attributeName, String... attributeValue )
    {
        Attribute attr = new DefaultAttribute( attributeName, attributeValue );
        addModification( attr, modOp );
    }
View Full Code Here

    Dn dn = new Dn( "cn=test,ou=system" );

    AttributeType pwdAtType = getService().getSchemaManager().lookupAttributeTypeRegistry(
        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 );

    assertFalse( Arrays.equals( plainPwd, pwdAt.getBytes() ) );
    assertTrue( PasswordUtil.compareCredentials( plainPwd, pwdAt.getBytes() ) );
}
View Full Code Here

    Dn dn = new Dn( "cn=test,ou=system" );

    AttributeType pwdAtType = getService().getSchemaManager().lookupAttributeTypeRegistry(
        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 );
View Full Code Here

    Dn dn = new Dn( "cn=test,ou=system" );

    AttributeType pwdAtType = getService().getSchemaManager().lookupAttributeTypeRegistry(
        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 );

    assertTrue( Arrays.equals( hashedPwd, pwdAt.getBytes() ) );
    assertTrue( PasswordUtil.compareCredentials( plainPwd, pwdAt.getBytes() ) );
}
View Full Code Here

TOP

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

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.