* Test the decoding of a SearchResultEntry
*/
@Test
public void testDecodeSearchResultEntry2AttrsSuccess() throws NamingException
{
Asn1Decoder ldapDecoder = new Asn1Decoder();
ByteBuffer stream = ByteBuffer.allocate( 0x7b );
stream.put( new byte[]
{
0x30,
0x79, // LDAPMessage ::=SEQUENCE {
0x02,
0x01,
0x01, // messageID MessageID
0x64,
0x74, // CHOICE { ..., searchResEntry SearchResultEntry,
// ...
// 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',
// attributes PartialAttributeList }
// PartialAttributeList ::= SEQUENCE OF SEQUENCE {
0x30, 0x55, 0x30, 0x28,
// type AttributeDescription,
0x04, 0x0b, 'o', 'b', 'j', 'e', 'c', 't', 'c', 'l', 'a', 's', 's',
// vals SET OF AttributeValue }
0x31, 0x19,
// AttributeValue ::= OCTET STRING
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,
// type AttributeDescription,
0x04, 0x0c, 'o', 'b', 'j', 'e', 'c', 't', 'c', 'l', 'a', 's', 's', '2',
// vals SET OF AttributeValue }
0x31, 0x19,
// AttributeValue ::= OCTET STRING
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' } );
stream.flip();
// Allocate a BindRequest Container
LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer =
new LdapMessageContainer<SearchResultEntryDecorator>( codec );
try
{
ldapDecoder.decode( stream, ldapMessageContainer );
}
catch ( DecoderException de )
{
de.printStackTrace();
fail( de.getMessage() );