directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: rev 9449 - in incubator/directory/snickers/trunk/ber: . src/java/org/apache/snickers/asn src/java/org/apache/snickers/ber src/test/org/apache/snickers/ber xdocs
Date Sun, 14 Mar 2004 02:38:54 GMT
Author: akarasulu
Date: Sat Mar 13 18:38:53 2004
New Revision: 9449

Added:
   incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/AbstractDecoderTestCaseTest.java
   incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/DefaultMutableTupleNodeTest.java
Removed:
   incubator/directory/snickers/trunk/ber/xdocs/decoder-design.xml
Modified:
   incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/asn/TLV.java
   incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/asn/TLVParsingUtility.java
   incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/AbstractDecoderTestCase.java
   incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/BERUtils.java
   incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/DefaultMutableTupleNode.java
   incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/Tuple.java
   incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/BERDecoderStateTest.java
   incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/BERUtilsTest.java
   incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/IntStackTest.java
   incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/TupleTest.java
   incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/TupleTreeDecoderTest.java
   incubator/directory/snickers/trunk/ber/todo.txt
Log:
caught some bugs while turning clover green

Modified: incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/asn/TLV.java
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/asn/TLV.java	(original)
+++ incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/asn/TLV.java	Sat Mar
13 18:38:53 2004
@@ -208,7 +208,7 @@
      * @return the type class
      */
     public TypeClass getTypeClass() {
-        return BERUtils.getTypeClass( tag );
+        return BERUtils.getTypeClass( (byte) tag );
     }
 
     /**

Modified: incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/asn/TLVParsingUtility.java
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/asn/TLVParsingUtility.java
(original)
+++ incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/asn/TLVParsingUtility.java
Sat Mar 13 18:38:53 2004
@@ -103,7 +103,7 @@
             
             int id = tag & (Binary.BIT_4 | Binary.BIT_3 | Binary.BIT_2 | Binary.BIT_1
| Binary.BIT_0 );
             boolean primative =  BERUtils.isPrimitive(tag);
-            TypeClass tc = BERUtils.getTypeClass(tag);
+            TypeClass tc = BERUtils.getTypeClass((byte)tag);
             
             System.out.println( strIndent + ">>>>>>>>>>>>>>
TLV <<<<<<<<<<<<<" );
             System.out.println( strIndent + "Tag:  " + toBits(tag) );

Modified: incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/AbstractDecoderTestCase.java
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/AbstractDecoderTestCase.java
(original)
+++ incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/AbstractDecoderTestCase.java
Sat Mar 13 18:38:53 2004
@@ -98,6 +98,13 @@
     public byte[][] fragment( byte[] bites, int size )
     {
         byte[][] fragments = null ;
+        
+        if ( size <= 0 )
+        {    
+            throw new IllegalArgumentException( 
+                    "fragment size should be 1 or more but was " + size ) ;
+        }
+        
         int wholeFrags = bites.length/size ;
         int partialFragSize = bites.length % size ; 
 

Modified: incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/BERUtils.java
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/BERUtils.java
(original)
+++ incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/BERUtils.java
Sat Mar 13 18:38:53 2004
@@ -53,18 +53,6 @@
 
 
     /**
-     * Gets the ASN.1 type's class using a TLV tag.
-     * 
-     * @param octet the first octet of the TLV
-     * @return the TypeClass enumeration for the ASN.1 type's class
-     */
-    public final static TypeClass getTypeClass( int octet )
-    {
-        return TypeClass.getTypeClass( ( byte ) octet ) ;
-    }
-    
-
-    /**
      * Checks to see if the TLV is constructed.
      * 
      * @param octet the first octet of the TLV

Modified: incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/DefaultMutableTupleNode.java
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/DefaultMutableTupleNode.java
(original)
+++ incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/DefaultMutableTupleNode.java
Sat Mar 13 18:38:53 2004
@@ -188,11 +188,24 @@
             
             if ( tuple.isIndefinate() )
             {    
+                TupleNode child = null ;
                 for ( int ii = 0; ii < children.size(); ii++ )
                 {
-                    TupleNode child = ( TupleNode ) children.get( ii ) ;
+                    child = ( TupleNode ) children.get( ii ) ;
                     size += child.size() ;
                 }
+                
+                if ( child != null )
+                {
+                    if ( ! child.getTuple().isIndefinateTerminator() )
+                    {
+                        size += 2 ;
+                    }
+                }
+                else
+                {
+                    size += 2 ;
+                }
             }
 
             return size ;
@@ -230,7 +243,7 @@
             child.encode( dest ) ;
         }
         
-        if ( child == null )
+        if ( child != null )
         {
             Tuple childTuple = child.getTuple() ;
             if ( childTuple.isIndefinateTerminator() )
@@ -355,7 +368,7 @@
      */
     public boolean isLeaf()
     {
-        if ( tuple.isPrimitive() )
+        if ( tuple != null && tuple.isPrimitive() )
         {    
             return true ;
         }

Modified: incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/Tuple.java
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/Tuple.java	(original)
+++ incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/Tuple.java	Sat
Mar 13 18:38:53 2004
@@ -210,17 +210,6 @@
     
     
     /**
-     * Gets the length component or field (L-part) for this TLV Tuple.
-     * 
-     * @return the length field for this TLV Tuple
-     */
-    public int getLength()
-    {
-        return length ;
-    }
-    
-    
-    /**
      * Get's whether or not this tuples's length is indefinate.
      * 
      * @return whether or not this tuple's length is indefinate
@@ -261,7 +250,7 @@
      * 
      * @return the length in bytes of the value field for this TLV tuple
      */
-    public int getValueLength()
+    public int getLength()
     {
         return length ;
     }

Added: incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/AbstractDecoderTestCaseTest.java
==============================================================================
--- (empty file)
+++ incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/AbstractDecoderTestCaseTest.java
Sat Mar 13 18:38:53 2004
@@ -0,0 +1,137 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.snickers.ber ;
+
+
+import org.apache.commons.lang.ArrayUtils ;
+
+
+/**
+ * Tests the base test class functions.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class AbstractDecoderTestCaseTest extends AbstractDecoderTestCase
+{
+    
+    public AbstractDecoderTestCaseTest()
+    {
+        super ( AbstractDecoderTestCaseTest.class.getName() ) ; 
+    }
+
+    public void testFragment()
+    {
+        byte[] all = new byte[3] ;
+        assertEquals( 1, fragment(all, 3).length) ;
+        try
+        {
+            fragment(ArrayUtils.EMPTY_BYTE_ARRAY, 0) ;
+            fail( "should have thrown exception before reaching this line" ) ;
+        }
+        catch( IllegalArgumentException e )
+        {
+            assertNotNull( e ) ;
+        }
+    }
+
+    /*
+     * Class to test for Tuple decode(byte)
+     */
+    public void testDecodebyte() throws Exception
+    {
+        decode( ( byte ) 1 ) ;
+        decode( ( byte ) 1 ) ;
+        Tuple t = decode( ( byte ) 1 ) ;
+        assertEquals( 1, t.id ) ;
+        assertEquals( 1, t.length ) ;
+    }
+
+    /*
+     * Class to test for Tuple decode(Tuple[])
+     */
+    public void testDecodeTupleArray() throws Exception
+    {
+        Tuple [] tuples = new Tuple[2] ;
+        tuples[0] = new Tuple(1, ArrayUtils.EMPTY_BYTE_ARRAY ) ;
+        tuples[1] = new Tuple(1, ArrayUtils.EMPTY_BYTE_ARRAY ) ;
+        decode(tuples) ;
+        
+        decode( new Tuple[0] ) ;
+    }
+
+    public void testCallbackOccured() throws Exception
+    {
+        decoder.setDecoderMonitor( this ) ;
+        Tuple [] tuples = new Tuple[2] ;
+        tuples[0] = new Tuple(1, ArrayUtils.EMPTY_BYTE_ARRAY ) ;
+        tuples[1] = new Tuple(1, ArrayUtils.EMPTY_BYTE_ARRAY ) ;
+        decode(tuples) ;
+        callbackOccured(decoder, this, tuples[1]) ;
+    }
+
+    public void testCallbackSet()
+    {
+        decoder.setCallback(this) ;
+        callbackSet(decoder, this, this) ;
+    }
+
+    public void testError()
+    {
+        try
+        {
+            error( decoder, new Exception() ) ;
+            fail("should not get here") ;
+        }
+        catch ( Throwable e )
+        {
+            assertNotNull( e ) ;
+        }
+    }
+
+    public void testFatalError()
+    {
+        try
+        {
+            fatalError( decoder, new Exception() ) ;
+            fail("should not get here") ;
+        }
+        catch ( Throwable e )
+        {
+            assertNotNull( e ) ;
+        }
+    }
+
+    public void testMonitorSet()
+    {
+        monitorSet( decoder, this ) ;
+    }
+
+    public void testWarning()
+    {
+        try
+        {
+            warning( decoder, new Exception() ) ;
+            fail("should not get here") ;
+        }
+        catch ( Throwable e )
+        {
+            assertNotNull( e ) ;
+        }
+    }
+}

