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

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



    @Test
    public void testModifyDnAsync() throws Exception
    {
        Dn oldDn = new Dn( DN );
        Dn newDn = new Dn( "cn=modifyDnWithString,ou=system" );

        ModifyDnRequest modDnReq = new ModifyDnRequestImpl();
        modDnReq.setName( oldDn );
        modDnReq.setNewRdn( new Rdn( "cn=modifyDnWithString" ) );
        modDnReq.setDeleteOldRdn( true );

        ModifyDnFuture modifyDnFuture = connection.modifyDnAsync( modDnReq );

        ModifyDnResponse response = modifyDnFuture.get( 1000, TimeUnit.MILLISECONDS );

        assertNotNull( response );

        assertTrue( connection.isAuthenticated() );
        assertFalse( session.exists( oldDn ) );
        assertTrue( session.exists( newDn ) );

        assertTrue( session.exists( new Dn( "cn=modifyDnWithString,ou=system" ) ) );
    }
View Full Code Here


    @Ignore
    @Test
    public void testMoveAndRenameShouldDeleteOldRdn() throws Exception
    {
        Dn newDn = new Dn( "cn=modifiedDn", DN_CONTAINER );
        connection.moveAndRename( new Dn( DN ), newDn );

        assertTrue( session.exists( newDn ) );
        Entry entry = session.lookup( newDn, "*" );
        assertTrue( entry.contains( "cn", "modifiedDn" ) );
        assertFalse( entry.contains( "cn", "modDn" ) );
View Full Code Here

    @Ignore
    @Test
    public void testMoveAndRenameWithDeleteOldRdnShouldDeleteOldRdn() throws Exception
    {
        Dn newDn = new Dn( "cn=modifiedDn", DN_CONTAINER );
        connection.moveAndRename( new Dn( DN ), newDn, true );

        assertTrue( session.exists( newDn ) );
        Entry entry = session.lookup( newDn, "*" );
        assertTrue( entry.contains( "cn", "modifiedDn" ) );
        assertFalse( entry.contains( "cn", "modDn" ) );
View Full Code Here


    @Test
    public void testMoveAndRenameWithoutDeleteOldRdnShouldNotDeleteOldRdn() throws Exception
    {
        Dn newDn = new Dn( "cn=modifiedDn", DN_CONTAINER );
        connection.moveAndRename( new Dn( DN ), newDn, false );

        assertTrue( session.exists( newDn ) );
        Entry entry = session.lookup( newDn, "*" );
        assertTrue( entry.contains( "cn", "modifiedDn" ) );
        assertTrue( entry.contains( "cn", "modDn" ) );
View Full Code Here

        getService().getAdminSession().add(
            new DefaultEntry( getService().getSchemaManager(), akarasulu.getEntry() ) );

        try
        {
            getService().getAdminSession().delete( new Dn( "uid=admin,ou=system") );
            fail( "User 'admin' should not be able to delete his account" );
        }
        catch ( LdapNoPermissionException e )
        {
            assertNotNull( e );
View Full Code Here

            new DefaultEntry( getService().getSchemaManager(), akarasulu.getEntry() ) );

        try
        {
            getService().getAdminSession().rename(
                new Dn( "uid=admin,ou=system" ),
                new Rdn( "uid=alex" ),
                false );
            fail( "admin should not be able to rename his account" );
        }
        catch ( LdapNoPermissionException e )
View Full Code Here

        Attribute attribute = new DefaultAttribute( "userPassword", "replaced" );

        Modification mod = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, attribute );
     
        Dn userDn = new Dn( getService().getSchemaManager(), "uid=akarasulu,ou=users,ou=system" );
        LdapPrincipal principal = new LdapPrincipal( getService().getSchemaManager(), userDn, AuthenticationLevel.SIMPLE );
        CoreSession akarasuluSession = getService().getSession( principal );

        try
        {
            akarasuluSession.modify( new Dn( "uid=admin,ou=system" ), mod );
            fail( "User 'uid=admin,ou=system' should not be able to modify attributes on admin" );
        }
        catch ( Exception e )
        {
        }
View Full Code Here

        getService().getAdminSession().add(
            new DefaultEntry( getService().getSchemaManager(), akarasulu.getEntry() ) );

        try
        {
            Dn userDn = new Dn( getService().getSchemaManager(), "uid=akarasulu,ou=users,ou=system" );
            LdapPrincipal principal = new LdapPrincipal( getService().getSchemaManager(), userDn, AuthenticationLevel.SIMPLE );
            CoreSession akarasuluSession = getService().getSession( principal );

            ExprNode filter = FilterParser.parse( getService().getSchemaManager(), "(objectClass=*)" );
            Cursor<Entry> cursor = akarasuluSession.search( new Dn( "ou=users,ou=system" ), SearchScope.OBJECT, filter , AliasDerefMode.DEREF_ALWAYS );
           
            while ( cursor.next() )
            {
                fail();
            }
View Full Code Here

        assertEquals( 1, i );

        int nbIterations = 1500000;

        Dn dn = new Dn( getService().getSchemaManager(), "uid=admin,ou=system" );

        SearchRequest searchRequest = new SearchRequestImpl();

        searchRequest.setBase( dn );
        searchRequest.setFilter( "(ObjectClass=*)" );
View Full Code Here

        cursor.close();

        assertEquals( 5, i );

        int nbIterations = 150000;
        Dn dn = new Dn( getService().getSchemaManager(), "ou=system" );
        SearchRequest searchRequest = new SearchRequestImpl();

        searchRequest.setBase( dn );
        searchRequest.setFilter( "(ObjectClass=*)" );
        searchRequest.setScope( SearchScope.ONELEVEL );
View Full Code Here

TOP

Related Classes of org.apache.directory.api.ldap.model.name.Dn

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.