You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by sz...@apache.org on 2005/10/09 04:29:58 UTC

svn commit: r307343 - /directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/util/AttributesFactory.java

Author: szoerner
Date: Sat Oct  8 19:29:54 2005
New Revision: 307343

URL: http://svn.apache.org/viewcvs?rev=307343&view=rev
Log:
Initial version, just includes person object class (more to come).

Added:
    directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/util/AttributesFactory.java   (with props)

Added: 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=307343&view=auto
==============================================================================
--- directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/util/AttributesFactory.java (added)
+++ directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/util/AttributesFactory.java Sat Oct  8 19:29:54 2005
@@ -0,0 +1,58 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.ldap.testsuite.ldaptests.jndi.util;
+
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttribute;
+import javax.naming.directory.BasicAttributes;
+
+/**
+ * Convenience methods to create attributes for entries of common objectclasses.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class AttributesFactory
+{
+    /**
+     * Creates the required attributes for a person as defined in RFC 2256. The
+     * result contains an objectClass attibute 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)
+    {
+        Attributes person = new BasicAttributes();
+
+        Attribute ocls = new BasicAttribute("objectClass");
+        ocls.add("top");
+        ocls.add("person");
+        person.put(ocls);
+
+        person.put("cn", cn);
+        person.put("sn", sn);
+
+        return person;
+    }
+
+}

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