@Test public void testGroupAttributesMapper() throws Exception { String name = UUID.randomUUID().toString(); String alias = UUID.randomUUID().toString().replace("-", ""); String description = UUID.randomUUID().toString(); String entry = UUID.randomUUID().toString(); String nameAttributeId = UUID.randomUUID().toString(); String aliasAttributeId = UUID.randomUUID().toString(); String descriptionAttributeId = UUID.randomUUID().toString(); String entryAttributeId = UUID.randomUUID().toString(); String memberAttributeId = UUID.randomUUID().toString(); Attribute nameAttribute = new BasicAttribute(nameAttributeId, name); nameAttribute.add(name); Attribute aliasAttribute = new BasicAttribute(aliasAttributeId, alias); aliasAttribute.add(alias); Attribute descriptionAttribute = new BasicAttribute(descriptionAttributeId, description); descriptionAttribute.add(description); Attribute entryAttribute = new BasicAttribute(entryAttributeId, entry); descriptionAttribute.add(entry); Attribute memberAttribute = new BasicAttribute(entryAttributeId, entry); Attributes attributes = new BasicAttributes(); attributes.put(nameAttribute); attributes.put(aliasAttribute); attributes.put(descriptionAttribute); attributes.put(entryAttribute); attributes.put(memberAttribute); Map<String, String> mapping = new HashMap<String, String>(); mapping.put(LdapGroupAttribute.NAME.getName(), nameAttributeId); mapping.put(LdapGroupAttribute.ALIAS.getName(), aliasAttributeId); mapping.put(LdapGroupAttribute.DESCRIPTION.getName(), descriptionAttributeId); mapping.put(LdapGroupAttribute.UID.getName(), entryAttributeId); mapping.put(LdapGroupAttribute.MEMBERSHIP.getName(), memberAttributeId); String groupDummyDN = "uid=group1,ou=test,dc=communote,dc=com"; LdapGroupAttributesMapper mapper = new LdapGroupAttributesMapper(mapping, "TestLdap", false); ExternalGroupVO groupVo = mapper.mapAttributes(groupDummyDN, attributes); Assert.assertNotNull(groupVo); Assert.assertEquals(alias, groupVo.getAlias()); Assert.assertEquals(name, groupVo.getName()); Assert.assertEquals(description, groupVo.getDescription()); Assert.assertEquals(groupDummyDN, groupVo.getAdditionalProperty()); }
public abstract T mapAttributes(String dn, Attributes ldapAttributes) throws LdapAttributeMappingException;
LdapAttributesMapper { public abstract T mapAttributes(String dn, Attributes ldapAttributes) throws LdapAttributeMappingException; }
LdapAttributesMapper { public abstract T mapAttributes(String dn, Attributes ldapAttributes) throws LdapAttributeMappingException; LdapAttributesMapper(Map<String, String> mapping);  LdapAttributesMapper(String mapping); }
LdapAttributesMapper { public abstract T mapAttributes(String dn, Attributes ldapAttributes) throws LdapAttributeMappingException; LdapAttributesMapper(Map<String, String> mapping);  LdapAttributesMapper(String mapping); abstract String[] getBinaryLdapAttributeName(); String getLdapAttributName(String name); String[] getMappedLdapAttributeNames(); String getMappingAsString(); boolean isKenmeiAttributeMapped(String communoteAttributeName); abstract T mapAttributes(String dn, Attributes ldapAttributes); }
LdapAttributesMapper { public abstract T mapAttributes(String dn, Attributes ldapAttributes) throws LdapAttributeMappingException; LdapAttributesMapper(Map<String, String> mapping);  LdapAttributesMapper(String mapping); abstract String[] getBinaryLdapAttributeName(); String getLdapAttributName(String name); String[] getMappedLdapAttributeNames(); String getMappingAsString(); boolean isKenmeiAttributeMapped(String communoteAttributeName); abstract T mapAttributes(String dn, Attributes ldapAttributes);  }