directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r1800122 - in /directory/site/trunk/content: api/user-guide/2.2-binding-unbinding.mdtext api/user-guide/2.3-searching.mdtext index.mdtext
Date Wed, 28 Jun 2017 06:11:10 GMT
Author: seelmann
Date: Wed Jun 28 06:11:10 2017
New Revision: 1800122

URL: http://svn.apache.org/viewvc?rev=1800122&view=rev
Log:
Test

Modified:
    directory/site/trunk/content/api/user-guide/2.2-binding-unbinding.mdtext
    directory/site/trunk/content/api/user-guide/2.3-searching.mdtext
    directory/site/trunk/content/index.mdtext

Modified: directory/site/trunk/content/api/user-guide/2.2-binding-unbinding.mdtext
URL: http://svn.apache.org/viewvc/directory/site/trunk/content/api/user-guide/2.2-binding-unbinding.mdtext?rev=1800122&r1=1800121&r2=1800122&view=diff
==============================================================================
--- directory/site/trunk/content/api/user-guide/2.2-binding-unbinding.mdtext (original)
+++ directory/site/trunk/content/api/user-guide/2.2-binding-unbinding.mdtext Wed Jun 28 06:11:10
2017
@@ -94,7 +94,7 @@ It's possible to issue a **Bind** on an
 
     :::Java
     @Test
-    public void testDoubleSimpleBindValid() throws Exception
+    public void testRebind() throws Exception
     {
         connection.bind( "uid=admin,ou=system", "secret" );
 
@@ -115,7 +115,7 @@ It's important to know that when you iss
 
     :::Java
     @Test
-    public void testDoubleSimpleBindValid() throws Exception
+    public void testUnbind() throws Exception
     {
         connection.bind( "uid=admin,ou=system", "secret" );
 

Modified: directory/site/trunk/content/api/user-guide/2.3-searching.mdtext
URL: http://svn.apache.org/viewvc/directory/site/trunk/content/api/user-guide/2.3-searching.mdtext?rev=1800122&r1=1800121&r2=1800122&view=diff
==============================================================================
--- directory/site/trunk/content/api/user-guide/2.3-searching.mdtext (original)
+++ directory/site/trunk/content/api/user-guide/2.3-searching.mdtext Wed Jun 28 06:11:10 2017
@@ -33,15 +33,19 @@ The idea is to define a search **API** w
 Let's first look at a simple search. To process a search we need a starting point in the
tree, a filter, and a scope. Here's an example:
 
     :::java
-    EntryCursor cursor = connection.search( "ou=system", "(objectclass=*)", SearchScope.ONELEVEL
);
-    
-    for ( Entry entry : cursor )
+    @Test
+    public void testSearch() throws Exception
     {
-        assertNotNull( entry );
-        System.out.println( entry );
+        EntryCursor cursor = connection.search( "ou=system", "(objectclass=*)", SearchScope.ONELEVEL
);
+
+        for ( Entry entry : cursor )
+        {
+            assertNotNull( entry );
+            System.out.println( entry );
+        }
+
+        cursor.close();
     }
-    
-    cursor.close();
 
 
 In this example, the _connection_ has been previously created. We search for all entries
starting at *ou=system* along with its children, which have an _ObjectClass_ attribute (all
the entries have such an attribute, so we should get back all the entries). The scope (_ONELEVEL_)
searches one level under the starting base.
@@ -59,17 +63,21 @@ But this is not really enough, there are
 In the previous sample, we used a String to define the starting point of the search. Sometimes
it's convenient to start a search with a DN (i.e. because you got the DN from another operation).
In this case, no need to transform the DN into a String before doing your search, simply use
the DN!
 
     :::java
-    Dn systemDn = new Dn( "ou=system" );
-    ...
-    EntryCursor cursor = connection.search( systemDn, "(objectclass=*)", SearchScope.ONELEVEL
);
-    
-    for ( Entry entry : cursor )
+    @Test
+    public void testSearchWithDn() throws Exception
     {
-        assertNotNull( entry );
-        System.out.println( entry );
+        Dn systemDn = new Dn( "ou=system" );
+
+        EntryCursor cursor = connection.search( systemDn, "(objectclass=*)", SearchScope.ONELEVEL
);
+
+        for ( Entry entry : cursor )
+        {
+            assertNotNull( entry );
+            System.out.println( entry );
+        }
+
+        cursor.close();
     }
-    
-    cursor.close();
 
 This is it!
 
@@ -131,26 +139,30 @@ You may also add a Control to the search
 In both cases, you should fill the _SearchRequest_ message and send it to the server:
 
     :::Java
-    // Create the SearchRequest object
-    SearchRequest req = new SearchRequestImpl();
-    req.setScope( SearchScope.SUBTREE );
-    req.addAttributes( "*" );
-    req.setTimeLimit( 0 );
-    req.setBase( new Dn( "ou=system" ) );
-    req.setFilter( "(cn=user1)" );
-
-    // Process the request
-    SearchCursor searchCursor = connection.search( req );
-
-    while ( searchCursor.next() )
+    @Test
+    public void testSearchWithSearchRequest() throws Exception
     {
-        Response response = searchCursor.get();
+        // Create the SearchRequest object
+        SearchRequest req = new SearchRequestImpl();
+        req.setScope( SearchScope.SUBTREE );
+        req.addAttributes( "*" );
+        req.setTimeLimit( 0 );
+        req.setBase( new Dn( "ou=system" ) );
+        req.setFilter( "(cn=user1)" );
+
+        // Process the request
+        SearchCursor searchCursor = connection.search( req );
 
-        // process the SearchResultEntry
-        if ( response instanceof SearchResultEntry )
+        while ( searchCursor.next() )
         {
-            Entry resultEntry = ( ( SearchResultEntry ) response ).getEntry();
-            ...
+            Response response = searchCursor.get();
+
+            // process the SearchResultEntry
+            if ( response instanceof SearchResultEntry )
+            {
+                Entry resultEntry = ( ( SearchResultEntry ) response ).getEntry();
+                System.out.println( resultEntry );
+            }
         }
     }
 

Modified: directory/site/trunk/content/index.mdtext
URL: http://svn.apache.org/viewvc/directory/site/trunk/content/index.mdtext?rev=1800122&r1=1800121&r2=1800122&view=diff
==============================================================================
--- directory/site/trunk/content/index.mdtext (original)
+++ directory/site/trunk/content/index.mdtext Wed Jun 28 06:11:10 2017
@@ -109,3 +109,4 @@ td {font-size: 12px;}
   </tbody>
 </table>
 
+



Mime
View raw message