[java-shib-shared] branch main updated: Rename XML package, and hide a couple of impl classes.
Scott Cantor
cantor.2 at osu.edu
Mon Sep 26 16:02:31 UTC 2022
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch main
in repository java-shib-shared.
View the commit online:
http://git.shibboleth.net/view/?p=java-shib-shared.git;a=commit;h=15fb4ef7ab3fb7f71716120b66ab1243a6222e1c
The following commit(s) were added to refs/heads/main by this push:
new 15fb4ef7 Rename XML package, and hide a couple of impl classes.
15fb4ef7 is described below
commit 15fb4ef7ab3fb7f71716120b66ab1243a6222e1c
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Sep 26 12:02:28 2022 -0400
Rename XML package, and hide a couple of impl classes.
---
.../spring/config/DurationPropertyEditor.java | 2 +-
.../spring/config/StringToDurationConverter.java | 4 +-
.../spring/custom/BaseSpringNamespaceHandler.java | 4 +-
.../custom/EmbeddedAndSchemaAwareReader.java | 4 +-
...chemaTypeAwareBeanDefinitionParserDelegate.java | 4 +-
.../spring/factory/DOMDocumentFactoryBean.java | 2 +-
.../shared/spring/util/SpringSupport.java | 4 +-
.../shared/spring/custom/LowerParsersAndBean.java | 4 +-
.../shared/spring/custom/UpperParserAndBean.java | 2 +-
.../spring/factory/DOMDocumentFactoryBeanTest.java | 4 +-
shib-support/pom.xml | 7 ++
.../support => shared}/xml/AttributeSupport.java | 2 +-
.../support => shared}/xml/ClasspathResolver.java | 2 +-
.../support => shared}/xml/DOMTypeSupport.java | 2 +-
.../support => shared}/xml/ElementSupport.java | 2 +-
.../support => shared}/xml/NamespaceSupport.java | 2 +-
.../java/support => shared}/xml/ParserPool.java | 2 +-
.../java/support => shared}/xml/QNameSupport.java | 2 +-
.../java/support => shared}/xml/SchemaBuilder.java | 3 +-
.../support => shared}/xml/SerializeSupport.java | 2 +-
.../java/support => shared}/xml/XMLConstants.java | 2 +-
.../support => shared}/xml/XMLParserException.java | 2 +-
.../java/support => shared}/xml/XMLSpace.java | 2 +-
.../xml => shared/xml/impl}/BasicParserPool.java | 4 +-
.../xml/impl}/LoggingErrorHandler.java | 2 +-
.../xml => shared/xml/impl}/package-info.java | 6 +-
.../java/support => shared}/xml/package-info.java | 6 +-
.../java/support/xml/SimpleNamespaceContext.java | 129 --------------------
.../xml/AttributeSupportTest.java | 9 +-
.../support => shared}/xml/DOMTypeSupportTest.java | 7 +-
.../support => shared}/xml/ElementSupportTest.java | 5 +-
.../xml/NamespaceSupportTest.java | 5 +-
.../support => shared}/xml/QNameSupportTest.java | 5 +-
.../support => shared}/xml/SchemaBuilderTest.java | 10 +-
.../xml/SerializeSupportTest.java | 5 +-
.../shared/xml/TestResourceConverter.java | 130 +++++++++++++++++++++
.../java/support => shared}/xml/XMLSpaceTest.java | 3 +-
.../xml/impl}/BasicParserPoolTest.java | 10 +-
.../support/xml/SimpleNamespaceContextTest.java | 75 ------------
.../xml/attributeSupportTest.xml | 0
.../java/support => shared}/xml/badNS1.xml | 0
.../java/support => shared}/xml/badNS2.xml | 0
.../support => shared}/xml/elementSupportTest.xml | 0
.../{utilities/java/support => shared}/xml/foo.xml | 0
.../java/support => shared}/xml/getXSIType.xml | 0
.../xml/impl}/basicParserPoolTest.xml | 0
.../xml/impl}/basicParserPoolTest.xsd | 0
.../xml => shared/xml/impl}/dtdParserPoolTest.xml | 0
.../xml/namespaceSupportTest.xml | 0
.../java/support => shared}/xml/noXSIType.xml | 0
.../support => shared}/xml/qNameSupportTest.xml | 0
.../schemaBuilderTest-fails.xml | 0
.../schemaBuilderTest-schemaFirstLoaded.xsd | 0
.../schemaBuilderTest-schemaSecondLoaded.xsd | 0
.../schemaBuilderTest-works.xml | 0
.../xml/serializeSupportTest.xml | 0
56 files changed, 214 insertions(+), 263 deletions(-)
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/config/DurationPropertyEditor.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/config/DurationPropertyEditor.java
index 9c7d99a6..a9ee485f 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/config/DurationPropertyEditor.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/config/DurationPropertyEditor.java
@@ -19,7 +19,7 @@ package net.shibboleth.shared.spring.config;
import java.beans.PropertyEditorSupport;
-import net.shibboleth.utilities.java.support.xml.DOMTypeSupport;
+import net.shibboleth.shared.xml.DOMTypeSupport;
/**
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/config/StringToDurationConverter.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/config/StringToDurationConverter.java
index 898abb1d..9b2d5817 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/config/StringToDurationConverter.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/config/StringToDurationConverter.java
@@ -19,10 +19,10 @@ package net.shibboleth.shared.spring.config;
import java.time.Duration;
-import net.shibboleth.utilities.java.support.xml.DOMTypeSupport;
-
import org.springframework.core.convert.converter.Converter;
+import net.shibboleth.shared.xml.DOMTypeSupport;
+
/**
* Allows setting of Duration-valued properties using lexical string form.
*/
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/BaseSpringNamespaceHandler.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/BaseSpringNamespaceHandler.java
index 421c12d3..4518c79b 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/BaseSpringNamespaceHandler.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/BaseSpringNamespaceHandler.java
@@ -47,9 +47,9 @@ import org.w3c.dom.Node;
import net.shibboleth.shared.annotation.ParameterName;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
+import net.shibboleth.shared.xml.DOMTypeSupport;
+import net.shibboleth.shared.xml.QNameSupport;
import net.shibboleth.utilities.java.support.primitive.StringSupport;
-import net.shibboleth.utilities.java.support.xml.DOMTypeSupport;
-import net.shibboleth.utilities.java.support.xml.QNameSupport;
/**
* A base class for {@link NamespaceHandler} implementations.
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/EmbeddedAndSchemaAwareReader.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/EmbeddedAndSchemaAwareReader.java
index fbe30ef6..824c229e 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/EmbeddedAndSchemaAwareReader.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/EmbeddedAndSchemaAwareReader.java
@@ -21,14 +21,14 @@ import java.util.List;
import javax.xml.namespace.QName;
-import net.shibboleth.utilities.java.support.xml.ElementSupport;
-
import org.springframework.beans.factory.BeanDefinitionStoreException;
import org.springframework.beans.factory.xml.BeanDefinitionParserDelegate;
import org.springframework.beans.factory.xml.XmlReaderContext;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+import net.shibboleth.shared.xml.ElementSupport;
+
/**
* An extension to our {@link SchemaTypeAwareBeanDefinitionDocumentReader} which, in addition
* allows parsing of embedded <beans> statements (by the native spring parsers).
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/SchemaTypeAwareBeanDefinitionParserDelegate.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/SchemaTypeAwareBeanDefinitionParserDelegate.java
index 877725c8..6fcad1ea 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/SchemaTypeAwareBeanDefinitionParserDelegate.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/SchemaTypeAwareBeanDefinitionParserDelegate.java
@@ -17,8 +17,6 @@
package net.shibboleth.shared.spring.custom;
-import net.shibboleth.utilities.java.support.xml.DOMTypeSupport;
-
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.xml.BeanDefinitionParserDelegate;
import org.springframework.beans.factory.xml.NamespaceHandler;
@@ -26,6 +24,8 @@ import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.beans.factory.xml.XmlReaderContext;
import org.w3c.dom.Element;
+import net.shibboleth.shared.xml.DOMTypeSupport;
+
/**
* An extension to the standard {@link BeanDefinitionParserDelegate} that adds support for retrieving
* {@link NamespaceHandler} by schema type, as well as element QName, when resolving custom elements. In the case where
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/factory/DOMDocumentFactoryBean.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/factory/DOMDocumentFactoryBean.java
index 8e89a9e5..c1ab028d 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/factory/DOMDocumentFactoryBean.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/factory/DOMDocumentFactoryBean.java
@@ -22,8 +22,8 @@ import java.io.InputStream;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
+import net.shibboleth.shared.xml.ParserPool;
import net.shibboleth.utilities.java.support.logic.Constraint;
-import net.shibboleth.utilities.java.support.xml.ParserPool;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.FactoryBean;
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/util/SpringSupport.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/util/SpringSupport.java
index 5cc92884..47145a69 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/util/SpringSupport.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/util/SpringSupport.java
@@ -53,10 +53,10 @@ import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.annotation.constraint.Unmodifiable;
import net.shibboleth.shared.net.HttpServletSupport;
import net.shibboleth.shared.spring.context.FilesystemGenericApplicationContext;
+import net.shibboleth.shared.xml.SerializeSupport;
+import net.shibboleth.shared.xml.XMLConstants;
import net.shibboleth.utilities.java.support.logic.Constraint;
import net.shibboleth.utilities.java.support.primitive.StringSupport;
-import net.shibboleth.utilities.java.support.xml.SerializeSupport;
-import net.shibboleth.utilities.java.support.xml.XMLConstants;
/**
* Helper class for performing some common Spring-related functions.
diff --git a/shib-spring/src/test/java/net/shibboleth/shared/spring/custom/LowerParsersAndBean.java b/shib-spring/src/test/java/net/shibboleth/shared/spring/custom/LowerParsersAndBean.java
index 1564fce0..bfdc283e 100644
--- a/shib-spring/src/test/java/net/shibboleth/shared/spring/custom/LowerParsersAndBean.java
+++ b/shib-spring/src/test/java/net/shibboleth/shared/spring/custom/LowerParsersAndBean.java
@@ -31,8 +31,8 @@ import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.spring.custom.AbstractCustomBeanDefinitionParser;
import net.shibboleth.shared.spring.custom.BaseSpringNamespaceHandler;
import net.shibboleth.shared.spring.util.SpringSupport;
-import net.shibboleth.utilities.java.support.xml.AttributeSupport;
-import net.shibboleth.utilities.java.support.xml.ElementSupport;
+import net.shibboleth.shared.xml.AttributeSupport;
+import net.shibboleth.shared.xml.ElementSupport;
public class LowerParsersAndBean extends BaseSpringNamespaceHandler {
diff --git a/shib-spring/src/test/java/net/shibboleth/shared/spring/custom/UpperParserAndBean.java b/shib-spring/src/test/java/net/shibboleth/shared/spring/custom/UpperParserAndBean.java
index c4042a6e..21c43487 100644
--- a/shib-spring/src/test/java/net/shibboleth/shared/spring/custom/UpperParserAndBean.java
+++ b/shib-spring/src/test/java/net/shibboleth/shared/spring/custom/UpperParserAndBean.java
@@ -26,7 +26,7 @@ import org.w3c.dom.Element;
import net.shibboleth.shared.spring.custom.AbstractCustomBeanDefinitionParser;
import net.shibboleth.shared.spring.custom.SecondaryNamespaceHandler;
-import net.shibboleth.utilities.java.support.xml.AttributeSupport;
+import net.shibboleth.shared.xml.AttributeSupport;
public class UpperParserAndBean extends SecondaryNamespaceHandler {
diff --git a/shib-spring/src/test/java/net/shibboleth/shared/spring/factory/DOMDocumentFactoryBeanTest.java b/shib-spring/src/test/java/net/shibboleth/shared/spring/factory/DOMDocumentFactoryBeanTest.java
index bf4f78f5..296945b5 100644
--- a/shib-spring/src/test/java/net/shibboleth/shared/spring/factory/DOMDocumentFactoryBeanTest.java
+++ b/shib-spring/src/test/java/net/shibboleth/shared/spring/factory/DOMDocumentFactoryBeanTest.java
@@ -17,8 +17,6 @@
package net.shibboleth.shared.spring.factory;
-import net.shibboleth.utilities.java.support.xml.BasicParserPool;
-
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.testng.Assert;
@@ -26,6 +24,8 @@ import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+import net.shibboleth.shared.xml.impl.BasicParserPool;
+
/** {@link DOMDocumentFactoryBean} unit tests. */
public class DOMDocumentFactoryBeanTest {
diff --git a/shib-support/pom.xml b/shib-support/pom.xml
index 61c8a24f..2c0c0b13 100644
--- a/shib-support/pom.xml
+++ b/shib-support/pom.xml
@@ -45,6 +45,13 @@
<artifactId>logback-core</artifactId>
<scope>test</scope><!-- normally runtime -->
</dependency>
+
+ <dependency>
+ <groupId>${spring.groupId}</groupId>
+ <artifactId>spring-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
<scm>
diff --git a/shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/AttributeSupport.java b/shib-support/src/main/java/net/shibboleth/shared/xml/AttributeSupport.java
similarity index 99%
rename from shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/AttributeSupport.java
rename to shib-support/src/main/java/net/shibboleth/shared/xml/AttributeSupport.java
index 20d25781..d60bfbe1 100644
--- a/shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/AttributeSupport.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/xml/AttributeSupport.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.utilities.java.support.xml;
+package net.shibboleth.shared.xml;
import java.time.Duration;
import java.time.Instant;
diff --git a/shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/ClasspathResolver.java b/shib-support/src/main/java/net/shibboleth/shared/xml/ClasspathResolver.java
similarity index 99%
rename from shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/ClasspathResolver.java
rename to shib-support/src/main/java/net/shibboleth/shared/xml/ClasspathResolver.java
index 771533b6..4fb9f901 100644
--- a/shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/ClasspathResolver.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/xml/ClasspathResolver.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.utilities.java.support.xml;
+package net.shibboleth.shared.xml;
import java.io.BufferedInputStream;
import java.io.IOException;
diff --git a/shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/DOMTypeSupport.java b/shib-support/src/main/java/net/shibboleth/shared/xml/DOMTypeSupport.java
similarity index 99%
rename from shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/DOMTypeSupport.java
rename to shib-support/src/main/java/net/shibboleth/shared/xml/DOMTypeSupport.java
index 070502ae..e9bf6d8d 100644
--- a/shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/DOMTypeSupport.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/xml/DOMTypeSupport.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.utilities.java.support.xml;
+package net.shibboleth.shared.xml;
import java.time.Duration;
import java.time.Instant;
diff --git a/shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/ElementSupport.java b/shib-support/src/main/java/net/shibboleth/shared/xml/ElementSupport.java
similarity index 99%
rename from shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/ElementSupport.java
rename to shib-support/src/main/java/net/shibboleth/shared/xml/ElementSupport.java
index 9fb671b7..70f4cae4 100644
--- a/shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/ElementSupport.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/xml/ElementSupport.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.utilities.java.support.xml;
+package net.shibboleth.shared.xml;
import java.util.ArrayList;
import java.util.Collections;
diff --git a/shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/NamespaceSupport.java b/shib-support/src/main/java/net/shibboleth/shared/xml/NamespaceSupport.java
similarity index 99%
rename from shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/NamespaceSupport.java
rename to shib-support/src/main/java/net/shibboleth/shared/xml/NamespaceSupport.java
index 27eba9d9..a898d2cf 100644
--- a/shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/NamespaceSupport.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/xml/NamespaceSupport.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.utilities.java.support.xml;
+package net.shibboleth.shared.xml;
import java.util.Objects;
diff --git a/shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/ParserPool.java b/shib-support/src/main/java/net/shibboleth/shared/xml/ParserPool.java
similarity index 98%
rename from shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/ParserPool.java
rename to shib-support/src/main/java/net/shibboleth/shared/xml/ParserPool.java
index 726f25e7..cb3b3409 100644
--- a/shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/ParserPool.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/xml/ParserPool.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.utilities.java.support.xml;
+package net.shibboleth.shared.xml;
import java.io.InputStream;
import java.io.Reader;
diff --git a/shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/QNameSupport.java b/shib-support/src/main/java/net/shibboleth/shared/xml/QNameSupport.java
similarity index 98%
rename from shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/QNameSupport.java
rename to shib-support/src/main/java/net/shibboleth/shared/xml/QNameSupport.java
index a31b4171..3f59148b 100644
--- a/shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/QNameSupport.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/xml/QNameSupport.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.utilities.java.support.xml;
+package net.shibboleth.shared.xml;
import java.util.StringTokenizer;
diff --git a/shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/SchemaBuilder.java b/shib-support/src/main/java/net/shibboleth/shared/xml/SchemaBuilder.java
similarity index 99%
rename from shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/SchemaBuilder.java
rename to shib-support/src/main/java/net/shibboleth/shared/xml/SchemaBuilder.java
index b4600a79..cdc21e48 100644
--- a/shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/SchemaBuilder.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/xml/SchemaBuilder.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.utilities.java.support.xml;
+package net.shibboleth.shared.xml;
import java.io.IOException;
import java.io.InputStream;
@@ -37,6 +37,7 @@ import javax.xml.validation.SchemaFactory;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.annotation.constraint.NullableElements;
+import net.shibboleth.shared.xml.impl.LoggingErrorHandler;
import net.shibboleth.utilities.java.support.logic.Constraint;
import net.shibboleth.utilities.java.support.primitive.StringSupport;
import net.shibboleth.utilities.java.support.resource.Resource;
diff --git a/shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/SerializeSupport.java b/shib-support/src/main/java/net/shibboleth/shared/xml/SerializeSupport.java
similarity index 99%
rename from shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/SerializeSupport.java
rename to shib-support/src/main/java/net/shibboleth/shared/xml/SerializeSupport.java
index 9698ee2e..cb44771a 100644
--- a/shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/SerializeSupport.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/xml/SerializeSupport.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.utilities.java.support.xml;
+package net.shibboleth.shared.xml;
import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
diff --git a/shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/XMLConstants.java b/shib-support/src/main/java/net/shibboleth/shared/xml/XMLConstants.java
similarity index 98%
rename from shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/XMLConstants.java
rename to shib-support/src/main/java/net/shibboleth/shared/xml/XMLConstants.java
index 721b80af..9192d51b 100644
--- a/shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/XMLConstants.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/xml/XMLConstants.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.utilities.java.support.xml;
+package net.shibboleth.shared.xml;
import javax.xml.namespace.QName;
diff --git a/shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/XMLParserException.java b/shib-support/src/main/java/net/shibboleth/shared/xml/XMLParserException.java
similarity index 97%
rename from shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/XMLParserException.java
rename to shib-support/src/main/java/net/shibboleth/shared/xml/XMLParserException.java
index 5fb9bf35..52ff4e12 100644
--- a/shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/XMLParserException.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/xml/XMLParserException.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.utilities.java.support.xml;
+package net.shibboleth.shared.xml;
import javax.annotation.Nullable;
diff --git a/shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/XMLSpace.java b/shib-support/src/main/java/net/shibboleth/shared/xml/XMLSpace.java
similarity index 96%
rename from shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/XMLSpace.java
rename to shib-support/src/main/java/net/shibboleth/shared/xml/XMLSpace.java
index 8dbbfa35..e7046c83 100644
--- a/shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/XMLSpace.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/xml/XMLSpace.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.utilities.java.support.xml;
+package net.shibboleth.shared.xml;
/** Enum representing the allowed values of the xml:space attribute. */
public enum XMLSpace {
diff --git a/shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/BasicParserPool.java b/shib-support/src/main/java/net/shibboleth/shared/xml/impl/BasicParserPool.java
similarity index 99%
rename from shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/BasicParserPool.java
rename to shib-support/src/main/java/net/shibboleth/shared/xml/impl/BasicParserPool.java
index 2bc56994..305efb56 100644
--- a/shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/BasicParserPool.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/xml/impl/BasicParserPool.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.utilities.java.support.xml;
+package net.shibboleth.shared.xml.impl;
import java.io.File;
import java.io.IOException;
@@ -55,6 +55,8 @@ import net.shibboleth.shared.annotation.constraint.NullableElements;
import net.shibboleth.shared.annotation.constraint.Unmodifiable;
import net.shibboleth.shared.component.AbstractInitializableComponent;
import net.shibboleth.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.xml.ParserPool;
+import net.shibboleth.shared.xml.XMLParserException;
import net.shibboleth.utilities.java.support.logic.Constraint;
import net.shibboleth.utilities.java.support.primitive.StringSupport;
diff --git a/shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/LoggingErrorHandler.java b/shib-support/src/main/java/net/shibboleth/shared/xml/impl/LoggingErrorHandler.java
similarity index 98%
rename from shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/LoggingErrorHandler.java
rename to shib-support/src/main/java/net/shibboleth/shared/xml/impl/LoggingErrorHandler.java
index 23fdbcd5..d82562be 100644
--- a/shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/LoggingErrorHandler.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/xml/impl/LoggingErrorHandler.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.utilities.java.support.xml;
+package net.shibboleth.shared.xml.impl;
import javax.annotation.Nonnull;
diff --git a/shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/package-info.java b/shib-support/src/main/java/net/shibboleth/shared/xml/impl/package-info.java
similarity index 87%
copy from shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/package-info.java
copy to shib-support/src/main/java/net/shibboleth/shared/xml/impl/package-info.java
index 470b9322..f1a0f3eb 100644
--- a/shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/package-info.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/xml/impl/package-info.java
@@ -15,5 +15,7 @@
* limitations under the License.
*/
-/** A set of helper functions for performing actions on DOM nodes. */
-package net.shibboleth.utilities.java.support.xml;
\ No newline at end of file
+/**
+ * XML implementation classes.
+ */
+package net.shibboleth.shared.xml.impl;
\ No newline at end of file
diff --git a/shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/package-info.java b/shib-support/src/main/java/net/shibboleth/shared/xml/package-info.java
similarity index 87%
rename from shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/package-info.java
rename to shib-support/src/main/java/net/shibboleth/shared/xml/package-info.java
index 470b9322..b1d37cb0 100644
--- a/shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/package-info.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/xml/package-info.java
@@ -15,5 +15,7 @@
* limitations under the License.
*/
-/** A set of helper functions for performing actions on DOM nodes. */
-package net.shibboleth.utilities.java.support.xml;
\ No newline at end of file
+/**
+ * APIs for parsing and using XML.
+ */
+package net.shibboleth.shared.xml;
\ No newline at end of file
diff --git a/shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/SimpleNamespaceContext.java b/shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/SimpleNamespaceContext.java
deleted file mode 100644
index d95ba4eb..00000000
--- a/shib-support/src/main/java/net/shibboleth/utilities/java/support/xml/SimpleNamespaceContext.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Licensed to the University Corporation for Advanced Internet Development,
- * Inc. (UCAID) under one or more contributor license agreements. See the
- * NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The UCAID licenses this file to You under the Apache
- * License, Version 2.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.shibboleth.utilities.java.support.xml;
-
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.ThreadSafe;
-import javax.xml.namespace.NamespaceContext;
-
-import net.shibboleth.shared.annotation.constraint.NullableElements;
-import net.shibboleth.utilities.java.support.primitive.StringSupport;
-
-import com.google.common.collect.ImmutableBiMap;
-import com.google.common.collect.ImmutableBiMap.Builder;
-
-/**
- * Simple implementation of {@link NamespaceContext} based on a map from prefix values to corresponding URIs. This
- * implementation only supports a single mapping for a given prefix, that is {@link #getPrefixes(String)} will always
- * contain at most 1 element.
- */
- at ThreadSafe
-public class SimpleNamespaceContext implements NamespaceContext {
-
- /** Mappings between namespace prefixes and namespace URIs. */
- private final ImmutableBiMap<String, String> mappings;
-
- /** Constructor. */
- public SimpleNamespaceContext() {
- mappings = getMappingsBuilder().build();
- }
-
- /**
- * Constructor.
- *
- * @param prefixToUriMappings Maps prefix values to the corresponding namespace URIs.
- */
- public SimpleNamespaceContext(@Nullable @NullableElements final Map<String, String> prefixToUriMappings) {
- final Builder<String,String> mappingBuilder = getMappingsBuilder();
-
- if (prefixToUriMappings == null || prefixToUriMappings.isEmpty()) {
- mappings = mappingBuilder.build();
- return;
- }
-
- String trimmedPrefix;
- String trimmedUri;
- for (final String key : prefixToUriMappings.keySet()) {
- trimmedPrefix = StringSupport.trimOrNull(key);
- if (trimmedPrefix == null) {
- continue;
- }
-
- trimmedUri = StringSupport.trimOrNull(prefixToUriMappings.get(key));
- if (trimmedUri != null) {
- mappingBuilder.put(trimmedPrefix, trimmedUri);
- }
- }
-
- mappings = mappingBuilder.build();
- }
-
- /** {@inheritDoc} */
- @Nullable public String getNamespaceURI(final String prefix) {
- if (prefix == null) {
- throw new IllegalArgumentException("Prefix can not be null");
- }
-
- final String uri = mappings.get(prefix);
- if (uri == null) {
- return javax.xml.XMLConstants.NULL_NS_URI;
- }
- return uri;
- }
-
- /** {@inheritDoc} */
- @Nullable public String getPrefix(final String namespaceURI) {
- if (namespaceURI == null) {
- throw new IllegalArgumentException("Namespace URI can not be null");
- }
-
- return mappings.inverse().get(namespaceURI);
- }
-
- /** {@inheritDoc} */
- @Nonnull public Iterator<String> getPrefixes(final String namespaceURI) {
- if (namespaceURI == null) {
- throw new IllegalArgumentException("Namespace URI can not be null");
- }
-
- final String prefix = mappings.inverse().get(namespaceURI);
- if (prefix == null) {
- return Collections.<String> emptyList().iterator();
- }
- return Collections.singletonList(prefix).iterator();
- }
-
- /**
- * Build the initial set of mappings which contains entries for XML and XMLNS.
- *
- * @return initial set of mappings
- */
- @Nonnull private Builder<String, String> getMappingsBuilder(){
- final Builder<String,String> mappingBuilder = new Builder<>();
-
- mappingBuilder.put(XMLConstants.XML_PREFIX, XMLConstants.XML_NS);
- mappingBuilder.put(XMLConstants.XMLNS_PREFIX, XMLConstants.XMLNS_NS);
-
- return mappingBuilder;
- }
-}
\ No newline at end of file
diff --git a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/AttributeSupportTest.java b/shib-support/src/test/java/net/shibboleth/shared/xml/AttributeSupportTest.java
similarity index 99%
rename from shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/AttributeSupportTest.java
rename to shib-support/src/test/java/net/shibboleth/shared/xml/AttributeSupportTest.java
index 2773fa6a..55f65d40 100644
--- a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/AttributeSupportTest.java
+++ b/shib-support/src/test/java/net/shibboleth/shared/xml/AttributeSupportTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.utilities.java.support.xml;
+package net.shibboleth.shared.xml;
import java.io.IOException;
import java.io.InputStream;
@@ -31,6 +31,7 @@ import javax.xml.parsers.DocumentBuilder;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.xml.impl.BasicParserPool;
import net.shibboleth.utilities.java.support.logic.ConstraintViolationException;
import org.testng.Assert;
@@ -84,7 +85,7 @@ public class AttributeSupportTest {
parserPool.initialize();
DocumentBuilder builder = parserPool.getBuilder();
- try (final InputStream s = getClass().getResourceAsStream("/net/shibboleth/utilities/java/support/xml/attributeSupportTest.xml")) {
+ try (final InputStream s = getClass().getResourceAsStream("/net/shibboleth/shared/xml/attributeSupportTest.xml")) {
idAttrQName = new QName(TEST_NS, TEST_ID_ATTRIBUTE, TEST_PREFIX);
Document testFile = builder.parse(s);
@@ -141,7 +142,7 @@ public class AttributeSupportTest {
DocumentBuilder builder = parserPool.getBuilder();
- try (final InputStream s = getClass().getResourceAsStream("/net/shibboleth/utilities/java/support/xml/badNS1.xml")) {
+ try (final InputStream s = getClass().getResourceAsStream("/net/shibboleth/shared/xml/badNS1.xml")) {
boolean thrown = false;
try {
builder.parse(s);
@@ -153,7 +154,7 @@ public class AttributeSupportTest {
"xmlns: declaration with name other than xml and namespace of http://www.w3.org/XML/1998/namespace should throw an error ");
}
- try (final InputStream s = getClass().getResourceAsStream("/net/shibboleth/utilities/java/support/xml/badNS2.xml")) {
+ try (final InputStream s = getClass().getResourceAsStream("/net/shibboleth/shared/xml/badNS2.xml")) {
boolean thrown = false;
try {
builder.parse(s);
diff --git a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/DOMTypeSupportTest.java b/shib-support/src/test/java/net/shibboleth/shared/xml/DOMTypeSupportTest.java
similarity index 95%
rename from shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/DOMTypeSupportTest.java
rename to shib-support/src/test/java/net/shibboleth/shared/xml/DOMTypeSupportTest.java
index 3fe40cad..bb488372 100644
--- a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/DOMTypeSupportTest.java
+++ b/shib-support/src/test/java/net/shibboleth/shared/xml/DOMTypeSupportTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.utilities.java.support.xml;
+package net.shibboleth.shared.xml;
import java.io.IOException;
import java.io.InputStream;
@@ -32,6 +32,7 @@ import org.w3c.dom.Element;
import org.xml.sax.SAXException;
import net.shibboleth.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.xml.impl.BasicParserPool;
/**
* Tests for {@link DOMTypeSupport};
@@ -49,11 +50,11 @@ public class DOMTypeSupportTest {
DocumentBuilder builder = parserPool.getBuilder();
- try (final InputStream s = getClass().getResourceAsStream("/net/shibboleth/utilities/java/support/xml/getXSIType.xml")) {
+ try (final InputStream s = getClass().getResourceAsStream("/net/shibboleth/shared/xml/getXSIType.xml")) {
xsStringXSITypeElement = (Element) builder.parse(s).getFirstChild();
}
- try (final InputStream s = getClass().getResourceAsStream("/net/shibboleth/utilities/java/support/xml/noXSIType.xml")) {
+ try (final InputStream s = getClass().getResourceAsStream("/net/shibboleth/shared/xml/noXSIType.xml")) {
noXSITypeElement = (Element) builder.parse(s).getFirstChild();
}
diff --git a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/ElementSupportTest.java b/shib-support/src/test/java/net/shibboleth/shared/xml/ElementSupportTest.java
similarity index 99%
rename from shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/ElementSupportTest.java
rename to shib-support/src/test/java/net/shibboleth/shared/xml/ElementSupportTest.java
index c122b54c..88c85101 100644
--- a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/ElementSupportTest.java
+++ b/shib-support/src/test/java/net/shibboleth/shared/xml/ElementSupportTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.utilities.java.support.xml;
+package net.shibboleth.shared.xml;
import java.io.IOException;
import java.io.InputStream;
@@ -29,6 +29,7 @@ import javax.xml.parsers.DocumentBuilder;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.xml.impl.BasicParserPool;
import net.shibboleth.utilities.java.support.logic.ConstraintViolationException;
import net.shibboleth.utilities.java.support.primitive.StringSupport;
@@ -73,7 +74,7 @@ public class ElementSupportTest {
parserPool.initialize();
DocumentBuilder builder = parserPool.getBuilder();
- try (final InputStream s = getClass().getResourceAsStream("/net/shibboleth/utilities/java/support/xml/elementSupportTest.xml")) {
+ try (final InputStream s = getClass().getResourceAsStream("/net/shibboleth/shared/xml/elementSupportTest.xml")) {
testFileDocument = builder.parse(s);
rootElement = (Element) testFileDocument.getFirstChild();
testerDocument = builder.newDocument();
diff --git a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/NamespaceSupportTest.java b/shib-support/src/test/java/net/shibboleth/shared/xml/NamespaceSupportTest.java
similarity index 99%
rename from shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/NamespaceSupportTest.java
rename to shib-support/src/test/java/net/shibboleth/shared/xml/NamespaceSupportTest.java
index d4c59d7d..d1b365e6 100644
--- a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/NamespaceSupportTest.java
+++ b/shib-support/src/test/java/net/shibboleth/shared/xml/NamespaceSupportTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.utilities.java.support.xml;
+package net.shibboleth.shared.xml;
import java.io.IOException;
import java.io.InputStream;
@@ -31,6 +31,7 @@ import org.w3c.dom.Element;
import org.xml.sax.SAXException;
import net.shibboleth.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.xml.impl.BasicParserPool;
/**
* Tests for {@link NamespaceSupport}
@@ -70,7 +71,7 @@ public class NamespaceSupportTest {
parserPool = new BasicParserPool();
parserPool.initialize();
DocumentBuilder builder = parserPool.getBuilder();
- try (final InputStream s = getClass().getResourceAsStream("/net/shibboleth/utilities/java/support/xml/namespaceSupportTest.xml")) {
+ try (final InputStream s = getClass().getResourceAsStream("/net/shibboleth/shared/xml/namespaceSupportTest.xml")) {
Document testFile = builder.parse(s);
parent = (Element) testFile.getFirstChild();
diff --git a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/QNameSupportTest.java b/shib-support/src/test/java/net/shibboleth/shared/xml/QNameSupportTest.java
similarity index 97%
rename from shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/QNameSupportTest.java
rename to shib-support/src/test/java/net/shibboleth/shared/xml/QNameSupportTest.java
index 57e11c4a..776f4222 100644
--- a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/QNameSupportTest.java
+++ b/shib-support/src/test/java/net/shibboleth/shared/xml/QNameSupportTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.utilities.java.support.xml;
+package net.shibboleth.shared.xml;
import java.io.IOException;
import java.io.InputStream;
@@ -26,6 +26,7 @@ import javax.xml.parsers.DocumentBuilder;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.xml.impl.BasicParserPool;
import net.shibboleth.utilities.java.support.logic.ConstraintViolationException;
import org.testng.Assert;
@@ -69,7 +70,7 @@ public class QNameSupportTest {
parserPool = pool;
DocumentBuilder builder = parserPool.getBuilder();
- try (final InputStream s = getClass().getResourceAsStream("/net/shibboleth/utilities/java/support/xml/qNameSupportTest.xml")) {
+ try (final InputStream s = getClass().getResourceAsStream("/net/shibboleth/shared/xml/qNameSupportTest.xml")) {
Document testFile = builder.parse(s);
parent = (Element) testFile.getFirstChild();
diff --git a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/SchemaBuilderTest.java b/shib-support/src/test/java/net/shibboleth/shared/xml/SchemaBuilderTest.java
similarity index 95%
rename from shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/SchemaBuilderTest.java
rename to shib-support/src/test/java/net/shibboleth/shared/xml/SchemaBuilderTest.java
index b3c161b5..3f4ec3d2 100644
--- a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/SchemaBuilderTest.java
+++ b/shib-support/src/test/java/net/shibboleth/shared/xml/SchemaBuilderTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.utilities.java.support.xml;
+package net.shibboleth.shared.xml;
import java.io.FileInputStream;
import java.io.IOException;
@@ -26,6 +26,7 @@ import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.Validator;
+import org.springframework.core.io.ClassPathResource;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -38,7 +39,7 @@ import net.shibboleth.shared.component.ComponentInitializationException;
*/
public class SchemaBuilderTest {
- private static final String TEST_DIR = "/net/shibboleth/utilities/java/support/xml/schemaBuilderTestDir/";
+ private static final String TEST_DIR = "/net/shibboleth/shared/xml/schemaBuilderTestDir/";
private static final String FILE_ROOT = "src/test/resources/";
@@ -109,9 +110,9 @@ public class SchemaBuilderTest {
}
}
- /*
+ /**
* May re-enable if cycle dependency resolved.
- *
+ */
@Test public void testResource() throws SAXException, IOException, ComponentInitializationException {
net.shibboleth.utilities.java.support.resource.Resource first = TestResourceConverter.of(new ClassPathResource(TEST_DIR + FIRST_SCHEMA_FILE));
net.shibboleth.utilities.java.support.resource.Resource second = TestResourceConverter.of(new ClassPathResource(TEST_DIR + SECOND_SCHEMA_FILE));
@@ -133,6 +134,5 @@ public class SchemaBuilderTest {
}
Assert.assertTrue(thrown, "Should fail to validate");
}
- */
}
\ No newline at end of file
diff --git a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/SerializeSupportTest.java b/shib-support/src/test/java/net/shibboleth/shared/xml/SerializeSupportTest.java
similarity index 98%
rename from shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/SerializeSupportTest.java
rename to shib-support/src/test/java/net/shibboleth/shared/xml/SerializeSupportTest.java
index e8078b3d..3bab0cbd 100644
--- a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/SerializeSupportTest.java
+++ b/shib-support/src/test/java/net/shibboleth/shared/xml/SerializeSupportTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.utilities.java.support.xml;
+package net.shibboleth.shared.xml;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -42,6 +42,7 @@ import org.w3c.dom.ls.LSSerializer;
import org.xml.sax.SAXException;
import net.shibboleth.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.xml.impl.BasicParserPool;
/**
* Tests for {@link NamespaceSupport}
@@ -141,7 +142,7 @@ public class SerializeSupportTest {
parserPool = new BasicParserPool();
parserPool.initialize();
final DocumentBuilder builder = parserPool.getBuilder();
- try (final InputStream s = getClass().getResourceAsStream("/net/shibboleth/utilities/java/support/xml/serializeSupportTest.xml")) {
+ try (final InputStream s = getClass().getResourceAsStream("/net/shibboleth/shared/xml/serializeSupportTest.xml")) {
final Document testFile = builder.parse(s);
parent = (Element) testFile.getFirstChild();
diff --git a/shib-support/src/test/java/net/shibboleth/shared/xml/TestResourceConverter.java b/shib-support/src/test/java/net/shibboleth/shared/xml/TestResourceConverter.java
new file mode 100644
index 00000000..0cafb19f
--- /dev/null
+++ b/shib-support/src/test/java/net/shibboleth/shared/xml/TestResourceConverter.java
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements. See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.shibboleth.shared.xml;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+
+import javax.annotation.Nonnull;
+
+import net.shibboleth.utilities.java.support.logic.Constraint;
+
+import org.springframework.core.io.Resource;
+
+/**
+ * Bridging class between {@link Resource} and {@link net.shibboleth.utilities.java.support.resource.Resource}.
+ */
+public final class TestResourceConverter implements net.shibboleth.utilities.java.support.resource.Resource {
+
+ /** The cached Spring {@link Resource}. */
+ private Resource springResource;
+
+ /**
+ * A private for shimming the provided input.
+ *
+ * @param theResource the spring resource;
+ */
+ private TestResourceConverter(@Nonnull Resource theResource) {
+
+ springResource = Constraint.isNotNull(theResource, "provided Spring Resource should not be null");
+ }
+
+ /**
+ * Return a {@link Resource} that does all the work of the provided {@link Resource}.
+ *
+ * <p>
+ * If the input implements {@link Resource} then it is cast to the output, other a shim class is
+ * generated.
+ * </p>
+ *
+ * @param springResource the input
+ * @return a {@link Resource} which reflects what the Spring one does
+ */
+ public static net.shibboleth.utilities.java.support.resource.Resource of(Resource springResource) {
+ if (springResource instanceof net.shibboleth.utilities.java.support.resource.Resource) {
+ return (net.shibboleth.utilities.java.support.resource.Resource) springResource;
+ }
+ return new TestResourceConverter(springResource);
+ }
+
+ /** {@inheritDoc} */
+ @Override @Nonnull public InputStream getInputStream() throws IOException {
+ return springResource.getInputStream();
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean exists() {
+ return springResource.exists();
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isReadable() {
+ return springResource.isReadable();
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isOpen() {
+ return springResource.isOpen();
+ }
+
+ /** {@inheritDoc} */
+ @Override public URL getURL() throws IOException {
+ return springResource.getURL();
+ }
+
+ /** {@inheritDoc} */
+ @Override public URI getURI() throws IOException {
+ return springResource.getURI();
+ }
+
+ /** {@inheritDoc} */
+ @Override public File getFile() throws IOException {
+ return springResource.getFile();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long contentLength() throws IOException {
+ return springResource.contentLength();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long lastModified() throws IOException {
+ return springResource.lastModified();
+ }
+
+ /** {@inheritDoc} */
+ @Override public net.shibboleth.utilities.java.support.resource.Resource createRelativeResource(
+ String relativePath) throws IOException {
+
+ return of(springResource.createRelative(relativePath));
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getFilename() {
+ return springResource.getFilename();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getDescription() {
+ return springResource.getDescription();
+ }
+
+}
diff --git a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/XMLSpaceTest.java b/shib-support/src/test/java/net/shibboleth/shared/xml/XMLSpaceTest.java
similarity index 97%
rename from shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/XMLSpaceTest.java
rename to shib-support/src/test/java/net/shibboleth/shared/xml/XMLSpaceTest.java
index c902011f..a48f9b51 100644
--- a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/XMLSpaceTest.java
+++ b/shib-support/src/test/java/net/shibboleth/shared/xml/XMLSpaceTest.java
@@ -15,11 +15,12 @@
* limitations under the License.
*/
-package net.shibboleth.utilities.java.support.xml;
+package net.shibboleth.shared.xml;
import org.testng.Assert;
import org.testng.annotations.Test;
+
/**
* Tests for {@link XMLSpace};
*/
diff --git a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/BasicParserPoolTest.java b/shib-support/src/test/java/net/shibboleth/shared/xml/impl/BasicParserPoolTest.java
similarity index 98%
rename from shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/BasicParserPoolTest.java
rename to shib-support/src/test/java/net/shibboleth/shared/xml/impl/BasicParserPoolTest.java
index 47eaa993..4391bea2 100644
--- a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/BasicParserPoolTest.java
+++ b/shib-support/src/test/java/net/shibboleth/shared/xml/impl/BasicParserPoolTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.utilities.java.support.xml;
+package net.shibboleth.shared.xml.impl;
import java.io.ByteArrayInputStream;
import java.io.CharArrayReader;
@@ -39,8 +39,12 @@ import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.component.DestroyedComponentException;
import net.shibboleth.shared.component.UninitializedComponentException;
import net.shibboleth.shared.component.UnmodifiableComponentException;
+import net.shibboleth.shared.xml.ElementSupport;
+import net.shibboleth.shared.xml.NamespaceSupport;
+import net.shibboleth.shared.xml.SchemaBuilder;
+import net.shibboleth.shared.xml.XMLParserException;
+import net.shibboleth.shared.xml.impl.BasicParserPool.DocumentBuilderProxy;
import net.shibboleth.utilities.java.support.logic.ConstraintViolationException;
-import net.shibboleth.utilities.java.support.xml.BasicParserPool.DocumentBuilderProxy;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
@@ -58,7 +62,7 @@ import org.xml.sax.SAXParseException;
*/
public class BasicParserPoolTest {
- @Nonnull @NotEmpty private static final String TEST_DIR = "/net/shibboleth/utilities/java/support/xml/";
+ @Nonnull @NotEmpty private static final String TEST_DIR = "/net/shibboleth/shared/xml/impl/";
@Nonnull @NotEmpty private static final String SCHEMA_FILE = TEST_DIR + "basicParserPoolTest.xsd";
diff --git a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/SimpleNamespaceContextTest.java b/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/SimpleNamespaceContextTest.java
deleted file mode 100644
index 45103ba9..00000000
--- a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/SimpleNamespaceContextTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the University Corporation for Advanced Internet Development,
- * Inc. (UCAID) under one or more contributor license agreements. See the
- * NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The UCAID licenses this file to You under the Apache
- * License, Version 2.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.shibboleth.utilities.java.support.xml;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.namespace.NamespaceContext;
-
-import org.testng.Assert;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-/** {@link SimpleNamespaceContext} test. */
-public class SimpleNamespaceContextTest {
-
- private final static String PREFIX_A = "a";
-
- private final static String URI_A = "value:of:a";
-
- private final static String PREFIX_B = "b";
-
- private final static String URI_B = "value:of:b";
-
- /** Standard set of mappings. */
- private NamespaceContext stdContext;
-
- /** Create standard set of mappings for use by multiple tests. */
- @BeforeClass public void createStandardMappings() {
- Map<String, String> prefixMappings = new HashMap<>();
- prefixMappings.put(PREFIX_A, URI_A);
- prefixMappings.put(PREFIX_B, URI_B);
- stdContext = new SimpleNamespaceContext(prefixMappings);
- }
-
- /** Test for getNamespaceURI method. */
- @Test public void testGetNamespaceURI() {
- Assert.assertEquals(stdContext.getNamespaceURI(PREFIX_A), URI_A);
- Assert.assertEquals(stdContext.getNamespaceURI(PREFIX_B), URI_B);
- Assert.assertEquals(stdContext.getNamespaceURI(XMLConstants.XML_PREFIX), XMLConstants.XML_NS);
- Assert.assertEquals(stdContext.getNamespaceURI(XMLConstants.XMLNS_PREFIX), XMLConstants.XMLNS_NS);
- Assert.assertEquals(stdContext.getNamespaceURI("c"), javax.xml.XMLConstants.NULL_NS_URI);
- }
-
- @Test public void testGetPrefix() {
- Assert.assertEquals(stdContext.getPrefix(URI_A), PREFIX_A);
- Assert.assertEquals(stdContext.getPrefix(URI_B), PREFIX_B);
- Assert.assertEquals(stdContext.getPrefix(XMLConstants.XML_NS), XMLConstants.XML_PREFIX);
- Assert.assertEquals(stdContext.getPrefix(XMLConstants.XMLNS_NS), XMLConstants.XMLNS_PREFIX);
- Assert.assertNull(stdContext.getPrefix("value:of:c"));
- }
-
- @Test public void testGetPrefixes() {
- Assert.assertEquals(stdContext.getPrefixes(URI_A).next(), PREFIX_A);
- Assert.assertEquals(stdContext.getPrefixes(URI_B).next(), PREFIX_B);
- Assert.assertEquals(stdContext.getPrefixes(XMLConstants.XML_NS).next(), XMLConstants.XML_PREFIX);
- Assert.assertEquals(stdContext.getPrefixes(XMLConstants.XMLNS_NS).next(), XMLConstants.XMLNS_PREFIX);
- Assert.assertFalse(stdContext.getPrefixes("value:of:c").hasNext());
- }
-}
\ No newline at end of file
diff --git a/shib-support/src/test/resources/net/shibboleth/utilities/java/support/xml/attributeSupportTest.xml b/shib-support/src/test/resources/net/shibboleth/shared/xml/attributeSupportTest.xml
similarity index 100%
rename from shib-support/src/test/resources/net/shibboleth/utilities/java/support/xml/attributeSupportTest.xml
rename to shib-support/src/test/resources/net/shibboleth/shared/xml/attributeSupportTest.xml
diff --git a/shib-support/src/test/resources/net/shibboleth/utilities/java/support/xml/badNS1.xml b/shib-support/src/test/resources/net/shibboleth/shared/xml/badNS1.xml
similarity index 100%
rename from shib-support/src/test/resources/net/shibboleth/utilities/java/support/xml/badNS1.xml
rename to shib-support/src/test/resources/net/shibboleth/shared/xml/badNS1.xml
diff --git a/shib-support/src/test/resources/net/shibboleth/utilities/java/support/xml/badNS2.xml b/shib-support/src/test/resources/net/shibboleth/shared/xml/badNS2.xml
similarity index 100%
rename from shib-support/src/test/resources/net/shibboleth/utilities/java/support/xml/badNS2.xml
rename to shib-support/src/test/resources/net/shibboleth/shared/xml/badNS2.xml
diff --git a/shib-support/src/test/resources/net/shibboleth/utilities/java/support/xml/elementSupportTest.xml b/shib-support/src/test/resources/net/shibboleth/shared/xml/elementSupportTest.xml
similarity index 100%
rename from shib-support/src/test/resources/net/shibboleth/utilities/java/support/xml/elementSupportTest.xml
rename to shib-support/src/test/resources/net/shibboleth/shared/xml/elementSupportTest.xml
diff --git a/shib-support/src/test/resources/net/shibboleth/utilities/java/support/xml/foo.xml b/shib-support/src/test/resources/net/shibboleth/shared/xml/foo.xml
similarity index 100%
rename from shib-support/src/test/resources/net/shibboleth/utilities/java/support/xml/foo.xml
rename to shib-support/src/test/resources/net/shibboleth/shared/xml/foo.xml
diff --git a/shib-support/src/test/resources/net/shibboleth/utilities/java/support/xml/getXSIType.xml b/shib-support/src/test/resources/net/shibboleth/shared/xml/getXSIType.xml
similarity index 100%
rename from shib-support/src/test/resources/net/shibboleth/utilities/java/support/xml/getXSIType.xml
rename to shib-support/src/test/resources/net/shibboleth/shared/xml/getXSIType.xml
diff --git a/shib-support/src/test/resources/net/shibboleth/utilities/java/support/xml/basicParserPoolTest.xml b/shib-support/src/test/resources/net/shibboleth/shared/xml/impl/basicParserPoolTest.xml
similarity index 100%
rename from shib-support/src/test/resources/net/shibboleth/utilities/java/support/xml/basicParserPoolTest.xml
rename to shib-support/src/test/resources/net/shibboleth/shared/xml/impl/basicParserPoolTest.xml
diff --git a/shib-support/src/test/resources/net/shibboleth/utilities/java/support/xml/basicParserPoolTest.xsd b/shib-support/src/test/resources/net/shibboleth/shared/xml/impl/basicParserPoolTest.xsd
similarity index 100%
rename from shib-support/src/test/resources/net/shibboleth/utilities/java/support/xml/basicParserPoolTest.xsd
rename to shib-support/src/test/resources/net/shibboleth/shared/xml/impl/basicParserPoolTest.xsd
diff --git a/shib-support/src/test/resources/net/shibboleth/utilities/java/support/xml/dtdParserPoolTest.xml b/shib-support/src/test/resources/net/shibboleth/shared/xml/impl/dtdParserPoolTest.xml
similarity index 100%
rename from shib-support/src/test/resources/net/shibboleth/utilities/java/support/xml/dtdParserPoolTest.xml
rename to shib-support/src/test/resources/net/shibboleth/shared/xml/impl/dtdParserPoolTest.xml
diff --git a/shib-support/src/test/resources/net/shibboleth/utilities/java/support/xml/namespaceSupportTest.xml b/shib-support/src/test/resources/net/shibboleth/shared/xml/namespaceSupportTest.xml
similarity index 100%
rename from shib-support/src/test/resources/net/shibboleth/utilities/java/support/xml/namespaceSupportTest.xml
rename to shib-support/src/test/resources/net/shibboleth/shared/xml/namespaceSupportTest.xml
diff --git a/shib-support/src/test/resources/net/shibboleth/utilities/java/support/xml/noXSIType.xml b/shib-support/src/test/resources/net/shibboleth/shared/xml/noXSIType.xml
similarity index 100%
rename from shib-support/src/test/resources/net/shibboleth/utilities/java/support/xml/noXSIType.xml
rename to shib-support/src/test/resources/net/shibboleth/shared/xml/noXSIType.xml
diff --git a/shib-support/src/test/resources/net/shibboleth/utilities/java/support/xml/qNameSupportTest.xml b/shib-support/src/test/resources/net/shibboleth/shared/xml/qNameSupportTest.xml
similarity index 100%
rename from shib-support/src/test/resources/net/shibboleth/utilities/java/support/xml/qNameSupportTest.xml
rename to shib-support/src/test/resources/net/shibboleth/shared/xml/qNameSupportTest.xml
diff --git a/shib-support/src/test/resources/net/shibboleth/utilities/java/support/xml/schemaBuilderTestDir/schemaBuilderTest-fails.xml b/shib-support/src/test/resources/net/shibboleth/shared/xml/schemaBuilderTestDir/schemaBuilderTest-fails.xml
similarity index 100%
rename from shib-support/src/test/resources/net/shibboleth/utilities/java/support/xml/schemaBuilderTestDir/schemaBuilderTest-fails.xml
rename to shib-support/src/test/resources/net/shibboleth/shared/xml/schemaBuilderTestDir/schemaBuilderTest-fails.xml
diff --git a/shib-support/src/test/resources/net/shibboleth/utilities/java/support/xml/schemaBuilderTestDir/schemaBuilderTest-schemaFirstLoaded.xsd b/shib-support/src/test/resources/net/shibboleth/shared/xml/schemaBuilderTestDir/schemaBuilderTest-schemaFirstLoaded.xsd
similarity index 100%
rename from shib-support/src/test/resources/net/shibboleth/utilities/java/support/xml/schemaBuilderTestDir/schemaBuilderTest-schemaFirstLoaded.xsd
rename to shib-support/src/test/resources/net/shibboleth/shared/xml/schemaBuilderTestDir/schemaBuilderTest-schemaFirstLoaded.xsd
diff --git a/shib-support/src/test/resources/net/shibboleth/utilities/java/support/xml/schemaBuilderTestDir/schemaBuilderTest-schemaSecondLoaded.xsd b/shib-support/src/test/resources/net/shibboleth/shared/xml/schemaBuilderTestDir/schemaBuilderTest-schemaSecondLoaded.xsd
similarity index 100%
rename from shib-support/src/test/resources/net/shibboleth/utilities/java/support/xml/schemaBuilderTestDir/schemaBuilderTest-schemaSecondLoaded.xsd
rename to shib-support/src/test/resources/net/shibboleth/shared/xml/schemaBuilderTestDir/schemaBuilderTest-schemaSecondLoaded.xsd
diff --git a/shib-support/src/test/resources/net/shibboleth/utilities/java/support/xml/schemaBuilderTestDir/schemaBuilderTest-works.xml b/shib-support/src/test/resources/net/shibboleth/shared/xml/schemaBuilderTestDir/schemaBuilderTest-works.xml
similarity index 100%
rename from shib-support/src/test/resources/net/shibboleth/utilities/java/support/xml/schemaBuilderTestDir/schemaBuilderTest-works.xml
rename to shib-support/src/test/resources/net/shibboleth/shared/xml/schemaBuilderTestDir/schemaBuilderTest-works.xml
diff --git a/shib-support/src/test/resources/net/shibboleth/utilities/java/support/xml/serializeSupportTest.xml b/shib-support/src/test/resources/net/shibboleth/shared/xml/serializeSupportTest.xml
similarity index 100%
rename from shib-support/src/test/resources/net/shibboleth/utilities/java/support/xml/serializeSupportTest.xml
rename to shib-support/src/test/resources/net/shibboleth/shared/xml/serializeSupportTest.xml
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list