You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2012/01/24 18:27:12 UTC
svn commit: r1235364 [12/27] - in /directory/shared/trunk:
asn1/api/src/main/java/org/apache/directory/shared/asn1/util/
asn1/api/src/test/java/org/apache/directory/shared/asn1/util/
asn1/ber/src/main/java/org/apache/directory/shared/asn1/actions/ asn1...
Modified: directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/add/AddRequestTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/add/AddRequestTest.java?rev=1235364&r1=1235363&r2=1235364&view=diff
==============================================================================
--- directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/add/AddRequestTest.java (original)
+++ directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/add/AddRequestTest.java Tue Jan 24 17:27:00 2012
@@ -88,37 +88,100 @@ public class AddRequestTest extends Abst
0x52, // CHOICE { ..., addRequest AddRequest, ...
// AddRequest ::= [APPLICATION 8] SEQUENCE {
// entry LDAPDN,
- 0x04, 0x20, 'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y', ',', 'o', 'u', '=', 'u',
- 's', 'e', 'r', 's', ',', 'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm',
+ 0x04,
+ 0x20,
+ 'c',
+ 'n',
+ '=',
+ 't',
+ 'e',
+ 's',
+ 't',
+ 'M',
+ 'o',
+ 'd',
+ 'i',
+ 'f',
+ 'y',
+ ',',
+ 'o',
+ 'u',
+ '=',
+ 'u',
+ 's',
+ 'e',
+ 'r',
+ 's',
+ ',',
+ 'o',
+ 'u',
+ '=',
+ 's',
+ 'y',
+ 's',
+ 't',
+ 'e',
+ 'm',
// attributes AttributeList }
0x30,
0x2E, // AttributeList ::= SEQUENCE OF SEQUENCE {
0x30,
0x0c, // attribute 1
- 0x04, 0x01,
+ 0x04,
+ 0x01,
'l', // type AttributeDescription,
0x31,
0x07, // vals SET OF AttributeValue }
- 0x04, 0x05, 'P', 'a', 'r', 'i', 's',
+ 0x04,
+ 0x05,
+ 'P',
+ 'a',
+ 'r',
+ 'i',
+ 's',
0x30,
0x1E, // attribute 2
// type AttributeDescription,
- 0x04, 0x05, 'a', 't', 't', 'r',
+ 0x04,
+ 0x05,
+ 'a',
+ 't',
+ 't',
+ 'r',
's',
0x31,
0x15, // vals SET
// OF
// AttributeValue
// }
- 0x04, 0x05, 't', 'e', 's', 't', '1', 0x04, 0x05, 't', 'e', 's', 't', '2', 0x04, 0x05, 't', 'e', 's',
- 't', '3', } );
+ 0x04,
+ 0x05,
+ 't',
+ 'e',
+ 's',
+ 't',
+ '1',
+ 0x04,
+ 0x05,
+ 't',
+ 'e',
+ 's',
+ 't',
+ '2',
+ 0x04,
+ 0x05,
+ 't',
+ 'e',
+ 's',
+ 't',
+ '3', } );
Strings.dumpBytes( stream.array() );
stream.flip();
// Allocate a LdapMessage Container
- LdapMessageContainer<AddRequestDecorator> container =
+ LdapMessageContainer<AddRequestDecorator> container =
new LdapMessageContainer<AddRequestDecorator>( codec );
// Decode a AddRequest message
@@ -228,9 +291,12 @@ public class AddRequestTest extends Abst
stream.put( new byte[]
{ 0x30, 0x05, // LDAPMessage ::= SEQUENCE {
- 0x02, 0x01, 0x01, // messageID MessageID
- 0x68, 0x00 // CHOICE { ..., addRequest AddRequest, ...
- } );
+ 0x02,
+ 0x01,
+ 0x01, // messageID MessageID
+ 0x68,
+ 0x00 // CHOICE { ..., addRequest AddRequest, ...
+ } );
stream.flip();
@@ -265,36 +331,69 @@ public class AddRequestTest extends Abst
stream.put( new byte[]
{ 0x30,
0x37, // LDAPMessage ::= SEQUENCE {
- 0x02, 0x01,
+ 0x02,
+ 0x01,
0x01, // messageID MessageID
0x68,
0x26, // CHOICE { ..., addRequest AddRequest, ...
// AddRequest ::= [APPLICATION 8] SEQUENCE {
// entry LDAPDN,
- 0x04, 0x00,
+ 0x04,
+ 0x00,
// attributes AttributeList }
0x30,
0x2E, // AttributeList ::= SEQUENCE OF SEQUENCE {
0x30,
0x0c, // attribute 1
- 0x04, 0x01,
+ 0x04,
+ 0x01,
'l', // type AttributeDescription,
0x31,
0x07, // vals SET OF AttributeValue }
- 0x04, 0x05, 'P', 'a', 'r', 'i', 's',
+ 0x04,
+ 0x05,
+ 'P',
+ 'a',
+ 'r',
+ 'i',
+ 's',
0x30,
0x1E, // attribute 2
// type AttributeDescription,
- 0x04, 0x05, 'a', 't', 't', 'r',
+ 0x04,
+ 0x05,
+ 'a',
+ 't',
+ 't',
+ 'r',
's',
0x31,
0x15, // vals SET
// OF
// AttributeValue
// }
- 0x04, 0x05, 't', 'e', 's', 't', '1', 0x04, 0x05, 't', 'e', 's', 't', '2', 0x04, 0x05, 't', 'e', 's',
- 't', '3', } );
+ 0x04,
+ 0x05,
+ 't',
+ 'e',
+ 's',
+ 't',
+ '1',
+ 0x04,
+ 0x05,
+ 't',
+ 'e',
+ 's',
+ 't',
+ '2',
+ 0x04,
+ 0x05,
+ 't',
+ 'e',
+ 's',
+ 't',
+ '3', } );
stream.flip();
@@ -341,37 +440,100 @@ public class AddRequestTest extends Abst
0x52, // CHOICE { ..., addRequest AddRequest, ...
// AddRequest ::= [APPLICATION 8] SEQUENCE {
// entry LDAPDN,
- 0x04, 0x20, 'c', 'n', ':', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y', ',', 'o', 'u', '=', 'u',
- 's', 'e', 'r', 's', ',', 'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm',
+ 0x04,
+ 0x20,
+ 'c',
+ 'n',
+ ':',
+ 't',
+ 'e',
+ 's',
+ 't',
+ 'M',
+ 'o',
+ 'd',
+ 'i',
+ 'f',
+ 'y',
+ ',',
+ 'o',
+ 'u',
+ '=',
+ 'u',
+ 's',
+ 'e',
+ 'r',
+ 's',
+ ',',
+ 'o',
+ 'u',
+ '=',
+ 's',
+ 'y',
+ 's',
+ 't',
+ 'e',
+ 'm',
// attributes AttributeList }
0x30,
0x2E, // AttributeList ::= SEQUENCE OF SEQUENCE {
0x30,
0x0c, // attribute 1
- 0x04, 0x01,
+ 0x04,
+ 0x01,
'l', // type AttributeDescription,
0x31,
0x07, // vals SET OF AttributeValue }
- 0x04, 0x05, 'P', 'a', 'r', 'i', 's',
+ 0x04,
+ 0x05,
+ 'P',
+ 'a',
+ 'r',
+ 'i',
+ 's',
0x30,
0x1E, // attribute 2
// type AttributeDescription,
- 0x04, 0x05, 'a', 't', 't', 'r',
+ 0x04,
+ 0x05,
+ 'a',
+ 't',
+ 't',
+ 'r',
's',
0x31,
0x15, // vals SET
// OF
// AttributeValue
// }
- 0x04, 0x05, 't', 'e', 's', 't', '1', 0x04, 0x05, 't', 'e', 's', 't', '2', 0x04, 0x05, 't', 'e', 's',
- 't', '3', } );
+ 0x04,
+ 0x05,
+ 't',
+ 'e',
+ 's',
+ 't',
+ '1',
+ 0x04,
+ 0x05,
+ 't',
+ 'e',
+ 's',
+ 't',
+ '2',
+ 0x04,
+ 0x05,
+ 't',
+ 'e',
+ 's',
+ 't',
+ '3', } );
stream.flip();
// Allocate a LdapMessage Container
Asn1Container ldapMessageContainer = new LdapMessageContainer<MessageDecorator<? extends Message>>( codec );
-
+
// Decode a AddRequest message
try
{
@@ -404,16 +566,50 @@ public class AddRequestTest extends Abst
stream.put( new byte[]
{ 0x30,
0x29, // LDAPMessage ::= SEQUENCE {
- 0x02, 0x01,
+ 0x02,
+ 0x01,
0x01, // messageID MessageID
0x68,
0x24, // CHOICE { ..., addRequest AddRequest, ...
// AddRequest ::= [APPLICATION 8] SEQUENCE {
// entry LDAPDN,
- 0x04, 0x20, 'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y', ',', 'o', 'u', '=', 'u',
- 's', 'e', 'r', 's', ',', 'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm',
+ 0x04,
+ 0x20,
+ 'c',
+ 'n',
+ '=',
+ 't',
+ 'e',
+ 's',
+ 't',
+ 'M',
+ 'o',
+ 'd',
+ 'i',
+ 'f',
+ 'y',
+ ',',
+ 'o',
+ 'u',
+ '=',
+ 'u',
+ 's',
+ 'e',
+ 'r',
+ 's',
+ ',',
+ 'o',
+ 'u',
+ '=',
+ 's',
+ 'y',
+ 's',
+ 't',
+ 'e',
+ 'm',
// attributes AttributeList }
- 0x30, 0x00, // AttributeList ::= SEQUENCE OF SEQUENCE {
+ 0x30,
+ 0x00, // AttributeList ::= SEQUENCE OF SEQUENCE {
} );
stream.flip();
@@ -449,17 +645,52 @@ public class AddRequestTest extends Abst
stream.put( new byte[]
{ 0x30,
0x2B, // LDAPMessage ::= SEQUENCE {
- 0x02, 0x01,
+ 0x02,
+ 0x01,
0x01, // messageID MessageID
0x68,
0x26, // CHOICE { ..., addRequest AddRequest, ...
// AddRequest ::= [APPLICATION 8] SEQUENCE {
// entry LDAPDN,
- 0x04, 0x20, 'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y', ',', 'o', 'u', '=', 'u',
- 's', 'e', 'r', 's', ',', 'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm',
+ 0x04,
+ 0x20,
+ 'c',
+ 'n',
+ '=',
+ 't',
+ 'e',
+ 's',
+ 't',
+ 'M',
+ 'o',
+ 'd',
+ 'i',
+ 'f',
+ 'y',
+ ',',
+ 'o',
+ 'u',
+ '=',
+ 'u',
+ 's',
+ 'e',
+ 'r',
+ 's',
+ ',',
+ 'o',
+ 'u',
+ '=',
+ 's',
+ 'y',
+ 's',
+ 't',
+ 'e',
+ 'm',
// attributes AttributeList }
- 0x30, 0x02, // AttributeList ::= SEQUENCE OF SEQUENCE {
- 0x30, 0x00, // AttributeList ::= SEQUENCE OF SEQUENCE {
+ 0x30,
+ 0x02, // AttributeList ::= SEQUENCE OF SEQUENCE {
+ 0x30,
+ 0x00, // AttributeList ::= SEQUENCE OF SEQUENCE {
} );
stream.flip();
@@ -495,18 +726,54 @@ public class AddRequestTest extends Abst
stream.put( new byte[]
{ 0x30,
0x2D, // LDAPMessage ::= SEQUENCE {
- 0x02, 0x01,
+ 0x02,
+ 0x01,
0x01, // messageID MessageID
0x68,
0x28, // CHOICE { ..., addRequest AddRequest, ...
// AddRequest ::= [APPLICATION 8] SEQUENCE {
// entry LDAPDN,
- 0x04, 0x20, 'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y', ',', 'o', 'u', '=', 'u',
- 's', 'e', 'r', 's', ',', 'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm',
+ 0x04,
+ 0x20,
+ 'c',
+ 'n',
+ '=',
+ 't',
+ 'e',
+ 's',
+ 't',
+ 'M',
+ 'o',
+ 'd',
+ 'i',
+ 'f',
+ 'y',
+ ',',
+ 'o',
+ 'u',
+ '=',
+ 'u',
+ 's',
+ 'e',
+ 'r',
+ 's',
+ ',',
+ 'o',
+ 'u',
+ '=',
+ 's',
+ 'y',
+ 's',
+ 't',
+ 'e',
+ 'm',
// attributes AttributeList }
- 0x30, 0x04, // AttributeList ::= SEQUENCE OF SEQUENCE {
- 0x30, 0x02, // attribute 1
- 0x04, 0x00, // type AttributeDescription,
+ 0x30,
+ 0x04, // AttributeList ::= SEQUENCE OF SEQUENCE {
+ 0x30,
+ 0x02, // attribute 1
+ 0x04,
+ 0x00, // type AttributeDescription,
} );
stream.flip();
@@ -546,18 +813,55 @@ public class AddRequestTest extends Abst
stream.put( new byte[]
{ 0x30,
0x2E, // LDAPMessage ::= SEQUENCE {
- 0x02, 0x01,
+ 0x02,
+ 0x01,
0x01, // messageID MessageID
0x68,
0x29, // CHOICE { ..., addRequest AddRequest, ...
// AddRequest ::= [APPLICATION 8] SEQUENCE {
// entry LDAPDN,
- 0x04, 0x20, 'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y', ',', 'o', 'u', '=', 'u',
- 's', 'e', 'r', 's', ',', 'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm',
+ 0x04,
+ 0x20,
+ 'c',
+ 'n',
+ '=',
+ 't',
+ 'e',
+ 's',
+ 't',
+ 'M',
+ 'o',
+ 'd',
+ 'i',
+ 'f',
+ 'y',
+ ',',
+ 'o',
+ 'u',
+ '=',
+ 'u',
+ 's',
+ 'e',
+ 'r',
+ 's',
+ ',',
+ 'o',
+ 'u',
+ '=',
+ 's',
+ 'y',
+ 's',
+ 't',
+ 'e',
+ 'm',
// attributes AttributeList }
- 0x30, 0x05, // AttributeList ::= SEQUENCE OF SEQUENCE {
- 0x30, 0x03, // attribute 1
- 0x04, 0x01, 'A', // type AttributeDescription,
+ 0x30,
+ 0x05, // AttributeList ::= SEQUENCE OF SEQUENCE {
+ 0x30,
+ 0x03, // attribute 1
+ 0x04,
+ 0x01,
+ 'A', // type AttributeDescription,
} );
stream.flip();
@@ -593,19 +897,57 @@ public class AddRequestTest extends Abst
stream.put( new byte[]
{ 0x30,
0x30, // LDAPMessage ::= SEQUENCE {
- 0x02, 0x01,
+ 0x02,
+ 0x01,
0x01, // messageID MessageID
0x68,
0x2B, // CHOICE { ..., addRequest AddRequest, ...
// AddRequest ::= [APPLICATION 8] SEQUENCE {
// entry LDAPDN,
- 0x04, 0x20, 'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y', ',', 'o', 'u', '=', 'u',
- 's', 'e', 'r', 's', ',', 'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm',
+ 0x04,
+ 0x20,
+ 'c',
+ 'n',
+ '=',
+ 't',
+ 'e',
+ 's',
+ 't',
+ 'M',
+ 'o',
+ 'd',
+ 'i',
+ 'f',
+ 'y',
+ ',',
+ 'o',
+ 'u',
+ '=',
+ 'u',
+ 's',
+ 'e',
+ 'r',
+ 's',
+ ',',
+ 'o',
+ 'u',
+ '=',
+ 's',
+ 'y',
+ 's',
+ 't',
+ 'e',
+ 'm',
// attributes AttributeList }
- 0x30, 0x07, // AttributeList ::= SEQUENCE OF SEQUENCE {
- 0x30, 0x05, // attribute 1
- 0x04, 0x01, 'A', // type AttributeDescription,
- 0x31, 0x00 } );
+ 0x30,
+ 0x07, // AttributeList ::= SEQUENCE OF SEQUENCE {
+ 0x30,
+ 0x05, // attribute 1
+ 0x04,
+ 0x01,
+ 'A', // type AttributeDescription,
+ 0x31,
+ 0x00 } );
stream.flip();
@@ -640,21 +982,61 @@ public class AddRequestTest extends Abst
stream.put( new byte[]
{ 0x30,
0x32, // LDAPMessage ::= SEQUENCE {
- 0x02, 0x01,
+ 0x02,
+ 0x01,
0x01, // messageID MessageID
0x68,
0x2D, // CHOICE { ..., addRequest AddRequest, ...
// AddRequest ::= [APPLICATION 8] SEQUENCE {
// entry LDAPDN,
- 0x04, 0x20, 'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y', ',', 'o', 'u', '=', 'u',
- 's', 'e', 'r', 's', ',', 'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm',
+ 0x04,
+ 0x20,
+ 'c',
+ 'n',
+ '=',
+ 't',
+ 'e',
+ 's',
+ 't',
+ 'M',
+ 'o',
+ 'd',
+ 'i',
+ 'f',
+ 'y',
+ ',',
+ 'o',
+ 'u',
+ '=',
+ 'u',
+ 's',
+ 'e',
+ 'r',
+ 's',
+ ',',
+ 'o',
+ 'u',
+ '=',
+ 's',
+ 'y',
+ 's',
+ 't',
+ 'e',
+ 'm',
// attributes AttributeList }
- 0x30, 0x09, // AttributeList ::= SEQUENCE OF SEQUENCE {
- 0x30, 0x07, // attribute 1
- 0x04, 0x01, 'l', // type AttributeDescription,
- 0x31, 0x02, 0x04, 0x00 } );
+ 0x30,
+ 0x09, // AttributeList ::= SEQUENCE OF SEQUENCE {
+ 0x30,
+ 0x07, // attribute 1
+ 0x04,
+ 0x01,
+ 'l', // type AttributeDescription,
+ 0x31,
+ 0x02,
+ 0x04,
+ 0x00 } );
- String decodedPdu = Strings.dumpBytes(stream.array());
+ String decodedPdu = Strings.dumpBytes( stream.array() );
stream.flip();
// Allocate a LdapMessage Container
@@ -698,7 +1080,7 @@ public class AddRequestTest extends Abst
// Check the length
assertEquals( 0x34, bb.limit() );
- String encodedPdu = Strings.dumpBytes(bb.array());
+ String encodedPdu = Strings.dumpBytes( bb.array() );
assertEquals( encodedPdu, decodedPdu );
}
@@ -732,21 +1114,83 @@ public class AddRequestTest extends Abst
0x2D, // CHOICE { ..., addRequest AddRequest, ...
// AddRequest ::= [APPLICATION 8] SEQUENCE {
// entry LDAPDN,
- 0x04, 0x20, 'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y', ',', 'o', 'u', '=', 'u',
- 's', 'e', 'r', 's', ',', 'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm',
+ 0x04,
+ 0x20,
+ 'c',
+ 'n',
+ '=',
+ 't',
+ 'e',
+ 's',
+ 't',
+ 'M',
+ 'o',
+ 'd',
+ 'i',
+ 'f',
+ 'y',
+ ',',
+ 'o',
+ 'u',
+ '=',
+ 'u',
+ 's',
+ 'e',
+ 'r',
+ 's',
+ ',',
+ 'o',
+ 'u',
+ '=',
+ 's',
+ 'y',
+ 's',
+ 't',
+ 'e',
+ 'm',
// attributes AttributeList }
0x30,
0x09, // AttributeList ::= SEQUENCE OF SEQUENCE {
0x30,
0x07, // attribute 1
- 0x04, 0x01,
+ 0x04,
+ 0x01,
'l', // type AttributeDescription,
- 0x31, 0x02, 0x04, 0x00, ( byte ) 0xA0,
+ 0x31,
+ 0x02,
+ 0x04,
+ 0x00,
+ ( byte ) 0xA0,
0x1B, // A control
- 0x30, 0x19, 0x04, 0x17, 0x32, 0x2E, 0x31, 0x36, 0x2E, 0x38, 0x34, 0x30, 0x2E, 0x31, 0x2E, 0x31, 0x31,
- 0x33, 0x37, 0x33, 0x30, 0x2E, 0x33, 0x2E, 0x34, 0x2E, 0x32 } );
+ 0x30,
+ 0x19,
+ 0x04,
+ 0x17,
+ 0x32,
+ 0x2E,
+ 0x31,
+ 0x36,
+ 0x2E,
+ 0x38,
+ 0x34,
+ 0x30,
+ 0x2E,
+ 0x31,
+ 0x2E,
+ 0x31,
+ 0x31,
+ 0x33,
+ 0x37,
+ 0x33,
+ 0x30,
+ 0x2E,
+ 0x33,
+ 0x2E,
+ 0x34,
+ 0x2E,
+ 0x32 } );
- String decodedPdu = Strings.dumpBytes(stream.array());
+ String decodedPdu = Strings.dumpBytes( stream.array() );
stream.flip();
// Allocate a LdapMessage Container
@@ -790,7 +1234,8 @@ public class AddRequestTest extends Abst
assertTrue( addRequest.hasControl( "2.16.840.1.113730.3.4.2" ) );
@SuppressWarnings("unchecked")
- CodecControl<Control> control = (org.apache.directory.shared.ldap.codec.api.CodecControl<Control> ) controls.get( "2.16.840.1.113730.3.4.2" );
+ CodecControl<Control> control = ( org.apache.directory.shared.ldap.codec.api.CodecControl<Control> ) controls
+ .get( "2.16.840.1.113730.3.4.2" );
assertEquals( "2.16.840.1.113730.3.4.2", control.getOid() );
assertEquals( "", Strings.dumpBytes( ( byte[] ) control.getValue() ) );
@@ -802,7 +1247,7 @@ public class AddRequestTest extends Abst
// Check the length
assertEquals( 0x51, bb.limit() );
- String encodedPdu = Strings.dumpBytes(bb.array());
+ String encodedPdu = Strings.dumpBytes( bb.array() );
assertEquals( encodedPdu, decodedPdu );
}
Modified: directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/add/AddResponseTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/add/AddResponseTest.java?rev=1235364&r1=1235363&r2=1235364&view=diff
==============================================================================
--- directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/add/AddResponseTest.java (original)
+++ directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/add/AddResponseTest.java Tue Jan 24 17:27:00 2012
@@ -67,20 +67,27 @@ public class AddResponseTest extends Abs
stream.put( new byte[]
{ 0x30, 0x0C, // LDAPMessage ::=SEQUENCE {
- 0x02, 0x01, 0x01, // messageID MessageID
- 0x69, 0x07, // CHOICE { ..., addResponse AddResponse, ...
+ 0x02,
+ 0x01,
+ 0x01, // messageID MessageID
+ 0x69,
+ 0x07, // CHOICE { ..., addResponse AddResponse, ...
// AddResponse ::= [APPLICATION 9] LDAPResult
- 0x0A, 0x01, 0x00, // LDAPResult ::= SEQUENCE {
+ 0x0A,
+ 0x01,
+ 0x00, // LDAPResult ::= SEQUENCE {
// resultCode ENUMERATED {
// success (0), ...
// },
- 0x04, 0x00, // matchedDN LDAPDN,
- 0x04, 0x00 // errorMessage LDAPString,
+ 0x04,
+ 0x00, // matchedDN LDAPDN,
+ 0x04,
+ 0x00 // errorMessage LDAPString,
// referral [3] Referral OPTIONAL }
// }
- } );
+ } );
- String decodedPdu = Strings.dumpBytes(stream.array());
+ String decodedPdu = Strings.dumpBytes( stream.array() );
stream.flip();
// Allocate a LdapMessage Container
@@ -112,7 +119,7 @@ public class AddResponseTest extends Abs
// Check the length
assertEquals( 0x0E, bb.limit() );
- String encodedPdu = Strings.dumpBytes(bb.array());
+ String encodedPdu = Strings.dumpBytes( bb.array() );
assertEquals( encodedPdu, decodedPdu );
}
@@ -136,8 +143,11 @@ public class AddResponseTest extends Abs
stream.put( new byte[]
{ 0x30, 0x0C, // LDAPMessage ::=SEQUENCE {
- 0x02, 0x01, 0x01, // messageID MessageID
- 0x69, 0x00, // CHOICE { ..., addResponse AddResponse, ...
+ 0x02,
+ 0x01,
+ 0x01, // messageID MessageID
+ 0x69,
+ 0x00, // CHOICE { ..., addResponse AddResponse, ...
} );
stream.flip();
@@ -173,7 +183,8 @@ public class AddResponseTest extends Abs
stream.put( new byte[]
{ 0x30,
0x29, // LDAPMessage ::=SEQUENCE {
- 0x02, 0x01,
+ 0x02,
+ 0x01,
0x01, // messageID MessageID
0x69,
0x07, // CHOICE { ..., addResponse AddResponse, ...
@@ -192,15 +203,39 @@ public class AddResponseTest extends Abs
// }
( byte ) 0xA0,
0x1B, // A control
- 0x30, 0x19, 0x04, 0x17, 0x32, 0x2E, 0x31, 0x36, 0x2E, 0x38, 0x34, 0x30, 0x2E, 0x31, 0x2E, 0x31, 0x31,
- 0x33, 0x37, 0x33, 0x30, 0x2E, 0x33, 0x2E, 0x34, 0x2E, 0x32 } );
+ 0x30,
+ 0x19,
+ 0x04,
+ 0x17,
+ 0x32,
+ 0x2E,
+ 0x31,
+ 0x36,
+ 0x2E,
+ 0x38,
+ 0x34,
+ 0x30,
+ 0x2E,
+ 0x31,
+ 0x2E,
+ 0x31,
+ 0x31,
+ 0x33,
+ 0x37,
+ 0x33,
+ 0x30,
+ 0x2E,
+ 0x33,
+ 0x2E,
+ 0x34,
+ 0x2E,
+ 0x32 } );
- String decodedPdu = Strings.dumpBytes(stream.array());
+ String decodedPdu = Strings.dumpBytes( stream.array() );
stream.flip();
// Allocate a LdapMessage Container
- LdapMessageContainer<AddResponseDecorator> container
- = new LdapMessageContainer<AddResponseDecorator>( codec );
+ LdapMessageContainer<AddResponseDecorator> container = new LdapMessageContainer<AddResponseDecorator>( codec );
// Decode the AddResponse PDU
try
@@ -227,9 +262,10 @@ public class AddResponseTest extends Abs
assertEquals( 1, controls.size() );
@SuppressWarnings("unchecked")
- CodecControl<Control> control = (org.apache.directory.shared.ldap.codec.api.CodecControl<Control> ) controls.get( "2.16.840.1.113730.3.4.2" );
+ CodecControl<Control> control = ( org.apache.directory.shared.ldap.codec.api.CodecControl<Control> ) controls
+ .get( "2.16.840.1.113730.3.4.2" );
assertEquals( "2.16.840.1.113730.3.4.2", control.getOid() );
- assertEquals( "", Strings.dumpBytes( ( byte[] ) control.getValue()) );
+ assertEquals( "", Strings.dumpBytes( ( byte[] ) control.getValue() ) );
try
{
@@ -239,7 +275,7 @@ public class AddResponseTest extends Abs
// Check the length
assertEquals( 0x02B, bb.limit() );
- String encodedPdu = Strings.dumpBytes(bb.array());
+ String encodedPdu = Strings.dumpBytes( bb.array() );
assertEquals( encodedPdu, decodedPdu );
}
Modified: directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestPerfTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestPerfTest.java?rev=1235364&r1=1235363&r2=1235364&view=diff
==============================================================================
--- directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestPerfTest.java (original)
+++ directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestPerfTest.java Tue Jan 24 17:27:00 2012
@@ -53,7 +53,7 @@ import com.mycila.junit.concurrent.Concu
*/
@RunWith(ConcurrentJunitRunner.class)
@Concurrency()
-@Ignore( "Ignore performance tests: should not be with integration tests" )
+@Ignore("Ignore performance tests: should not be with integration tests")
public class BindRequestPerfTest extends AbstractCodecServiceTest
{
/**
@@ -82,18 +82,80 @@ public class BindRequestPerfTest extends
0x03, // version INTEGER (1..127),
0x04,
0x1F, // name LDAPDN,
- 'u', 'i', 'd', '=', 'a', 'k', 'a', 'r', 'a', 's', 'u', 'l', 'u', ',', 'd', 'c', '=', 'e', 'x', 'a',
- 'm', 'p', 'l', 'e', ',', 'd', 'c', '=', 'c', 'o', 'm',
+ 'u',
+ 'i',
+ 'd',
+ '=',
+ 'a',
+ 'k',
+ 'a',
+ 'r',
+ 'a',
+ 's',
+ 'u',
+ 'l',
+ 'u',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'e',
+ 'x',
+ 'a',
+ 'm',
+ 'p',
+ 'l',
+ 'e',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'c',
+ 'o',
+ 'm',
( byte ) 0x80,
0x08, // authentication AuthenticationChoice
// AuthenticationChoice ::= CHOICE { simple [0] OCTET STRING,
// ...
- 'p', 'a', 's', 's', 'w', 'o', 'r', 'd', ( byte ) 0xA0,
+ 'p',
+ 'a',
+ 's',
+ 's',
+ 'w',
+ 'o',
+ 'r',
+ 'd',
+ ( byte ) 0xA0,
0x1B, // A control
- 0x30, 0x19, 0x04, 0x17, 0x32, 0x2E, 0x31, 0x36, 0x2E, 0x38, 0x34, 0x30, 0x2E, 0x31, 0x2E, 0x31, 0x31,
- 0x33, 0x37, 0x33, 0x30, 0x2E, 0x33, 0x2E, 0x34, 0x2E, 0x32 } );
+ 0x30,
+ 0x19,
+ 0x04,
+ 0x17,
+ 0x32,
+ 0x2E,
+ 0x31,
+ 0x36,
+ 0x2E,
+ 0x38,
+ 0x34,
+ 0x30,
+ 0x2E,
+ 0x31,
+ 0x2E,
+ 0x31,
+ 0x31,
+ 0x33,
+ 0x37,
+ 0x33,
+ 0x30,
+ 0x2E,
+ 0x33,
+ 0x2E,
+ 0x34,
+ 0x2E,
+ 0x32 } );
- String decodedPdu = Strings.dumpBytes(stream.array());
+ String decodedPdu = Strings.dumpBytes( stream.array() );
stream.flip();
// Allocate a LdapMessage Container
@@ -131,7 +193,7 @@ public class BindRequestPerfTest extends
assertTrue( bindRequest.isVersion3() );
assertEquals( "uid=akarasulu,dc=example,dc=com", bindRequest.getName().toString() );
assertTrue( bindRequest.isSimple() );
- assertEquals( "password", Strings.utf8ToString(bindRequest.getCredentials()) );
+ assertEquals( "password", Strings.utf8ToString( bindRequest.getCredentials() ) );
// Check the Control
Map<String, Control> controls = bindRequest.getControls();
@@ -139,7 +201,8 @@ public class BindRequestPerfTest extends
assertEquals( 1, controls.size() );
@SuppressWarnings("unchecked")
- CodecControl<Control> control = (org.apache.directory.shared.ldap.codec.api.CodecControl<Control> ) controls.get( "2.16.840.1.113730.3.4.2" );
+ CodecControl<Control> control = ( org.apache.directory.shared.ldap.codec.api.CodecControl<Control> ) controls
+ .get( "2.16.840.1.113730.3.4.2" );
assertEquals( "2.16.840.1.113730.3.4.2", control.getOid() );
assertEquals( "", Strings.dumpBytes( ( byte[] ) control.getValue() ) );
@@ -151,7 +214,7 @@ public class BindRequestPerfTest extends
// Check the length
assertEquals( 0x52, bb.limit() );
- String encodedPdu = Strings.dumpBytes(bb.array());
+ String encodedPdu = Strings.dumpBytes( bb.array() );
assertEquals( encodedPdu, decodedPdu );
}
@@ -183,7 +246,7 @@ public class BindRequestPerfTest extends
bindRequest.setSimple( true );
bindRequest.setDn( dn );
- bindRequest.setCredentials( Strings.getBytesUtf8("password") );
+ bindRequest.setCredentials( Strings.getBytesUtf8( "password" ) );
Control control = new OpaqueControl( "2.16.840.1.113730.3.4.2" );
bindRequest.addControl( control );
Modified: directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestTest.java?rev=1235364&r1=1235363&r2=1235364&view=diff
==============================================================================
--- directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestTest.java (original)
+++ directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestTest.java Tue Jan 24 17:27:00 2012
@@ -20,7 +20,7 @@
package org.apache.directory.shared.ldap.codec.bind;
-import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -169,22 +169,62 @@ public class BindRequestTest extends Abs
stream.put( new byte[]
{ 0x30,
0x33, // LDAPMessage ::=SEQUENCE {
- 0x02, 0x01,
+ 0x02,
+ 0x01,
0x01, // messageID MessageID
0x60,
0x2E, // CHOICE { ..., bindRequest BindRequest, ...
// BindRequest ::= APPLICATION[0] SEQUENCE {
- 0x02, 0x01,
+ 0x02,
+ 0x01,
0x03, // version INTEGER (1..127),
0x04,
0x1F, // name LDAPDN,
- 'u', 'i', 'd', '=', 'a', 'k', 'a', 'r', 'a', 's', 'u', 'l', 'u', ',', 'd', 'c', '=', 'e', 'x', 'a',
- 'm', 'p', 'l', 'e', ',', 'd', 'c', '=', 'c', 'o', 'm', ( byte ) 0x80, 0x08, // authentication AuthenticationChoice
+ 'u',
+ 'i',
+ 'd',
+ '=',
+ 'a',
+ 'k',
+ 'a',
+ 'r',
+ 'a',
+ 's',
+ 'u',
+ 'l',
+ 'u',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'e',
+ 'x',
+ 'a',
+ 'm',
+ 'p',
+ 'l',
+ 'e',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'c',
+ 'o',
+ 'm',
+ ( byte ) 0x80,
+ 0x08, // authentication AuthenticationChoice
// AuthenticationChoice ::= CHOICE { simple [0] OCTET STRING,
// ...
- 'p', 'a', 's', 's', 'w', 'o', 'r', 'd' } );
+ 'p',
+ 'a',
+ 's',
+ 's',
+ 'w',
+ 'o',
+ 'r',
+ 'd' } );
- String decodedPdu = Strings.dumpBytes(stream.array());
+ String decodedPdu = Strings.dumpBytes( stream.array() );
stream.flip();
// Allocate a LdapMessage Container
@@ -208,7 +248,7 @@ public class BindRequestTest extends Abs
assertTrue( bindRequest.isVersion3() );
assertEquals( "uid=akarasulu,dc=example,dc=com", bindRequest.getName() );
assertTrue( bindRequest.isSimple() );
- assertEquals( "password", Strings.utf8ToString(bindRequest.getCredentials()) );
+ assertEquals( "password", Strings.utf8ToString( bindRequest.getCredentials() ) );
// Check the encoding
try
@@ -218,7 +258,7 @@ public class BindRequestTest extends Abs
// Check the length
assertEquals( 0x35, bb.limit() );
- String encodedPdu = Strings.dumpBytes(bb.array());
+ String encodedPdu = Strings.dumpBytes( bb.array() );
assertEquals( encodedPdu, decodedPdu );
}
@@ -243,25 +283,65 @@ public class BindRequestTest extends Abs
stream.put( new byte[]
{ 0x30,
0x33, // LDAPMessage ::=SEQUENCE {
- 0x02, 0x01,
+ 0x02,
+ 0x01,
0x01, // messageID MessageID
0x60,
0x2E, // CHOICE { ..., bindRequest BindRequest, ...
// BindRequest ::= APPLICATION[0] SEQUENCE {
- 0x02, 0x01,
+ 0x02,
+ 0x01,
0x03, // version INTEGER (1..127),
0x04,
0x1F, // name LDAPDN,
- 'u', 'i', 'd', ':', 'a', 'k', 'a', 'r', 'a', 's', 'u', 'l', 'u', ',', 'd', 'c', '=', 'e', 'x', 'a',
- 'm', 'p', 'l', 'e', ',', 'd', 'c', '=', 'c', 'o', 'm', ( byte ) 0x80, 0x08, // authentication AuthenticationChoice
+ 'u',
+ 'i',
+ 'd',
+ ':',
+ 'a',
+ 'k',
+ 'a',
+ 'r',
+ 'a',
+ 's',
+ 'u',
+ 'l',
+ 'u',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'e',
+ 'x',
+ 'a',
+ 'm',
+ 'p',
+ 'l',
+ 'e',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'c',
+ 'o',
+ 'm',
+ ( byte ) 0x80,
+ 0x08, // authentication AuthenticationChoice
// AuthenticationChoice ::= CHOICE { simple [0] OCTET STRING,
// ...
- 'p', 'a', 's', 's', 'w', 'o', 'r', 'd' } );
+ 'p',
+ 'a',
+ 's',
+ 's',
+ 'w',
+ 'o',
+ 'r',
+ 'd' } );
stream.flip();
// Allocate a LdapMessage Container
- LdapMessageContainer<MessageDecorator<? extends Message>> container =
+ LdapMessageContainer<MessageDecorator<? extends Message>> container =
new LdapMessageContainer<MessageDecorator<? extends Message>>( codec );
// Decode the BindRequest PDU
@@ -295,14 +375,27 @@ public class BindRequestTest extends Abs
ByteBuffer stream = ByteBuffer.allocate( 0x15 );
stream.put( new byte[]
{ 0x30, 0x13, // LDAPMessage ::=SEQUENCE {
- 0x02, 0x01, 0x01, // messageID MessageID
- 0x60, 0x0D, // CHOICE { ..., bindRequest BindRequest, ...
+ 0x02,
+ 0x01,
+ 0x01, // messageID MessageID
+ 0x60,
+ 0x0D, // CHOICE { ..., bindRequest BindRequest, ...
// BindRequest ::= APPLICATION[0] SEQUENCE {
- 0x02, 0x01, 0x03, // version INTEGER (1..127),
- ( byte ) 0x80, 0x08, // authentication AuthenticationChoice
+ 0x02,
+ 0x01,
+ 0x03, // version INTEGER (1..127),
+ ( byte ) 0x80,
+ 0x08, // authentication AuthenticationChoice
// AuthenticationChoice ::= CHOICE { simple [0] OCTET STRING,
// ...
- 'p', 'a', 's', 's', 'w', 'o', 'r', 'd' } );
+ 'p',
+ 'a',
+ 's',
+ 's',
+ 'w',
+ 'o',
+ 'r',
+ 'd' } );
stream.flip();
@@ -316,7 +409,8 @@ public class BindRequestTest extends Abs
}
catch ( DecoderException de )
{
- assertEquals( "ERR_00001_BAD_TRANSITION_FROM_STATE Bad transition from state VERSION_STATE, tag 0x80", de.getMessage() );
+ assertEquals( "ERR_00001_BAD_TRANSITION_FROM_STATE Bad transition from state VERSION_STATE, tag 0x80",
+ de.getMessage() );
return;
}
@@ -336,17 +430,31 @@ public class BindRequestTest extends Abs
ByteBuffer stream = ByteBuffer.allocate( 0x16 );
stream.put( new byte[]
{ 0x30, 0x14, // LDAPMessage ::=SEQUENCE {
- 0x02, 0x01, 0x01, // messageID MessageID
- 0x60, 0x0F, // CHOICE { ..., bindRequest BindRequest, ...
+ 0x02,
+ 0x01,
+ 0x01, // messageID MessageID
+ 0x60,
+ 0x0F, // CHOICE { ..., bindRequest BindRequest, ...
// BindRequest ::= APPLICATION[0] SEQUENCE {
- 0x02, 0x01, 0x03, // version INTEGER (1..127),
- 0x04, 0x00, // name LDAPDN,
- ( byte ) 0x80, 0x08, // authentication AuthenticationChoice
+ 0x02,
+ 0x01,
+ 0x03, // version INTEGER (1..127),
+ 0x04,
+ 0x00, // name LDAPDN,
+ ( byte ) 0x80,
+ 0x08, // authentication AuthenticationChoice
// AuthenticationChoice ::= CHOICE { simple [0] OCTET STRING,
// ...
- 'p', 'a', 's', 's', 'w', 'o', 'r', 'd' } );
+ 'p',
+ 'a',
+ 's',
+ 's',
+ 'w',
+ 'o',
+ 'r',
+ 'd' } );
- String decodedPdu = Strings.dumpBytes(stream.array());
+ String decodedPdu = Strings.dumpBytes( stream.array() );
stream.flip();
@@ -371,7 +479,7 @@ public class BindRequestTest extends Abs
assertTrue( bindRequest.isVersion3() );
assertEquals( "", bindRequest.getName() );
assertTrue( bindRequest.isSimple() );
- assertEquals( "password", Strings.utf8ToString(bindRequest.getCredentials()) );
+ assertEquals( "password", Strings.utf8ToString( bindRequest.getCredentials() ) );
// Check the encoding
try
@@ -381,7 +489,7 @@ public class BindRequestTest extends Abs
// Check the length
assertEquals( 0x16, bb.limit() );
- String encodedPdu = Strings.dumpBytes(bb.array());
+ String encodedPdu = Strings.dumpBytes( bb.array() );
assertEquals( encodedPdu, decodedPdu );
}
@@ -406,25 +514,70 @@ public class BindRequestTest extends Abs
stream.put( new byte[]
{ 0x30,
0x38, // LDAPMessage ::=SEQUENCE {
- 0x02, 0x01,
+ 0x02,
+ 0x01,
0x01, // messageID MessageID
0x60,
0x33, // CHOICE { ..., bindRequest BindRequest, ...
// BindRequest ::= APPLICATION[0] SEQUENCE {
- 0x02, 0x01,
+ 0x02,
+ 0x01,
0x03, // version INTEGER (1..127),
0x04,
0x1F, // name LDAPDN,
- 'u', 'i', 'd', '=', 'a', 'k', 'a', 'r', 'a', 's', 'u', 'l', 'u', ',', 'd', 'c', '=', 'e', 'x', 'a',
- 'm', 'p', 'l', 'e', ',', 'd', 'c', '=', 'c', 'o', 'm', ( byte ) 0xA3, 0x0D, // authentication AuthenticationChoice
+ 'u',
+ 'i',
+ 'd',
+ '=',
+ 'a',
+ 'k',
+ 'a',
+ 'r',
+ 'a',
+ 's',
+ 'u',
+ 'l',
+ 'u',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'e',
+ 'x',
+ 'a',
+ 'm',
+ 'p',
+ 'l',
+ 'e',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'c',
+ 'o',
+ 'm',
+ ( byte ) 0xA3,
+ 0x0D, // authentication AuthenticationChoice
// AuthenticationChoice ::= CHOICE { ... sasl [3]
// SaslCredentials }
// SaslCredentials ::= SEQUENCE {
// mechanism LDAPSTRING,
// ...
- 0x04, 0x0B, 'K', 'E', 'R', 'B', 'E', 'R', 'O', 'S', '_', 'V', '4' } );
+ 0x04,
+ 0x0B,
+ 'K',
+ 'E',
+ 'R',
+ 'B',
+ 'E',
+ 'R',
+ 'O',
+ 'S',
+ '_',
+ 'V',
+ '4' } );
- String decodedPdu = Strings.dumpBytes(stream.array());
+ String decodedPdu = Strings.dumpBytes( stream.array() );
stream.flip();
// Allocate a LdapMessage Container
@@ -458,7 +611,7 @@ public class BindRequestTest extends Abs
// Check the length
assertEquals( 0x3A, bb.limit() );
- String encodedPdu = Strings.dumpBytes(bb.array());
+ String encodedPdu = Strings.dumpBytes( bb.array() );
assertEquals( encodedPdu, decodedPdu );
}
@@ -483,30 +636,82 @@ public class BindRequestTest extends Abs
stream.put( new byte[]
{ 0x30,
0x40, // LDAPMessage ::=SEQUENCE {
- 0x02, 0x01,
+ 0x02,
+ 0x01,
0x01, // messageID MessageID
0x60,
0x3B, // CHOICE { ..., bindRequest BindRequest, ...
// BindRequest ::= APPLICATION[0] SEQUENCE {
- 0x02, 0x01,
+ 0x02,
+ 0x01,
0x03, // version INTEGER (1..127),
0x04,
0x1F, // name LDAPDN,
- 'u', 'i', 'd', '=', 'a', 'k', 'a', 'r', 'a', 's', 'u', 'l', 'u', ',', 'd', 'c', '=', 'e', 'x', 'a',
- 'm', 'p', 'l', 'e', ',', 'd', 'c', '=', 'c', 'o', 'm', ( byte ) 0xA3, 0x15, // authentication AuthenticationChoice
+ 'u',
+ 'i',
+ 'd',
+ '=',
+ 'a',
+ 'k',
+ 'a',
+ 'r',
+ 'a',
+ 's',
+ 'u',
+ 'l',
+ 'u',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'e',
+ 'x',
+ 'a',
+ 'm',
+ 'p',
+ 'l',
+ 'e',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'c',
+ 'o',
+ 'm',
+ ( byte ) 0xA3,
+ 0x15, // authentication AuthenticationChoice
// }
// AuthenticationChoice ::= CHOICE { ... sasl [3]
// SaslCredentials }
// SaslCredentials ::= SEQUENCE {
// mechanism LDAPSTRING,
// ...
- 0x04, 0x0B, 'K', 'E', 'R', 'B', 'E', 'R', 'O', 'S', '_', 'V', '4', ( byte ) 0x04, 0x06, // SaslCredentials ::= SEQUENCE {
+ 0x04,
+ 0x0B,
+ 'K',
+ 'E',
+ 'R',
+ 'B',
+ 'E',
+ 'R',
+ 'O',
+ 'S',
+ '_',
+ 'V',
+ '4',
+ ( byte ) 0x04,
+ 0x06, // SaslCredentials ::= SEQUENCE {
// ...
// credentials OCTET STRING OPTIONAL }
//
- 'a', 'b', 'c', 'd', 'e', 'f' } );
+ 'a',
+ 'b',
+ 'c',
+ 'd',
+ 'e',
+ 'f' } );
- String decodedPdu = Strings.dumpBytes(stream.array());
+ String decodedPdu = Strings.dumpBytes( stream.array() );
stream.flip();
// Allocate a LdapMessage Container
@@ -531,7 +736,7 @@ public class BindRequestTest extends Abs
assertEquals( "uid=akarasulu,dc=example,dc=com", bindRequest.getName() );
assertFalse( bindRequest.isSimple() );
assertEquals( "KERBEROS_V4", bindRequest.getSaslMechanism() );
- assertEquals( "abcdef", Strings.utf8ToString(bindRequest.getCredentials()) );
+ assertEquals( "abcdef", Strings.utf8ToString( bindRequest.getCredentials() ) );
// Check the encoding
try
@@ -541,7 +746,7 @@ public class BindRequestTest extends Abs
// Check the length
assertEquals( 0x42, bb.limit() );
- String encodedPdu = Strings.dumpBytes(bb.array());
+ String encodedPdu = Strings.dumpBytes( bb.array() );
assertEquals( encodedPdu, decodedPdu );
}
@@ -565,25 +770,51 @@ public class BindRequestTest extends Abs
ByteBuffer stream = ByteBuffer.allocate( 0x23 );
stream.put( new byte[]
{ 0x30, 0x21, // LDAPMessage ::=SEQUENCE {
- 0x02, 0x01, 0x01, // messageID MessageID
- 0x60, 0x1C, // CHOICE { ..., bindRequest BindRequest, ...
+ 0x02,
+ 0x01,
+ 0x01, // messageID MessageID
+ 0x60,
+ 0x1C, // CHOICE { ..., bindRequest BindRequest, ...
// BindRequest ::= APPLICATION[0] SEQUENCE {
- 0x02, 0x01, 0x03, // version INTEGER (1..127),
- 0x04, 0x00, // name LDAPDN,
- ( byte ) 0xA3, 0x15, // authentication AuthenticationChoice
+ 0x02,
+ 0x01,
+ 0x03, // version INTEGER (1..127),
+ 0x04,
+ 0x00, // name LDAPDN,
+ ( byte ) 0xA3,
+ 0x15, // authentication AuthenticationChoice
// }
// AuthenticationChoice ::= CHOICE { ... sasl [3]
// SaslCredentials }
// SaslCredentials ::= SEQUENCE {
// mechanism LDAPSTRING,
// ...
- 0x04, 0x0B, 'K', 'E', 'R', 'B', 'E', 'R', 'O', 'S', '_', 'V', '4', ( byte ) 0x04, 0x06, // SaslCredentials ::= SEQUENCE {
+ 0x04,
+ 0x0B,
+ 'K',
+ 'E',
+ 'R',
+ 'B',
+ 'E',
+ 'R',
+ 'O',
+ 'S',
+ '_',
+ 'V',
+ '4',
+ ( byte ) 0x04,
+ 0x06, // SaslCredentials ::= SEQUENCE {
// ...
// credentials OCTET STRING OPTIONAL }
//
- 'a', 'b', 'c', 'd', 'e', 'f' } );
+ 'a',
+ 'b',
+ 'c',
+ 'd',
+ 'e',
+ 'f' } );
- String decodedPdu = Strings.dumpBytes(stream.array());
+ String decodedPdu = Strings.dumpBytes( stream.array() );
stream.flip();
// Allocate a LdapMessage Container
@@ -608,7 +839,7 @@ public class BindRequestTest extends Abs
assertEquals( "", bindRequest.getName() );
assertFalse( bindRequest.isSimple() );
assertEquals( "KERBEROS_V4", bindRequest.getSaslMechanism() );
- assertEquals( "abcdef", Strings.utf8ToString(bindRequest.getCredentials()) );
+ assertEquals( "abcdef", Strings.utf8ToString( bindRequest.getCredentials() ) );
// Check the encoding
try
@@ -618,7 +849,7 @@ public class BindRequestTest extends Abs
// Check the length
assertEquals( 0x23, bb.limit() );
- String encodedPdu = Strings.dumpBytes(bb.array());
+ String encodedPdu = Strings.dumpBytes( bb.array() );
assertEquals( encodedPdu, decodedPdu );
}
@@ -641,9 +872,12 @@ public class BindRequestTest extends Abs
ByteBuffer stream = ByteBuffer.allocate( 0x07 );
stream.put( new byte[]
{ 0x30, 0x05, // LDAPMessage ::=SEQUENCE {
- 0x02, 0x01, 0x01, // messageID MessageID
- 0x60, 0x00 // CHOICE { ..., bindRequest BindRequest, ...
- } );
+ 0x02,
+ 0x01,
+ 0x01, // messageID MessageID
+ 0x60,
+ 0x00 // CHOICE { ..., bindRequest BindRequest, ...
+ } );
stream.flip();
@@ -676,10 +910,14 @@ public class BindRequestTest extends Abs
ByteBuffer stream = ByteBuffer.allocate( 0x09 );
stream.put( new byte[]
{ 0x30, 0x07, // LDAPMessage ::=SEQUENCE {
- 0x02, 0x01, 0x01, // messageID MessageID
- 0x60, 0x02, // CHOICE { ..., bindRequest BindRequest, ...
- 0x02, 0x00 // version INTEGER (1..127),
- } );
+ 0x02,
+ 0x01,
+ 0x01, // messageID MessageID
+ 0x60,
+ 0x02, // CHOICE { ..., bindRequest BindRequest, ...
+ 0x02,
+ 0x00 // version INTEGER (1..127),
+ } );
stream.flip();
@@ -712,10 +950,15 @@ public class BindRequestTest extends Abs
ByteBuffer stream = ByteBuffer.allocate( 0x0A );
stream.put( new byte[]
{ 0x30, 0x08, // LDAPMessage ::=SEQUENCE {
- 0x02, 0x01, 0x01, // messageID MessageID
- 0x60, 0x03, // CHOICE { ..., bindRequest BindRequest, ...
- 0x02, 0x01, 0x00 // version INTEGER (1..127),
- } );
+ 0x02,
+ 0x01,
+ 0x01, // messageID MessageID
+ 0x60,
+ 0x03, // CHOICE { ..., bindRequest BindRequest, ...
+ 0x02,
+ 0x01,
+ 0x00 // version INTEGER (1..127),
+ } );
stream.flip();
@@ -748,10 +991,15 @@ public class BindRequestTest extends Abs
ByteBuffer stream = ByteBuffer.allocate( 0x0A );
stream.put( new byte[]
{ 0x30, 0x08, // LDAPMessage ::=SEQUENCE {
- 0x02, 0x01, 0x01, // messageID MessageID
- 0x60, 0x03, // CHOICE { ..., bindRequest BindRequest, ...
- 0x02, 0x01, 0x04 // version INTEGER (1..127),
- } );
+ 0x02,
+ 0x01,
+ 0x01, // messageID MessageID
+ 0x60,
+ 0x03, // CHOICE { ..., bindRequest BindRequest, ...
+ 0x02,
+ 0x01,
+ 0x04 // version INTEGER (1..127),
+ } );
stream.flip();
@@ -784,10 +1032,16 @@ public class BindRequestTest extends Abs
ByteBuffer stream = ByteBuffer.allocate( 0x0C );
stream.put( new byte[]
{ 0x30, 0x0A, // LDAPMessage ::=SEQUENCE {
- 0x02, 0x01, 0x01, // messageID MessageID
- 0x60, 0x04, // CHOICE { ..., bindRequest BindRequest, ...
- 0x02, 0x02, 0x00, ( byte ) 0x80 // version INTEGER (1..127),
- } );
+ 0x02,
+ 0x01,
+ 0x01, // messageID MessageID
+ 0x60,
+ 0x04, // CHOICE { ..., bindRequest BindRequest, ...
+ 0x02,
+ 0x02,
+ 0x00,
+ ( byte ) 0x80 // version INTEGER (1..127),
+ } );
stream.flip();
@@ -820,10 +1074,15 @@ public class BindRequestTest extends Abs
ByteBuffer stream = ByteBuffer.allocate( 0x0A );
stream.put( new byte[]
{ 0x30, 0x08, // LDAPMessage ::=SEQUENCE {
- 0x02, 0x01, 0x01, // messageID MessageID
- 0x60, 0x03, // CHOICE { ..., bindRequest BindRequest, ...
- 0x02, 0x01, 0x03 // version INTEGER (1..127),
- } );
+ 0x02,
+ 0x01,
+ 0x01, // messageID MessageID
+ 0x60,
+ 0x03, // CHOICE { ..., bindRequest BindRequest, ...
+ 0x02,
+ 0x01,
+ 0x03 // version INTEGER (1..127),
+ } );
stream.flip();
@@ -856,10 +1115,16 @@ public class BindRequestTest extends Abs
ByteBuffer stream = ByteBuffer.allocate( 0x0C );
stream.put( new byte[]
{ 0x30, 0x0A, // LDAPMessage ::=SEQUENCE {
- 0x02, 0x01, 0x01, // messageID MessageID
- 0x60, 0x05, // CHOICE { ..., bindRequest BindRequest, ...
- 0x02, 0x01, 0x03, // version INTEGER (1..127),
- 0x04, 0x00 } );
+ 0x02,
+ 0x01,
+ 0x01, // messageID MessageID
+ 0x60,
+ 0x05, // CHOICE { ..., bindRequest BindRequest, ...
+ 0x02,
+ 0x01,
+ 0x03, // version INTEGER (1..127),
+ 0x04,
+ 0x00 } );
stream.flip();
@@ -892,12 +1157,20 @@ public class BindRequestTest extends Abs
ByteBuffer stream = ByteBuffer.allocate( 0x0E );
stream.put( new byte[]
{ 0x30, 0x0C, // LDAPMessage ::=SEQUENCE {
- 0x02, 0x01, 0x01, // messageID MessageID
- 0x60, 0x07, // CHOICE { ..., bindRequest BindRequest, ...
- 0x02, 0x01, 0x03, // version INTEGER (1..127),
- 0x04, 0x00, ( byte ) 0x80, 0x00 } );
+ 0x02,
+ 0x01,
+ 0x01, // messageID MessageID
+ 0x60,
+ 0x07, // CHOICE { ..., bindRequest BindRequest, ...
+ 0x02,
+ 0x01,
+ 0x03, // version INTEGER (1..127),
+ 0x04,
+ 0x00,
+ ( byte ) 0x80,
+ 0x00 } );
- String decodedPdu = Strings.dumpBytes(stream.array());
+ String decodedPdu = Strings.dumpBytes( stream.array() );
stream.flip();
// Allocate a LdapMessage Container
@@ -921,7 +1194,7 @@ public class BindRequestTest extends Abs
assertTrue( bindRequest.isVersion3() );
assertEquals( "", bindRequest.getName() );
assertTrue( bindRequest.isSimple() );
- assertEquals( "", Strings.utf8ToString(bindRequest.getCredentials()) );
+ assertEquals( "", Strings.utf8ToString( bindRequest.getCredentials() ) );
// Check the encoding
try
@@ -931,7 +1204,7 @@ public class BindRequestTest extends Abs
// Check the length
assertEquals( 0x0E, bb.limit() );
- String encodedPdu = Strings.dumpBytes(bb.array());
+ String encodedPdu = Strings.dumpBytes( bb.array() );
assertEquals( encodedPdu, decodedPdu );
}
@@ -954,10 +1227,18 @@ public class BindRequestTest extends Abs
ByteBuffer stream = ByteBuffer.allocate( 0x0E );
stream.put( new byte[]
{ 0x30, 0x0C, // LDAPMessage ::=SEQUENCE {
- 0x02, 0x01, 0x01, // messageID MessageID
- 0x60, 0x07, // CHOICE { ..., bindRequest BindRequest, ...
- 0x02, 0x01, 0x03, // version INTEGER (1..127),
- 0x04, 0x00, ( byte ) 0xA3, 0x00 } );
+ 0x02,
+ 0x01,
+ 0x01, // messageID MessageID
+ 0x60,
+ 0x07, // CHOICE { ..., bindRequest BindRequest, ...
+ 0x02,
+ 0x01,
+ 0x03, // version INTEGER (1..127),
+ 0x04,
+ 0x00,
+ ( byte ) 0xA3,
+ 0x00 } );
stream.flip();
@@ -994,12 +1275,22 @@ public class BindRequestTest extends Abs
ByteBuffer stream = ByteBuffer.allocate( 0x10 );
stream.put( new byte[]
{ 0x30, 0x0E, // LDAPMessage ::=SEQUENCE {
- 0x02, 0x01, 0x01, // messageID MessageID
- 0x60, 0x09, // CHOICE { ..., bindRequest BindRequest, ...
- 0x02, 0x01, 0x03, // version INTEGER (1..127),
- 0x04, 0x00, ( byte ) 0xA3, 0x02, 0x04, 0x00 } );
+ 0x02,
+ 0x01,
+ 0x01, // messageID MessageID
+ 0x60,
+ 0x09, // CHOICE { ..., bindRequest BindRequest, ...
+ 0x02,
+ 0x01,
+ 0x03, // version INTEGER (1..127),
+ 0x04,
+ 0x00,
+ ( byte ) 0xA3,
+ 0x02,
+ 0x04,
+ 0x00 } );
- String decodedPdu = Strings.dumpBytes(stream.array());
+ String decodedPdu = Strings.dumpBytes( stream.array() );
stream.flip();
// Allocate a LdapMessage Container
@@ -1033,7 +1324,7 @@ public class BindRequestTest extends Abs
// Check the length
assertEquals( 0x10, bb.limit() );
- String encodedPdu = Strings.dumpBytes(bb.array());
+ String encodedPdu = Strings.dumpBytes( bb.array() );
assertEquals( encodedPdu, decodedPdu );
}
@@ -1100,12 +1391,24 @@ public class BindRequestTest extends Abs
ByteBuffer stream = ByteBuffer.allocate( 0x12 );
stream.put( new byte[]
{ 0x30, 0x10, // LDAPMessage ::=SEQUENCE {
- 0x02, 0x01, 0x01, // messageID MessageID
- 0x60, 0x0B, // CHOICE { ..., bindRequest BindRequest, ...
- 0x02, 0x01, 0x03, // version INTEGER (1..127),
- 0x04, 0x00, ( byte ) 0xA3, 0x04, 0x04, 0x00, 0x04, 0x00, } );
+ 0x02,
+ 0x01,
+ 0x01, // messageID MessageID
+ 0x60,
+ 0x0B, // CHOICE { ..., bindRequest BindRequest, ...
+ 0x02,
+ 0x01,
+ 0x03, // version INTEGER (1..127),
+ 0x04,
+ 0x00,
+ ( byte ) 0xA3,
+ 0x04,
+ 0x04,
+ 0x00,
+ 0x04,
+ 0x00, } );
- String decodedPdu = Strings.dumpBytes(stream.array());
+ String decodedPdu = Strings.dumpBytes( stream.array() );
stream.flip();
// Allocate a LdapMessage Container
@@ -1130,7 +1433,7 @@ public class BindRequestTest extends Abs
assertEquals( "", bindRequest.getName() );
assertFalse( bindRequest.isSimple() );
assertEquals( "", bindRequest.getSaslMechanism() );
- assertEquals( "", Strings.utf8ToString(bindRequest.getCredentials()) );
+ assertEquals( "", Strings.utf8ToString( bindRequest.getCredentials() ) );
// Check the encoding
try
@@ -1140,7 +1443,7 @@ public class BindRequestTest extends Abs
// Check the length
assertEquals( 0x12, bb.limit() );
- String encodedPdu = Strings.dumpBytes(bb.array());
+ String encodedPdu = Strings.dumpBytes( bb.array() );
assertEquals( encodedPdu, decodedPdu );
}
@@ -1165,18 +1468,53 @@ public class BindRequestTest extends Abs
stream.put( new byte[]
{ 0x30,
0x2D, // LDAPMessage ::=SEQUENCE {
- 0x02, 0x01,
+ 0x02,
+ 0x01,
0x01, // messageID MessageID
0x60,
0x0B, // CHOICE { ..., bindRequest BindRequest, ...
- 0x02, 0x01,
+ 0x02,
+ 0x01,
0x03, // version INTEGER (1..127),
- 0x04, 0x00, ( byte ) 0xA3, 0x04, 0x04, 0x00, 0x04, 0x00, ( byte ) 0xA0,
+ 0x04,
+ 0x00,
+ ( byte ) 0xA3,
+ 0x04,
+ 0x04,
+ 0x00,
+ 0x04,
+ 0x00,
+ ( byte ) 0xA0,
0x1B, // A control
- 0x30, 0x19, 0x04, 0x17, 0x32, 0x2E, 0x31, 0x36, 0x2E, 0x38, 0x34, 0x30, 0x2E, 0x31, 0x2E, 0x31, 0x31,
- 0x33, 0x37, 0x33, 0x30, 0x2E, 0x33, 0x2E, 0x34, 0x2E, 0x32 } );
+ 0x30,
+ 0x19,
+ 0x04,
+ 0x17,
+ 0x32,
+ 0x2E,
+ 0x31,
+ 0x36,
+ 0x2E,
+ 0x38,
+ 0x34,
+ 0x30,
+ 0x2E,
+ 0x31,
+ 0x2E,
+ 0x31,
+ 0x31,
+ 0x33,
+ 0x37,
+ 0x33,
+ 0x30,
+ 0x2E,
+ 0x33,
+ 0x2E,
+ 0x34,
+ 0x2E,
+ 0x32 } );
- String decodedPdu = Strings.dumpBytes(stream.array());
+ String decodedPdu = Strings.dumpBytes( stream.array() );
stream.flip();
// Allocate a LdapMessage Container
@@ -1201,7 +1539,7 @@ public class BindRequestTest extends Abs
assertEquals( "", bindRequest.getName() );
assertFalse( bindRequest.isSimple() );
assertEquals( "", bindRequest.getSaslMechanism() );
- assertEquals( "", Strings.utf8ToString(bindRequest.getCredentials()) );
+ assertEquals( "", Strings.utf8ToString( bindRequest.getCredentials() ) );
// Check the Control
Map<String, Control> controls = bindRequest.getControls();
@@ -1209,7 +1547,8 @@ public class BindRequestTest extends Abs
assertEquals( 1, controls.size() );
@SuppressWarnings("unchecked")
- CodecControl<Control> control = (org.apache.directory.shared.ldap.codec.api.CodecControl<Control> ) controls.get( "2.16.840.1.113730.3.4.2" );
+ CodecControl<Control> control = ( org.apache.directory.shared.ldap.codec.api.CodecControl<Control> ) controls
+ .get( "2.16.840.1.113730.3.4.2" );
assertEquals( "2.16.840.1.113730.3.4.2", control.getOid() );
assertEquals( "", Strings.dumpBytes( ( byte[] ) control.getValue() ) );
@@ -1221,7 +1560,7 @@ public class BindRequestTest extends Abs
// Check the length
assertEquals( 0x2F, bb.limit() );
- String encodedPdu = Strings.dumpBytes(bb.array());
+ String encodedPdu = Strings.dumpBytes( bb.array() );
assertEquals( encodedPdu, decodedPdu );
}
@@ -1245,18 +1584,51 @@ public class BindRequestTest extends Abs
stream.put( new byte[]
{ 0x30,
0x2B, // LDAPMessage ::=SEQUENCE {
- 0x02, 0x01,
+ 0x02,
+ 0x01,
0x01, // messageID MessageID
0x60,
0x09, // CHOICE { ..., bindRequest BindRequest, ...
- 0x02, 0x01,
+ 0x02,
+ 0x01,
0x03, // version INTEGER (1..127),
- 0x04, 0x00, ( byte ) 0xA3, 0x02, 0x04, 0x00, ( byte ) 0xA0,
+ 0x04,
+ 0x00,
+ ( byte ) 0xA3,
+ 0x02,
+ 0x04,
+ 0x00,
+ ( byte ) 0xA0,
0x1B, // A control
- 0x30, 0x19, 0x04, 0x17, 0x32, 0x2E, 0x31, 0x36, 0x2E, 0x38, 0x34, 0x30, 0x2E, 0x31, 0x2E, 0x31, 0x31,
- 0x33, 0x37, 0x33, 0x30, 0x2E, 0x33, 0x2E, 0x34, 0x2E, 0x32 } );
+ 0x30,
+ 0x19,
+ 0x04,
+ 0x17,
+ 0x32,
+ 0x2E,
+ 0x31,
+ 0x36,
+ 0x2E,
+ 0x38,
+ 0x34,
+ 0x30,
+ 0x2E,
+ 0x31,
+ 0x2E,
+ 0x31,
+ 0x31,
+ 0x33,
+ 0x37,
+ 0x33,
+ 0x30,
+ 0x2E,
+ 0x33,
+ 0x2E,
+ 0x34,
+ 0x2E,
+ 0x32 } );
- String decodedPdu = Strings.dumpBytes(stream.array());
+ String decodedPdu = Strings.dumpBytes( stream.array() );
stream.flip();
// Allocate a LdapMessage Container
@@ -1281,7 +1653,7 @@ public class BindRequestTest extends Abs
assertEquals( "", bindRequest.getName() );
assertFalse( bindRequest.isSimple() );
assertEquals( "", bindRequest.getSaslMechanism() );
- assertEquals( "", Strings.utf8ToString(bindRequest.getCredentials()) );
+ assertEquals( "", Strings.utf8ToString( bindRequest.getCredentials() ) );
// Check the Control
Map<String, Control> controls = bindRequest.getControls();
@@ -1289,7 +1661,8 @@ public class BindRequestTest extends Abs
assertEquals( 1, controls.size() );
@SuppressWarnings("unchecked")
- CodecControl<Control> control = (org.apache.directory.shared.ldap.codec.api.CodecControl<Control> ) controls.get( "2.16.840.1.113730.3.4.2" );
+ CodecControl<Control> control = ( org.apache.directory.shared.ldap.codec.api.CodecControl<Control> ) controls
+ .get( "2.16.840.1.113730.3.4.2" );
assertEquals( "2.16.840.1.113730.3.4.2", control.getOid() );
assertEquals( "", Strings.dumpBytes( ( byte[] ) control.getValue() ) );
@@ -1301,7 +1674,7 @@ public class BindRequestTest extends Abs
// Check the length
assertEquals( 0x2D, bb.limit() );
- String encodedPdu = Strings.dumpBytes(bb.array());
+ String encodedPdu = Strings.dumpBytes( bb.array() );
assertEquals( encodedPdu, decodedPdu );
}