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

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


    @Test
    public void testFreshStore() throws Exception
    {
        LdapDN dn = new LdapDN( "o=Good Times Co." );
        dn.normalize( attributeRegistry.getNormalizerMapping() );
        assertEquals( 1L, ( long ) store.getEntryId( dn.toNormName() ) );
        assertEquals( 11, store.count() );
        assertEquals( "o=Good Times Co.", store.getEntryUpdn( dn.toNormName() ) );
        assertEquals( dn.toNormName(), store.getEntryDn( 1L ) );
        assertEquals( dn.getUpName(), store.getEntryUpdn( 1L ) );
View Full Code Here


        assertEquals( 2, store.getChildCount( 1L ) );
        assertEquals( 10, store.count() );
       
        // add an alias and delete to test dropAliasIndices method
        LdapDN dn = new LdapDN( "commonName=Jack Daniels,ou=Apache,ou=Board of Directors,o=Good Times Co." );
        dn.normalize( attributeRegistry.getNormalizerMapping() );
        DefaultServerEntry entry = new DefaultServerEntry( registries, dn );
        entry.add( "objectClass", "top", "alias", "extensibleObject" );
        entry.add( "ou", "Apache" );
        entry.add( "commonName""Jack Daniels");
        entry.add( "aliasedObjectName", "cn=Jack Daniels,ou=Engineering,o=Good Times Co." );
View Full Code Here

     
      assertFalse( cursor.next() );
     
      // dn id 12
      LdapDN martinDn = new LdapDN( "cn=Marting King,ou=Sales,o=Good Times Co." );
      martinDn.normalize( attributeRegistry.getNormalizerMapping() );
      DefaultServerEntry entry = new DefaultServerEntry( registries, martinDn );
      entry.add( "objectClass", "top", "person", "organizationalPerson" );
      entry.add( "ou", "Sales" );
      entry.add( "cn""Martin King");
      entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
View Full Code Here

      cursor.afterLast();
      assertTrue( cursor.previous() );
      assertEquals( 12, ( long ) cursor.get().getId() );
     
      LdapDN newParentDn = new LdapDN( "ou=Board of Directors,o=Good Times Co." );
      newParentDn.normalize( attributeRegistry.getNormalizerMapping() );
     
      store.move( martinDn, newParentDn );
      cursor = idx.forwardCursor( 3L);
      cursor.afterLast();
      assertTrue( cursor.previous() );
View Full Code Here

      assertTrue( cursor.previous() );
      assertEquals( 12, ( long ) cursor.get().getId() );
     
      // dn id 13
      LdapDN marketingDn = new LdapDN( "ou=Marketing,ou=Sales,o=Good Times Co." );
      marketingDn.normalize( attributeRegistry.getNormalizerMapping() );
      entry = new DefaultServerEntry( registries, marketingDn );
      entry.add( "objectClass", "top", "organizationalUnit" );
      entry.add( "ou", "Marketing" );
      entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
      entry.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
View Full Code Here

      entry.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
      store.add( entry );

      // dn id 14
      LdapDN jimmyDn = new LdapDN( "cn=Jimmy Wales,ou=Marketing, ou=Sales,o=Good Times Co." );
      jimmyDn.normalize( attributeRegistry.getNormalizerMapping() );
      entry = new DefaultServerEntry( registries, jimmyDn );
      entry.add( "objectClass", "top", "person", "organizationalPerson" );
      entry.add( "ou", "Marketing" );
      entry.add( "cn""Jimmy Wales");
      entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
View Full Code Here

   
    @Test( expected = LdapNameNotFoundException.class )
    public void testAddWithoutParentId() throws Exception
    {
        LdapDN dn = new LdapDN( "cn=Marting King,ou=Not Present,o=Good Times Co." );
        dn.normalize( attributeRegistry.getNormalizerMapping() );
        DefaultServerEntry entry = new DefaultServerEntry( registries, dn );
        entry.add( "objectClass", "top", "person", "organizationalPerson" );
        entry.add( "ou", "Not Present" );
        entry.add( "cn""Martin King");
        store.add( entry );
View Full Code Here

   
    @Test( expected = LdapSchemaViolationException.class )
    public void testAddWithoutObjectClass() throws Exception
    {
        LdapDN dn = new LdapDN( "cn=Martin King,ou=Sales,o=Good Times Co." );
        dn.normalize( attributeRegistry.getNormalizerMapping() );
        DefaultServerEntry entry = new DefaultServerEntry( registries, dn );
        entry.add( "ou", "Sales" );
        entry.add( "cn""Martin King");
        store.add( entry );
    }
View Full Code Here

   
    @Test
    public void testModifyAddOUAttrib() throws Exception
    {
        LdapDN dn = new LdapDN( "cn=JOhnny WAlkeR,ou=Sales,o=Good Times Co." );
        dn.normalize( attributeRegistry.getNormalizerMapping() );

        List<Modification> mods = new ArrayList<Modification>();
        ServerAttribute attrib = new DefaultServerAttribute( SchemaConstants.OU_AT,
            attributeRegistry.lookup( SchemaConstants.OU_AT_OID ) );
        attrib.add( "Engineering" );
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

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.