[java-shib-profile] branch main updated: Fix tests.

Scott Cantor cantor.2 at osu.edu
Wed Feb 15 16:04:19 UTC 2023


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

scantor pushed a commit to branch main
in repository java-shib-profile.

View the commit online:
http://git.shibboleth.net/view/?p=java-shib-profile.git;a=commit;h=440470207d3608f868efeae06a2b334c588d9f1c

The following commit(s) were added to refs/heads/main by this push:
     new 4404702  Fix tests.
4404702 is described below

commit 440470207d3608f868efeae06a2b334c588d9f1c
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Feb 15 11:04:17 2023 -0500

    Fix tests.
---
 shib-profile-api/pom.xml                           | 27 ++++++++++++++++++++++
 .../context/logic/RelyingPartyIdPredicateTest.java |  2 +-
 .../context/logic/ScriptedPredicateTest.java       |  4 ++--
 .../profile/context/logic/inlineBean.xml           | 24 +++++++++++++++++++
 .../logic/relyingPartyIdPredicates.xml             |  0
 .../profile/context/logic/resourceBean.xml         | 14 +++++++++++
 .../net/shibboleth/profile/context/logic/script.js |  5 ++++
 7 files changed, 73 insertions(+), 3 deletions(-)

diff --git a/shib-profile-api/pom.xml b/shib-profile-api/pom.xml
index 385867b..b3c310b 100644
--- a/shib-profile-api/pom.xml
+++ b/shib-profile-api/pom.xml
@@ -90,6 +90,12 @@
         <!-- Runtime Dependencies -->
 
         <!-- Test Dependencies -->
+        <!-- Needed for XMLObject implementations. -->
+        <dependency>
+            <groupId>${opensaml.groupId}</groupId>
+            <artifactId>opensaml-core-impl</artifactId>
+            <scope>test</scope>
+        </dependency>
         <dependency>
             <groupId>${opensaml.groupId}</groupId>
             <artifactId>opensaml-testing</artifactId>
@@ -104,4 +110,25 @@
 
     </dependencies>
 
+    <profiles>
+        <!--
+            Pull in a Javascript engine for testing in Java
+            versions where the JDK doesn't provide one.
+        -->
+        <profile>
+            <id>get-nashorn</id>
+            <activation>
+                <jdk>[15,</jdk>
+            </activation>
+            <dependencies>
+                <dependency>
+                    <groupId>org.openjdk.nashorn</groupId>
+                    <artifactId>nashorn-core</artifactId>
+                    <version>${nashorn.jdk.version}</version>
+                    <scope>test</scope>
+                </dependency>
+            </dependencies>
+        </profile>
+    </profiles>
+
 </project>
diff --git a/shib-profile-api/src/test/java/net/shibboleth/profile/context/logic/RelyingPartyIdPredicateTest.java b/shib-profile-api/src/test/java/net/shibboleth/profile/context/logic/RelyingPartyIdPredicateTest.java
index 2fd05d8..30cd0ef 100644
--- a/shib-profile-api/src/test/java/net/shibboleth/profile/context/logic/RelyingPartyIdPredicateTest.java
+++ b/shib-profile-api/src/test/java/net/shibboleth/profile/context/logic/RelyingPartyIdPredicateTest.java
@@ -80,7 +80,7 @@ public class RelyingPartyIdPredicateTest {
             final SchemaTypeAwareXMLBeanDefinitionReader beanDefinitionReader =
                     new SchemaTypeAwareXMLBeanDefinitionReader(context);
     
-            beanDefinitionReader.loadBeanDefinitions("net/shibboleth/profile/logic/relyingPartyIdPredicates.xml");
+            beanDefinitionReader.loadBeanDefinitions("net/shibboleth/profile/context/logic/relyingPartyIdPredicates.xml");
     
             context.refresh();
             
diff --git a/shib-profile-api/src/test/java/net/shibboleth/profile/context/logic/ScriptedPredicateTest.java b/shib-profile-api/src/test/java/net/shibboleth/profile/context/logic/ScriptedPredicateTest.java
index 1685116..b611075 100644
--- a/shib-profile-api/src/test/java/net/shibboleth/profile/context/logic/ScriptedPredicateTest.java
+++ b/shib-profile-api/src/test/java/net/shibboleth/profile/context/logic/ScriptedPredicateTest.java
@@ -75,7 +75,7 @@ public class ScriptedPredicateTest {
                     new SchemaTypeAwareXMLBeanDefinitionReader(ctx);
 
             beanDefinitionReader.loadBeanDefinitions(new ClassPathResource(
-                    "/net/shibboleth/idp/profile/logic/inlineBean.xml"));
+                    "/net/shibboleth/profile/context/logic/inlineBean.xml"));
 
             ctx.refresh();
             final ScriptedPredicate rule = ctx.getBean(ScriptedPredicate.class);
@@ -93,7 +93,7 @@ public class ScriptedPredicateTest {
                     new SchemaTypeAwareXMLBeanDefinitionReader(ctx);
 
             beanDefinitionReader.loadBeanDefinitions(new ClassPathResource(
-                    "/net/shibboleth/idp/profile/logic/resourceBean.xml"));
+                    "/net/shibboleth/profile/context/logic/resourceBean.xml"));
 
             ctx.refresh();
             final ScriptedPredicate rule = ctx.getBean(ScriptedPredicate.class);
