directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r1007594 - in /websites/staging/directory/trunk/content: ./ api/user-guide/2.4-adding.html
Date Thu, 02 Mar 2017 21:35:04 GMT
Author: buildbot
Date: Thu Mar  2 21:35:04 2017
New Revision: 1007594

Log:
Staging update by buildbot for directory

Modified:
    websites/staging/directory/trunk/content/   (props changed)
    websites/staging/directory/trunk/content/api/user-guide/2.4-adding.html

Propchange: websites/staging/directory/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Thu Mar  2 21:35:04 2017
@@ -1 +1 @@
-1785192
+1785193

Modified: websites/staging/directory/trunk/content/api/user-guide/2.4-adding.html
==============================================================================
--- websites/staging/directory/trunk/content/api/user-guide/2.4-adding.html (original)
+++ websites/staging/directory/trunk/content/api/user-guide/2.4-adding.html Thu Mar  2 21:35:04
2017
@@ -189,46 +189,38 @@ h2:hover > .headerlink, h3:hover > .head
 <p>Here is the simplest way to add an entry into the server, assuming that the entry
is correct. In order to add an entry, you must provide the location where the entry is stored
(its <em>Dn</em>) and the list of its <em>Attributes</em> contained
within it.</p>
 <p>Here are two examples where the entry is injected using <strong>LDIF</strong>:</p>
 <div class="codehilite"><pre><span class="nd">@Test</span>
-<span class="kd">public</span> <span class="kt">void</span> <span
class="nf">testAddLdif</span><span class="o">()</span> <span class="kd">throws</span>
<span class="n">Exception</span>
+<span class="kd">public</span> <span class="kt">void</span> <span
class="nf">testAddLdif1</span><span class="o">()</span> <span class="kd">throws</span>
<span class="n">Exception</span>
 <span class="o">{</span>
-    <span class="n">AddResponse</span> <span class="n">response</span>
<span class="o">=</span> <span class="n">connection</span><span
class="o">.</span><span class="na">add</span><span class="o">(</span>

-        <span class="k">new</span> <span class="nf">DefaultEntry</span><span
class="o">(</span> 
-            <span class="s">&quot;cn=testadd,ou=system&quot;</span><span
class="o">,</span>    <span class="c1">// The Dn</span>
+    <span class="n">connection</span><span class="o">.</span><span
class="na">add</span><span class="o">(</span>
+        <span class="k">new</span> <span class="nf">DefaultEntry</span><span
class="o">(</span>
+            <span class="s">&quot;cn=testadd,ou=system&quot;</span><span
class="o">,</span> <span class="c1">// The Dn</span>
             <span class="s">&quot;ObjectClass: top&quot;</span><span
class="o">,</span>
             <span class="s">&quot;ObjectClass: person&quot;</span><span
class="o">,</span>
             <span class="s">&quot;cn: testadd_cn&quot;</span><span
class="o">,</span>
-            <span class="s">&quot;sn: testadd_sn&quot;</span>
-            <span class="o">)</span> <span class="o">);</span>
+            <span class="s">&quot;sn: testadd_sn&quot;</span> <span
class="o">)</span> <span class="o">);</span>
 
-    <span class="n">assertNotNull</span><span class="o">(</span>
<span class="n">response</span> <span class="o">);</span>
-    <span class="n">assertEquals</span><span class="o">(</span> <span
class="n">ResultCodeEnum</span><span class="o">.</span><span class="na">SUCCESS</span><span
class="o">,</span> <span class="n">response</span><span class="o">.</span><span
class="na">getLdapResult</span><span class="o">().</span><span class="na">getResultCode</span><span
class="o">()</span> <span class="o">);</span>
-
-    <span class="n">assertTrue</span><span class="o">(</span> <span
class="n">session</span><span class="o">.</span><span class="na">exists</span><span
class="o">(</span> <span class="s">&quot;cn=testadd,ou=system&quot;</span>
<span class="o">)</span> <span class="o">);</span>
+    <span class="n">assertTrue</span><span class="o">(</span> <span
class="n">connection</span><span class="o">.</span><span class="na">exists</span><span
class="o">(</span> <span class="s">&quot;cn=testadd,ou=system&quot;</span>
<span class="o">)</span> <span class="o">);</span>
 <span class="o">}</span>
 </pre></div>
 
 
