From 8df0c6b47d875027c90bc14fd85a260f645e2d25 Mon Sep 17 00:00:00 2001 From: Bill Smith Date: Fri, 18 May 2018 19:18:56 +0000 Subject: [PATCH] Merged in NOISSUE-possible-test-fix (pull request #74) [NOISSUE] This is an attempt to fix the auth test on jenkins. --- ...faultAuthenticationIntegrationTests.groovy | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/backend/src/test/groovy/edu/internet2/tier/shibboleth/admin/ui/controller/DefaultAuthenticationIntegrationTests.groovy b/backend/src/test/groovy/edu/internet2/tier/shibboleth/admin/ui/controller/DefaultAuthenticationIntegrationTests.groovy index 43b6c850e..c70e6f44f 100644 --- a/backend/src/test/groovy/edu/internet2/tier/shibboleth/admin/ui/controller/DefaultAuthenticationIntegrationTests.groovy +++ b/backend/src/test/groovy/edu/internet2/tier/shibboleth/admin/ui/controller/DefaultAuthenticationIntegrationTests.groovy @@ -1,7 +1,17 @@ package edu.internet2.tier.shibboleth.admin.ui.controller +import edu.internet2.tier.shibboleth.admin.ui.opensaml.OpenSamlObjects +import net.shibboleth.ext.spring.resource.ResourceHelper +import org.joda.time.DateTime +import org.opensaml.saml.metadata.resolver.ChainingMetadataResolver +import org.opensaml.saml.metadata.resolver.MetadataResolver +import org.opensaml.saml.metadata.resolver.filter.MetadataFilterChain +import org.opensaml.saml.metadata.resolver.impl.ResourceBackedMetadataResolver import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.context.SpringBootTest +import org.springframework.boot.test.context.TestConfiguration +import org.springframework.context.annotation.Bean +import org.springframework.core.io.ClassPathResource import org.springframework.test.context.ActiveProfiles import org.springframework.test.web.reactive.server.WebTestClient import org.springframework.web.util.DefaultUriBuilderFactory @@ -33,4 +43,36 @@ class DefaultAuthenticationIntegrationTests extends Specification { .expectStatus().isEqualTo(302) .expectHeader().valueMatches("Location", "http://localhost:\\d*/login") } + + @TestConfiguration + static class Config { + @Autowired + OpenSamlObjects openSamlObjects + + @Bean + MetadataResolver metadataResolver() { + def resource = ResourceHelper.of(new ClassPathResource("/metadata/aggregate.xml")) + def aggregate = new ResourceBackedMetadataResolver(resource){ + @Override + DateTime getLastRefresh() { + return null + } + } + + aggregate.with { + it.metadataFilter = new MetadataFilterChain() + it.id = 'testme' + it.parserPool = openSamlObjects.parserPool + it.initialize() + it + } + + return new ChainingMetadataResolver().with { + it.id = 'chain' + it.resolvers = [aggregate] + it.initialize() + it + } + } + } }