1
0
mirror of synced 2026-08-05 17:57:15 +00:00

SEC-1131: Applied patch for portlet upgrade

This commit is contained in:
Luke Taylor
2009-04-12 05:52:20 +00:00
parent 365ae3936e
commit 7c4d54f356
12 changed files with 1006 additions and 952 deletions
@@ -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);
}
@@ -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));
}
}