[java-identity-provider] branch master updated: Fix failing tests.

Scott Cantor cantor.2 at osu.edu
Wed Mar 13 17:33:13 EDT 2019


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

scantor pushed a commit to branch master
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=f6296524b994474b025265f2bd4f00019e7dc1a2

The following commit(s) were added to refs/heads/master by this push:
       new  f629652   Fix failing tests.
f629652 is described below

commit f6296524b994474b025265f2bd4f00019e7dc1a2
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Mar 13 17:33:11 2019 -0400

    Fix failing tests.
---
 .../DynamicHTTPMetadataProviderParserTest.java     | 31 +++++++++++-----------
 .../FileBackedHTTPMetadataProviderParserTest.java  |  5 ++--
 .../metadata/FilesystemMetadataParserTest.java     |  7 ++---
 .../profile/spring/relyingparty/reload/beans.xml   | 16 +++++++++++
 .../spring/relyingparty/reload/chainingbeans.xml   | 16 +++++++++++
 5 files changed, 55 insertions(+), 20 deletions(-)

diff --git a/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/DynamicHTTPMetadataProviderParserTest.java b/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/DynamicHTTPMetadataProviderParserTest.java
index 8edf658..9954b74 100644
--- a/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/DynamicHTTPMetadataProviderParserTest.java
+++ b/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/DynamicHTTPMetadataProviderParserTest.java
@@ -19,6 +19,7 @@ package net.shibboleth.idp.profile.spring.relyingparty.metadata;
 
 import java.security.MessageDigest;
 import java.security.SecureRandom;
+import java.time.Duration;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.function.Function;
@@ -66,14 +67,14 @@ public class DynamicHTTPMetadataProviderParserTest extends AbstractMetadataParse
         Assert.assertNotNull(resolver.getParserPool());
         Assert.assertTrue(resolver.getIndexes().isEmpty());
         
-        Assert.assertEquals(resolver.getNegativeLookupCacheDuration(), Long.valueOf(10*60*1000L));
+        Assert.assertEquals(resolver.getNegativeLookupCacheDuration(), Duration.ofMinutes(10));
         Assert.assertEquals(resolver.getRefreshDelayFactor(), 0.75f);
-        Assert.assertEquals(resolver.getMinCacheDuration(), Long.valueOf(10*60*1000L));
-        Assert.assertEquals(resolver.getMaxCacheDuration(), Long.valueOf(8*60*60*1000L));
-        Assert.assertEquals(resolver.getMaxIdleEntityData(), Long.valueOf(8*60*60*1000L));
+        Assert.assertEquals(resolver.getMinCacheDuration(), Duration.ofMinutes(10));
+        Assert.assertEquals(resolver.getMaxCacheDuration(), Duration.ofHours(8));
+        Assert.assertEquals(resolver.getMaxIdleEntityData(), Duration.ofHours(8));
         Assert.assertTrue(resolver.isRemoveIdleEntityData());
-        Assert.assertEquals(resolver.getCleanupTaskInterval(), Long.valueOf(30*60*1000L));
-        Assert.assertEquals(resolver.getExpirationWarningThreshold(), Long.valueOf(0l));
+        Assert.assertEquals(resolver.getCleanupTaskInterval(), Duration.ofMinutes(30));
+        Assert.assertEquals(resolver.getExpirationWarningThreshold(), Duration.ZERO);
         
         Assert.assertEquals(resolver.getSupportedContentTypes(), 
                 Arrays.asList("application/samlmetadata+xml", "application/xml", "text/xml"));
@@ -90,7 +91,7 @@ public class DynamicHTTPMetadataProviderParserTest extends AbstractMetadataParse
         
         Assert.assertTrue(resolver.isInitializeFromPersistentCacheInBackground());
         
-        Assert.assertEquals(resolver.getBackgroundInitializationFromCacheDelay(), Long.valueOf(2*1000));
+        Assert.assertEquals(resolver.getBackgroundInitializationFromCacheDelay(), Duration.ofSeconds(2));
         
         Assert.assertEquals(resolver.getRequestURLBuilder().getClass(), HTTPEntityIDRequestURLBuilder.class);
     }
@@ -162,7 +163,7 @@ public class DynamicHTTPMetadataProviderParserTest extends AbstractMetadataParse
         
         Assert.assertFalse(resolver.isInitializeFromPersistentCacheInBackground());
         
