Package javax.naming.ldap

Examples of javax.naming.ldap.LdapContext.rename()


    public void testRejectSchemaRenameWithDeps() throws Exception
    {
        LdapContext schemaRoot = getSchemaContext( service );
        try
        {
            schemaRoot.rename( "cn=nis", "cn=foo" );
            fail( "should not be able to rename nis which has samba as it's dependent" );
        }
        catch ( OperationNotSupportedException onse )
        {
            // expected       
View Full Code Here


        IntegrationUtils.enableSchema( service, "samba" );
        assertTrue( service.getSchemaManager().getAttributeTypeRegistry().contains( "sambaNTPassword" ) );
        assertEquals( "samba", service.getSchemaManager().getAttributeTypeRegistry().getSchemaName( "sambaNTPassword" ) );
       
        schemaRoot.rename( "cn=samba", "cn=foo" );
        assertNotNull( schemaRoot.lookup( "cn=foo" ) );
        assertTrue( service.getSchemaManager().getAttributeTypeRegistry().contains( "sambaNTPassword" ) );
        assertEquals( "foo", service.getSchemaManager().getAttributeTypeRegistry().getSchemaName( "sambaNTPassword" ) );

        //noinspection EmptyCatchBlock
View Full Code Here

        DN dn = getAttributeTypeContainer( "apachemeta" );
        dn.add( "m-oid=" + OID );
       
        DN newdn = getAttributeTypeContainer( "apachemeta" );
        newdn.add( "m-oid=" + NEW_OID );
        schemaRoot.rename( DN.toName( dn ), DN.toName( newdn ) );

        assertFalse( "old attributeType OID should be removed from the registry after being renamed",
            service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
       
        service.getSchemaManager().getAttributeTypeRegistry().lookup( OID );
View Full Code Here

                    // we use LdapName here for the following reason:
                    // - when passing dn as String, JNDI doesn't handle slashes '/' correctly
                    // - when using LdapDN from shared-ldap, JNDI uses the toString() method
                    //   and LdapDN.toString() returns the normalized ATAV, but we need the
                    //   user provided ATAV.
                    modCtx.rename( new LdapName( oldDn ), new LdapName( newDn ) );
                }
                catch ( ReferralException re )
                {
                    try
                    {
View Full Code Here

            {
                try
                {
                    LdapContext modCtx = context.newInstance( controls );
                    modCtx.addToEnvironment( Context.REFERRAL, "throw" ); //$NON-NLS-1$
                    modCtx.rename( new LdapName( oldDn ), new LdapName( newDn ) );
                }
                catch ( NamingException ne )
                {
                    namingException = ne;
                }
View Full Code Here

                    else
                    {
                        modCtx.addToEnvironment( "java.naming.ldap.deleteRDN", "false" ); //$NON-NLS-1$ //$NON-NLS-2$
                    }

                    modCtx.rename( new LdapName( oldDn ), new LdapName( newDn ) );
                }
                catch ( NamingException ne )
                {
                    namingException = ne;
                }
View Full Code Here

                    {
                        modCtx.addToEnvironment( JAVA_NAMING_LDAP_DELETE_RDN, "false" ); //$NON-NLS-1$
                    }

                    // rename entry
                    modCtx.rename( getSaveJndiName( oldDn ), getSaveJndiName( newDn ) );
                }
                catch ( ReferralException re )
                {
                    logModification = false;
                    try
View Full Code Here

    @Test
    public void testMoveNoRdnChange() throws Exception
    {
        LdapContext ctx = getWiredContext( ldapServer );
        ctx.rename( DN, NEW_DN );
       
        SearchControls controls = new SearchControls();
        controls.setSearchScope( SearchControls.OBJECT_SCOPE );
       
        NamingEnumeration<SearchResult> results =
View Full Code Here

    @Test
    public void testMoveAndRdnChange() throws Exception
    {
        LdapContext ctx = getWiredContext( ldapServer );
        ctx.rename( DN, NEW_DN2 );
       
        SearchControls controls = new SearchControls();
        controls.setSearchScope( SearchControls.OBJECT_SCOPE );
       
        NamingEnumeration<SearchResult> results =
View Full Code Here

        LdapContext ctx = getWiredContextThrowOnRefferal( ldapServer );
       
        // ModifyDN referrals failure
        try
        {
            ctx.rename( "uid=akarasuluref,ou=users,ou=system", "uid=ref,ou=users,ou=system" );
            fail( "Should never get here due to ModifyDN failure on ReferralException" );
        }
        catch ( ReferralException e )
        {
            // seems JNDI only returns the first referral URL and not all so we test for it
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.