Skip to content

Commit

Permalink
Merged in NOISSUE-possible-test-fix (pull request #74)
Browse files Browse the repository at this point in the history
[NOISSUE]

This is an attempt to fix the auth test on jenkins.
  • Loading branch information
Bill Smith authored and Jonathan Johnson committed May 18, 2018
1 parent a6f2fd9 commit 8df0c6b
Showing 1 changed file with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
}
}
}
}

0 comments on commit 8df0c6b

Please sign in to comment.