[java-oidc-common] branch main updated: Fix test. Add headers
Phil Smart
philip.smart at jisc.ac.uk
Wed Mar 9 15:23:37 UTC 2022
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=624b85ca67f45b48ba112008c4379fc0cbf22fe9
The following commit(s) were added to refs/heads/main by this push:
new 624b85c Fix test. Add headers
624b85c is described below
commit 624b85ca67f45b48ba112008c4379fc0cbf22fe9
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Wed Mar 9 15:23:31 2022 +0000
Fix test. Add headers
---
.../oidc/metadata/cache/impl/MetadataCacheBuilder.java | 17 +++++++++++++++++
.../metadata/cache/impl/MetadataCacheBuilderSpec.java | 17 +++++++++++++++++
.../policy/impl/OIDCMetadataPolicyResolverTest.java | 15 ++++++++++-----
3 files changed, 44 insertions(+), 5 deletions(-)
diff --git a/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/MetadataCacheBuilder.java b/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/MetadataCacheBuilder.java
index c862103..5d0179c 100644
--- a/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/MetadataCacheBuilder.java
+++ b/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/MetadataCacheBuilder.java
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package net.shibboleth.oidc.metadata.cache.impl;
import javax.annotation.Nonnull;
diff --git a/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/MetadataCacheBuilderSpec.java b/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/MetadataCacheBuilderSpec.java
index 8dcd28b..c65db1e 100644
--- a/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/MetadataCacheBuilderSpec.java
+++ b/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/MetadataCacheBuilderSpec.java
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package net.shibboleth.oidc.metadata.cache.impl;
/**
diff --git a/oidc-common-metadata-impl/src/test/java/net/shibboleth/oidc/metadata/policy/impl/OIDCMetadataPolicyResolverTest.java b/oidc-common-metadata-impl/src/test/java/net/shibboleth/oidc/metadata/policy/impl/OIDCMetadataPolicyResolverTest.java
index 6095433..3dc9d4c 100644
--- a/oidc-common-metadata-impl/src/test/java/net/shibboleth/oidc/metadata/policy/impl/OIDCMetadataPolicyResolverTest.java
+++ b/oidc-common-metadata-impl/src/test/java/net/shibboleth/oidc/metadata/policy/impl/OIDCMetadataPolicyResolverTest.java
@@ -28,12 +28,13 @@ import org.springframework.core.io.Resource;
import org.testng.Assert;
import org.testng.annotations.Test;
+import net.shibboleth.oidc.metadata.cache.MetadataCache;
import net.shibboleth.oidc.metadata.cache.impl.BatchMetadataCache;
-import net.shibboleth.oidc.metadata.cache.impl.BatchMetadataCacheBuilder;
import net.shibboleth.oidc.metadata.cache.impl.BatchMetadataCacheBuilderSpec;
import net.shibboleth.oidc.metadata.cache.impl.DefaultFileLoadingStrategy;
import net.shibboleth.oidc.metadata.cache.impl.DefaultJSONMapParsingStrategy;
import net.shibboleth.oidc.metadata.cache.impl.DefaultSourceMetadataExpirationTimeStrategy;
+import net.shibboleth.oidc.metadata.cache.impl.MetadataCacheBuilder;
import net.shibboleth.oidc.metadata.policy.MetadataPolicy;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
import net.shibboleth.utilities.java.support.resolver.CriteriaSet;
@@ -51,13 +52,13 @@ public class OIDCMetadataPolicyResolverTest {
resolver.initialize();
}
- protected BatchMetadataCache<String, Map<String, MetadataPolicy>> buildCache(String filename)
+ protected BatchMetadataCache<String, Map<String, MetadataPolicy>> buildCache(final String filename)
throws IOException, ComponentInitializationException {
final Resource file = filename == null || filename.isEmpty()? null : new ClassPathResource(filename);
- BatchMetadataCacheBuilderSpec<String, Map<String, MetadataPolicy>> spec =
+ final BatchMetadataCacheBuilderSpec<String, Map<String, MetadataPolicy>> spec =
new BatchMetadataCacheBuilderSpec<String, Map<String, MetadataPolicy>>();
- var builder = new BatchMetadataCacheBuilder.Builder<String, Map<String, MetadataPolicy>>();
+ final var builder = new MetadataCacheBuilder.Builder<String, Map<String, MetadataPolicy>>();
spec.setLoadingStrategy(new DefaultFileLoadingStrategy(file));
spec.setParsingStrategy(new DefaultJSONMapParsingStrategy<>(MetadataPolicy.class));
spec.setMinRefreshDelay(Duration.ofMinutes(5));
@@ -71,7 +72,11 @@ public class OIDCMetadataPolicyResolverTest {
spec.setRefreshDelayFactor(0.75f);
spec.setMetadataFilterStrategy((metadata, context) -> metadata);
- return builder.build(spec);
+ final MetadataCache<Map<String, MetadataPolicy>> cache = builder.build(spec);
+ if (!(cache instanceof BatchMetadataCache)) {
+ throw new ComponentInitializationException("Wrong cache type");
+ }
+ return (BatchMetadataCache<String, Map<String, MetadataPolicy>>) cache;
}
@Test
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list