diff --git a/shib-profile-api/src/test/resources/net/shibboleth/profile/context/logic/inlineBean.xml b/shib-profile-api/src/test/resources/net/shibboleth/profile/context/logic/inlineBean.xml
new file mode 100644
index 0000000..d483e6a
--- /dev/null
+++ b/shib-profile-api/src/test/resources/net/shibboleth/profile/context/logic/inlineBean.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+    xmlns:context="http://www.springframework.org/schema/context"
+    xmlns:util="http://www.springframework.org/schema/util" xmlns:p="http://www.springframework.org/schema/p"
+    xmlns:c="http://www.springframework.org/schema/c" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+                           http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
+                           http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
+
+    <bean id="testBean" class="net.shibboleth.profile.context.logic.ScriptedPredicate"
+            factory-method="inlineScript">
+        <constructor-arg>
+            <value>
+<![CDATA[
+       value = true;
+       if (null == profileContext.getSubcontext("net.shibboleth.profile.context.RelyingPartyContext")) {
+         value = false;
+       }
+       value;
+]]>
+            </value>
+        </constructor-arg>
+    </bean>
+</beans>
\ No newline at end of file
diff --git a/shib-profile-api/src/test/resources/net/shibboleth/profile/logic/relyingPartyIdPredicates.xml b/shib-profile-api/src/test/resources/net/shibboleth/profile/context/logic/relyingPartyIdPredicates.xml
similarity index 100%
rename from shib-profile-api/src/test/resources/net/shibboleth/profile/logic/relyingPartyIdPredicates.xml
rename to shib-profile-api/src/test/resources/net/shibboleth/profile/context/logic/relyingPartyIdPredicates.xml
diff --git a/shib-profile-api/src/test/resources/net/shibboleth/profile/context/logic/resourceBean.xml b/shib-profile-api/src/test/resources/net/shibboleth/profile/context/logic/resourceBean.xml
new file mode 100644
index 0000000..0b23b0d
--- /dev/null
+++ b/shib-profile-api/src/test/resources/net/shibboleth/profile/context/logic/resourceBean.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:context="http://www.springframework.org/schema/context"
+	xmlns:util="http://www.springframework.org/schema/util" xmlns:p="http://www.springframework.org/schema/p"
+	xmlns:c="http://www.springframework.org/schema/c" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+                           http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
+                           http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"
+
+	default-init-method="initialize">
+
+	<bean id="testBean" class="net.shibboleth.profile.context.logic.ScriptedPredicate"
+		  factory-method="resourceScript" c:resource="classpath:/net/shibboleth/profile/context/logic/script.js"/>
+</beans>
\ No newline at end of file
diff --git a/shib-profile-api/src/test/resources/net/shibboleth/profile/context/logic/script.js b/shib-profile-api/src/test/resources/net/shibboleth/profile/context/logic/script.js
new file mode 100644
index 0000000..4da3293
--- /dev/null
+++ b/shib-profile-api/src/test/resources/net/shibboleth/profile/context/logic/script.js
@@ -0,0 +1,5 @@
+value = true;
+if (null == profileContext.getSubcontext("net.shibboleth.profile.context.RelyingPartyContext")) {
+  value = false;
+}
+value;

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


More information about the commits mailing list