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

Examples of org.apache.directory.shared.ldap.model.entry.Attribute


        entry.put( "jpegPhoto", BYTES1, BYTES2, BYTES1 );
        assertEquals( 2, entry.size() );
        assertNotNull( entry.get( "jpegPhoto" ) );
        assertEquals( 2, entry.get( "JPEGPhoto" ).size() );
        Attribute attribute = entry.get( "jpegPhoto" );
        assertTrue( attribute.contains( BYTES1 ) );
        assertTrue( attribute.contains( BYTES2 ) );
        assertEquals( "jpegphoto", attribute.getId() );
        assertEquals( "jpegPhoto", attribute.getUpId() );
    }
View Full Code Here


        entry.put( "ObjectClass", "top", "person", "top" );
        assertEquals( 2, entry.size() );
        assertNotNull( "objectclass", entry.get( "sn" ) );
        assertEquals( 2, entry.get( "OBJECTCLASS" ).size() );
        Attribute attribute = entry.get( "objectClass" );
        assertTrue( attribute.contains( "top" ) );
        assertTrue( attribute.contains( "person" ) );
        assertEquals( "objectclass", attribute.getId() );
        assertEquals( "ObjectClass", attribute.getUpId() );
    }
View Full Code Here

        entry.put( "ObjectClass", strValueTop, strValuePerson, strValueTop2, strNullValue );
        assertEquals( 1, entry.size() );
        assertNotNull( "objectclass", entry.get( "objectclass" ) );
        assertEquals( 3, entry.get( "OBJECTCLASS" ).size() );
        Attribute attribute = entry.get( "objectClass" );
        assertTrue( attribute.contains( "top" ) );
        assertTrue( attribute.contains( "person" ) );
        assertTrue( attribute.contains( ( String ) null ) );
        assertEquals( "objectclass", attribute.getId() );
        assertEquals( "ObjectClass", attribute.getUpId() );

        entry.clear();

        entry.put( "userpassword", strNullValue );
        assertEquals( 1, entry.size() );
        assertNotNull( "userpassword", entry.get( "userpassword" ) );
        assertEquals( 1, entry.get( "userpassword" ).size() );
        assertNull( entry.get( "userpassword" ).get().getValue() );

        entry.clear();

        entry.put( "userPassword", binValue1, binValue2, binValue3, binNullValue );
        assertEquals( 1, entry.size() );
        assertNotNull( "userpassword", entry.get( "userpassword" ) );
        assertEquals( 3, entry.get( "userpassword" ).size() );
        attribute = entry.get( "userpassword" );
        assertTrue( attribute.contains( BYTES1 ) );
        assertTrue( attribute.contains( BYTES2 ) );
        assertTrue( attribute.contains( ( byte[] ) null ) );
        assertEquals( "userpassword", attribute.getId() );
        assertEquals( "userPassword", attribute.getUpId() );
    }
