directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From szoer...@apache.org
Subject svn commit: r320745 - in /directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi: ./ ops/compare/ ops/delete/ ops/modifydn/ ops/search/ util/
Date Thu, 13 Oct 2005 12:07:30 GMT
Author: szoerner
Date: Thu Oct 13 05:07:21 2005
New Revision: 320745

URL: http://svn.apache.org/viewcvs?rev=320745&view=rev
Log:
Create a new method within the AttributesFactory class, which creates the required attributes
for an organizat onalUnit entry (OID 2.5.6.5), and use it in several test cases to reduce
duplicate code.

Modified:
    directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/BaseProtocolTest.java
    directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/compare/BasicCompareTests.java
  (contents, props changed)
    directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/compare/CompareOperationalAttributesTest.java
  (contents, props changed)
    directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/delete/BasicDeleteTests.java
  (contents, props changed)
    directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/delete/TreeDeleteControlTests.java
  (contents, props changed)
    directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/modifydn/ModifyDnSameAttributeTests.java
  (contents, props changed)
    directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/search/SearchScopeTest.java
  (contents, props changed)
    directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/util/AttributesFactory.java

Modified: directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/BaseProtocolTest.java
URL: http://svn.apache.org/viewcvs/directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/BaseProtocolTest.java?rev=320745&r1=320744&r2=320745&view=diff
==============================================================================
--- directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/BaseProtocolTest.java
(original)
+++ directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/BaseProtocolTest.java
Thu Oct 13 05:07:21 2005
@@ -20,16 +20,15 @@
 import javax.naming.NameNotFoundException;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
-import javax.naming.directory.BasicAttribute;
-import javax.naming.directory.BasicAttributes;
 import javax.naming.directory.DirContext;
 import javax.naming.ldap.InitialLdapContext;
 import javax.naming.ldap.LdapContext;
 
 import junit.framework.TestCase;
 
