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

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


                for ( int i = 0; i < nbModifs; i++ )
                {
                    int operation = in.readInt();
                    String modStr = Unicode.readUTF(in);
                    DefaultEntryAttribute value = ( DefaultEntryAttribute ) in.readObject();

                    addModificationItem( ModificationOperation.getOperation( operation ), modStr, value );
                }

                break;
View Full Code Here


        catch ( LdapException ne )
        {
            // do nothing
        }

        EntryAttribute attr = new DefaultEntryAttribute( "attr0" );
        attr.add( "val0" );
        attr.add( "val1" );
        attr.add( "val2" );
        Modification item = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, attr );
        req.addModification( item );

        attr = new DefaultEntryAttribute( "attr1" );
        attr.add( "val3" );
        item = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE, attr );
        req.addModification( item );

        attr = new DefaultEntryAttribute( "attr2" );
        attr.add( "val4" );
        attr.add( "val5" );
        item = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, attr );
        req.addModification( item );

        return req;
    }
View Full Code Here

     */
    @Test
    public void testNotEqualDiffModOps()
    {
        ModifyRequestImpl req0 = getRequest();
        EntryAttribute attr = new DefaultEntryAttribute( "attr3" );
        attr.add( "val0" );
        attr.add( "val1" );
        attr.add( "val2" );
        Modification item = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, attr );
        req0.addModification( item );

        ModifyRequestImpl req1 = getRequest();
        attr = new DefaultEntryAttribute( "attr3" );
        attr.add( "val0" );
        attr.add( "val1" );
        attr.add( "val2" );
        item = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE, attr );
        req0.addModification( item );

        assertFalse( req0.equals( req1 ) );
        assertFalse( req1.equals( req0 ) );
View Full Code Here

     */
    @Test
    public void testNotEqualDiffModCount()
    {
        ModifyRequestImpl req0 = getRequest();
        EntryAttribute attr = new DefaultEntryAttribute( "attr3" );
        attr.add( "val0" );
        attr.add( "val1" );
        attr.add( "val2" );
        Modification item = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, attr );
        req0.addModification( item );

        ModifyRequestImpl req1 = getRequest();

View Full Code Here

     */
    @Test
    public void testNotEqualDiffModIds()
    {
        ModifyRequestImpl req0 = getRequest();
        EntryAttribute attr = new DefaultEntryAttribute( "attr3" );
        attr.add( "val0" );
        attr.add( "val1" );
        attr.add( "val2" );
        Modification item = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, attr );
        req0.addModification( item );

        ModifyRequestImpl req1 = getRequest();
        attr = new DefaultEntryAttribute( "attr4" );
        attr.add( "val0" );
        attr.add( "val1" );
        attr.add( "val2" );
        item = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, attr );
        req0.addModification( item );

        assertFalse( req0.equals( req1 ) );
        assertFalse( req1.equals( req0 ) );
View Full Code Here

     */
    @Test
    public void testNotEqualDiffModValues()
    {
        ModifyRequestImpl req0 = getRequest();
        EntryAttribute attr = new DefaultEntryAttribute( "attr3" );
        attr.add( "val0" );
        attr.add( "val1" );
        attr.add( "val2" );
        Modification item = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, attr );
        req0.addModification( item );

        ModifyRequestImpl req1 = getRequest();
        attr = new DefaultEntryAttribute( "attr3" );
        attr.add( "val0" );
        attr.add( "val1" );
        attr.add( "val2" );
        attr.add( "val3" );
        item = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, attr );
        req0.addModification( item );

        assertFalse( req0.equals( req1 ) );
        assertFalse( req1.equals( req0 ) );
View Full Code Here

        ModifyRequest req0 = new ModifyRequest()
        {
            public Collection<Modification> getModifications()
            {
                List<Modification> list = new ArrayList<Modification>();
                EntryAttribute attr = new DefaultEntryAttribute( "attr0" );
                attr.add( "val0" );
                attr.add( "val1" );
                attr.add( "val2" );
                Modification item = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, attr );
                list.add( item );

                attr = new DefaultEntryAttribute( "attr1" );
                attr.add( "val3" );
                item = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE, attr );
                list.add( item );

                attr = new DefaultEntryAttribute( "attr2" );
                attr.add( "val4" );
                attr.add( "val5" );
                item = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, attr );
                list.add( item );

                return list;
            }
View Full Code Here

    {
        try
        {
            Entry entry = new DefaultEntry( EXAMPLE_DN );
           
            EntryAttribute attrOC = new DefaultEntryAttribute( "objectClass", "top", "person" );
            EntryAttribute attrCN = new DefaultEntryAttribute( "cn", "test1", "test2" );
            EntryAttribute attrSN = new DefaultEntryAttribute( "sn", "Test1", "Test2" );
            EntryAttribute attrPWD = new DefaultEntryAttribute( "userPassword", BYTES1, BYTES2 );
           
            entry.put( attrOC, attrCN, attrSN, attrPWD );
           
            return entry;
        }
View Full Code Here

     * Test method for DefaultEntry( Dn, EntryAttribute... )
     */
    @Test
    public void testDefaultClientEntryLdapDNEntryAttributeArray()
    {
        EntryAttribute attrOC = new DefaultEntryAttribute( "objectClass", "top", "person" );
        EntryAttribute attrCN = new DefaultEntryAttribute( "cn", "test1", "test2" );
        EntryAttribute attrPWD = new DefaultEntryAttribute( "userPassword", BYTES1, BYTES2 );
       
        Entry entry = new DefaultEntry( EXAMPLE_DN, attrOC, attrCN, attrPWD );
       
        assertNotNull( entry );
        assertNotNull( entry.getDn() );
View Full Code Here

        assertTrue( entry.containsAttribute( "userPassword" ) );
   
        EntryAttribute attr = entry.get( "objectclass" );
        assertEquals( 2, attr.size() );
       
        EntryAttribute attrCN2 = new DefaultEntryAttribute( "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

TOP

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

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.