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

Examples of org.apache.directory.api.ldap.model.cursor.EntryCursor


        Entry entry = getOrgUnitEntry( "East -> West" );
        String dn = "ou=East -\\> West,ou=system";
        entry.setDn( new Dn( dn ) );
        connection.add( entry );

        EntryCursor cursor = connection
            .search( "ou=system", "(ou=East -> West)", SearchScope.SUBTREE, "*" );

        boolean entryFound = false;

        while ( cursor.next() )
        {
            Entry sr = cursor.get();
            entryFound = true;

            assertTrue( entry.getDn().equals( sr.getDn() ) );
            Attribute ou = sr.get( "ou" );
            assertNotNull( ou );
            assertTrue( ou.contains( "East -> West" ) );
        }

        cursor.close();

        assertTrue( "entry found", entryFound );

        connection.delete( dn );
        connection.close();
View Full Code Here


        Entry entry = getOrgUnitEntry( "Scissors 8<" );
        String dn = "ou=Scissors 8\\<,ou=system";
        entry.setDn( new Dn( dn ) );
        connection.add( entry );

        EntryCursor cursor = connection.search( "ou=system", "(ou=Scissors 8<)", SearchScope.SUBTREE, "*" );

        boolean entryFound = false;

        while ( cursor.next() )
        {
            Entry sr = cursor.get();
            entryFound = true;

            assertTrue( entry.getDn().equals( sr.getDn() ) );

            Attribute ou = sr.get( "ou" );
            assertNotNull( ou );
            assertTrue( ou.contains( "Scissors 8<" ) );
        }

        cursor.close();

        assertTrue( "entry found", entryFound );

        connection.delete( dn );
        connection.close();
View Full Code Here

        Entry entry = getOrgUnitEntry( "semicolon group;" );
        String dn = "ou=semicolon group\\;,ou=system";
        entry.setDn( new Dn( dn ) );
        connection.add( entry );

        EntryCursor cursor = connection.search( "ou=system", "(ou=semicolon group;)", SearchScope.SUBTREE,
            "*" );

        boolean entryFound = false;

        while ( cursor.next() )
        {
            Entry sr = cursor.get();
            entryFound = true;

            assertTrue( entry.getDn().equals( sr.getDn() ) );
            Attribute ou = sr.get( "ou" );
            assertNotNull( ou );
            assertTrue( ou.contains( "semicolon group;" ) );
        }

        cursor.close();

        assertTrue( "entry found", entryFound );

        connection.delete( dn );
        connection.close();
View Full Code Here

        Entry entry = getOrgUnitEntry( "nomen=omen" );
        String dn = "ou=nomen\\=omen,ou=system";
        entry.setDn( new Dn( dn ) );
        connection.add( entry );

        EntryCursor cursor = connection.search( "ou=system", "(ou=nomen=omen)", SearchScope.SUBTREE, "*" );

        boolean entryFound = false;

        while ( cursor.next() )
        {
            Entry sr = cursor.get();
            entryFound = true;

            assertTrue( entry.getDn().equals( sr.getDn() ) );
            Attribute ou = sr.get( "ou" );
            assertNotNull( ou );
            assertTrue( ou.contains( "nomen=omen" ) );
        }

        cursor.close();

        assertTrue( "entry found", entryFound );

        connection.delete( dn );
        connection.close();
View Full Code Here

    private Map<String, Entry> getAllEntries( LdapConnection connection, boolean print ) throws Exception
    {
        Map<String, Entry> resultMap = new HashMap<String, Entry>();

        EntryCursor cursor = connection.search( "ou=system", "(objectClass=*)", SearchScope.SUBTREE, "+",
            "*" );

        while ( cursor.next() )
        {
            Entry entry = cursor.get();

            String dn = entry.getDn().getName();
            resultMap.put( dn, entry );

            if ( print )
            {
                System.out.println( "found entry " + dn );
            }
        }

        cursor.close();

        return resultMap;
    }
View Full Code Here

    private Map<String, Entry> getAllEntriesRestrictAttributes( LdapConnection connection ) throws Exception
    {
        Map<String, Entry> resultMap = new HashMap<String, Entry>();

        EntryCursor cursor = connection.search( "ou=system", "(objectClass=*)", SearchScope.SUBTREE, "cn" );

        while ( cursor.next() )
        {
            Entry entry = cursor.get();
            resultMap.put( entry.getDn().getName(), entry );
        }

        cursor.close();

        return resultMap;
    }
View Full Code Here

    private Map<String, Entry> getAllEntriesCollectiveAttributesOnly( LdapConnection connection ) throws Exception
    {
        Map<String, Entry> resultMap = new HashMap<String, Entry>();

        EntryCursor cursor = connection.search( "ou=system", "(objectClass=*)", SearchScope.SUBTREE,
            "c-ou", "c-st" );

        while ( cursor.next() )
        {
            Entry entry = cursor.get();

            resultMap.put( entry.getDn().getName(), entry );
        }

        cursor.close();

        return resultMap;
    }
View Full Code Here

        // Setup the collective attribute specific administration point
        // -------------------------------------------------------------------
        addAdministrativeRole( connection, "collectiveAttributeSpecificArea" );
        connection.add( getTestSubentry( "cn=testsubentry,ou=system" ) );

        EntryCursor cursor = connection.search( "ou=system", "(c-ou=configuration)", SearchScope.SUBTREE, "+",
            "*" );

        boolean found = false;

        while ( cursor.next() )
        {
            Entry entry = cursor.get();

            found = true;
            break;
        }

        cursor.close();

        assertTrue( found );

        connection.close();
    }
View Full Code Here

        assertEquals( "configuration", c_ou.getString() );

        // -------------------------------------------------------------------
        // Test searching for subtypes
        // -------------------------------------------------------------------
        EntryCursor responses = connection.search( "ou=services,ou=configuration,ou=system",
            "(ObjectClass=*)", SearchScope.OBJECT, "ou" );

        while ( responses.next() )
        {
            entry = responses.get();

            assertEquals( 2, entry.size() );
            assertTrue( entry.containsAttribute( "ou" ) );
            assertTrue( entry.containsAttribute( "c-ou" ) );
            assertTrue( entry.contains( "ou", "services" ) );
            assertTrue( entry.contains( "c-ou", "configuration" ) );
        }

        responses.close();

        // ------------------------------------------------------------------
        // test an entry that should show the collective attribute c-ou,
        // but restrict returned attributes to c-ou and c-st
        // ------------------------------------------------------------------
View Full Code Here

            //assertNotNull( conn.lookup( "cn=barAlias,cn=foo,cn=test,ou=system" ) );
            //assertNotNull( conn.lookup( "cn=fooAlias,cn=bar,cn=test,ou=system" ) );

            // Now, do a search
            EntryCursor cursor = conn.search( "cn=foo,cn=test,ou=system", "(objectClass=*)", SearchScope.SUBTREE, "*" );

            while ( cursor.next() )
            {
                //System.out.println( cursor.get().getDn() );
            }

            cursor.close();
        }
        finally
        {
            // Cleanup entries now
            conn.delete( "cn=barAlias,cn=foo,cn=test,ou=system" );
View Full Code Here

TOP

Related Classes of org.apache.directory.api.ldap.model.cursor.EntryCursor

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.