+import org.apache.ldap.testsuite.ldaptests.jndi.util.AttributesFactory;
+
 /**
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev: $
@@ -50,12 +49,7 @@
         }
 
         // Create an entry
-        Attributes attributes = new BasicAttributes();
-        Attribute attribute = new BasicAttribute("objectClass");
-        attribute.add("top");
-        attribute.add("organizationalUnit");
-        attributes.put(attribute);
-        attributes.put("ou", "playground");
+        Attributes attributes = AttributesFactory.createOrganizationalUnitAttributes("playground");
 
         DirContext pg = ctx.createSubcontext(getTestContainerRdn(), attributes);
         assertNotNull(pg);
@@ -86,7 +80,6 @@
 
     private void deleteSubtree(LdapContext entry) throws NamingException
     {
-
         NamingEnumeration enumeration = entry.listBindings("");
         while (enumeration.hasMore()) {
             Binding b = (Binding) enumeration.next();

Modified: directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/compare/BasicCompareTests.java
URL: http://svn.apache.org/viewcvs/directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/compare/BasicCompareTests.java?rev=320745&r1=320744&r2=320745&view=diff
==============================================================================
--- directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/compare/BasicCompareTests.java
(original)
+++ directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/compare/BasicCompareTests.java
Thu Oct 13 05:07:21 2005
@@ -18,19 +18,17 @@
 
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
-import javax.naming.directory.BasicAttribute;
-import javax.naming.directory.BasicAttributes;
 import javax.naming.directory.DirContext;
 import javax.naming.directory.NoSuchAttributeException;
 import javax.naming.directory.SearchControls;
 
 import org.apache.ldap.testsuite.ldaptests.jndi.BaseProtocolTest;
+import org.apache.ldap.testsuite.ldaptests.jndi.util.AttributesFactory;
 
 /**
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev: $ 
+ * @version $Rev$ 
  */
 public class BasicCompareTests extends BaseProtocolTest {
 
@@ -39,18 +37,6 @@
 
 	public static final String RDN = "cn=Tori Amos";
 
-	protected Attributes getPersonAttributes(String sn, String cn) {
-		Attributes attributes = new BasicAttributes();
-		Attribute attribute = new BasicAttribute("objectClass");
-		attribute.add("top");
-		attribute.add("person");
-		attributes.put(attribute);
-		attributes.put("cn", cn);
-		attributes.put("sn", sn);
-
-		return attributes;
-	}
-
 	public void setUp() throws NamingException {
 		super.setUp();
 		
@@ -58,7 +44,7 @@
 		target = (DirContext) ctx.lookup(this.getTestContainerRdn()); 
 
 		// Create a person
-		Attributes attributes = this.getPersonAttributes("Amos", "Tori Amos");
+		Attributes attributes = AttributesFactory.createPersonAttributes("Amos", "Tori Amos");
 		target.createSubcontext(RDN, attributes);
 	}
 
@@ -148,7 +134,7 @@
 		} catch (NamingException iaie) {
 			// expected behaviour
 			
-			// TODO: add
+			// TODO: add a more detailed Exception here
 
 			// I am uncertain, whether Return code 16 or 17 is appropriate here.
 			// both values occur, depending on the server you use

Propchange: directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/compare/BasicCompareTests.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Modified: directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/compare/CompareOperationalAttributesTest.java
URL: http://svn.apache.org/viewcvs/directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/compare/CompareOperationalAttributesTest.java?rev=320745&r1=320744&r2=320745&view=diff
==============================================================================
--- directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/compare/CompareOperationalAttributesTest.java
(original)
+++ directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/compare/CompareOperationalAttributesTest.java
Thu Oct 13 05:07:21 2005
@@ -20,7 +20,6 @@
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
-import javax.naming.directory.BasicAttribute;
 import javax.naming.directory.BasicAttributes;
 import javax.naming.directory.DirContext;
 import javax.naming.directory.SearchControls;
@@ -28,33 +27,22 @@
 import javax.naming.ldap.LdapContext;
 
 import org.apache.ldap.testsuite.ldaptests.jndi.BaseProtocolTest;
+import org.apache.ldap.testsuite.ldaptests.jndi.util.AttributesFactory;
 
 /**
  * Tests with compare operations on the operational attributes createTimestamp,
  * modifyTimestamp, creatorsName, modifiersName.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev: $ 
+ * @version $Rev$ 
  */
 public class CompareOperationalAttributesTest extends BaseProtocolTest {
 
 	private LdapContext ctx = null;
 
-	public static final String RDN = "ou=Peoples Front of Judea";
-
-	/**
-	 * Creation of required attributes of an organizationalUnit entry.
-	 */
-	protected Attributes getOrganizationalUnitAttributes(String ou) {
-		Attributes attributes = new BasicAttributes();
-		Attribute attribute = new BasicAttribute("objectClass");
-		attribute.add("top");
-		attribute.add("organizationalUnit");
-		attributes.put(attribute);
-		attributes.put("ou", ou);
-
-		return attributes;
-	}
+    public static final String OU_VALUE = "Peoples Front of Judea";
+    
+	public static final String RDN = "ou="+OU_VALUE;
 
 	public void setUp() throws NamingException {
 		super.setUp();
@@ -62,8 +50,8 @@
 		ctx = this.createContext();
 		ctx = (LdapContext) ctx.lookup(this.getTestContainerRdn());
 
-		// Create an organizationalUnit
-		Attributes attributes = this.getOrganizationalUnitAttributes("Amos");
+		// Create an organizational Unit
+		Attributes attributes = AttributesFactory.createOrganizationalUnitAttributes(OU_VALUE);
 		ctx.createSubcontext(RDN, attributes);
 	}
 

Propchange: directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/compare/CompareOperationalAttributesTest.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Modified: directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/delete/BasicDeleteTests.java
URL: http://svn.apache.org/viewcvs/directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/delete/BasicDeleteTests.java?rev=320745&r1=320744&r2=320745&view=diff
==============================================================================
--- directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/delete/BasicDeleteTests.java
(original)
+++ directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/delete/BasicDeleteTests.java
Thu Oct 13 05:07:21 2005
@@ -19,35 +19,18 @@
 import javax.naming.ContextNotEmptyException;
 import javax.naming.NameNotFoundException;
 import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
-import javax.naming.directory.BasicAttribute;
-import javax.naming.directory.BasicAttributes;
 import javax.naming.directory.DirContext;
 
 import org.apache.ldap.testsuite.ldaptests.jndi.BaseProtocolTest;
+import org.apache.ldap.testsuite.ldaptests.jndi.util.AttributesFactory;
 
 /**
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev: $
+ * @version $Rev$
  */
 public class BasicDeleteTests extends BaseProtocolTest
 {
-
-    protected Attributes getOrganizationalUnitAttributes(String ou)
-    {
-        Attributes attributes = new BasicAttributes();
-
-        Attribute ocls = new BasicAttribute("objectClass");
-        ocls.add("top");
-        ocls.add("organizationalUnit");
-        attributes.put(ocls);
-
-        attributes.put("ou", ou);
-
-        return attributes;
-    }
-
     /**
      * Basic deletion test. Creates an entry, delete it, and check whether it is
      * gone.
@@ -64,7 +47,7 @@
         DirContext target = (DirContext) ctx.lookup(this.getTestContainerRdn());
 
         // Add an entry
-        Attributes attributes = this.getOrganizationalUnitAttributes(ou);
+        Attributes attributes = AttributesFactory.createOrganizationalUnitAttributes(ou);
         DirContext orgUnit = target.createSubcontext(rdn, attributes);
 
         // Check wether entry is created
@@ -99,7 +82,7 @@
         // Add an entry
         final String ou = "nonLeaf";
         final String rdn = "ou=" + ou;
-        Attributes attributes = this.getOrganizationalUnitAttributes(ou);
+        Attributes attributes = AttributesFactory.createOrganizationalUnitAttributes(ou);
         target.createSubcontext(rdn, attributes);
 
         // Check wether entry is created
@@ -109,7 +92,7 @@
         // Add an entry below this
         final String ouLeaf = "leaf";
         final String rdnLeaf = "ou=" + ouLeaf;
-        attributes = this.getOrganizationalUnitAttributes(ouLeaf);
+        attributes = AttributesFactory.createOrganizationalUnitAttributes(ouLeaf);
         nonLeafRdn.createSubcontext(rdnLeaf, attributes);
 
         // Try to delete subtree Entry

Propchange: directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/delete/BasicDeleteTests.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Modified: directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/delete/TreeDeleteControlTests.java
URL: http://svn.apache.org/viewcvs/directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/delete/TreeDeleteControlTests.java?rev=320745&r1=320744&r2=320745&view=diff
==============================================================================
--- directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/delete/TreeDeleteControlTests.java
(original)
+++ directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/delete/TreeDeleteControlTests.java
Thu Oct 13 05:07:21 2005
@@ -19,19 +19,17 @@
 import javax.naming.NameNotFoundException;
 import javax.naming.NamingException;
 import javax.naming.OperationNotSupportedException;
-import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
-import javax.naming.directory.BasicAttribute;
-import javax.naming.directory.BasicAttributes;
 import javax.naming.directory.DirContext;
 import javax.naming.ldap.Control;
 import javax.naming.ldap.LdapContext;
 
 import org.apache.ldap.testsuite.ldaptests.jndi.BaseProtocolTest;
+import org.apache.ldap.testsuite.ldaptests.jndi.util.AttributesFactory;
 
 /**
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev: $
+ * @version $Rev$
  */
 public class TreeDeleteControlTests extends BaseProtocolTest
 {
@@ -65,21 +63,6 @@
         }
     }
 
-    protected Attributes getOrganizationalUnitAttributes(String ou)
-    {
-        Attributes attributes = new BasicAttributes();
-
-        Attribute ocls = new BasicAttribute("objectClass");
-        ocls.add("top");
-        ocls.add("organizationalUnit");
-        attributes.put(ocls);
-
-        attributes.put("ou", ou);
-        attributes.put("description", ou + "is an organizationalUnit");
-
-        return attributes;
-    }
-
     public void testDeleteSubtreeWithControl() throws NamingException
     {
         LdapContext ctx = this.createContext();
@@ -88,7 +71,7 @@
         // Add an entry
         final String ou = "nonLeaf";
         final String rdn = "ou=" + ou;
-        Attributes attributes = this.getOrganizationalUnitAttributes(ou);
+        Attributes attributes = AttributesFactory.createOrganizationalUnitAttributes(ou);
         target.createSubcontext(rdn, attributes);
 
         // Check wether entry is created
@@ -98,7 +81,7 @@
         // Add an entry below this
         final String ouLeaf = "leaf";
         final String rdnLeaf = "ou=" + ouLeaf;
-        attributes = this.getOrganizationalUnitAttributes(ouLeaf);
+        attributes = AttributesFactory.createOrganizationalUnitAttributes(ouLeaf);
         nonLeafRdn.createSubcontext(rdnLeaf, attributes);
 
         // Try to delete subtree Entry

Propchange: directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/delete/TreeDeleteControlTests.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Modified: directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/modifydn/ModifyDnSameAttributeTests.java
URL: http://svn.apache.org/viewcvs/directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/modifydn/ModifyDnSameAttributeTests.java?rev=320745&r1=320744&r2=320745&view=diff
==============================================================================
--- directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/modifydn/ModifyDnSameAttributeTests.java
(original)
+++ directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/modifydn/ModifyDnSameAttributeTests.java
Thu Oct 13 05:07:21 2005
@@ -20,45 +20,17 @@
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
-import javax.naming.directory.BasicAttribute;
-import javax.naming.directory.BasicAttributes;
 import javax.naming.directory.DirContext;
 
 import org.apache.ldap.testsuite.ldaptests.jndi.BaseProtocolTest;
+import org.apache.ldap.testsuite.ldaptests.jndi.util.AttributesFactory;
 
 /**
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev: $
+ * @version $Rev$
  */
 public class ModifyDnSameAttributeTests extends BaseProtocolTest
 {
-
-    protected Attributes getPersonAttributes(String sn, String cn)
-    {
-        Attributes attributes = new BasicAttributes();
-        Attribute attribute = new BasicAttribute("objectClass");
-        attribute.add("top");
-        attribute.add("person");
-        attributes.put(attribute);
-        attributes.put("cn", cn);
-        attributes.put("sn", sn);
-        attributes.put("description", cn + " is a person.");
-
-        return attributes;
-    }
-
-    protected Attributes getOrganizationalUnitAttributes(String ou)
-    {
-        Attributes attributes = new BasicAttributes();
-        Attribute attribute = new BasicAttribute("objectClass");
-        attribute.add("top");
-        attribute.add("organizationalUnit");
-        attributes.put(attribute);
-        attributes.put("ou", ou);
-
-        return attributes;
-    }
-
     /**
      * Modify Rdn of an entry, delete its old rdn value.
      * 
@@ -72,7 +44,7 @@
         // Create an organizational unit, ou value is rdn
         String oldOu = "Judean People's Front";
         String oldRdn = "ou=" + oldOu;
-        Attributes attributes = this.getOrganizationalUnitAttributes(oldOu);
+        Attributes attributes = AttributesFactory.createOrganizationalUnitAttributes(oldOu);
         target.createSubcontext(oldRdn, attributes);
 
         // modify Rdn
@@ -117,7 +89,7 @@
         // Create an organizational unit, ou value is rdn
         String oldOu = "Judean People's Front";
         String oldRdn = "ou=" + oldOu;
-        Attributes attributes = this.getOrganizationalUnitAttributes(oldOu);
+        Attributes attributes = AttributesFactory.createOrganizationalUnitAttributes(oldOu);
         target.createSubcontext(oldRdn, attributes);
 
         // modify Rdn
@@ -164,7 +136,7 @@
         // Create an organizational unit, ou value is rdn
         String oldOu = "Judean People's Front";
         String oldRdn = "ou=" + oldOu;
-        Attributes attributes = this.getOrganizationalUnitAttributes(oldOu);
+        Attributes attributes = AttributesFactory.createOrganizationalUnitAttributes(oldOu);
 
         // add a second ou value
         String alternateOu = "J.P.F.";

Propchange: directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/modifydn/ModifyDnSameAttributeTests.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Modified: directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/search/SearchScopeTest.java
URL: http://svn.apache.org/viewcvs/directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/search/SearchScopeTest.java?rev=320745&r1=320744&r2=320745&view=diff
==============================================================================
--- directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/search/SearchScopeTest.java
(original)
+++ directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/search/SearchScopeTest.java
Thu Oct 13 05:07:21 2005
@@ -24,20 +24,19 @@
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
-import javax.naming.directory.BasicAttribute;
-import javax.naming.directory.BasicAttributes;
 import javax.naming.directory.DirContext;
 import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
 
 import org.apache.ldap.testsuite.ldaptests.jndi.BaseProtocolTest;
+import org.apache.ldap.testsuite.ldaptests.jndi.util.AttributesFactory;
 
 /**
  * Tests for the search operations with JNDI.
  * 
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev: $
+ * @version $Rev$
  */
 public class SearchScopeTest extends BaseProtocolTest
 {
@@ -54,24 +53,12 @@
 
     private static final int ENTRIES_PER_LEVEL = 3;
 
-    protected Attributes getOrganizationalUnitAttributes(String ou)
-    {
-        Attributes attributes = new BasicAttributes();
-        Attribute attribute = new BasicAttribute("objectClass");
-        attribute.add("top");
-        attribute.add("organizationalUnit");
-        attributes.put(attribute);
-        attributes.put("ou", ou);
-
-        return attributes;
-    }
-
     protected void createSubtrees(DirContext target, int depth, int maxDepth, int count)
throws NamingException
     {
         if (depth < maxDepth) {
             for (int i = 0; i < count; ++i) {
                 String ou = "unit_" + depth + "_" + (i);
-                Attributes attr = this.getOrganizationalUnitAttributes(ou);
+                Attributes attr = AttributesFactory.createOrganizationalUnitAttributes(ou);
                 DirContext entry = target.createSubcontext("ou=" + ou, attr);
                 createSubtrees(entry, depth + 1, maxDepth, count);
             }
@@ -86,7 +73,7 @@
         ctx = this.createContext();
         ctx = (DirContext) ctx.lookup(this.getTestContainerRdn());
 
-        DirContext units = ctx.createSubcontext(UNITS_RDN, getOrganizationalUnitAttributes(UNITS_NAME));
+        DirContext units = ctx.createSubcontext(UNITS_RDN, AttributesFactory.createOrganizationalUnitAttributes(UNITS_NAME));
         createSubtrees(units, 0, SUBTREE_LEVEL_DEPTH, ENTRIES_PER_LEVEL);
 
     }

Propchange: directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/search/SearchScopeTest.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Modified: directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/util/AttributesFactory.java
URL: http://svn.apache.org/viewcvs/directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/util/AttributesFactory.java?rev=320745&r1=320744&r2=320745&view=diff
==============================================================================
--- directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/util/AttributesFactory.java
(original)
+++ directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/util/AttributesFactory.java
Thu Oct 13 05:07:21 2005
@@ -31,13 +31,14 @@
 {
     /**
      * Creates the required attributes for a person as defined in RFC 2256. The
-     * result contains an objectClass attibute with values top and person, and
+     * result contains an objectClass attribute with values top and person, and
      * the attributes sn and cn.
      * 
      * @param cn
      *            common name of person
      * @param sn
      *            surname of person
+     * 
      * @return attributes object with the required attributes for a person
      */
     public static final Attributes createPersonAttributes(String cn, String sn)
@@ -51,6 +52,31 @@
 
         person.put("cn", cn);
         person.put("sn", sn);
+
+        return person;
+    }
+
+    /**
+     * Creates the required attributes for an organizational unit as defined in
+     * RFC 2256. The result contains an objectClass attribute with values top
+     * and organizationalUnit, and the mandatory attribute ou.
+     * 
+     * @param ou
+     *            common name of person
+     * 
+     * @return attributes object with the required attributes for an
+     *         organizational unit
+     */
+    public static final Attributes createOrganizationalUnitAttributes(String ou)
+    {
+        Attributes person = new BasicAttributes();
+
+        Attribute ocls = new BasicAttribute("objectClass");
+        ocls.add("top");
+        ocls.add("organizationalUnit");
+        person.put(ocls);
+
+        person.put("ou", ou);
 
         return person;
     }



Mime
View raw message