Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 37642 invoked from network); 29 Jan 2006 00:18:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 29 Jan 2006 00:18:04 -0000 Received: (qmail 80937 invoked by uid 500); 29 Jan 2006 00:18:04 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 80913 invoked by uid 500); 29 Jan 2006 00:18:03 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 80902 invoked by uid 99); 29 Jan 2006 00:18:03 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 28 Jan 2006 16:18:03 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Sat, 28 Jan 2006 16:18:03 -0800 Received: (qmail 37182 invoked by uid 65534); 29 Jan 2006 00:17:42 -0000 Message-ID: <20060129001742.37180.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r373265 - /directory/trunks/common/ldap/src/test/java/org/apache/ldap/common/codec/search/SearchRequestSubstringTest.java Date: Sun, 29 Jan 2006 00:17:42 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: elecharny Date: Sat Jan 28 16:17:35 2006 New Revision: 373265 URL: http://svn.apache.org/viewcvs?rev=373265&view=rev Log: Added two more tests Modified: directory/trunks/common/ldap/src/test/java/org/apache/ldap/common/codec/search/SearchRequestSubstringTest.java Modified: directory/trunks/common/ldap/src/test/java/org/apache/ldap/common/codec/search/SearchRequestSubstringTest.java URL: http://svn.apache.org/viewcvs/directory/trunks/common/ldap/src/test/java/org/apache/ldap/common/codec/search/SearchRequestSubstringTest.java?rev=373265&r1=373264&r2=373265&view=diff ============================================================================== --- directory/trunks/common/ldap/src/test/java/org/apache/ldap/common/codec/search/SearchRequestSubstringTest.java (original) +++ directory/trunks/common/ldap/src/test/java/org/apache/ldap/common/codec/search/SearchRequestSubstringTest.java Sat Jan 28 16:17:35 2006 @@ -1617,4 +1617,108 @@ fail( "We should not reach this point" ); } + + /** + * Test the decoding of a SearchRequest with a Substring filter + * Two initials + */ + public void testDecodeSearchRequestSubstringFilterTwoInitials() + { + byte[] asn1BER = new byte[] + { + 0x30, 0x49, + 0x02, 0x01, 0x04, // messageID + 0x63, 0x44, + 0x04, 0x1F, // baseObject 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', + 0x0A, 0x01, 0x01, + 0x0A, 0x01, 0x03, + 0x02, 0x01, 0x00, + 0x02, 0x01, 0x00, + 0x01, 0x01, (byte)0xFF, + (byte)0xA4, 0x0E, + 0x04, 0x04, 't', 'e', 's', 't', + 0x30, 0x06, + (byte)0x80, 0x01, 'a', + (byte)0x80, 0x01, 'b', + 0x30, 0x02, // AttributeDescriptionList ::= SEQUENCE OF AttributeDescription + 0x04, 0x00 + }; + + Asn1Decoder ldapDecoder = new LdapDecoder(); + + ByteBuffer stream = ByteBuffer.allocate( asn1BER.length ); + stream.put( asn1BER ); + stream.flip(); + + // Allocate a LdapMessage Container + IAsn1Container ldapMessageContainer = new LdapMessageContainer(); + + // Decode a SearchRequest message + try + { + ldapDecoder.decode(stream, ldapMessageContainer); + } + catch ( DecoderException de ) + { + System.out.println( de.getMessage() ); + assertTrue( true ); + return; + } + + fail( "We should not reach this point" ); + } + + /** + * Test the decoding of a SearchRequest with a Substring filter + * Two finals + */ + public void testDecodeSearchRequestSubstringFilterTwoFinals() + { + byte[] asn1BER = new byte[] + { + 0x30, 0x49, + 0x02, 0x01, 0x04, // messageID + 0x63, 0x44, + 0x04, 0x1F, // baseObject 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', + 0x0A, 0x01, 0x01, + 0x0A, 0x01, 0x03, + 0x02, 0x01, 0x00, + 0x02, 0x01, 0x00, + 0x01, 0x01, (byte)0xFF, + (byte)0xA4, 0x0E, + 0x04, 0x04, 't', 'e', 's', 't', + 0x30, 0x06, + (byte)0x82, 0x01, 'a', + (byte)0x82, 0x01, 'b', + 0x30, 0x02, // AttributeDescriptionList ::= SEQUENCE OF AttributeDescription + 0x04, 0x00 + }; + + Asn1Decoder ldapDecoder = new LdapDecoder(); + + ByteBuffer stream = ByteBuffer.allocate( asn1BER.length ); + stream.put( asn1BER ); + stream.flip(); + + // Allocate a LdapMessage Container + IAsn1Container ldapMessageContainer = new LdapMessageContainer(); + + // Decode a SearchRequest message + try + { + ldapDecoder.decode(stream, ldapMessageContainer); + } + catch ( DecoderException de ) + { + System.out.println( de.getMessage() ); + assertTrue( true ); + return; + } + + fail( "We should not reach this point" ); + } }