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

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


        Entry entry = new DefaultEntry( schemaManager, EXAMPLE_DN );

        assertFalse( entry.contains( ( String ) null, "test" ) );
        assertFalse( entry.containsAttribute( "objectClass" ) );

        Attribute attrEMail = new DefaultAttribute( atEMail, "test1", "test2", ( String ) null );
        Attribute attrPWD = new DefaultAttribute( atPwd, BYTES1, BYTES2, ( byte[] ) null );

        entry.add( attrEMail, attrPWD );

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


    {
        Entry entry = new DefaultEntry( schemaManager, EXAMPLE_DN );

        assertFalse( entry.containsAttribute( atOC ) );

        Attribute attrOC = new DefaultAttribute( atOC, "top", "person" );
        Attribute attrCN = new DefaultAttribute( atCN, "test1", "test2" );
        Attribute attrSN = new DefaultAttribute( atSN, "Test1", "Test2" );
        Attribute attrPWD = new DefaultAttribute( atPwd, BYTES1, BYTES2 );

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

        assertTrue( entry.containsAttribute( atOC ) );
        assertTrue( entry.containsAttribute( atCN ) );
View Full Code Here

    {
        Entry entry = new DefaultEntry( schemaManager, EXAMPLE_DN );

        assertFalse( entry.containsAttribute( "objectClass" ) );

        Attribute attrOC = new DefaultAttribute( atOC, "top", "person" );
        Attribute attrCN = new DefaultAttribute( atCN, "test1", "test2" );
        Attribute attrSN = new DefaultAttribute( atSN, "Test1", "Test2" );
        Attribute attrPWD = new DefaultAttribute( atPwd, BYTES1, BYTES2 );

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

        assertTrue( entry.containsAttribute( "OBJECTCLASS", " cn ", "Sn", "  userPASSWORD  " ) );
View Full Code Here

        assertNotSame( entry1, entry2 );

        entry2.setDn( EXAMPLE_DN );
        assertEquals( entry1, entry2 );

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

        entry1.put( attrOC, attrCN, attrSN, attrPWD );
        entry2.put( attrOC, attrCN, attrSN );
        assertNotSame( entry1, entry2 );

        entry2.put( attrPWD );
        assertEquals( entry1, entry2 );

        Attribute attrL1 = new DefaultAttribute( "l", atL, "Paris", "New-York" );
        Attribute attrL2 = new DefaultAttribute( "l", atL, "Paris", "Tokyo" );

        entry1.put( attrL1 );
        entry2.put( attrL1 );
        assertEquals( entry1, entry2 );
View Full Code Here

    {
        Entry entry = new DefaultEntry( schemaManager, EXAMPLE_DN );

        assertEquals( 0, entry.getAttributes().size() );

        Attribute attrOC = new DefaultAttribute( atOC, "top", "person" );
        Attribute attrCN = new DefaultAttribute( atCN, "test1", "test2" );
        Attribute attrSN = new DefaultAttribute( atSN, "Test1", "Test2" );
        Attribute attrPWD = new DefaultAttribute( atPwd, BYTES1, BYTES2 );

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

        Collection<Attribute> attributes = entry.getAttributes();
View Full Code Here

        Entry entry = new DefaultEntry( schemaManager, EXAMPLE_DN );

        assertNull( entry.get( atCN ) );
        assertNull( entry.get( ( AttributeType ) null ) );

        Attribute attrOC = new DefaultAttribute( atOC, "top", "person" );
        Attribute attrCN = new DefaultAttribute( atCN, "test1", "test2" );
        Attribute attrSN = new DefaultAttribute( atSN, "Test1", "Test2" );
        Attribute attrPWD = new DefaultAttribute( atPwd, BYTES1, BYTES2 );

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

        assertNotNull( entry.get( atCN ) );
View Full Code Here

        Entry entry = new DefaultEntry( schemaManager, EXAMPLE_DN );

        assertNull( entry.get( "cn" ) );
        assertNull( entry.get( "badId" ) );

        Attribute attrOC = new DefaultAttribute( atOC, "top", "person" );
        Attribute attrCN = new DefaultAttribute( atCN, "test1", "test2" );
        Attribute attrSN = new DefaultAttribute( atSN, "Test1", "Test2" );
        Attribute attrPWD = new DefaultAttribute( atPwd, BYTES1, BYTES2 );

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

        assertNotNull( entry.get( "CN" ) );
        assertNotNull( entry.get( " commonName " ) );
View Full Code Here

        assertNotSame( entry1.hashCode(), entry2.hashCode() );

        entry2.setDn( EXAMPLE_DN );
        assertEquals( entry1.hashCode(), entry2.hashCode() );

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

        entry1.add( attrOC, attrCN, attrSN, attrPWD );
        entry2.add( attrOC, attrCN, attrSN, attrPWD );

        assertEquals( entry1.hashCode(), entry2.hashCode() );
View Full Code Here

    @Test
    public void testHasObjectClassEntryAttribute() throws Exception
    {
        Entry entry = new DefaultEntry( schemaManager, EXAMPLE_DN );

        Attribute attrOC = new DefaultAttribute( atOC, "top", "person" );

        assertFalse( entry.contains( attrOC ) );
        assertFalse( entry.hasObjectClass( attrOC ) );

        entry.add( attrOC );

        assertTrue( entry.hasObjectClass( attrOC ) );

        Attribute attrOC2 = new DefaultAttribute( atOC, "person" );
        assertTrue( entry.hasObjectClass( attrOC2 ) );

        Attribute attrOC3 = new DefaultAttribute( atOC, "inetOrgPerson" );
        assertFalse( entry.hasObjectClass( attrOC3 ) );
        assertFalse( entry.hasObjectClass( ( Attribute ) null ) );

        Attribute attrCN = new DefaultAttribute( atCN, "top" );
        assertFalse( entry.hasObjectClass( attrCN ) );
    }
View Full Code Here

    @Test
    public void testIterator() throws Exception
    {
        Entry entry = new DefaultEntry( schemaManager, EXAMPLE_DN );

        Attribute attrOC = new DefaultAttribute( atOC, "top", "person" );
        Attribute attrCN = new DefaultAttribute( atCN, "test1", "test2" );
        Attribute attrSN = new DefaultAttribute( atSN, "Test1", "Test2" );
        Attribute attrPWD = new DefaultAttribute( atPwd, BYTES1, BYTES2 );

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

        Iterator<Attribute> iterator = entry.iterator();

        assertTrue( iterator.hasNext() );

        Set<AttributeType> expectedIds = new HashSet<AttributeType>();
        expectedIds.add( atOC );
        expectedIds.add( atCN );
        expectedIds.add( atSN );
        expectedIds.add( atPwd );

        while ( iterator.hasNext() )
        {
            Attribute attribute = iterator.next();

            AttributeType attributeType = attribute.getAttributeType();
            assertTrue( expectedIds.contains( attributeType ) );
            expectedIds.remove( attributeType );
        }

        assertEquals( 0, expectedIds.size() );
View Full Code Here

TOP

Related Classes of org.apache.directory.api.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.