-<p>In this basic example, we are adding a new entry, created using some <strong>LDIF</strong>
formatted parameters, the first one being the entry's <em>Dn</em>.
-Note that it is possible to use some variables in the <strong>LDIF</strong> instead
of pure text. Here is the same example, resulting to the same entry being added:</p>
+<p>In this basic example, we are adding a new entry, created using some <strong>LDIF</strong>
formatted parameters, the first one being the entry's <em>Dn</em>.</p>
+<p>Note that it is possible to use some variables in the <strong>LDIF</strong>
instead of pure text. Here is the same example, resulting to the same entry being added:</p>
 <div class="codehilite"><pre><span class="nd">@Test</span>
-<span class="kd">public</span> <span class="kt">void</span> <span
class="nf">testAddLdif</span><span class="o">()</span> <span class="kd">throws</span>
<span class="n">Exception</span>
+<span class="kd">public</span> <span class="kt">void</span> <span
class="nf">testAddLdif2</span><span class="o">()</span> <span class="kd">throws</span>
<span class="n">Exception</span>
 <span class="o">{</span>
     <span class="n">String</span> <span class="n">cn</span> <span
class="o">=</span> <span class="s">&quot;testadd_cn&quot;</span><span
class="o">;</span>
     <span class="n">String</span> <span class="n">sn</span> <span
class="o">=</span> <span class="s">&quot;testadd_sn&quot;</span><span
class="o">;</span>
 
-    <span class="n">AddResponse</span> <span class="n">response</span>
<span class="o">=</span> <span class="n">connection</span><span
class="o">.</span><span class="na">add</span><span class="o">(</span>

-        <span class="k">new</span> <span class="nf">DefaultEntry</span><span
class="o">(</span> 
-            <span class="s">&quot;cn=testadd,ou=system&quot;</span><span
class="o">,</span>    <span class="c1">// The Dn</span>
+    <span class="n">connection</span><span class="o">.</span><span
class="na">add</span><span class="o">(</span>
+        <span class="k">new</span> <span class="nf">DefaultEntry</span><span
class="o">(</span>
+            <span class="s">&quot;cn=testadd,ou=system&quot;</span><span
class="o">,</span> <span class="c1">// The Dn</span>
             <span class="s">&quot;ObjectClass: top&quot;</span><span
class="o">,</span>
             <span class="s">&quot;ObjectClass: person&quot;</span><span
class="o">,</span>
-            <span class="s">&quot;cn&quot;</span><span class="o">,</span>
<span class="n">cn</span><span class="o">,</span>                
 <span class="c1">// Note : there is no &#39;:&#39; when using a variable</span>
-            <span class="s">&quot;sn&quot;</span><span class="o">,</span>
<span class="n">sn</span>
-            <span class="o">)</span> <span class="o">);</span>
-
-    <span class="n">assertNotNull</span><span class="o">(</span>
<span class="n">response</span> <span class="o">);</span>
-    <span class="n">assertEquals</span><span class="o">(</span> <span
class="n">ResultCodeEnum</span><span class="o">.</span><span class="na">SUCCESS</span><span
class="o">,</span> <span class="n">response</span><span class="o">.</span><span
class="na">getLdapResult</span><span class="o">().</span><span class="na">getResultCode</span><span
class="o">()</span> <span class="o">);</span>
+            <span class="s">&quot;cn&quot;</span><span class="o">,</span>
<span class="n">cn</span><span class="o">,</span> <span class="c1">//
Note : there is no &#39;:&#39; when using a variable</span>
+            <span class="s">&quot;sn&quot;</span><span class="o">,</span>
<span class="n">sn</span> <span class="o">)</span> <span class="o">);</span>
 
-    <span class="n">assertTrue</span><span class="o">(</span> <span
class="n">session</span><span class="o">.</span><span class="na">exists</span><span
class="o">(</span> <span class="s">&quot;cn=testadd,ou=system&quot;</span>
<span class="o">)</span> <span class="o">);</span>
+    <span class="n">assertTrue</span><span class="o">(</span> <span
class="n">connection</span><span class="o">.</span><span class="na">exists</span><span
class="o">(</span> <span class="s">&quot;cn=testadd,ou=system&quot;</span>
<span class="o">)</span> <span class="o">);</span>
 <span class="o">}</span>
 </pre></div>
 
