SEC-1131: Applied patch for portlet upgrade
This commit is contained in:
+4
-4
@@ -1,6 +1,5 @@
|
||||
package org.springframework.security.authoritymapping;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
@@ -25,9 +24,10 @@ public class SimpleMappableAttributesRetriever implements MappableAttributesRetr
|
||||
return mappableAttributes;
|
||||
}
|
||||
|
||||
public void setMappableAttributes(String[] aMappableRoles) {
|
||||
mappableAttributes = new HashSet<String>(aMappableRoles.length);
|
||||
mappableAttributes.addAll(Arrays.asList(aMappableRoles));
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setMappableAttributes(Set aMappableRoles) {
|
||||
mappableAttributes = new HashSet<String>();
|
||||
mappableAttributes.addAll(aMappableRoles);
|
||||
mappableAttributes = Collections.unmodifiableSet(mappableAttributes);
|
||||
}
|
||||
|
||||
|
||||
+27
-26
@@ -1,26 +1,27 @@
|
||||
package org.springframework.security.authoritymapping;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TSARDD
|
||||
* @since 18-okt-2007
|
||||
*/
|
||||
public class SimpleMappableRolesRetrieverTests extends TestCase {
|
||||
|
||||
public final void testGetSetMappableRoles() {
|
||||
String[] roles = new String[] { "Role1", "Role2" };
|
||||
SimpleMappableAttributesRetriever r = new SimpleMappableAttributesRetriever();
|
||||
r.setMappableAttributes(roles);
|
||||
Set<String> result = r.getMappableAttributes();
|
||||
Collection<String> rolesColl = Arrays.asList(roles);
|
||||
assertTrue("Role collections do not match; result: " + result + ", expected: " + rolesColl, rolesColl.containsAll(result)
|
||||
&& result.containsAll(rolesColl));
|
||||
}
|
||||
|
||||
}
|
||||
package org.springframework.security.authoritymapping;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TSARDD
|
||||
* @since 18-okt-2007
|
||||
*/
|
||||
public class SimpleMappableRolesRetrieverTests extends TestCase {
|
||||
|
||||
public final void testGetSetMappableRoles() {
|
||||
Set<String> roles = StringUtils.commaDelimitedListToSet("Role1,Role2");
|
||||
SimpleMappableAttributesRetriever r = new SimpleMappableAttributesRetriever();
|
||||
r.setMappableAttributes(roles);
|
||||
Set<String> result = r.getMappableAttributes();
|
||||
assertTrue("Role collections do not match; result: " + result + ", expected: " + roles, roles.containsAll(result)
|
||||
&& result.containsAll(roles));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user