You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2005/12/25 23:09:54 UTC
svn commit: r359007 -
/directory/shared/ldap/branches/DN-refactoring/common/src/test/org/apache/ldap/common/name/LdapDNTest.java
Author: elecharny
Date: Sun Dec 25 14:09:51 2005
New Revision: 359007
URL: http://svn.apache.org/viewcvs?rev=359007&view=rev
Log:
Fixed some tests, added some more
Modified:
directory/shared/ldap/branches/DN-refactoring/common/src/test/org/apache/ldap/common/name/LdapDNTest.java
Modified: directory/shared/ldap/branches/DN-refactoring/common/src/test/org/apache/ldap/common/name/LdapDNTest.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/DN-refactoring/common/src/test/org/apache/ldap/common/name/LdapDNTest.java?rev=359007&r1=359006&r2=359007&view=diff
==============================================================================
--- directory/shared/ldap/branches/DN-refactoring/common/src/test/org/apache/ldap/common/name/LdapDNTest.java (original)
+++ directory/shared/ldap/branches/DN-refactoring/common/src/test/org/apache/ldap/common/name/LdapDNTest.java Sun Dec 25 14:09:51 2005
@@ -360,7 +360,7 @@
// Warning ! The order of AVAs has changed during the parsing
// This has no impact on the correctness of the DN, but the
// String used to do the comparizon should be inverted.
- Assert.assertEquals( "g=h+e=f,a=b,c=d" , dn.toString() );
+ Assert.assertEquals( "e=f+g=h,a=b,c=d" , dn.toString() );
Assert.assertEquals( 3, dn.size() );
}
@@ -1056,7 +1056,7 @@
Name name1 = new LdapDN( "cn= HomeDir+cn=Workdir" );
Name name2 = new LdapDN( "cn = Work+cn=HomeDir" );
- assertEquals( -1, name1.compareTo( name2 ) );
+ assertEquals( 1, name1.compareTo( name2 ) );
}
/**
@@ -1348,7 +1348,7 @@
for ( int i = 0 ; enum1.hasMoreElements(); i++ )
{
- LdapRDN element = ( LdapRDN ) enum1.nextElement() ;
+ Rdn element = ( Rdn ) enum1.nextElement() ;
if ( i == 0 )
{
@@ -1361,7 +1361,7 @@
for ( int i = 0 ; enum2.hasMoreElements(); i++ )
{
- LdapRDN element = ( LdapRDN ) enum2.nextElement() ;
+ Rdn element = ( Rdn ) enum2.nextElement() ;
if ( i == 0 )
{
@@ -1379,7 +1379,7 @@
for ( int i = 0 ; enum3.hasMoreElements(); i++ )
{
- LdapRDN element = ( LdapRDN ) enum3.nextElement() ;
+ Rdn element = ( Rdn ) enum3.nextElement() ;
if ( i == 0 )
{
@@ -1402,7 +1402,7 @@
for ( int i = 0 ; enum4.hasMoreElements(); i++ )
{
- LdapRDN element = ( LdapRDN ) enum4.nextElement() ;
+ Rdn element = ( Rdn ) enum4.nextElement() ;
if ( i == 0 )
{
@@ -1430,7 +1430,7 @@
for ( int i = 0 ; enum5.hasMoreElements(); i++ )
{
- LdapRDN element = ( LdapRDN ) enum5.nextElement() ;
+ Rdn element = ( Rdn ) enum5.nextElement() ;
if ( i == 0 )
{
@@ -1463,7 +1463,7 @@
for ( int i = 0 ; enum6.hasMoreElements(); i++ )
{
- LdapRDN element = ( LdapRDN ) enum6.nextElement() ;
+ Rdn element = ( Rdn ) enum6.nextElement() ;
if ( i == 0 )
{
@@ -1990,7 +1990,7 @@
}
/**
- * Class to test for toOid( Name, Map)
+ * Class to test for toOid( Name, Map) with a NULL dn
*/
public void testLdapNameToOidEmpty() throws Exception
{
@@ -2003,5 +2003,24 @@
Name result = LdapDN.toOidName( name, oids );
assertTrue( result.toString().equals( "" ) ) ;
+ }
+
+ /**
+ * Class to test for toOid( Name, Map) with a multiple NameComponent
+ */
+ public void testLdapNameToOidMultiNC() throws Exception
+ {
+ Name name = new LdapDN( "ou= Some People + dc= And Some anImAls,dc = eXample,dc= cOm" ) ;
+
+ Map oids = new HashMap();
+
+ oids.put( "dc", new OidNormalizer( "0.9.2342.19200300.100.1.25", new DeepTrimToLowerNormalizer() ) );
+ oids.put( "ou", new OidNormalizer( "2.5.4.11", new DeepTrimToLowerNormalizer() ) );
+
+ Name result = LdapDN.toOidName( name, oids );
+
+ 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( ( (LdapDN)result).toUpName().equals( "ou= Some People + dc= And Some anImAls,dc = eXample,dc= cOm" ) );
}
}