@@ -241,15 +233,14 @@ Note that it is possible to use some var
 <div class="codehilite"><pre><span class="nd">@Test</span>
 <span class="kd">public</span> <span class="kt">void</span> <span
class="nf">testAddWithControl</span><span class="o">()</span> <span
class="kd">throws</span> <span class="n">Exception</span>
 <span class="o">{</span>
-    <span class="n">assertFalse</span><span class="o">(</span> <span
class="n">session</span><span class="o">.</span><span class="na">exists</span><span
class="o">(</span> <span class="s">&quot;cn=testadd,ou=system&quot;</span>
<span class="o">)</span> <span class="o">);</span>
+    <span class="n">assertFalse</span><span class="o">(</span> <span
class="n">connection</span><span class="o">.</span><span class="na">exists</span><span
class="o">(</span> <span class="s">&quot;cn=testadd,ou=system&quot;</span>
<span class="o">)</span> <span class="o">);</span>
 
-    <span class="n">Entry</span> <span class="n">entry</span> <span
class="o">=</span> <span class="k">new</span> <span class="n">DefaultEntry</span><span
class="o">(</span> 
+    <span class="n">Entry</span> <span class="n">entry</span> <span
class="o">=</span> <span class="k">new</span> <span class="n">DefaultEntry</span><span
class="o">(</span>
         <span class="s">&quot;cn=testadd,ou=system&quot;</span><span
class="o">,</span>
         <span class="s">&quot;ObjectClass : top&quot;</span><span
class="o">,</span>
         <span class="s">&quot;ObjectClass : person&quot;</span><span
class="o">,</span>
         <span class="s">&quot;cn: testadd_sn&quot;</span><span class="o">,</span>
-        <span class="s">&quot;sn: testadd_sn&quot;</span>
-        <span class="o">);</span>
+        <span class="s">&quot;sn: testadd_sn&quot;</span> <span class="o">);</span>
 
     <span class="n">AddRequest</span> <span class="n">addRequest</span>
<span class="o">=</span> <span class="k">new</span> <span class="n">AddRequestImpl</span><span
class="o">();</span>
     <span class="n">addRequest</span><span class="o">.</span><span
class="na">setEntry</span><span class="o">(</span> <span class="n">entry</span>
<span class="o">);</span>
@@ -260,7 +251,7 @@ Note that it is possible to use some var
     <span class="n">assertNotNull</span><span class="o">(</span>
<span class="n">response</span> <span class="o">);</span>
     <span class="n">assertEquals</span><span class="o">(</span> <span
class="n">ResultCodeEnum</span><span class="o">.</span><span class="na">SUCCESS</span><span
class="o">,</span> <span class="n">response</span><span class="o">.</span><span
class="na">getLdapResult</span><span class="o">().</span><span class="na">getResultCode</span><span
class="o">()</span> <span class="o">);</span>
 
-    <span class="n">assertTrue</span><span class="o">(</span> <span
class="n">session</span><span class="o">.</span><span class="na">exists</span><span
class="o">(</span> <span class="s">&quot;cn=testadd,ou=system&quot;</span>
<span class="o">)</span> <span class="o">);</span>
+    <span class="n">assertTrue</span><span class="o">(</span> <span
class="n">connection</span><span class="o">.</span><span class="na">exists</span><span
class="o">(</span> <span class="s">&quot;cn=testadd,ou=system&quot;</span>
<span class="o">)</span> <span class="o">);</span>
 <span class="o">}</span>
 </pre></div>
 