View Full Code Here

    @Test
    public void testRemoveAttributesStringArray() throws LdapException
    {
        Entry entry = new DefaultEntry( EXAMPLE_DN );

        Attribute attrOC = new DefaultAttribute( "objectClass", "top", "person" );
        Attribute attrCN = new DefaultAttribute( "cn", "test1", "test2" );
        Attribute attrSN = new DefaultAttribute( "sn", "Test1", "Test2" );
        Attribute attrPWD = new DefaultAttribute( "userPassword", BYTES1, BYTES2 );

        entry.put( attrOC, attrCN, attrSN, attrPWD );

        entry.removeAttributes( "CN", "SN" );
View Full Code Here

    @Test
    public void testRemoveEntryAttributeArray() throws LdapException
    {
        Entry entry = new DefaultEntry( EXAMPLE_DN );

        Attribute attrOC = new DefaultAttribute( "objectClass", "top", "person" );
        Attribute attrCN = new DefaultAttribute( "cn", "test1", "test2" );
        Attribute attrSN = new DefaultAttribute( "sn", "Test1", "Test2" );
        Attribute attrPWD = new DefaultAttribute( "userPassword", BYTES1, BYTES2 );

        entry.put( attrOC, attrCN, attrSN, attrPWD );

        List<Attribute> removed = entry.remove( attrSN, attrPWD );
View Full Code Here

    @Test
    public void testRemoveStringByteArrayArray() throws LdapException
    {
        Entry entry = new DefaultEntry( EXAMPLE_DN );

        Attribute attrPWD = new DefaultAttribute( "userPassword", BYTES1, ( byte[] ) null, BYTES2 );

        entry.put( attrPWD );
        assertTrue( entry.remove( "userPassword", ( byte[] ) null ) );
        assertTrue( entry.remove( "userPassword", BYTES1, BYTES2 ) );
        assertFalse( entry.containsAttribute( "userPassword" ) );
View Full Code Here

    @Test
    public void testRemoveStringValueArray() throws LdapException
    {
        Entry entry = new DefaultEntry( EXAMPLE_DN );

        Attribute attrCN = new DefaultAttribute( "cn", "test1", "test2", ( String ) null );
        Attribute attrPWD = new DefaultAttribute( "userPassword", BYTES1, BYTES2, ( byte[] ) null );

        entry.add( attrCN, attrPWD );

        Value<String> strValue1 = new StringValue( "test1" );
        Value<String> strValue2 = new StringValue( "test2" );
View Full Code Here

    {
        try
        {
            Entry entry = new DefaultEntry( EXAMPLE_DN );

            Attribute attrOC = new DefaultAttribute( "objectClass", "top", "person" );
            Attribute attrCN = new DefaultAttribute( "cn", "test1", "test2" );
            Attribute attrSN = new DefaultAttribute( "sn", "Test1", "Test2" );
            Attribute attrPWD = new DefaultAttribute( "userPassword", BYTES1, BYTES2 );

            entry.put( attrOC, attrCN, attrSN, attrPWD );

            return entry;
        }
View Full Code Here

        assertTrue( entry.containsAttribute( "ObjectClass" ) );
        assertTrue( entry.containsAttribute( "CN" ) );
        assertTrue( entry.containsAttribute( "  sn  " ) );
        assertTrue( entry.containsAttribute( "userPassword" ) );

        Attribute attr = entry.get( "objectclass" );
        assertEquals( 2, attr.size() );

        Attribute attrCN2 = new DefaultAttribute( "cn", "test1", "test3" );
        entry.add( attrCN2 );
        assertEquals( 4, entry.size() );
        attr = entry.get( "cn" );
        assertEquals( 3, attr.size() );
        assertTrue( attr.contains( "test1", "test2", "test3" ) );

        // Check adding some byte[] values (they will not be transformed to Strings)
        attrCN2.clear();
        attrCN2.add( BYTES1, BYTES2 );
        entry.add( attrCN2 );
        assertEquals( 4, entry.size() );
        attr = entry.get( "cn" );
        assertEquals( 3, attr.size() );
        assertTrue( attr.contains( "test1", "test2", "test3" ) );
View Full Code Here

    {
        Entry entry = new DefaultEntry();

        entry.add( "userPassword", ( byte[] ) null );
        assertEquals( 1, entry.size() );
        Attribute attributePWD = entry.get( "userPassword" );
        assertEquals( 1, attributePWD.size() );
        assertNotNull( attributePWD.get() );
        assertNull( attributePWD.get().getValue() );

        entry.add( "jpegPhoto", BYTES1, BYTES1, BYTES2 );
        assertEquals( 2, entry.size() );
        Attribute attributeJPG = entry.get( "jpegPhoto" );
        assertEquals( 2, attributeJPG.size() );
        assertNotNull( attributeJPG.get() );
        assertTrue( attributeJPG.contains( BYTES1 ) );
        assertTrue( attributeJPG.contains( BYTES2 ) );
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.model.entry.Attribute

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.