directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r1030870 - /directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java
Date Thu, 04 Nov 2010 09:41:04 GMT
Author: seelmann
Date: Thu Nov  4 09:41:03 2010
New Revision: 1030870

URL: http://svn.apache.org/viewvc?rev=1030870&view=rev
Log:
o use lookup instead of search
o renamed test method

Modified:
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java?rev=1030870&r1=1030869&r2=1030870&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java
(original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java
Thu Nov  4 09:41:03 2010
@@ -123,7 +123,7 @@ public class OperationalAttributeService
 
 
     @Test
-    public void testModifyOperationalOpAttrs() throws Exception
+    public void testAddShouldAddOperationalOpAttrs() throws Exception
     {
         /*
          * create ou=testing00,ou=system
@@ -133,8 +133,8 @@ public class OperationalAttributeService
 
         connection.add( entry );
 
-        entry = connection.lookup( "ou=testing00,ou=system" );
-        assertNotNull( entry );
+        // search user attributes doesn't include op attrs
+        entry = connection.lookup( "ou=testing00,ou=system", "*" );
 
         assertNotNull( entry );
         assertEquals( "testing00", entry.get( "ou" ).getString() );
@@ -145,14 +145,12 @@ public class OperationalAttributeService
         assertNull( entry.get( "createTimestamp" ) );
         assertNull( entry.get( "creatorsName" ) );
 
-        Cursor<Response> responses = connection.search( "ou=testing00,ou=system", "(ou=testing00)",
-            SearchScope.SUBTREE, "ou", "createTimestamp", "creatorsName" );
-        responses.next();
-        SearchResultEntry result = ( SearchResultEntry ) responses.get();
+        // search with '+' includes op attrs
+        entry = connection.lookup( "ou=testing00,ou=system", "*", "+" );
 
-        assertNotNull( result.getEntry().get( "ou" ) );
-        assertNotNull( result.getEntry().get( "creatorsName" ) );
-        assertNotNull( result.getEntry().get( "createTimestamp" ) );
+        assertNotNull( entry.get( "ou" ) );
+        assertNotNull( entry.get( "creatorsName" ) );
+        assertNotNull( entry.get( "createTimestamp" ) );
     }
 
 
@@ -234,18 +232,20 @@ public class OperationalAttributeService
     @Test
     public void testModifyShouldLeadToModifiersAttributes() throws Exception
     {
+        Entry entry = connection.lookup( DN_KATE_BUSH, "modifiersName", "modifyTimestamp"
);
+
+        assertNull( entry.get( "modifiersName" ) );
+        assertNull( entry.get( "modifyTimestamp" ) );
+        
         Modification modifyOp = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE,
             new DefaultEntryAttribute( "description", "Singer Songwriter" ) );
 
         connection.modify( DN_KATE_BUSH, modifyOp );
 
-        Cursor<Response> responses = connection.search( DN_KATE_BUSH, "(objectClass=*)",
SearchScope.OBJECT,
-            "modifiersName", "modifyTimestamp" );
-        responses.next();
-        SearchResultEntry result = ( SearchResultEntry ) responses.get();
+        entry = connection.lookup( DN_KATE_BUSH, "modifiersName", "modifyTimestamp" );
 
-        assertNotNull( result.getEntry().get( "modifiersName" ) );
-        assertNotNull( result.getEntry().get( "modifyTimestamp" ) );
+        assertNotNull( entry.get( "modifiersName" ) );
+        assertNotNull( entry.get( "modifyTimestamp" ) );
     }
 
 
@@ -265,12 +265,9 @@ public class OperationalAttributeService
         connection.modify( DN_KATE_BUSH, modifyAddOp );
 
         // Determine modifyTimestamp
-        Cursor<Response> responses = connection.search( DN_KATE_BUSH, "(objectClass=*)",
SearchScope.OBJECT,
-            "modifyTimestamp" );
-        responses.next();
-        SearchResultEntry result = ( SearchResultEntry ) responses.get();
+        Entry entry = connection.lookup( DN_KATE_BUSH, "modifyTimestamp" );
 
-        EntryAttribute modifyTimestamp = result.getEntry().get( "modifyTimestamp" );
+        EntryAttribute modifyTimestamp = entry.get( "modifyTimestamp" );
         assertNotNull( modifyTimestamp );
         String oldTimestamp = modifyTimestamp.getString();
 
@@ -284,11 +281,9 @@ public class OperationalAttributeService
         connection.modify( DN_KATE_BUSH, modifyOp );
 
         // Determine modifyTimestamp after modification
-        responses = connection.search( DN_KATE_BUSH, "(objectClass=*)", SearchScope.OBJECT,
"modifyTimestamp" );
-        responses.next();
-        result = ( SearchResultEntry ) responses.get();
+        entry = connection.lookup( DN_KATE_BUSH, "modifyTimestamp" );
 
-        modifyTimestamp = result.getEntry().get( "modifyTimestamp" );
+        modifyTimestamp = entry.get( "modifyTimestamp" );
         assertNotNull( modifyTimestamp );
         String newTimestamp = modifyTimestamp.getString();
 



Mime
View raw message