@@ -270,14 +261,15 @@ Note that it is possible to use some var
 <div class="codehilite"><pre><span class="nd">@Test</span>
 <span class="kd">public</span> <span class="kt">void</span> <span
class="nf">testAddAsyncLdif</span><span class="o">()</span> <span
class="kd">throws</span> <span class="n">Exception</span>
 <span class="o">{</span>
-    <span class="n">Entry</span> <span class="n">entry</span> <span
class="o">=</span> <span class="k">new</span> <span class="n">DefaultEntry</span><span
class="o">(</span> 
+    <span class="n">assertFalse</span><span class="o">(</span> <span
class="n">connection</span><span class="o">.</span><span class="na">exists</span><span
class="o">(</span> <span class="s">&quot;cn=testAsyncAdd,ou=system&quot;</span>
<span class="o">)</span> <span class="o">);</span>
+
+    <span class="n">Entry</span> <span class="n">entry</span> <span
class="o">=</span> <span class="k">new</span> <span class="n">DefaultEntry</span><span
class="o">(</span>
         <span class="s">&quot;cn=testAsyncAdd,ou=system&quot;</span><span
class="o">,</span>
         <span class="s">&quot;ObjectClass: top&quot;</span><span class="o">,</span>
         <span class="s">&quot;ObjectClass: person&quot;</span><span
class="o">,</span>
         <span class="s">&quot;cn: testAsyncAdd_cn&quot;</span><span
class="o">,</span>
         <span class="s">&quot;sn: testAsyncAdd_sn&quot;</span> <span
class="o">);</span>
 
-    <span class="n">assertFalse</span><span class="o">(</span> <span
class="n">session</span><span class="o">.</span><span class="na">exists</span><span
class="o">(</span> <span class="s">&quot;cn=testAsyncAdd,ou=system&quot;</span>
<span class="o">)</span> <span class="o">);</span>
     <span class="n">AddRequest</span> <span class="n">addRequest</span>
<span class="o">=</span> <span class="k">new</span> <span class="n">AddRequestImpl</span><span
class="o">();</span>
     <span class="n">addRequest</span><span class="o">.</span><span
class="na">setEntry</span><span class="o">(</span> <span class="n">entry</span>
<span class="o">);</span>
 
@@ -289,7 +281,8 @@ Note that it is possible to use some var
 
     <span class="n">assertNotNull</span><span class="o">(</span>
<span class="n">addResponse</span> <span class="o">);</span>
     <span class="n">assertEquals</span><span class="o">(</span> <span
class="n">ResultCodeEnum</span><span class="o">.</span><span class="na">SUCCESS</span><span
class="o">,</span> <span class="n">addResponse</span><span class="o">.</span><span
class="na">getLdapResult</span><span class="o">().</span><span class="na">getResultCode</span><span
class="o">()</span> <span class="o">);</span>
-    <span class="n">assertTrue</span><span class="o">(</span> <span
class="n">session</span><span class="o">.</span><span class="na">exists</span><span
class="o">(</span> <span class="s">&quot;cn=testAsyncAdd,ou=system&quot;</span>
<span class="o">)</span> <span class="o">);</span>
+
+    <span class="n">assertTrue</span><span class="o">(</span> <span
class="n">connection</span><span class="o">.</span><span class="na">exists</span><span
class="o">(</span> <span class="s">&quot;cn=testAsyncAdd,ou=system&quot;</span>
<span class="o">)</span> <span class="o">);</span>
 <span class="o">}</span>
 </pre></div>
 



Mime
View raw message