Return-Path: Delivered-To: apmail-incubator-directory-cvs-archive@www.apache.org Received: (qmail 16681 invoked from network); 2 Mar 2005 15:14:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 2 Mar 2005 15:14:51 -0000 Received: (qmail 12720 invoked by uid 500); 2 Mar 2005 15:14:50 -0000 Delivered-To: apmail-incubator-directory-cvs-archive@incubator.apache.org Received: (qmail 12678 invoked by uid 500); 2 Mar 2005 15:14:50 -0000 Mailing-List: contact directory-cvs-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: directory-dev@incubator.apache.org Delivered-To: mailing list directory-cvs@incubator.apache.org Received: (qmail 12664 invoked by uid 99); 2 Mar 2005 15:14:50 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Wed, 02 Mar 2005 07:14:49 -0800 Received: (qmail 16621 invoked by uid 65534); 2 Mar 2005 15:14:48 -0000 Message-ID: <20050302151448.16619.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailer: svnmailer-1.0.0-dev Date: Wed, 02 Mar 2005 15:14:47 -0000 Subject: svn commit: r155926 [2/2] - in incubator/directory/asn1/trunk: ber/src/java/org/apache/asn1/ber/ ber/src/java/org/apache/asn1/ber/digester/rules/ ber/src/test/org/apache/asn1/ber/ ber/src/test/org/apache/asn1/ber/digester/rules/ ber/xdocs/ codec/src/java/org/apache/asn1/codec/stateful/ xdocs/ To: directory-cvs@incubator.apache.org From: adc@apache.org X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Modified: incubator/directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/D= efaultMutableTupleNodeTest.java URL: http://svn.apache.org/viewcvs/incubator/directory/asn1/trunk/ber/src/t= est/org/apache/asn1/ber/DefaultMutableTupleNodeTest.java?view=3Ddiff&r1=3D1= 55925&r2=3D155926 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/Default= MutableTupleNodeTest.java (original) +++ incubator/directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/Default= MutableTupleNodeTest.java Wed Mar 2 07:14:39 2005 @@ -1,5 +1,5 @@ /* - * Copyright 2004 The Apache Software Foundation + * Copyright 2004-2005 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. @@ -37,7 +37,7 @@ { public DefaultMutableTupleNodeTest() { - super ( DefaultMutableTupleNodeTest.class.getName() ) ;=20 + super ( DefaultMutableTupleNodeTest.class.getName() ) ; } =20 =20 @@ -85,7 +85,7 @@ DefaultMutableTupleNode node =3D new DefaultMutableTupleNode() ; parent.insert( (MutableTupleNode) node, 0 ) ; node.setParent( (MutableTupleNode) parent) ; - =20 + assertEquals(1,parent.getChildCount()) ; node.removeFromParent() ; assertEquals(0,parent.getChildCount()) ; @@ -147,7 +147,7 @@ assertTrue( parent.getChildren().hasNext()) ; } =20 - =20 + public void testGetChildTupleNodeAt() { } @@ -175,13 +175,13 @@ DefaultMutableTupleNode node =3D new DefaultMutableTupleNode() ; parent.insert( (MutableTupleNode) node, 0 ) ; node.setParent( (MutableTupleNode) parent) ; - =20 + Tuple primitive =3D new Tuple( 1, 3, true, TypeClass.APPLICATION )= ; Tuple constructed =3D new Tuple ( 2, TypeClass.APPLICATION ) ; parent.setTuple( constructed ) ; node.setTuple( primitive ) ; - =20 - // fact that we use the indefinate form we automatically add two to + + // fact that we use the indefinite form we automatically add two to // the contained size assertEquals(9, parent.size()) ; } @@ -192,12 +192,12 @@ DefaultMutableTupleNode node =3D new DefaultMutableTupleNode() ; parent.insert( (MutableTupleNode) node, 0 ) ; node.setParent( (MutableTupleNode) parent) ; - =20 + Tuple primitive =3D new Tuple( 1, 3, true, TypeClass.APPLICATION )= ; Tuple constructed =3D new Tuple ( 2, 5, TypeClass.APPLICATION ) ; parent.setTuple( constructed ) ; node.setTuple( primitive ) ; - =20 + assertEquals(7, parent.size()) ; } =20 @@ -206,7 +206,7 @@ DefaultMutableTupleNode parent =3D new DefaultMutableTupleNode() ; Tuple constructed =3D new Tuple ( 2, TypeClass.APPLICATION ) ; parent.setTuple( constructed ) ; - =20 + assertEquals(4, parent.size()) ; } =20 @@ -219,7 +219,7 @@ ByteBuffer buf =3D ByteBuffer.allocate( 4 ) ; parent.encode( buf ) ; =20 - =20 + /* final ArrayList list =3D new ArrayList() ; TupleTreeDecoder decoder =3D new TupleTreeDecoder() ; @@ -228,10 +228,10 @@ { list.add( arg1 ) ; }}) ; - =20 + decoder.decode(buf.flip()) ; - DefaultMutableTupleNode decoded =3D ( DefaultMutableTupleNode )=20 - list.get(0);=20 + DefaultMutableTupleNode decoded =3D ( DefaultMutableTupleNode ) + list.get(0); assertEquals( decoded.getTuple(), parent.getTuple()) ; */ } @@ -248,13 +248,13 @@ { DefaultMutableTupleNode parent =3D new DefaultMutableTupleNode() ; DefaultMutableTupleNode node =3D new DefaultMutableTupleNode() ; - =20 + DefaultMutableTupleNode end =3D new DefaultMutableTupleNode() ; parent.insert( (MutableTupleNode) end, 0 ) ; end.setParent( (MutableTupleNode) parent) ; parent.insert( (MutableTupleNode) node, 0 ) ; node.setParent( (MutableTupleNode) parent) ; - =20 + Tuple primitive =3D new Tuple( 1, 3, true, TypeClass.APPLICATION )= ; Tuple constructed =3D new Tuple ( 2, TypeClass.APPLICATION ) ; Tuple terminator =3D new Tuple( 0, 0, true, TypeClass.UNIVERSAL ) ; @@ -262,9 +262,9 @@ parent.setTuple( constructed ) ; node.setTuple( primitive ) ; end.setTuple(terminator) ; - =20 + assertEquals(9, parent.size()) ; - =20 + ByteBuffer buf =3D ByteBuffer.allocate( 9 ) ; parent.encode( buf ) ; =20 @@ -276,10 +276,10 @@ { list.add( arg1 ) ; }}) ; - =20 + decoder.decode(buf.flip()) ; - DefaultMutableTupleNode decoded =3D ( DefaultMutableTupleNode )=20 - list.get(0);=20 + DefaultMutableTupleNode decoded =3D ( DefaultMutableTupleNode ) + list.get(0); assertEquals( decoded.getTuple(), parent.getTuple()) ; */ } @@ -290,15 +290,15 @@ DefaultMutableTupleNode node =3D new DefaultMutableTupleNode() ; parent.insert( (MutableTupleNode) node, 0 ) ; node.setParent( (MutableTupleNode) parent) ; - =20 + Tuple primitive =3D new Tuple( 1, 3, true, TypeClass.APPLICATION )= ; Tuple constructed =3D new Tuple ( 2, TypeClass.APPLICATION ) ; parent.setTuple( constructed ) ; node.setTuple( primitive ) ; - =20 - // 2 extra bytes added for indefinate form + + // 2 extra bytes added for indefinite form assertEquals(9, parent.size()) ; - =20 + ByteBuffer buf =3D ByteBuffer.allocate( 9 ) ; parent.encode( buf ) ; =20 @@ -310,10 +310,10 @@ { list.add( arg1 ) ; }}) ; - =20 + decoder.decode(buf.flip()) ; - DefaultMutableTupleNode decoded =3D ( DefaultMutableTupleNode )=20 - list.get(0);=20 + DefaultMutableTupleNode decoded =3D ( DefaultMutableTupleNode ) + list.get(0); assertEquals( decoded.getTuple(), parent.getTuple()) ; */ } @@ -327,18 +327,18 @@ middle.setParent( (MutableTupleNode) top) ; middle.insert( (MutableTupleNode) bottom, 0 ) ; bottom.setParent( (MutableTupleNode) middle) ; - =20 + Tuple middleTuple =3D new Tuple( 1, 3, TypeClass.APPLICATION ) ; Tuple topTuple =3D new Tuple ( 2, 5, TypeClass.APPLICATION ) ; Tuple bottomTuple =3D new Tuple( 3, 1, true, TypeClass.APPLICATION= ) ; - =20 + bottomTuple.typeClass =3D TypeClass.UNIVERSAL ; top.setTuple( topTuple ) ; middle.setTuple( middleTuple ) ; bottom.setTuple( bottomTuple ) ; - =20 + assertEquals(7, top.size()) ; - =20 + ByteBuffer buf =3D ByteBuffer.allocate( 7 ) ; top.encode( buf ) ; =20 @@ -350,15 +350,15 @@ { list.add( arg1 ) ; }}) ; - =20 + decoder.decode(buf.flip()) ; - DefaultMutableTupleNode decoded =3D ( DefaultMutableTupleNode )=20 - list.get(0);=20 + DefaultMutableTupleNode decoded =3D ( DefaultMutableTupleNode ) + list.get(0); assertEquals( decoded.getTuple(), top.getTuple()) ; */ } =20 - =20 + public void testEquals() { DefaultMutableTupleNode top =3D new DefaultMutableTupleNode() ; @@ -368,18 +368,18 @@ middle.setParent( (MutableTupleNode) top) ; middle.insert( (MutableTupleNode) bottom, 0 ) ; bottom.setParent( (MutableTupleNode) middle) ; - =20 + Tuple middleTuple =3D new Tuple( 1, 3, TypeClass.APPLICATION ) ; Tuple topTuple =3D new Tuple ( 2, 5, TypeClass.APPLICATION ) ; Tuple bottomTuple =3D new Tuple( 3, 1, true, TypeClass.APPLICATION= ) ; - =20 + bottomTuple.typeClass =3D TypeClass.UNIVERSAL ; top.setTuple( topTuple ) ; middle.setTuple( middleTuple ) ; bottom.setTuple( bottomTuple ) ; =20 assertTrue( top.equals( top ) ) ; - =20 + DefaultMutableTupleNode topClone =3D new DefaultMutableTupleNode()= ; topClone.setTuple( topTuple ) ; assertFalse( top.equals(topClone)) ; @@ -387,7 +387,7 @@ topClone =3D new DefaultMutableTupleNode() ; topClone.setTuple( bottomTuple ) ; assertFalse( top.equals(topClone)) ; - =20 + topClone =3D new DefaultMutableTupleNode() ; DefaultMutableTupleNode middleClone =3D new DefaultMutableTupleNod= e() ; DefaultMutableTupleNode bottomClone =3D new DefaultMutableTupleNod= e() ; @@ -395,11 +395,11 @@ middleClone.setParent( (MutableTupleNode) topClone) ; middleClone.insert( (MutableTupleNode) bottomClone, 0 ) ; bottomClone.setParent( (MutableTupleNode) middleClone) ; - =20 + Tuple middleTupleClone =3D new Tuple( 1, 3, TypeClass.APPLICATION = ) ; Tuple topTupleClone =3D new Tuple ( 2, 5, TypeClass.APPLICATION ) ; Tuple bottomTupleClone=3D new Tuple( 3, 1, true, TypeClass.APPLICA= TION ) ; - =20 + bottomTupleClone.typeClass =3D TypeClass.UNIVERSAL ; topClone.setTuple( topTupleClone ) ; middleClone.setTuple( middleTupleClone ) ; @@ -409,8 +409,8 @@ assertTrue( middle.equals( middleClone ) ) ; assertTrue( top.equals( topClone ) ) ; } - =20 - =20 + + public void testEquals2() { DefaultMutableTupleNode top =3D new DefaultMutableTupleNode() ; @@ -420,11 +420,11 @@ middle.setParent( (MutableTupleNode) top) ; middle.insert( (MutableTupleNode) bottom, 0 ) ; bottom.setParent( (MutableTupleNode) middle) ; - =20 + Tuple middleTuple =3D new Tuple( 1, 3, TypeClass.APPLICATION ) ; Tuple topTuple =3D new Tuple ( 2, 5, TypeClass.APPLICATION ) ; Tuple bottomTuple =3D new Tuple( 3, 1, true, TypeClass.APPLICATION= ) ; - =20 + bottomTuple.typeClass =3D TypeClass.UNIVERSAL ; top.setTuple( topTuple ) ; middle.setTuple( middleTuple ) ; @@ -433,7 +433,7 @@ assertTrue( top.equals( top ) ) ; =20 top.printDepthFirst(new StringBuffer(), 0 ) ; - =20 + DefaultMutableTupleNode topClone =3D new DefaultMutableTupleNode()= ; topClone.setTuple( topTuple ) ; assertFalse( top.equals(topClone)) ; @@ -441,7 +441,7 @@ topClone =3D new DefaultMutableTupleNode() ; topClone.setTuple( bottomTuple ) ; assertFalse( top.equals(topClone)) ; - =20 + topClone =3D new DefaultMutableTupleNode() ; DefaultMutableTupleNode middleClone =3D new DefaultMutableTupleNod= e() ; DefaultMutableTupleNode bottomClone =3D new DefaultMutableTupleNod= e() ; @@ -449,11 +449,11 @@ middleClone.setParent( (MutableTupleNode) topClone) ; middleClone.insert( (MutableTupleNode) bottomClone, 0 ) ; bottomClone.setParent( (MutableTupleNode) middleClone) ; - =20 + Tuple middleTupleClone =3D new Tuple( 1, 3, TypeClass.APPLICATION = ) ; Tuple topTupleClone =3D new Tuple ( 2, 5, TypeClass.APPLICATION ) ; Tuple bottomTupleClone=3D new Tuple( 3, 1, true, TypeClass.APPLICA= TION ) ; - =20 + bottomTupleClone.typeClass =3D TypeClass.UNIVERSAL ; topClone.setTuple( topTupleClone ) ; middleClone.setTuple( bottomTupleClone ) ; @@ -465,8 +465,8 @@ assertFalse( top.equals( new Object() ) ) ; assertFalse( top.equals( null ) ) ; } - =20 - =20 + + /* * Class to test for String toString() */ @@ -479,7 +479,7 @@ end.setParent( parent) ; parent.insert( node, 0 ) ; node.setParent( parent) ; - =20 + Tuple primitive =3D new Tuple( 1, 3, true, TypeClass.APPLICATION )= ; Tuple constructed =3D new Tuple ( 2, TypeClass.APPLICATION ) ; Tuple terminator =3D new Tuple( 0, 0, true, TypeClass.UNIVERSAL ) ; @@ -487,7 +487,7 @@ parent.setTuple( constructed ) ; node.setTuple( primitive ) ; end.setTuple( terminator ) ; - =20 + assertNotNull( parent.toString() ) ; } =20 @@ -500,7 +500,7 @@ end.setParent( parent) ; parent.insert( node, 0 ) ; node.setParent( parent) ; - =20 + Tuple primitive =3D new Tuple( 1, 3, true, TypeClass.APPLICATION )= ; Tuple constructed =3D new Tuple ( 2, TypeClass.APPLICATION ) ; Tuple terminator =3D new Tuple( 0, 0, true, TypeClass.UNIVERSAL ) ; @@ -508,7 +508,7 @@ parent.setTuple( constructed ) ; node.setTuple( primitive, Collections.EMPTY_LIST ) ; end.setTuple( terminator ) ; - =20 + assertTrue( node.getValueChunks().isEmpty() ) ; =20 =20 @@ -525,7 +525,7 @@ end.setParent( parent) ; parent.insert( node, 0 ) ; node.setParent( parent) ; - =20 + Tuple primitive =3D new Tuple( 1, 3, true, TypeClass.APPLICATION )= ; Tuple constructed =3D new Tuple ( 2, TypeClass.APPLICATION ) ; Tuple terminator =3D new Tuple( 0, 0, true, TypeClass.UNIVERSAL ) ; @@ -533,18 +533,18 @@ parent.setTuple( constructed ) ; node.setTuple( primitive ) ; end.setTuple( terminator ) ; - =20 + Iterator list =3D parent.getChildren() ; - =20 + assertEquals( node, list.next() ) ; assertEquals( end, list.next() ) ; - =20 + try { list.next() ; fail( "should never get here due to thrown exception" ) ; } - catch( Throwable t )=20 + catch( Throwable t ) { assertNotNull( t ) ; } @@ -559,7 +559,7 @@ end.setParent( parent) ; parent.insert( node, 0 ) ; node.setParent( parent) ; - =20 + Tuple primitive =3D new Tuple( 1, 3, true, TypeClass.APPLICATION )= ; Tuple constructed =3D new Tuple ( 2, TypeClass.APPLICATION ) ; Tuple terminator =3D new Tuple( 0, 0, true, TypeClass.UNIVERSAL ) ; @@ -578,7 +578,7 @@ end.setParent( parent) ; parent.addFront( node ) ; node.setParent( parent) ; - =20 + Tuple primitive =3D new Tuple( 1, 3, true, TypeClass.APPLICATION )= ; Tuple constructed =3D new Tuple ( 2, TypeClass.APPLICATION ) ; Tuple terminator =3D new Tuple( 0, 0, true, TypeClass.UNIVERSAL ) ; @@ -589,7 +589,7 @@ parent.toDepthFirstString() ; } =20 - =20 + public void testAddLast() { DefaultMutableTupleNode parent =3D new DefaultMutableTupleNode() ; @@ -599,7 +599,7 @@ node.setParent( (MutableTupleNode) parent) ; parent.addLast( end ) ; end.setParent( (MutableTupleNode) parent) ; - =20 + Tuple primitive =3D new Tuple( 1, 3, true, TypeClass.APPLICATION )= ; Tuple constructed =3D new Tuple ( 2, TypeClass.APPLICATION ) ; Tuple terminator =3D new Tuple( 0, 0, true, TypeClass.UNIVERSAL ) ; Modified: incubator/directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/T= upleTest.java URL: http://svn.apache.org/viewcvs/incubator/directory/asn1/trunk/ber/src/t= est/org/apache/asn1/ber/TupleTest.java?view=3Ddiff&r1=3D155925&r2=3D155926 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/TupleTe= st.java (original) +++ incubator/directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/TupleTe= st.java Wed Mar 2 07:14:39 2005 @@ -1,5 +1,5 @@ /* - * Copyright 2004 The Apache Software Foundation + * Copyright 2004-2005 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. @@ -142,14 +142,14 @@ assertEquals( 2, t.getId() ) ; assertEquals( TypeClass.PRIVATE, t.getTypeClass() ) ; assertEquals( false, t.isPrimitive() ) ; - assertEquals( Length.INDEFINATE, t.getLength() ) ; + assertEquals( Length.INDEFINITE, t.getLength() ) ; assertEquals( EMPTY_BUFFER, t.getLastValueChunk() ) ; =20 t =3D new Tuple( 2, (TypeClass) null ) ; assertEquals( 2, t.getId() ) ; assertEquals( TypeClass.APPLICATION, t.getTypeClass() ) ; assertEquals( false, t.isPrimitive() ) ; - assertEquals( Length.INDEFINATE, t.getLength() ) ; + assertEquals( Length.INDEFINITE, t.getLength() ) ; assertEquals( EMPTY_BUFFER, t.getLastValueChunk() ) ; } =20 @@ -162,8 +162,8 @@ t.id =3D 21 ; assertEquals( 21, t.getId() ) ; } - =20 - =20 + + public void testSize() { Tuple t =3D new Tuple( 1, TypeClass.APPLICATION ) ; @@ -178,7 +178,7 @@ assertEquals( 5, t.size() ) ; t.id =3D 1 << 21 ; assertEquals( 6, t.size() ) ; - =20 + t.length =3D 127 ; assertEquals( 6+127, t.size() ) ; t.length =3D 128 ; @@ -188,28 +188,28 @@ t.length =3D 256 ; assertEquals( 8+256, t.size() ) ; } - =20 - =20 - public void testIsIndefinate() + + + public void testIsIndefinite() { Tuple t =3D new Tuple() ; - assertFalse( t.isIndefinate() ) ; - t.length =3D Length.INDEFINATE ; - assertTrue( t.isIndefinate() ) ; + assertFalse( t.isIndefinite() ) ; + t.length =3D Length.INDEFINITE ; + assertTrue( t.isIndefinite() ) ; } - =20 =20 - public void testIsIndefinateTerminator() + + public void testIsIndefiniteTerminator() { Tuple t =3D new Tuple() ; - assertFalse( t.isIndefinateTerminator() ) ; + assertFalse( t.isIndefiniteTerminator() ) ; t.id =3D 0 ; t.length =3D 0 ; t.isPrimitive =3D true ; t.typeClass =3D TypeClass.UNIVERSAL ; - assertTrue( t.isIndefinateTerminator() ) ; + assertTrue( t.isIndefiniteTerminator() ) ; } - =20 + =20 public void testIsPrimitive() { @@ -300,13 +300,13 @@ Tuple tnull1 =3D new Tuple() ; tnull1.valueChunk =3D null ; tnull0.equals( tnull1 ) ; - =20 + tnull1.equals( tnull1 ) ; tnull0.equals( tnull0 ) ; - =20 + Tuple t0 =3D new Tuple() ; Tuple t1 =3D ( Tuple ) t0.clone() ; - =20 + assertTrue( t0.equals( t1 ) ) ; t0.id =3D 23 ; assertFalse( t0.equals( t1 ) ) ; @@ -346,10 +346,10 @@ =20 t0.valueChunk =3D ByteBuffer.allocate( 4 ) ; t1.valueChunk =3D null ; - =20 + // The buffer does not factor into equality assertTrue( t0.equals( t1 ) ) ; - =20 + t1 =3D ( Tuple ) t0.clone() ; assertTrue( t0.equals( t1 ) ) ; =20 @@ -567,13 +567,13 @@ , toAsciiString( encoded ) ) ; } =20 - =20 + public String toAsciiString( ByteBuffer buf ) { return BinaryCodec.toAsciiString( buf.array() ) ; } - =20 - =20 + + public void testSetTagBufferint() { ByteBuffer bites =3D ByteBuffer.allocate( 1 ) ; @@ -581,7 +581,7 @@ t.setTag( bites, 1 ) ; String binary =3D toAsciiString( bites ) ; assertEquals( "01100000", binary ) ; - =20 + bites =3D ByteBuffer.allocate( 1 ) ; t =3D new Tuple( 30, 0 ) ; t.setTag( bites, 1 ) ; @@ -617,8 +617,8 @@ t =3D new Tuple( BIT_13 - 1, 0 ) ; t.setTag( bites, 3 ) ; binary =3D toAsciiString( bites ) ; - assertEquals( "01111111" +=20 - "11111111" +=20 + assertEquals( "01111111" + + "11111111" + "01111111", binary ) ; =20 bites =3D ByteBuffer.allocate( 4 ) ; @@ -627,7 +627,7 @@ binary =3D toAsciiString( bites ) ; assertEquals( "00000000" + "10000000" + - "10000001" +=20 + "10000001" + "01111111", binary ) ; =20 bites =3D ByteBuffer.allocate( 4 ) ; @@ -636,16 +636,16 @@ binary =3D toAsciiString( bites ) ; assertEquals( "00000001" + "10000000" + - "10000001" +=20 + "10000001" + "01111111", binary ) ; =20 bites =3D ByteBuffer.allocate( 4 ) ; t =3D new Tuple( BIT_20 - 1, 0 ) ; t.setTag( bites, 4 ) ; binary =3D toAsciiString( bites ) ; - assertEquals( "01111111" +=20 - "11111111" +=20 - "11111111" +=20 + assertEquals( "01111111" + + "11111111" + + "11111111" + "01111111", binary ) ; =20 bites =3D ByteBuffer.allocate( 5 ) ; @@ -655,7 +655,7 @@ assertEquals( "00000000" + "10000000" + "10000000" + - "10000001" +=20 + "10000001" + "01111111", binary ) ; =20 bites =3D ByteBuffer.allocate( 5 ) ; @@ -665,22 +665,22 @@ assertEquals( "00000001" + "10000000" + "10000000" + - "10000001" +=20 + "10000001" + "01111111", binary ) ; =20 bites =3D ByteBuffer.allocate( 5 ) ; t =3D new Tuple( BIT_27 - 1, 0 ) ; t.setTag( bites, 5 ) ; binary =3D toAsciiString( bites ) ; - assertEquals( "01111111" +=20 - "11111111" +=20 - "11111111" +=20 - "11111111" +=20 + assertEquals( "01111111" + + "11111111" + + "11111111" + + "11111111" + "01111111", binary ) ; =20 bites =3D ByteBuffer.allocate( 6 ) ; t =3D new Tuple( BIT_27, 0 ) ; - =20 + try { t.setTag( bites, 6 ) ; @@ -699,7 +699,7 @@ t.setTag( bites, 1 ) ; String binary =3D toAsciiString( bites ) ; assertEquals( "01100000", binary ) ; - =20 + bites =3D ByteBuffer.allocate( 1 ) ; t =3D new Tuple( 30, 0 ) ; t.setTag( bites, 1 ) ; @@ -735,8 +735,8 @@ t =3D new Tuple( BIT_13 - 1, 0 ) ; t.setTag( bites, 3 ) ; binary =3D toAsciiString( bites ) ; - assertEquals( "01111111" +=20 - "11111111" +=20 + assertEquals( "01111111" + + "11111111" + "01111111", binary ) ; =20 bites =3D ByteBuffer.allocate( 4 ) ; @@ -745,7 +745,7 @@ binary =3D toAsciiString( bites ) ; assertEquals( "00000000" + "10000000" + - "10000001" +=20 + "10000001" + "01111111", binary ) ; =20 bites =3D ByteBuffer.allocate( 4 ) ; @@ -754,16 +754,16 @@ binary =3D toAsciiString( bites ) ; assertEquals( "00000001" + "10000000" + - "10000001" +=20 + "10000001" + "01111111", binary ) ; =20 bites =3D ByteBuffer.allocate( 4 ) ; t =3D new Tuple( BIT_20 - 1, 0 ) ; t.setTag( bites, 4 ) ; binary =3D toAsciiString( bites ) ; - assertEquals( "01111111" +=20 - "11111111" +=20 - "11111111" +=20 + assertEquals( "01111111" + + "11111111" + + "11111111" + "01111111", binary ) ; =20 bites =3D ByteBuffer.allocate( 5 ) ; @@ -773,7 +773,7 @@ assertEquals( "00000000" + "10000000" + "10000000" + - "10000001" +=20 + "10000001" + "01111111", binary ) ; =20 bites =3D ByteBuffer.allocate( 5 ) ; @@ -783,22 +783,22 @@ assertEquals( "00000001" + "10000000" + "10000000" + - "10000001" +=20 + "10000001" + "01111111", binary ) ; =20 bites =3D ByteBuffer.allocate( 5 ) ; t =3D new Tuple( BIT_27 - 1, 0 ) ; t.setTag( bites, 5 ) ; binary =3D toAsciiString( bites ) ; - assertEquals( "01111111" +=20 - "11111111" +=20 - "11111111" +=20 - "11111111" +=20 + assertEquals( "01111111" + + "11111111" + + "11111111" + + "11111111" + "01111111", binary ) ; =20 bites =3D ByteBuffer.allocate( 6 ) ; t =3D new Tuple( BIT_27, 0 ) ; - =20 + try { t.setTag( bites, 6 ) ; @@ -809,8 +809,8 @@ assertNotNull( e ) ; } } - =20 - =20 + + String toAsciiString( int raw ) { byte[] intBytes =3D new byte[4] ; @@ -818,10 +818,10 @@ intBytes[1] =3D (byte) ( (int) ( 0x0000ff00 & raw ) >> 8 ) ; intBytes[2] =3D (byte) ( (int) ( 0x00ff0000 & raw ) >> 16 ) ; intBytes[3] =3D (byte) ( (int) ( 0xff000000 & raw ) >> 24 ) ; - =20 + return BinaryCodec.toAsciiString( intBytes ) ; } - =20 + =20 public void testSetLengthBuffer() { @@ -1064,7 +1064,7 @@ assertEquals( 4, t.getTagLength() ) ; t.id =3D BIT_13 + 100 ; assertEquals( 4, t.getTagLength() ) ; - =20 + t.id =3D BIT_20 - 1 ; assertEquals( 4, t.getTagLength() ) ; t.id =3D BIT_20 ; @@ -1076,7 +1076,7 @@ assertEquals( 5, t.getTagLength() ) ; =20 t.id =3D BIT_27 ; - =20 + try { assertEquals( 6, t.getTagLength() ) ; @@ -1107,7 +1107,7 @@ assertEquals( 4, t.getLengthLength() ) ; t.length =3D BIT_15 + 100 ; assertEquals( 4, t.getLengthLength() ) ; - =20 + t.length =3D BIT_23 - 1 ; assertEquals( 4, t.getLengthLength() ) ; t.length =3D BIT_23 ; @@ -1118,7 +1118,7 @@ t.length =3D Integer.MAX_VALUE ; assertEquals( 5, t.getLengthLength() ) ; =20 - =20 + t.length =3D Integer.MAX_VALUE + 1 ; try { @@ -1129,6 +1129,6 @@ { assertNotNull( e ) ; } - =20 + } } Modified: incubator/directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/d= igester/rules/PrimitiveOctetStringRuleTest.java URL: http://svn.apache.org/viewcvs/incubator/directory/asn1/trunk/ber/src/t= est/org/apache/asn1/ber/digester/rules/PrimitiveOctetStringRuleTest.java?vi= ew=3Ddiff&r1=3D155925&r2=3D155926 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/digeste= r/rules/PrimitiveOctetStringRuleTest.java (original) +++ incubator/directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/digeste= r/rules/PrimitiveOctetStringRuleTest.java Wed Mar 2 07:14:39 2005 @@ -1,5 +1,5 @@ /* - * Copyright 2004 The Apache Software Foundation + * Copyright 2004-2005 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. @@ -99,12 +99,12 @@ =20 =20 /** - * Tests when the length is indefinate. + * Tests when the length is indefinite. */ - public void testIndefinateLength() + public void testIndefiniteLength() { rule.tag( UniversalTag.OCTET_STRING.getTagId(), true, null ) ; - rule.length( Length.INDEFINATE ) ; + rule.length( Length.INDEFINITE ) ; rule.finish() ; ByteBuffer buf =3D ( ByteBuffer ) digester.pop() ; assertFalse( buf.hasRemaining() ) ; @@ -112,12 +112,12 @@ =20 =20 /** - * Tests when the length is indefinate. + * Tests when the length is indefinite. */ public void testNullValue() { rule.tag( UniversalTag.OCTET_STRING.getTagId(), true, null ) ; - rule.length( Length.INDEFINATE ) ; + rule.length( Length.INDEFINITE ) ; rule.value( null ) ; rule.value( ByteBuffer.allocate( 0 ) ) ; rule.finish() ; Modified: incubator/directory/asn1/trunk/ber/xdocs/BERDecoderDesign.xml URL: http://svn.apache.org/viewcvs/incubator/directory/asn1/trunk/ber/xdocs= /BERDecoderDesign.xml?view=3Ddiff&r1=3D155925&r2=3D155926 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/directory/asn1/trunk/ber/xdocs/BERDecoderDesign.xml (original) +++ incubator/directory/asn1/trunk/ber/xdocs/BERDecoderDesign.xml Wed Mar = 2 07:14:39 2005 @@ -22,7 +22,7 @@