Modified: incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/BERDecoderStateTest.java
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/BERDecoderStateTest.java
(original)
+++ incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/BERDecoderStateTest.java
Sat Mar 13 18:38:53 2004
@@ -112,6 +112,8 @@
                 BERDecoderState.getState("length") ) ;
         assertEquals( BERDecoderState.TAG, 
                 BERDecoderState.getState("TAG") ) ;
+        assertEquals( BERDecoderState.TAG, 
+                BERDecoderState.getState("Tag") ) ;
         assertEquals( BERDecoderState.VALUE, 
                 BERDecoderState.getState("value") ) ;
         

Modified: incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/BERUtilsTest.java
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/BERUtilsTest.java
(original)
+++ incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/BERUtilsTest.java
Sat Mar 13 18:38:53 2004
@@ -17,8 +17,8 @@
 package org.apache.snickers.ber ;
 
 
-import org.apache.commons.codec.DecoderException;
-import org.apache.commons.codec.binary.Binary;
+import org.apache.commons.codec.binary.Binary ;
+import org.apache.commons.collections.primitives.ArrayByteList ;
 
 import junit.framework.TestCase ;
 
@@ -64,6 +64,11 @@
     }
     
     
+    public void getTypeClass()
+    {
+        assertEquals( TypeClass.UNIVERSAL, BERUtils.getTypeClass( (byte) 0 ) ) ;
+    }
+    
     public void testIsPrimitive() throws Exception
     {
         byte octet = Binary.BIT_5 ;
@@ -180,50 +185,66 @@
             }
         }
         
-        octets = new byte[7] ;
-        octets[0] = 31 ;
-        octets[1] = 1 ;
-        octets[2] = 0 ;
-        octets[3] = 0 ;
-        octets[4] = 0 ;
-        octets[5] = 0 ;   
-        octets[6] = 0 ;
-        
+        ArrayByteList list = new ArrayByteList() ;
+        list.add( (byte)1) ;
+        assertEquals( 1, BERUtils.getTagId( list ) ) ;
+
+        list.add( (byte)1) ;
+        list.add( (byte)1) ;
+        list.add( (byte)1) ;
+        list.add( (byte)1) ;
+        list.add( (byte)1) ;
+        list.add( (byte)1) ;
+        list.add( (byte)1) ;
+        list.add( (byte)1) ;
         try
         {
-            BERUtils.getTagId( octets ) ;
-            fail( "the line above should blow and exception" ) ;
+            BERUtils.getTagId( list ) ;
+            fail( "should fail before getting here" ) ;
         }
