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

Examples of org.apache.directory.api.ldap.model.name.Ava


     * test that a RDN with an attributeType used twice throws an exception
     */
    @Test(expected = LdapInvalidDnException.class)
    public void testAvaConstructorWrongRdnAtUsedTwice() throws LdapException
    {
        new Rdn( new Ava( "A", "b" ), new Ava( "A", "d" ) );
    }
View Full Code Here


   
   
    @Test
    public void testCompareToSameAva() throws LdapInvalidDnException
    {
        Ava atav1 = new Ava( schemaManager, "cn", "b" );
        Ava atav2 = new Ava( schemaManager, "cn", "b" );
        Ava atav3 = new Ava( schemaManager, "commonName", "b" );
        Ava atav4 = new Ava( schemaManager, "2.5.4.3", "  B  " );

        // 1 with others
        assertEquals( 0, atav1.compareTo( atav1 ) );
        assertEquals( 0, atav1.compareTo( atav2 ) );
        assertEquals( 0, atav1.compareTo( atav3 ) );
        assertEquals( 0, atav1.compareTo( atav4 ) );
       
        // 2 with others
        assertEquals( 0, atav2.compareTo( atav1 ) );
        assertEquals( 0, atav2.compareTo( atav2 ) );
        assertEquals( 0, atav2.compareTo( atav3 ) );
        assertEquals( 0, atav2.compareTo( atav4 ) );
       
        // 3 with others
        assertEquals( 0, atav3.compareTo( atav1 ) );
        assertEquals( 0, atav3.compareTo( atav2 ) );
        assertEquals( 0, atav3.compareTo( atav3 ) );
        assertEquals( 0, atav3.compareTo( atav4 ) );
       
        // 4 with others
        assertEquals( 0, atav4.compareTo( atav1 ) );
        assertEquals( 0, atav4.compareTo( atav2 ) );
        assertEquals( 0, atav4.compareTo( atav3 ) );
        assertEquals( 0, atav4.compareTo( atav4 ) );
    }
View Full Code Here

   
   
    @Test
    public void testCompareAvaOrder() throws LdapInvalidDnException
    {
        Ava atav1 = new Ava( schemaManager, "cn", "  B  " );
        Ava atav2 = new Ava( schemaManager, "sn", "  c" );
       
        // atav1 should be before atav2
        assertEquals( -1, atav1.compareTo( atav2 ) );
        assertEquals( 1, atav2.compareTo( atav1 ) );

        Ava atav3 = new Ava( schemaManager, "2.5.4.3", "A " );
       
        // Atav1 shoud be after atav3
        assertEquals( 1, atav1.compareTo( atav3 ) );
        assertEquals( -1, atav3.compareTo( atav1 ) );
    }
View Full Code Here

   
   
    @Test
    public void testSortAva() throws LdapInvalidDnException
    {
        Ava atav1 = new Ava( schemaManager, "cn", "  B  " );
        Ava atav2 = new Ava( schemaManager, "sn", "  c" );
        Ava atav3 = new Ava( schemaManager, "2.5.4.3", "A " );
        Ava atav4 = new Ava( schemaManager, "2.5.4.11", " C  " );
        Ava atav5 = new Ava( schemaManager, "ou", "B " );
        Ava atav6 = new Ava( schemaManager, "ou", "D " );
        Ava atav7 = new Ava( schemaManager, "CN", " " );

        Ava[] avas = new Ava[] { atav1, atav2, atav3, atav4, atav5, atav6, atav7 };
       
        Arrays.sort( avas );
       
View Full Code Here

     * Test a null AttributeTypeAndValue
     */
    @Test
    public void testAttributeTypeAndValueNull()
    {
        Ava atav = new Ava( schemaManager );
        assertEquals( "", atav.toString() );
        assertEquals( "", atav.getName() );
    }
View Full Code Here

    @Test
    public void testAttributeTypeAndValueNullType() throws LdapException
    {
        try
        {
            new Ava( schemaManager, null, ( String ) null );
            fail();
        }
        catch ( LdapException ine )
        {
            assertTrue( true );
View Full Code Here

    @Test
    public void testAttributeTypeAndValueInvalidType() throws LdapException
    {
        try
        {
            new Ava( schemaManager, "  ", ( String ) null );
            fail();
        }
        catch ( LdapException ine )
        {
            assertTrue( true );
View Full Code Here

     * Test a valid type for an AttributeTypeAndValue
     */
    @Test
    public void testAttributeTypeAndValueValidType() throws LdapException
    {
        Ava ava = new Ava( schemaManager, "CN", " " );
        assertEquals( "CN=\\ ", ava.toString() );
        assertEquals( "2.5.4.3=\\ ", ava.getNormName() );
        assertEquals( "CN=\\ ", ava.getName() );

        ava = new Ava( schemaManager, "  CN  ", " " );
        assertEquals( "  CN  =\\ ", ava.toString() );
        assertEquals( "2.5.4.3=\\ ", ava.getNormName() );
        assertEquals( "  CN  =\\ ", ava.getName() );

        ava = new Ava( schemaManager, "cn", " " );
        assertEquals( "cn=\\ ", ava.toString() );
        assertEquals( "2.5.4.3=\\ ", ava.getNormName() );
        assertEquals( "cn=\\ ", ava.getName() );

        ava = new Ava( schemaManager, "  cn  ", " " );
        assertEquals( "  cn  =\\ ", ava.toString() );
        assertEquals( "2.5.4.3=\\ ", ava.getNormName() );
        assertEquals( "  cn  =\\ ", ava.getName() );
    }
View Full Code Here

    @Test
    public void testAvaEmpty()
    {
        try
        {
            new Ava( schemaManager, "", "" );
            fail( "Should not occurs ... " );
        }
        catch ( LdapException ine )
        {
            assertTrue( true );
View Full Code Here

     * test a simple AttributeTypeAndValue : a = b
     */
    @Test
    public void testAvaSimple() throws LdapException
    {
        Ava atav = new Ava( schemaManager, "cn", "b" );
        assertEquals( "cn=b", atav.toString() );
        assertEquals( "2.5.4.3=b", atav.getNormName() );
        assertEquals( "cn=b", atav.getName() );
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.api.ldap.model.name.Ava

Copyright © 2018 www.massapicom. 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.