[java-oidc-common] branch main updated: Cleanup max cache duration usage

Phil Smart philip.smart at jisc.ac.uk
Fri Nov 12 17:16:52 UTC 2021


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

philsmart pushed a commit to branch main
in repository java-oidc-common.

View the commit online:
http://git.shibboleth.net/view/?p=java-oidc-common.git;a=commit;h=24aaac10e518f58ed85bda8ed1390b5e82841239

The following commit(s) were added to refs/heads/main by this push:
     new 24aaac1  Cleanup max cache duration usage
24aaac1 is described below

commit 24aaac10e518f58ed85bda8ed1390b5e82841239
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Fri Nov 12 17:16:45 2021 +0000

    Cleanup max cache duration usage
---
 .../oidc/metadata/DynamicBackingStore.java         | 20 ++++++--
 .../oidc/metadata/MetadataManagementData.java      |  1 +
 .../metadata/cache/impl/AbstractMetadataCache.java |  2 +-
 .../metadata/cache/impl/DynamicMetadataCache.java  | 45 +++++++++++-------
 .../cache/impl/DynamicMetadataCacheBuilder.java    |  2 +-
 .../metadata/impl/DefaultDynamicBackingStore.java  | 34 ++++++-------
 .../cache/impl/DynamicMetadataCacheTest.java       | 55 ++++++++++++----------
 .../impl/OIDCProviderMetadataResolverTest.java     |  9 ++--
 8 files changed, 97 insertions(+), 71 deletions(-)

diff --git a/oidc-common-metadata-api/src/main/java/net/shibboleth/oidc/metadata/DynamicBackingStore.java b/oidc-common-metadata-api/src/main/java/net/shibboleth/oidc/metadata/DynamicBackingStore.java
index a9f5b57..9238756 100644
--- a/oidc-common-metadata-api/src/main/java/net/shibboleth/oidc/metadata/DynamicBackingStore.java
+++ b/oidc-common-metadata-api/src/main/java/net/shibboleth/oidc/metadata/DynamicBackingStore.java
@@ -1,8 +1,10 @@
 package net.shibboleth.oidc.metadata;
 
 import java.util.Set;
+import java.util.function.Function;
 
 import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
 
 import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
 import net.shibboleth.utilities.java.support.annotation.constraint.NotLive;
