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 [19/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/search/SearchResultDoneTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultDoneTest.java?rev=1235364&r1=1235363&r2=1235364&view=diff
==============================================================================
--- directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultDoneTest.java (original)
+++ directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultDoneTest.java Tue Jan 24 17:27:00 2012
@@ -66,24 +66,31 @@ public class SearchResultDoneTest extend
stream.put( new byte[]
{ 0x30, 0x0C, // LDAPMessage ::=SEQUENCE {
- 0x02, 0x01, 0x01, // messageID MessageID
- 0x65, 0x07, // CHOICE { ..., searchResDone SearchResultDone, ...
+ 0x02,
+ 0x01,
+ 0x01, // messageID MessageID
+ 0x65,
+ 0x07, // CHOICE { ..., searchResDone SearchResultDone, ...
// SearchResultDone ::= [APPLICATION 5] 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 SearchResultDone Container
- LdapMessageContainer<SearchResultDoneDecorator> ldapMessageContainer =
+ LdapMessageContainer<SearchResultDoneDecorator> ldapMessageContainer =
new LdapMessageContainer<SearchResultDoneDecorator>( codec );
try
@@ -111,7 +118,7 @@ public class SearchResultDoneTest extend
// Check the length
assertEquals( 0x0E, bb.limit() );
- String encodedPdu = Strings.dumpBytes(bb.array());
+ String encodedPdu = Strings.dumpBytes( bb.array() );
assertEquals( encodedPdu, decodedPdu );
}
@@ -136,7 +143,8 @@ public class SearchResultDoneTest extend
stream.put( new byte[]
{ 0x30,
0x29, // LDAPMessage ::=SEQUENCE {
- 0x02, 0x01,
+ 0x02,
+ 0x01,
0x01, // messageID MessageID
0x65,
0x07, // CHOICE { ..., searchResDone SearchResultDone, ...
@@ -155,16 +163,41 @@ public class SearchResultDoneTest extend
// }
( 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 BindRequest Container
- LdapMessageContainer<SearchResultDoneDecorator> ldapMessageContainer =
+ LdapMessageContainer<SearchResultDoneDecorator> ldapMessageContainer =
new LdapMessageContainer<SearchResultDoneDecorator>( codec );
try
@@ -190,9 +223,10 @@ public class SearchResultDoneTest extend
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() ) );
// Check the encoding
try
@@ -202,7 +236,7 @@ public class SearchResultDoneTest extend
// Check the length
assertEquals( 0x2B, bb.limit() );
- String encodedPdu = Strings.dumpBytes(bb.array());
+ String encodedPdu = Strings.dumpBytes( bb.array() );
assertEquals( encodedPdu, decodedPdu );
}
@@ -226,14 +260,17 @@ public class SearchResultDoneTest extend
stream.put( new byte[]
{ 0x30, 0x05, // LDAPMessage ::=SEQUENCE {
- 0x02, 0x01, 0x01, // messageID MessageID
- 0x65, 0x00 // CHOICE { ..., searchResDone SearchResultDone, ...
- } );
+ 0x02,
+ 0x01,
+ 0x01, // messageID MessageID
+ 0x65,
+ 0x00 // CHOICE { ..., searchResDone SearchResultDone, ...
+ } );
stream.flip();
// Allocate a LdapMessage Container
- LdapMessageContainer<SearchResultDoneDecorator> ldapMessageContainer =
+ LdapMessageContainer<SearchResultDoneDecorator> ldapMessageContainer =
new LdapMessageContainer<SearchResultDoneDecorator>( codec );
// Decode a SearchResultDone message
@@ -249,8 +286,8 @@ public class SearchResultDoneTest extend
fail( "We should not reach this point" );
}
-
-
+
+
/**
* Test the decoding of a SearchResultDone with a result code of length 2 bytes
*/
@@ -263,24 +300,32 @@ public class SearchResultDoneTest extend
stream.put( new byte[]
{ 0x30, 0x0D, // LDAPMessage ::=SEQUENCE {
- 0x02, 0x01, 0x01, // messageID MessageID
- 0x65, 0x08, // CHOICE { ..., searchResDone SearchResultDone, ...
+ 0x02,
+ 0x01,
+ 0x01, // messageID MessageID
+ 0x65,
+ 0x08, // CHOICE { ..., searchResDone SearchResultDone, ...
// SearchResultDone ::= [APPLICATION 5] LDAPResult
- 0x0A, 0x02, 0x10, 0x00, // LDAPResult ::= SEQUENCE {
+ 0x0A,
+ 0x02,
+ 0x10,
+ 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 SearchResultDone Container
- LdapMessageContainer<SearchResultDoneDecorator> ldapMessageContainer =
+ LdapMessageContainer<SearchResultDoneDecorator> ldapMessageContainer =
new LdapMessageContainer<SearchResultDoneDecorator>( codec );
try
@@ -308,7 +353,7 @@ public class SearchResultDoneTest extend
// Check the length
assertEquals( 0x0F, 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/search/SearchResultEntryTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntryTest.java?rev=1235364&r1=1235363&r2=1235364&view=diff
==============================================================================
--- directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntryTest.java (original)
+++ directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntryTest.java Tue Jan 24 17:27:00 2012
@@ -70,7 +70,7 @@ public class SearchResultEntryTest exten
stream.put( new byte[]
{
- 0x30,
+ 0x30,
0x4e, // LDAPMessage ::=SEQUENCE {
0x02,
0x01,
@@ -80,25 +80,91 @@ public class SearchResultEntryTest exten
// ...
// SearchResultEntry ::= [APPLICATION 4] SEQUENCE {
// objectName LDAPDN,
- 0x04, 0x1b, 'o', 'u', '=', 'c', 'o', 'n', 't', 'a', 'c', 't', 's', ',', 'd', 'c', '=', 'i', 'k', 't',
- 'e', 'k', ',', 'd', 'c', '=', 'c', 'o', 'm',
+ 0x04,
+ 0x1b,
+ 'o',
+ 'u',
+ '=',
+ 'c',
+ 'o',
+ 'n',
+ 't',
+ 'a',
+ 'c',
+ 't',
+ 's',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'i',
+ 'k',
+ 't',
+ 'e',
+ 'k',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'c',
+ 'o',
+ 'm',
// attributes PartialAttributeList }
// PartialAttributeList ::= SEQUENCE OF SEQUENCE {
- 0x30, 0x2a, 0x30, 0x28,
+ 0x30,
+ 0x2a,
+ 0x30,
+ 0x28,
// type AttributeDescription,
- 0x04, 0x0b, 'o', 'b', 'j', 'e', 'c', 't', 'c', 'l', 'a', 's', 's',
+ 0x04,
+ 0x0b,
+ 'o',
+ 'b',
+ 'j',
+ 'e',
+ 'c',
+ 't',
+ 'c',
+ 'l',
+ 'a',
+ 's',
+ 's',
// vals SET OF AttributeValue }
- 0x31, 0x19,
+ 0x31,
+ 0x19,
// AttributeValue ::= OCTET STRING
- 0x04, 0x03, 't', 'o', 'p',
+ 0x04,
+ 0x03,
+ 't',
+ 'o',
+ 'p',
// AttributeValue ::= OCTET STRING
- 0x04, 0x12, 'o', 'r', 'g', 'a', 'n', 'i', 'z', 'a', 't', 'i', 'o', 'n', 'a', 'l', 'U', 'n', 'i', 't' } );
+ 0x04,
+ 0x12,
+ 'o',
+ 'r',
+ 'g',
+ 'a',
+ 'n',
+ 'i',
+ 'z',
+ 'a',
+ 't',
+ 'i',
+ 'o',
+ 'n',
+ 'a',
+ 'l',
+ 'U',
+ 'n',
+ 'i',
+ 't' } );
- String decodedPdu = Strings.dumpBytes(stream.array());
+ String decodedPdu = Strings.dumpBytes( stream.array() );
stream.flip();
// Allocate a BindRequest Container
- LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer =
+ LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer =
new LdapMessageContainer<SearchResultEntryDecorator>( codec );
try
@@ -138,7 +204,7 @@ public class SearchResultEntryTest exten
// Check the length
assertEquals( 0x50, bb.limit() );
- String encodedPdu = Strings.dumpBytes(bb.array());
+ String encodedPdu = Strings.dumpBytes( bb.array() );
assertEquals( encodedPdu, decodedPdu );
}
@@ -172,34 +238,137 @@ public class SearchResultEntryTest exten
// ...
// SearchResultEntry ::= [APPLICATION 4] SEQUENCE {
// objectName LDAPDN,
- 0x04, 0x1b, 'o', 'u', '=', 'c', 'o', 'n', 't', 'a', 'c', 't', 's', ',', 'd', 'c', '=', 'i', 'k', 't',
- 'e', 'k', ',', 'd', 'c', '=', 'c', 'o',
+ 0x04,
+ 0x1b,
+ 'o',
+ 'u',
+ '=',
+ 'c',
+ 'o',
+ 'n',
+ 't',
+ 'a',
+ 'c',
+ 't',
+ 's',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'i',
+ 'k',
+ 't',
+ 'e',
+ 'k',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'c',
+ 'o',
'm',
// attributes PartialAttributeList }
// PartialAttributeList ::= SEQUENCE OF SEQUENCE {
- 0x30, 0x55, 0x30, 0x28,
+ 0x30,
+ 0x55,
+ 0x30,
+ 0x28,
// type AttributeDescription,
- 0x04, 0x0b, 'o', 'b', 'j', 'e', 'c', 't', 'c', 'l', 'a', 's', 's',
+ 0x04,
+ 0x0b,
+ 'o',
+ 'b',
+ 'j',
+ 'e',
+ 'c',
+ 't',
+ 'c',
+ 'l',
+ 'a',
+ 's',
+ 's',
// vals SET OF AttributeValue }
- 0x31, 0x19,
+ 0x31,
+ 0x19,
// AttributeValue ::= OCTET STRING
- 0x04, 0x03, 't', 'o', 'p',
+ 0x04,
+ 0x03,
+ 't',
+ 'o',
+ 'p',
// AttributeValue ::= OCTET STRING
- 0x04, 0x12, 'o', 'r', 'g', 'a', 'n', 'i', 'z', 'a', 't', 'i', 'o', 'n', 'a', 'l', 'U', 'n', 'i', 't',
- 0x30, 0x29,
+ 0x04,
+ 0x12,
+ 'o',
+ 'r',
+ 'g',
+ 'a',
+ 'n',
+ 'i',
+ 'z',
+ 'a',
+ 't',
+ 'i',
+ 'o',
+ 'n',
+ 'a',
+ 'l',
+ 'U',
+ 'n',
+ 'i',
+ 't',
+ 0x30,
+ 0x29,
// type AttributeDescription,
- 0x04, 0x0c, 'o', 'b', 'j', 'e', 'c', 't', 'c', 'l', 'a', 's', 's', '2',
+ 0x04,
+ 0x0c,
+ 'o',
+ 'b',
+ 'j',
+ 'e',
+ 'c',
+ 't',
+ 'c',
+ 'l',
+ 'a',
+ 's',
+ 's',
+ '2',
// vals SET OF AttributeValue }
- 0x31, 0x19,
+ 0x31,
+ 0x19,
// AttributeValue ::= OCTET STRING
- 0x04, 0x03, 't', 'o', 'p',
+ 0x04,
+ 0x03,
+ 't',
+ 'o',
+ 'p',
// AttributeValue ::= OCTET STRING
- 0x04, 0x12, 'o', 'r', 'g', 'a', 'n', 'i', 'z', 'a', 't', 'i', 'o', 'n', 'a', 'l', 'U', 'n', 'i', 't' } );
+ 0x04,
+ 0x12,
+ 'o',
+ 'r',
+ 'g',
+ 'a',
+ 'n',
+ 'i',
+ 'z',
+ 'a',
+ 't',
+ 'i',
+ 'o',
+ 'n',
+ 'a',
+ 'l',
+ 'U',
+ 'n',
+ 'i',
+ 't' } );
stream.flip();
// Allocate a BindRequest Container
- LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer =
+ LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer =
new LdapMessageContainer<SearchResultEntryDecorator>( codec );
try
@@ -228,8 +397,8 @@ public class SearchResultEntryTest exten
{
Attribute attribute = entry.get( expectedAttributes[i] );
- assertEquals(
- Strings.toLowerCase( expectedAttributes[i] ),
+ assertEquals(
+ Strings.toLowerCase( expectedAttributes[i] ),
Strings.toLowerCase( attribute.getUpId() ) );
assertTrue( attribute.contains( "top" ) );
@@ -278,14 +447,43 @@ public class SearchResultEntryTest exten
// ...
// SearchResultEntry ::= [APPLICATION 4] SEQUENCE {
// objectName LDAPDN,
- 0x04, 0x13, 'u', 'i', 'd', '=', 'a', 'd', 'm', 'i', 'n', ',', 'o', 'u', '=', 's', 'y', 's', 't', 'e',
+ 0x04,
+ 0x13,
+ 'u',
+ 'i',
+ 'd',
+ '=',
+ 'a',
+ 'd',
+ 'm',
+ 'i',
+ 'n',
+ ',',
+ 'o',
+ 'u',
+ '=',
+ 's',
+ 'y',
+ 's',
+ 't',
+ 'e',
'm',
// attributes PartialAttributeList }
0x30,
0x43, // PartialAttributeList ::= SEQUENCE OF SEQUENCE {
- 0x30, 0x41,
+ 0x30,
+ 0x41,
// type AttributeDescription,
- 0x04, 0x0B, 'o', 'b', 'j', 'e', 'c', 't', 'c', 'l',
+ 0x04,
+ 0x0B,
+ 'o',
+ 'b',
+ 'j',
+ 'e',
+ 'c',
+ 't',
+ 'c',
+ 'l',
'a',
's',
's',
@@ -296,23 +494,72 @@ public class SearchResultEntryTest exten
// AttributeValue
// }
// AttributeValue ::= OCTET STRING
- 0x04, 0x0D, 'i', 'n', 'e', 't', 'O', 'r', 'g', 'P', 'e', 'r', 's', 'o', 'n',
+ 0x04,
+ 0x0D,
+ 'i',
+ 'n',
+ 'e',
+ 't',
+ 'O',
+ 'r',
+ 'g',
+ 'P',
+ 'e',
+ 'r',
+ 's',
+ 'o',
+ 'n',
// AttributeValue ::= OCTET STRING
- 0x04, 0x14, 'o', 'r', 'g', 'a', 'n', 'i', 'z', 'a', 't', 'i', 'o', 'n', 'a', 'l', 'P', 'e', 'r', 's',
- 'o', 'n',
+ 0x04,
+ 0x14,
+ 'o',
+ 'r',
+ 'g',
+ 'a',
+ 'n',
+ 'i',
+ 'z',
+ 'a',
+ 't',
+ 'i',
+ 'o',
+ 'n',
+ 'a',
+ 'l',
+ 'P',
+ 'e',
+ 'r',
+ 's',
+ 'o',
+ 'n',
// AttributeValue ::= OCTET STRING
- 0x04, 0x06, 'p', 'e', 'r', 's', 'o', 'n',
+ 0x04,
+ 0x06,
+ 'p',
+ 'e',
+ 'r',
+ 's',
+ 'o',
+ 'n',
// AttributeValue ::= OCTET STRING
- 0x04, 0x03, 't', 'o', 'p', 0x30, 0x45, // Start of the next
+ 0x04,
+ 0x03,
+ 't',
+ 'o',
+ 'p',
+ 0x30,
+ 0x45, // Start of the next
// message
- 0x02, 0x01, 0x02 // messageID MessageID ...
- } );
+ 0x02,
+ 0x01,
+ 0x02 // messageID MessageID ...
+ } );
- String decodedPdu = Strings.dumpBytes(stream.array());
+ String decodedPdu = Strings.dumpBytes( stream.array() );
stream.flip();
// Allocate a BindRequest Container
- LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer =
+ LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer =
new LdapMessageContainer<SearchResultEntryDecorator>( codec );
try
@@ -361,7 +608,7 @@ public class SearchResultEntryTest exten
// Check the length
assertEquals( 0x61, bb.limit() );
- String encodedPdu = Strings.dumpBytes(bb.array());
+ String encodedPdu = Strings.dumpBytes( bb.array() );
// We have to supress the last 5 chars from the decodedPDU, as they
// belongs to the next message.
@@ -390,16 +637,19 @@ public class SearchResultEntryTest exten
stream.put( new byte[]
{
- 0x30, 0x05, // LDAPMessage ::=SEQUENCE {
- 0x02, 0x01, 0x01, // messageID MessageID
- 0x64, 0x00 // CHOICE { ..., searchResEntry SearchResultEntry,
+ 0x30, 0x05, // LDAPMessage ::=SEQUENCE {
+ 0x02,
+ 0x01,
+ 0x01, // messageID MessageID
+ 0x64,
+ 0x00 // CHOICE { ..., searchResEntry SearchResultEntry,
// ...
- } );
+ } );
stream.flip();
// Allocate a BindRequest Container
- LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer =
+ LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer =
new LdapMessageContainer<SearchResultEntryDecorator>( codec );
try
@@ -428,19 +678,23 @@ public class SearchResultEntryTest exten
stream.put( new byte[]
{ 0x30, 0x07, // LDAPMessage ::=SEQUENCE {
- 0x02, 0x01, 0x01, // messageID MessageID
- 0x64, 0x02, // CHOICE { ..., searchResEntry SearchResultEntry,
+ 0x02,
+ 0x01,
+ 0x01, // messageID MessageID
+ 0x64,
+ 0x02, // CHOICE { ..., searchResEntry SearchResultEntry,
// ...
// SearchResultEntry ::= [APPLICATION 4] SEQUENCE {
// objectName LDAPDN,
- 0x04, 0x00
+ 0x04,
+ 0x00
- } );
+ } );
stream.flip();
// Allocate a BindRequest Container
- LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer =
+ LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer =
new LdapMessageContainer<SearchResultEntryDecorator>( codec );
try
@@ -478,15 +732,42 @@ public class SearchResultEntryTest exten
// ...
// SearchResultEntry ::= [APPLICATION 4] SEQUENCE {
// objectName LDAPDN,
- 0x04, 0x1B, 'o', 'u', '=', 'c', 'o', 'n', 't', 'a', 'c', 't', 's', ',', 'd', 'c', '=', 'i', 'k', 't',
- 'e', 'k', ',', 'd', 'c', '=', 'c', 'o', 'm',
+ 0x04,
+ 0x1B,
+ 'o',
+ 'u',
+ '=',
+ 'c',
+ 'o',
+ 'n',
+ 't',
+ 'a',
+ 'c',
+ 't',
+ 's',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'i',
+ 'k',
+ 't',
+ 'e',
+ 'k',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'c',
+ 'o',
+ 'm',
- } );
+ } );
stream.flip();
// Allocate a BindRequest Container
- LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer =
+ LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer =
new LdapMessageContainer<SearchResultEntryDecorator>( codec );
try
@@ -524,17 +805,45 @@ public class SearchResultEntryTest exten
// ...
// SearchResultEntry ::= [APPLICATION 4] SEQUENCE {
// objectName LDAPDN,
- 0x04, 0x1B, 'o', 'u', '=', 'c', 'o', 'n', 't', 'a', 'c', 't', 's', ',', 'd', 'c', '=', 'i', 'k', 't',
- 'e', 'k', ',', 'd', 'c', '=', 'c', 'o', 'm',
+ 0x04,
+ 0x1B,
+ 'o',
+ 'u',
+ '=',
+ 'c',
+ 'o',
+ 'n',
+ 't',
+ 'a',
+ 'c',
+ 't',
+ 's',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'i',
+ 'k',
+ 't',
+ 'e',
+ 'k',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'c',
+ 'o',
+ 'm',
// attributes PartialAttributeList }
// PartialAttributeList ::= SEQUENCE OF SEQUENCE {
- 0x30, 0x00 } );
+ 0x30,
+ 0x00 } );
- String decodedPdu = Strings.dumpBytes(stream.array());
+ String decodedPdu = Strings.dumpBytes( stream.array() );
stream.flip();
// Allocate a BindRequest Container
- LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer =
+ LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer =
new LdapMessageContainer<SearchResultEntryDecorator>( codec );
try
@@ -564,7 +873,7 @@ public class SearchResultEntryTest exten
// Check the length
assertEquals( 0x26, bb.limit() );
- String encodedPdu = Strings.dumpBytes(bb.array());
+ String encodedPdu = Strings.dumpBytes( bb.array() );
assertEquals( encodedPdu, decodedPdu );
}
@@ -597,16 +906,46 @@ public class SearchResultEntryTest exten
// ...
// SearchResultEntry ::= [APPLICATION 4] SEQUENCE {
// objectName LDAPDN,
- 0x04, 0x1B, 'o', 'u', '=', 'c', 'o', 'n', 't', 'a', 'c', 't', 's', ',', 'd', 'c', '=', 'i', 'k', 't',
- 'e', 'k', ',', 'd', 'c', '=', 'c', 'o', 'm',
+ 0x04,
+ 0x1B,
+ 'o',
+ 'u',
+ '=',
+ 'c',
+ 'o',
+ 'n',
+ 't',
+ 'a',
+ 'c',
+ 't',
+ 's',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'i',
+ 'k',
+ 't',
+ 'e',
+ 'k',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'c',
+ 'o',
+ 'm',
// attributes PartialAttributeList }
// PartialAttributeList ::= SEQUENCE OF SEQUENCE {
- 0x30, 0x02, 0x30, 0x00 } );
+ 0x30,
+ 0x02,
+ 0x30,
+ 0x00 } );
stream.flip();
// Allocate a BindRequest Container
- LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer =
+ LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer =
new LdapMessageContainer<SearchResultEntryDecorator>( codec );
try
@@ -646,20 +985,75 @@ public class SearchResultEntryTest exten
// ...
// SearchResultEntry ::= [APPLICATION 4] SEQUENCE {
// objectName LDAPDN,
- 0x04, 0x1B, 'o', 'u', '=', 'c', 'o', 'n', 't', 'a', 'c', 't', 's', ',', 'd', 'c', '=', 'i', 'k', 't',
- 'e', 'k', ',', 'd', 'c', '=', 'c', 'o',
+ 0x04,
+ 0x1B,
+ 'o',
+ 'u',
+ '=',
+ 'c',
+ 'o',
+ 'n',
+ 't',
+ 'a',
+ 'c',
+ 't',
+ 's',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'i',
+ 'k',
+ 't',
+ 'e',
+ 'k',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'c',
+ 'o',
'm',
// attributes PartialAttributeList }
// PartialAttributeList ::= SEQUENCE OF SEQUENCE {
- 0x30, 0x02, 0x30, 0x00, ( byte ) 0xA0,
+ 0x30,
+ 0x02,
+ 0x30,
+ 0x00,
+ ( byte ) 0xA0,
0x1B, // A control
- 0x30, 0x19, 0x04, 0x17, '2', '.', '1', '6', '.', '8', '4', '0', '.', '1', '.', '1', '1', '3', '7', '3',
- '0', '.', '3', '.', '4', '.', '2' } );
+ 0x30,
+ 0x19,
+ 0x04,
+ 0x17,
+ '2',
+ '.',
+ '1',
+ '6',
+ '.',
+ '8',
+ '4',
+ '0',
+ '.',
+ '1',
+ '.',
+ '1',
+ '1',
+ '3',
+ '7',
+ '3',
+ '0',
+ '.',
+ '3',
+ '.',
+ '4',
+ '.',
+ '2' } );
stream.flip();
// Allocate a BindRequest Container
- LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer =
+ LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer =
new LdapMessageContainer<SearchResultEntryDecorator>( codec );
try
@@ -689,7 +1083,7 @@ public class SearchResultEntryTest exten
stream.put( new byte[]
{
- 0x30,
+ 0x30,
0x28, // LDAPMessage ::=SEQUENCE {
0x02,
0x01,
@@ -699,18 +1093,49 @@ public class SearchResultEntryTest exten
// ...
// SearchResultEntry ::= [APPLICATION 4] SEQUENCE {
// objectName LDAPDN,
- 0x04, 0x1b, 'o', 'u', '=', 'c', 'o', 'n', 't', 'a', 'c', 't', 's', ',', 'd', 'c', '=', 'i', 'k', 't',
- 'e', 'k', ',', 'd', 'c', '=', 'c', 'o', 'm',
+ 0x04,
+ 0x1b,
+ 'o',
+ 'u',
+ '=',
+ 'c',
+ 'o',
+ 'n',
+ 't',
+ 'a',
+ 'c',
+ 't',
+ 's',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'i',
+ 'k',
+ 't',
+ 'e',
+ 'k',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'c',
+ 'o',
+ 'm',
// attributes PartialAttributeList }
// PartialAttributeList ::= SEQUENCE OF SEQUENCE {
- 0x30, 0x04, 0x30, 0x02,
+ 0x30,
+ 0x04,
+ 0x30,
+ 0x02,
// type AttributeDescription,
- 0x04, 0x00 } );
+ 0x04,
+ 0x00 } );
stream.flip();
// Allocate a BindRequest Container
- LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer =
+ LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer =
new LdapMessageContainer<SearchResultEntryDecorator>( codec );
try
@@ -740,7 +1165,7 @@ public class SearchResultEntryTest exten
stream.put( new byte[]
{
- 0x30,
+ 0x30,
0x33, // LDAPMessage ::=SEQUENCE {
0x02,
0x01,
@@ -750,18 +1175,60 @@ public class SearchResultEntryTest exten
// ...
// SearchResultEntry ::= [APPLICATION 4] SEQUENCE {
// objectName LDAPDN,
- 0x04, 0x1b, 'o', 'u', '=', 'c', 'o', 'n', 't', 'a', 'c', 't', 's', ',', 'd', 'c', '=', 'i', 'k', 't',
- 'e', 'k', ',', 'd', 'c', '=', 'c', 'o', 'm',
+ 0x04,
+ 0x1b,
+ 'o',
+ 'u',
+ '=',
+ 'c',
+ 'o',
+ 'n',
+ 't',
+ 'a',
+ 'c',
+ 't',
+ 's',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'i',
+ 'k',
+ 't',
+ 'e',
+ 'k',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'c',
+ 'o',
+ 'm',
// attributes PartialAttributeList }
// PartialAttributeList ::= SEQUENCE OF SEQUENCE {
- 0x30, 0x0F, 0x30, 0x0D,
+ 0x30,
+ 0x0F,
+ 0x30,
+ 0x0D,
// type AttributeDescription,
- 0x04, 0x0b, 'o', 'b', 'j', 'e', 'c', 't', 'c', 'l', 'a', 's', 's' } );
+ 0x04,
+ 0x0b,
+ 'o',
+ 'b',
+ 'j',
+ 'e',
+ 'c',
+ 't',
+ 'c',
+ 'l',
+ 'a',
+ 's',
+ 's' } );
stream.flip();
// Allocate a BindRequest Container
- LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer =
+ LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer =
new LdapMessageContainer<SearchResultEntryDecorator>( codec );
try
@@ -791,7 +1258,7 @@ public class SearchResultEntryTest exten
stream.put( new byte[]
{
- 0x30,
+ 0x30,
0x35, // LDAPMessage ::=SEQUENCE {
0x02,
0x01,
@@ -801,19 +1268,63 @@ public class SearchResultEntryTest exten
// ...
// SearchResultEntry ::= [APPLICATION 4] SEQUENCE {
// objectName LDAPDN,
- 0x04, 0x1b, 'o', 'u', '=', 'c', 'o', 'n', 't', 'a', 'c', 't', 's', ',', 'd', 'c', '=', 'i', 'k', 't',
- 'e', 'k', ',', 'd', 'c', '=', 'c', 'o', 'm',
+ 0x04,
+ 0x1b,
+ 'o',
+ 'u',
+ '=',
+ 'c',
+ 'o',
+ 'n',
+ 't',
+ 'a',
+ 'c',
+ 't',
+ 's',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'i',
+ 'k',
+ 't',
+ 'e',
+ 'k',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'c',
+ 'o',
+ 'm',
// attributes PartialAttributeList }
// PartialAttributeList ::= SEQUENCE OF SEQUENCE {
- 0x30, 0x11, 0x30, 0x0F,
+ 0x30,
+ 0x11,
+ 0x30,
+ 0x0F,
// type AttributeDescription,
- 0x04, 0x0b, 'o', 'b', 'j', 'e', 'c', 't', 'c', 'l', 'a', 's', 's', 0x31, 0x00 } );
+ 0x04,
+ 0x0b,
+ 'o',
+ 'b',
+ 'j',
+ 'e',
+ 'c',
+ 't',
+ 'c',
+ 'l',
+ 'a',
+ 's',
+ 's',
+ 0x31,
+ 0x00 } );
- String decodedPdu = Strings.dumpBytes(stream.array());
+ String decodedPdu = Strings.dumpBytes( stream.array() );
stream.flip();
// Allocate a BindRequest Container
- LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer =
+ LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer =
new LdapMessageContainer<SearchResultEntryDecorator>( codec );
try
@@ -851,7 +1362,7 @@ public class SearchResultEntryTest exten
// Check the length
assertEquals( 0x37, bb.limit() );
- String encodedPdu = Strings.dumpBytes(bb.array());
+ String encodedPdu = Strings.dumpBytes( bb.array() );
assertEquals( encodedPdu, decodedPdu );
}
@@ -876,7 +1387,7 @@ public class SearchResultEntryTest exten
stream.put( new byte[]
{
- 0x30,
+ 0x30,
0x46, // LDAPMessage ::=SEQUENCE {
0x02,
0x01,
@@ -886,21 +1397,81 @@ public class SearchResultEntryTest exten
// ...
// SearchResultEntry ::= [APPLICATION 4] SEQUENCE {
// objectName LDAPDN,
- 0x04, 0x1b, 'o', 'u', '=', 'c', 'o', 'n', 't', 'a', 'c', 't', 's', ',', 'd', 'c', '=', 'i', 'k', 't',
- 'e', 'k', ',', 'd', 'c', '=', 'c', 'o', 'm',
+ 0x04,
+ 0x1b,
+ 'o',
+ 'u',
+ '=',
+ 'c',
+ 'o',
+ 'n',
+ 't',
+ 'a',
+ 'c',
+ 't',
+ 's',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'i',
+ 'k',
+ 't',
+ 'e',
+ 'k',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'c',
+ 'o',
+ 'm',
// attributes PartialAttributeList }
// PartialAttributeList ::= SEQUENCE OF SEQUENCE {
- 0x30, 0x22, 0x30, 0x0F,
+ 0x30,
+ 0x22,
+ 0x30,
+ 0x0F,
// type AttributeDescription,
- 0x04, 0x0b, 'o', 'b', 'j', 'e', 'c', 't', 'c', 'l', 'a', 's', 's', 0x31, 0x00, 0x30, 0x0F,
+ 0x04,
+ 0x0b,
+ 'o',
+ 'b',
+ 'j',
+ 'e',
+ 'c',
+ 't',
+ 'c',
+ 'l',
+ 'a',
+ 's',
+ 's',
+ 0x31,
+ 0x00,
+ 0x30,
+ 0x0F,
// type AttributeDescription,
- 0x04, 0x0b, 'o', 'b', 'j', 'e', 'c', 't', 'c', 'l', 'a', 'z', 'z', 0x31, 0x00 } );
+ 0x04,
+ 0x0b,
+ 'o',
+ 'b',
+ 'j',
+ 'e',
+ 'c',
+ 't',
+ 'c',
+ 'l',
+ 'a',
+ 'z',
+ 'z',
+ 0x31,
+ 0x00 } );
- String decodedPdu = Strings.dumpBytes(stream.array());
+ String decodedPdu = Strings.dumpBytes( stream.array() );
stream.flip();
// Allocate a BindRequest Container
- LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer =
+ LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer =
new LdapMessageContainer<SearchResultEntryDecorator>( codec );
try
@@ -938,7 +1509,7 @@ public class SearchResultEntryTest exten
// Check the length
assertEquals( 0x48, bb.limit() );
- String encodedPdu = Strings.dumpBytes(bb.array());
+ String encodedPdu = Strings.dumpBytes( bb.array() );
assertEquals( encodedPdu.length(), decodedPdu.length() );
}
@@ -973,24 +1544,93 @@ public class SearchResultEntryTest exten
// ...
// SearchResultEntry ::= [APPLICATION 4] SEQUENCE {
// objectName LDAPDN,
- 0x04, 0x1b, 'o', 'u', '=', 'c', 'o', 'n', 't', 'a', 'c', 't', 's', ',', 'd', 'c', '=', 'i', 'k', 't',
- 'e', 'k', ',', 'd', 'c', '=', 'c', 'o',
+ 0x04,
+ 0x1b,
+ 'o',
+ 'u',
+ '=',
+ 'c',
+ 'o',
+ 'n',
+ 't',
+ 'a',
+ 'c',
+ 't',
+ 's',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'i',
+ 'k',
+ 't',
+ 'e',
+ 'k',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'c',
+ 'o',
'm',
// attributes PartialAttributeList }
// PartialAttributeList ::= SEQUENCE OF SEQUENCE {
- 0x30, 0x11, 0x30, 0x0F,
+ 0x30,
+ 0x11,
+ 0x30,
+ 0x0F,
// type AttributeDescription,
- 0x04, 0x0b, 'o', 'b', 'j', 'e', 'c', 't', 'c', 'l', 'a', 's', 's', 0x31, 0x00, ( byte ) 0xA0,
+ 0x04,
+ 0x0b,
+ 'o',
+ 'b',
+ 'j',
+ 'e',
+ 'c',
+ 't',
+ 'c',
+ 'l',
+ 'a',
+ 's',
+ 's',
+ 0x31,
+ 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 BindRequest Container
- LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer =
+ LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer =
new LdapMessageContainer<SearchResultEntryDecorator>( codec );
try
@@ -1027,9 +1667,10 @@ public class SearchResultEntryTest exten
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() ) );
// Check the encoding
try
@@ -1039,7 +1680,7 @@ public class SearchResultEntryTest exten
// Check the length
assertEquals( 0x54, bb.limit() );
- String encodedPdu = Strings.dumpBytes(bb.array());
+ String encodedPdu = Strings.dumpBytes( bb.array() );
assertEquals( encodedPdu, decodedPdu );
}
@@ -1072,23 +1713,67 @@ public class SearchResultEntryTest exten
// ...
// SearchResultEntry ::= [APPLICATION 4] SEQUENCE {
// objectName LDAPDN,
- 0x04, 0x1b, 'o', 'u', '=', 'c', 'o', 'n', 't', 'a', 'c', 't', 's', ',', 'd', 'c', '=', 'i', 'k', 't',
- 'e', 'k', ',', 'd', 'c', '=', 'c', 'o', 'm',
+ 0x04,
+ 0x1b,
+ 'o',
+ 'u',
+ '=',
+ 'c',
+ 'o',
+ 'n',
+ 't',
+ 'a',
+ 'c',
+ 't',
+ 's',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'i',
+ 'k',
+ 't',
+ 'e',
+ 'k',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'c',
+ 'o',
+ 'm',
// attributes PartialAttributeList }
// PartialAttributeList ::= SEQUENCE OF SEQUENCE {
- 0x30, 0x13, 0x30, 0x11,
+ 0x30,
+ 0x13,
+ 0x30,
+ 0x11,
// type AttributeDescription,
- 0x04, 0x0b, 'o', 'b', 'j', 'e', 'c', 't', 'c', 'l', 'a', 's', 's',
+ 0x04,
+ 0x0b,
+ 'o',
+ 'b',
+ 'j',
+ 'e',
+ 'c',
+ 't',
+ 'c',
+ 'l',
+ 'a',
+ 's',
+ 's',
// vals SET OF AttributeValue }
- 0x31, 0x02,
+ 0x31,
+ 0x02,
// AttributeValue ::= OCTET STRING
- 0x04, 0x00, } );
+ 0x04,
+ 0x00, } );
- String decodedPdu = Strings.dumpBytes(stream.array());
+ String decodedPdu = Strings.dumpBytes( stream.array() );
stream.flip();
// Allocate a BindRequest Container
- LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer =
+ LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer =
new LdapMessageContainer<SearchResultEntryDecorator>( codec );
try
@@ -1127,7 +1812,7 @@ public class SearchResultEntryTest exten
// Check the length
assertEquals( 0x39, bb.limit() );
- String encodedPdu = Strings.dumpBytes(bb.array());
+ String encodedPdu = Strings.dumpBytes( bb.array() );
assertEquals( encodedPdu, decodedPdu );
}
@@ -1162,27 +1847,96 @@ public class SearchResultEntryTest exten
// ...
// SearchResultEntry ::= [APPLICATION 4] SEQUENCE {
// objectName LDAPDN,
- 0x04, 0x1b, 'o', 'u', '=', 'c', 'o', 'n', 't', 'a', 'c', 't', 's', ',', 'd', 'c', '=', 'i', 'k', 't',
- 'e', 'k', ',', 'd', 'c', '=', 'c', 'o',
+ 0x04,
+ 0x1b,
+ 'o',
+ 'u',
+ '=',
+ 'c',
+ 'o',
+ 'n',
+ 't',
+ 'a',
+ 'c',
+ 't',
+ 's',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'i',
+ 'k',
+ 't',
+ 'e',
+ 'k',
+ ',',
+ 'd',
+ 'c',
+ '=',
+ 'c',
+ 'o',
'm',
// attributes PartialAttributeList }
// PartialAttributeList ::= SEQUENCE OF SEQUENCE {
- 0x30, 0x13, 0x30, 0x11,
+ 0x30,
+ 0x13,
+ 0x30,
+ 0x11,
// type AttributeDescription,
- 0x04, 0x0b, 'o', 'b', 'j', 'e', 'c', 't', 'c', 'l', 'a', 's', 's',
+ 0x04,
+ 0x0b,
+ 'o',
+ 'b',
+ 'j',
+ 'e',
+ 'c',
+ 't',
+ 'c',
+ 'l',
+ 'a',
+ 's',
+ 's',
// vals SET OF AttributeValue }
- 0x31, 0x02,
+ 0x31,
+ 0x02,
// AttributeValue ::= OCTET STRING
- 0x04, 0x00, ( byte ) 0xA0,
+ 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 BindRequest Container
- LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer =
+ LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer =
new LdapMessageContainer<SearchResultEntryDecorator>( codec );
try
@@ -1219,9 +1973,10 @@ public class SearchResultEntryTest exten
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() ) );
// Check the encoding
try
@@ -1231,7 +1986,7 @@ public class SearchResultEntryTest exten
// Check the length
assertEquals( 0x56, 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/search/SearchResultReferenceTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultReferenceTest.java?rev=1235364&r1=1235363&r2=1235364&view=diff
==============================================================================
--- directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultReferenceTest.java (original)
+++ directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultReferenceTest.java Tue Jan 24 17:27:00 2012
@@ -84,22 +84,27 @@ public class SearchResultReferenceTest e
stream.put( new byte[]
{
- 0x30, ( byte ) 0x82, 0x03, ( byte ) 0xd4, // LDAPMessage
+ 0x30, ( byte ) 0x82, 0x03, ( byte ) 0xd4, // LDAPMessage
// ::=SEQUENCE {
- 0x02, 0x01, 0x01, // messageID MessageID
- 0x73, ( byte ) 0x82, 0x03, ( byte ) 0xcd, // CHOICE { ...,
+ 0x02,
+ 0x01,
+ 0x01, // messageID MessageID
+ 0x73,
+ ( byte ) 0x82,
+ 0x03,
+ ( byte ) 0xcd, // CHOICE { ...,
// searchResEntry
// SearchResultEntry,
// ...
// SearchResultReference ::= [APPLICATION 19] SEQUENCE OF LDAPURL
- } );
+ } );
for ( int i = 0; i < ldapUrls.length; i++ )
{
stream.put( ( byte ) 0x04 );
stream.put( ( byte ) ldapUrls[i].getBytes().length );
- byte[] bytes = Strings.getBytesUtf8(ldapUrls[i]);
+ byte[] bytes = Strings.getBytesUtf8( ldapUrls[i] );
for ( int j = 0; j < bytes.length; j++ )
{
@@ -107,11 +112,12 @@ public class SearchResultReferenceTest e
}
}
- String decodedPdu = Strings.dumpBytes(stream.array());
+ String decodedPdu = Strings.dumpBytes( stream.array() );
stream.flip();
// Allocate a BindRequest Container
- LdapMessageContainer<SearchResultReferenceDecorator> ldapMessageContainer = new LdapMessageContainer<SearchResultReferenceDecorator>( codec );
+ LdapMessageContainer<SearchResultReferenceDecorator> ldapMessageContainer = new LdapMessageContainer<SearchResultReferenceDecorator>(
+ codec );
try
{
@@ -131,7 +137,7 @@ public class SearchResultReferenceTest e
for ( int i = 0; i < ldapUrls.length; i++ )
{
- ldapUrlsSet.add( Strings.utf8ToString(ldapUrls[i].getBytes()) );
+ ldapUrlsSet.add( Strings.utf8ToString( ldapUrls[i].getBytes() ) );
}
Referral referral = searchResultReference.getReferral();
@@ -160,7 +166,7 @@ public class SearchResultReferenceTest e
// Check the length
assertEquals( 0x3D8, bb.limit() );
- String encodedPdu = Strings.dumpBytes(bb.array());
+ String encodedPdu = Strings.dumpBytes( bb.array() );
assertEquals( encodedPdu, decodedPdu );
}
@@ -200,15 +206,20 @@ public class SearchResultReferenceTest e
stream.put( new byte[]
{
- 0x30, ( byte ) 0x82, 0x03, ( byte ) 0xF1, // LDAPMessage
+ 0x30, ( byte ) 0x82, 0x03, ( byte ) 0xF1, // LDAPMessage
// ::=SEQUENCE {
- 0x02, 0x01, 0x01, // messageID MessageID
- 0x73, ( byte ) 0x82, 0x03, ( byte ) 0xcd, // CHOICE { ...,
+ 0x02,
+ 0x01,
+ 0x01, // messageID MessageID
+ 0x73,
+ ( byte ) 0x82,
+ 0x03,
+ ( byte ) 0xcd, // CHOICE { ...,
// searchResEntry
// SearchResultEntry,
// ...
// SearchResultReference ::= [APPLICATION 19] SEQUENCE OF LDAPURL
- } );
+ } );
for ( int i = 0; i < ldapUrls.length; i++ )
{
@@ -226,19 +237,45 @@ public class SearchResultReferenceTest e
byte[] controlBytes = new byte[]
{ ( 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 };
for ( int i = 0; i < controlBytes.length; i++ )
{
stream.put( controlBytes[i] );
}
- String decodedPdu = Strings.dumpBytes(stream.array());
+ String decodedPdu = Strings.dumpBytes( stream.array() );
stream.flip();
// Allocate a BindRequest Container
- LdapMessageContainer<SearchResultReferenceDecorator> ldapMessageContainer = new LdapMessageContainer<SearchResultReferenceDecorator>( codec );
+ LdapMessageContainer<SearchResultReferenceDecorator> ldapMessageContainer = new LdapMessageContainer<SearchResultReferenceDecorator>(
+ codec );
try
{
@@ -261,7 +298,7 @@ public class SearchResultReferenceTest e
for ( int i = 0; i < ldapUrls.length; i++ )
{
- ldapUrlsSet.add( Strings.utf8ToString(ldapUrls[i].getBytes()) );
+ ldapUrlsSet.add( Strings.utf8ToString( ldapUrls[i].getBytes() ) );
}
Referral referral = searchResultReference.getReferral();
@@ -288,9 +325,10 @@ public class SearchResultReferenceTest e
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() ) );
// Check the encoding
try
@@ -300,7 +338,7 @@ public class SearchResultReferenceTest e
// Check the length
assertEquals( 0x3F5, bb.limit() );
- String encodedPdu = Strings.dumpBytes(bb.array());
+ String encodedPdu = Strings.dumpBytes( bb.array() );
assertEquals( encodedPdu, decodedPdu );
}
@@ -325,17 +363,21 @@ public class SearchResultReferenceTest e
stream.put( new byte[]
{
- 0x30, 0x05, // LDAPMessage ::=SEQUENCE {
- 0x02, 0x01, 0x01, // messageID MessageID
- 0x73, 0x00 // CHOICE { ..., searchResEntry SearchResultEntry,
+ 0x30, 0x05, // LDAPMessage ::=SEQUENCE {
+ 0x02,
+ 0x01,
+ 0x01, // messageID MessageID
+ 0x73,
+ 0x00 // CHOICE { ..., searchResEntry SearchResultEntry,
// ...
// SearchResultReference ::= [APPLICATION 19] SEQUENCE OF LDAPURL
- } );
+ } );
stream.flip();
// Allocate a LdapMessage Container
- LdapMessageContainer<SearchResultReferenceDecorator> ldapMessageContainer = new LdapMessageContainer<SearchResultReferenceDecorator>( codec );
+ LdapMessageContainer<SearchResultReferenceDecorator> ldapMessageContainer = new LdapMessageContainer<SearchResultReferenceDecorator>(
+ codec );
// Decode a SearchResultReference message
try
@@ -365,24 +407,37 @@ public class SearchResultReferenceTest e
stream.put( new byte[]
{
- 0x30, 0x0F, // LDAPMessage ::=SEQUENCE {
- 0x02, 0x01, 0x01, // messageID MessageID
- 0x73, 0x0A, // CHOICE { ..., searchResEntry SearchResultEntry,
+ 0x30, 0x0F, // LDAPMessage ::=SEQUENCE {
+ 0x02,
+ 0x01,
+ 0x01, // messageID MessageID
+ 0x73,
+ 0x0A, // CHOICE { ..., searchResEntry SearchResultEntry,
// ...
- 0x04, 0x08, 'l', 'd', 'a', 'p', ':', '/', '/', '/' // SearchResultReference
+ 0x04,
+ 0x08,
+ 'l',
+ 'd',
+ 'a',
+ 'p',
+ ':',
+ '/',
+ '/',
+ '/' // SearchResultReference
// ::=
// [APPLICATION
// 19]
// SEQUENCE
// OF
// LDAPURL
- } );
+ } );
- String decodedPdu = Strings.dumpBytes(stream.array());
+ String decodedPdu = Strings.dumpBytes( stream.array() );
stream.flip();
// Allocate a BindRequest Container
- LdapMessageContainer<SearchResultReferenceDecorator> ldapMessageContainer = new LdapMessageContainer<SearchResultReferenceDecorator>( codec );
+ LdapMessageContainer<SearchResultReferenceDecorator> ldapMessageContainer = new LdapMessageContainer<SearchResultReferenceDecorator>(
+ codec );
try
{
@@ -415,7 +470,7 @@ public class SearchResultReferenceTest e
// Check the length
assertEquals( 0x11, 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/search/controls/EntryChangeControlTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlTest.java?rev=1235364&r1=1235363&r2=1235364&view=diff
==============================================================================
--- directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlTest.java (original)
+++ directory/shared/trunk/ldap/codec/core/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlTest.java Tue Jan 24 17:27:00 2012
@@ -55,19 +55,27 @@ public class EntryChangeControlTest exte
{
ByteBuffer bb = ByteBuffer.allocate( 0x0D );
bb.put( new byte[]
- {
- 0x30, 0x0B, // EntryChangeNotification ::= SEQUENCE {
- 0x0A, 0x01, 0x08, // changeType ENUMERATED {
- // modDN (8)
- // }
- 0x04, 0x03, 'a', '=', 'b', // previousDN LDAPDN OPTIONAL, -- modifyDN ops. only
- 0x02, 0x01, 0x10 // changeNumber INTEGER OPTIONAL } -- if supported
- } );
+ {
+ 0x30, 0x0B, // EntryChangeNotification ::= SEQUENCE {
+ 0x0A,
+ 0x01,
+ 0x08, // changeType ENUMERATED {
+ // modDN (8)
+ // }
+ 0x04,
+ 0x03,
+ 'a',
+ '=',
+ 'b', // previousDN LDAPDN OPTIONAL, -- modifyDN ops. only
+ 0x02,
+ 0x01,
+ 0x10 // changeNumber INTEGER OPTIONAL } -- if supported
+ } );
bb.flip();
EntryChangeDecorator decorator = new EntryChangeDecorator( codec );
-
- EntryChange entryChange = (EntryChange)decorator.decode( bb.array() );
+
+ EntryChange entryChange = ( EntryChange ) decorator.decode( bb.array() );
assertEquals( ChangeType.MODDN, entryChange.getChangeType() );
assertEquals( "a=b", entryChange.getPreviousDn().toString() );
@@ -83,20 +91,33 @@ public class EntryChangeControlTest exte
{
ByteBuffer bb = ByteBuffer.allocate( 0x13 );
bb.put( new byte[]
- {
- 0x30, 0x11, // EntryChangeNotification ::= SEQUENCE {
- 0x0A, 0x01, 0x08, // changeType ENUMERATED {
- // modDN (8)
- // }
- 0x04, 0x03, 'a', '=', 'b', // previousDN LDAPDN OPTIONAL, -- modifyDN ops. only
- 0x02, 0x07, // changeNumber INTEGER OPTIONAL } -- if supported
- 0x12, 0x34, 0x56, 0x78, (byte)0x9A, (byte)0xBC, (byte)0xDE
- } );
+ {
+ 0x30, 0x11, // EntryChangeNotification ::= SEQUENCE {
+ 0x0A,
+ 0x01,
+ 0x08, // changeType ENUMERATED {
+ // modDN (8)
+ // }
+ 0x04,
+ 0x03,
+ 'a',
+ '=',
+ 'b', // previousDN LDAPDN OPTIONAL, -- modifyDN ops. only
+ 0x02,
+ 0x07, // changeNumber INTEGER OPTIONAL } -- if supported
+ 0x12,
+ 0x34,
+ 0x56,
+ 0x78,
+ ( byte ) 0x9A,
+ ( byte ) 0xBC,
+ ( byte ) 0xDE
+ } );
bb.flip();
EntryChangeDecorator decorator = new EntryChangeDecorator( codec );
-
- EntryChange entryChange = (EntryChange)decorator.decode( bb.array() );
+
+ EntryChange entryChange = ( EntryChange ) decorator.decode( bb.array() );
assertEquals( ChangeType.MODDN, entryChange.getChangeType() );
assertEquals( "a=b", entryChange.getPreviousDn().toString() );
@@ -112,19 +133,23 @@ public class EntryChangeControlTest exte
{
ByteBuffer bb = ByteBuffer.allocate( 0x08 );
bb.put( new byte[]
- {
- 0x30, 0x06, // EntryChangeNotification ::= SEQUENCE {
- 0x0A, 0x01, 0x01, // changeType ENUMERATED {
- // Add (1)
- // }
- 0x02, 0x01, 0x10 // changeNumber INTEGER OPTIONAL -- if supported
- // }
- } );
+ {
+ 0x30, 0x06, // EntryChangeNotification ::= SEQUENCE {
+ 0x0A,
+ 0x01,
+ 0x01, // changeType ENUMERATED {
+ // Add (1)
+ // }
+ 0x02,
+ 0x01,
+ 0x10 // changeNumber INTEGER OPTIONAL -- if supported
+ // }
+ } );
bb.flip();
EntryChangeDecorator decorator = new EntryChangeDecorator( codec );
-
- EntryChange entryChange = (EntryChange)decorator.decode( bb.array() );
+
+ EntryChange entryChange = ( EntryChange ) decorator.decode( bb.array() );
assertEquals( ChangeType.ADD, entryChange.getChangeType() );
assertNull( entryChange.getPreviousDn() );
@@ -136,25 +161,33 @@ public class EntryChangeControlTest exte
* Test the decoding of a EntryChangeControl with a add so we should not
* have a PreviousDN
*/
- @Test( expected=DecoderException.class )
+ @Test(expected = DecoderException.class)
public void testDecodeEntryChangeControlWithADDAndPreviousDNBad() throws Exception
{
ByteBuffer bb = ByteBuffer.allocate( 0x0D );
bb.put( new byte[]
- {
- 0x30, 0x0B, // EntryChangeNotification ::= SEQUENCE {
- 0x0A, 0x01, 0x01, // changeType ENUMERATED {
- // ADD (1)
- // }
- 0x04, 0x03, 'a', '=', 'b', // previousDN LDAPDN OPTIONAL, --
- // modifyDN ops. only
- 0x02, 0x01, 0x10 // changeNumber INTEGER OPTIONAL -- if supported
- // }
- } );
+ {
+ 0x30, 0x0B, // EntryChangeNotification ::= SEQUENCE {
+ 0x0A,
+ 0x01,
+ 0x01, // changeType ENUMERATED {
+ // ADD (1)
+ // }
+ 0x04,
+ 0x03,
+ 'a',
+ '=',
+ 'b', // previousDN LDAPDN OPTIONAL, --
+ // modifyDN ops. only
+ 0x02,
+ 0x01,
+ 0x10 // changeNumber INTEGER OPTIONAL -- if supported
+ // }
+ } );
bb.flip();
EntryChangeDecorator decorator = new EntryChangeDecorator( codec );
-
+
decorator.decode( bb.array() );
}
@@ -167,18 +200,20 @@ public class EntryChangeControlTest exte
{
ByteBuffer bb = ByteBuffer.allocate( 0x05 );
bb.put( new byte[]
- {
- 0x30, 0x03, // EntryChangeNotification ::= SEQUENCE {
- 0x0A, 0x01, 0x01, // changeType ENUMERATED {
- // ADD (1)
- // }
- // }
+ {
+ 0x30, 0x03, // EntryChangeNotification ::= SEQUENCE {
+ 0x0A,
+ 0x01,
+ 0x01, // changeType ENUMERATED {
+ // ADD (1)
+ // }
+ // }
} );
bb.flip();
EntryChangeDecorator decorator = new EntryChangeDecorator( codec );
-
- EntryChange entryChange = (EntryChange)decorator.decode( bb.array() );
+
+ EntryChange entryChange = ( EntryChange ) decorator.decode( bb.array() );
assertEquals( ChangeType.ADD, entryChange.getChangeType() );
assertNull( entryChange.getPreviousDn() );
@@ -190,22 +225,24 @@ public class EntryChangeControlTest exte
* Test the decoding of a EntryChangeControl with a wrong changeType and
* nothing else
*/
- @Test( expected=DecoderException.class )
+ @Test(expected = DecoderException.class)
public void testDecodeEntryChangeControlWithWrongChangeType() throws Exception
{
ByteBuffer bb = ByteBuffer.allocate( 0x05 );
bb.put( new byte[]
- {
- 0x30, 0x03, // EntryChangeNotification ::= SEQUENCE {
- 0x0A, 0x01, 0x03, // changeType ENUMERATED {
- // BAD Change Type
- // }
- // }
+ {
+ 0x30, 0x03, // EntryChangeNotification ::= SEQUENCE {
+ 0x0A,
+ 0x01,
+ 0x03, // changeType ENUMERATED {
+ // BAD Change Type
+ // }
+ // }
} );
bb.flip();
EntryChangeDecorator decorator = new EntryChangeDecorator( codec );
-
+
decorator.decode( bb.array() );
}
@@ -213,25 +250,46 @@ public class EntryChangeControlTest exte
/**
* Test the decoding of a EntryChangeControl with a wrong changeNumber
*/
- @Test( expected=DecoderException.class )
+ @Test(expected = DecoderException.class)
public void testDecodeEntryChangeControlWithWrongChangeNumber() throws Exception
{
ByteBuffer bb = ByteBuffer.allocate( 0x1C );
bb.put( new byte[]
- {
- 0x30, 0x1A, // EntryChangeNotification ::= SEQUENCE {
- 0x0A, 0x01, 0x08, // changeType ENUMERATED {
- // modDN (8)
- // }
- 0x04, 0x03, 'a', '=', 'b', // previousDN LDAPDN OPTIONAL, -- modifyDN ops. only
- 0x02, 0x10, // changeNumber INTEGER OPTIONAL -- if supported
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- } );
+ {
+ 0x30, 0x1A, // EntryChangeNotification ::= SEQUENCE {
+ 0x0A,
+ 0x01,
+ 0x08, // changeType ENUMERATED {
+ // modDN (8)
+ // }
+ 0x04,
+ 0x03,
+ 'a',
+ '=',
+ 'b', // previousDN LDAPDN OPTIONAL, -- modifyDN ops. only
+ 0x02,
+ 0x10, // changeNumber INTEGER OPTIONAL -- if supported
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00
+ } );
bb.flip();
EntryChangeDecorator decorator = new EntryChangeDecorator( codec );
-
+
decorator.decode( bb.array() );
}
@@ -244,21 +302,29 @@ public class EntryChangeControlTest exte
{
ByteBuffer bb = ByteBuffer.allocate( 0x0D );
bb.put( new byte[]
- {
- 0x30, 0x0B, // EntryChangeNotification ::= SEQUENCE {
- 0x0A, 0x01, 0x08, // changeType ENUMERATED {
- // modDN (8)
- // }
- 0x04, 0x03, 'a', '=', 'b', // previousDN LDAPDN OPTIONAL, -- modifyDN ops. only
- 0x02, 0x01, 0x10, // changeNumber INTEGER OPTIONAL -- if supported
+ {
+ 0x30, 0x0B, // EntryChangeNotification ::= SEQUENCE {
+ 0x0A,
+ 0x01,
+ 0x08, // changeType ENUMERATED {
+ // modDN (8)
+ // }
+ 0x04,
+ 0x03,
+ 'a',
+ '=',
+ 'b', // previousDN LDAPDN OPTIONAL, -- modifyDN ops. only
+ 0x02,
+ 0x01,
+ 0x10, // changeNumber INTEGER OPTIONAL -- if supported
} );
- String expected = Strings.dumpBytes(bb.array());
+ String expected = Strings.dumpBytes( bb.array() );
bb.flip();
EntryChangeDecorator decorator = new EntryChangeDecorator( codec );
- EntryChange entryChange = (EntryChange) decorator.getDecorated();
+ EntryChange entryChange = ( EntryChange ) decorator.getDecorated();
entryChange.setChangeType( ChangeType.MODDN );
entryChange.setChangeNumber( 16 );
entryChange.setPreviousDn( new Dn( "a=b" ) );
@@ -276,28 +342,41 @@ public class EntryChangeControlTest exte
{
ByteBuffer bb = ByteBuffer.allocate( 0x13 );
bb.put( new byte[]
- {
- 0x30, 0x11, // EntryChangeNotification ::= SEQUENCE {
- 0x0A, 0x01, 0x08, // changeType ENUMERATED {
- // modDN (8)
- // }
- 0x04, 0x03, 'a', '=', 'b', // previousDN LDAPDN OPTIONAL, -- modifyDN ops. only
- 0x02, 0x07, // changeNumber INTEGER OPTIONAL -- if supported
- 0x12, 0x34, 0x56, 0x78, (byte)0x9a, (byte)0xbc, (byte)0xde
- } );
+ {
+ 0x30, 0x11, // EntryChangeNotification ::= SEQUENCE {
+ 0x0A,
+ 0x01,
+ 0x08, // changeType ENUMERATED {
+ // modDN (8)
+ // }
+ 0x04,
+ 0x03,
+ 'a',
+ '=',
+ 'b', // previousDN LDAPDN OPTIONAL, -- modifyDN ops. only
+ 0x02,
+ 0x07, // changeNumber INTEGER OPTIONAL -- if supported
+ 0x12,
+ 0x34,
+ 0x56,
+ 0x78,
+ ( byte ) 0x9a,
+ ( byte ) 0xbc,
+ ( byte ) 0xde
+ } );
- String expected = Strings.dumpBytes(bb.array());
+ String expected = Strings.dumpBytes( bb.array() );
bb.flip();
EntryChangeDecorator decorator = new EntryChangeDecorator( codec );
-
- EntryChange entryChange = (EntryChange) decorator.getDecorated();
+
+ EntryChange entryChange = ( EntryChange ) decorator.getDecorated();
entryChange.setChangeType( ChangeType.MODDN );
entryChange.setChangeNumber( 5124095576030430L );
entryChange.setPreviousDn( new Dn( "a=b" ) );
bb = decorator.encode( ByteBuffer.allocate( decorator.computeLength() ) );
- String decoded = Strings.dumpBytes(bb.array());
+ String decoded = Strings.dumpBytes( bb.array() );
assertEquals( expected, decoded );
}
}