directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r226635 - in /directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec: DelResponseTest.java ModifyDNResponseTest.java ModifyResponseTest.java
Date Sun, 31 Jul 2005 12:04:13 GMT
Author: elecharny
Date: Sun Jul 31 05:04:09 2005
New Revision: 226635

URL: http://svn.apache.org/viewcvs?rev=226635&view=rev
Log:
Added the encoding test

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

Modified: directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/DelResponseTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/DelResponseTest.java?rev=226635&r1=226634&r2=226635&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/DelResponseTest.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/DelResponseTest.java
Sun Jul 31 05:04:09 2005
@@ -19,10 +19,12 @@
 import java.nio.ByteBuffer;
 
 import org.apache.asn1.DecoderException;
+import org.apache.asn1.EncoderException;
 import org.apache.asn1.ber.Asn1Decoder;
 import org.apache.asn1.ber.containers.IAsn1Container;
 import org.apache.asn1.ldap.pojo.DelResponse;
 import org.apache.asn1.ldap.pojo.LdapMessage;
+import org.apache.asn1.util.StringUtils;
 import org.apache.log4j.Logger;
 import org.apache.log4j.PropertyConfigurator;
 
@@ -71,6 +73,7 @@
 									// }
             } );
 
+        String decodedPdu = StringUtils.dumpBytes( stream.array() );
         stream.flip();
 
         // Allocate a LdapMessage Container
@@ -98,5 +101,20 @@
 
         // Check the length
         Assert.assertEquals(0x2D, message.computeLength());
+        
+        // Check the encoding
+        try
+        {
+            ByteBuffer bb = message.encode( null );
+            
+            String encodedPdu = StringUtils.dumpBytes( bb.array() ); 
+            
+            Assert.assertEquals(encodedPdu, decodedPdu );
+        }
+        catch ( EncoderException ee )
+        {
+            ee.printStackTrace();
+            Assert.fail( ee.getMessage() );
+        }
     }
 }

Modified: directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/ModifyDNResponseTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/ModifyDNResponseTest.java?rev=226635&r1=226634&r2=226635&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/ModifyDNResponseTest.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/ModifyDNResponseTest.java
Sun Jul 31 05:04:09 2005
@@ -19,10 +19,12 @@
 import java.nio.ByteBuffer;
 
 import org.apache.asn1.DecoderException;
+import org.apache.asn1.EncoderException;
 import org.apache.asn1.ber.Asn1Decoder;
 import org.apache.asn1.ber.containers.IAsn1Container;
 import org.apache.asn1.ldap.pojo.LdapMessage;
 import org.apache.asn1.ldap.pojo.ModifyDNResponse;
+import org.apache.asn1.util.StringUtils;
 import org.apache.log4j.Logger;
 import org.apache.log4j.PropertyConfigurator;
 
@@ -71,6 +73,7 @@
 									// }
             } );
 
+        String decodedPdu = StringUtils.dumpBytes( stream.array() );
         stream.flip();
 
         // Allocate a LdapMessage Container
@@ -98,5 +101,20 @@
         
         // Check the length
         Assert.assertEquals(0x2D, message.computeLength());
+
+        // Check the encoding
+        try
+        {
+            ByteBuffer bb = message.encode( null );
+            
+            String encodedPdu = StringUtils.dumpBytes( bb.array() ); 
+            
+            Assert.assertEquals(encodedPdu, decodedPdu );
+        }
+        catch ( EncoderException ee )
+        {
+            ee.printStackTrace();
+            Assert.fail( ee.getMessage() );
+        }
     }
 }

Modified: directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/ModifyResponseTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/ModifyResponseTest.java?rev=226635&r1=226634&r2=226635&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/ModifyResponseTest.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/ModifyResponseTest.java
Sun Jul 31 05:04:09 2005
@@ -19,10 +19,12 @@
 import java.nio.ByteBuffer;
 
 import org.apache.asn1.DecoderException;
+import org.apache.asn1.EncoderException;
 import org.apache.asn1.ber.Asn1Decoder;
 import org.apache.asn1.ber.containers.IAsn1Container;
 import org.apache.asn1.ldap.pojo.LdapMessage;
 import org.apache.asn1.ldap.pojo.ModifyResponse;
+import org.apache.asn1.util.StringUtils;
 import org.apache.log4j.Logger;
 import org.apache.log4j.PropertyConfigurator;
 
@@ -71,6 +73,7 @@
 									// }
             } );
 
+        String decodedPdu = StringUtils.dumpBytes( stream.array() );
         stream.flip();
 
         // Allocate a LdapMessage Container
@@ -98,5 +101,20 @@
         
         // Check the length
         Assert.assertEquals(0x2D, message.computeLength());
+
+        // Check the encoding
+        try
+        {
+            ByteBuffer bb = message.encode( null );
+            
+            String encodedPdu = StringUtils.dumpBytes( bb.array() ); 
+            
+            Assert.assertEquals(encodedPdu, decodedPdu );
+        }
+        catch ( EncoderException ee )
+        {
+            ee.printStackTrace();
+            Assert.fail( ee.getMessage() );
+        }
     }
 }



Mime
View raw message