-        catch( DecoderException e )
+        catch ( Throwable t )
         {
-            assertNotNull( e ) ;
+            assertNotNull( t ) ;
         }
 
-        /* loop takes too long but it works
-        octets = new byte[6] ;
-        octets[0] = 31 ;
-        octets[1] = 0 ;
-        octets[2] = 0 ;
-        octets[3] = 0 ;
-        octets[4] = 0 ;
-        octets[5] = 0 ;   
+    
+        try
+        {
+            BERUtils.getTagId( new byte[56] ) ;
+            fail( "should fail before getting here" ) ;
+        }
+        catch ( Throwable t )
+        {
+            assertNotNull( t ) ;
+        }
+    }
+    
+    
+    public void testGetLength() throws Exception
+    {
+        ArrayByteList list = new ArrayByteList() ;
+        list.add( (byte) 0x1 ) ;
+        list.add( (byte) 0x1 ) ;
+        list.add( (byte) 0x1 ) ;
+        list.add( (byte) 0x1 ) ;
+        list.add( (byte) 0x1 ) ;
+        list.add( (byte) 0x1 ) ;
+        list.add( (byte) 0x1 ) ;
+        list.add( (byte) 0x1 ) ;
         
-        for ( int ii = 2097152 ; ii < 269435456 ; ii++ )
+        try
         {
-            octets[1] = ( byte ) ( ii & BERUtils.LONG_TAG_MASK ) ;
-            octets[2] = ( byte ) ( ( ii >> 7 ) & BERUtils.LONG_TAG_MASK ) ;
-            octets[3] = ( byte ) ( ( ii >> 14 ) & BERUtils.LONG_TAG_MASK ) ;
-            octets[4] = ( byte ) ( ( ii >> 21 ) & BERUtils.LONG_TAG_MASK ) ;
-            
-            if ( ii < 268435456 ) 
-            {
-                assertEquals( BERUtils.getTagId( octets ), ii ) ;
-            }
-            else
-            {
-                assertTrue( BERUtils.getTagId( octets ) != ii ) ;
-            }
+            BERUtils.getLength( list ) ;
+            fail( "should fail before we get here" ) ;
         }
-        */
+        catch ( Throwable t )
+        {
+            assertNotNull( t ) ;
+        }
+        
+        
+        list.clear() ;
+        list.add(( byte ) 0x7 ) ;
+        assertEquals( 7, BERUtils.getLength( list ) ) ;
     }
 }