@@ -12,7 +14,7 @@ public interface DynamicBackingStore<I, T> extends BackingStore<I, T> {
     
     /**
      * Get the management data for the specified identifier. If the management data does not exist
-     * it should be created.
+     * it should be created using the supplied mapping function.
      * 
      * <p>Management data facilitates per-entity metadata locking and cache primitives e.g. next refresh time. </p>
      * 
@@ -20,10 +22,22 @@ public interface DynamicBackingStore<I, T> extends BackingStore<I, T> {
      * to create management data for the same identifier.</p>
      * 
      * @param identifier the identifier of the entity to find management data about
+     * @param mappingFunction the function used to create a new {@link MetadataManagementData} instance if none exist.
      * 
-     * @return the corresponding management data
+     * @return a new or previously cache metadata management data.
      */
-    @Nonnull public MetadataManagementData<I> computeManagementDataIfAbsent(@Nonnull final I identifier);
+    @Nonnull public MetadataManagementData<I> computeManagementDataIfAbsent(@Nonnull final I identifier,
+            @Nonnull final Function<I, MetadataManagementData<I>> mappingFunction);
+    
+    /**
+     * Get the management data for the specified identifier. If the management data does not exist, {@literal null}
+     * is returned. 
+     * 
+     * @param identifier the identifier of the entity to find management data about
+     * 
+     * @return the corresponding management data, or {@literal null} if not found.
+     */
+    @Nullable public MetadataManagementData<I> getManagementData(@Nonnull final I identifier);
     
     /**
      * Remove the management data for the specified entityID.
diff --git a/oidc-common-metadata-api/src/main/java/net/shibboleth/oidc/metadata/MetadataManagementData.java b/oidc-common-metadata-api/src/main/java/net/shibboleth/oidc/metadata/MetadataManagementData.java
index 9923e84..a639aee 100644
--- a/oidc-common-metadata-api/src/main/java/net/shibboleth/oidc/metadata/MetadataManagementData.java
+++ b/oidc-common-metadata-api/src/main/java/net/shibboleth/oidc/metadata/MetadataManagementData.java
@@ -32,6 +32,7 @@ import net.shibboleth.utilities.java.support.logic.Constraint;
  * 
  */
 //TODO removed negative lookup cache.
+//TODO guard this class?
 //TODO change to a generic ObjectManagmentData type - if we want to broaden beyond metadata.
 public class MetadataManagementData<MetadataIdentifier> {
     
diff --git a/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/AbstractMetadataCache.java b/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/AbstractMetadataCache.java
index bb8f12d..3fe1a7b 100644
--- a/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/AbstractMetadataCache.java
+++ b/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/AbstractMetadataCache.java
@@ -401,7 +401,7 @@ public abstract class AbstractMetadataCache<IdentifierType, MetadataType>
     
    
     /**
-     * Determine whether should attempt to refresh the metadata, based on stored refresh trigger time.
+     * Determine if the metadata should be refreshed based on stored refresh trigger time. 
      * 
      * @param mgmtData the entity'd management data
      * @return true if should attempt refresh, false otherwise
diff --git a/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/DynamicMetadataCache.java b/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/DynamicMetadataCache.java
index fb87066..98fcc55 100644
--- a/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/DynamicMetadataCache.java
+++ b/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/DynamicMetadataCache.java
@@ -28,7 +28,6 @@ import java.util.Set;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.StampedLock;
-import java.util.function.BiFunction;
 import java.util.function.Function;
 
 import javax.annotation.Nonnull;
@@ -89,7 +88,6 @@ public class DynamicMetadataCache<IdentifierType, MetadataType>
     @NonnullAfterInit private Duration minCacheDuration;
     
     /** Maximum cache duration. */
-    //FIXME: is not being used here, should be for metadata expiry computation
     @NonnullAfterInit private Duration maxCacheDuration;
     
     /** The function to use to fetch/load metadata if either none exists, or the existing is stale.*/
@@ -98,29 +96,36 @@ public class DynamicMetadataCache<IdentifierType, MetadataType>
     /** Strategy used to compute an expiration time from a metadata instance. */
     @NonnullAfterInit private Function<ExpirationTimeContext<MetadataType>, Instant> metadataExpirationTimeStrategy;
     
+    /** Mapping function to use when creating new metadata management data.*/
+    @Nonnull private final Function<IdentifierType, MetadataManagementData<IdentifierType>> mgmtMappingFunction;
+    
     /** 
      * Constructor.
      *
      * @param store the backing store to use as the cache store.
      */
     protected DynamicMetadataCache(@Nonnull final DynamicBackingStore<IdentifierType, MetadataType> store) {
-        super(store);
+        this(store, null);
+        
     }
     
     /**
-     * 
      * Protected constructor. Used mainly for testing.
      *
      * @param store the backing store to use as the cache store.
-     * @param metadataFetchStrategy the strategy used to fetch metadata using the 'read-through' semantics. 
      * @param executor override the executor service.
      */
     protected DynamicMetadataCache(@Nonnull final DynamicBackingStore<IdentifierType, MetadataType> store, 
-            @Nonnull final Function<CriteriaSet, MetadataType> metadataFetchStrategy,
             @Nullable final ScheduledExecutorService executor) { 
         super(store, executor);
-        fetchStrategy = 
-                Constraint.isNotNull(metadataFetchStrategy, "Dynamic Metadata fetch strategy can not be null");
+        mgmtMappingFunction = id -> {
+            final Instant now = Instant.now();
+            final MetadataManagementData<IdentifierType> mgmt = new MetadataManagementData<>(id);
+            mgmt.setRefreshTriggerTime(now.plus(maxCacheDuration));
+            mgmt.setExpirationTime(now.plus(maxCacheDuration));
+            return mgmt;
+        };
+        
     }
     
     /**
@@ -292,11 +297,13 @@ public class DynamicMetadataCache<IdentifierType, MetadataType>
         if (identifier != null) {       
             //TODO check we can do this here, as another thread could change this concurrently?
             final MetadataManagementData<IdentifierType> mgmtData = getBackingStore()
-                    .computeManagementDataIfAbsent(identifier);
+                    .computeManagementDataIfAbsent(identifier, mgmtMappingFunction);
             
             // check metadata refresh is not needed before reading.
             List<MetadataType> allMetadata = Collections.emptyList();
             if (!shouldAttemptRefresh(mgmtData)) {
+                // TODO: Metadata that does not exist yet but its mgmtData has been created will attempt 
+                // a pointless read.
                 allMetadata = read(mgmtData, identifier);
             }
             if (allMetadata.isEmpty()) {
@@ -535,15 +542,17 @@ public class DynamicMetadataCache<IdentifierType, MetadataType>
             ids.addAll(store.getManagementDataIdentifiers());
             
             for (final IdentifierType identifier : ids) {
-                final MetadataManagementData<IdentifierType> mgmtData = store.computeManagementDataIfAbsent(identifier);
-                final long stamp = mgmtData.getStampLock().writeLock();
-                try {                                       
-                    if (isRemoveData(mgmtData, now, earliestValidLastAccessed)) {
-                        invalidate(identifier);
-                        store.removeManagementData(identifier);
-                    }                    
-                } finally {
-                    mgmtData.getStampLock().unlock(stamp);
+                final MetadataManagementData<IdentifierType> mgmtData = store.getManagementData(identifier);
+                if (mgmtData != null) {
+                    final long stamp = mgmtData.getStampLock().writeLock();
+                    try {                                       
+                        if (isRemoveData(mgmtData, now, earliestValidLastAccessed)) {
+                            invalidate(identifier);
+                            store.removeManagementData(identifier);
+                        }                    
+                    } finally {
+                        mgmtData.getStampLock().unlock(stamp);
+                    }
                 }
             }
             
diff --git a/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/DynamicMetadataCacheBuilder.java b/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/DynamicMetadataCacheBuilder.java
index 3e5f060..e06b1fb 100644
--- a/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/DynamicMetadataCacheBuilder.java
+++ b/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/DynamicMetadataCacheBuilder.java
@@ -59,7 +59,7 @@ public final class DynamicMetadataCacheBuilder {
                         throws ComponentInitializationException {
 
             final DynamicMetadataCache<IdentifierType, MetadataType> cache = new DynamicMetadataCache<>(
-                    new DefaultDynamicBackingStore<>(spec.getMaxCacheDuration()));
+                    new DefaultDynamicBackingStore<>());
             cache.setFetchStrategy(spec.getFetchStrategy());
             cache.setMinCacheDuration(spec.getMinCacheDuration());
             cache.setMaxCacheDuration(spec.getMaxCacheDuration());
diff --git a/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/impl/DefaultDynamicBackingStore.java b/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/impl/DefaultDynamicBackingStore.java
index fb029e9..3bce8d1 100644
--- a/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/impl/DefaultDynamicBackingStore.java
+++ b/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/impl/DefaultDynamicBackingStore.java
@@ -18,11 +18,10 @@
 
 package net.shibboleth.oidc.metadata.impl;
 
-import java.time.Duration;
-import java.time.Instant;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.function.Function;
 
 import javax.annotation.Nonnull;
 import javax.annotation.concurrent.ThreadSafe;
@@ -47,35 +46,29 @@ public class DefaultDynamicBackingStore<I,T> extends AbstractBackingStore<I,T> i
     /** Map holding management data for each entityID. */
     private final Map<I, MetadataManagementData<I>> mgmtDataMap;    
     
-    /** The maximum cache duration for metadata.*/  
-    @Nonnull private final Duration maxCacheDuration;
-    
     /**
      * Constructor.
-     *
-     * @param maximumCacheDuration the maximum duration the metadata is valid for in the cache.
      */
-    public DefaultDynamicBackingStore(@Nonnull final Duration maximumCacheDuration) {
-        super();
-        maxCacheDuration = Constraint.isNotNull(maximumCacheDuration,"Max cache duration can not be null");          
+    public DefaultDynamicBackingStore() {
+        super();        
         mgmtDataMap = new ConcurrentHashMap<>();
     }
     
     @Override
-    public MetadataManagementData<I> computeManagementDataIfAbsent(@Nonnull final I identifier) {
+    public MetadataManagementData<I> computeManagementDataIfAbsent(@Nonnull final I identifier,
+            @Nonnull final Function<I, MetadataManagementData<I>> mappingFunction) {
         Constraint.isNotNull(identifier, "identifier may not be null");
-        Constraint.isNotNull(maxCacheDuration, "Max cache duration can not be null");
         
-        return mgmtDataMap.computeIfAbsent(identifier, id -> {
-            final Instant now = Instant.now();
-            final MetadataManagementData<I> mgmt = new MetadataManagementData<>(id);
-            mgmt.setRefreshTriggerTime(now.plus(maxCacheDuration));
-            mgmt.setExpirationTime(now.plus(maxCacheDuration));
-            return mgmt;
-        });        
-
+        return mgmtDataMap.computeIfAbsent(identifier, mappingFunction);  
     }
     
+    @Override
+    public MetadataManagementData<I> getManagementData(@Nonnull final I identifier) {
+        Constraint.isNotNull(identifier, "identifier may not be null");
+        return mgmtDataMap.get(identifier);
+    }
+
+    
     @Override
     //TODO is concurrent hashmap threadsafe for remove and get - do we need the synchronized
     public synchronized void removeManagementData(@Nonnull final I identifier) {
@@ -91,4 +84,5 @@ public class DefaultDynamicBackingStore<I,T> extends AbstractBackingStore<I,T> i
         return Set.copyOf(mgmtDataMap.keySet());        
     }
 
+ 
 }
diff --git a/oidc-common-metadata-impl/src/test/java/net/shibboleth/oidc/metadata/cache/impl/DynamicMetadataCacheTest.java b/oidc-common-metadata-impl/src/test/java/net/shibboleth/oidc/metadata/cache/impl/DynamicMetadataCacheTest.java
index bf65fa2..c8d6087 100644
--- a/oidc-common-metadata-impl/src/test/java/net/shibboleth/oidc/metadata/cache/impl/DynamicMetadataCacheTest.java
+++ b/oidc-common-metadata-impl/src/test/java/net/shibboleth/oidc/metadata/cache/impl/DynamicMetadataCacheTest.java
@@ -1,11 +1,10 @@
 /*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements.  See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
  *
  *    http://www.apache.org/licenses/LICENSE-2.0
  *
@@ -19,6 +18,7 @@
 package net.shibboleth.oidc.metadata.cache.impl;
 
 import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertSame;
 import static org.testng.Assert.assertTrue;
 
@@ -59,9 +59,10 @@ public class DynamicMetadataCacheTest {
     /** Class logger. */
     private final Logger log = LoggerFactory.getLogger(DynamicMetadataCacheTest.class);
 
-    // OIDC provider metadata cache
+    /** The cache.*/
     private DynamicMetadataCache<Issuer, OIDCProviderMetadata> cache;
     
+    /** A default fetching strategy.*/
     @Nonnull private Function<CriteriaSet, OIDCProviderMetadata> defaultFetchStrategy;
 
     @BeforeMethod
@@ -79,8 +80,9 @@ public class DynamicMetadataCacheTest {
         
         // Give our own executor, so we can manually handle the cleanup task
         final ManuallyTriggeredScheduledExecutorService scheduler = new ManuallyTriggeredScheduledExecutorService();
-        cache = new DynamicMetadataCache<Issuer, OIDCProviderMetadata>
-                        (new DefaultDynamicBackingStore<>(Duration.ofMinutes(5)),defaultFetchStrategy, scheduler);
+        cache = new DynamicMetadataCache<Issuer, OIDCProviderMetadata>(
+                new DefaultDynamicBackingStore<>(), scheduler);
+        cache.setFetchStrategy(defaultFetchStrategy);
         cache.setIdentifierExtractionStrategy(m -> m.getIssuer());
         cache.setMetadataExpirationTimeStrategy(ctx -> ctx.getNow().plus(Duration.ofMinutes(5)));
         cache.setCriteriaToIdentifierStrategy(crit -> {
@@ -112,14 +114,14 @@ public class DynamicMetadataCacheTest {
     }
     
     @Test
-    public void testBackgroundCleanup_Expired_Success() throws ComponentInitializationException, URISyntaxException, InterruptedException {
+    public void testBackgroundCleanup_Expired_Success() 
+            throws ComponentInitializationException, URISyntaxException, InterruptedException {
 
         // Give our own executor, so we do not need to wait.
         ManuallyTriggeredScheduledExecutorService scheduler = new ManuallyTriggeredScheduledExecutorService();
         DynamicMetadataCache<Issuer, OIDCProviderMetadata> cacheLocal =  
-                new DynamicMetadataCache<Issuer, OIDCProviderMetadata>(new DefaultDynamicBackingStore<>(Duration.ofMinutes(5)),
-                        defaultFetchStrategy, scheduler);
-        
+                new DynamicMetadataCache<Issuer, OIDCProviderMetadata>(new DefaultDynamicBackingStore<>(),scheduler);
+        cacheLocal.setFetchStrategy(defaultFetchStrategy);
         // use a cache local to this method
         cacheLocal.setIdentifierExtractionStrategy(m -> m.getIssuer());
         cacheLocal.setMetadataExpirationTimeStrategy(ctx -> ctx.getNow().plus(Duration.ofMinutes(10)));
@@ -141,7 +143,8 @@ public class DynamicMetadataCacheTest {
         cacheLocal.initialize();
         
         final Issuer iss = new Issuer("https://example.oidc.op.org");
-        final MetadataManagementData<Issuer> mgmtData = cacheLocal.getBackingStore().computeManagementDataIfAbsent(iss);
+        final MetadataManagementData<Issuer> mgmtData = cacheLocal.getBackingStore()
+                .computeManagementDataIfAbsent(iss, MetadataManagementData::new);
         final Instant now = Instant.now();
         mgmtData.setLastUpdateTime(now);
         // expire metadata
@@ -174,7 +177,7 @@ public class DynamicMetadataCacheTest {
 
         // Create but do not initialise
         final DynamicMetadataCache<Issuer, OIDCProviderMetadata> cacheLocal =  new DynamicMetadataCache<>(
-                new DefaultDynamicBackingStore<>(Duration.ofMinutes(5)));
+                new DefaultDynamicBackingStore<>());
         final Issuer iss = new Issuer("https://example.oidc.op.org");
         cacheLocal.get(new CriteriaSet(new IssuerIDCriterion(iss)));
     }
@@ -187,10 +190,10 @@ public class DynamicMetadataCacheTest {
         final ManuallyTriggeredScheduledExecutorService scheduler = new ManuallyTriggeredScheduledExecutorService();
         final DynamicMetadataCache<Issuer, OIDCProviderMetadata> cacheLocal =  
                 new DynamicMetadataCache<Issuer, OIDCProviderMetadata>(
-                        new DefaultDynamicBackingStore<>(Duration.ofMinutes(5)),
-                        defaultFetchStrategy, scheduler);
+                        new DefaultDynamicBackingStore<>(), scheduler);
         
         // use a cache local to this method
+        cacheLocal.setFetchStrategy(defaultFetchStrategy);
         cacheLocal.setIdentifierExtractionStrategy(m -> m.getIssuer());
         cacheLocal.setMetadataExpirationTimeStrategy(ctx -> ctx.getNow().plus(Duration.ofMinutes(10)));
         cacheLocal.setCriteriaToIdentifierStrategy(crit -> crit.get(IssuerIDCriterion.class).getIssuerID());
@@ -212,7 +215,8 @@ public class DynamicMetadataCacheTest {
         
 
         final Issuer iss = new Issuer("https://example.oidc.op.org");
-        final MetadataManagementData<Issuer> mgmtData = cacheLocal.getBackingStore().computeManagementDataIfAbsent(iss);
+        final MetadataManagementData<Issuer> mgmtData = cacheLocal.getBackingStore()
+                .computeManagementDataIfAbsent(iss, MetadataManagementData::new);
         final Instant now = Instant.now();
         mgmtData.setLastUpdateTime(now);
         // metadata not expired
@@ -246,7 +250,8 @@ public class DynamicMetadataCacheTest {
         cache.initialize();
         
         final Issuer iss = new Issuer("https://example.oidc.op.org");
-        final MetadataManagementData<Issuer> mgmtData = cache.getBackingStore().computeManagementDataIfAbsent(iss);
+        final MetadataManagementData<Issuer> mgmtData = cache.getBackingStore()
+                .computeManagementDataIfAbsent(iss, MetadataManagementData::new);
         final Instant now = Instant.now();
         mgmtData.setLastUpdateTime(now);
         // expire metadata
@@ -272,7 +277,8 @@ public class DynamicMetadataCacheTest {
         // should have been updated after firstUpdateTime.
         assertTrue(mgmtData.getLastUpdateTime().isAfter(firstUpdateTime));
         
-    }
+    }   
+    
 
     @Test
     public void testGetNotCached_Success() throws MetadataCacheException, ComponentInitializationException {
@@ -288,13 +294,14 @@ public class DynamicMetadataCacheTest {
         final ManuallyTriggeredScheduledExecutorService scheduler = new ManuallyTriggeredScheduledExecutorService();
         final DynamicMetadataCache<Issuer, OIDCProviderMetadata> localCache = 
                 new DynamicMetadataCache<Issuer, OIDCProviderMetadata>(
-                        new DefaultDynamicBackingStore<>(Duration.ofMinutes(5)),crit -> {
+                        new DefaultDynamicBackingStore<>(), scheduler);
+        localCache.setFetchStrategy(crit -> {
                     try {                    
                         return new OIDCProviderMetadata(new Issuer("wrong-id"), List.of(SubjectType.PUBLIC),
                                 new URI("http://example.oidc.op.org"));
-                    } catch (URISyntaxException e) {
+                    } catch (final URISyntaxException e) {
                         return null;
-                    }}, scheduler);
+        }});
         localCache.setIdentifierExtractionStrategy(m -> m.getIssuer());
         localCache.setMetadataExpirationTimeStrategy(ctx -> ctx.getNow().plus(Duration.ofMinutes(5)));
         localCache.setCriteriaToIdentifierStrategy(crit -> {
diff --git a/oidc-common-metadata-impl/src/test/java/net/shibboleth/oidc/metadata/impl/OIDCProviderMetadataResolverTest.java b/oidc-common-metadata-impl/src/test/java/net/shibboleth/oidc/metadata/impl/OIDCProviderMetadataResolverTest.java
index 05681d7..a0785ab 100644
--- a/oidc-common-metadata-impl/src/test/java/net/shibboleth/oidc/metadata/impl/OIDCProviderMetadataResolverTest.java
+++ b/oidc-common-metadata-impl/src/test/java/net/shibboleth/oidc/metadata/impl/OIDCProviderMetadataResolverTest.java
@@ -240,7 +240,8 @@ public class OIDCProviderMetadataResolverTest {
         // Give our own executor, so we can manually handle the cleanup task
         ManuallyTriggeredScheduledExecutorService scheduler = new ManuallyTriggeredScheduledExecutorService();
         dynCache = new TestableDynamicMetadataCache<Issuer, OIDCProviderMetadata>
-                        (new DefaultDynamicBackingStore<>(Duration.ofMinutes(5)),fetchingStrategy, scheduler);
+                        (new DefaultDynamicBackingStore<>(), scheduler);
+        dynCache.setFetchStrategy(fetchingStrategy);
         dynCache.setIdentifierExtractionStrategy(m -> m.getIssuer());
         dynCache.setMetadataExpirationTimeStrategy(ctx -> ctx.getNow().plus(Duration.ofMinutes(5)));
         dynCache.setCriteriaToIdentifierStrategy(crit -> {
@@ -307,7 +308,7 @@ public class OIDCProviderMetadataResolverTest {
         
         final Issuer iss = new Issuer("https://example.oidc.op.org");
         final MetadataManagementData<Issuer> mgmtData = dynCache.getBackingStore()
-                .computeManagementDataIfAbsent(iss);
+                .computeManagementDataIfAbsent(iss, MetadataManagementData::new);
         final Instant now = Instant.now();
         mgmtData.setLastUpdateTime(now);
         //metadata not expired
@@ -438,8 +439,8 @@ public class OIDCProviderMetadataResolverTest {
                             extends DynamicMetadataCache<IdentifierType, MetadataType> {
 
         TestableDynamicMetadataCache(DynamicBackingStore<IdentifierType, MetadataType> store,
-                Function<CriteriaSet, MetadataType> metadataFetchStrategy, ScheduledExecutorService executor) {
-            super(store, metadataFetchStrategy, executor);
+                ScheduledExecutorService executor) {
+            super(store, executor);
         }
         
         /* Expose the backing store with a public method.*/

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


More information about the commits mailing list