directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r372837 - in /directory/trunks/common/ldap/src: main/java/org/apache/ldap/common/codec/abandon/AbandonRequestGrammar.java test/java/org/apache/ldap/common/codec/abandon/AbandonRequestTest.java
Date Fri, 27 Jan 2006 13:20:19 GMT
Author: elecharny
Date: Fri Jan 27 05:19:57 2006
New Revision: 372837

URL: http://svn.apache.org/viewcvs?rev=372837&view=rev
Log:
- Fixed the pop allowed transition
- Fixed the test case with controls

Modified:
    directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/abandon/AbandonRequestGrammar.java
    directory/trunks/common/ldap/src/test/java/org/apache/ldap/common/codec/abandon/AbandonRequestTest.java

Modified: directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/abandon/AbandonRequestGrammar.java
URL: http://svn.apache.org/viewcvs/directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/abandon/AbandonRequestGrammar.java?rev=372837&r1=372836&r2=372837&view=diff
==============================================================================
--- directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/abandon/AbandonRequestGrammar.java
(original)
+++ directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/abandon/AbandonRequestGrammar.java
Fri Jan 27 05:19:57 2006
@@ -125,6 +125,7 @@
                             }
 
                             ldapMessageContainer.grammarEndAllowed( true );
+                            ldapMessageContainer.grammarPopAllowed( true );
                             return;
                         }
                         catch ( IntegerDecoderException ide )

Modified: directory/trunks/common/ldap/src/test/java/org/apache/ldap/common/codec/abandon/AbandonRequestTest.java
URL: http://svn.apache.org/viewcvs/directory/trunks/common/ldap/src/test/java/org/apache/ldap/common/codec/abandon/AbandonRequestTest.java?rev=372837&r1=372836&r2=372837&view=diff
==============================================================================
--- directory/trunks/common/ldap/src/test/java/org/apache/ldap/common/codec/abandon/AbandonRequestTest.java
(original)
+++ directory/trunks/common/ldap/src/test/java/org/apache/ldap/common/codec/abandon/AbandonRequestTest.java
Fri Jan 27 05:19:57 2006
@@ -124,28 +124,28 @@
         stream.put(
             new byte[]
             {
-                0x30, 0x62,         // LDAPMessage ::=SEQUENCE {
-                0x02, 0x01, 0x03,   //        messageID MessageID
-                0x50, 0x01, 0x02,    //        CHOICE { ..., abandonRequest AbandonRequest,...
-                (byte)0xA0, 0x5A,   //    controls       [0] Controls OPTIONAL }
-                0x30, 0x1A,         // Control ::= SEQUENCE {
-                                    //    controlType             LDAPOID, 
-                0x04, 0x0D, '1', '.', '3', '.', '6', '.', '1', '.', '5', '.', '5', '.', '1',
-                0x01, 0x01, (byte)0xFF,   //    criticality             BOOLEAN DEFAULT FALSE,
-                                    //    controlValue            OCTET STRING OPTIONAL }
-                0x04, 0x06, 'a', 'b', 'c', 'd', 'e', 'f',
-                0x30, 0x17,         // Control ::= SEQUENCE {
-                                    //    controlType             LDAPOID, 
-                0x04, 0x0D, '1', '.', '3', '.', '6', '.', '1', '.', '5', '.', '5', '.', '2',
-                                    //    controlValue            OCTET STRING OPTIONAL }
-                0x04, 0x06, 'g', 'h', 'i', 'j', 'k', 'l',
-                0x30, 0x12,         // Control ::= SEQUENCE {
-                                    //    controlType             LDAPOID, 
-                0x04, 0x0D, '1', '.', '3', '.', '6', '.', '1', '.', '5', '.', '5', '.', '3',
-                0x01, 0x01, (byte)0xFF,   //    criticality             BOOLEAN DEFAULT FALSE}
-                0x30, 0x0F,         // Control ::= SEQUENCE {
-                                    //    controlType             LDAPOID} 
-                0x04, 0x0D, '1', '.', '3', '.', '6', '.', '1', '.', '5', '.', '5', '.', '4'
+                0x30, 0x62,          // LDAPMessage ::=SEQUENCE {
+                  0x02, 0x01, 0x03,  //        messageID MessageID
+                  0x50, 0x01, 0x02,  //        CHOICE { ..., abandonRequest AbandonRequest,...
+                  (byte)0xA0, 0x5A,  //    controls       [0] Controls OPTIONAL }
+                    0x30, 0x1A,      // Control ::= SEQUENCE {
+                                     //    controlType             LDAPOID, 
+                      0x04, 0x0D, '1', '.', '3', '.', '6', '.', '1', '.', '5', '.', '5',
'.', '1',
+                      0x01, 0x01, (byte)0xFF,   //    criticality             BOOLEAN DEFAULT
FALSE,
+                                     //    controlValue            OCTET STRING OPTIONAL
}
+                      0x04, 0x06, 'a', 'b', 'c', 'd', 'e', 'f',
+                    0x30, 0x17,      // Control ::= SEQUENCE {
+                                     //    controlType             LDAPOID, 
+                      0x04, 0x0D, '1', '.', '3', '.', '6', '.', '1', '.', '5', '.', '5',
'.', '2',
+                                     //    controlValue            OCTET STRING OPTIONAL
}
+                      0x04, 0x06, 'g', 'h', 'i', 'j', 'k', 'l',
+                    0x30, 0x12,      // Control ::= SEQUENCE {
+                                     //    controlType             LDAPOID, 
+                      0x04, 0x0D, '1', '.', '3', '.', '6', '.', '1', '.', '5', '.', '5',
'.', '3',
+                      0x01, 0x01, (byte)0xFF,   //    criticality             BOOLEAN DEFAULT
FALSE}
+                    0x30, 0x0F,      // Control ::= SEQUENCE {
+                                     //    controlType             LDAPOID} 
+                      0x04, 0x0D, '1', '.', '3', '.', '6', '.', '1', '.', '5', '.', '5',
'.', '4'
             } );
 
         String decodedPdu = StringTools.dumpBytes( stream.array() );
@@ -172,6 +172,31 @@
         assertEquals( 3, message.getMessageId() );
         assertEquals( 2, abandonRequest.getAbandonedMessageId() );
         
+        // Check the Controls
+        List controls = message.getControls();
+        
+        assertEquals( 4, controls.size() );
+        
+        Control control = message.getControls( 0 );
+        assertEquals( "1.3.6.1.5.5.1", control.getControlType() );
+        assertEquals( "0x61 0x62 0x63 0x64 0x65 0x66 ", StringTools.dumpBytes( (byte[])control.getControlValue()
) );
+        assertTrue( control.getCriticality() );
+
+        control = message.getControls( 1 );
+        assertEquals( "1.3.6.1.5.5.2", control.getControlType() );
+        assertEquals( "0x67 0x68 0x69 0x6A 0x6B 0x6C ", StringTools.dumpBytes( (byte[])control.getControlValue()
) );
+        assertFalse( control.getCriticality() );
+
+        control = message.getControls( 2 );
+        assertEquals( "1.3.6.1.5.5.3", control.getControlType() );
+        assertEquals( "", StringTools.dumpBytes( (byte[])control.getControlValue() ) );
+        assertTrue( control.getCriticality() );
+
+        control = message.getControls( 3 );
+        assertEquals( "1.3.6.1.5.5.4", control.getControlType() );
+        assertEquals( "", StringTools.dumpBytes( (byte[])control.getControlValue() ) );
+        assertFalse( control.getCriticality() );
+
         // Check the length
         assertEquals(0x64, message.computeLength());
         



Mime
View raw message