Added: incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/DefaultMutableTupleNodeTest.java
==============================================================================
--- (empty file)
+++ incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/DefaultMutableTupleNodeTest.java
Sat Mar 13 18:38:53 2004
@@ -0,0 +1,506 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.snickers.ber ;
+
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Enumeration;
+
+import javax.swing.tree.MutableTreeNode;
+
+import org.apache.commons.codec.stateful.DecoderCallback;
+import org.apache.commons.codec.stateful.StatefulDecoder;
+import org.apache.commons.lang.ArrayUtils;
+
+
+/**
+ * Tests the default MutableTupleNode implementation.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class DefaultMutableTupleNodeTest extends AbstractDecoderTestCase
+{
+    public DefaultMutableTupleNodeTest()
+    {
+        super ( DefaultMutableTupleNodeTest.class.getName() ) ; 
+    }
+
+
+    /*
+     * Class to test for void DefaultMutableTupleNode()
+     */
+    public void testDefaultMutableTupleNode()
+    {
+        DefaultMutableTupleNode node = new DefaultMutableTupleNode() ;
+        assertNotNull( node ) ;
+    }
+
+    /*
+     * Class to test for void DefaultMutableTupleNode(Tuple)
+     */
+    public void testDefaultMutableTupleNodeTuple()
+    {
+    }
+
+    /*
+     * Class to test for void insert(MutableTupleNode, int)
+     */
+    public void testInsertMutableTupleNodeint()
+    {
+    }
+
+    /*
+     * Class to test for void remove(int)
+     */
+    public void testRemoveint()
+    {
+        DefaultMutableTupleNode parent = new DefaultMutableTupleNode() ;
+        DefaultMutableTupleNode node = new DefaultMutableTupleNode() ;
+        parent.insert( (MutableTupleNode) node, 0 ) ;
+        assertEquals(1,parent.getChildCount()) ;
+        parent.remove( 0 ) ;
+        assertEquals(0,parent.getChildCount()) ;
+    }
+
+    /*
+     * Class to test for void remove(MutableTupleNode)
+     */
+    public void testRemoveMutableTupleNode()
+    {
+        DefaultMutableTupleNode parent = new DefaultMutableTupleNode() ;
+        DefaultMutableTupleNode node = new DefaultMutableTupleNode() ;
+        parent.insert( (MutableTupleNode) node, 0 ) ;
+        assertEquals(1,parent.getChildCount()) ;
+        parent.remove( (MutableTupleNode) node ) ;
+        assertEquals(0,parent.getChildCount()) ;
+
+        parent.insert( (MutableTreeNode) node, 0 ) ;
+        assertEquals(1,parent.getChildCount()) ;
+        parent.remove( (MutableTreeNode) node ) ;
+        assertEquals(0,parent.getChildCount()) ;
+    }
+
+    public void testRemoveFromParent()
+    {
+        DefaultMutableTupleNode parent = new DefaultMutableTupleNode() ;
+        DefaultMutableTupleNode node = new DefaultMutableTupleNode() ;
+        parent.insert( (MutableTupleNode) node, 0 ) ;
+        node.setParent( (MutableTupleNode) parent) ;
+        
+        assertEquals(1,parent.getChildCount()) ;
+        node.removeFromParent() ;
+        assertEquals(0,parent.getChildCount()) ;
+    }
+
+    /*
+     * Class to test for void setParent(MutableTupleNode)
+     */
+    public void testSetParentMutableTupleNode()
+    {
+        DefaultMutableTupleNode parent = new DefaultMutableTupleNode() ;
+        DefaultMutableTupleNode node = new DefaultMutableTupleNode() ;
+        parent.insert( (MutableTupleNode) node, 0 ) ;
+        node.setParent( (MutableTupleNode) parent) ;
+        assertEquals(parent, node.getParent()) ;
+        node.setParent((MutableTupleNode)new DefaultMutableTupleNode()) ;
+        assertNotSame(parent, node.getParent()) ;
+    }
+
+    /*
+     * Class to test for void setParent(MutableTupleNode)
+     */
+    public void testSetParentMutableTreeNode()
+    {
+        DefaultMutableTupleNode parent = new DefaultMutableTupleNode() ;
+        DefaultMutableTupleNode node = new DefaultMutableTupleNode() ;
+        parent.insert( (MutableTreeNode) node, 0 ) ;
+        node.setParent( (MutableTreeNode) parent) ;
+        assertEquals(parent, node.getParent()) ;
+        node.setParent((MutableTreeNode)new DefaultMutableTupleNode()) ;
+        assertNotSame(parent, node.getParent()) ;
+    }
+
+    public void testSetTuple()
+    {
+        Tuple t = new Tuple() ;
+        DefaultMutableTupleNode node = new DefaultMutableTupleNode() ;
+        node.setTuple( t ) ;
+        assertEquals(t, node.getTuple()) ;
+    }
+
+    public void testGetParentTupleNode()
+    {
+        DefaultMutableTupleNode parent = new DefaultMutableTupleNode() ;
+        DefaultMutableTupleNode node = new DefaultMutableTupleNode() ;
+        parent.insert( (MutableTupleNode) node, 0 ) ;
+        node.setParent( (MutableTupleNode) parent) ;
+        assertSame(parent, node.getParentTupleNode()) ;
+        assertSame(parent, node.getParent()) ;
+    }
+
+    public void testGetChildren()
+    {
+        DefaultMutableTupleNode parent = new DefaultMutableTupleNode() ;
+        DefaultMutableTupleNode node = new DefaultMutableTupleNode() ;
+        parent.insert( (MutableTupleNode) node, 0 ) ;
+        node.setParent( (MutableTupleNode) parent) ;
+        assertSame(parent, node.getParentTupleNode()) ;
+        assertTrue( parent.getChildren().hasNext()) ;
+    }
+
+    
+    public void testGetChildTupleNodeAt()
+    {
+    }
+
+    /*
+     * Class to test for int getIndex(TupleNode)
+     */
+    public void testGetIndexTupleNode()
+    {
+        DefaultMutableTupleNode parent = new DefaultMutableTupleNode() ;
+        DefaultMutableTupleNode node = new DefaultMutableTupleNode() ;
+        parent.insert( (MutableTupleNode) node, 0 ) ;
+        node.setParent( (MutableTupleNode) parent) ;
+        assertEquals( 0, parent.getIndex((MutableTupleNode)node));
+        assertEquals( 0, parent.getIndex((MutableTreeNode)node));
+    }
+
+    public void testGetChildCount()
+    {
+    }
+
+    public void testSize()
+    {
+        DefaultMutableTupleNode parent = new DefaultMutableTupleNode() ;
+        DefaultMutableTupleNode node = new DefaultMutableTupleNode() ;
+        parent.insert( (MutableTupleNode) node, 0 ) ;
+        node.setParent( (MutableTupleNode) parent) ;
+        
+        Tuple primitive = new Tuple( 1, new byte[3] ) ;
+        Tuple constructed = new Tuple ( 2, TypeClass.APPLICATION ) ;
+        parent.setTuple( constructed ) ;
+        node.setTuple( primitive ) ;
+        
+        // fact that we use the indefinate form we automatically add two to
+        // the contained size
+        assertEquals(9, parent.size()) ;
+    }
+
+    public void testSize2()
+    {
+        DefaultMutableTupleNode parent = new DefaultMutableTupleNode() ;
+        DefaultMutableTupleNode node = new DefaultMutableTupleNode() ;
+        parent.insert( (MutableTupleNode) node, 0 ) ;
+        node.setParent( (MutableTupleNode) parent) ;
+        
+        Tuple primitive = new Tuple( 1, new byte[3] ) ;
+        Tuple constructed = new Tuple ( 2, 5, TypeClass.APPLICATION ) ;
+        parent.setTuple( constructed ) ;
+        node.setTuple( primitive ) ;
+        
+        assertEquals(7, parent.size()) ;
+    }
+
+    public void testSize3()
+    {
+        DefaultMutableTupleNode parent = new DefaultMutableTupleNode() ;
+        Tuple constructed = new Tuple ( 2, TypeClass.APPLICATION ) ;
+        parent.setTuple( constructed ) ;
+        
+        assertEquals(4, parent.size()) ;
+    }
+
+    public void testEncode3() throws Exception
+    {
+        DefaultMutableTupleNode parent = new DefaultMutableTupleNode() ;
+        Tuple constructed = new Tuple ( 2, TypeClass.APPLICATION ) ;
+        parent.setTuple( constructed ) ;
+        
+        assertEquals(4, parent.size()) ;
+        
+        ByteBuffer buf = ByteBuffer.allocate( 4 ) ;
+        parent.encode( buf ) ;
+
+        final ArrayList list = new ArrayList() ;
+        TupleTreeDecoder decoder = new TupleTreeDecoder() ;
+        decoder.setCallback( new DecoderCallback(){
+            public void decodeOccurred(StatefulDecoder arg0, Object arg1)
+            {
+                list.add( arg1 ) ;
+            }}) ;
+        
+        decoder.decode(buf.flip()) ;
+        DefaultMutableTupleNode decoded = ( DefaultMutableTupleNode ) 
+            list.get(0); 
+        assertEquals( decoded.getTuple(), parent.getTuple()) ;
+    }
+
+    public void testGetTuple()
+    {
+        Tuple t = new Tuple() ;
+        DefaultMutableTupleNode node = new DefaultMutableTupleNode() ;
+        node.setTuple(t) ;
+        assertSame(t, node.getTuple()) ;
+    }
+
+    public void testEncode0() throws Exception
+    {
+        DefaultMutableTupleNode parent = new DefaultMutableTupleNode() ;
+        DefaultMutableTupleNode node = new DefaultMutableTupleNode() ;
+        DefaultMutableTupleNode end = new DefaultMutableTupleNode() ;
+        parent.insert( (MutableTupleNode) end, 0 ) ;
+        end.setParent( (MutableTupleNode) parent) ;
+        parent.insert( (MutableTupleNode) node, 0 ) ;
+        node.setParent( (MutableTupleNode) parent) ;
+        
+        Tuple primitive = new Tuple( 1, new byte[3] ) ;
+        Tuple constructed = new Tuple ( 2, TypeClass.APPLICATION ) ;
+        Tuple terminator = new Tuple( 0, true, ArrayUtils.EMPTY_BYTE_ARRAY) ;
+        terminator.typeClass = TypeClass.UNIVERSAL ;
+        parent.setTuple( constructed ) ;
+        node.setTuple( primitive ) ;
+        end.setTuple(terminator) ;
+        
+        assertEquals(9, parent.size()) ;
+        
+        ByteBuffer buf = ByteBuffer.allocate( 9 ) ;
+        parent.encode( buf ) ;
+
+        final ArrayList list = new ArrayList() ;
+        TupleTreeDecoder decoder = new TupleTreeDecoder() ;
+        decoder.setCallback( new DecoderCallback(){
+            public void decodeOccurred(StatefulDecoder arg0, Object arg1)
+            {
+                list.add( arg1 ) ;
+            }}) ;
+        
+        decoder.decode(buf.flip()) ;
+        DefaultMutableTupleNode decoded = ( DefaultMutableTupleNode ) 
+            list.get(0); 
+        assertEquals( decoded.getTuple(), parent.getTuple()) ;
+    }
+
+    public void testEncode1() throws Exception
+    {
+        DefaultMutableTupleNode parent = new DefaultMutableTupleNode() ;
+        DefaultMutableTupleNode node = new DefaultMutableTupleNode() ;
+        parent.insert( (MutableTupleNode) node, 0 ) ;
+        node.setParent( (MutableTupleNode) parent) ;
+        
+        Tuple primitive = new Tuple( 1, new byte[3] ) ;
+        Tuple constructed = new Tuple ( 2, TypeClass.APPLICATION ) ;
+        parent.setTuple( constructed ) ;
+        node.setTuple( primitive ) ;
+        
+        // 2 extra bytes added for indefinate form
+        assertEquals(9, parent.size()) ;
+        
+        ByteBuffer buf = ByteBuffer.allocate( 9 ) ;
+        parent.encode( buf ) ;
+
+        final ArrayList list = new ArrayList() ;
+        TupleTreeDecoder decoder = new TupleTreeDecoder() ;
+        decoder.setCallback( new DecoderCallback(){
+            public void decodeOccurred(StatefulDecoder arg0, Object arg1)
+            {
+                list.add( arg1 ) ;
+            }}) ;
+        
+        decoder.decode(buf.flip()) ;
+        DefaultMutableTupleNode decoded = ( DefaultMutableTupleNode ) 
+            list.get(0); 
+        assertEquals( decoded.getTuple(), parent.getTuple()) ;
+    }
+
+    public void testEncode2() throws Exception
+    {
+        DefaultMutableTupleNode top = new DefaultMutableTupleNode() ;
+        DefaultMutableTupleNode middle = new DefaultMutableTupleNode() ;
+        DefaultMutableTupleNode bottom = new DefaultMutableTupleNode() ;
+        top.insert( (MutableTupleNode) middle, 0 ) ;
+        middle.setParent( (MutableTupleNode) top) ;
+        middle.insert( (MutableTupleNode) bottom, 0 ) ;
+        bottom.setParent( (MutableTupleNode) middle) ;
+        
+        Tuple middleTuple = new Tuple( 1, 3, TypeClass.APPLICATION  ) ;
+        Tuple topTuple = new Tuple ( 2, 5, TypeClass.APPLICATION ) ;
+        Tuple bottomTuple = new Tuple( 3, new byte[1]) ;
+        
+        bottomTuple.typeClass = TypeClass.UNIVERSAL ;
+        top.setTuple( topTuple ) ;
+        middle.setTuple( middleTuple ) ;
+        bottom.setTuple( bottomTuple ) ;
+        
+        assertEquals(7, top.size()) ;
+        
+        ByteBuffer buf = ByteBuffer.allocate( 7 ) ;
+        top.encode( buf ) ;
+
+        final ArrayList list = new ArrayList() ;
+        TupleTreeDecoder decoder = new TupleTreeDecoder() ;
+        decoder.setCallback( new DecoderCallback(){
+            public void decodeOccurred(StatefulDecoder arg0, Object arg1)
+            {
+                list.add( arg1 ) ;
+            }}) ;
+        
+        decoder.decode(buf.flip()) ;
+        DefaultMutableTupleNode decoded = ( DefaultMutableTupleNode ) 
+            list.get(0); 
+        assertEquals( decoded.getTuple(), top.getTuple()) ;
+    }
+
+    /*
+     * Class to test for String toString()
+     */
+    public void testToString()
+    {
+    }
+
+    public void testPrintDepthFirst()
+    {
+    }
+
+    public void testChildren()
+    {
+        DefaultMutableTupleNode parent = new DefaultMutableTupleNode() ;
+        DefaultMutableTupleNode node = new DefaultMutableTupleNode() ;
+        DefaultMutableTupleNode end = new DefaultMutableTupleNode() ;
+        parent.insert( (MutableTupleNode) end, 0 ) ;
+        end.setParent( (MutableTupleNode) parent) ;
+        parent.insert( (MutableTupleNode) node, 0 ) ;
+        node.setParent( (MutableTupleNode) parent) ;
+        
+        Tuple primitive = new Tuple( 1, new byte[3] ) ;
+        Tuple constructed = new Tuple ( 2, TypeClass.APPLICATION ) ;
+        Tuple terminator = new Tuple( 0, true, ArrayUtils.EMPTY_BYTE_ARRAY) ;
+        terminator.typeClass = TypeClass.UNIVERSAL ;
+        parent.setTuple( constructed ) ;
+        node.setTuple( primitive ) ;
+        end.setTuple(terminator) ;
+        
+        Enumeration list = parent.children() ;
+        
+        assertEquals( node, list.nextElement() ) ;
+        assertEquals( end, list.nextElement() ) ;
+        
+        try
+        {
+            list.nextElement() ;
+            fail( "should never get here due to thrown exception" ) ;
+        }
+        catch( Throwable t ) 
+        {
+            assertNotNull( t ) ;
+        }
+    }
+
+    public void testGetAllowsChildren()
+    {
+        DefaultMutableTupleNode parent = new DefaultMutableTupleNode() ;
+        DefaultMutableTupleNode node = new DefaultMutableTupleNode() ;
+        DefaultMutableTupleNode end = new DefaultMutableTupleNode() ;
+        parent.insert( (MutableTupleNode) end, 0 ) ;
+        end.setParent( (MutableTupleNode) parent) ;
+        parent.insert( (MutableTupleNode) node, 0 ) ;
+        node.setParent( (MutableTupleNode) parent) ;
+        
+        Tuple primitive = new Tuple( 1, new byte[3] ) ;
+        Tuple constructed = new Tuple ( 2, TypeClass.APPLICATION ) ;
+        Tuple terminator = new Tuple( 0, true, ArrayUtils.EMPTY_BYTE_ARRAY) ;
+        terminator.typeClass = TypeClass.UNIVERSAL ;
+        parent.setTuple( constructed ) ;
+        node.setTuple( primitive ) ;
+        end.setTuple(terminator) ;
+        
+        assertFalse( end.getAllowsChildren() ) ;
+        assertFalse( node.getAllowsChildren() ) ;
+        assertTrue( parent.getAllowsChildren() ) ;
+    }
+
+    public void testGetChildAt()
+    {
+    }
+
+    /*
+     * Class to test for int getIndex(TreeNode)
+     */
+    public void testGetIndexTreeNode()
+    {
+    }
+
+    public void testGetParent()
+    {
+    }
+
+    /*
+     * Class to test for void insert(MutableTreeNode, int)
+     */
+    public void testInsertMutableTreeNodeint()
+    {
+    }
+
+    public void testIsLeaf0()
+    {
+        DefaultMutableTupleNode parent = new DefaultMutableTupleNode() ;
+        assertTrue( parent.isLeaf() ) ;
+    }
+
+    public void testIsLeaf1()
+    {
+        DefaultMutableTupleNode parent = new DefaultMutableTupleNode() ;
+        parent.setTuple(new Tuple()) ;
+        assertTrue( parent.isLeaf() ) ;
+    }
+
+    public void testIsLeaf2()
+    {
+        DefaultMutableTupleNode parent = new DefaultMutableTupleNode() ;
+        DefaultMutableTupleNode node = new DefaultMutableTupleNode() ;
+        DefaultMutableTupleNode end = new DefaultMutableTupleNode() ;
+        parent.insert( (MutableTupleNode) end, 0 ) ;
+        end.setParent( (MutableTupleNode) parent) ;
+        parent.insert( (MutableTupleNode) node, 0 ) ;
+        node.setParent( (MutableTupleNode) parent) ;
+        
+        Tuple primitive = new Tuple( 1, new byte[3] ) ;
+        Tuple constructed = new Tuple ( 2, TypeClass.APPLICATION ) ;
+        Tuple terminator = new Tuple( 0, true, ArrayUtils.EMPTY_BYTE_ARRAY) ;
+        terminator.typeClass = TypeClass.UNIVERSAL ;
+        parent.setTuple( constructed ) ;
+        node.setTuple( primitive ) ;
+        end.setTuple(terminator) ;
+        
+        assertFalse( parent.isLeaf() ) ;
+    }
+
+    /*
+     * Class to test for void remove(MutableTreeNode)
+     */
+    public void testRemoveMutableTreeNode()
+    {
+    }
+
+    public void testSetUserObject()
+    {
+        DefaultMutableTupleNode node = new DefaultMutableTupleNode() ;
+        node.setUserObject( new Tuple() ) ;
+    }
+}

