directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: rev 36754 - in incubator/directory/snickers/branches/encoder-redesign/ldap-ber-provider/src/test/org/apache/snickers/ldap/encoder: . bind
Date Mon, 23 Aug 2004 05:19:51 GMT
Author: akarasulu
Date: Sun Aug 22 22:19:50 2004
New Revision: 36754

Modified:
   incubator/directory/snickers/branches/encoder-redesign/ldap-ber-provider/src/test/org/apache/snickers/ldap/encoder/AbstractEncoderTestCase.java
   incubator/directory/snickers/branches/encoder-redesign/ldap-ber-provider/src/test/org/apache/snickers/ldap/encoder/bind/BindResponseEncoderTest.java
Log:
Commit changes ...

 o added setUp and tearDown overrides in base class for clean room operation
 o added extra constructor to base class to have variable sized buffers
 o corrected BindResponseEncoderTest accordingly



Modified: incubator/directory/snickers/branches/encoder-redesign/ldap-ber-provider/src/test/org/apache/snickers/ldap/encoder/AbstractEncoderTestCase.java
==============================================================================
--- incubator/directory/snickers/branches/encoder-redesign/ldap-ber-provider/src/test/org/apache/snickers/ldap/encoder/AbstractEncoderTestCase.java
(original)
+++ incubator/directory/snickers/branches/encoder-redesign/ldap-ber-provider/src/test/org/apache/snickers/ldap/encoder/AbstractEncoderTestCase.java
Sun Aug 22 22:19:50 2004
@@ -44,7 +44,46 @@
         implements EncoderCallback
 {
     /** collects/accumulates the chunks emitted from the encoder */
-    ByteBuffer accumulator = ByteBuffer.wrap( new byte[128] );
+    private ByteBuffer accumulator;
+    /** the max buffer size for the accumulator */
+    private final int bufsz;
+
+
+    /**
+     * Creates a test case with a name and a maximum buffer size.
+     *
+     * @param name the name of the test case
+     * @param bufsz the max size of the buffer
+     */
+    public AbstractEncoderTestCase( String name, int bufsz )
+    {
+        super( name );
+        this.bufsz = bufsz;
+    }
+
+
+    /**
+     *
+     *
+     * @throws Exception
+     */
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+        accumulator = ByteBuffer.wrap( new byte[bufsz] );
+    }
+
+
+    /**
+     * Sets the accumulator to null.
+     *
+     * @throws Exception - from super call
+     */
+    protected void tearDown() throws Exception
+    {
+        super.tearDown();
+        accumulator = null;
+    }
 
 
     /**
@@ -65,7 +104,7 @@
      *
      * @return the decoded LDAP Message envelope
      */
-    public Message decode()
+    protected Message decode()
     {
         Properties env = new Properties();
         env.setProperty( Provider.BERLIB_PROVIDER,
@@ -83,7 +122,7 @@
      *
      * @param node the node to be encoded.
      */
-    public void encode( DefaultMutableTupleNode node )
+    protected void encode( DefaultMutableTupleNode node )
     {
         DeterminateLengthVisitor visitor = new DeterminateLengthVisitor();
         node.accept( visitor );

Modified: incubator/directory/snickers/branches/encoder-redesign/ldap-ber-provider/src/test/org/apache/snickers/ldap/encoder/bind/BindResponseEncoderTest.java
==============================================================================
--- incubator/directory/snickers/branches/encoder-redesign/ldap-ber-provider/src/test/org/apache/snickers/ldap/encoder/bind/BindResponseEncoderTest.java
(original)
+++ incubator/directory/snickers/branches/encoder-redesign/ldap-ber-provider/src/test/org/apache/snickers/ldap/encoder/bind/BindResponseEncoderTest.java
Sun Aug 22 22:19:50 2004
@@ -35,6 +35,15 @@
  */
 public class BindResponseEncoderTest extends AbstractEncoderTestCase
 {
+    public BindResponseEncoderTest( String name )
+    {
+        super( name, 128 );
+    }
+
+
+    /**
+     * Tests the encoder's encode() method.
+     */ 
     public void testEncode()
     {
         // Construct the bind response to test with results and referrals

Mime
View raw message