directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r534498 - in /directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name: AttributeTypeAndValueTest.java LdapDNTest.java RdnTest.java
Date Wed, 02 May 2007 14:55:20 GMT
Author: elecharny
Date: Wed May  2 07:55:19 2007
New Revision: 534498

URL: http://svn.apache.org/viewvc?view=rev&rev=534498
Log:
Test for RDN UP value to be returned.

Modified:
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValueTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValueTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValueTest.java?view=diff&rev=534498&r1=534497&r2=534498
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValueTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValueTest.java
Wed May  2 07:55:19 2007
@@ -57,7 +57,7 @@
    {
        try
        {
-           new AttributeTypeAndValue( "", "" );
+           new AttributeTypeAndValue( "", "", "", "" );
            Assert.fail( "Should not occurs ... " );
        }
        catch ( InvalidNameException ine )
@@ -72,7 +72,7 @@
     */
    public void testLdapRDNSimple() throws InvalidNameException
    {
-       AttributeTypeAndValue atav = new AttributeTypeAndValue( "a", "b" );
+       AttributeTypeAndValue atav = new AttributeTypeAndValue( "a", "a", "b", "b" );
        assertEquals( "a=b", atav.toString() );
        assertEquals( "a=b", atav.getUpName());
        assertEquals( 0, atav.getStart());
@@ -85,8 +85,8 @@
     */
    public void testCompareToEquals() throws InvalidNameException
    {
-       AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "a", "b" );
-       AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "a", "b" );
+       AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "a", "a", "b", "b" );
+       AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "a", "a", "b", "b" );
 
        assertEquals( 0, atav1.compareTo( atav2 ) );
    }
@@ -97,8 +97,8 @@
     */
    public void testCompareToEqualsCase() throws InvalidNameException
    {
-       AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "a", "b" );
-       AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "A", "b" );
+       AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "a", "a", "b", "b" );
+       AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "A", "A", "b", "b" );
 
        assertEquals( 0, atav1.compareTo( atav2 ) );
    }
@@ -110,8 +110,8 @@
     */
    public void testCompareAtav1TypeSuperior() throws InvalidNameException
    {
-       AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "b", "b" );
-       AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "a", "b" );
+       AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "b", "b", "b", "b" );
+       AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "a", "a", "b", "b" );
 
        assertEquals( 1, atav1.compareTo( atav2 ) );
    }
@@ -123,8 +123,8 @@
     */
    public void testCompareAtav2TypeSuperior() throws InvalidNameException
    {
-       AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "a", "b" );
-       AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "b", "b" );
+       AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "a", "a", "b", "b" );
+       AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "b", "b", "b", "b" );
 
        assertEquals( -1, atav1.compareTo( atav2 ) );
    }
@@ -136,8 +136,8 @@
     */
    public void testCompareAtav1ValueSuperior() throws InvalidNameException
    {
-       AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "a", "b" );
-       AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "a", "a" );
+       AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "a", "a", "b", "b" );
+       AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "a", "a", "a", "a" );
 
        assertEquals( 1, atav1.compareTo( atav2 ) );
    }
@@ -149,8 +149,8 @@
     */
    public void testCompareAtav2ValueSuperior() throws InvalidNameException
    {
-       AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "a", "a" );
-       AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "a", "b" );
+       AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "a", "a", "a", "a" );
+       AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "a", "a", "b", "b" );
 
        assertEquals( -1, atav1.compareTo( atav2 ) );
    }
@@ -158,7 +158,7 @@
 
    public void testNormalize() throws InvalidNameException
    {
-       AttributeTypeAndValue atav = new AttributeTypeAndValue( " A ", "a" );
+       AttributeTypeAndValue atav = new AttributeTypeAndValue( " A "," A ", "a", "a" );
 
        assertEquals( "a=a", atav.normalize() );
 

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java?view=diff&rev=534498&r1=534497&r2=534498
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
Wed May  2 07:55:19 2007
@@ -2218,6 +2218,48 @@
        assertTrue( result.toString().equals( "ou=some people,dc=example,dc=com" ) );
    }
 
