[java-identity-provider] 01/04: IDP-1593 Tests for weird ServiceName/ServiceDescription elements

Rod Widdowson rdw at steadingsoftware.com
Sun Apr 19 10:54:21 EDT 2020


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch master
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=84adada68ac7ccd1dd7e7e0cc7504014dfc88869

commit 84adada68ac7ccd1dd7e7e0cc7504014dfc88869
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Sun Apr 19 14:40:10 2020 +0100

    IDP-1593 Tests for weird ServiceName/ServiceDescription elements
    
    https://issues.shibboleth.net/jira/browse/IDP-1593
---
 .../shibboleth/idp/saml/metadata/ACSUIInfoTest.java   | 19 +++++++++++++++----
 .../shibboleth/idp/saml/metadata/IdPUIInfoTest.java   |  1 +
 .../idp/saml/metadata/OrganizationUIInfoTest.java     |  1 +
 .../idp/saml/metadata/ScopesContainerTest.java        |  1 +
 idp-saml-api/src/test/resources/ACSUIInfoBad.xml      | 10 ++++++++++
 5 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/metadata/ACSUIInfoTest.java b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/metadata/ACSUIInfoTest.java
index 79a99f9..a8d3502 100644
--- a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/metadata/ACSUIInfoTest.java
+++ b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/metadata/ACSUIInfoTest.java
@@ -18,6 +18,7 @@
 package net.shibboleth.idp.saml.metadata;
 
 import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
 
 import java.util.Locale;
 
@@ -31,16 +32,26 @@ import net.shibboleth.utilities.java.support.xml.XMLParserException;
 /**
  * test for the {@link ACSUIInfo}.
  */
+ at SuppressWarnings("javadoc")
 public class ACSUIInfoTest extends XMLObjectBaseTestCase {
-    
+
     @Test public void test() throws XMLParserException, UnmarshallingException {
-    
+
         final AttributeConsumingService acs = unmarshallElement("/ACSUIInfo.xml", true);
         final ACSUIInfo info = new ACSUIInfo(acs); 
-        
+
         assertEquals(info.getServiceNames().size(), 2);
         assertEquals(info.getServiceNames().get(Locale.forLanguageTag("en")), "ServiceName");
+        assertEquals(info.getServiceDescriptions().size(), 1);        
+    }
+
+    @Test public void testBad() throws XMLParserException, UnmarshallingException {
+
+        final AttributeConsumingService acs = unmarshallElement("/ACSUIInfoBad.xml", true);
+        final ACSUIInfo info = new ACSUIInfo(acs); 
+
+        assertTrue(info.getServiceNames().isEmpty());
         assertEquals(info.getServiceDescriptions().size(), 1);
-        
+
     }
 }
diff --git a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/metadata/IdPUIInfoTest.java b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/metadata/IdPUIInfoTest.java
index 760fa5d..e888be3 100644
--- a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/metadata/IdPUIInfoTest.java
+++ b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/metadata/IdPUIInfoTest.java
@@ -29,6 +29,7 @@ import org.testng.annotations.Test;
 /**
  * test for the {@link IdPUIInfo}.
  */
+ at SuppressWarnings("javadoc")
 public class IdPUIInfoTest extends XMLObjectBaseTestCase {
     
     @Test public void test() {
diff --git a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/metadata/OrganizationUIInfoTest.java b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/metadata/OrganizationUIInfoTest.java
index 111217b..e4ba13e 100644
--- a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/metadata/OrganizationUIInfoTest.java
+++ b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/metadata/OrganizationUIInfoTest.java
@@ -31,6 +31,7 @@ import net.shibboleth.utilities.java.support.xml.XMLParserException;
 /**
  * test for the {@link OrganizationUIInfo}.
  */
+ at SuppressWarnings("javadoc")
 public class OrganizationUIInfoTest extends XMLObjectBaseTestCase {
     
     @Test public void test() throws XMLParserException, UnmarshallingException {
diff --git a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/metadata/ScopesContainerTest.java b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/metadata/ScopesContainerTest.java
index 07bd0d4..88ef9f6 100644
--- a/idp-saml-api/src/test/java/net/shibboleth/idp/saml/metadata/ScopesContainerTest.java
+++ b/idp-saml-api/src/test/java/net/shibboleth/idp/saml/metadata/ScopesContainerTest.java
@@ -28,6 +28,7 @@ import org.testng.annotations.Test;
 /**
  * Tests for the {@link ScopesContainer}.
  */
+ at SuppressWarnings("javadoc")
 public class ScopesContainerTest {
 
     @Test public void empty() {
diff --git a/idp-saml-api/src/test/resources/ACSUIInfoBad.xml b/idp-saml-api/src/test/resources/ACSUIInfoBad.xml
new file mode 100644
index 0000000..cff4129
--- /dev/null
+++ b/idp-saml-api/src/test/resources/ACSUIInfoBad.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<AttributeConsumingService xmlns="urn:oasis:names:tc:SAML:2.0:metadata" index="1"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="urn:oasis:names:tc:SAML:2.0:metadata http://docs.oasis-open.org/security/saml/v2.0/saml-schema-metadata-2.0.xsd">
+    <ServiceName xml:lang="fr"></ServiceName>
+    <ServiceName xml:lang="">ServiceName</ServiceName>
+    <ServiceDescription >ServiceDesc</ServiceDescription>
+    <ServiceDescription xml:lang="de">ServiceDesc</ServiceDescription>
+    <RequestedAttribute Name="a"></RequestedAttribute>
+</AttributeConsumingService>

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list