Examples of RDN


Examples of org.apache.directory.api.ldap.model.name.Rdn

            nc = connections.get( connectionIndex );
           
            Dn personDn = present.get( i );
           
            ModifyDnRequest modReq = new ModifyDnRequestImpl();
            Rdn newRdn = new Rdn( "cn=p_rename" + i );
            modReq.setName( personDn );
            modReq.setNewRdn( newRdn );
           
            if( verbose )
            {
View Full Code Here

Examples of org.apache.directory.api.ldap.model.name.Rdn

        partitionLookupTree.add( suffix, partition );

        assertNotNull( partitionLookupTree );
        assertTrue( partitionLookupTree.hasChildren() );
        assertTrue( partitionLookupTree.contains( new Rdn( schemaManager, "dc=com" ) ) );

        DnNode<Partition> child = partitionLookupTree.getChild( new Rdn( schemaManager, "dc=com" ) );
        assertTrue( child.hasChildren() );
        assertTrue( child.contains( new Rdn( schemaManager, "dc=example" ) ) );

        child = child.getChild( new Rdn( schemaManager, "dc=example" ) );
        assertEquals( "dc=example, dc=com", child.getElement().getSuffixDn().getName() );
    }
View Full Code Here

Examples of org.apache.directory.api.ldap.model.name.Rdn

        partitionLookupTree.add( suffix2, partition2 );

        assertNotNull( partitionLookupTree );
        assertTrue( partitionLookupTree.hasChildren() );
        assertTrue( partitionLookupTree.contains( new Rdn( schemaManager, "ou=system" ) ) );
        assertTrue( partitionLookupTree.contains( new Rdn( schemaManager, "dc=com" ) ) );

        DnNode<Partition> child = partitionLookupTree.getChild( new Rdn( schemaManager, "ou=system" ) );
        assertTrue( child.isLeaf() );
        assertEquals( "ou=system", child.getElement().getSuffixDn().getName() );

        child = partitionLookupTree.getChild( new Rdn( schemaManager, "dc=com" ) );
        assertTrue( child.hasChildren() );
        assertTrue( child.contains( new Rdn( schemaManager, "dc=example" ) ) );

        child = child.getChild( new Rdn( schemaManager, "dc=example" ) );
        assertTrue( child.isLeaf() );
        assertEquals( "dc=example, dc=com", child.getElement().getSuffixDn().getName() );
    }
View Full Code Here

Examples of org.apache.directory.api.ldap.model.name.Rdn

        partitionLookupTree.add( suffix2, partition2 );

        assertNotNull( partitionLookupTree );

        assertTrue( partitionLookupTree.hasChildren() );
        assertTrue( partitionLookupTree.contains( new Rdn( schemaManager, "dc=com" ) ) );

        DnNode<Partition> child = partitionLookupTree.getChild( new Rdn( schemaManager, "dc=com" ) );
        assertTrue( child.hasChildren() );

        child = partitionLookupTree.getChild( new Rdn( schemaManager, "dc=com" ) );
        assertTrue( child.hasChildren() );
        assertTrue( child.contains( new Rdn( schemaManager, "dc=example1" ) ) );
        assertTrue( child.contains( new Rdn( schemaManager, "dc=example2" ) ) );

        DnNode<Partition> child1 = child.getChild( new Rdn( schemaManager, "dc=example1" ) );
        assertTrue( child1.isLeaf() );
        assertEquals( "dc=example1, dc=com", child1.getElement().getSuffixDn().getName() );

        DnNode<Partition> child2 = child.getChild( new Rdn( schemaManager, "dc=example1" ) );
        assertTrue( child2.isLeaf() );
        assertEquals( "dc=example1, dc=com", child2.getElement().getSuffixDn().getName() );
    }
View Full Code Here

Examples of org.apache.directory.api.ldap.model.name.Rdn

    public void testCount() throws Exception
    {
        initIndex();
        assertEquals( 0, idx.count() );

        ParentIdAndRdn key = new ParentIdAndRdn( Strings.getUUID( 0L ), new Rdn( "cn=key" ) );

        idx.add( key, Strings.getUUID( 0L ) );
        assertEquals( 1, idx.count() );

        // setting a different parentId should make this key a different key
        key = new ParentIdAndRdn( Strings.getUUID( 1L ), new Rdn( "cn=key" ) );

        idx.add( key, Strings.getUUID( 1L ) );
        assertEquals( 2, idx.count() );

        //count shouldn't get affected cause of inserting the same key
        idx.add( key, Strings.getUUID( 2L ) );
        assertEquals( 2, idx.count() );

        key = new ParentIdAndRdn( Strings.getUUID( 2L ), new Rdn( "cn=key" ) );
        idx.add( key, Strings.getUUID( 3L ) );
        assertEquals( 3, idx.count() );
    }
