[java-shib-attribute] 01/02: IDP-2375 Aliased decoded IdPAttributes are lost during subsequent use
Rod Widdowson
rdw at steadingsoftware.com
Sun Apr 20 12:46:03 UTC 2025
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch main
in repository java-shib-attribute.
View the commit online:
http://git.shibboleth.net/view/?p=java-shib-attribute.git;a=commit;h=196014294bec6d1b7f9091c3b528468f9d1e3649
commit 196014294bec6d1b7f9091c3b528468f9d1e3649
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Sun Apr 20 13:44:08 2025 +0100
IDP-2375 Aliased decoded IdPAttributes are lost during subsequent use
https://shibboleth.atlassian.net/browse/IDP-2375
Add commented out test for AttributeContext.
---
.../idp/attribute/AttributeContextTest.java | 42 ++++++++++++++++++++--
1 file changed, 39 insertions(+), 3 deletions(-)
diff --git a/shib-attribute-api/src/test/java/net/shibboleth/idp/attribute/AttributeContextTest.java b/shib-attribute-api/src/test/java/net/shibboleth/idp/attribute/AttributeContextTest.java
index 6c06bad82..b2053b57d 100644
--- a/shib-attribute-api/src/test/java/net/shibboleth/idp/attribute/AttributeContextTest.java
+++ b/shib-attribute-api/src/test/java/net/shibboleth/idp/attribute/AttributeContextTest.java
@@ -14,14 +14,18 @@
package net.shibboleth.idp.attribute;
-import java.util.Arrays;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
-import net.shibboleth.idp.attribute.context.AttributeContext;
-import net.shibboleth.shared.collection.CollectionSupport;
+import java.util.Arrays;
+import java.util.Map;
import org.testng.Assert;
import org.testng.annotations.Test;
+import net.shibboleth.idp.attribute.context.AttributeContext;
+import net.shibboleth.shared.collection.CollectionSupport;
+
/** Unit test for {@link AttributeContext} class. */
public class AttributeContextTest {
@@ -53,5 +57,37 @@ public class AttributeContextTest {
context.setIdPAttributes(CollectionSupport.emptySet());
contextAttributes(context, 0);
}
+ @Test(enabled = false) public void testAttributeMerge() {
+
+ final IdPAttribute attribute1a = new IdPAttribute("attribute1");
+ final IdPAttribute attribute1b = new IdPAttribute("attribute1");
+ final IdPAttribute attribute2a = new IdPAttribute("attribute2");
+ final IdPAttribute attribute2b = new IdPAttribute("attribute2");
+ final IdPAttribute attribute3 = new IdPAttribute("attribute3");
+ final IdPAttributeValue av1 = new StringAttributeValue("av1");
+ final IdPAttributeValue av2 = new StringAttributeValue("av2");
+ final IdPAttributeValue av3 = new StringAttributeValue("av3");
+ final IdPAttributeValue av4 = new StringAttributeValue("av4");
+
+ attribute1a.setValues(CollectionSupport.listOf(av1, av2));
+ attribute1b.setValues(CollectionSupport.listOf(av3, av2));
+
+ attribute2a.setValues(CollectionSupport.listOf(av1, av2));
+ attribute2b.setValues(CollectionSupport.listOf(av3, av4));
+
+ attribute3.setValues(CollectionSupport.listOf(av1, av2, av1));
+
+ final AttributeContext context = new AttributeContext();
+ context.setIdPAttributes(
+ CollectionSupport.listOf(attribute1a, attribute1b, attribute2a, attribute2b, attribute3));
+
+ final Map<String, IdPAttribute> attrs = context.getIdPAttributes();
+
+ assertEquals(attrs.size(), 3);
+ assertNull(attrs.get("atribute4"));
+ assertEquals(attrs.get("attribute1").getValues().size(), 4);
+ assertEquals(attrs.get("attribute2").getValues().size(), 4);
+ assertEquals(attrs.get("attribute3").getValues().size(), 3);
+ }
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list