directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vte...@apache.org
Subject svn commit: r152980 [2/2] - in incubator/directory/ldap/trunk/apache-provider/src: java/org/apache/ldap/common/berlib/asn1/ java/org/apache/ldap/common/berlib/asn1/encoder/add/ test/org/apache/ldap/common/berlib/asn1/ test/org/apache/ldap/common/berlib/asn1/decoder/abandon/ test/org/apache/ldap/common/berlib/asn1/decoder/add/ test/org/apache/ldap/common/berlib/asn1/decoder/bind/ test/org/apache/ldap/common/berlib/asn1/decoder/compare/ test/org/apache/ldap/common/berlib/asn1/decoder/delete/ test/org/apache/ldap/common/berlib/asn1/decoder/extended/ test/org/apache/ldap/common/berlib/asn1/decoder/modify/ test/org/apache/ldap/common/berlib/asn1/decoder/modifydn/ test/org/apache/ldap/common/berlib/asn1/decoder/search/ test/org/apache/ldap/common/berlib/asn1/decoder/testutils/ test/org/apache/ldap/common/berlib/asn1/decoder/unbind/ test/org/apache/ldap/common/berlib/asn1/encoder/ test/org/apache/ldap/common/berlib/asn1/encoder/abandon/ test/org/apache/ldap/common/berlib/asn1/encoder/add/ test/org/apache/ldap/common/berlib/asn1/encoder/bind/ test/org/apache/ldap/common/berlib/asn1/encoder/compare/ test/org/apache/ldap/common/berlib/asn1/encoder/delete/ test/org/apache/ldap/common/berlib/asn1/encoder/extended/ test/org/apache/ldap/common/berlib/asn1/encoder/modify/ test/org/apache/ldap/common/berlib/asn1/encoder/modifyDn/ test/org/apache/ldap/common/berlib/asn1/encoder/search/ test/org/apache/ldap/common/berlib/asn1/encoder/unbind/
Date Wed, 09 Feb 2005 03:33:54 GMT
Modified: incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/decoder/testutils/TestUtils.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/decoder/testutils/TestUtils.java?view=diff&r1=152979&r2=152980
==============================================================================
--- incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/decoder/testutils/TestUtils.java (original)
+++ incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/decoder/testutils/TestUtils.java Tue Feb  8 19:33:42 2005
@@ -17,19 +17,17 @@
 package org.apache.ldap.common.berlib.asn1.decoder.testutils ;
 
 
-import java.nio.ByteBuffer ;
-import java.util.Properties;
-
-import org.apache.asn1.codec.stateful.CallbackHistory ;
+import junit.framework.Assert;
 import org.apache.asn1.ber.DefaultMutableTupleNode;
-
-import org.apache.ldap.common.message.Message ;
-import org.apache.ldap.common.message.MessageEncoder ;
+import org.apache.asn1.ber.TupleTreeDecoder;
+import org.apache.asn1.codec.stateful.CallbackHistory;
+import org.apache.ldap.common.message.Message;
+import org.apache.ldap.common.message.MessageEncoder;
 import org.apache.ldap.common.message.spi.Provider;
 
-import org.apache.asn1.ber.TupleTreeDecoder ;
-import org.apache.asn1.ber.DefaultMutableTupleNode ;
-import org.apache.asn1.ber.TupleTreeDecoder;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import java.util.Properties;
 
 
 /**
@@ -85,5 +83,26 @@
         node = getTupleTree( pdu ) ;
         node.printDepthFirst( sb, 0 ) ;
         return sb.toString() ;
+    }
+
+    public static void assertEquals( byte[] expected, byte[] actual )
+    {
+        String msg = "\nexpected <" + toString( expected ) + ">\nbut was  <" + toString( actual ) + ">";
+        Assert.assertTrue( msg, Arrays.equals( expected, actual ));
+    }
+
+    public static String toString( byte[] bites )
+    {
+        if ( bites.length == 0 ) return "";
+
+        StringBuffer sb = new StringBuffer( "");
+        for ( int i = 0; i < bites.length; i++ )
+        {
+            byte bite = bites[i];
+            sb.append( Integer.toHexString( bite ).toUpperCase( ) ).append( " ");
+        }
+        sb.setLength( sb.length() - 1 );
+
+        return sb.toString();
     }
 }

Modified: incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/decoder/unbind/UnbindRequestRuleTest.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/decoder/unbind/UnbindRequestRuleTest.java?view=diff&r1=152979&r2=152980
==============================================================================
--- incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/decoder/unbind/UnbindRequestRuleTest.java (original)
+++ incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/decoder/unbind/UnbindRequestRuleTest.java Tue Feb  8 19:33:42 2005
@@ -17,12 +17,9 @@
 package org.apache.ldap.common.berlib.asn1.decoder.unbind ;
 
 
-import org.apache.ldap.common.berlib.asn1.decoder.testutils.TestUtils ;
-import org.apache.ldap.common.berlib.asn1.decoder.testutils.RuleTestCase ;
 import org.apache.ldap.common.berlib.asn1.decoder.testutils.RuleTestCase;
-
-import org.apache.ldap.common.message.UnbindRequest ;
-import org.apache.ldap.common.message.UnbindRequestImpl ;
+import org.apache.ldap.common.message.UnbindRequest;
+import org.apache.ldap.common.message.UnbindRequestImpl;
 
 
 /**
@@ -33,32 +30,12 @@
  */
 public class UnbindRequestRuleTest extends RuleTestCase
 {
-    /**
-     * Builds an UnbindRequest for testing.
-     *
-     * @param id the messageId of the request
-     * @return the newly built UnbindRequest
-     * @throws Exception if there are failures creating the request
-     */
-    public UnbindRequest build( int id ) throws Exception
-    {
-        UnbindRequest req = new UnbindRequestImpl( id ) ;
-
-        System.out.println( "Generated UnbindRequest for testing:" ) ;
-        System.out.println( TestUtils.printTupleTree( req ) ) ;
-        return req ;
-    }
-
-
-    /**
-     * Tests the ability to decode an UnbindRequest with Snickers'
-     * BERDigester.
-     */
     public void testUnbindRequest() throws Exception
     {
-        UnbindRequest req = build( 44 ) ;
-        UnbindRequest decoded = ( UnbindRequest )
-                snickersDecode( snaccEncode( req ) ) ;
-        assertEquals( req.getMessageId(), decoded.getMessageId() ) ;
+        byte[] pdu = new byte[] {0x30, 0x05, 0x02, 0x01, 0x2C, 0x42, 0x00};
+        UnbindRequest decoded = ( UnbindRequest ) decode( pdu );
+
+        UnbindRequest expected = new UnbindRequestImpl( 44 ) ;
+        assertEquals( expected, decoded ) ;
     }
 }

Modified: incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/AbstractEncoderTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/AbstractEncoderTestCase.java?view=diff&r1=152979&r2=152980
==============================================================================
--- incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/AbstractEncoderTestCase.java (original)
+++ incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/AbstractEncoderTestCase.java Tue Feb  8 19:33:42 2005
@@ -18,23 +18,18 @@
 
 
 import junit.framework.TestCase;
-
+import org.apache.asn1.ber.DefaultMutableTupleNode;
+import org.apache.asn1.ber.DeterminateLengthVisitor;
+import org.apache.asn1.ber.TupleEncodingVisitor;
 import org.apache.asn1.codec.stateful.EncoderCallback;
 import org.apache.asn1.codec.stateful.StatefulEncoder;
-import org.apache.asn1.codec.stateful.StatefulEncoder;
-import org.apache.asn1.ber.DefaultMutableTupleNode;
-
 import org.apache.ldap.common.message.Message;
 import org.apache.ldap.common.message.MessageDecoder;
 import org.apache.ldap.common.message.spi.Provider;
-import org.apache.asn1.ber.DefaultMutableTupleNode;
-import org.apache.asn1.ber.DeterminateLengthVisitor;
-import org.apache.asn1.ber.DeterminateLengthVisitor;
-import org.apache.asn1.ber.TupleEncodingVisitor;
 
