[java-shib-profile] branch main updated: Switch tests over to our ApplicationContextBuilder.

Scott Cantor cantor.2 at osu.edu
Thu Jun 15 18:39:06 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=ff8035c5fc2d26b7dfcab83c838e89a95e11f484

The following commit(s) were added to refs/heads/main by this push:
     new ff8035c  Switch tests over to our ApplicationContextBuilder.
ff8035c is described below

commit ff8035c5fc2d26b7dfcab83c838e89a95e11f484
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Jun 15 14:39:03 2023 -0400

    Switch tests over to our ApplicationContextBuilder.
---
 .../context/logic/ScriptedPredicateTest.java       | 30 +++++++++-------------
 1 file changed, 12 insertions(+), 18 deletions(-)

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 83c721f..d05a134 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
@@ -20,11 +20,11 @@ package net.shibboleth.profile.context.logic;
 import javax.script.ScriptException;
 
 import net.shibboleth.profile.context.RelyingPartyContext;
-import net.shibboleth.shared.spring.custom.SchemaTypeAwareXMLBeanDefinitionReader;
+import net.shibboleth.shared.collection.CollectionSupport;
+import net.shibboleth.shared.spring.util.ApplicationContextBuilder;
 
 import org.opensaml.profile.context.ProfileRequestContext;
 import org.springframework.context.support.GenericApplicationContext;
-import org.springframework.core.io.ClassPathResource;
 import org.testng.Assert;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
@@ -70,14 +70,11 @@ public class ScriptedPredicateTest {
     }
     @Test public void inlineBean() throws ScriptException {
 
-        try (final GenericApplicationContext ctx = new GenericApplicationContext()) {
-            final SchemaTypeAwareXMLBeanDefinitionReader beanDefinitionReader =
-                    new SchemaTypeAwareXMLBeanDefinitionReader(ctx);
+        final ApplicationContextBuilder builder = new ApplicationContextBuilder();
+        builder.setUnresolvedServiceConfigurations(
+                CollectionSupport.singletonList("/net/shibboleth/profile/context/logic/inlineBean.xml"));
 
-            beanDefinitionReader.loadBeanDefinitions(new ClassPathResource(
-                    "/net/shibboleth/profile/context/logic/inlineBean.xml"));
-
-            ctx.refresh();
+        try (final GenericApplicationContext ctx = builder.build()) {
             final ScriptedPredicate rule = ctx.getBean(ScriptedPredicate.class);
 
             Assert.assertTrue(rule.test(withChild));
@@ -88,14 +85,11 @@ public class ScriptedPredicateTest {
 
     @Test public void resourceBean() throws ScriptException {
 
-        try (final GenericApplicationContext ctx = new GenericApplicationContext()) {
-            final SchemaTypeAwareXMLBeanDefinitionReader beanDefinitionReader =
-                    new SchemaTypeAwareXMLBeanDefinitionReader(ctx);
-
-            beanDefinitionReader.loadBeanDefinitions(new ClassPathResource(
-                    "/net/shibboleth/profile/context/logic/resourceBean.xml"));
-
-            ctx.refresh();
+        final ApplicationContextBuilder builder = new ApplicationContextBuilder();
+        builder.setUnresolvedServiceConfigurations(
+                CollectionSupport.singletonList("/net/shibboleth/profile/context/logic/resourceBean.xml"));
+        
+        try (final GenericApplicationContext ctx = builder.build()) {
             final ScriptedPredicate rule = ctx.getBean(ScriptedPredicate.class);
 
             Assert.assertTrue(rule.test(withChild));
@@ -104,4 +98,4 @@ public class ScriptedPredicateTest {
         }
     }
 
-}
+}
\ No newline at end of file

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


More information about the commits mailing list