directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r264081 - /directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/test/org/apache/asn1new/ldap/codec/SearchResultEntryTest.java
Date Mon, 29 Aug 2005 05:41:38 GMT
Author: elecharny
Date: Sun Aug 28 22:41:35 2005
New Revision: 264081

URL: http://svn.apache.org/viewcvs?rev=264081&view=rev
Log:
Changed from ArrayList to Attributes.

Modified:
    directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/test/org/apache/asn1new/ldap/codec/SearchResultEntryTest.java

Modified: directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/test/org/apache/asn1new/ldap/codec/SearchResultEntryTest.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/test/org/apache/asn1new/ldap/codec/SearchResultEntryTest.java?rev=264081&r1=264080&r2=264081&view=diff
==============================================================================
--- directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/test/org/apache/asn1new/ldap/codec/SearchResultEntryTest.java
(original)
+++ directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/test/org/apache/asn1new/ldap/codec/SearchResultEntryTest.java
Sun Aug 28 22:41:35 2005
@@ -17,11 +17,11 @@
 package org.apache.asn1new.ldap.codec;
 
 import java.nio.ByteBuffer;
-import java.util.ArrayList;
 import java.util.HashSet;
 
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
+import javax.naming.directory.Attributes;
 import javax.naming.directory.BasicAttribute;
 
 import org.apache.asn1.codec.DecoderException;
@@ -110,13 +110,13 @@
         Assert.assertEquals( 1, message.getMessageId() );
         Assert.assertEquals( "ou=contacts,dc=iktek,dc=com", searchResultEntry.getObjectName()
);
 
-        ArrayList partialAttributesList = searchResultEntry.getPartialAttributeList();
+        Attributes partialAttributesList = searchResultEntry.getPartialAttributeList();
         
         Assert.assertEquals( 1, partialAttributesList.size() );
         
         for ( int i = 0; i < partialAttributesList.size(); i++ )
         {
-            BasicAttribute attributeValue = (BasicAttribute)partialAttributesList.get( i
);
+            BasicAttribute attributeValue = (BasicAttribute)partialAttributesList.get( "objectclass"
);
             
             Assert.assertEquals( "objectClass".toLowerCase(), attributeValue.getID().toLowerCase()
);
             
@@ -197,7 +197,6 @@
 				0x04, 0x12, 'o', 'r', 'g', 'a', 'n', 'i', 'z', 'a', 't', 'i', 'o', 'n', 'a', 'l', 'U',
'n', 'i', 't'
             } );
 
-        String decodedPdu = StringUtils.dumpBytes( stream.array() );
         stream.flip();
 
         // Allocate a BindRequest Container
@@ -219,15 +218,15 @@
         Assert.assertEquals( 1, message.getMessageId() );
         Assert.assertEquals( "ou=contacts,dc=iktek,dc=com", searchResultEntry.getObjectName()
);
 
-        ArrayList partialAttributesList = searchResultEntry.getPartialAttributeList();
+        Attributes partialAttributesList = searchResultEntry.getPartialAttributeList();
         
         Assert.assertEquals( 2, partialAttributesList.size() );
         
         String[] expectedAttributes = new String[]{"objectClass", "objectClass2"}; 
         
-        for ( int i = 0; i < partialAttributesList.size(); i++ )
+        for ( int i = 0; i < expectedAttributes.length; i++ )
         {
-            BasicAttribute attributeValue = (BasicAttribute)partialAttributesList.get( i
);
+            BasicAttribute attributeValue = (BasicAttribute)partialAttributesList.get( expectedAttributes[i]
);
             
             Assert.assertEquals( expectedAttributes[i].toLowerCase(), attributeValue.getID().toLowerCase()
);
             
@@ -254,11 +253,9 @@
         // Check the encoding
         try
         {
-            ByteBuffer bb = message.encode( null );
+            message.encode( null );
             
-            String encodedPdu = StringUtils.dumpBytes( bb.array() ); 
-            
-            Assert.assertEquals(encodedPdu, decodedPdu );
+            // We cant compare the encodings, the order of the attributes has changed
         }
         catch ( EncoderException ee )
         {
@@ -326,13 +323,13 @@
         Assert.assertEquals( 2, message.getMessageId() );
         Assert.assertEquals( "uid=admin,ou=system", searchResultEntry.getObjectName() );
 
-        ArrayList partialAttributesList = searchResultEntry.getPartialAttributeList();
+        Attributes partialAttributesList = searchResultEntry.getPartialAttributeList();
         
         Assert.assertEquals( 1, partialAttributesList.size() );
         
         for ( int i = 0; i < partialAttributesList.size(); i++ )
         {
-            BasicAttribute attributeValue = (BasicAttribute)partialAttributesList.get( i
);
+            BasicAttribute attributeValue = (BasicAttribute)partialAttributesList.get( "objectclass"
);
             
             Assert.assertEquals( "objectClass".toLowerCase(), attributeValue.getID().toLowerCase()
);
             



Mime
View raw message