+   public void testRdnGetTypeUpName() throws Exception
+   {
+       List<String> list = new ArrayList<String>();
+       list.add( "ou= Some   People   " );
+       list.add( "dc = eXample" );
+       list.add( "dc= cOm" );
+       LdapDN name = new LdapDN( list.iterator() );
+
+       Map<String, OidNormalizer> oids = new HashMap<String, OidNormalizer>();
+
+       oids.put( "dc", new OidNormalizer( "0.9.2342.19200300.100.1.25", new DeepTrimToLowerNormalizer()
) );
+       oids.put( "domaincomponent", new OidNormalizer( "0.9.2342.19200300.100.1.25", new
DeepTrimToLowerNormalizer() ) );
+       oids.put( "0.9.2342.19200300.100.1.25", new OidNormalizer( "0.9.2342.19200300.100.1.25",
new DeepTrimToLowerNormalizer() ) );
+       oids.put( "ou", new OidNormalizer( "2.5.4.11", new DeepTrimToLowerNormalizer() ) );
+       oids.put( "organizationalUnitName", new OidNormalizer( "2.5.4.11", new DeepTrimToLowerNormalizer()
) );
+       oids.put( "2.5.4.11", new OidNormalizer( "2.5.4.11", new DeepTrimToLowerNormalizer()
) );
+
+       assertTrue( name.getUpName().equals( "ou= Some   People   ,dc = eXample,dc= cOm" )
);
+
+       Rdn rdn = name.getRdn();
+       
+       assertEquals( "ou= Some   People   ", rdn.getUpName() );
+       //assertEquals( "2.5.4.11=some people", rdn.getNormName() );
+       assertEquals( "ou", rdn.getNormType() );
+       assertEquals( "ou", rdn.getUpType() );
+       //assertEquals( "some people", rdn.getNormValue() );
+       //assertEquals( "ou= Some   People   ", rdn.getUpValue() );
+
+       LdapDN result = LdapDN.normalize( name, oids );
+
+       assertTrue( result.getNormName().equals( "2.5.4.11=some people,0.9.2342.19200300.100.1.25=example,0.9.2342.19200300.100.1.25=com"
) );
+       assertTrue( name.getUpName().equals( "ou= Some   People   ,dc = eXample,dc= cOm" )
);
+       
+       Rdn rdn2 = result.getRdn();
+       
+       assertEquals( "ou= Some   People   ", rdn2.getUpName() );
+       //assertEquals( "2.5.4.11=some people", rdn2.getNormName() );
+       assertEquals( "2.5.4.11", rdn2.getNormType() );
+       assertEquals( "ou", rdn2.getUpType() );
+       //assertEquals( "some people", rdn2.getNormValue() );
+       //assertEquals( "ou= Some   People   ", rdn2.getUpValue() );
+   }
 
    /**
     * Class to test for toOid( Name, Map) with a NULL dn
@@ -2250,16 +2292,16 @@
 
        Map<String, OidNormalizer> oids = new HashMap<String, OidNormalizer>();
 
-       oids.put( "dc", new OidNormalizer( "dc", new DeepTrimToLowerNormalizer() ) );
-       oids.put( "domaincomponent", new OidNormalizer( "dc", new DeepTrimToLowerNormalizer()
) );
-       oids.put( "0.9.2342.19200300.100.1.25", new OidNormalizer( "dc", new DeepTrimToLowerNormalizer()
) );
-       oids.put( "ou", new OidNormalizer( "ou", new DeepTrimToLowerNormalizer() ) );
-       oids.put( "organizationalUnitName", new OidNormalizer( "ou", new DeepTrimToLowerNormalizer()
) );
-       oids.put( "2.5.4.11", new OidNormalizer( "ou", new DeepTrimToLowerNormalizer() ) );
+       oids.put( "dc", new OidNormalizer( "0.9.2342.19200300.100.1.25", new DeepTrimToLowerNormalizer()
) );
+       oids.put( "domaincomponent", new OidNormalizer( "0.9.2342.19200300.100.1.25", new
DeepTrimToLowerNormalizer() ) );
+       oids.put( "0.9.2342.19200300.100.1.25", new OidNormalizer( "0.9.2342.19200300.100.1.25",
new DeepTrimToLowerNormalizer() ) );
+       oids.put( "ou", new OidNormalizer( "2.5.4.11", new DeepTrimToLowerNormalizer() ) );
+       oids.put( "organizationalUnitName", new OidNormalizer( "2.5.4.11", new DeepTrimToLowerNormalizer()
) );
+       oids.put( "2.5.4.11", new OidNormalizer( "2.5.4.11", new DeepTrimToLowerNormalizer()
) );
 
        Name result = LdapDN.normalize( name, oids );
 
-       assertTrue( result.toString().equals( "dc=and some animals+ou=some people,dc=example,dc=com"
) );
+       assertEquals( result.toString(), "0.9.2342.19200300.100.1.25=and some animals+2.5.4.11=some
people,0.9.2342.19200300.100.1.25=example,0.9.2342.19200300.100.1.25=com" );
        assertTrue( ( ( LdapDN ) result )
            .getUpName()
            .equals(
@@ -2277,16 +2319,16 @@
 
        Map<String, OidNormalizer> oids = new HashMap<String, OidNormalizer>();
 
-       oids.put( "dc", new OidNormalizer( "dc", new DeepTrimToLowerNormalizer() ) );
-       oids.put( "domaincomponent", new OidNormalizer( "dc", new DeepTrimToLowerNormalizer()
) );
-       oids.put( "0.9.2342.19200300.100.1.25", new OidNormalizer( "dc", new DeepTrimToLowerNormalizer()
) );
-       oids.put( "ou", new OidNormalizer( "ou", new DeepTrimToLowerNormalizer() ) );
-       oids.put( "organizationalUnitName", new OidNormalizer( "ou", new DeepTrimToLowerNormalizer()
) );
-       oids.put( "2.5.4.11", new OidNormalizer( "ou", new DeepTrimToLowerNormalizer() ) );
+       oids.put( "dc", new OidNormalizer( "0.9.2342.19200300.100.1.25", new DeepTrimToLowerNormalizer()
) );
+       oids.put( "domaincomponent", new OidNormalizer( "0.9.2342.19200300.100.1.25", new
DeepTrimToLowerNormalizer() ) );
+       oids.put( "0.9.2342.19200300.100.1.25", new OidNormalizer( "0.9.2342.19200300.100.1.25",
new DeepTrimToLowerNormalizer() ) );
+       oids.put( "ou", new OidNormalizer( "2.5.4.11", new DeepTrimToLowerNormalizer() ) );
+       oids.put( "organizationalUnitName", new OidNormalizer( "2.5.4.11", new DeepTrimToLowerNormalizer()
) );
+       oids.put( "2.5.4.11", new OidNormalizer( "2.5.4.11", new DeepTrimToLowerNormalizer()
) );
 
        LdapDN result = LdapDN.normalize( name, oids );
 
-       assertTrue( result.toString().equals( "dc=and some animals+ou=some people,dc=example,dc=com"
) );
+       assertTrue( result.toString().equals( "0.9.2342.19200300.100.1.25=and some animals+2.5.4.11=some
people,0.9.2342.19200300.100.1.25=example,0.9.2342.19200300.100.1.25=com" ) );
        assertTrue( result
            .getUpName()
            .equals(

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java?view=diff&rev=534498&r1=534497&r2=534498
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java
Wed May  2 07:55:19 2007
@@ -204,7 +204,7 @@
     */
    public void testRDNCloningOneNameComponent() throws InvalidNameException
    {
-       Rdn rdn = new Rdn( "a", "b" );
+       Rdn rdn = new Rdn( "a", "a", "b", "b" );
 
        Rdn rdnClone = ( Rdn ) rdn.clone();
 



Mime
View raw message