Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 25164 invoked from network); 15 Aug 2006 21:16:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 15 Aug 2006 21:16:47 -0000 Received: (qmail 16970 invoked by uid 500); 15 Aug 2006 21:16:45 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 16929 invoked by uid 500); 15 Aug 2006 21:16:45 -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 16918 invoked by uid 99); 15 Aug 2006 21:16:45 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Aug 2006 14:16:45 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Aug 2006 14:16:43 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 5B84E1A981A; Tue, 15 Aug 2006 14:16:23 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r431704 - /directory/branches/apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/SearchTest.java Date: Tue, 15 Aug 2006 21:16:23 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060815211623.5B84E1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: elecharny Date: Tue Aug 15 14:16:22 2006 New Revision: 431704 URL: http://svn.apache.org/viewvc?rev=431704&view=rev Log: Updated the test with Stefan patch for Dirserver-703 Modified: directory/branches/apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/SearchTest.java Modified: directory/branches/apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/SearchTest.java URL: http://svn.apache.org/viewvc/directory/branches/apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/SearchTest.java?rev=431704&r1=431703&r2=431704&view=diff ============================================================================== --- directory/branches/apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/SearchTest.java (original) +++ directory/branches/apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/SearchTest.java Tue Aug 15 14:16:22 2006 @@ -545,4 +545,67 @@ assertEquals( "expected results size of", 1, results.size() ); assertTrue( results.contains( "cn=anyBodyAdd" ) ); } + + + /** + * Create a person entry with multivalued RDN and check its content. This + * testcase was created to demonstrate DIRSERVER-628. + */ + public void testMultiValuedRdnContent() throws NamingException + { + Attributes attrs = getPersonAttributes( "Bush", "Kate Bush" ); + String rdn = "cn=Kate Bush+sn=Bush"; + ctx.createSubcontext( rdn, attrs ); + + SearchControls sctls = new SearchControls(); + sctls.setSearchScope( SearchControls.SUBTREE_SCOPE ); + String filter = "(sn=Bush)"; + String base = ""; + + NamingEnumeration enm = ctx.search( base, filter, sctls ); + while ( enm.hasMore() ) + { + SearchResult sr = ( SearchResult ) enm.next(); + attrs = sr.getAttributes(); + Attribute cn = sr.getAttributes().get( "cn" ); + assertNotNull( cn ); + assertTrue( cn.contains( "Kate Bush" ) ); + Attribute sn = sr.getAttributes().get( "sn" ); + assertNotNull( sn ); + assertTrue( sn.contains( "Bush" ) ); + } + + ctx.destroySubcontext( rdn ); + } + + + /** + * Create a person entry with multivalued RDN and check its name. + */ + public void testMultiValuedRdnName() throws NamingException + { + Attributes attrs = getPersonAttributes( "Bush", "Kate Bush" ); + String rdn = "cn=Kate Bush+sn=Bush"; + DirContext entry = ctx.createSubcontext( rdn, attrs ); + String nameInNamespace = entry.getNameInNamespace(); + + SearchControls sctls = new SearchControls(); + sctls.setSearchScope( SearchControls.OBJECT_SCOPE ); + String filter = "(sn=Bush)"; + String base = rdn; + + NamingEnumeration enm = ctx.search( base, filter, sctls ); + if ( enm.hasMore() ) + { + SearchResult sr = ( SearchResult ) enm.next(); + assertNotNull( sr ); + assertEquals( "Name in namespace", nameInNamespace, sr.getNameInNamespace() ); + } + else + { + fail( "Entry not found:" + nameInNamespace ); + } + + ctx.destroySubcontext( rdn ); + } }