A constructed TLV tuple contains other TLV tuples nested within = the Value field, and so on, recursively. The nesting depth is usual= ly - indefinate and dependent on the data structures being transforme= d=2E + indefinite and dependent on the data structures being transforme= d=2E This fact drastically affects the way the decoder is designed and hence operates.

@@ -61,7 +61,7 @@ =20

Now let's try to figure out how to handle constructed TLV tuples - which recursively nest other tuples indefinately. State now + which recursively nest other tuples indefinitely. State now is more that just where you left off in the current tuple being processed. When processing an inner tuple the decoder must also= know where it left off in the outter tuple to resume processing. More Modified: incubator/directory/asn1/trunk/codec/src/java/org/apache/asn1/cod= ec/stateful/CallbackHistory.java URL: http://svn.apache.org/viewcvs/incubator/directory/asn1/trunk/codec/src= /java/org/apache/asn1/codec/stateful/CallbackHistory.java?view=3Ddiff&r1=3D= 155925&r2=3D155926 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/directory/asn1/trunk/codec/src/java/org/apache/asn1/codec/sta= teful/CallbackHistory.java (original) +++ incubator/directory/asn1/trunk/codec/src/java/org/apache/asn1/codec/sta= teful/CallbackHistory.java Wed Mar 2 07:14:39 2005 @@ -1,5 +1,5 @@ /* - * Copyright 2004 The Apache Software Foundation + * Copyright 2004-2005 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. @@ -36,33 +36,33 @@ private final LinkedList history ; /** the length of callback history stored */ private final int length ; - =20 + =20 /** - * Creates an auditing callback that manages a history of indefinate l= ength. + * Creates an auditing callback that manages a history of indefinite l= ength. */ public CallbackHistory() { this( -1 ) ; } - =20 - =20 + + /** - * Creates an auditing callback that manages a history of fixed or=20 - * indefinate length. If the length is fixed the history effectively=20 + * Creates an auditing callback that manages a history of fixed or + * indefinite length. If the length is fixed the history effectively * becomes a FIFO structure. - *=20 + * * @param length the maximum length of callback history to store before - * dropping decoded items, a length of zero or 1 corresponds to indef= inate - * history=20 + * dropping decoded items, a length of zero or 1 corresponds to indef= inite + * history */ public CallbackHistory( int length ) { this.length =3D length ; history =3D new LinkedList() ; } - =20 - =20 + + /* (non-Javadoc) * @see org.apache.asn1.codec.stateful.DecoderCallback#decodeOccurred( * org.apache.asn1.codec.stateful.StatefulDecoder, java.lang.Object) @@ -70,13 +70,13 @@ public void decodeOccurred( StatefulDecoder decoder, Object decoded ) { if ( length > 0 ) - { =20 + { while ( history.size() >=3D length ) { history.removeLast() ; } } - =20 + history.addFirst( decoded ) ; } =20 @@ -103,7 +103,7 @@ =20 /** * Gets the most recent decoded object if one exists. - *=20 + * * @return the most recent decoded object * @throws java.util.NoSuchElementException if the history is empty */ @@ -111,11 +111,11 @@ { return history.getFirst() ; } - =20 - =20 + + /** * Gets the oldest decoded object if one exists. - *=20 + * * @return the oldest decoded object * @throws java.util.NoSuchElementException if the history is empty */ @@ -123,19 +123,19 @@ { return history.getLast() ; } - =20 - =20 + + /** * Tests to see if the history is empty. - *=20 + * * @return true if the history is empty, false otherwise */ public boolean isEmpty() { return history.isEmpty() ; } - =20 - =20 + + /** * Clears the history of decoded items. */ @@ -143,11 +143,11 @@ { history.clear() ; } - =20 - =20 + + /** * Gets the number of decoded items in the callback history. - *=20 + * * @return the number of decoded items in the callback history */ public int size() Modified: incubator/directory/asn1/trunk/xdocs/refactor.xml URL: http://svn.apache.org/viewcvs/incubator/directory/asn1/trunk/xdocs/ref= actor.xml?view=3Ddiff&r1=3D155925&r2=3D155926 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/directory/asn1/trunk/xdocs/refactor.xml (original) +++ incubator/directory/asn1/trunk/xdocs/refactor.xml Wed Mar 2 07:14:39 2= 005 @@ -166,7 +166,7 @@ are still abstract. This is because we need to differentiate fu= rther for buffered verses streamed Tuples in the case of primitive Tup= les. For constructed Tuples we need to differentiate between definate - length verses indefinate length Tuples. With our approach, only= the=20 + length verses indefinite length Tuples. With our approach, only= the=20 leaf nodes of the inheritance hierarchy will be concrete. Below= is the definition for the PrimitiveTuple.