-        Assert.assertEquals(resolver.getBackgroundInitializationFromCacheDelay(), Long.valueOf(30*1000));
+        Assert.assertEquals(resolver.getBackgroundInitializationFromCacheDelay(), Duration.ofSeconds(30));
     }
     
     @Test
@@ -191,7 +192,7 @@ public class DynamicHTTPMetadataProviderParserTest extends AbstractMetadataParse
         
         Assert.assertFalse(resolver.isInitializeFromPersistentCacheInBackground());
         
-        Assert.assertEquals(resolver.getBackgroundInitializationFromCacheDelay(), Long.valueOf(30*1000));
+        Assert.assertEquals(resolver.getBackgroundInitializationFromCacheDelay(), Duration.ofSeconds(30));
     }
     
     @Test
@@ -205,14 +206,14 @@ public class DynamicHTTPMetadataProviderParserTest extends AbstractMetadataParse
         Assert.assertNull(resolver.getMetadataFilter());
         Assert.assertNotNull(resolver.getParserPool());
         
-        Assert.assertEquals(resolver.getNegativeLookupCacheDuration(), Long.valueOf(5*60*1000L));
+        Assert.assertEquals(resolver.getNegativeLookupCacheDuration(), Duration.ofMinutes(5));
         Assert.assertEquals(resolver.getRefreshDelayFactor(), 0.50f);
-        Assert.assertEquals(resolver.getMinCacheDuration(), Long.valueOf(5*60*1000L));
-        Assert.assertEquals(resolver.getMaxCacheDuration(), Long.valueOf(4*60*60*1000L));
-        Assert.assertEquals(resolver.getMaxIdleEntityData(), Long.valueOf(2*60*60*1000L));
+        Assert.assertEquals(resolver.getMinCacheDuration(), Duration.ofMinutes(5));
+        Assert.assertEquals(resolver.getMaxCacheDuration(), Duration.ofHours(4));
+        Assert.assertEquals(resolver.getMaxIdleEntityData(), Duration.ofHours(2));
         Assert.assertFalse(resolver.isRemoveIdleEntityData());
-        Assert.assertEquals(resolver.getCleanupTaskInterval(), Long.valueOf(20*60*1000L));
-        Assert.assertEquals(resolver.getExpirationWarningThreshold(), Long.valueOf(3*60*60*1000L));
+        Assert.assertEquals(resolver.getCleanupTaskInterval(), Duration.ofMinutes(20));
+        Assert.assertEquals(resolver.getExpirationWarningThreshold(), Duration.ofHours(3));
         
         Assert.assertEquals(resolver.getSupportedContentTypes(), Collections.singletonList("text/xml"));
         
diff --git a/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/FileBackedHTTPMetadataProviderParserTest.java b/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/FileBackedHTTPMetadataProviderParserTest.java
index cd621ba..652527c 100644
--- a/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/FileBackedHTTPMetadataProviderParserTest.java
+++ b/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/FileBackedHTTPMetadataProviderParserTest.java
@@ -17,6 +17,7 @@
 
 package net.shibboleth.idp.profile.spring.relyingparty.metadata;
 
+import java.time.Duration;
 import java.util.Iterator;
 
 import org.opensaml.saml.metadata.resolver.MetadataResolver;
@@ -56,11 +57,11 @@ public class FileBackedHTTPMetadataProviderParserTest extends AbstractMetadataPa
         Assert.assertFalse(entities.hasNext());
 
         Assert.assertEquals(resolver.getRefreshDelayFactor(), 0.75, 0.001);
-        Assert.assertEquals(resolver.getExpirationWarningThreshold(), 1000*60*60*12);
+        Assert.assertEquals(resolver.getExpirationWarningThreshold(), Duration.ofHours(12));
         Assert.assertSame(resolver.getParserPool(), parserPool);
 
         Assert.assertEquals(resolver.isInitializeFromBackupFile(), false);
-        Assert.assertEquals(resolver.getBackupFileInitNextRefreshDelay(), 10*1000);
+        Assert.assertEquals(resolver.getBackupFileInitNextRefreshDelay(), Duration.ofSeconds(10));
 
         Assert.assertNull(resolver.resolveSingle(criteriaFor(SP_ID)));
     }
diff --git a/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/FilesystemMetadataParserTest.java b/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/FilesystemMetadataParserTest.java
index c21c0a1..f36d6d2 100644
--- a/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/FilesystemMetadataParserTest.java
+++ b/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/FilesystemMetadataParserTest.java
@@ -18,6 +18,7 @@
 package net.shibboleth.idp.profile.spring.relyingparty.metadata;
 
 import java.io.IOException;
