[spring-extensions] branch master updated: JSE-25 Add example native spring configuration
Rod Widdowson
rdw at steadingsoftware.com
Tue Aug 8 12:36:29 EDT 2017
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch master
in repository spring-extensions.
View the commit online:
http://git.shibboleth.net/view/?p=spring-extensions.git;a=commit;h=7a29157838d85c17ef6c7bcbaf1ca1f8e165f0c0
The following commit(s) were added to refs/heads/master by this push:
new 7a29157 JSE-25 Add example native spring configuration
7a29157 is described below
commit 7a29157838d85c17ef6c7bcbaf1ca1f8e165f0c0
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Tue Aug 8 17:35:30 2017 +0100
JSE-25 Add example native spring configuration
https://issues.shibboleth.net/jira/browse/JSE-25
---
.../ext/spring/resource/RunnableResourceTest.java | 18 ++++++++++++++++++
.../ext/spring/resource/RunnableResource.xml | 18 ++++++++++++++++++
2 files changed, 36 insertions(+)
diff --git a/src/test/java/net/shibboleth/ext/spring/resource/RunnableResourceTest.java b/src/test/java/net/shibboleth/ext/spring/resource/RunnableResourceTest.java
index 682ebeb..9579688 100644
--- a/src/test/java/net/shibboleth/ext/spring/resource/RunnableResourceTest.java
+++ b/src/test/java/net/shibboleth/ext/spring/resource/RunnableResourceTest.java
@@ -21,9 +21,12 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.util.Collection;
import javax.script.ScriptException;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
+import org.springframework.context.support.GenericApplicationContext;
import org.springframework.core.io.Resource;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
@@ -31,6 +34,7 @@ import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import net.shibboleth.ext.spring.util.SchemaTypeAwareXMLBeanDefinitionReader;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
import net.shibboleth.utilities.java.support.scripting.EvaluableScript;
import net.shibboleth.utilities.java.support.scripting.ScriptedRunnable;
@@ -144,6 +148,20 @@ public class RunnableResourceTest {
}
+ @Test(enabled=true) public void testSpringLoad() {
+
+ final GenericApplicationContext context = new GenericApplicationContext();
+ final XmlBeanDefinitionReader beanDefinitionReader = new SchemaTypeAwareXMLBeanDefinitionReader(context);
+
+ beanDefinitionReader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_XSD);
+ beanDefinitionReader.loadBeanDefinitions("classpath:net/shibboleth/ext/spring/resource/RunnableResource.xml");
+
+ context.refresh();
+ final Collection<Resource> beans = context.getBeansOfType(Resource.class).values();
+ Assert.assertEquals(beans.size(), 1);
+ }
+
+
public class CustomObject {
diff --git a/src/test/resources/net/shibboleth/ext/spring/resource/RunnableResource.xml b/src/test/resources/net/shibboleth/ext/spring/resource/RunnableResource.xml
new file mode 100644
index 0000000..8b9f064
--- /dev/null
+++ b/src/test/resources/net/shibboleth/ext/spring/resource/RunnableResource.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
+ xmlns:c="http://www.springframework.org/schema/c"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+ <bean id="shibboleth.IdentifiableBeanPostProcessor" class="net.shibboleth.ext.spring.config.IdentifiableBeanPostProcessor" />
+
+ <bean id="Script" class="net.shibboleth.utilities.java.support.scripting.EvaluableScript" c:_0="
+ var i = 22;
+ var j = 7;
+ var pi = i/j;
+ "/>
+
+ <bean id="Runnable" class="net.shibboleth.utilities.java.support.scripting.ScriptedRunnable" p:script-ref="Script" init-method="initialize"/>
+
+ <bean id="Resource" class="net.shibboleth.ext.spring.resource.RunnableFileSystemResource" c:path="file" c:runnable-ref="Runnable"/>
+</beans>
\ 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