directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r493876 - in /directory/trunks/apacheds: core-unit/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceITest.java server-unit/src/test/java/org/apache/directory/server/SearchTest.java
Date Sun, 07 Jan 2007 23:33:28 GMT
Author: seelmann
Date: Sun Jan  7 15:33:27 2007
New Revision: 493876

URL: http://svn.apache.org/viewvc?view=rev&rev=493876
Log:
Added test cases for DIRSERVER-816, commented

Modified:
    directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceITest.java
    directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/SearchTest.java

Modified: directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceITest.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceITest.java?view=diff&rev=493876&r1=493875&r2=493876
==============================================================================
--- directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceITest.java
(original)
+++ directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceITest.java
Sun Jan  7 15:33:27 2007
@@ -139,7 +139,25 @@
         }
         return resultMap;
     }
-
+    
+    
+//  Testcase for DIRSERVER-816
+//    public Map getAllEntriesCollectiveAttributesOnly() throws NamingException
+//    {
+//        Map resultMap = new HashMap();
+//        SearchControls controls = new SearchControls();
+//        controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
+//        controls.setReturningAttributes( new String[]
+//                                                    { "c-ou", "c-st" } );
+//        NamingEnumeration results = super.sysRoot.search( "", "(objectClass=*)", controls
);
+//        while ( results.hasMore() )
+//        {
+//            SearchResult result = ( SearchResult ) results.next();
+//            resultMap.put( result.getName(), result.getAttributes() );
+//        }
+//        return resultMap;
+//    }
+    
 
     public void testLookup() throws Exception
     {
@@ -266,6 +284,20 @@
         assertNotNull( "a collective c-ou attribute should be present", c_ou );
         assertEquals( "configuration", c_ou.get() );
 
+        
+//      Testcase for DIRSERVER-816
+//        // ------------------------------------------------------------------
+//        // test an entry that should show the collective attribute c-ou, 
+//        // but restrict returned attributes to c-ou and c-st
+//        // ------------------------------------------------------------------
+//        
+//        entries = getAllEntriesCollectiveAttributesOnly();
+//        attributes = ( Attributes ) entries.get( "ou=services,ou=configuration,ou=system"
);
+//        c_ou = attributes.get( "c-ou" );
+//        assertNotNull( "a collective c-ou attribute should be present", c_ou );
+//        assertEquals( "configuration", c_ou.get() );   
+        
+        
         // -------------------------------------------------------------------
         // test an entry that should not show the collective attribute
         // -------------------------------------------------------------------

Modified: directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/SearchTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/SearchTest.java?view=diff&rev=493876&r1=493875&r2=493876
==============================================================================
--- directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/SearchTest.java
(original)
+++ directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/SearchTest.java
Sun Jan  7 15:33:27 2007
@@ -833,4 +833,57 @@
         assertEquals( "Tori Amos", (String)attrs.get("cn").get() );
     }
     
+    
+//  Testcase for DIRSERVER-816
+//    public void testSearchAttrC_L() throws NamingException
+//    {
+//        // create administrative area
+//        Attributes aaAttrs = new BasicAttributes();
+//        Attribute aaObjectClass = new BasicAttribute( "objectClass" );
+//        aaObjectClass.add( "top" );
+//        aaObjectClass.add( "organizationalUnit" );
+//        aaObjectClass.add( "extensibleObject" );
+//        aaAttrs.put( aaObjectClass );
+//        aaAttrs.put( "ou", "Collective Test" );
+//        aaAttrs.put( "administrativeRole", "collectiveAttributeSpecificArea" );
+//        DirContext aaCtx = ctx.createSubcontext( "ou=Collective Area", aaAttrs );
+//        
+//        // create subentry
+//        Attributes subentry = new BasicAttributes();
+//        Attribute objectClass = new BasicAttribute( "objectClass" );
+//        objectClass.add( "top" );
+//        objectClass.add( "subentry" );
+//        objectClass.add( "collectiveAttributeSubentry" );
+//        subentry.put( objectClass );
+//        subentry.put( "c-l", "Munich" );
+//        subentry.put( "cn", "Collective Subentry" );
+//        subentry.put( "subtreeSpecification", "{ }" );
+//        aaCtx.createSubcontext( "cn=Collective Subentry", aaAttrs );
+//        
+//        // create real enty
+//        Attributes attributes = this.getPersonAttributes( "Bush", "Kate Bush" );
+//        aaCtx.createSubcontext( "cn=Kate Bush", attributes );
+//        
+//        // search
+//        SearchControls controls = new SearchControls();
+//        controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
+//        controls.setReturningAttributes( new String[]{"c-l"} );
+//        
+//        NamingEnumeration res = aaCtx.search( "", "(cn=Kate Bush)", controls );
+//        
+//        assertTrue( res.hasMore() );
+//        
+//        SearchResult result = ( SearchResult ) res.next();
+//        
+//        // ensure that result is not null
+//        assertNotNull( result );
+//        
+//        Attributes attrs = result.getAttributes();
+//        
+//        // ensure the one and only attribute is "c-l"
+//        assertEquals( 1, attrs.size() );
+//        assertNotNull( attrs.get("c-l") );
+//        assertEquals( 1, attrs.get("c-l").size() );
+//        assertEquals( "Munich", (String)attrs.get("c-l").get() );
+//    }
 }



Mime
View raw message