+import java.time.Duration;
 import java.util.Iterator;
 
 import org.opensaml.saml.metadata.resolver.impl.FilesystemMetadataResolver;
@@ -54,10 +55,10 @@ public class FilesystemMetadataParserTest extends AbstractMetadataParserTest {
         FilesystemMetadataResolver resolver = getBean(FilesystemMetadataResolver.class, "fileEntities.xml", "beans.xml");
         
         Assert.assertEquals(resolver.getId(), "fileEntities");
-        Assert.assertEquals(resolver.getMaxRefreshDelay(), 1000*60*55);
-        Assert.assertEquals(resolver.getMinRefreshDelay(), 1000*60*15);
+        Assert.assertEquals(resolver.getMaxRefreshDelay(), Duration.ofMinutes(55));
+        Assert.assertEquals(resolver.getMinRefreshDelay(), Duration.ofMinutes(15));
         Assert.assertEquals(resolver.getRefreshDelayFactor(), 0.5, 0.001);
-        Assert.assertEquals(resolver.getExpirationWarningThreshold(), 1000*60*60*12);
+        Assert.assertEquals(resolver.getExpirationWarningThreshold(), Duration.ofHours(12));
         Assert.assertNotSame(resolver.getParserPool(), parserPool);
    
         final Iterator<EntityDescriptor> entities = resolver.resolve(criteriaFor(IDP_ID)).iterator();
diff --git a/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/reload/beans.xml b/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/reload/beans.xml
index 2a77205..57312f9 100644
--- a/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/reload/beans.xml
+++ b/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/reload/beans.xml
@@ -9,6 +9,22 @@
 
 	default-init-method="initialize" default-destroy-method="destroy">
 
+    <!-- This bean MUST be called "conversionService" to work properly. -->
+    <bean id="conversionService" class="org.springframework.context.support.ConversionServiceFactoryBean">
+        <property name="converters">
+            <set>
+                <bean class="net.shibboleth.ext.spring.config.DurationToLongConverter" />
+                <bean class="net.shibboleth.ext.spring.config.StringToIPRangeConverter" />
+                <bean class="net.shibboleth.ext.spring.config.BooleanToPredicateConverter" />
+                <bean class="net.shibboleth.ext.spring.config.StringBooleanToPredicateConverter" />
+                <bean class="net.shibboleth.ext.spring.config.StringToResourceConverter" />
+                <bean class="net.shibboleth.ext.spring.config.FunctionToFunctionConverter" />
+                <bean class="net.shibboleth.ext.spring.config.PredicateToPredicateConverter" />
+                <bean class="net.shibboleth.ext.spring.config.StringToDurationConverter" />
+            </set>
+        </property>
+    </bean>
+
     <bean id="myParserPool"
         class="net.shibboleth.utilities.java.support.xml.BasicParserPool"
         p:maxPoolSize="1000"
diff --git a/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/reload/chainingbeans.xml b/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/reload/chainingbeans.xml
index 7c419d1..5e8f792 100644
--- a/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/reload/chainingbeans.xml
+++ b/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/reload/chainingbeans.xml
@@ -9,6 +9,22 @@
 
 	default-init-method="initialize" default-destroy-method="destroy">
 
+    <!-- This bean MUST be called "conversionService" to work properly. -->
+    <bean id="conversionService" class="org.springframework.context.support.ConversionServiceFactoryBean">
+        <property name="converters">
+            <set>
+                <bean class="net.shibboleth.ext.spring.config.DurationToLongConverter" />
+                <bean class="net.shibboleth.ext.spring.config.StringToIPRangeConverter" />
+                <bean class="net.shibboleth.ext.spring.config.BooleanToPredicateConverter" />
+                <bean class="net.shibboleth.ext.spring.config.StringBooleanToPredicateConverter" />
+                <bean class="net.shibboleth.ext.spring.config.StringToResourceConverter" />
+                <bean class="net.shibboleth.ext.spring.config.FunctionToFunctionConverter" />
+                <bean class="net.shibboleth.ext.spring.config.PredicateToPredicateConverter" />
+                <bean class="net.shibboleth.ext.spring.config.StringToDurationConverter" />
+            </set>
+        </property>
+    </bean>
+
     <bean id="myParserPool"
         class="net.shibboleth.utilities.java.support.xml.BasicParserPool"
         p:maxPoolSize="1000"

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


More information about the commits mailing list