From: Mathieu Baudier Date: Sat, 14 Jan 2017 13:47:58 +0000 (+0100) Subject: Remove LdifName X-Git-Tag: argeo-commons-2.1.56~7 X-Git-Url: https://git.argeo.org/?a=commitdiff_plain;h=d907c5d302b14b495fa8530889488c604fcc63ec;p=lgpl%2Fargeo-commons.git Remove LdifName --- diff --git a/org.argeo.enterprise/ext/test/org/argeo/osgi/useradmin/LdifParserTest.java b/org.argeo.enterprise/ext/test/org/argeo/osgi/useradmin/LdifParserTest.java index b732a98ac..75bfe11ff 100644 --- a/org.argeo.enterprise/ext/test/org/argeo/osgi/useradmin/LdifParserTest.java +++ b/org.argeo.enterprise/ext/test/org/argeo/osgi/useradmin/LdifParserTest.java @@ -10,10 +10,11 @@ import javax.naming.directory.Attribute; import javax.naming.directory.Attributes; import javax.naming.ldap.LdapName; -import junit.framework.TestCase; - +import org.argeo.naming.LdapAttrs; import org.argeo.naming.LdifParser; +import junit.framework.TestCase; + public class LdifParserTest extends TestCase implements BasicTestConstants { public void testBasicLdif() throws Exception { LdifParser ldifParser = new LdifParser(); @@ -23,9 +24,9 @@ public class LdifParserTest extends TestCase implements BasicTestConstants { Attributes rootAttributes = res.get(rootDn); assertNotNull(rootAttributes); assertEquals("Superuser", - rootAttributes.get(LdifName.description.name()).get()); + rootAttributes.get(LdapAttrs.description.name()).get()); byte[] rawPwEntry = (byte[]) rootAttributes.get( - LdifName.userPassword.name()).get(); + LdapAttrs.userPassword.name()).get(); assertEquals("{SHA}ieSV55Qc+eQOaYDRSha/AjzNTJE=", new String(rawPwEntry)); byte[] hashedPassword = DigestUtils.sha1("demo".getBytes()); @@ -35,7 +36,7 @@ public class LdifParserTest extends TestCase implements BasicTestConstants { LdapName adminDn = new LdapName(ADMIN_GROUP_DN); Attributes adminAttributes = res.get(adminDn); assertNotNull(adminAttributes); - Attribute memberAttribute = adminAttributes.get(LdifName.member.name()); + Attribute memberAttribute = adminAttributes.get(LdapAttrs.member.name()); assertNotNull(memberAttribute); NamingEnumeration members = memberAttribute.getAll(); List users = new ArrayList(); diff --git a/org.argeo.enterprise/ext/test/org/argeo/osgi/useradmin/LdifUserAdminTest.java b/org.argeo.enterprise/ext/test/org/argeo/osgi/useradmin/LdifUserAdminTest.java index 4cfb58b77..d930a4981 100644 --- a/org.argeo.enterprise/ext/test/org/argeo/osgi/useradmin/LdifUserAdminTest.java +++ b/org.argeo.enterprise/ext/test/org/argeo/osgi/useradmin/LdifUserAdminTest.java @@ -20,6 +20,7 @@ import java.util.UUID; import javax.transaction.TransactionManager; +import org.argeo.naming.LdapAttrs; import org.osgi.service.useradmin.Authorization; import org.osgi.service.useradmin.Group; import org.osgi.service.useradmin.Role; @@ -100,8 +101,8 @@ public class LdifUserAdminTest extends TestCase implements BasicTestConstants { // credentials byte[] hashedPassword = ("{SHA}" + Base64.getEncoder().encodeToString(DigestUtils.sha1("demo".getBytes()))) .getBytes(); - assertTrue(rootUser.hasCredential(LdifName.userPassword.name(), hashedPassword)); - assertTrue(demoUser.hasCredential(LdifName.userPassword.name(), hashedPassword)); + assertTrue(rootUser.hasCredential(LdapAttrs.userPassword.name(), hashedPassword)); + assertTrue(demoUser.hasCredential(LdapAttrs.userPassword.name(), hashedPassword)); // search Role[] search = userAdmin.getRoles(null); diff --git a/org.argeo.enterprise/src/org/argeo/osgi/useradmin/LdifName.java b/org.argeo.enterprise/src/org/argeo/osgi/useradmin/LdifName.java deleted file mode 100644 index 9beac3a51..000000000 --- a/org.argeo.enterprise/src/org/argeo/osgi/useradmin/LdifName.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.argeo.osgi.useradmin; - -import javax.naming.ldap.LdapName; - -import org.argeo.naming.LdapAttrs; -import org.argeo.naming.LdapObjs; - -/** - * Standard LDAP attributes and object classes leveraged in this implementation - * of user admin. Named {@link LdifName} in order not to collide with - * {@link LdapName}. - * - * @deprecated Use {@link LdapAttrs} and {@link LdapObjs} instead. - */ -@Deprecated -public enum LdifName { - // Attributes - dn, dc, cn, sn, uid, mail, displayName, objectClass, userPassword, givenName, description, member, - // Object classes - inetOrgPerson, organizationalPerson, person, groupOfNames, groupOfUniqueNames, top; - - public final static String PREFIX = "ldap:"; - - /** For use as XML name. */ - public String property() { - return PREFIX + name(); - } - - public static LdifName local(String property) { - return LdifName.valueOf(property.substring(PREFIX.length())); - } -}