Modified: incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/IntStackTest.java
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/IntStackTest.java
(original)
+++ incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/IntStackTest.java
Sat Mar 13 18:38:53 2004
@@ -17,7 +17,7 @@
 package org.apache.snickers.ber ;
 
 
-import java.util.EmptyStackException;
+import java.util.EmptyStackException ;
 
 import junit.framework.TestCase ;
 
@@ -146,5 +146,6 @@
         assertEquals( 1, stack.search( 0 ) ) ;
         stack.push( 0 ) ;
         assertEquals( 3, stack.search( 1 ) ) ;
+        assertEquals( -1, stack.search( 44 ) ) ;
     }
 }

Modified: incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/TupleTest.java
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/TupleTest.java
(original)
+++ incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/TupleTest.java
Sat Mar 13 18:38:53 2004
@@ -123,14 +123,14 @@
         assertEquals( 2, t.getId() ) ;
         assertEquals( TypeClass.PRIVATE, t.getTypeClass() ) ;
         assertEquals( true, t.isPrimitive() ) ;
-        assertEquals( 0, t.getValueLength() ) ;
+        assertEquals( 0, t.getLength() ) ;
         assertEquals( ArrayUtils.EMPTY_BYTE_ARRAY, t.getValue() ) ;
 
         t = new Tuple( 2, TypeClass.PRIVATE, true, null ) ;
         assertEquals( 2, t.getId() ) ;
         assertEquals( TypeClass.PRIVATE, t.getTypeClass() ) ;
         assertEquals( true, t.isPrimitive() ) ;
