directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r224600 - /directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/SearchResultReferenceTest.java
Date Sun, 24 Jul 2005 10:20:21 GMT
Author: elecharny
Date: Sun Jul 24 03:20:18 2005
New Revision: 224600

URL: http://svn.apache.org/viewcvs?rev=224600&view=rev
Log:
- added the code to check that the decoded SearchResultReference is correct. This had lead
to meny
correction in LdapUTL class and its tests.

Modified:
    directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/SearchResultReferenceTest.java

Modified: directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/SearchResultReferenceTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/SearchResultReferenceTest.java?rev=224600&r1=224599&r2=224600&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/SearchResultReferenceTest.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/SearchResultReferenceTest.java
Sun Jul 24 03:20:18 2005
@@ -17,12 +17,15 @@
 package org.apache.asn1.ldap.codec;
 
 import java.nio.ByteBuffer;
+import java.util.HashSet;
+import java.util.Iterator;
 
 import javax.naming.NamingException;
 
 import org.apache.asn1.DecoderException;
 import org.apache.asn1.ber.Asn1Decoder;
 import org.apache.asn1.ber.containers.IAsn1Container;
+import org.apache.asn1.ldap.codec.primitives.LdapURL;
 import org.apache.asn1.ldap.pojo.LdapMessage;
 import org.apache.asn1.ldap.pojo.SearchResultReference;
 import org.apache.log4j.Logger;
@@ -123,5 +126,36 @@
         SearchResultReference searchResultReference      = message.getSearchResultReference();
 
         Assert.assertEquals( 1, message.getMessageId() );
+        
+        HashSet ldapUrlsSet = new HashSet();
+        
+        try {
+	        for (int i = 0; i < ldapUrls.length; i++)
+	        {
+	            ldapUrlsSet.add( new LdapURL( ldapUrls[i].getBytes() ).toString() );
+	        }
+        } catch (DecoderException de)
+        {
+            Assert.fail();
+        }
+        
+        Iterator iter = searchResultReference.getSearchResultReferences().iterator();
+        
+        while (iter.hasNext())
+        {
+            LdapURL ldapUrl = (LdapURL)iter.next();
+            
+            if (ldapUrlsSet.contains( ldapUrl.toString()) )
+            {
+                ldapUrlsSet.remove( ldapUrl.toString() );
+            }
+            else
+            {
+                Assert.fail(ldapUrl.toString() + " is not present");
+            }
+        }
+        
+        Assert.assertTrue( ldapUrlsSet.size() == 0 );
+        
     }
 }



Mime
View raw message