[java-idp-integration-tests] 05/07: Enable retry handlers only when max retries is greater than 1

Tom Zeller tzeller at dragonacea.biz
Fri Mar 23 19:36:29 EDT 2018


This is an automated email from the git hooks/post-receive script.

tzeller pushed a commit to branch master
in repository java-idp-integration-tests.

View the commit online:
http://git.shibboleth.net/view/?p=java-idp-integration-tests.git;a=commit;h=158ccf7cb98c2546ddc582f148ecfaf1e5a854ee

commit 158ccf7cb98c2546ddc582f148ecfaf1e5a854ee
Author: Tom Zeller <tzeller at dragonacea.biz>
AuthorDate: Fri Mar 23 18:30:27 2018 -0500

    Enable retry handlers only when max retries is greater than 1
    
    Otherwise, Jetty may throw an Exception if not running when
    getStatusPage() is called.
---
 .../java/net/shibboleth/idp/test/AbstractServerProcess.java    | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/test/java/net/shibboleth/idp/test/AbstractServerProcess.java b/src/test/java/net/shibboleth/idp/test/AbstractServerProcess.java
index 9ee531f..6489d8c 100644
--- a/src/test/java/net/shibboleth/idp/test/AbstractServerProcess.java
+++ b/src/test/java/net/shibboleth/idp/test/AbstractServerProcess.java
@@ -297,17 +297,21 @@ public class AbstractServerProcess extends AbstractInitializableComponent implem
     /**
      * Get the text of the IdP status page.
      * 
+     * Retries must be greater than 1 to enable the retry handlers.
+     * 
      * @param retries maximum number of times to retry
      * @param millis length of time to sleep in milliseconds between retry attempts
      * @return the text of the IdP status page or <code>null</code>
      * @throws Exception if an error occurs
      */
     @Nullable
-    public String getStatusPageText(@Nullable final int retries, @Nonnull final int millis) throws Exception {
+    public String getStatusPageText(@Nonnull final int retries, @Nonnull final int millis) throws Exception {
 
         final HttpClientBuilder builder = new HttpClientBuilder();
-        builder.setHttpRequestRetryHandler(new FiniteWaitHttpRequestRetryHandler(retries / 2, millis));
-        builder.setServiceUnavailableRetryHandler(new FiniteWaitServiceUnavailableRetryStrategy(retries / 2, millis));
+        if (retries > 1) {
+            builder.setHttpRequestRetryHandler(new FiniteWaitHttpRequestRetryHandler(retries / 2, millis));
+            builder.setServiceUnavailableRetryHandler(new FiniteWaitServiceUnavailableRetryStrategy(retries / 2, millis));
+        }
         builder.setConnectionCloseAfterResponse(false);
         builder.setConnectionDisregardTLSCertificate(true);
         final HttpClient httpClient = builder.buildClient();

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list