[java-shib-shared] branch main updated: Move HTTP client Spring support into new module.
Scott Cantor
cantor.2 at osu.edu
Tue Sep 13 18:33:47 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=1d7290ef76fc4d98a6c66100c996a8b7f50b3baa
The following commit(s) were added to refs/heads/main by this push:
new 1d7290ef Move HTTP client Spring support into new module.
1d7290ef is described below
commit 1d7290ef76fc4d98a6c66100c996a8b7f50b3baa
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Sep 13 14:33:44 2022 -0400
Move HTTP client Spring support into new module.
---
pom.xml | 1 +
shib-networking-spring/.check-m2 | 1 +
shib-networking-spring/.checkstyle | 15 ++++
shib-networking-spring/.gitignore | 21 +++++
shib-networking-spring/pom.xml | 91 ++++++++++++++++++++++
.../factory/FileCachingHttpClientFactoryBean.java | 2 +-
.../httpclient}/factory/HttpClientFactoryBean.java | 2 +-
.../InMemoryCachingHttpClientFactoryBean.java | 2 +-
.../spring/httpclient/factory/package-info.java | 32 +-------
.../resource/FileBackedHTTPResource.java | 2 +-
.../spring/httpclient}/resource/HTTPResource.java | 2 +-
.../spring/httpclient/resource/package-info.java | 32 +-------
.../resource/ConditionalResourceTest.java | 15 ++--
.../resource/FileBackedHTTPResourceTest.java | 18 +++--
.../httpclient}/resource/HTTPResourceTest.java | 20 ++---
.../httpclient}/resource/RepositorySupport.java | 2 +-
.../httpclient}/resource/ResourceTestHelper.java | 2 +-
.../httpclient}/resource/TestHTTPResource.java | 2 +-
.../httpclient}/resource/FileBackedHTTPBean.xml | 4 +-
.../httpclient}/resource/MemBackedHTTPBean.xml | 4 +-
.../httpclient}/resource/conditional-import.xml | 2 +-
.../spring/httpclient}/resource/conditional.xml | 0
.../shared/spring/httpclient/resource/document.xml | 4 +
.../spring/httpclient}/resource/newStyle.xml | 10 +--
shib-shared-bom/pom.xml | 5 ++
shib-spring/pom.xml | 24 ++----
26 files changed, 199 insertions(+), 116 deletions(-)
diff --git a/pom.xml b/pom.xml
index d97b439e..83765a9e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,6 +28,7 @@
<module>shib-support</module>
<module>shib-spring</module>
<module>shib-networking</module>
+ <module>shib-networking-spring</module>
<module>shib-security</module>
<module>shib-security-spring</module>
<module>shib-service</module>
diff --git a/shib-networking-spring/.check-m2 b/shib-networking-spring/.check-m2
new file mode 100644
index 00000000..048849a0
--- /dev/null
+++ b/shib-networking-spring/.check-m2
@@ -0,0 +1 @@
+This file provokes a signature check of the maven repository unless overridden by the no-check-m2 property.
\ No newline at end of file
diff --git a/shib-networking-spring/.checkstyle b/shib-networking-spring/.checkstyle
new file mode 100644
index 00000000..186d7f35
--- /dev/null
+++ b/shib-networking-spring/.checkstyle
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<fileset-config file-format-version="1.2.0" simple-config="false" sync-formatter="false">
+
+ <local-check-config name="Shibboleth Checkstyle" location="/java-shib-shared/resources/checkstyle/checkstyle.xml" type="project" description="">
+ <additional-data name="cache-file" value="true"/>
+ <additional-data name="cache-props-file-location" value="null_1312636288299_cache.properties"/>
+ <additional-data name="cache-file-location" value="null_1312636288299_cache.xml"/>
+ </local-check-config>
+
+ <fileset name="main source" enabled="true" check-config-name="Shibboleth Checkstyle" local="true">
+ <file-match-pattern match-pattern="src/main/java/.*\.java$" include-pattern="true"/>
+ </fileset>
+
+</fileset-config>
diff --git a/shib-networking-spring/.gitignore b/shib-networking-spring/.gitignore
new file mode 100644
index 00000000..d8e6f876
--- /dev/null
+++ b/shib-networking-spring/.gitignore
@@ -0,0 +1,21 @@
+# A simulation of Subversion default ignores, generated by reposurgeon.
+*.o
+*.lo
+*.la
+*.al
+*.libs
+*.so
+*.so.[0-9]*
+*.a
+*.pyc
+*.pyo
+*.rej
+*.iml
+*~
+*.#*
+.*.swp
+.DS_store
+# Simulated Subversion default ignores end here
+# The contents of the svn:ignore property on the branch root.
+/test-output
+/target
diff --git a/shib-networking-spring/pom.xml b/shib-networking-spring/pom.xml
new file mode 100644
index 00000000..103b49cd
--- /dev/null
+++ b/shib-networking-spring/pom.xml
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>net.shibboleth</groupId>
+ <artifactId>shib-shared-parent</artifactId>
+ <version>9.0.0-SNAPSHOT</version>
+ </parent>
+
+ <name>Shibboleth Shared :: Networking Spring Support</name>
+ <artifactId>shib-networking-spring</artifactId>
+ <packaging>jar</packaging>
+
+ <properties>
+ <automatic.module.name>net.shibboleth.shared.spring.networking</automatic.module.name>
+ <checkstyle.configLocation>${project.basedir}/../resources/checkstyle/checkstyle.xml</checkstyle.configLocation>
+ </properties>
+
+ <dependencies>
+ <!-- Compile Dependencies -->
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>shib-networking</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>org.apache.httpcomponents</groupId>
+ <artifactId>httpcore</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient-cache</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${spring.groupId}</groupId>
+ <artifactId>spring-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${spring.groupId}</groupId>
+ <artifactId>spring-beans</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${spring.groupId}</groupId>
+ <artifactId>spring-context</artifactId>
+ </dependency>
+
+ <!-- Provided dependencies -->
+
+ <!-- Runtime Dependencies -->
+
+ <!-- Test Dependencies -->
+ <dependency>
+ <groupId>${spring.groupId}</groupId>
+ <artifactId>spring-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <scm>
+ <connection>${shibboleth.scm.connection}java-shib-shared</connection>
+ <developerConnection>${shibboleth.scm.developerConnection}java-shib-shared</developerConnection>
+ <url>${shibboleth.scm.url}java-shib-shared.git</url>
+ </scm>
+
+ <distributionManagement>
+ <site>
+ <id>site</id>
+ <url>scp:${shared-module.site.url}</url>
+ </site>
+ </distributionManagement>
+
+</project>
diff --git a/shib-spring/src/main/java/net/shibboleth/ext/spring/factory/FileCachingHttpClientFactoryBean.java b/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/httpclient/factory/FileCachingHttpClientFactoryBean.java
similarity index 97%
rename from shib-spring/src/main/java/net/shibboleth/ext/spring/factory/FileCachingHttpClientFactoryBean.java
rename to shib-networking-spring/src/main/java/net/shibboleth/shared/spring/httpclient/factory/FileCachingHttpClientFactoryBean.java
index b11e78cb..13688122 100644
--- a/shib-spring/src/main/java/net/shibboleth/ext/spring/factory/FileCachingHttpClientFactoryBean.java
+++ b/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/httpclient/factory/FileCachingHttpClientFactoryBean.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.ext.spring.factory;
+package net.shibboleth.shared.spring.httpclient.factory;
import javax.annotation.Nullable;
diff --git a/shib-spring/src/main/java/net/shibboleth/ext/spring/factory/HttpClientFactoryBean.java b/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/httpclient/factory/HttpClientFactoryBean.java
similarity index 97%
rename from shib-spring/src/main/java/net/shibboleth/ext/spring/factory/HttpClientFactoryBean.java
rename to shib-networking-spring/src/main/java/net/shibboleth/shared/spring/httpclient/factory/HttpClientFactoryBean.java
index ec2d6161..e0151668 100644
--- a/shib-spring/src/main/java/net/shibboleth/ext/spring/factory/HttpClientFactoryBean.java
+++ b/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/httpclient/factory/HttpClientFactoryBean.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.ext.spring.factory;
+package net.shibboleth.shared.spring.httpclient.factory;
import javax.annotation.Nullable;
diff --git a/shib-spring/src/main/java/net/shibboleth/ext/spring/factory/InMemoryCachingHttpClientFactoryBean.java b/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/httpclient/factory/InMemoryCachingHttpClientFactoryBean.java
similarity index 97%
rename from shib-spring/src/main/java/net/shibboleth/ext/spring/factory/InMemoryCachingHttpClientFactoryBean.java
rename to shib-networking-spring/src/main/java/net/shibboleth/shared/spring/httpclient/factory/InMemoryCachingHttpClientFactoryBean.java
index 272dd96f..dc7738d8 100644
--- a/shib-spring/src/main/java/net/shibboleth/ext/spring/factory/InMemoryCachingHttpClientFactoryBean.java
+++ b/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/httpclient/factory/InMemoryCachingHttpClientFactoryBean.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.ext.spring.factory;
+package net.shibboleth.shared.spring.httpclient.factory;
import javax.annotation.Nullable;
diff --git a/shib-spring/src/test/java/net/shibboleth/ext/spring/resource/TestHTTPResource.java b/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/httpclient/factory/package-info.java
similarity index 52%
copy from shib-spring/src/test/java/net/shibboleth/ext/spring/resource/TestHTTPResource.java
copy to shib-networking-spring/src/main/java/net/shibboleth/shared/spring/httpclient/factory/package-info.java
index 69066ba3..5dd9d72b 100644
--- a/shib-spring/src/test/java/net/shibboleth/ext/spring/resource/TestHTTPResource.java
+++ b/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/httpclient/factory/package-info.java
@@ -15,31 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.ext.spring.resource;
-
-import java.io.IOException;
-
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.cache.CacheResponseStatus;
-import org.apache.http.client.cache.HttpCacheContext;
-
-class TestHTTPResource extends HTTPResource {
-
- private CacheResponseStatus responseStatus;
-
- public TestHTTPResource(final HttpClient client, final String url) throws IOException {
- super(client, url);
- }
-
- /** {@inheritDoc} */
- @Override protected void reportCachingStatus(final HttpCacheContext context) {
- responseStatus = context.getCacheResponseStatus();
-
- super.reportCachingStatus(context);
- }
-
- public CacheResponseStatus getLastCacheResponseStatus() {
- return responseStatus;
- }
-
-}
\ No newline at end of file
+/**
+ * Factory beans for HttpClient objects.
+ */
+package net.shibboleth.shared.spring.httpclient.factory;
diff --git a/shib-spring/src/main/java/net/shibboleth/ext/spring/resource/FileBackedHTTPResource.java b/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/httpclient/resource/FileBackedHTTPResource.java
similarity index 99%
rename from shib-spring/src/main/java/net/shibboleth/ext/spring/resource/FileBackedHTTPResource.java
rename to shib-networking-spring/src/main/java/net/shibboleth/shared/spring/httpclient/resource/FileBackedHTTPResource.java
index 5d7b25f8..0165de90 100644
--- a/shib-spring/src/main/java/net/shibboleth/ext/spring/resource/FileBackedHTTPResource.java
+++ b/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/httpclient/resource/FileBackedHTTPResource.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.ext.spring.resource;
+package net.shibboleth.shared.spring.httpclient.resource;
import java.io.File;
import java.io.FileInputStream;
diff --git a/shib-spring/src/main/java/net/shibboleth/ext/spring/resource/HTTPResource.java b/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/httpclient/resource/HTTPResource.java
similarity index 99%
rename from shib-spring/src/main/java/net/shibboleth/ext/spring/resource/HTTPResource.java
rename to shib-networking-spring/src/main/java/net/shibboleth/shared/spring/httpclient/resource/HTTPResource.java
index d74e9089..00511ac8 100644
--- a/shib-spring/src/main/java/net/shibboleth/ext/spring/resource/HTTPResource.java
+++ b/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/httpclient/resource/HTTPResource.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.ext.spring.resource;
+package net.shibboleth.shared.spring.httpclient.resource;
import java.io.File;
import java.io.FileNotFoundException;
diff --git a/shib-spring/src/test/java/net/shibboleth/ext/spring/resource/TestHTTPResource.java b/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/httpclient/resource/package-info.java
similarity index 52%
copy from shib-spring/src/test/java/net/shibboleth/ext/spring/resource/TestHTTPResource.java
copy to shib-networking-spring/src/main/java/net/shibboleth/shared/spring/httpclient/resource/package-info.java
index 69066ba3..8a2c0ebd 100644
--- a/shib-spring/src/test/java/net/shibboleth/ext/spring/resource/TestHTTPResource.java
+++ b/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/httpclient/resource/package-info.java
@@ -15,31 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.ext.spring.resource;
-
-import java.io.IOException;
-
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.cache.CacheResponseStatus;
-import org.apache.http.client.cache.HttpCacheContext;
-
-class TestHTTPResource extends HTTPResource {
-
- private CacheResponseStatus responseStatus;
-
- public TestHTTPResource(final HttpClient client, final String url) throws IOException {
- super(client, url);
- }
-
- /** {@inheritDoc} */
- @Override protected void reportCachingStatus(final HttpCacheContext context) {
- responseStatus = context.getCacheResponseStatus();
-
- super.reportCachingStatus(context);
- }
-
- public CacheResponseStatus getLastCacheResponseStatus() {
- return responseStatus;
- }
-
-}
\ No newline at end of file
+/**
+ * Spring resource classes supporting HttpClient access.
+ */
+package net.shibboleth.shared.spring.httpclient.resource;
\ No newline at end of file
diff --git a/shib-spring/src/test/java/net/shibboleth/ext/spring/resource/ConditionalResourceTest.java b/shib-networking-spring/src/test/java/net/shibboleth/shared/spring/httpclient/resource/ConditionalResourceTest.java
similarity index 92%
rename from shib-spring/src/test/java/net/shibboleth/ext/spring/resource/ConditionalResourceTest.java
rename to shib-networking-spring/src/test/java/net/shibboleth/shared/spring/httpclient/resource/ConditionalResourceTest.java
index 6bc02514..609b6e31 100644
--- a/shib-spring/src/test/java/net/shibboleth/ext/spring/resource/ConditionalResourceTest.java
+++ b/shib-networking-spring/src/test/java/net/shibboleth/shared/spring/httpclient/resource/ConditionalResourceTest.java
@@ -15,10 +15,12 @@
* limitations under the License.
*/
-package net.shibboleth.ext.spring.resource;
+package net.shibboleth.shared.spring.httpclient.resource;
import java.io.IOException;
+import net.shibboleth.ext.spring.resource.ConditionalResource;
+import net.shibboleth.ext.spring.resource.ConditionalResourceResolver;
import net.shibboleth.ext.spring.util.SchemaTypeAwareXMLBeanDefinitionReader;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
import net.shibboleth.utilities.java.support.httpclient.HttpClientBuilder;
@@ -40,6 +42,8 @@ import org.testng.annotations.Test;
@SuppressWarnings("javadoc")
public class ConditionalResourceTest {
+ private final String documentPath = "/net/shibboleth/shared/spring/httpclient/resource/document.xml";
+
private final String existsURL = RepositorySupport.buildHTTPResourceURL("spring-extensions", "src/test/resources/net/shibboleth/ext/spring/resource/document.xml",false);
private final String nonExistsURL = RepositorySupport.buildHTTPResourceURL("spring-extensions.git", "trunk/src/test/resources/data/document.xml",false);
@@ -113,13 +117,12 @@ public class ConditionalResourceTest {
existsResource.setId("test");
existsResource.initialize();
- Assert.assertTrue(ResourceTestHelper.compare(existsResource, new ClassPathResource(
- "net/shibboleth/ext/spring/resource/document.xml")));
+ Assert.assertTrue(ResourceTestHelper.compare(existsResource, new ClassPathResource(documentPath)));
}
@Test public void testBeanExists() throws ComponentInitializationException {
final ClassPathResource existsCPResource =
- new ClassPathResource("net/shibboleth/ext/spring/resource/conditional.xml");
+ new ClassPathResource("net/shibboleth/shared/spring/httpclient/resource/conditional.xml");
final ConditionalResource existsResource = new ConditionalResource(existsCPResource);
existsResource.setId("test");
existsResource.initialize();
@@ -139,7 +142,7 @@ public class ConditionalResourceTest {
@Test public void testBeanMissing() throws ComponentInitializationException {
final ClassPathResource missingCPResource =
- new ClassPathResource("net/shibboleth/ext/spring/resource/missing.xml");
+ new ClassPathResource("net/shibboleth/shared/spring/httpclient/resource/missing.xml");
final ConditionalResource missingResource = new ConditionalResource(missingCPResource);
missingResource.setId("test");
missingResource.initialize();
@@ -159,7 +162,7 @@ public class ConditionalResourceTest {
@Test public void testImport() {
final ClassPathResource resource =
- new ClassPathResource("net/shibboleth/ext/spring/resource/conditional-import.xml");
+ new ClassPathResource("net/shibboleth/shared/spring/httpclient/resource/conditional-import.xml");
final GenericApplicationContext parentContext = new GenericApplicationContext();
parentContext.refresh(); // THIS IS REQUIRED
diff --git a/shib-spring/src/test/java/net/shibboleth/ext/spring/resource/FileBackedHTTPResourceTest.java b/shib-networking-spring/src/test/java/net/shibboleth/shared/spring/httpclient/resource/FileBackedHTTPResourceTest.java
similarity index 88%
rename from shib-spring/src/test/java/net/shibboleth/ext/spring/resource/FileBackedHTTPResourceTest.java
rename to shib-networking-spring/src/test/java/net/shibboleth/shared/spring/httpclient/resource/FileBackedHTTPResourceTest.java
index c6286578..c852b12d 100644
--- a/shib-spring/src/test/java/net/shibboleth/ext/spring/resource/FileBackedHTTPResourceTest.java
+++ b/shib-networking-spring/src/test/java/net/shibboleth/shared/spring/httpclient/resource/FileBackedHTTPResourceTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.ext.spring.resource;
+package net.shibboleth.shared.spring.httpclient.resource;
import java.io.File;
import java.io.IOException;
@@ -43,6 +43,8 @@ import org.testng.annotations.Test;
@SuppressWarnings("javadoc")
public class FileBackedHTTPResourceTest {
+ private final String documentPath = "/net/shibboleth/shared/spring/httpclient/resource/document.xml";
+
private final String existsURL =
"https://git.shibboleth.net/view/?p=spring-extensions.git;a=blob_plain;f=src/test/resources/data/document.xml;h=e8ec7c0d20c7a6b8193e1868398cda0c28df45ed;hb=HEAD";
@@ -77,10 +79,10 @@ public class FileBackedHTTPResourceTest {
@Test public void testCompare() throws IOException {
Assert.assertTrue(ResourceTestHelper.compare(new FileBackedHTTPResource(existsFile, client, existsURL),
- new ClassPathResource("net/shibboleth/ext/spring/resource/document.xml")));
+ new ClassPathResource(documentPath)));
// With that done compare via the backup
Assert.assertTrue(ResourceTestHelper.compare(new FileBackedHTTPResource(existsFile, client, nonExistsURL),
- new ClassPathResource("net/shibboleth/ext/spring/resource/document.xml")));
+ new ClassPathResource(documentPath)));
}
public GenericApplicationContext getContext(final String location) {
@@ -117,17 +119,17 @@ public class FileBackedHTTPResourceTest {
@Test public void testParsingNew() throws IOException {
- try (final GenericApplicationContext context = getContext("net/shibboleth/ext/spring/resource/newStyle.xml")) {
+ try (final GenericApplicationContext context = getContext("net/shibboleth/shared/spring/httpclient/resource/newStyle.xml")) {
Assert.assertTrue(ResourceTestHelper.compare(context.getBean("namedString", FileBackedHTTPResource.class),
- new ClassPathResource("net/shibboleth/ext/spring/resource/document.xml")));
+ new ClassPathResource(documentPath)));
Assert.assertTrue(ResourceTestHelper.compare(context.getBean("namedURL", FileBackedHTTPResource.class),
- new ClassPathResource("net/shibboleth/ext/spring/resource/document.xml")));
+ new ClassPathResource(documentPath)));
Assert.assertTrue(ResourceTestHelper.compare(context
.getBean("numberedString", FileBackedHTTPResource.class),
- new ClassPathResource("net/shibboleth/ext/spring/resource/document.xml")));
+ new ClassPathResource(documentPath)));
Assert.assertTrue(ResourceTestHelper.compare(context.getBean("numberedURL", FileBackedHTTPResource.class),
- new ClassPathResource("net/shibboleth/ext/spring/resource/document.xml")));
+ new ClassPathResource(documentPath)));
}
}
diff --git a/shib-spring/src/test/java/net/shibboleth/ext/spring/resource/HTTPResourceTest.java b/shib-networking-spring/src/test/java/net/shibboleth/shared/spring/httpclient/resource/HTTPResourceTest.java
similarity index 93%
rename from shib-spring/src/test/java/net/shibboleth/ext/spring/resource/HTTPResourceTest.java
rename to shib-networking-spring/src/test/java/net/shibboleth/shared/spring/httpclient/resource/HTTPResourceTest.java
index 26c39925..48a7992f 100644
--- a/shib-spring/src/test/java/net/shibboleth/ext/spring/resource/HTTPResourceTest.java
+++ b/shib-networking-spring/src/test/java/net/shibboleth/shared/spring/httpclient/resource/HTTPResourceTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.ext.spring.resource;
+package net.shibboleth.shared.spring.httpclient.resource;
import java.io.File;
import java.io.IOException;
@@ -47,6 +47,8 @@ import net.shibboleth.utilities.java.support.httpclient.InMemoryCachingHttpClien
@SuppressWarnings("javadoc")
public class HTTPResourceTest {
+ private final String documentPath = "/net/shibboleth/shared/spring/httpclient/resource/document.xml";
+
private final String existsURL =
"https://git.shibboleth.net/view/?p=spring-extensions.git;a=blob_plain;f=src/test/resources/data/document.xml;h=e8ec7c0d20c7a6b8193e1868398cda0c28df45ed;hb=HEAD";
@@ -107,8 +109,7 @@ public class HTTPResourceTest {
@Test public void testCompare() throws IOException {
- Assert.assertTrue(ResourceTestHelper.compare(new HTTPResource(client, existsURL), new ClassPathResource(
- "net/shibboleth/ext/spring/resource/document.xml")));
+ Assert.assertTrue(ResourceTestHelper.compare(new HTTPResource(client, existsURL), new ClassPathResource(documentPath)));
}
@Test public void testRelated() throws IOException {
@@ -132,7 +133,7 @@ public class HTTPResourceTest {
final TestHTTPResource what = new TestHTTPResource(client, existsURL);
Assert.assertTrue(what.exists());
Assert.assertNull(what.getLastCacheResponseStatus());
- Assert.assertTrue(ResourceTestHelper.compare(what, new ClassPathResource("net/shibboleth/ext/spring/resource/document.xml")));
+ Assert.assertTrue(ResourceTestHelper.compare(what, new ClassPathResource(documentPath)));
Assert.assertNull(what.getLastCacheResponseStatus());
}
@@ -143,7 +144,7 @@ public class HTTPResourceTest {
final TestHTTPResource what = new TestHTTPResource(builder.buildClient(), existsURL);
Assert.assertTrue(what.exists());
Assert.assertNotNull(what.getLastCacheResponseStatus());
- Assert.assertTrue(ResourceTestHelper.compare(what, new ClassPathResource("net/shibboleth/ext/spring/resource/document.xml")));
+ Assert.assertTrue(ResourceTestHelper.compare(what, new ClassPathResource(documentPath)));
Assert.assertEquals(what.getLastCacheResponseStatus(), CacheResponseStatus.CACHE_HIT);
}
@@ -167,7 +168,8 @@ public class HTTPResourceTest {
@Test public void springLoadMemCache() throws IOException {
- final GenericApplicationContext context = getContext("classpath:net/shibboleth/ext/spring/resource/MemBackedHTTPBean.xml", null);
+ final GenericApplicationContext context =
+ getContext("classpath:/net/shibboleth/shared/spring/httpclient/resource/MemBackedHTTPBean.xml", null);
try {
final Collection<TestHTTPResource> beans = context.getBeansOfType(TestHTTPResource.class).values();
@@ -177,7 +179,7 @@ public class HTTPResourceTest {
Assert.assertTrue(what.exists());
Assert.assertNotNull(what.getLastCacheResponseStatus());
- Assert.assertTrue(ResourceTestHelper.compare(what, new ClassPathResource("net/shibboleth/ext/spring/resource/document.xml")));
+ Assert.assertTrue(ResourceTestHelper.compare(what, new ClassPathResource(documentPath)));
Assert.assertEquals(what.getLastCacheResponseStatus(), CacheResponseStatus.CACHE_HIT);
} finally {
@@ -202,7 +204,7 @@ public class HTTPResourceTest {
try {
final Path p = Files.createTempDirectory("HTTPResourceTest");
theDir = p.toFile();
- context = getContext("classpath:net/shibboleth/ext/spring/resource/MemBackedHTTPBean.xml", null);
+ context = getContext("classpath:/net/shibboleth/shared/spring/httpclient/resource/MemBackedHTTPBean.xml", null);
final Collection<TestHTTPResource> beans = context.getBeansOfType(TestHTTPResource.class).values();
Assert.assertEquals(beans.size(), 1);
@@ -210,7 +212,7 @@ public class HTTPResourceTest {
Assert.assertTrue(what.exists());
Assert.assertNotNull(what.getLastCacheResponseStatus());
- Assert.assertTrue(ResourceTestHelper.compare(what, new ClassPathResource("net/shibboleth/ext/spring/resource/document.xml")));
+ Assert.assertTrue(ResourceTestHelper.compare(what, new ClassPathResource(documentPath)));
Assert.assertEquals(what.getLastCacheResponseStatus(), CacheResponseStatus.CACHE_HIT);
} finally {
diff --git a/shib-spring/src/test/java/net/shibboleth/ext/spring/resource/RepositorySupport.java b/shib-networking-spring/src/test/java/net/shibboleth/shared/spring/httpclient/resource/RepositorySupport.java
similarity index 98%
rename from shib-spring/src/test/java/net/shibboleth/ext/spring/resource/RepositorySupport.java
rename to shib-networking-spring/src/test/java/net/shibboleth/shared/spring/httpclient/resource/RepositorySupport.java
index 11b4a78d..52000a33 100644
--- a/shib-spring/src/test/java/net/shibboleth/ext/spring/resource/RepositorySupport.java
+++ b/shib-networking-spring/src/test/java/net/shibboleth/shared/spring/httpclient/resource/RepositorySupport.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.ext.spring.resource;
+package net.shibboleth.shared.spring.httpclient.resource;
import javax.annotation.Nonnull;
diff --git a/shib-spring/src/test/java/net/shibboleth/ext/spring/resource/ResourceTestHelper.java b/shib-networking-spring/src/test/java/net/shibboleth/shared/spring/httpclient/resource/ResourceTestHelper.java
similarity index 97%
rename from shib-spring/src/test/java/net/shibboleth/ext/spring/resource/ResourceTestHelper.java
rename to shib-networking-spring/src/test/java/net/shibboleth/shared/spring/httpclient/resource/ResourceTestHelper.java
index 2fc95627..73c889c0 100644
--- a/shib-spring/src/test/java/net/shibboleth/ext/spring/resource/ResourceTestHelper.java
+++ b/shib-networking-spring/src/test/java/net/shibboleth/shared/spring/httpclient/resource/ResourceTestHelper.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.ext.spring.resource;
+package net.shibboleth.shared.spring.httpclient.resource;
import java.io.IOException;
import java.io.InputStream;
diff --git a/shib-spring/src/test/java/net/shibboleth/ext/spring/resource/TestHTTPResource.java b/shib-networking-spring/src/test/java/net/shibboleth/shared/spring/httpclient/resource/TestHTTPResource.java
similarity index 96%
rename from shib-spring/src/test/java/net/shibboleth/ext/spring/resource/TestHTTPResource.java
rename to shib-networking-spring/src/test/java/net/shibboleth/shared/spring/httpclient/resource/TestHTTPResource.java
index 69066ba3..75a3ca13 100644
--- a/shib-spring/src/test/java/net/shibboleth/ext/spring/resource/TestHTTPResource.java
+++ b/shib-networking-spring/src/test/java/net/shibboleth/shared/spring/httpclient/resource/TestHTTPResource.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.ext.spring.resource;
+package net.shibboleth.shared.spring.httpclient.resource;
import java.io.IOException;
diff --git a/shib-spring/src/test/resources/net/shibboleth/ext/spring/resource/FileBackedHTTPBean.xml b/shib-networking-spring/src/test/resources/net/shibboleth/shared/spring/httpclient/resource/FileBackedHTTPBean.xml
similarity index 84%
rename from shib-spring/src/test/resources/net/shibboleth/ext/spring/resource/FileBackedHTTPBean.xml
rename to shib-networking-spring/src/test/resources/net/shibboleth/shared/spring/httpclient/resource/FileBackedHTTPBean.xml
index aacf7693..ddb75918 100644
--- a/shib-spring/src/test/resources/net/shibboleth/ext/spring/resource/FileBackedHTTPBean.xml
+++ b/shib-networking-spring/src/test/resources/net/shibboleth/shared/spring/httpclient/resource/FileBackedHTTPBean.xml
@@ -11,11 +11,11 @@
<bean id="apacheClient" factory-bean="clientBuilder" init-method="initialize" destroy-method="destroy"
factory-method="buildClient" />
- <bean id="ShibResource" class="net.shibboleth.ext.spring.resource.HTTPResource"
+ <bean id="ShibResource" class="net.shibboleth.shared.spring.httpclient.resource.HTTPResource"
c:client-ref="apacheClient" c:url="http://git.shibboleth.net/view/?p=spring-extensions.git;a=blob_plain;f=src/test/resources/data/document.xml;h=e8ec7c0d20c7a6b8193e1868398cda0c28df45ed;hb=HEAD" />
<!-- for testing we will use our test resource -->
- <bean id="TestResource" class="net.shibboleth.ext.spring.resource.TestHTTPResource"
+ <bean id="TestResource" class="net.shibboleth.shared.spring.httpclient.resource.TestHTTPResource"
c:client-ref="apacheClient" c:url="http://git.shibboleth.net/view/?p=spring-extensions.git;a=blob_plain;f=src/test/resources/data/document.xml;h=e8ec7c0d20c7a6b8193e1868398cda0c28df45ed;hb=HEAD" />
</beans>
\ No newline at end of file
diff --git a/shib-spring/src/test/resources/net/shibboleth/ext/spring/resource/MemBackedHTTPBean.xml b/shib-networking-spring/src/test/resources/net/shibboleth/shared/spring/httpclient/resource/MemBackedHTTPBean.xml
similarity index 84%
rename from shib-spring/src/test/resources/net/shibboleth/ext/spring/resource/MemBackedHTTPBean.xml
rename to shib-networking-spring/src/test/resources/net/shibboleth/shared/spring/httpclient/resource/MemBackedHTTPBean.xml
index 10787301..238fb3a4 100644
--- a/shib-spring/src/test/resources/net/shibboleth/ext/spring/resource/MemBackedHTTPBean.xml
+++ b/shib-networking-spring/src/test/resources/net/shibboleth/shared/spring/httpclient/resource/MemBackedHTTPBean.xml
@@ -10,11 +10,11 @@
factory-bean="clientBuilder"
factory-method="buildClient"/>
- <bean id="Resource" class="net.shibboleth.ext.spring.resource.HTTPResource"
+ <bean id="Resource" class="net.shibboleth.shared.spring.httpclient.resource.HTTPResource"
c:client-ref="apacheClient" c:url="http://git.shibboleth.net/view/?p=spring-extensions.git;a=blob_plain;f=src/test/resources/data/document.xml;h=e8ec7c0d20c7a6b8193e1868398cda0c28df45ed;hb=HEAD" />
<!-- for testing we will use our test resource -->
- <bean id="TestResource" class="net.shibboleth.ext.spring.resource.TestHTTPResource"
+ <bean id="TestResource" class="net.shibboleth.shared.spring.httpclient.resource.TestHTTPResource"
c:client-ref="apacheClient" c:url="http://git.shibboleth.net/view/?p=spring-extensions.git;a=blob_plain;f=src/test/resources/data/document.xml;h=e8ec7c0d20c7a6b8193e1868398cda0c28df45ed;hb=HEAD" />
</beans>
\ No newline at end of file
diff --git a/shib-spring/src/test/resources/net/shibboleth/ext/spring/resource/conditional-import.xml b/shib-networking-spring/src/test/resources/net/shibboleth/shared/spring/httpclient/resource/conditional-import.xml
similarity index 82%
rename from shib-spring/src/test/resources/net/shibboleth/ext/spring/resource/conditional-import.xml
rename to shib-networking-spring/src/test/resources/net/shibboleth/shared/spring/httpclient/resource/conditional-import.xml
index 475e4fb4..c08033a9 100644
--- a/shib-spring/src/test/resources/net/shibboleth/ext/spring/resource/conditional-import.xml
+++ b/shib-networking-spring/src/test/resources/net/shibboleth/shared/spring/httpclient/resource/conditional-import.xml
@@ -7,7 +7,7 @@
default-init-method="initialize"
default-destroy-method="destroy">
- <import resource="conditional:net/shibboleth/ext/spring/resource/conditional.xml" />
+ <import resource="conditional:net/shibboleth/shared/spring/httpclient/resource/conditional.xml" />
<import resource="conditional:missing.xml" />
diff --git a/shib-spring/src/test/resources/net/shibboleth/ext/spring/resource/conditional.xml b/shib-networking-spring/src/test/resources/net/shibboleth/shared/spring/httpclient/resource/conditional.xml
similarity index 100%
rename from shib-spring/src/test/resources/net/shibboleth/ext/spring/resource/conditional.xml
rename to shib-networking-spring/src/test/resources/net/shibboleth/shared/spring/httpclient/resource/conditional.xml
diff --git a/shib-networking-spring/src/test/resources/net/shibboleth/shared/spring/httpclient/resource/document.xml b/shib-networking-spring/src/test/resources/net/shibboleth/shared/spring/httpclient/resource/document.xml
new file mode 100644
index 00000000..e8ec7c0d
--- /dev/null
+++ b/shib-networking-spring/src/test/resources/net/shibboleth/shared/spring/httpclient/resource/document.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<docElement>
+ <innerElement/>
+</docElement>
diff --git a/shib-spring/src/test/resources/net/shibboleth/ext/spring/resource/newStyle.xml b/shib-networking-spring/src/test/resources/net/shibboleth/shared/spring/httpclient/resource/newStyle.xml
similarity index 80%
rename from shib-spring/src/test/resources/net/shibboleth/ext/spring/resource/newStyle.xml
rename to shib-networking-spring/src/test/resources/net/shibboleth/shared/spring/httpclient/resource/newStyle.xml
index 003d1e26..db4b8729 100644
--- a/shib-spring/src/test/resources/net/shibboleth/ext/spring/resource/newStyle.xml
+++ b/shib-networking-spring/src/test/resources/net/shibboleth/shared/spring/httpclient/resource/newStyle.xml
@@ -17,29 +17,29 @@
<bean id="shibboleth.NonCachingHttpClient"
lazy-init="true"
- class="net.shibboleth.ext.spring.factory.HttpClientFactoryBean"
+ class="net.shibboleth.shared.spring.httpclient.factory.HttpClientFactoryBean"
p:tLSSocketFactory="#{ %{idp.httpclient.useTrustEngineTLSSocketFactory:false} ? @'shibboleth.TrustEngineTLSSocketFactory' : null }"
p:connectionDisregardTLSCertificate="%{idp.httpclient.connectionDisregardTLSCertificate:false}"
p:connectionTimeout="%{idp.httpclient.connectionTimeout:-1}" />
<bean id="urlBean" class="java.net.URL" c:_0="%{the.url}"/>
- <bean id="namedString" class="net.shibboleth.ext.spring.resource.FileBackedHTTPResource"
+ <bean id="namedString" class="net.shibboleth.shared.spring.httpclient.resource.FileBackedHTTPResource"
c:client-ref="shibboleth.NonCachingHttpClient"
c:url="%{the.url}"
c:backingFile="%{file.name}"/>
- <bean id="namedURL" class="net.shibboleth.ext.spring.resource.FileBackedHTTPResource"
+ <bean id="namedURL" class="net.shibboleth.shared.spring.httpclient.resource.FileBackedHTTPResource"
c:client-ref="shibboleth.NonCachingHttpClient"
c:url-ref="urlBean"
c:backingFile="%{file.name}"/>
- <bean id="numberedString" class="net.shibboleth.ext.spring.resource.FileBackedHTTPResource"
+ <bean id="numberedString" class="net.shibboleth.shared.spring.httpclient.resource.FileBackedHTTPResource"
c:_1-ref="shibboleth.NonCachingHttpClient"
c:_2="%{the.url}"
c:_0="%{file.name}"/>
- <bean id="numberedURL" class="net.shibboleth.ext.spring.resource.FileBackedHTTPResource"
+ <bean id="numberedURL" class="net.shibboleth.shared.spring.httpclient.resource.FileBackedHTTPResource"
c:_1-ref="shibboleth.NonCachingHttpClient"
c:_2-ref="urlBean"
c:_0="%{file.name}"/>
diff --git a/shib-shared-bom/pom.xml b/shib-shared-bom/pom.xml
index c7ac6b61..c6c83da8 100644
--- a/shib-shared-bom/pom.xml
+++ b/shib-shared-bom/pom.xml
@@ -22,6 +22,11 @@
<artifactId>shib-networking</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>shib-networking-spring</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>shib-security</artifactId>
diff --git a/shib-spring/pom.xml b/shib-spring/pom.xml
index c91bbaa2..1698b3fb 100644
--- a/shib-spring/pom.xml
+++ b/shib-spring/pom.xml
@@ -26,25 +26,6 @@
<dependencies>
<!-- Compile dependencies -->
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
- <dependency>
- <!-- Required for HTTPResource. -->
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpcore</artifactId>
- </dependency>
- <dependency>
- <!-- Required for HTTPResource. -->
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient-cache</artifactId>
- </dependency>
-
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>shib-support</artifactId>
@@ -57,6 +38,11 @@
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </dependency>
+
<dependency>
<groupId>com.beust</groupId>
<artifactId>jcommander</artifactId>
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list