-        assertEquals( 0, t.getValueLength() ) ;
+        assertEquals( 0, t.getLength() ) ;
         assertEquals( ArrayUtils.EMPTY_BYTE_ARRAY, t.getValue() ) ;
 
         byte[] bites = new byte[7] ;
@@ -138,14 +138,14 @@
         assertEquals( 2, t.getId() ) ;
         assertEquals( TypeClass.APPLICATION, t.getTypeClass() ) ;
         assertEquals( false, t.isPrimitive() ) ;
-        assertEquals( 7, t.getValueLength() ) ;
+        assertEquals( 7, t.getLength() ) ;
         assertEquals( bites, t.getValue() ) ;
         
         t = new Tuple( 2, null, false,  null ) ; 
         assertEquals( 2, t.getId() ) ;
         assertEquals( TypeClass.APPLICATION, t.getTypeClass() ) ;
         assertEquals( false, t.isPrimitive() ) ;
-        assertEquals( 0, t.getValueLength() ) ;
+        assertEquals( 0, t.getLength() ) ;
         assertEquals( ArrayUtils.EMPTY_BYTE_ARRAY, t.getValue() ) ;
     }
 
@@ -158,7 +158,7 @@
         assertEquals( 2, t.getId() ) ;
         assertEquals( TypeClass.APPLICATION, t.getTypeClass() ) ;
         assertEquals( true, t.isPrimitive() ) ;