@@ -251,10 +251,10 @@ =20 /** * Gets whether or not the length of this constructed Tuple is of the=20 - * definate form or of the indefinate length form. + * definate form or of the indefinite length form. * * @return true if the length is definate, false if the length is of t= he - * indefinate form + * indefinite form */ public abstract boolean isLengthDefinate(); } @@ -264,21 +264,21 @@ ConstructedTuple implements the isConstructed() met= hod=20 as final since it will always return false for this lineage of=20 Tuples. Also a new abstract method isLengthDefinate() is introd= uced=20 - to see if the Tuple uses the indefinate length form or not. =20 + to see if the Tuple uses the indefinite length form or not. =20

=20 - +

The ConstructedTuple can be further differentiated into two=20 - subclasses to represent definate and indefinate length construct= ed=20 - TLV Tuples. The indefinate form does not have a length value=20 + subclasses to represent definate and indefinite length construct= ed=20 + TLV Tuples. The indefinite form does not have a length value=20 associated with it where as the definate lenght form does. Let's - explore the concrete IndefinateLegthTuple definition. + explore the concrete IndefiniteLegthTuple definition.

=20 -public class IndefinateLength extends ConstructedTuple +public class IndefiniteLength extends ConstructedTuple { public final boolean isLengthDefinate() {