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

Examples of org.apache.directory.shared.ldap.entry.Entry


        Cursor<SearchResponse> cursor = connection.search( "ou=system", "(objectclass=organizationalUnit)", SearchScope.ONELEVEL, "*",
            "+" );
        int count = 0;
        while ( cursor.next() )
        {
            Entry entry = ( ( SearchResultEntry ) cursor.get() ).getEntry();
            assertNotNullentry );
            count++;
        }
       
        assertEquals( 4, count );
View Full Code Here


       
        for ( int i = 0; i < numEntries; i++ )
        {
            String s = String.valueOf( i );
            DN dn = new DN( "cn=" + s + ",ou=system" );
            Entry entry = new DefaultClientEntry( dn );
            entry.add( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.PERSON_OC );
            entry.add( SchemaConstants.CN_AT, s );
            entry.add( SchemaConstants.SN_AT, s );

            connection.add( entry );
        }
       
        SearchRequest sr = new SearchRequest();
View Full Code Here

        cursor.beforeFirst();
        int nbRes = 0;
       
        while ( cursor.next() )
        {
            Entry entry = cursor.get();
            assertNotNull( entry );
            assertNotNull( entry.get( "ou" ) );
            assertEquals( "Roles", entry.get( "ou" ).getString() );
            nbRes++;
        }
       
        assertEquals( 1, nbRes );
    }
View Full Code Here

        createUser( "billyd", "billyd" );

        DN userName = new DN( "uid=billyd,ou=users,ou=system" );
        // Authenticate to RootDSE
        LdapConnection connection = getConnectionAs( userName, "billyd" );
        Entry entry = ( ( SearchResultEntry ) connection.lookup( "" ) ).getEntry();
        assertNotNull( entry );
        assertEquals( 0, entry.getDn().size() );
    }
View Full Code Here

    private AddResponse createSubContext( DN parent, String type, String value ) throws Exception
    {
        DN dn = ( DN ) parent.clone();
        dn.add( "ou=" + value );
        Entry entry = new DefaultClientEntry( dn );
        entry.add( SchemaConstants.OBJECT_CLASS_AT, "person" );
        entry.add( SchemaConstants.OBJECT_CLASS_AT, "OrganizationalPerson" );
        entry.add( SchemaConstants.CN_AT, value );
        entry.add( SchemaConstants.SN_AT, value );
       
        AddResponse resp = getAdminConnection( ldapServer ).add( entry );
       
        return resp;
    }
View Full Code Here

    @Test
    public void testFailMoveEntryAlreadyExists() throws Exception
    {
        LdapConnection connection = getAdminConnection( ldapServer );

        Entry entry = new DefaultClientEntry( new DN( "ou=users,ou=groups,ou=system" ) );
        entry.add( SchemaConstants.OBJECT_CLASS_AT, "OrganizationalUnit" );
        entry.add( SchemaConstants.OU_AT, "users" );
       
        connection.add( entry );
        ModifyDnResponse resp = connection.rename( entry.getDn(), new RDN( "ou=users" ) );
        assertEquals( ResultCodeEnum.ENTRY_ALREADY_EXISTS, resp.getLdapResult().getResultCode() );

        Entry userzEntry = new DefaultClientEntry( new DN( "ou=userz,ou=groups,ou=system" ) );
        userzEntry.add( SchemaConstants.OBJECT_CLASS_AT, "OrganizationalUnit" );
        userzEntry.add( SchemaConstants.OU_AT, "userz" );
       
        connection.add( userzEntry );
       
        ModifyDnResponse modResp = connection.rename( "ou=userz,ou=groups,ou=system", "ou=users", true );
        assertEquals( ResultCodeEnum.ENTRY_ALREADY_EXISTS, modResp.getLdapResult().getResultCode() );
View Full Code Here

    public void testMoveControl() throws Exception
    {
        LdapConnection connection = getAdminConnection( ldapServer );

        connection.move( "ou=users,ou=system", "ou=groups,ou=system" );
        Entry entry = ( ( SearchResultEntry ) connection.lookup( "ou=users,ou=groups,ou=system" ) ).getEntry();
        assertNotNull( entry );

        SearchResponse res = connection.lookup( "ou=users,ou=system" );
        assertNull( res );
    }
View Full Code Here

        ModifyRequest modReq = new ModifyRequest( new DN( "ou=users,ou=system" ) );
        modReq.add( SchemaConstants.OU_AT, "dummyValue" );
       
        connection.modify( modReq );
        Entry entry = ( ( SearchResultEntry ) connection.lookup( "ou=users,ou=system" ) ).getEntry();
        EntryAttribute ou = entry.get( "ou" );
        assertTrue( ou.contains( "users" ) );
        assertTrue( ou.contains( "dummyValue" ) );
    }
View Full Code Here

    @Test
    public void testLookupControl() throws Exception
    {
        LdapConnection connection = getAdminConnection( ldapServer );

        Entry entry = ( ( SearchResultEntry ) connection.lookup( "ou=users,ou=system" ) ).getEntry();
        assertNotNull( entry );
        assertEquals( "users", entry.get( "ou" ).getString() );
    }
View Full Code Here

    @Test
    public void testFailAddOnAlias() throws Exception
    {
        LdapConnection connection = getAdminConnection( ldapServer );

        Entry entry = new DefaultClientEntry( new DN( "cn=toanother,ou=system" ) );
        entry.add( SchemaConstants.OBJECT_CLASS_AT, "alias", SchemaConstants.EXTENSIBLE_OBJECT_OC );
        entry.add( "aliasedObjectName", "ou=users,ou=system" );

        connection.add( entry );

        Entry aliasChild = new DefaultClientEntry( new DN( "ou=blah,cn=toanother,ou=system" ) );
        aliasChild.add( SchemaConstants.OBJECT_CLASS_AT, "organizationalUnit" );
        aliasChild.add( SchemaConstants.OU_AT, "blah" );

        AddResponse resp = connection.add( aliasChild );
        assertEquals( ResultCodeEnum.ALIAS_PROBLEM, resp.getLdapResult().getResultCode() );
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.entry.Entry

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.