+import java.io.ByteArrayInputStream;
 import java.nio.ByteBuffer;
 import java.util.Properties;
-import java.io.ByteArrayInputStream;
 
 
 /**
@@ -146,6 +141,13 @@
         ByteArrayInputStream in = new ByteArrayInputStream( accumulator.array(),
                 0, accumulator.position() );
         return ( Message ) decoder.decode( null, in );
+    }
+
+    protected byte[] getEncoded()
+    {
+        byte[] encoded = new byte[accumulator.position()];
+        System.arraycopy( accumulator.array(), 0, encoded,  0, accumulator.position() );
+        return encoded;
     }
 
 

Modified: incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/EncoderUtilsTest.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/EncoderUtilsTest.java?view=diff&r1=152979&r2=152980
==============================================================================
--- incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/EncoderUtilsTest.java (original)
+++ incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/EncoderUtilsTest.java Tue Feb  8 19:33:42 2005
@@ -20,12 +20,9 @@
 import junit.framework.TestCase;
 import org.apache.asn1.ber.TupleNode;
 import org.apache.asn1.ber.primitives.UniversalTag;
-import org.apache.asn1.ber.TupleNode;
+import org.apache.commons.lang.ArrayUtils;
 import org.apache.ldap.common.berlib.asn1.BufferUtils;
 import org.apache.ldap.common.berlib.asn1.LdapTag;
-import org.apache.ldap.common.berlib.asn1.encoder.EncoderUtils;
-import org.apache.ldap.common.berlib.asn1.BufferUtils;
-import org.apache.commons.lang.ArrayUtils;
 
 
 /**

Modified: incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/abandon/AbandonRequestEncoderTest.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/abandon/AbandonRequestEncoderTest.java?view=diff&r1=152979&r2=152980
==============================================================================
--- incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/abandon/AbandonRequestEncoderTest.java (original)
+++ incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/abandon/AbandonRequestEncoderTest.java Tue Feb  8 19:33:42 2005
@@ -17,14 +17,11 @@
 package org.apache.ldap.common.berlib.asn1.encoder.abandon;
 
 
-import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
-import org.apache.ldap.common.berlib.asn1.encoder.abandon.AbandonRequestEncoder;
-import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
-
-import org.apache.asn1.ber.TupleNode;
 import org.apache.asn1.ber.DefaultMutableTupleNode;
-
-import org.apache.ldap.common.message.*;
+import org.apache.asn1.ber.TupleNode;
+import org.apache.ldap.common.berlib.asn1.decoder.testutils.TestUtils;
+import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
+import org.apache.ldap.common.message.AbandonRequestImpl;
 
 
 /**
@@ -42,12 +39,11 @@
     {
         AbandonRequestImpl request = new AbandonRequestImpl( 33 );
         request.setAbandoned( 11 );
+        byte[] expected = new byte[] {0x30, 0x06, 0x02, 0x01, 0x21, 0x50, 0x01, 0x0B};
 
         // Encode stub into tuple tree then into the accumulator
         TupleNode node = AbandonRequestEncoder.INSTANCE.encode( request );
         encode( ( DefaultMutableTupleNode ) node );
-
-        // Test to see if original stub equals the round trip generated stub
-        assertTrue( request.equals( decode() ) );
+        TestUtils.assertEquals( expected, getEncoded() );
     }
 }

Modified: incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/add/AddRequestEncoderTest.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/add/AddRequestEncoderTest.java?view=diff&r1=152979&r2=152980
==============================================================================
--- incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/add/AddRequestEncoderTest.java (original)
+++ incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/add/AddRequestEncoderTest.java Tue Feb  8 19:33:42 2005
@@ -17,22 +17,17 @@
 package org.apache.ldap.common.berlib.asn1.encoder.add;
 
 
-import javax.naming.directory.Attribute;
-import javax.naming.NamingException;
-
-import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
-import org.apache.ldap.common.berlib.asn1.encoder.add.AddRequestEncoder;
-import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
-
-import org.apache.asn1.ber.TupleNode;
-import org.apache.asn1.ber.DefaultMutableTupleNode;
-
-import org.apache.ldap.common.message.*;
 import org.apache.asn1.ber.DefaultMutableTupleNode;
 import org.apache.asn1.ber.TupleNode;
+import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
+import org.apache.ldap.common.message.AddRequestImpl;
+import org.apache.ldap.common.message.LockableAttributesImpl;
+
+import javax.naming.NamingException;
 
 
 /**
+ * TODO: fix me! Snacc generated PDU doesnt match snickers one
  * TestCase for the AddRequestEncoder class.
  *
  * @author <a href="mailto:directory-dev@incubator.apache.org"> Apache Directory
@@ -56,27 +51,29 @@
         // Encode stub into tuple tree then into the accumulator
         TupleNode node = AddRequestEncoder.INSTANCE.encode( request );
         encode( ( DefaultMutableTupleNode ) node );
-
-        // Test to see if original stub equals the round trip generated stub
-        AddRequest decoded = ( AddRequest ) super.decode();
-
-        /*
-         * Snacc is not preserving attribute order for some reason when building
-         * attributes so we are going to manually test things instead.
-         */
-        assertEquals( request.getName(), decoded.getName() );
-        assertEquals( request.getResponseType(), decoded.getResponseType() );
-        assertEquals( request.getType(), decoded.getType() );
-
-        // when there is one attribute we do not see the bug in snacc4j
-        assertEquals( request.getEntry().get( "dc" ), decoded.getEntry().get( "dc" ) );
-        Attribute objectClass = request.getEntry().get( "objectClass" );
-        Attribute decodedObjectClass = decoded.getEntry().get( "objectClass" );
-
-        assertEquals( objectClass.size(), decodedObjectClass.size() );
-        for ( int ii = 0; ii < objectClass.size(); ii++ )
-        {
-            assertTrue( decodedObjectClass.contains( objectClass.get( ii ) ) );
-        }
+        assertEquals( request, decode() );
     }
+
+    /**
+     * TODO: study differences between snacc and snickers PDUs
+     * PDUs might be equivalent yet different in sub elements order
+     */
+    
+//    public void testCanEncodeAddRequests() throws NamingException
+//    {
+//        AddRequestImpl request = new AddRequestImpl( 33 );
+//        request.setName( "dc=apache,dc=org" );
+//        LockableAttributesImpl attrs = new LockableAttributesImpl( request );
+//        attrs.put( "objectClass", "top" );
+//        attrs.put( "objectClass", "dcObject" );
+//        attrs.put( "dc", "example.com" );
+//        request.setEntry( attrs );
+//
+//        byte[] expected = new byte[] {0x30, 0x4E, 0x02, 0x01, 0x21, 0x68, 0x49, 0x04, 0x10, 0x64, 0x63, 0x3D, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2C, 0x64, 0x63, 0x3D, 0x6F, 0x72, 0x67, 0x30, 0x35, 0x30, 0x1E, 0x04, 0x0B, 0x6F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x43, 0x6C, 0x61, 0x73, 0x73, 0x31, 0x0F, 0x04, 0x03, 0x74, 0x6F, 0x70, 0x04, 0x08, 0x64, 0x63, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x30, 0x13, 0x04, 0x02, 0x64, 0x63, 0x31, 0x0D, 0x04, 0x0B, 0x65, 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x2E, 0x63, 0x6F, 0x6D};
+//
+//        // Encode stub into tuple tree then into the accumulator
+//        TupleNode node = AddRequestEncoder.INSTANCE.encode( request );
+//        encode( ( DefaultMutableTupleNode ) node );
+//        TestUtils.assertEquals( expected, getEncoded() );
+//    }
 }

Modified: incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/add/AddResponseEncoderTest.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/add/AddResponseEncoderTest.java?view=diff&r1=152979&r2=152980
==============================================================================
--- incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/add/AddResponseEncoderTest.java (original)
+++ incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/add/AddResponseEncoderTest.java Tue Feb  8 19:33:42 2005
@@ -17,14 +17,14 @@
 package org.apache.ldap.common.berlib.asn1.encoder.add;
 
 
