directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r894847 - in /directory/shared/branches/shared-schema/ldap/src: main/java/org/apache/directory/shared/ldap/codec/LdapMessageCodec.java test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
Date Thu, 31 Dec 2009 14:31:25 GMT
Author: akarasulu
Date: Thu Dec 31 14:31:25 2009
New Revision: 894847

URL: http://svn.apache.org/viewvc?rev=894847&view=rev
Log:
merging in changes from trunk to schema branch since revision 806621

Modified:
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageCodec.java
    directory/shared/branches/shared-schema/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageCodec.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageCodec.java?rev=894847&r1=894846&r2=894847&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageCodec.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageCodec.java
Thu Dec 31 14:31:25 2009
@@ -165,6 +165,25 @@
 
 
     /**
+     * Set or add a list of controls to the Controls array. If the existing
+     * control array is not null then the given controls will be added
+     * 
+     * @param controls The list of Controls to set or add
+     */
+    public void addControls( List<ControlCodec> controls )
+    {
+        if( this.controls == null )
+        {
+            this.controls = controls;
+        }
+        else if( controls != null )
+        {
+            this.controls.addAll( controls );
+        }
+    }
+    
+    
+    /**
      * Init the controls array
      */
     public void initControls()

Modified: directory/shared/branches/shared-schema/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java?rev=894847&r1=894846&r2=894847&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
Thu Dec 31 14:31:25 2009
@@ -20,12 +20,6 @@
 package org.apache.directory.shared.ldap.name;
 
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
@@ -47,13 +41,21 @@
 import javax.naming.NamingException;
 import javax.naming.ldap.LdapName;
 
-import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.name.LdapDnParser;
+import org.apache.directory.shared.ldap.name.Rdn;
 import org.apache.directory.shared.ldap.schema.normalizers.DeepTrimToLowerNormalizer;
 import org.apache.directory.shared.ldap.schema.normalizers.OidNormalizer;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.junit.Before;
 import org.junit.Test;
 
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.fail;
+import static org.junit.Assert.assertSame;
+
 
 /**
  * Test the class LdapDN
@@ -75,32 +77,25 @@
     {
         oids = new HashMap<String, OidNormalizer>();
 
-        // DC normalizer
-        OidNormalizer dcOidNormalizer = new OidNormalizer( SchemaConstants.DOMAIN_COMPONENT_AT_OID,
-            new DeepTrimToLowerNormalizer( SchemaConstants.DOMAIN_COMPONENT_AT_OID ) );
-        
-        oids.put( "dc", dcOidNormalizer );
-        oids.put( "domaincomponent", dcOidNormalizer );
-        oids.put( "0.9.2342.19200300.100.1.25", dcOidNormalizer );
-
-        // OU normalizer
-        OidNormalizer ouOidNormalizer = new OidNormalizer( SchemaConstants.OU_AT_OID,
-            new DeepTrimToLowerNormalizer( SchemaConstants.OU_AT_OID ) );
-        
-        oids.put( "ou", ouOidNormalizer );
-        oids.put( "organizationalUnitName", ouOidNormalizer );
-        oids.put( "2.5.4.11", ouOidNormalizer );
+        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() )
);
 
         // Another map where we store OIDs instead of names.
         oidOids = new HashMap<String, OidNormalizer>();
 
-        oidOids.put( "dc", dcOidNormalizer );
-        oidOids.put( "domaincomponent", dcOidNormalizer );
-        oidOids.put( "0.9.2342.19200300.100.1.25", dcOidNormalizer );
-
-        oidOids.put( "ou", ouOidNormalizer );
-        oidOids.put( "organizationalUnitName", ouOidNormalizer );
-        oidOids.put( "2.5.4.11", ouOidNormalizer );
+        oidOids.put( "dc", new OidNormalizer( "0.9.2342.19200300.100.1.25", new DeepTrimToLowerNormalizer()
) );
+        oidOids.put( "domaincomponent", new OidNormalizer( "0.9.2342.19200300.100.1.25",
+            new DeepTrimToLowerNormalizer() ) );
+        oidOids.put( "0.9.2342.19200300.100.1.25", new OidNormalizer( "0.9.2342.19200300.100.1.25",
+            new DeepTrimToLowerNormalizer() ) );
+        oidOids.put( "ou", new OidNormalizer( "2.5.4.11", new DeepTrimToLowerNormalizer()
) );
+        oidOids.put( "organizationalUnitName", new OidNormalizer( "2.5.4.11", new DeepTrimToLowerNormalizer()
) );
+        oidOids.put( "2.5.4.11", new OidNormalizer( "2.5.4.11", new DeepTrimToLowerNormalizer()
) );
     }
 
 
@@ -724,22 +719,6 @@
         assertEquals( 3, dn.size() );
     }
 
-    
-    @Test
-    public void testLdapDNAddVarargs() throws InvalidNameException
-    {
-        String c = "C";
-        String dd = "D = D";
-        
-        LdapDN dn = new LdapDN( 
-            "a = A", 
-            "b", "B",
-            "c", c,
-            dd );
-        
-        assertEquals( "a=A,b=B,c=C,d=D", dn.toString() );
-        assertEquals( "a = A,b=B,c=C,D = D", dn.getUpName() );
-    }
 
     /**
      * test Add a composite RDN to an existing LdapDN
@@ -2539,9 +2518,9 @@
 
         assertTrue( name.getUpName().equals( "ou= Some   People   ,dc = eXample,dc= cOm"
) );
 
-        LdapDN result = LdapDN.normalize( name, oids );
+        Name result = LdapDN.normalize( name, oids );
 
-        assertEquals( "2.5.4.11=some people,0.9.2342.19200300.100.1.25=example,0.9.2342.19200300.100.1.25=com",
result.getNormName() );
+        assertTrue( result.toString().equals( "ou=some people,dc=example,dc=com" ) );
     }
 
 
@@ -3529,24 +3508,4 @@
         assertEquals( "cn=loopback+iphostnumber=\\#127.0.0.1 Z", dn4.getRdn().getNormName()
);
     }
 
-    
-    /**
-     * test case for DIRSERVER-1442
-     * 
-     * This test shows that the parser has no issues with escaped + 
-     */
-    @Test
-    public void testAddAttributeWithEscapedPlusCharacter()
-    {
-        try
-        {
-            LdapDN dn = new LdapDN( "cn=John\\+Doe" );
-            assertTrue( true );
-        }
-        catch( Exception e )
-        {
-            fail();
-        }
-    }
-
 }



Mime
View raw message