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

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


            //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


        Entry personEntry = getPersonEntry( "Bush", "Kate#Bush" );
        String dn = "cn=Kate\\#Bush,ou=system";
        personEntry.setDn( new Dn( dn ) );
        connection.add( personEntry );

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

        boolean entryFound = false;

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

            assertTrue( personEntry.getDn().equals( entry.getDn() ) );
            Attribute cn = entry.get( "cn" );
            assertNotNull( cn );
            assertTrue( cn.contains( "Kate#Bush" ) );
        }

        cursor.close();

        assertTrue( "entry found", entryFound );

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

        Entry entry = getPersonEntry( "Bush", "Bush, Kate" );
        String dn = "cn=Bush\\, Kate,ou=system";
        entry.setDn( new Dn( dn ) );
        connection.add( entry );

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

        boolean entryFound = false;

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

            assertTrue( entry.getDn().equals( sr.getDn() ) );
            Attribute cn = sr.get( "cn" );
            assertNotNull( cn );

            assertTrue( cn.contains( "Bush, Kate" ) );
        }

        cursor.close();

        assertTrue( "entry found", entryFound );

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

        Entry entry = getPersonEntry( "Messer", "Mackie \"The Knife\" Messer" );
        String dn = "cn=Mackie \\\"The Knife\\\" Messer,ou=system";
        entry.setDn( new Dn( dn ) );
        connection.add( entry );

        EntryCursor cursor = connection.search( "ou=system", "(cn=Mackie \"The Knife\" Messer)",
            SearchScope.SUBTREE, "*" );
        boolean entryFound = false;

        while ( cursor.next() )
        {
            Entry sr = cursor.get();
            entryFound = true;
            assertTrue( entry.getDn().equals( sr.getDn() ) );
            Attribute cn = sr.get( "cn" );
            assertNotNull( cn );
            assertTrue( cn.contains( "Mackie \"The Knife\" Messer" ) );
        }

        cursor.close();

        assertTrue( "entry found", entryFound );

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

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

        EntryCursor cursor = connection.search( "ou=system", "(ou=AC\\5CDC)", 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( "AC\\DC" ) );
        }
       
        cursor.close();

        assertTrue( "no entry found", entryFound );
        connection.delete( dn );
        connection.close();
    }
View Full Code Here

        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

        LdapConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
        connection.bind( "uid=admin,ou=system", "secret" );

        long t2 = System.currentTimeMillis();

        EntryCursor cursor = connection.search( "dc=example,dc=com", "(objectClass=*)", SearchScope.SUBTREE, "*" );

        while ( cursor.next() )
        {
            cursor.get();
        }

        cursor.close();

        long t3 = System.currentTimeMillis();

        connection.close();

View Full Code Here

TOP

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