-import org.apache.asn1.ber.TupleNode;
 import org.apache.asn1.ber.DefaultMutableTupleNode;
+import org.apache.asn1.ber.TupleNode;
 import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
-import org.apache.ldap.common.berlib.asn1.encoder.add.AddResponseEncoder;
-import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
-
-import org.apache.ldap.common.message.*;
-import org.apache.asn1.ber.DefaultMutableTupleNode;
+import org.apache.ldap.common.berlib.asn1.decoder.testutils.TestUtils;
+import org.apache.ldap.common.message.AddResponseImpl;
+import org.apache.ldap.common.message.LdapResultImpl;
+import org.apache.ldap.common.message.ReferralImpl;
+import org.apache.ldap.common.message.ResultCodeEnum;
 
 
 /**
@@ -52,11 +52,12 @@
         refs.addLdapUrl( "ldap://another.net" );
         result.setReferral( refs );
 
+        byte[] expected = new byte[] {0x30, 0x5D, 0x2, 0x1, 0x2D, 0x69, 0x58, 0xA, 0x1, 0x0, 0x4, 0x11, 0x64, 0x63, 0x3D, 0x65, 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x2C, 0x64, 0x63, 0x3D, 0x63, 0x6F, 0x6D, 0x4, 0x0, 0xFFFFFFA3, 0x3E, 0x4, 0x15, 0x6C, 0x64, 0x61, 0x70, 0x3A, 0x2F, 0x2F, 0x73, 0x6F, 0x6D, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2E, 0x63, 0x6F, 0x6D, 0x4, 0x12, 0x6C, 0x64, 0x61, 0x70, 0x3A, 0x2F, 0x2F, 0x61, 0x6E, 0x6F, 0x74, 0x68, 0x65, 0x72, 0x2E, 0x6E, 0x65, 0x74, 0x4, 0x11, 0x6C, 0x64, 0x61, 0x70, 0x3A, 0x2F, 0x2F, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2E, 0x6F, 0x72, 0x67};
+
         // Encode stub into tuple tree then into the accumulator
         TupleNode node = AddResponseEncoder.INSTANCE.encode( response );
         encode( ( DefaultMutableTupleNode ) node );
+        TestUtils.assertEquals( expected, getEncoded() );
 
-        // Test to see if original stub equals the round trip generated stub
-        assertTrue( response.equals( decode() ) );
     }
 }

Modified: incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/bind/BindRequestEncoderTest.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/bind/BindRequestEncoderTest.java?view=diff&r1=152979&r2=152980
==============================================================================
--- incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/bind/BindRequestEncoderTest.java (original)
+++ incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/bind/BindRequestEncoderTest.java Tue Feb  8 19:33:42 2005
@@ -16,11 +16,10 @@
  */
 package org.apache.ldap.common.berlib.asn1.encoder.bind;
 
-import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
-import org.apache.ldap.common.berlib.asn1.encoder.bind.BindRequestEncoder;
-import org.apache.asn1.ber.TupleNode;
 import org.apache.asn1.ber.DefaultMutableTupleNode;
 import org.apache.asn1.ber.TupleNode;
