[java-shib-shared] branch main updated: Phase 3 of refactor, change original artifacts.
Scott Cantor
cantor.2 at osu.edu
Fri Sep 2 12:35:59 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=ae971e69adc54e53b0059d21e9f997c6167980dc
The following commit(s) were added to refs/heads/main by this push:
new ae971e69 Phase 3 of refactor, change original artifacts.
ae971e69 is described below
commit ae971e69adc54e53b0059d21e9f997c6167980dc
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Fri Sep 2 08:35:53 2022 -0400
Phase 3 of refactor, change original artifacts.
---
shib-networking/pom.xml | 4 +-
shib-security/pom.xml | 4 +-
shib-service/pom.xml | 8 ++--
shib-shared-bom/pom.xml | 12 ++++-
shib-spring/pom.xml | 13 +++---
shib-support/pom.xml | 24 ++--------
.../java/support/primitive/StringSupportTest.java | 5 +-
.../java/support/xml/AttributeSupportTest.java | 48 +++++++++----------
.../java/support/xml/BasicParserPoolTest.java | 53 +++++++++++----------
.../java/support/xml/DOMTypeSupportTest.java | 15 +++---
.../java/support/xml/ElementSupportTest.java | 11 ++---
.../java/support/xml/NamespaceSupportTest.java | 12 ++---
.../java/support/xml/QNameSupportTest.java | 17 ++++---
.../java/support/xml/SchemaBuilderTest.java | 54 +++++++++++-----------
.../java/support/xml/SerializeSupportTest.java | 9 ++--
shib-testing/pom.xml | 8 ++--
shib-velocity/pom.xml | 4 +-
17 files changed, 139 insertions(+), 162 deletions(-)
diff --git a/shib-networking/pom.xml b/shib-networking/pom.xml
index 640f1dae..976ebd3c 100644
--- a/shib-networking/pom.xml
+++ b/shib-networking/pom.xml
@@ -22,8 +22,8 @@
<dependencies>
<!-- Compile Dependencies -->
<dependency>
- <groupId>net.shibboleth.utilities</groupId>
- <artifactId>java-support</artifactId>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>shib-support</artifactId>
<version>${project.version}</version>
</dependency>
diff --git a/shib-security/pom.xml b/shib-security/pom.xml
index ecc78234..ef21033c 100644
--- a/shib-security/pom.xml
+++ b/shib-security/pom.xml
@@ -22,8 +22,8 @@
<dependencies>
<!-- Compile Dependencies -->
<dependency>
- <groupId>net.shibboleth.utilities</groupId>
- <artifactId>java-support</artifactId>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>shib-support</artifactId>
<version>${project.version}</version>
</dependency>
diff --git a/shib-service/pom.xml b/shib-service/pom.xml
index 6f09322c..2496418f 100644
--- a/shib-service/pom.xml
+++ b/shib-service/pom.xml
@@ -22,14 +22,14 @@
<dependencies>
<!-- Compile Dependencies -->
<dependency>
- <groupId>net.shibboleth.utilities</groupId>
- <artifactId>java-support</artifactId>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>shib-support</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>net.shibboleth.ext</groupId>
- <artifactId>spring-extensions</artifactId>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>shib-spring</artifactId>
<version>${project.version}</version>
</dependency>
diff --git a/shib-shared-bom/pom.xml b/shib-shared-bom/pom.xml
index 029aeb63..e7e9c562 100644
--- a/shib-shared-bom/pom.xml
+++ b/shib-shared-bom/pom.xml
@@ -15,8 +15,6 @@
<artifactId>shib-shared-bom</artifactId>
<packaging>pom</packaging>
- <!-- TODO: Add renamed java-support and spring-exts when ready. -->
-
<dependencyManagement>
<dependencies>
<dependency>
@@ -34,6 +32,16 @@
<artifactId>shib-service</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>shib-spring</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>shib-support</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>shib-velocity</artifactId>
diff --git a/shib-spring/pom.xml b/shib-spring/pom.xml
index 6f9c62b7..4f15a16a 100644
--- a/shib-spring/pom.xml
+++ b/shib-spring/pom.xml
@@ -10,10 +10,9 @@
<version>9.0.0-SNAPSHOT</version>
</parent>
- <groupId>net.shibboleth.ext</groupId>
- <artifactId>spring-extensions</artifactId>
-
- <name>Spring Framework Extension</name>
+
+ <name>Shibboleth Shared :: Spring Support Classes</name>
+ <artifactId>shib-spring</artifactId>
<description>
A set of extensions for the Spring framework. This package includes things like
factory beans, converters, etc.
@@ -49,13 +48,13 @@
</dependency>
<dependency>
- <groupId>net.shibboleth.utilities</groupId>
- <artifactId>java-support</artifactId>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>shib-support</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>net.shibboleth.shared</groupId>
+ <groupId>${project.groupId}</groupId>
<artifactId>shib-networking</artifactId>
<version>${project.version}</version>
</dependency>
diff --git a/shib-support/pom.xml b/shib-support/pom.xml
index 5095c8ab..b29f1d36 100644
--- a/shib-support/pom.xml
+++ b/shib-support/pom.xml
@@ -10,13 +10,12 @@
<version>9.0.0-SNAPSHOT</version>
</parent>
- <name>java-support</name>
- <groupId>net.shibboleth.utilities</groupId>
- <artifactId>java-support</artifactId>
+ <name>Shibboleth Shared :: Generic Support Classes</name>
+ <artifactId>shib-support</artifactId>
<packaging>jar</packaging>
<properties>
- <automatic.module.name>net.shibboleth.utilities.java.support</automatic.module.name>
+ <automatic.module.name>net.shibboleth.shared.support</automatic.module.name>
<checkstyle.configLocation>${project.basedir}/../resources/checkstyle/checkstyle.xml</checkstyle.configLocation>
</properties>
@@ -46,23 +45,6 @@
<artifactId>logback-core</artifactId>
<scope>test</scope><!-- normally runtime -->
</dependency>
-
- <dependency>
- <groupId>${spring.groupId}</groupId>
- <artifactId>spring-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>${spring.groupId}</groupId>
- <artifactId>spring-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>${spring.groupId}</groupId>
- <artifactId>spring-web</artifactId>
- <scope>test</scope>
- </dependency>
-
</dependencies>
<profiles>
diff --git a/shib-support/src/test/java/net/shibboleth/utilities/java/support/primitive/StringSupportTest.java b/shib-support/src/test/java/net/shibboleth/utilities/java/support/primitive/StringSupportTest.java
index 33a66245..a1eae1cf 100644
--- a/shib-support/src/test/java/net/shibboleth/utilities/java/support/primitive/StringSupportTest.java
+++ b/shib-support/src/test/java/net/shibboleth/utilities/java/support/primitive/StringSupportTest.java
@@ -33,8 +33,6 @@ import java.util.List;
import javax.annotation.Nonnull;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.Resource;
import org.testng.annotations.Test;
import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
@@ -57,8 +55,7 @@ public class StringSupportTest {
@Test public void testInputStreamToString() throws IOException {
String str = null;
- final Resource resource = new ClassPathResource("/net/shibboleth/utilities/java/support/primitive/data.txt");
- try (final InputStream stream = resource.getInputStream()) {
+ try (final InputStream stream = getClass().getResourceAsStream("/net/shibboleth/utilities/java/support/primitive/data.txt")) {
str = StringSupport.inputStreamToString(stream, null);
}
assertNotNull(str);
diff --git a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/AttributeSupportTest.java b/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/AttributeSupportTest.java
index d72d0f33..0297514b 100644
--- a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/AttributeSupportTest.java
+++ b/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/AttributeSupportTest.java
@@ -18,6 +18,7 @@
package net.shibboleth.utilities.java.support.xml;
import java.io.IOException;
+import java.io.InputStream;
import java.time.Duration;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
@@ -32,8 +33,6 @@ import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
import net.shibboleth.utilities.java.support.logic.ConstraintViolationException;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.Resource;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
@@ -85,12 +84,10 @@ public class AttributeSupportTest {
parserPool.initialize();
DocumentBuilder builder = parserPool.getBuilder();
- try {
+ try (final InputStream s = getClass().getResourceAsStream("/net/shibboleth/utilities/java/support/xml/attributeSupportTest.xml")) {
idAttrQName = new QName(TEST_NS, TEST_ID_ATTRIBUTE, TEST_PREFIX);
- Resource resource =
- new ClassPathResource("/net/shibboleth/utilities/java/support/xml/attributeSupportTest.xml");
- Document testFile = builder.parse(resource.getInputStream());
+ Document testFile = builder.parse(s);
Element root = (Element) testFile.getFirstChild();
@@ -141,30 +138,31 @@ public class AttributeSupportTest {
* @throws IOException if badness happens.
*/
@Test public void testBadNS() throws XMLParserException, ComponentInitializationException, IOException {
+
DocumentBuilder builder = parserPool.getBuilder();
- Resource resource = new ClassPathResource("/net/shibboleth/utilities/java/support/xml/badNS1.xml");
- boolean thrown = false;
- Document file = null;
- try {
- file = builder.parse(resource.getInputStream());
- } catch (SAXException e) {
- thrown = true;
+ try (final InputStream s = getClass().getResourceAsStream("/net/shibboleth/utilities/java/support/xml/badNS1.xml")) {
+ boolean thrown = false;
+ try {
+ builder.parse(s);
+ } catch (SAXException e) {
+ thrown = true;
+ }
+ Assert.assertTrue(
+ thrown,
+ "xmlns: declaration with name other than xml and namespace of http://www.w3.org/XML/1998/namespace should throw an error ");
}
- Assert.assertTrue(
- thrown,
- "xmlns: declaration with name other than xml and namespace of http://www.w3.org/XML/1998/namespace should throw an error ");
- resource = new ClassPathResource("/net/shibboleth/utilities/java/support/xml/badNS2.xml");
- thrown = false;
- try {
- file = builder.parse(resource.getInputStream());
- } catch (SAXException e) {
- thrown = true;
+ try (final InputStream s = getClass().getResourceAsStream("/net/shibboleth/utilities/java/support/xml/badNS2.xml")) {
+ boolean thrown = false;
+ try {
+ builder.parse(s);
+ } catch (SAXException e) {
+ thrown = true;
+ }
+ Assert.assertTrue(thrown,
+ "xmlns:xml with namespace other than http://www.w3.org/XML/1998/namespace should throw an error ");
}
- Assert.assertTrue(thrown,
- "xmlns:xml with namespace other than http://www.w3.org/XML/1998/namespace should throw an error ");
- Assert.assertNull(file, "shut up compiler");
parserPool.returnBuilder(builder);
}
diff --git a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/BasicParserPoolTest.java b/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/BasicParserPoolTest.java
index 3510e114..2a4c14fc 100644
--- a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/BasicParserPoolTest.java
+++ b/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/BasicParserPoolTest.java
@@ -42,8 +42,6 @@ import net.shibboleth.utilities.java.support.component.UnmodifiableComponentExce
import net.shibboleth.utilities.java.support.logic.ConstraintViolationException;
import net.shibboleth.utilities.java.support.xml.BasicParserPool.DocumentBuilderProxy;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.Resource;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -99,11 +97,13 @@ public class BasicParserPoolTest {
basicParserPool.setIgnoreComments(true);
basicParserPool.setIgnoreElementContentWhitespace(true);
basicParserPool.setNamespaceAware(true);
- Resource r = new ClassPathResource(SCHEMA_FILE);
- final SchemaBuilder schemaBuilder = new SchemaBuilder();
- schemaBuilder.addSchema(r.getInputStream());
- Schema schema = schemaBuilder.buildSchema();
- basicParserPool.setSchema(schema);
+ final Schema schema;
+ try (final InputStream s = getClass().getResourceAsStream(SCHEMA_FILE)) {
+ final SchemaBuilder schemaBuilder = new SchemaBuilder();
+ schemaBuilder.addSchema(s);
+ schema = schemaBuilder.buildSchema();
+ basicParserPool.setSchema(schema);
+ }
basicParserPool.setXincludeAware(true);
EntityResolver entityResolver = new MockEntityResolver();
basicParserPool.setEntityResolver(entityResolver);
@@ -293,10 +293,12 @@ public class BasicParserPoolTest {
}
Assert.assertTrue(thrown, "setNamespaceAware after init");
- Resource r = new ClassPathResource(SCHEMA_FILE);
- final SchemaBuilder schemaBuilder = new SchemaBuilder();
- schemaBuilder.addSchema(r.getInputStream());
- Schema schema = schemaBuilder.buildSchema();
+ final Schema schema;
+ try (final InputStream s = getClass().getResourceAsStream(SCHEMA_FILE)) {
+ final SchemaBuilder schemaBuilder = new SchemaBuilder();
+ schemaBuilder.addSchema(s);
+ schema = schemaBuilder.buildSchema();
+ }
thrown = false;
try {
@@ -419,10 +421,12 @@ public class BasicParserPoolTest {
}
Assert.assertTrue(thrown, "setNamespaceAware after destroy");
- Resource r = new ClassPathResource(SCHEMA_FILE);
- final SchemaBuilder schemaBuilder = new SchemaBuilder();
- schemaBuilder.addSchema(r.getInputStream());
- Schema schema = schemaBuilder.buildSchema();
+ final Schema schema;
+ try (final InputStream s = getClass().getResourceAsStream(SCHEMA_FILE)) {
+ final SchemaBuilder schemaBuilder = new SchemaBuilder();
+ schemaBuilder.addSchema(s);
+ schema = schemaBuilder.buildSchema();
+ }
thrown = false;
try {
@@ -487,12 +491,13 @@ public class BasicParserPoolTest {
basicParserPool.initialize();
- Resource r = new ClassPathResource(XML_FILE);
-
- checkParsedDocument(basicParserPool.parse(r.getInputStream()));
-
- // Get file name the same way that SchemaBuilderTest does
- checkParsedDocument(basicParserPool.parse(new FileReader("src/test/resources/" + XML_FILE)));
+ try (final InputStream s = getClass().getResourceAsStream(XML_FILE)) {
+
+ checkParsedDocument(basicParserPool.parse(s));
+
+ // Get file name the same way that SchemaBuilderTest does
+ checkParsedDocument(basicParserPool.parse(new FileReader("src/test/resources/" + XML_FILE)));
+ }
}
@Test(expectedExceptions=XMLParserException.class)
@@ -500,9 +505,9 @@ public class BasicParserPoolTest {
basicParserPool.initialize();
- Resource r = new ClassPathResource(DTD_FILE);
-
- basicParserPool.parse(r.getInputStream());
+ try (final InputStream s = getClass().getResourceAsStream(DTD_FILE)) {
+ basicParserPool.parse(s);
+ }
}
@Test public void testNewDocument() throws ComponentInitializationException, XMLParserException {
diff --git a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/DOMTypeSupportTest.java b/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/DOMTypeSupportTest.java
index 93aef435..af448873 100644
--- a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/DOMTypeSupportTest.java
+++ b/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/DOMTypeSupportTest.java
@@ -18,6 +18,7 @@
package net.shibboleth.utilities.java.support.xml;
import java.io.IOException;
+import java.io.InputStream;
import java.time.Duration;
import java.time.Instant;
@@ -26,8 +27,6 @@ import javax.xml.parsers.DocumentBuilder;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.Resource;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -49,16 +48,18 @@ public class DOMTypeSupportTest {
parserPool = pool;
DocumentBuilder builder = parserPool.getBuilder();
- Resource res = new ClassPathResource("/net/shibboleth/utilities/java/support/xml/getXSIType.xml");
- xsStringXSITypeElement = (Element) builder.parse(res.getInputStream()).getFirstChild();
+
+ try (final InputStream s = getClass().getResourceAsStream("/net/shibboleth/utilities/java/support/xml/getXSIType.xml")) {
+ xsStringXSITypeElement = (Element) builder.parse(s).getFirstChild();
+ }
- res = new ClassPathResource("/net/shibboleth/utilities/java/support/xml/noXSIType.xml");
- noXSITypeElement = (Element) builder.parse(res.getInputStream()).getFirstChild();
+ try (final InputStream s = getClass().getResourceAsStream("/net/shibboleth/utilities/java/support/xml/noXSIType.xml")) {
+ noXSITypeElement = (Element) builder.parse(s).getFirstChild();
+ }
if (null != builder) {
parserPool.returnBuilder(builder);
}
-
}
diff --git a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/ElementSupportTest.java b/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/ElementSupportTest.java
index 122d2444..de383fc3 100644
--- a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/ElementSupportTest.java
+++ b/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/ElementSupportTest.java
@@ -18,6 +18,7 @@
package net.shibboleth.utilities.java.support.xml;
import java.io.IOException;
+import java.io.InputStream;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -31,8 +32,6 @@ import net.shibboleth.utilities.java.support.component.ComponentInitializationEx
import net.shibboleth.utilities.java.support.logic.ConstraintViolationException;
import net.shibboleth.utilities.java.support.primitive.StringSupport;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.Resource;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -74,14 +73,10 @@ public class ElementSupportTest {
parserPool.initialize();
DocumentBuilder builder = parserPool.getBuilder();
- try {
-
- Resource resource =
- new ClassPathResource("/net/shibboleth/utilities/java/support/xml/elementSupportTest.xml");
- testFileDocument = builder.parse(resource.getInputStream());
+ try (final InputStream s = getClass().getResourceAsStream("/net/shibboleth/utilities/java/support/xml/elementSupportTest.xml")) {
+ testFileDocument = builder.parse(s);
rootElement = (Element) testFileDocument.getFirstChild();
testerDocument = builder.newDocument();
-
} finally {
parserPool.returnBuilder(builder);
}
diff --git a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/NamespaceSupportTest.java b/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/NamespaceSupportTest.java
index 0d2a4227..f673a3bf 100644
--- a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/NamespaceSupportTest.java
+++ b/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/NamespaceSupportTest.java
@@ -18,13 +18,12 @@
package net.shibboleth.utilities.java.support.xml;
import java.io.IOException;
+import java.io.InputStream;
import javax.xml.parsers.DocumentBuilder;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.Resource;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -71,17 +70,12 @@ public class NamespaceSupportTest {
parserPool = new BasicParserPool();
parserPool.initialize();
DocumentBuilder builder = parserPool.getBuilder();
- try {
- Resource resource =
- new ClassPathResource("/net/shibboleth/utilities/java/support/xml/namespaceSupportTest.xml");
- Document testFile = builder.parse(resource.getInputStream());
+ try (final InputStream s = getClass().getResourceAsStream("/net/shibboleth/utilities/java/support/xml/namespaceSupportTest.xml")) {
+ Document testFile = builder.parse(s);
parent = (Element) testFile.getFirstChild();
-
child = ElementSupport.getFirstChildElement(parent);
-
grandchild = ElementSupport.getFirstChildElement(child);
-
} finally {
parserPool.returnBuilder(builder);
}
diff --git a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/QNameSupportTest.java b/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/QNameSupportTest.java
index 6349ac91..7045951c 100644
--- a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/QNameSupportTest.java
+++ b/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/QNameSupportTest.java
@@ -18,6 +18,7 @@
package net.shibboleth.utilities.java.support.xml;
import java.io.IOException;
+import java.io.InputStream;
import javax.annotation.Nonnull;
import javax.xml.namespace.QName;
@@ -27,8 +28,6 @@ import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
import net.shibboleth.utilities.java.support.logic.ConstraintViolationException;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.Resource;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -70,13 +69,13 @@ public class QNameSupportTest {
parserPool = pool;
DocumentBuilder builder = parserPool.getBuilder();
- Resource resource =
- new ClassPathResource("/net/shibboleth/utilities/java/support/xml/qNameSupportTest.xml");
-
- Document testFile = builder.parse(resource.getInputStream());
- parent = (Element) testFile.getFirstChild();
-
- child = ElementSupport.getFirstChildElement(parent);
+ try (final InputStream s = getClass().getResourceAsStream("/net/shibboleth/utilities/java/support/xml/qNameSupportTest.xml")) {
+
+ Document testFile = builder.parse(s);
+ parent = (Element) testFile.getFirstChild();
+
+ child = ElementSupport.getFirstChildElement(parent);
+ }
if (null != builder) {
parserPool.returnBuilder(builder);
diff --git a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/SchemaBuilderTest.java b/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/SchemaBuilderTest.java
index 46df4825..4612e8c2 100644
--- a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/SchemaBuilderTest.java
+++ b/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/SchemaBuilderTest.java
@@ -19,6 +19,8 @@ package net.shibboleth.utilities.java.support.xml;
import java.io.FileInputStream;
import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
@@ -26,8 +28,6 @@ import javax.xml.validation.Validator;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.Resource;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -46,21 +46,21 @@ public class SchemaBuilderTest {
private static final String SECOND_SCHEMA_FILE = "schemaBuilderTest-schemaSecondLoaded.xsd";
- private Resource works;
+ private URL works;
- private Resource fails;
+ private URL fails;
private StreamSource workingSource() throws IOException {
- return new StreamSource(works.getInputStream());
+ return new StreamSource(works.openStream());
}
private StreamSource failingSource() throws IOException {
- return new StreamSource(fails.getInputStream());
+ return new StreamSource(fails.openStream());
}
@BeforeClass public void setup() {
- works = new ClassPathResource(TEST_DIR + "schemaBuilderTest-works.xml");
- fails = new ClassPathResource(TEST_DIR + "schemaBuilderTest-fails.xml");
+ works = getClass().getResource(TEST_DIR + "schemaBuilderTest-works.xml");
+ fails = getClass().getResource(TEST_DIR + "schemaBuilderTest-fails.xml");
}
@Test public void testFiles() throws SAXException, IOException {
@@ -86,25 +86,27 @@ public class SchemaBuilderTest {
}
@Test public void testInputStream() throws SAXException, IOException, ComponentInitializationException {
- Resource first = new ClassPathResource(TEST_DIR + FIRST_SCHEMA_FILE);
- Resource second = new ClassPathResource(TEST_DIR + SECOND_SCHEMA_FILE);
-
- final SchemaBuilder builder = new SchemaBuilder();
- builder.addSchema(first.getInputStream());
- builder.addSchema(second.getInputStream());
- Schema schema = builder.buildSchema();
-
- Validator validator = schema.newValidator();
-
- validator.validate(workingSource());
-
- boolean thrown = false;
- try {
- validator.validate(failingSource());
- } catch (final Exception e) {
- thrown = true;
+
+ try (final InputStream first = getClass().getResourceAsStream(TEST_DIR + FIRST_SCHEMA_FILE);
+ final InputStream second = getClass().getResourceAsStream(TEST_DIR + SECOND_SCHEMA_FILE)) {
+
+ final SchemaBuilder builder = new SchemaBuilder();
+ builder.addSchema(first);
+ builder.addSchema(second);
+ Schema schema = builder.buildSchema();
+
+ Validator validator = schema.newValidator();
+
+ validator.validate(workingSource());
+
+ boolean thrown = false;
+ try {
+ validator.validate(failingSource());
+ } catch (final Exception e) {
+ thrown = true;
+ }
+ Assert.assertTrue(thrown, "Should fail to validate");
}
- Assert.assertTrue(thrown, "Should fail to validate");
}
/*
diff --git a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/SerializeSupportTest.java b/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/SerializeSupportTest.java
index 552c0fc7..53bcb9ca 100644
--- a/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/SerializeSupportTest.java
+++ b/shib-support/src/test/java/net/shibboleth/utilities/java/support/xml/SerializeSupportTest.java
@@ -20,12 +20,11 @@ package net.shibboleth.utilities.java.support.xml;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.io.StringReader;
import javax.xml.parsers.DocumentBuilder;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.Resource;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -142,10 +141,8 @@ public class SerializeSupportTest {
parserPool = new BasicParserPool();
parserPool.initialize();
final DocumentBuilder builder = parserPool.getBuilder();
- try {
- final Resource resource =
- new ClassPathResource("/net/shibboleth/utilities/java/support/xml/serializeSupportTest.xml");
- final Document testFile = builder.parse(resource.getInputStream());
+ try (final InputStream s = getClass().getResourceAsStream("/net/shibboleth/utilities/java/support/xml/serializeSupportTest.xml")) {
+ final Document testFile = builder.parse(s);
parent = (Element) testFile.getFirstChild();
diff --git a/shib-testing/pom.xml b/shib-testing/pom.xml
index 08c9026d..f70723a1 100644
--- a/shib-testing/pom.xml
+++ b/shib-testing/pom.xml
@@ -22,14 +22,14 @@
<dependencies>
<!-- Compile Dependencies -->
<dependency>
- <groupId>net.shibboleth.utilities</groupId>
- <artifactId>java-support</artifactId>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>shib-support</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>net.shibboleth.ext</groupId>
- <artifactId>spring-extensions</artifactId>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>shib-spring</artifactId>
<version>${project.version}</version>
</dependency>
diff --git a/shib-velocity/pom.xml b/shib-velocity/pom.xml
index f1bd1c54..2bbe56b5 100644
--- a/shib-velocity/pom.xml
+++ b/shib-velocity/pom.xml
@@ -22,8 +22,8 @@
<dependencies>
<!-- Compile Dependencies -->
<dependency>
- <groupId>net.shibboleth.utilities</groupId>
- <artifactId>java-support</artifactId>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>shib-support</artifactId>
<version>${project.version}</version>
</dependency>
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list