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

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


    @Test
    public void testSerializeEntryWithNoAttribute() throws LdapException, IOException, ClassNotFoundException
    {
        Dn dn = new Dn( "ou=system" );
       
        dn.normalize( oids );
       
        Entry entry = new DefaultEntry( dn );

        Entry entrySer = deserializeValue( serializeValue( entry ) );
       
View Full Code Here


    @Test
    public void testSerializeCompleteEntry() throws LdapException, IOException, ClassNotFoundException
    {
        Dn dn = new Dn( "ou=system" );
       
        dn.normalize( oids );
       
        byte[] password = Strings.getBytesUtf8("secret");
        Entry entry = new DefaultEntry( dn);
        entry.add( "ObjectClass", "top", "person" );
        entry.add( "cn", "test1" );
View Full Code Here

        if ( obj instanceof Dn)
        {
            dn = (Dn) obj;

            dn = ( dn.isNormalized() ? dn : dn.normalize( schemaManager ) );
        }
        else if ( obj instanceof String )
        {
            dn = new Dn( schemaManager, ( String ) obj );
        }
View Full Code Here

       
        if ( obj instanceof Dn)
        {
            dn = (Dn)obj;
           
            dn = ( dn.isNormalized() ? dn : dn.normalize( schemaManager ) );
        }
        else if ( obj instanceof String )
        {
            dn = new Dn( schemaManager, ( String ) obj );
        }
View Full Code Here

        assertFalse( two.getParent().isNormalized() );
        assertFalse( two.getParent().isEmpty() );
        assertEquals( "o=acme", two.getParent().getName() );

        Dn three = new Dn( "cn=test,dc=example,dc=com" );
        three.normalize( schemaManager );
        Dn threeParent = three.getParent();
        assertNotNull( threeParent );
        assertTrue( threeParent.isNormalized() );
        assertFalse( threeParent.isEmpty() );
        assertEquals( "dc=example,dc=com", threeParent.getName() );
View Full Code Here

            assertEquals( "T+ST ", ava.getNormValue().get() );
        }

        // ------------------------------------------------------------------
        // Now normalize the Dn
        dn.normalize( schemaManager );

        assertEquals( "  OU  =  Ex\\+mple + ou = T\\+ST\\  ,  ou  =  COM ", dn.getName() );
        assertEquals( "2.5.4.11=ex\\+mple+2.5.4.11=t\\+st,2.5.4.11=com", dn.getNormName() );

        // Check the first Rdn
View Full Code Here

        assertFalse( dn.isNormalized() );

        dn = dn.add( "ou=users" );
        assertFalse( dn.isNormalized() );

        dn.normalize( schemaManager );
        assertTrue( dn.isNormalized() );

        dn = dn.add( "ou=x" );
        assertTrue( dn.isNormalized() );
View Full Code Here

        assertTrue( dn.isNormalized() );

        assertEquals( "2.5.4.11=x,2.5.4.11=users,2.5.4.11=system", dn.getNormName() );
        assertEquals( "ou=x,ou=users,ou=system", dn.getName() );

        dn.normalize( schemaManager );
        assertEquals( "2.5.4.11=x,2.5.4.11=users,2.5.4.11=system", dn.getNormName() );
        assertEquals( "ou=x,ou=users,ou=system", dn.getName() );

        Rdn rdn = new Rdn( "ou=system" );
        dn = new Dn();
View Full Code Here

        assertTrue( dn.isNormalized() );

        dn = dn.add( rdn );
        assertFalse( dn.isNormalized() );

        dn.normalize( schemaManager );
        assertTrue( dn.isNormalized() );

        Dn anotherDn = new Dn( "ou=x,ou=users" );

        dn = dn.addAll( anotherDn );
View Full Code Here

    public void testParseDnWithSlash() throws Exception
    {
        String dnStr = "dc=/vehicles/v1/";

        Dn dn = new Dn( dnStr );
        dn.normalize( schemaManager );

        assertEquals( dnStr, dn.toString() );
    }
   
   
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.