-        assertEquals( 0, t.getValueLength() ) ;
+        assertEquals( 0, t.getLength() ) ;
         assertEquals( ArrayUtils.EMPTY_BYTE_ARRAY, t.getValue() ) ;
         
         byte[] bites = new byte[5] ;
@@ -166,7 +166,7 @@
         assertEquals( 2, t.getId() ) ;
         assertEquals( TypeClass.APPLICATION, t.getTypeClass() ) ;
         assertEquals( true, t.isPrimitive() ) ;
-        assertEquals( 5, t.getValueLength() ) ;
+        assertEquals( 5, t.getLength() ) ;
         assertEquals( bites, t.getValue() ) ;
     }
 
@@ -179,7 +179,7 @@
         assertEquals( 2, t.getId() ) ;
         assertEquals( TypeClass.APPLICATION, t.getTypeClass() ) ;
         assertEquals( false, t.isPrimitive() ) ;
-        assertEquals( 0, t.getValueLength() ) ;
+        assertEquals( 0, t.getLength() ) ;
         assertEquals( ArrayUtils.EMPTY_BYTE_ARRAY, t.getValue() ) ;
         
         byte[] bites = new byte[5] ;
@@ -187,7 +187,7 @@
         assertEquals( 2, t.getId() ) ;
         assertEquals( TypeClass.APPLICATION, t.getTypeClass() ) ;
         assertEquals( false, t.isPrimitive() ) ;
-        assertEquals( 5, t.getValueLength() ) ;
+        assertEquals( 5, t.getLength() ) ;
         assertEquals( bites, t.getValue() ) ;
     }
 
@@ -200,14 +200,14 @@
         assertEquals( 2, t.getId() ) ;
         assertEquals( TypeClass.PRIVATE, t.getTypeClass() ) ;
         assertEquals( false, t.isPrimitive() ) ;
-        assertEquals( BERDecoder.INDEFINATE, t.getValueLength() ) ;
+        assertEquals( BERDecoder.INDEFINATE, t.getLength() ) ;
         assertEquals( ArrayUtils.EMPTY_BYTE_ARRAY, t.getValue() ) ;
 
         t = new Tuple( 2, (TypeClass) null ) ;
         assertEquals( 2, t.getId() ) ;
         assertEquals( TypeClass.APPLICATION, t.getTypeClass() ) ;
         assertEquals( false, t.isPrimitive() ) ;
-        assertEquals( BERDecoder.INDEFINATE, t.getValueLength() ) ;
+        assertEquals( BERDecoder.INDEFINATE, t.getLength() ) ;
         assertEquals( ArrayUtils.EMPTY_BYTE_ARRAY, t.getValue() ) ;
     }
 