+import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
+import org.apache.ldap.common.berlib.asn1.decoder.testutils.TestUtils;
 import org.apache.ldap.common.message.BindRequestImpl;
 
 /**
@@ -40,11 +39,11 @@
         req.setSimple( true );
         req.setVersion3( true );
 
+        byte[] expected = new byte[] {0x30, 0x32, 0x02, 0x01, 0x0C, 0x60, 0x2D, 0x02, 0x01, 0x03, 0x04, 0x1E, 0x75, 0x69, 0x64, 0x3D, 0x61, 0x6B, 0x61, 0x72, 0x61, 0x73, 0x75, 0x6C, 0x75, 0x2C, 0x64, 0x63, 0x3D, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2C, 0x64, 0x63, 0x3D, 0x6F, 0x72, 0x67, 0xFFFFFF80, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6F, 0x72, 0x64};
+
         // Encode stub into tuple tree then into the accumulator
         TupleNode node = BindRequestEncoder.INSTANCE.encode( req );
         encode( ( DefaultMutableTupleNode ) node );
-
-        // Test to see if original stub equals the round trip generated stub
-        assertTrue( req.equals( decode() ) );
+        TestUtils.assertEquals( expected, getEncoded() );
     }
 }

Modified: incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/bind/BindResponseEncoderTest.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/bind/BindResponseEncoderTest.java?view=diff&r1=152979&r2=152980
==============================================================================
--- incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/bind/BindResponseEncoderTest.java (original)
+++ incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/bind/BindResponseEncoderTest.java Tue Feb  8 19:33:42 2005
@@ -17,17 +17,14 @@
 package org.apache.ldap.common.berlib.asn1.encoder.bind;
 
 
-import org.apache.asn1.ber.TupleNode;
 import org.apache.asn1.ber.DefaultMutableTupleNode;
 import org.apache.asn1.ber.TupleNode;
 import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
-import org.apache.ldap.common.berlib.asn1.encoder.bind.BindResponseEncoder;
-import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
-
+import org.apache.ldap.common.berlib.asn1.decoder.testutils.TestUtils;
+import org.apache.ldap.common.message.BindResponseImpl;
+import org.apache.ldap.common.message.LdapResultImpl;
 import org.apache.ldap.common.message.ReferralImpl;
 import org.apache.ldap.common.message.ResultCodeEnum;
-import org.apache.ldap.common.message.LdapResultImpl;
-import org.apache.ldap.common.message.BindResponseImpl;
 
 
 /**
@@ -55,11 +52,11 @@
         refs.addLdapUrl( "ldap://another.net" );
         result.setReferral( refs );
 
+        byte[] expected = new byte[] {0x30, 0x5D, 0x02, 0x01, 0x05, 0x61, 0x58, 0x0A, 0x01, 0x00, 0x04, 0x11, 0x64, 0x63, 0x3D, 0x65, 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x2C, 0x64, 0x63, 0x3D, 0x63, 0x6F, 0x6D, 0x04, 0x00, 0xFFFFFFA3, 0x3E, 0x04, 0x15, 0x6C, 0x64, 0x61, 0x70, 0x3A, 0x2F, 0x2F, 0x73, 0x6F, 0x6D, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2E, 0x63, 0x6F, 0x6D, 0x04, 0x12, 0x6C, 0x64, 0x61, 0x70, 0x3A, 0x2F, 0x2F, 0x61, 0x6E, 0x6F, 0x74, 0x68, 0x65, 0x72, 0x2E, 0x6E, 0x65, 0x74, 0x04, 0x11, 0x6C, 0x64, 0x61, 0x70, 0x3A, 0x2F, 0x2F, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2E, 0x6F, 0x72, 0x67};
+
         // Encode stub into tuple tree then into the accumulator
         TupleNode node = BindResponseEncoder.INSTANCE.encode( response );
         encode( ( DefaultMutableTupleNode ) node );
-
-        // Test to see if original stub equals the round trip generated stub
-        assertTrue( response.equals( decode() ) );
+        TestUtils.assertEquals( expected, getEncoded() );
     }
 }

Modified: incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/compare/CompareRequestEncoderTest.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/compare/CompareRequestEncoderTest.java?view=diff&r1=152979&r2=152980
==============================================================================
--- incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/compare/CompareRequestEncoderTest.java (original)
+++ incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/compare/CompareRequestEncoderTest.java Tue Feb  8 19:33:42 2005
@@ -17,16 +17,11 @@
 package org.apache.ldap.common.berlib.asn1.encoder.compare;
 
 
-import org.apache.asn1.ber.TupleNode;
-import org.apache.asn1.ber.DefaultMutableTupleNode;
-
-import org.apache.ldap.common.message.CompareRequestImpl;
-
-import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
-import org.apache.ldap.common.berlib.asn1.encoder.compare.CompareRequestEncoder;
-import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
 import org.apache.asn1.ber.DefaultMutableTupleNode;
 import org.apache.asn1.ber.TupleNode;
+import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
+import org.apache.ldap.common.berlib.asn1.decoder.testutils.TestUtils;
+import org.apache.ldap.common.message.CompareRequestImpl;
 
 
 /**
@@ -47,11 +42,11 @@
         req.setAttributeId( "dc" );
         req.setAssertionValue( "apache.org" );
 
+        byte[] expected = new byte[] {0x30, 0x2A, 0x02, 0x02, 0x01, 0xFFFFFFBC, 0x6E, 0x24, 0x04, 0x10, 0x64, 0x63, 0x3D, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2C, 0x64, 0x63, 0x3D, 0x6F, 0x72, 0x67, 0x30, 0x10, 0x04, 0x02, 0x64, 0x63, 0x04, 0x0A, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2E, 0x6F, 0x72, 0x67};
+
         // Encode stub into tuple tree then into the accumulator
         TupleNode node = CompareRequestEncoder.INSTANCE.encode( req );
         encode( ( DefaultMutableTupleNode ) node );
-
-        // Test to see if original stub equals the round trip generated stub
-        assertTrue( req.equals( decode() ) );
+        TestUtils.assertEquals( expected, getEncoded() );
     }
 }

Modified: incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/compare/CompareResponseEncoderTest.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/compare/CompareResponseEncoderTest.java?view=diff&r1=152979&r2=152980
==============================================================================
--- incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/compare/CompareResponseEncoderTest.java (original)
+++ incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/compare/CompareResponseEncoderTest.java Tue Feb  8 19:33:42 2005
@@ -17,13 +17,14 @@
 package org.apache.ldap.common.berlib.asn1.encoder.compare;
 
 
-import org.apache.asn1.ber.TupleNode;
 import org.apache.asn1.ber.DefaultMutableTupleNode;
 import org.apache.asn1.ber.TupleNode;
 import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
-import org.apache.ldap.common.berlib.asn1.encoder.compare.CompareResponseEncoder;
-
-import org.apache.ldap.common.message.*;
+import org.apache.ldap.common.berlib.asn1.decoder.testutils.TestUtils;
+import org.apache.ldap.common.message.CompareResponseImpl;
+import org.apache.ldap.common.message.LdapResultImpl;
+import org.apache.ldap.common.message.ReferralImpl;
+import org.apache.ldap.common.message.ResultCodeEnum;
 
 
 /**
@@ -51,11 +52,11 @@
         refs.addLdapUrl( "ldap://another.net" );
         result.setReferral( refs );
 
+        byte[] expected = new byte[] {0x30, 0x5D, 0x02, 0x01, 0x2D, 0x6F, 0x58, 0x0A, 0x01, 0x06, 0x04, 0x11, 0x64, 0x63, 0x3D, 0x65, 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x2C, 0x64, 0x63, 0x3D, 0x63, 0x6F, 0x6D, 0x04, 0x00, 0xFFFFFFA3, 0x3E, 0x04, 0x15, 0x6C, 0x64, 0x61, 0x70, 0x3A, 0x2F, 0x2F, 0x73, 0x6F, 0x6D, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2E, 0x63, 0x6F, 0x6D, 0x04, 0x12, 0x6C, 0x64, 0x61, 0x70, 0x3A, 0x2F, 0x2F, 0x61, 0x6E, 0x6F, 0x74, 0x68, 0x65, 0x72, 0x2E, 0x6E, 0x65, 0x74, 0x04, 0x11, 0x6C, 0x64, 0x61, 0x70, 0x3A, 0x2F, 0x2F, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2E, 0x6F, 0x72, 0x67};
+
         // Encode stub into tuple tree then into the accumulator
         TupleNode node = CompareResponseEncoder.INSTANCE.encode( response );
         encode( ( DefaultMutableTupleNode ) node );
-
-        // Test to see if original stub equals the round trip generated stub
-        assertTrue( response.equals( decode() ) );
+        TestUtils.assertEquals( expected, getEncoded() );
     }
 }

Modified: incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/delete/DeleteRequestEncoderTest.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/delete/DeleteRequestEncoderTest.java?view=diff&r1=152979&r2=152980
==============================================================================
--- incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/delete/DeleteRequestEncoderTest.java (original)
+++ incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/delete/DeleteRequestEncoderTest.java Tue Feb  8 19:33:42 2005
@@ -17,15 +17,11 @@
 package org.apache.ldap.common.berlib.asn1.encoder.delete;
 
 
-import org.apache.ldap.common.message.DeleteRequestImpl;
-
-import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
-import org.apache.ldap.common.berlib.asn1.encoder.delete.DeleteRequestEncoder;
-
-import org.apache.asn1.ber.TupleNode;
-import org.apache.asn1.ber.DefaultMutableTupleNode;
 import org.apache.asn1.ber.DefaultMutableTupleNode;
 import org.apache.asn1.ber.TupleNode;
+import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
+import org.apache.ldap.common.berlib.asn1.decoder.testutils.TestUtils;
+import org.apache.ldap.common.message.DeleteRequestImpl;
 
 
 /**
@@ -42,11 +38,11 @@
         DeleteRequestImpl req = new DeleteRequestImpl( 12 );
         req.setName( "uid=akarasulu,dc=apache,dc=org" );
 
+        byte[] expected = new byte[] {0x30, 0x23, 0x02, 0x01, 0x0C, 0x4A, 0x1E, 0x75, 0x69, 0x64, 0x3D, 0x61, 0x6B, 0x61, 0x72, 0x61, 0x73, 0x75, 0x6C, 0x75, 0x2C, 0x64, 0x63, 0x3D, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2C, 0x64, 0x63, 0x3D, 0x6F, 0x72, 0x67};
+
         // Encode stub into tuple tree then into the accumulator
         TupleNode node = DeleteRequestEncoder.INSTANCE.encode( req );
         encode( ( DefaultMutableTupleNode ) node );
-
-        // Test to see if original stub equals the round trip generated stub
-        assertTrue( req.equals( decode() ) );
+        TestUtils.assertEquals( expected, getEncoded() );
     }
 }

Modified: incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/delete/DeleteResponseEncoderTest.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/delete/DeleteResponseEncoderTest.java?view=diff&r1=152979&r2=152980
==============================================================================
--- incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/delete/DeleteResponseEncoderTest.java (original)
+++ incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/delete/DeleteResponseEncoderTest.java Tue Feb  8 19:33:42 2005
@@ -17,13 +17,14 @@
 package org.apache.ldap.common.berlib.asn1.encoder.delete;
 
 
-import org.apache.asn1.ber.TupleNode;
 import org.apache.asn1.ber.DefaultMutableTupleNode;
+import org.apache.asn1.ber.TupleNode;
 import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
-import org.apache.ldap.common.berlib.asn1.encoder.delete.DeleteResponseEncoder;
-
-import org.apache.ldap.common.message.*;
-import org.apache.asn1.ber.DefaultMutableTupleNode;
+import org.apache.ldap.common.berlib.asn1.decoder.testutils.TestUtils;
+import org.apache.ldap.common.message.DeleteResponseImpl;
+import org.apache.ldap.common.message.LdapResultImpl;
+import org.apache.ldap.common.message.ReferralImpl;
+import org.apache.ldap.common.message.ResultCodeEnum;
 
 
 /**
@@ -51,11 +52,12 @@
         refs.addLdapUrl( "ldap://another.net" );
         result.setReferral( refs );
 
+        byte[] expected = new byte[] {0x30, 0x5D, 0x02, 0x01, 0x2D, 0x6B, 0x58, 0x0A, 0x01, 0x00, 0x04, 0x11, 0x64, 0x63, 0x3D, 0x65, 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x2C, 0x64, 0x63, 0x3D, 0x63, 0x6F, 0x6D, 0x04, 0x00, 0xFFFFFFA3, 0x3E, 0x04, 0x15, 0x6C, 0x64, 0x61, 0x70, 0x3A, 0x2F, 0x2F, 0x73, 0x6F, 0x6D, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2E, 0x63, 0x6F, 0x6D, 0x04, 0x12, 0x6C, 0x64, 0x61, 0x70, 0x3A, 0x2F, 0x2F, 0x61, 0x6E, 0x6F, 0x74, 0x68, 0x65, 0x72, 0x2E, 0x6E, 0x65, 0x74, 0x04, 0x11, 0x6C, 0x64, 0x61, 0x70, 0x3A, 0x2F, 0x2F, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2E, 0x6F, 0x72, 0x67};
+
         // Encode stub into tuple tree then into the accumulator
         TupleNode node = DeleteResponseEncoder.INSTANCE.encode( response );
         encode( ( DefaultMutableTupleNode ) node );
+        TestUtils.assertEquals( expected, getEncoded() );
 
-        // Test to see if original stub equals the round trip generated stub
-        assertTrue( response.equals( decode() ) );
     }
 }

Modified: incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/extended/ExtendedRequestEncoderTest.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/extended/ExtendedRequestEncoderTest.java?view=diff&r1=152979&r2=152980
==============================================================================
--- incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/extended/ExtendedRequestEncoderTest.java (original)
+++ incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/extended/ExtendedRequestEncoderTest.java Tue Feb  8 19:33:42 2005
@@ -17,15 +17,11 @@
 package org.apache.ldap.common.berlib.asn1.encoder.extended;
 
 
-import junit.framework.TestCase;
-import org.apache.ldap.common.message.ExtendedRequestImpl;
-import org.apache.asn1.ber.TupleNode;
 import org.apache.asn1.ber.DefaultMutableTupleNode;
-import org.apache.ldap.common.berlib.asn1.encoder.search.SearchRequestEncoder;
-import org.apache.ldap.common.berlib.asn1.encoder.extended.ExtendedRequestEncoder;
-import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
+import org.apache.asn1.ber.TupleNode;
 import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
-import org.apache.asn1.ber.DefaultMutableTupleNode;
+import org.apache.ldap.common.berlib.asn1.decoder.testutils.TestUtils;
+import org.apache.ldap.common.message.ExtendedRequestImpl;
 
 
 /**
@@ -43,11 +39,11 @@
         request.setOid( "1.1.1.1" );
         request.setPayload( "Hello World!".getBytes() );
 
+        byte[] expected = new byte[] {0x30, 0x1C, 0x02, 0x01, 0x17, 0x77, 0x17, 0xFFFFFF80, 0x07, 0x31, 0x2E, 0x31, 0x2E, 0x31, 0x2E, 0x31, 0xFFFFFF81, 0x0C, 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x57, 0x6F, 0x72, 0x6C, 0x64, 0x21};
+
         // Encode stub into tuple tree then into the accumulator
         TupleNode node = ExtendedRequestEncoder.INSTANCE.encode( request );
         encode( ( DefaultMutableTupleNode ) node );
-
-        // Test to see if original stub equals the round trip generated stub
-        assertTrue( request.equals( decode() ) );
+        TestUtils.assertEquals( expected, getEncoded() );
     }
 }

Modified: incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/extended/ExtendedResponseEncoderTest.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/extended/ExtendedResponseEncoderTest.java?view=diff&r1=152979&r2=152980
==============================================================================
--- incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/extended/ExtendedResponseEncoderTest.java (original)
+++ incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/extended/ExtendedResponseEncoderTest.java Tue Feb  8 19:33:42 2005
@@ -17,19 +17,12 @@
 package org.apache.ldap.common.berlib.asn1.encoder.extended;
 
 
-import junit.framework.TestCase;
-import org.apache.ldap.common.message.ExtendedRequestImpl;
-import org.apache.asn1.ber.TupleNode;
-import org.apache.asn1.ber.DefaultMutableTupleNode;
-import org.apache.ldap.common.berlib.asn1.encoder.search.SearchRequestEncoder;
-import org.apache.ldap.common.berlib.asn1.encoder.extended.ExtendedRequestEncoder;
 import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
-import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
-import org.apache.asn1.ber.DefaultMutableTupleNode;
-import org.apache.asn1.ber.TupleNode;
 
 
 /**
+ * TODO: fix me! Looks like a copy and paste error from ExtendedRequestEncoderTestCase
+ *
  * TestCase for the ExtendedRequestEncoder class.
  *
  * @author <a href="mailto:directory-dev@incubator.apache.org"> Apache Directory
@@ -40,15 +33,15 @@
 {
     public void testEncode()
     {
-        ExtendedRequestImpl request = new ExtendedRequestImpl( 23 );
-        request.setOid( "1.1.1.1" );
-        request.setPayload( "Hello World!".getBytes() );
-
-        // Encode stub into tuple tree then into the accumulator
-        TupleNode node = ExtendedRequestEncoder.INSTANCE.encode( request );
-        encode( ( DefaultMutableTupleNode ) node );
-
-        // Test to see if original stub equals the round trip generated stub
-        assertTrue( request.equals( decode() ) );
+//        ExtendedRequestImpl request = new ExtendedRequestImpl( 23 );
+//        request.setOid( "1.1.1.1" );
+//        request.setPayload( "Hello World!".getBytes() );
+//
+//        // Encode stub into tuple tree then into the accumulator
+//        TupleNode node = ExtendedRequestEncoder.INSTANCE.encode( request );
+//        encode( ( DefaultMutableTupleNode ) node );
+//
+//        // Test to see if original stub equals the round trip generated stub
+//        assertTrue( request.equals( decode() ) );
     }
 }

Modified: incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/modify/ModifyRequestEncoderTest.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/modify/ModifyRequestEncoderTest.java?view=diff&r1=152979&r2=152980
==============================================================================
--- incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/modify/ModifyRequestEncoderTest.java (original)
+++ incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/modify/ModifyRequestEncoderTest.java Tue Feb  8 19:33:42 2005
@@ -17,20 +17,21 @@
 package org.apache.ldap.common.berlib.asn1.encoder.modify;
 
 
-import org.apache.asn1.ber.TupleNode;
 import org.apache.asn1.ber.DefaultMutableTupleNode;
-import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
-import org.apache.ldap.common.berlib.asn1.encoder.modify.ModifyRequestEncoder;
-import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
-
-import org.apache.ldap.common.message.*;
+import org.apache.asn1.ber.TupleNode;
 import org.apache.asn1.codec.DecoderException;
+import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
+import org.apache.ldap.common.message.LockableAttributeImpl;
+import org.apache.ldap.common.message.ModifyRequest;
+import org.apache.ldap.common.message.ModifyRequestImpl;
 
-import javax.naming.directory.ModificationItem;
 import javax.naming.directory.DirContext;
+import javax.naming.directory.ModificationItem;
 
 
 /**
+ * TODO: fix me! Snacc generated PDU doesnt match snickers one
+ *
  * Tests the ModifyRequest encoder.
  *
  * @author <a href="mailto:directory-dev@incubator.apache.org"> Apache Directory
@@ -82,8 +83,22 @@
         // Encode stub into tuple tree then into the accumulator
         TupleNode node = ModifyRequestEncoder.INSTANCE.encode( req );
         encode( ( DefaultMutableTupleNode ) node );
-
-        // Test to see if original stub equals the round trip generated stub
-        assertTrue( req.equals( decode() ) );
+        assertEquals( req, decode() );
     }
+
+    /**
+     * TODO: study differences between snacc and snickers PDUs
+     * PDUs might be equivalent yet different in sub elements order
+     */
+
+//    public void testEncode() throws DecoderException
+//    {
+//        ModifyRequest req = getRequest();
+//        byte[] expected = new byte[] {0x30, 0x76, 0x02, 0x01, 0x2D, 0x66, 0x71, 0x04, 0x19, 0x63, 0x6E, 0x3D, 0x61, 0x64, 0x6D, 0x69, 0x6E, 0x2C, 0x64, 0x63, 0x3D, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2C, 0x64, 0x63, 0x3D, 0x6F, 0x72, 0x67, 0x30, 0x54, 0x30, 0x20, 0x0A, 0x01, 0x00, 0x30, 0x1B, 0x04, 0x05, 0x61, 0x74, 0x74, 0x72, 0x30, 0x31, 0x12, 0x04, 0x04, 0x76, 0x61, 0x6C, 0x32, 0x04, 0x04, 0x76, 0x61, 0x6C, 0x30, 0x04, 0x04, 0x76, 0x61, 0x6C, 0x31, 0x30, 0x14, 0x0A, 0x01, 0x01, 0x30, 0x0F, 0x04, 0x05, 0x61, 0x74, 0x74, 0x72, 0x31, 0x31, 0x06, 0x04, 0x04, 0x76, 0x61, 0x6C, 0x33, 0x30, 0x1A, 0x0A, 0x01, 0x02, 0x30, 0x15, 0x04, 0x05, 0x61, 0x74, 0x74, 0x72, 0x32, 0x31, 0x0C, 0x04, 0x04, 0x76, 0x61, 0x6C, 0x35, 0x04, 0x04, 0x76, 0x61, 0x6C, 0x34};
+//
+//        // Encode stub into tuple tree then into the accumulator
+//        TupleNode node = ModifyRequestEncoder.INSTANCE.encode( req );
+//        encode( ( DefaultMutableTupleNode ) node );
+//        TestUtils.assertEquals( expected, getEncoded() );
+//    }
 }