View Full Code Here

Examples of org.apache.directory.api.ldap.model.name.Rdn

    @Test
    public void testCountOneArg() throws Exception
    {
        initIndex();

        ParentIdAndRdn key = new ParentIdAndRdn( Strings.getUUID( 0L ), new Rdn( "cn=key" ) );

        assertEquals( 0, idx.count( key ) );

        idx.add( key, Strings.getUUID( 0L ) );
        assertEquals( 1, idx.count( key ) );
View Full Code Here

Examples of org.apache.directory.api.ldap.model.name.Rdn

    @Test
    public void testLookups() throws Exception
    {
        initIndex();

        ParentIdAndRdn key = new ParentIdAndRdn( Strings.getUUID( 0L ), new Rdn( schemaManager, "cn=key" ) );

        assertNull( idx.forwardLookup( key ) );

        idx.add( key, Strings.getUUID( 0L ) );
        assertEquals( Strings.getUUID( 0L ), idx.forwardLookup( key ) );
        assertEquals( key, idx.reverseLookup( Strings.getUUID( 0L ) ) );

        // check with the different case in UP name, this ensures that the custom
        // key comparator is used
        key = new ParentIdAndRdn( Strings.getUUID( 0L ), new Rdn( schemaManager, "cn=KEY" ) );
        assertEquals( Strings.getUUID( 0L ), idx.forwardLookup( key ) );
        assertEquals( key, idx.reverseLookup( Strings.getUUID( 0L ) ) );
    }
View Full Code Here

Examples of org.apache.directory.api.ldap.model.name.Rdn

    @Test
    public void testAddDropById() throws Exception
    {
        initIndex();

        ParentIdAndRdn key = new ParentIdAndRdn( Strings.getUUID( 0L ), new Rdn( "cn=key" ) );

        assertNull( idx.forwardLookup( key ) );

        // test add/drop without adding any duplicates
        idx.add( key, Strings.getUUID( 0L ) );
View Full Code Here

Examples of org.apache.directory.api.ldap.model.name.Rdn

    @Test
    public void testCursors() throws Exception
    {
        initIndex();

        ParentIdAndRdn key = new ParentIdAndRdn( Strings.getUUID( 0L ), new Rdn( "cn=key" ) );

        assertEquals( 0, idx.count() );

        idx.add( key, Strings.getUUID( 0L ) );
        assertEquals( 1, idx.count() );

        for ( long i = 1; i < 5; i++ )
        {
            key = new ParentIdAndRdn( Strings.getUUID( i ), new Rdn( "cn=key" + i ) );

            idx.add( key, Strings.getUUID( i ) );
        }

        assertEquals( 5, idx.count() );
View Full Code Here

Examples of org.apache.directory.api.ldap.model.name.Rdn

        Dn newDn = new Dn( schemaManager );
        int size = dn.size();

        for ( int pos = 0; pos < size; pos++ )
        {
            Rdn rdn = dn.getRdn( size - 1 - pos );

            if ( rdn.size() == 0 )
            {
                newDn = newDn.add( new Rdn() );
                continue;
            }
            else if ( rdn.size() == 1 )
            {
                String name = schemaManager.lookupAttributeTypeRegistry( rdn.getNormType() ).getName();
                String value = rdn.getNormValue().getString();
                newDn = newDn.add( new Rdn( name, value ) );
                continue;
            }

            // below we only process multi-valued rdns
            StringBuffer buf = new StringBuffer();

            for ( Iterator<Ava> atavs = rdn.iterator(); atavs.hasNext(); /**/)
            {
                Ava atav = atavs.next();
                String type = schemaManager.lookupAttributeTypeRegistry( rdn.getNormType() ).getName();
                buf.append( type ).append( '=' ).append( atav.getNormValue() );

                if ( atavs.hasNext() )
                {
                    buf.append( '+' );
                }
            }

            newDn = newDn.add( new Rdn( buf.toString() ) );
        }

        return newDn;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.