Package javax.naming.ldap

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


    @Test
    public void testMoveNoRdnChange() throws Exception
    {
        LdapContext ctx = getWiredContext( getLdapServer() );
        ctx.rename( DN, NEW_DN );

        SearchControls controls = new SearchControls();
        controls.setSearchScope( SearchControls.OBJECT_SCOPE );

        NamingEnumeration<SearchResult> results = ctx.search( NEW_DN, "(objectClass=*)", controls );
View Full Code Here


    @Test
    public void testMoveAndRdnChange() throws Exception
    {
        LdapContext ctx = getWiredContext( getLdapServer() );
        ctx.rename( DN, NEW_DN2 );

        SearchControls controls = new SearchControls();
        controls.setSearchScope( SearchControls.OBJECT_SCOPE );

        NamingEnumeration<SearchResult> results = ctx.search( NEW_DN2, "(objectClass=*)", controls );
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, newdn );

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

    @Test
    @Ignore
    public void testSchemaRenameDisabledSchema() throws Exception
    {
        LdapContext schemaRoot = getSchemaContext( service );
        schemaRoot.rename( "cn=samba", "cn=foo" );
        assertNotNull( schemaRoot.lookup( "cn=foo" ) );

        // check that there is a samba schema installed and that is is disabled
        Attributes attributes = schemaRoot.getAttributes( "cn=foo" );
        assertNotNull( attributes );
View Full Code Here

    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 ( LdapOperationNotSupportedException e )
        {
            assertEquals( ResultCodeEnum.UNWILLING_TO_PERFORM, e.getResultCode() );
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

            attr.add( "top"  );
            attr.add( "OrganizationalUnit" );
            attrs.put( attr );

            sysRoot.createSubcontext( "ou=users,ou=groups", attrs );
            sysRoot.rename( "ou=users", "ou=users,ou=groups" );
            fail( "Execution should never get here due to exception!" );
        }
        catch ( LdapNameAlreadyBoundException e )
        {
            assertEquals( "ou=users,ou=groups,ou=system", e.getResolvedName().toString() );
View Full Code Here

            attr.add( "OrganizationalUnit" );
            attrs.put( attr );

            sysRoot.createSubcontext( "ou=uzerz,ou=groups", attrs );
            sysRoot.addToEnvironment( "java.naming.ldap.deleteRDN", "false" );
            sysRoot.rename( "ou=users", "ou=uzerz,ou=groups" );
            sysRoot.removeFromEnvironment( "java.naming.ldap.deleteRDN" );
            fail( "Execution should never get here due to exception!" );
        }
        catch ( LdapNameAlreadyBoundException e )
        {
View Full Code Here

    {
        LdapContext sysRoot = getSystemContext( service );

        try
        {
            sysRoot.rename( "ou=blah", "ou=blah,ou=groups" );
            fail( "Execution should never get here due to exception!" );
        }
        catch ( LdapNameNotFoundException e )
        {
            assertEquals( "ou=system", e.getResolvedName().toString() );
View Full Code Here

        }

        try
        {
            sysRoot.addToEnvironment( "java.naming.ldap.deleteRDN", "false" );
            sysRoot.rename( "ou=blah", "ou=blah2,ou=groups" );
            sysRoot.removeFromEnvironment( "java.naming.ldap.deleteRDN" );
            fail( "Execution should never get here due to exception!" );
        }
        catch ( LdapNameNotFoundException e )
        {
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.