Author: baedke Date: Wed Sep 9 14:09:54 2015 New Revision: 1702022 URL: http://svn.apache.org/r1702022 Log: OAK-3144: Support multivalue user properties for Ldap users
Fixed test case that wrongly assumed a fixed ordering on multi value LDAP attributes (thanks to Konrad Windszus for the patch). Modified: jackrabbit/oak/trunk/oak-auth-ldap/src/test/java/org/apache/jackrabbit/oak/security/authentication/ldap/LdapProviderTest.java Modified: jackrabbit/oak/trunk/oak-auth-ldap/src/test/java/org/apache/jackrabbit/oak/security/authentication/ldap/LdapProviderTest.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-auth-ldap/src/test/java/org/apache/jackrabbit/oak/security/authentication/ldap/LdapProviderTest.java?rev=1702022&r1=1702021&r2=1702022&view=diff ============================================================================== --- jackrabbit/oak/trunk/oak-auth-ldap/src/test/java/org/apache/jackrabbit/oak/security/authentication/ldap/LdapProviderTest.java (original) +++ jackrabbit/oak/trunk/oak-auth-ldap/src/test/java/org/apache/jackrabbit/oak/security/authentication/ldap/LdapProviderTest.java Wed Sep 9 14:09:54 2015 @@ -19,6 +19,7 @@ package org.apache.jackrabbit.oak.securi import java.io.InputStream; import java.util.Arrays; +import java.util.Collection; import java.util.Collections; import java.util.LinkedList; import java.util.List; @@ -172,21 +173,20 @@ public class LdapProviderTest { } @Test - @Ignore("OAK-3144") public void testGetUserProperties() throws Exception { ExternalUser user = idp.getUser(TEST_USER1_UID); assertNotNull("User 1 must exist", user); - List<String> multiValuePropValue = Arrays.asList(new String[] { "top", "person", "organizationalPerson", "inetOrgPerson"}); - Map<String, Object> properties = new ImmutableMap.Builder<String, Object>() - .put("uid", "hhornblo") - .put("mail", "hhorn...@royalnavy.mod.uk") - .put("givenname", "Horatio") - .put("description", "Capt. Horatio Hornblower, R.N") - .put("sn", "Hornblower") - .put("cn", "Horatio Hornblower") - .put("objectclass", multiValuePropValue) - .build(); - assertThat((Map<String, Object>) user.getProperties(), Matchers.<Map<String, Object>>equalTo(properties)); + + Map<String, ?> properties = user.getProperties(); + assertThat((Map<String, Collection<String>>) properties, + Matchers.<String, Collection<String>>hasEntry( + Matchers.equalTo("objectclass"), + Matchers.containsInAnyOrder( "inetOrgPerson", "top", "person", "organizationalPerson"))); + assertThat(properties, Matchers.<String, Object>hasEntry("uid", "hhornblo")); + assertThat(properties, Matchers.<String, Object>hasEntry("mail", "hhorn...@royalnavy.mod.uk")); + assertThat(properties, Matchers.<String, Object>hasEntry("givenname", "Horatio")); + assertThat(properties, Matchers.<String, Object>hasEntry("description", "Capt. Horatio Hornblower, R.N")); + assertThat(properties, Matchers.<String, Object>hasEntry("sn", "Hornblower")); } @Test