Package org.apache.directory.shared.ldap.name

Examples of org.apache.directory.shared.ldap.name.LdapDN.toNormName()


        assertEquals( "o=Good Times Co.", store.getEntryUpdn( dn.toNormName() ) );
        assertEquals( dn.toNormName(), store.getEntryDn( 1L ) );
        assertEquals( dn.getUpName(), store.getEntryUpdn( 1L ) );

        // note that the suffix entry returns 0 for it's parent which does not exist
        assertEquals( 0L, ( long ) store.getParentId( dn.toNormName() ) );
        assertNull( store.getParentId( 0L ) );

        // should NOW be allowed
        store.delete( 1L );
    }
View Full Code Here


    public void add( LdapDN name, ServerEntry entry ) throws Exception
    {
        LdapDN parentDn = ( LdapDN ) name.clone();
        parentDn.remove( parentDn.size() - 1 );
        parentDn.normalize( globalRegistries.getAttributeTypeRegistry().getNormalizerMapping() );
        if ( !parentDn.toNormName().equals( OU_OID + "=schema" ) )
        {
            throw new LdapInvalidNameException( "The parent dn of a schema should be " + OU_OID + "=schema and not: "
                + parentDn.toNormName(), ResultCodeEnum.NAMING_VIOLATION );
        }
View Full Code Here

        parentDn.remove( parentDn.size() - 1 );
        parentDn.normalize( globalRegistries.getAttributeTypeRegistry().getNormalizerMapping() );
        if ( !parentDn.toNormName().equals( OU_OID + "=schema" ) )
        {
            throw new LdapInvalidNameException( "The parent dn of a schema should be " + OU_OID + "=schema and not: "
                + parentDn.toNormName(), ResultCodeEnum.NAMING_VIOLATION );
        }

        // check if the new schema is enabled or disabled
        boolean isEnabled = false;
        EntryAttribute disabled = entry.get( disabledAT );
View Full Code Here

        attrib.add( attribVal );
       
        Modification add = new ServerModification( ModificationOperation.ADD_ATTRIBUTE, attrib );
        mods.add( add );
       
        ServerEntry lookedup = store.lookup( store.getEntryId( dn.toNormName() ) );

        store.modify( dn, mods );
        assertTrue( lookedup.get( "sn" ).contains( attribVal ) );
       
        // testing the store.modify( dn, mod, entry ) API
View Full Code Here

        ServerEntry entry = new DefaultServerEntry( registries, dn );
        attribVal = "+1974045779";
        entry.add( "telephoneNumber", attribVal );
       
        store.modify( dn, ModificationOperation.ADD_ATTRIBUTE, entry );
        lookedup = store.lookup( store.getEntryId( dn.toNormName() ) );
        assertTrue( lookedup.get( "telephoneNumber" ).contains( attribVal ) );
    }
   
   
    @Test
View Full Code Here

        attrib.add( attribVal );
       
        Modification add = new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, attrib );
        mods.add( add );
       
        ServerEntry lookedup = store.lookup( store.getEntryId( dn.toNormName() ) );
       
        assertEquals( "WAlkeR", lookedup.get( "sn" ).get().getString() ); // before replacing
       
        store.modify( dn, mods );
        assertEquals( attribVal, lookedup.get( "sn" ).get().getString() );
View Full Code Here

            attributeRegistry.lookup( SchemaConstants.SN_AT_OID ) );
       
        Modification add = new ServerModification( ModificationOperation.REMOVE_ATTRIBUTE, attrib );
        mods.add( add );
       
        ServerEntry lookedup = store.lookup( store.getEntryId( dn.toNormName() ) );
       
        assertNotNull( lookedup.get( "sn" ).get() );
       
        store.modify( dn, mods );
        assertNull( lookedup.get( "sn" ) );
View Full Code Here

        attrib.add( attribVal );
       
        Modification add = new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, attrib );
        mods.add( add );
       
        ServerEntry lookedup = store.lookup( store.getEntryId( dn.toNormName() ) );
       
        assertNull( lookedup.get( "ou" ) ); // before replacing
       
        store.modify( dn, mods );
        assertEquals( attribVal, lookedup.get( "ou" ).get().getString() );
View Full Code Here

        {
            EntryFilteringCursor cursor =  nextInterceptor.search( opContext );
           
            if ( ! cursor.next() )
            {
                if ( !base.isEmpty() && !( subschemSubentryDn.toNormName() ).equalsIgnoreCase( base.toNormName() ) )
                {
                    // We just check that the entry exists only if we didn't found any entry
                    assertHasEntry( nextInterceptor, opContext, "Attempt to search under non-existant entry:" , base );
                }
            }
View Full Code Here

        Value<?> subschemaSubentry =
            directoryService.getPartitionNexus().getRootDSE( null ).
                get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
        LdapDN subschemaSubentryDnName = new LdapDN( subschemaSubentry.getString() );
        subschemaSubentryDnName.normalize( atRegistry.getNormalizerMapping() );
        subschemaSubentryDn = subschemaSubentryDnName.toNormName();
    }


    private void protectCriticalEntries( LdapDN dn ) throws Exception
    {
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.