directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lécharny <elecha...@gmail.com>
Subject Re: Work in progress...
Date Sun, 06 Mar 2016 01:49:44 GMT
Le 05/03/16 09:26, Emmanuel Lécharny a écrit :
> Hi guys,
>
> a bit of a heads up on what I'm on atm. being pretty busy aside, and I
> guess its the same for all of you, things are moving forward slowly.
>
> - I have added two AttributeTypes in the ApacheDS schema : nbChildren
> and nbSubordinates. They will contain the number of children and
> subordinates an entry has (we have this information in ApacheDS
> associated with each RDN), they are operational attributes that will be
> added on the fly. I still have to add them in the AbstractBtreePartition
> (in the fetch method, which calls the buildEntryDn metho, which has
> access to this information) On day of work.

So now, I can get back those values for a Lookup operation. Here is a
sample test that works well :

    @Test
    public void testLookupSubordinates() throws LdapException
    {
        Entry entry = connection.lookup( "cn=test,ou=system", "*", "+" );
       
        assertNotNull( entry );

        // We should have 11 attributes
        assertEquals( 11, entry.size() );
        assertTrue( entry.containsAttribute( "nbChildren",
"nbSubordinates" ) );
        assertEquals( 0L, Long.parseLong( entry.get( "nbChildren"
).getString() ) );
        assertEquals( 0L, Long.parseLong( entry.get( "nbSubordinates"
).getString() ) );
       
        // Now lookup for the "ou=system"
        entry = connection.lookup( "ou=system", "*", "+" );
       
        assertNotNull( entry );

        // We should have 11 attributes
        assertEquals( 11, entry.size() );
        assertTrue( entry.containsAttribute( "nbChildren",
"nbSubordinates" ) );

        // we will have 6 children :
        // - ou=configuration
        // - ou=consumer
        // - ou = groups
        // - ou=users
        // - ou=prefNodeNames
        // - uid=admin
        // and 10 subordinates, as we have 3 children under
ou=configuration and one under ou=groups
        assertEquals( 6L, Long.parseLong( entry.get( "nbChildren"
).getString() ) );
        assertEquals( 10L, Long.parseLong( entry.get( "nbSubordinates"
).getString() ) );
    }


I still have to add the Search filter, which should not be complicated
(but it's already almost 3am ;-)


This was a funny feature to add that leverages something we had in the
backend for years. It works for every partition extending teh
AbtsractBtreePartition (so for the moment, it doesn't return anything
for the schema partition).

I think it will be very useful for studio, when running against
ApacheDS, as once can now expose the number of *real* childrens and
subrdinates without having to fetch them from teh server (more
important, we won't be limited by the SizeLimit that can be set -
typically 1000).

I wish we can have the same feature added to OpenLDAP and the other
servers...

More to come !

Mime
View raw message