[java-idp-integration-tests] branch main updated: Partial HttpClient update.
Scott Cantor
cantor.2 at osu.edu
Tue Mar 14 22:00:00 UTC 2023
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch main
in repository java-idp-integration-tests.
View the commit online:
http://git.shibboleth.net/view/?p=java-idp-integration-tests.git;a=commit;h=f5056e0f7436cb7e595f4f869d1d692d9b55bfdd
The following commit(s) were added to refs/heads/main by this push:
new f5056e0 Partial HttpClient update.
f5056e0 is described below
commit f5056e0f7436cb7e595f4f869d1d692d9b55bfdd
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Mar 14 17:59:58 2023 -0400
Partial HttpClient update.
---
.../integration/tests/AbstractServerProcess.java | 23 ++++++++--------------
.../idp/integration/tests/BaseIntegrationTest.java | 20 +++++++++----------
2 files changed, 17 insertions(+), 26 deletions(-)
diff --git a/src/test/java/net/shibboleth/idp/integration/tests/AbstractServerProcess.java b/src/test/java/net/shibboleth/idp/integration/tests/AbstractServerProcess.java
index 78f1f42..9491794 100644
--- a/src/test/java/net/shibboleth/idp/integration/tests/AbstractServerProcess.java
+++ b/src/test/java/net/shibboleth/idp/integration/tests/AbstractServerProcess.java
@@ -31,17 +31,12 @@ import java.util.concurrent.TimeUnit;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.HttpStatus;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.HttpRequestRetryHandler;
-import org.apache.http.client.ServiceUnavailableRetryStrategy;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.protocol.HttpContext;
-import org.apache.http.util.EntityUtils;
+import org.apache.hc.client5.http.classic.HttpClient;
+import org.apache.hc.client5.http.classic.methods.HttpGet;
+import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
+import org.apache.hc.core5.http.ClassicHttpResponse;
+import org.apache.hc.core5.http.HttpEntity;
+import org.apache.hc.core5.http.io.entity.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.Lifecycle;
@@ -371,7 +366,7 @@ public class AbstractServerProcess extends AbstractInitializableComponent implem
final HttpClient httpClient = builder.buildClient();
final HttpGet httpget = new HttpGet(statusPageURL);
- final HttpResponse response = httpClient.execute(httpget);
+ final ClassicHttpResponse response = httpClient.executeOpen(httpget);
log.trace("Status page response '{}'", response);
try {
@@ -384,9 +379,7 @@ public class AbstractServerProcess extends AbstractInitializableComponent implem
}
}
} finally {
- if (response instanceof CloseableHttpResponse) {
- ((CloseableHttpResponse) response).close();
- }
+ response.close();
if (httpClient instanceof CloseableHttpClient) {
((CloseableHttpClient) httpClient).close();
}
diff --git a/src/test/java/net/shibboleth/idp/integration/tests/BaseIntegrationTest.java b/src/test/java/net/shibboleth/idp/integration/tests/BaseIntegrationTest.java
index c68a0e9..1d6fd8f 100644
--- a/src/test/java/net/shibboleth/idp/integration/tests/BaseIntegrationTest.java
+++ b/src/test/java/net/shibboleth/idp/integration/tests/BaseIntegrationTest.java
@@ -54,13 +54,12 @@ import java.util.regex.Pattern;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.util.EntityUtils;
+import org.apache.hc.client5.http.classic.HttpClient;
+import org.apache.hc.client5.http.classic.methods.HttpGet;
+import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
+import org.apache.hc.core5.http.ClassicHttpResponse;
+import org.apache.hc.core5.http.HttpEntity;
+import org.apache.hc.core5.http.io.entity.EntityUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.ElementNotInteractableException;
@@ -2151,7 +2150,8 @@ public abstract class BaseIntegrationTest {
final HttpClientBuilder builder = new HttpClientBuilder();
try {
final HttpClient httpClient = builder.buildClient();
- final HttpResponse response = httpClient.execute(httpget);
+ // TODO fix up open call...
+ final ClassicHttpResponse response = httpClient.executeOpen(httpget);
log.trace("EC2 metadata response '{}'", response);
try {
final HttpEntity entity = response.getEntity();
@@ -2164,9 +2164,7 @@ public abstract class BaseIntegrationTest {
}
}
} finally {
- if (response instanceof CloseableHttpResponse) {
- ((CloseableHttpResponse) response).close();
- }
+ response.close();
if (httpClient instanceof CloseableHttpClient) {
((CloseableHttpClient) httpClient).close();
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list