Modified: incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/modify/ModifyResponseEncoderTest.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/modify/ModifyResponseEncoderTest.java?view=diff&r1=152979&r2=152980
==============================================================================
--- incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/modify/ModifyResponseEncoderTest.java (original)
+++ incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/modify/ModifyResponseEncoderTest.java Tue Feb  8 19:33:42 2005
@@ -17,13 +17,14 @@
 package org.apache.ldap.common.berlib.asn1.encoder.modify;
 
 
-import org.apache.asn1.ber.TupleNode;
 import org.apache.asn1.ber.DefaultMutableTupleNode;
 import org.apache.asn1.ber.TupleNode;
 import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
-import org.apache.ldap.common.berlib.asn1.encoder.modify.ModifyResponseEncoder;
-
-import org.apache.ldap.common.message.*;
+import org.apache.ldap.common.berlib.asn1.decoder.testutils.TestUtils;
+import org.apache.ldap.common.message.LdapResultImpl;
+import org.apache.ldap.common.message.ModifyResponseImpl;
+import org.apache.ldap.common.message.ReferralImpl;
+import org.apache.ldap.common.message.ResultCodeEnum;
 
 
 /**
@@ -51,11 +52,11 @@
         refs.addLdapUrl( "ldap://another.net" );
         result.setReferral( refs );
 
+        byte[] expected = new byte[] {0x30, 0x5D, 0x02, 0x01, 0x2D, 0x67, 0x58, 0x0A, 0x01, 0x00, 0x04, 0x11, 0x64, 0x63, 0x3D, 0x65, 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x2C, 0x64, 0x63, 0x3D, 0x63, 0x6F, 0x6D, 0x04, 0x00, 0xFFFFFFA3, 0x3E, 0x04, 0x15, 0x6C, 0x64, 0x61, 0x70, 0x3A, 0x2F, 0x2F, 0x73, 0x6F, 0x6D, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2E, 0x63, 0x6F, 0x6D, 0x04, 0x12, 0x6C, 0x64, 0x61, 0x70, 0x3A, 0x2F, 0x2F, 0x61, 0x6E, 0x6F, 0x74, 0x68, 0x65, 0x72, 0x2E, 0x6E, 0x65, 0x74, 0x04, 0x11, 0x6C, 0x64, 0x61, 0x70, 0x3A, 0x2F, 0x2F, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2E, 0x6F, 0x72, 0x67};
+
         // Encode stub into tuple tree then into the accumulator
         TupleNode node = ModifyResponseEncoder.INSTANCE.encode( response );
         encode( ( DefaultMutableTupleNode ) node );
-
-        // Test to see if original stub equals the round trip generated stub
-        assertTrue( response.equals( decode() ) );
+        TestUtils.assertEquals( expected, getEncoded() );
     }
 }

Modified: incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/modifyDn/ModifyDnRequestEncoderTest.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/modifyDn/ModifyDnRequestEncoderTest.java?view=diff&r1=152979&r2=152980
==============================================================================
--- incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/modifyDn/ModifyDnRequestEncoderTest.java (original)
+++ incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/modifyDn/ModifyDnRequestEncoderTest.java Tue Feb  8 19:33:42 2005
@@ -17,13 +17,11 @@
 package org.apache.ldap.common.berlib.asn1.encoder.modifyDn;
 
 
-import org.apache.asn1.ber.TupleNode;
 import org.apache.asn1.ber.DefaultMutableTupleNode;
+import org.apache.asn1.ber.TupleNode;
 import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
-import org.apache.ldap.common.berlib.asn1.encoder.modifyDn.ModifyDnRequestEncoder;
-import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
-
-import org.apache.ldap.common.message.*;
+import org.apache.ldap.common.berlib.asn1.decoder.testutils.TestUtils;
+import org.apache.ldap.common.message.ModifyDnRequestImpl;
 
 
 /**
@@ -46,11 +44,11 @@
         request.setNewRdn( "dc=administrators" );
         request.setNewSuperior( "dc=groups,dc=apache,dc=org" );
 
+        byte[] expected = new byte[] {0x30, 0x53, 0x02, 0x01, 0x2D, 0x6C, 0x4E, 0x04, 0x1A, 0x64, 0x63, 0x3D, 0x61, 0x64, 0x6D, 0x69, 0x6E, 0x73, 0x2C, 0x64, 0x63, 0x3D, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2C, 0x64, 0x63, 0x3D, 0x6F, 0x72, 0x67, 0x04, 0x11, 0x64, 0x63, 0x3D, 0x61, 0x64, 0x6D, 0x69, 0x6E, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x6F, 0x72, 0x73, 0x01, 0x01, 0xFFFFFFFF, 0xFFFFFF80, 0x1A, 0x64, 0x63, 0x3D, 0x67, 0x72, 0x6F, 0x75, 0x70, 0x73, 0x2C, 0x64, 0x63, 0x3D, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2C, 0x64, 0x63, 0x3D, 0x6F, 0x72, 0x67};
+
         // Encode stub into tuple tree then into the accumulator
         TupleNode node = ModifyDnRequestEncoder.INSTANCE.encode( request );
         encode( ( DefaultMutableTupleNode ) node );
-
-        // Test to see if original stub equals the round trip generated stub
-        assertTrue( request.equals( decode() ) );
+        TestUtils.assertEquals( expected, getEncoded() );
     }
 }

Modified: incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/modifyDn/ModifyDnResponseEncoderTest.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/modifyDn/ModifyDnResponseEncoderTest.java?view=diff&r1=152979&r2=152980
==============================================================================
--- incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/modifyDn/ModifyDnResponseEncoderTest.java (original)
+++ incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/modifyDn/ModifyDnResponseEncoderTest.java Tue Feb  8 19:33:42 2005
@@ -17,15 +17,14 @@
 package org.apache.ldap.common.berlib.asn1.encoder.modifyDn;
 
 
-import org.apache.asn1.ber.TupleNode;
-import org.apache.asn1.ber.DefaultMutableTupleNode;
-import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
-import org.apache.ldap.common.berlib.asn1.encoder.modifyDn.ModifyDnResponseEncoder;
-import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
-
-import org.apache.ldap.common.message.*;
 import org.apache.asn1.ber.DefaultMutableTupleNode;
 import org.apache.asn1.ber.TupleNode;
+import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
+import org.apache.ldap.common.berlib.asn1.decoder.testutils.TestUtils;
+import org.apache.ldap.common.message.LdapResultImpl;
+import org.apache.ldap.common.message.ModifyDnResponseImpl;
+import org.apache.ldap.common.message.ReferralImpl;
+import org.apache.ldap.common.message.ResultCodeEnum;
 
 
 /**
@@ -53,11 +52,11 @@
         refs.addLdapUrl( "ldap://another.net" );
         result.setReferral( refs );
 
+        byte[] expected = new byte[] {0x30, 0x5D, 0x02, 0x01, 0x2D, 0x6D, 0x58, 0x0A, 0x01, 0x00, 0x04, 0x11, 0x64, 0x63, 0x3D, 0x65, 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x2C, 0x64, 0x63, 0x3D, 0x63, 0x6F, 0x6D, 0x04, 0x00, 0xFFFFFFA3, 0x3E, 0x04, 0x15, 0x6C, 0x64, 0x61, 0x70, 0x3A, 0x2F, 0x2F, 0x73, 0x6F, 0x6D, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2E, 0x63, 0x6F, 0x6D, 0x04, 0x12, 0x6C, 0x64, 0x61, 0x70, 0x3A, 0x2F, 0x2F, 0x61, 0x6E, 0x6F, 0x74, 0x68, 0x65, 0x72, 0x2E, 0x6E, 0x65, 0x74, 0x04, 0x11, 0x6C, 0x64, 0x61, 0x70, 0x3A, 0x2F, 0x2F, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2E, 0x6F, 0x72, 0x67};
+
         // Encode stub into tuple tree then into the accumulator
         TupleNode node = ModifyDnResponseEncoder.INSTANCE.encode( response );
         encode( ( DefaultMutableTupleNode ) node );
-
-        // Test to see if original stub equals the round trip generated stub
-        assertTrue( response.equals( decode() ) );
+        TestUtils.assertEquals( expected, getEncoded() );
     }
 }

Modified: incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/search/SearchRequestEncoderTest.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/search/SearchRequestEncoderTest.java?view=diff&r1=152979&r2=152980
==============================================================================
--- incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/search/SearchRequestEncoderTest.java (original)
+++ incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/search/SearchRequestEncoderTest.java Tue Feb  8 19:33:42 2005
@@ -17,17 +17,14 @@
 package org.apache.ldap.common.berlib.asn1.encoder.search;
 
 
-import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
-import org.apache.ldap.common.berlib.asn1.encoder.search.SearchRequestEncoder;
-import org.apache.asn1.ber.TupleNode;
 import org.apache.asn1.ber.DefaultMutableTupleNode;
-import org.apache.ldap.common.message.SearchRequestImpl;
+import org.apache.asn1.ber.TupleNode;
+import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
+import org.apache.ldap.common.berlib.asn1.decoder.testutils.TestUtils;
+import org.apache.ldap.common.filter.FilterParserImpl;
 import org.apache.ldap.common.message.DerefAliasesEnum;
 import org.apache.ldap.common.message.ScopeEnum;
-import org.apache.ldap.common.filter.FilterParserImpl;
-
-import java.io.IOException;
-import java.text.ParseException;
+import org.apache.ldap.common.message.SearchRequestImpl;
 
 
 /**
@@ -41,38 +38,24 @@
     /**
      * Tests the encode method.
      */
