[java-opensaml] branch main updated: Eliminate unneeded beans in tests and move to our context builder.
Scott Cantor
cantor.2 at osu.edu
Wed Jun 14 13:48:03 UTC 2023
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch main
in repository java-opensaml.
View the commit online:
http://git.shibboleth.net/view/?p=java-opensaml.git;a=commit;h=7312fd60b4280234e5cd0c3387a51f2f8ab885e5
The following commit(s) were added to refs/heads/main by this push:
new 7312fd60b Eliminate unneeded beans in tests and move to our context builder.
7312fd60b is described below
commit 7312fd60b4280234e5cd0c3387a51f2f8ab885e5
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Jun 14 09:48:00 2023 -0400
Eliminate unneeded beans in tests and move to our context builder.
---
.../BasicX509CredentialFactoryBeanTest.java | 16 ++++-----
.../spring/trust/StaticPKIXFactoryBeanTest.java | 40 ++++++++--------------
.../org/opensaml/spring/credential/bean.xml | 9 -----
.../trust/static-pkix-factory-custom-success.xml | 9 -----
.../spring/trust/static-pkix-factory-defaults.xml | 9 -----
5 files changed, 20 insertions(+), 63 deletions(-)
diff --git a/opensaml-spring/src/test/java/org/opensaml/spring/credential/BasicX509CredentialFactoryBeanTest.java b/opensaml-spring/src/test/java/org/opensaml/spring/credential/BasicX509CredentialFactoryBeanTest.java
index 55ee4d978..f52357425 100644
--- a/opensaml-spring/src/test/java/org/opensaml/spring/credential/BasicX509CredentialFactoryBeanTest.java
+++ b/opensaml-spring/src/test/java/org/opensaml/spring/credential/BasicX509CredentialFactoryBeanTest.java
@@ -22,9 +22,9 @@ import org.springframework.context.support.GenericApplicationContext;
import org.testng.Assert;
import org.testng.annotations.Test;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.logic.Constraint;
-import net.shibboleth.shared.spring.context.FilesystemGenericApplicationContext;
-import net.shibboleth.shared.spring.custom.SchemaTypeAwareXMLBeanDefinitionReader;
+import net.shibboleth.shared.spring.util.ApplicationContextBuilder;
/**
* Unit test for {@link BasicX509CredentialFactoryBean}.
@@ -35,14 +35,10 @@ public class BasicX509CredentialFactoryBeanTest {
* Test.
*/
@Test public void bean() {
- final GenericApplicationContext context = new FilesystemGenericApplicationContext();
- context.setDisplayName("ApplicationContext: X509Credential");
- final SchemaTypeAwareXMLBeanDefinitionReader beanDefinitionReader =
- new SchemaTypeAwareXMLBeanDefinitionReader(context);
-
- beanDefinitionReader.loadBeanDefinitions("org/opensaml/spring/credential/bean.xml");
-
- context.refresh();
+ final ApplicationContextBuilder contextBuilder = new ApplicationContextBuilder();
+ contextBuilder.setUnresolvedServiceConfigurations(CollectionSupport.singletonList("org/opensaml/spring/credential/bean.xml"));
+
+ final GenericApplicationContext context = contextBuilder.build();
final BasicX509Credential cred1 = context.getBean("Credential", BasicX509Credential.class);
diff --git a/opensaml-spring/src/test/java/org/opensaml/spring/trust/StaticPKIXFactoryBeanTest.java b/opensaml-spring/src/test/java/org/opensaml/spring/trust/StaticPKIXFactoryBeanTest.java
index 102868bf5..fe591a4cd 100644
--- a/opensaml-spring/src/test/java/org/opensaml/spring/trust/StaticPKIXFactoryBeanTest.java
+++ b/opensaml-spring/src/test/java/org/opensaml/spring/trust/StaticPKIXFactoryBeanTest.java
@@ -37,9 +37,9 @@ import org.springframework.context.support.GenericApplicationContext;
import org.testng.Assert;
import org.testng.annotations.Test;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.component.AbstractInitializableComponent;
-import net.shibboleth.shared.spring.context.FilesystemGenericApplicationContext;
-import net.shibboleth.shared.spring.custom.SchemaTypeAwareXMLBeanDefinitionReader;
+import net.shibboleth.shared.spring.util.ApplicationContextBuilder;
/**
* Unit test for {@link StaticPKIXFactoryBean}.
@@ -49,14 +49,10 @@ public class StaticPKIXFactoryBeanTest {
@Test
public void defaults() {
- final GenericApplicationContext context = new FilesystemGenericApplicationContext();
- context.setDisplayName("ApplicationContext: X509Credential");
- final SchemaTypeAwareXMLBeanDefinitionReader beanDefinitionReader =
- new SchemaTypeAwareXMLBeanDefinitionReader(context);
-
- beanDefinitionReader.loadBeanDefinitions("org/opensaml/spring/trust/static-pkix-factory-defaults.xml");
-
- context.refresh();
+ final ApplicationContextBuilder contextBuilder = new ApplicationContextBuilder();
+ contextBuilder.setUnresolvedServiceConfigurations(CollectionSupport.singletonList("org/opensaml/spring/trust/static-pkix-factory-defaults.xml"));
+
+ final GenericApplicationContext context = contextBuilder.build();
final PKIXX509CredentialTrustEngine trustEngine = context.getBean("StaticPKIXX509CredentialTrustEngine",
PKIXX509CredentialTrustEngine.class);
@@ -72,14 +68,10 @@ public class StaticPKIXFactoryBeanTest {
@Test
public void customPropertiesSuccess() {
- final GenericApplicationContext context = new FilesystemGenericApplicationContext();
- context.setDisplayName("ApplicationContext: X509Credential");
- final SchemaTypeAwareXMLBeanDefinitionReader beanDefinitionReader =
- new SchemaTypeAwareXMLBeanDefinitionReader(context);
-
- beanDefinitionReader.loadBeanDefinitions("org/opensaml/spring/trust/static-pkix-factory-custom-success.xml");
-
- context.refresh();
+ final ApplicationContextBuilder contextBuilder = new ApplicationContextBuilder();
+ contextBuilder.setUnresolvedServiceConfigurations(CollectionSupport.singletonList("org/opensaml/spring/trust/static-pkix-factory-custom-success.xml"));
+
+ final GenericApplicationContext context = contextBuilder.build();
final PKIXX509CredentialTrustEngine trustEngine = context.getBean("StaticPKIXX509CredentialTrustEngine",
PKIXX509CredentialTrustEngine.class);
@@ -95,14 +87,10 @@ public class StaticPKIXFactoryBeanTest {
@Test(expectedExceptions=FatalBeanException.class)
public void customPropertiesFailsValidation() {
- final GenericApplicationContext context = new FilesystemGenericApplicationContext();
- context.setDisplayName("ApplicationContext: X509Credential");
- final SchemaTypeAwareXMLBeanDefinitionReader beanDefinitionReader =
- new SchemaTypeAwareXMLBeanDefinitionReader(context);
-
- beanDefinitionReader.loadBeanDefinitions("org/opensaml/spring/trust/static-pkix-factory-custom-failsValidation.xml");
-
- context.refresh();
+ final ApplicationContextBuilder contextBuilder = new ApplicationContextBuilder();
+ contextBuilder.setUnresolvedServiceConfigurations(CollectionSupport.singletonList("org/opensaml/spring/trust/static-pkix-factory-custom-failsValidation.xml"));
+
+ contextBuilder.build();
}
diff --git a/opensaml-spring/src/test/resources/org/opensaml/spring/credential/bean.xml b/opensaml-spring/src/test/resources/org/opensaml/spring/credential/bean.xml
index cd1315952..9a2d0d2d2 100644
--- a/opensaml-spring/src/test/resources/org/opensaml/spring/credential/bean.xml
+++ b/opensaml-spring/src/test/resources/org/opensaml/spring/credential/bean.xml
@@ -12,15 +12,6 @@
default-init-method="initialize"
default-destroy-method="destroy">
- <!-- This bean MUST be called "conversionService" to work properly. -->
- <bean id="conversionService" class="org.springframework.context.support.ConversionServiceFactoryBean">
- <property name="converters">
- <set>
- <bean class="net.shibboleth.shared.spring.config.StringToResourceConverter" />
- </set>
- </property>
- </bean>
-
<bean id="Credential"
class="org.opensaml.spring.credential.BasicX509CredentialFactoryBean"
p:privateKeyResource="org/opensaml/spring/credential/idp-signing.key"
diff --git a/opensaml-spring/src/test/resources/org/opensaml/spring/trust/static-pkix-factory-custom-success.xml b/opensaml-spring/src/test/resources/org/opensaml/spring/trust/static-pkix-factory-custom-success.xml
index dd6969aa7..22e93f04c 100644
--- a/opensaml-spring/src/test/resources/org/opensaml/spring/trust/static-pkix-factory-custom-success.xml
+++ b/opensaml-spring/src/test/resources/org/opensaml/spring/trust/static-pkix-factory-custom-success.xml
@@ -12,15 +12,6 @@
default-init-method="initialize"
default-destroy-method="destroy">
- <!-- This bean MUST be called "conversionService" to work properly. -->
- <bean id="conversionService" class="org.springframework.context.support.ConversionServiceFactoryBean">
- <property name="converters">
- <set>
- <bean class="net.shibboleth.shared.spring.config.StringToResourceConverter" />
- </set>
- </property>
- </bean>
-
<bean id="StaticPKIXX509CredentialTrustEngine"
class="org.opensaml.spring.trust.StaticPKIXFactoryBean">
<property name="certificates">
diff --git a/opensaml-spring/src/test/resources/org/opensaml/spring/trust/static-pkix-factory-defaults.xml b/opensaml-spring/src/test/resources/org/opensaml/spring/trust/static-pkix-factory-defaults.xml
index 35665472b..cf186faec 100644
--- a/opensaml-spring/src/test/resources/org/opensaml/spring/trust/static-pkix-factory-defaults.xml
+++ b/opensaml-spring/src/test/resources/org/opensaml/spring/trust/static-pkix-factory-defaults.xml
@@ -12,15 +12,6 @@
default-init-method="initialize"
default-destroy-method="destroy">
- <!-- This bean MUST be called "conversionService" to work properly. -->
- <bean id="conversionService" class="org.springframework.context.support.ConversionServiceFactoryBean">
- <property name="converters">
- <set>
- <bean class="net.shibboleth.shared.spring.config.StringToResourceConverter" />
- </set>
- </property>
- </bean>
-
<bean id="StaticPKIXX509CredentialTrustEngine"
class="org.opensaml.spring.trust.StaticPKIXFactoryBean">
<property name="certificates">
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list