[java-opensaml] branch master updated: Replace deprecated Spring context builder.
Scott Cantor
cantor.2 at osu.edu
Mon Mar 20 13:01:48 EDT 2017
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch master
in repository java-opensaml.
View the commit online:
http://git.shibboleth.net/view/?p=java-opensaml.git;a=commit;h=3c52aa6c7421a64215de5062381d1cc825b03721
The following commit(s) were added to refs/heads/master by this push:
new 3c52aa6 Replace deprecated Spring context builder.
3c52aa6 is described below
commit 3c52aa6c7421a64215de5062381d1cc825b03721
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Mar 20 13:01:46 2017 -0400
Replace deprecated Spring context builder.
---
.../opensaml/profile/logic/IPRangePredicateTest.java | 17 +++++++----------
.../opensaml/storage/impl/JPAStorageServiceTest.java | 18 ++++++++----------
2 files changed, 15 insertions(+), 20 deletions(-)
diff --git a/opensaml-profile-api/src/test/java/org/opensaml/profile/logic/IPRangePredicateTest.java b/opensaml-profile-api/src/test/java/org/opensaml/profile/logic/IPRangePredicateTest.java
index 1c733fc..68f2864 100644
--- a/opensaml-profile-api/src/test/java/org/opensaml/profile/logic/IPRangePredicateTest.java
+++ b/opensaml-profile-api/src/test/java/org/opensaml/profile/logic/IPRangePredicateTest.java
@@ -17,18 +17,13 @@
package org.opensaml.profile.logic;
-import java.util.Collections;
import java.util.Map;
import net.shibboleth.ext.spring.config.IdentifiableBeanPostProcessor;
-import net.shibboleth.ext.spring.util.SpringSupport;
+import net.shibboleth.ext.spring.util.ApplicationContextBuilder;
-import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
-import org.springframework.beans.factory.config.BeanPostProcessor;
-import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.Resource;
import org.testng.Assert;
import org.testng.annotations.Test;
@@ -38,10 +33,12 @@ import org.testng.annotations.Test;
public class IPRangePredicateTest {
@Test public void testRanges() {
- final GenericApplicationContext ctx = SpringSupport.newContext("IpRange", Collections.singletonList((Resource)new ClassPathResource("iprange.xml")),
- Collections.<BeanFactoryPostProcessor> emptyList(),
- Collections.<BeanPostProcessor> singletonList(new IdentifiableBeanPostProcessor()),
- Collections.<ApplicationContextInitializer> emptyList(), null);
+
+ final GenericApplicationContext ctx = new ApplicationContextBuilder()
+ .setName("IpRange")
+ .setServiceConfiguration(new ClassPathResource("iprange.xml"))
+ .setBeanPostProcessor(new IdentifiableBeanPostProcessor())
+ .build();
final Map<String, IPRangePredicate> bar = ctx.getBeansOfType(IPRangePredicate.class);
diff --git a/opensaml-storage-impl/src/test/java/org/opensaml/storage/impl/JPAStorageServiceTest.java b/opensaml-storage-impl/src/test/java/org/opensaml/storage/impl/JPAStorageServiceTest.java
index 029c09a..363ad93 100644
--- a/opensaml-storage-impl/src/test/java/org/opensaml/storage/impl/JPAStorageServiceTest.java
+++ b/opensaml-storage-impl/src/test/java/org/opensaml/storage/impl/JPAStorageServiceTest.java
@@ -19,23 +19,19 @@ package org.opensaml.storage.impl;
import java.io.IOException;
import java.security.SecureRandom;
-import java.util.Collections;
import java.util.List;
import java.util.UUID;
import javax.annotation.Nonnull;
import javax.persistence.EntityManagerFactory;
-import net.shibboleth.ext.spring.util.SpringSupport;
+import net.shibboleth.ext.spring.util.ApplicationContextBuilder;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
import org.opensaml.storage.StorageRecord;
import org.opensaml.storage.StorageService;
import org.opensaml.storage.StorageServiceTest;
import org.springframework.beans.factory.FactoryBean;
-import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
-import org.springframework.beans.factory.config.BeanPostProcessor;
-import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
@@ -81,11 +77,13 @@ public class JPAStorageServiceTest extends StorageServiceTest {
private EntityManagerFactory createEntityManagerFactory() throws ComponentInitializationException
{
final Resource resource = new ClassPathResource("/org/opensaml/storage/impl/jpa-spring-context.xml");
- final GenericApplicationContext context = SpringSupport.newContext("JPAStorageService",
- Collections.singletonList(resource), Collections.<BeanFactoryPostProcessor>emptyList(),
- Collections.<BeanPostProcessor>emptyList(), Collections.<ApplicationContextInitializer>emptyList(),
- null);
- FactoryBean<EntityManagerFactory> factoryBean = context.getBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.class);
+ final GenericApplicationContext context =
+ new ApplicationContextBuilder()
+ .setName("JPAStorageService")
+ .setServiceConfiguration(resource)
+ .build();
+ final FactoryBean<EntityManagerFactory> factoryBean =
+ context.getBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.class);
try {
return factoryBean.getObject();
} catch (Exception e) {
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list