-    public void testEncode()
+    public void testEncode() throws Exception
     {
         FilterParserImpl parser = new FilterParserImpl();
         SearchRequestImpl request = new SearchRequestImpl( 33 );
         request.setBase( "dc=apache,dc=org" );
         request.setDerefAliases( DerefAliasesEnum.DEREFINSEARCHING );
-
-        try
-        {
-            request.setFilter( parser.parse(
+        request.setFilter( parser.parse(
                     "(& (ou=Engineering) (l=Sunnyvale) )" ) );
-        }
-        catch ( IOException e )
-        {
-            e.printStackTrace();
-        }
-        catch ( ParseException e )
-        {
-            e.printStackTrace();
-        }
-
         request.setScope( ScopeEnum.SINGLELEVEL );
         request.setSizeLimit( 12 );
         request.setTimeLimit( 300 );
         request.setTypesOnly( true );
 
+        byte[] expected = new byte[] {0x30, 0x4E, 0x02, 0x01, 0x21, 0x63, 0x49, 0x04, 0x10, 0x64, 0x63, 0x3D, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2C, 0x64, 0x63, 0x3D, 0x6F, 0x72, 0x67, 0x0A, 0x01, 0x01, 0x0A, 0x01, 0x01, 0x02, 0x01, 0x0C, 0x02, 0x02, 0x01, 0x2C, 0x01, 0x01, 0xFFFFFFFF, 0xFFFFFFA0, 0x23, 0xFFFFFFA3, 0x11, 0x04, 0x02, 0x6F, 0x75, 0x04, 0x0B, 0x45, 0x6E, 0x67, 0x69, 0x6E, 0x65, 0x65, 0x72, 0x69, 0x6E, 0x67, 0xFFFFFFA3, 0x0E, 0x04, 0x01, 0x6C, 0x04, 0x09, 0x53, 0x75, 0x6E, 0x6E, 0x79, 0x76, 0x61, 0x6C, 0x65, 0x30, 0x00};
 
         // Encode stub into tuple tree then into the accumulator
         TupleNode node = SearchRequestEncoder.INSTANCE.encode( request );
         encode( ( DefaultMutableTupleNode ) node );
-
-        // Test to see if original stub equals the round trip generated stub
-        assertTrue( request.equals( decode() ) );
+        TestUtils.assertEquals( expected, getEncoded() );
     }
 }

Modified: incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/search/SearchResponseDoneEncoderTest.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/search/SearchResponseDoneEncoderTest.java?view=diff&r1=152979&r2=152980
==============================================================================
--- incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/search/SearchResponseDoneEncoderTest.java (original)
+++ incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/search/SearchResponseDoneEncoderTest.java Tue Feb  8 19:33:42 2005
@@ -17,15 +17,14 @@
 package org.apache.ldap.common.berlib.asn1.encoder.search;
 
 
-import org.apache.asn1.ber.TupleNode;
 import org.apache.asn1.ber.DefaultMutableTupleNode;
+import org.apache.asn1.ber.TupleNode;
 import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
-import org.apache.ldap.common.berlib.asn1.encoder.search.SearchResponseDoneEncoder;
-import org.apache.ldap.common.berlib.asn1.encoder.search.SearchResponseDoneEncoder;
-import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
-
-import org.apache.ldap.common.message.*;
-import org.apache.asn1.ber.DefaultMutableTupleNode;
+import org.apache.ldap.common.berlib.asn1.decoder.testutils.TestUtils;
+import org.apache.ldap.common.message.LdapResultImpl;
+import org.apache.ldap.common.message.ReferralImpl;
+import org.apache.ldap.common.message.ResultCodeEnum;
+import org.apache.ldap.common.message.SearchResponseDoneImpl;
 
 
 /**
@@ -53,11 +52,11 @@
         refs.addLdapUrl( "ldap://another.net" );
         result.setReferral( refs );
 
+        byte[] expected = new byte[] {0x30, 0x5D, 0x02, 0x01, 0x2D, 0x65, 0x58, 0x0A, 0x01, 0x00, 0x04, 0x11, 0x64, 0x63, 0x3D, 0x65, 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x2C, 0x64, 0x63, 0x3D, 0x63, 0x6F, 0x6D, 0x04, 0x00, 0xFFFFFFA3, 0x3E, 0x04, 0x15, 0x6C, 0x64, 0x61, 0x70, 0x3A, 0x2F, 0x2F, 0x73, 0x6F, 0x6D, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2E, 0x63, 0x6F, 0x6D, 0x04, 0x12, 0x6C, 0x64, 0x61, 0x70, 0x3A, 0x2F, 0x2F, 0x61, 0x6E, 0x6F, 0x74, 0x68, 0x65, 0x72, 0x2E, 0x6E, 0x65, 0x74, 0x04, 0x11, 0x6C, 0x64, 0x61, 0x70, 0x3A, 0x2F, 0x2F, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2E, 0x6F, 0x72, 0x67};
+
         // Encode stub into tuple tree then into the accumulator
         TupleNode node = SearchResponseDoneEncoder.INSTANCE.encode( response );
         encode( ( DefaultMutableTupleNode ) node );
-
-        // Test to see if original stub equals the round trip generated stub
-        assertTrue( response.equals( decode() ) );
+        TestUtils.assertEquals( expected, getEncoded() );
     }
 }

Modified: incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/search/SearchResponseEntryEncoderTest.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/search/SearchResponseEntryEncoderTest.java?view=diff&r1=152979&r2=152980
==============================================================================
--- incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/search/SearchResponseEntryEncoderTest.java (original)
+++ incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/search/SearchResponseEntryEncoderTest.java Tue Feb  8 19:33:42 2005
@@ -17,12 +17,11 @@
 package org.apache.ldap.common.berlib.asn1.encoder.search;
 
 
-import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
-import org.apache.ldap.common.berlib.asn1.encoder.search.SearchResponseEntryEncoder;
-import org.apache.asn1.ber.TupleNode;
-import org.apache.asn1.ber.DefaultMutableTupleNode;
-import org.apache.ldap.common.message.*;
 import org.apache.asn1.ber.DefaultMutableTupleNode;
+import org.apache.asn1.ber.TupleNode;
+import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
+import org.apache.ldap.common.message.LockableAttributesImpl;
+import org.apache.ldap.common.message.SearchResponseEntryImpl;
 
 
 /**
@@ -54,4 +53,28 @@
         // Test to see if original stub equals the round trip generated stub
         assertTrue( response.equals( decode() ) );
     }
+
+    /**
+     * TODO: study differences between snacc and snickers PDUs
+     * PDUs might be equivalent yet different in sub elements order
+     */
+//    public void testEncode()
+//    {
+//        // Construct the Search response
+//        SearchResponseEntryImpl response = new SearchResponseEntryImpl( 45 );
+//        response.setObjectName( "dc=example,dc=com" );
+//        LockableAttributesImpl attrs = new LockableAttributesImpl( response );
+//        attrs.put( "objectClass", "top" );
+//        attrs.put( "objectClass", "dcObject" );
+//        attrs.put( "dc", "example.com" );
+//        response.setAttributes( attrs );
+//
+//        byte[] expected = new byte[] {0x30, 0x4F, 0x02, 0x01, 0x2D, 0x64, 0x4A, 0x04, 0x11, 0x64, 0x63, 0x3D, 0x65, 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x2C, 0x64, 0x63, 0x3D, 0x63, 0x6F, 0x6D, 0x30, 0x35, 0x30, 0x1E, 0x04, 0x0B, 0x6F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x43, 0x6C, 0x61, 0x73, 0x73, 0x31, 0x0F, 0x04, 0x03, 0x74, 0x6F, 0x70, 0x04, 0x08, 0x64, 0x63, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x30, 0x13, 0x04, 0x02, 0x64, 0x63, 0x31, 0x0D, 0x04, 0x0B, 0x65, 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x2E, 0x63, 0x6F, 0x6D};
+//
+//        // Encode stub into tuple tree then into the accumulator
+//        TupleNode node = SearchResponseEntryEncoder.INSTANCE.encode( response );
+//        encode( ( DefaultMutableTupleNode ) node );
+//        TestUtils.assertEquals( expected, getEncoded() );
+//    }
+
 }