@@ -220,6 +220,54 @@
         t.id = 21 ;
         assertEquals( 21, t.getId() ) ;
     }
+    
+    
+    public void testSize()
+    {
+        Tuple t = new Tuple( 1, TypeClass.APPLICATION ) ;
+        assertEquals( 2, t.size() ) ;
+        t.id = 32 ;
+        assertEquals( 3, t.size() ) ;
+        t.id = 127 ;
+        assertEquals( 3, t.size() ) ;
+        t.id = 128 ;
+        assertEquals( 4, t.size() ) ;
+        t.id = 1 << 14 ;
+        assertEquals( 5, t.size() ) ;
+        t.id = 1 << 21 ;
+        assertEquals( 6, t.size() ) ;
+        
+        t.length = 127 ;
+        assertEquals( 6+127, t.size() ) ;
+        t.length = 128 ;
+        assertEquals( 7+128, t.size() ) ;
+        t.length = 255 ;
+        assertEquals( 7+255, t.size() ) ;
+        t.length = 256 ;
+        assertEquals( 8+256, t.size() ) ;
+    }
+    
+    
+    public void testIsIndefinate()
+    {
+        Tuple t = new Tuple() ;
+        assertFalse( t.isIndefinate() ) ;
+        t.length = BERDecoder.INDEFINATE ;
+        assertTrue( t.isIndefinate() ) ;
+    }
+    
+
+    public void testIsIndefinateTerminator()
+    {
+        Tuple t = new Tuple() ;
+        assertFalse( t.isIndefinateTerminator() ) ;
+        t.id = 0 ;
+        t.length = 0 ;
+        t.isPrimitive = true ;
+        t.typeClass = TypeClass.UNIVERSAL ;
+        assertTrue( t.isIndefinateTerminator() ) ;
+    }
+    
 
     public void testIsPrimitive()
     {
@@ -232,11 +280,11 @@
     public void testGetLength()
     {
         Tuple t = new Tuple() ;
-        assertEquals( 0, t.getValueLength() ) ;
+        assertEquals( 0, t.getLength() ) ;
         t = new Tuple( 1, 2 ) ;
-        assertEquals( 2, t.getValueLength() ) ;
+        assertEquals( 2, t.getLength() ) ;
         t.length = 21 ;
-        assertEquals( 21, t.getValueLength() ) ;
+        assertEquals( 21, t.getLength() ) ;
     }
 
     public void testGetTypeClass()

Modified: incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/TupleTreeDecoderTest.java
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/TupleTreeDecoderTest.java
(original)
+++ incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/TupleTreeDecoderTest.java
Sat Mar 13 18:38:53 2004
@@ -14,22 +14,30 @@
  *   limitations under the License.
  *
  */
-package org.apache.snickers.ber;
+package org.apache.snickers.ber ;
 
-import java.io.ByteArrayOutputStream;
-import java.math.BigInteger;
-import java.nio.ByteBuffer;
-
-import org.apache.commons.codec.stateful.DecoderCallback;
-import org.apache.commons.codec.stateful.StatefulDecoder;
-import org.apache.commons.lang.time.StopWatch;
-import org.apache.ldap.common.message.BindRequestImpl;
-import org.apache.ldap.common.message.MessageEncoder;
 
-import junit.framework.TestCase;
+import java.io.ByteArrayOutputStream ;
+
+import java.math.BigInteger ;
+
+import java.nio.ByteBuffer ;
+
+import org.apache.commons.codec.stateful.DecoderCallback ;
+import org.apache.commons.codec.stateful.DecoderMonitorAdapter;
+import org.apache.commons.codec.stateful.StatefulDecoder ;
+
+import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang.time.StopWatch ;
+
+import org.apache.ldap.common.message.MessageEncoder ;
+import org.apache.ldap.common.message.BindRequestImpl ;
+
+import junit.framework.TestCase ;
+
 
 /**
- * $todo$ doc me
+ * Tests the TupleTreeDecoder.
  *
  * @author <a href="mailto:directory-dev@incubator.apache.org">
  * Apache Directory Project</a>
@@ -45,6 +53,22 @@
         
         try { test.testTTD() ; } catch ( Exception e ) { e.printStackTrace() ; } 
     }
+    
+    public void testSetMonitor()
+    {
+        TupleTreeDecoder decoder = new TupleTreeDecoder() ;
+        decoder.setDecoderMonitor( null ) ;
+        decoder.setDecoderMonitor( new DecoderMonitorAdapter() ) ;
+    }
+    
+    
+    public void testTTD2() throws Exception
+    {
+        TupleTreeDecoder decoder = new TupleTreeDecoder() ;
+        decoder.handleTuple(new Tuple( 1, ArrayUtils.EMPTY_BYTE_ARRAY )) ;
+        decoder.decode( ByteBuffer.wrap( new Tuple( 1, 
+                                ArrayUtils.EMPTY_BYTE_ARRAY ).encode() ) ) ;
+    }    
     
     public void testTTD() throws Exception
     {

Modified: incubator/directory/snickers/trunk/ber/todo.txt
==============================================================================
--- incubator/directory/snickers/trunk/ber/todo.txt	(original)
+++ incubator/directory/snickers/trunk/ber/todo.txt	Sat Mar 13 18:38:53 2004
@@ -3,6 +3,7 @@
                                 T O D O   L I S T 
                                 =================
 
+* Need an equality test for TupleNodes hence trees.
 
 * For the mock decoder in Eve see if we can rig in a decoder that builds on this
   BERDecoder that can at a bare minimum detect when an LDAP message starts and 

Mime
View raw message