Modified: incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/search/SearchResponseReferenceEncoderTest.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/search/SearchResponseReferenceEncoderTest.java?view=diff&r1=152979&r2=152980
==============================================================================
--- incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/search/SearchResponseReferenceEncoderTest.java (original)
+++ incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/search/SearchResponseReferenceEncoderTest.java Tue Feb  8 19:33:42 2005
@@ -17,13 +17,12 @@
 package org.apache.ldap.common.berlib.asn1.encoder.search;
 
 
-import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
-import org.apache.ldap.common.berlib.asn1.encoder.search.SearchResponseReferenceEncoder;
-import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
-import org.apache.asn1.ber.TupleNode;
-import org.apache.asn1.ber.DefaultMutableTupleNode;
-import org.apache.ldap.common.message.*;
 import org.apache.asn1.ber.DefaultMutableTupleNode;
+import org.apache.asn1.ber.TupleNode;
+import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
+import org.apache.ldap.common.berlib.asn1.decoder.testutils.TestUtils;
+import org.apache.ldap.common.message.ReferralImpl;
+import org.apache.ldap.common.message.SearchResponseReferenceImpl;
 
 
 /**
@@ -49,12 +48,12 @@
         ref.addLdapUrl( "ldap://openldap.org" );
         ref.addLdapUrl( "ldap://xyz.net" );
 
+        byte[] expected = new byte[] {0x30, 0x4D, 0x02, 0x01, 0x2D, 0x73, 0x48, 0x04, 0x13, 0x6C, 0x64, 0x61, 0x70, 0x3A, 0x2F, 0x2F, 0x6F, 0x70, 0x65, 0x6E, 0x6C, 0x64, 0x61, 0x70, 0x2E, 0x6F, 0x72, 0x67, 0x04, 0x0E, 0x6C, 0x64, 0x61, 0x70, 0x3A, 0x2F, 0x2F, 0x78, 0x79, 0x7A, 0x2E, 0x6E, 0x65, 0x74, 0x04, 0x0E, 0x6C, 0x64, 0x61, 0x70, 0x3A, 0x2F, 0x2F, 0x61, 0x62, 0x63, 0x2E, 0x63, 0x6F, 0x6D, 0x04, 0x11, 0x6C, 0x64, 0x61, 0x70, 0x3A, 0x2F, 0x2F, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2E, 0x6F, 0x72, 0x67};
+
         // Encode stub into tuple tree then into the accumulator
         TupleNode node = SearchResponseReferenceEncoder.
                 INSTANCE.encode( response );
         encode( ( DefaultMutableTupleNode ) node );
-
-        // Test to see if original stub equals the round trip generated stub
-        assertTrue( response.equals( decode() ) );
+        TestUtils.assertEquals( expected, getEncoded() );
     }
 }

Modified: incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/unbind/UnbindRequestEncoderTest.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/unbind/UnbindRequestEncoderTest.java?view=diff&r1=152979&r2=152980
==============================================================================
--- incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/unbind/UnbindRequestEncoderTest.java (original)
+++ incubator/directory/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/unbind/UnbindRequestEncoderTest.java Tue Feb  8 19:33:42 2005
@@ -17,11 +17,10 @@
 package org.apache.ldap.common.berlib.asn1.encoder.unbind;
 
 
-import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
-import org.apache.ldap.common.berlib.asn1.encoder.unbind.UnbindRequestEncoder;
-import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
-import org.apache.asn1.ber.TupleNode;
 import org.apache.asn1.ber.DefaultMutableTupleNode;
+import org.apache.asn1.ber.TupleNode;
+import org.apache.ldap.common.berlib.asn1.encoder.AbstractEncoderTestCase;
+import org.apache.ldap.common.berlib.asn1.decoder.testutils.TestUtils;
 import org.apache.ldap.common.message.UnbindRequestImpl;
 
 
@@ -40,11 +39,11 @@
     {
         UnbindRequestImpl request = new UnbindRequestImpl( 34 );
 
+        byte[] expected = new byte[] {0x30, 0x05, 0x02, 0x01, 0x22, 0x42, 0x00};
+
         // Encode stub into tuple tree then into the accumulator
         TupleNode node = UnbindRequestEncoder.INSTANCE.encode( request );
         encode( ( DefaultMutableTupleNode ) node );
-
-        // Test to see if original stub equals the round trip generated stub
-        assertTrue( request.equals( decode() ) );
+        TestUtils.assertEquals( expected, getEncoded() );
     }
 }



Mime
View raw message