Skip to content

Commit

Permalink
Merged in merge-master-1743 (pull request #525)
Browse files Browse the repository at this point in the history
Merge master 1743
  • Loading branch information
chasegawa committed Sep 9, 2021
2 parents 9cde801 + c23ba82 commit f9ccfce
Show file tree
Hide file tree
Showing 132 changed files with 3,959 additions and 1,259 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -406,4 +406,5 @@ beacon/spring/out
*.classpath
*.settings
*.project
*bin
*bin
/a.json
19 changes: 18 additions & 1 deletion backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,23 @@ configurations {

def generatedSrcDir = new File(buildDir, 'generated/src/main/java')

//test {
// exclude 'edu/internet2/tier/shibboleth/admin/ui/configuration/*.class'
// exclude 'edu/internet2/tier/shibboleth/admin/ui/controller/*.class'
// exclude 'edu/internet2/tier/shibboleth/admin/ui/domain/*.class'
// exclude 'edu/internet2/tier/shibboleth/admin/ui/domain/filters/*.class'
// exclude 'edu/internet2/tier/shibboleth/admin/ui/domain/resolvers/*.class'
// exclude 'edu/internet2/tier/shibboleth/admin/ui/domain/versioning/*.class'
// exclude 'edu/internet2/tier/shibboleth/admin/ui/repository/*.class'
// exclude 'edu/internet2/tier/shibboleth/admin/ui/scheduled/*.class'
// exclude 'edu/internet2/tier/shibboleth/admin/ui/security/controller/*.class'
// exclude 'edu/internet2/tier/shibboleth/admin/ui/security/repository/*.class'
//// exclude 'edu/internet2/tier/shibboleth/admin/ui/security/service/*.class'
//// exclude 'edu/internet2/tier/shibboleth/admin/ui/security/springsecurity/*.class'
// exclude 'edu/internet2/tier/shibboleth/admin/ui/service/*.class'
// exclude 'edu/internet2/tier/shibboleth/admin/ui/util/*.class'
//}

sourceSets {
main {
groovy {
Expand Down Expand Up @@ -353,4 +370,4 @@ dockerRun {
daemonize true
command '--spring.profiles.include=very-dangerous,dev', '--shibui.default-password={noop}password'
clean true
}
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
package edu.internet2.tier.shibboleth.admin.ui.controller

import edu.internet2.tier.shibboleth.admin.ui.domain.EntityDescriptor
import edu.internet2.tier.shibboleth.admin.ui.domain.Organization
import edu.internet2.tier.shibboleth.admin.ui.domain.OrganizationDisplayName
import edu.internet2.tier.shibboleth.admin.ui.domain.OrganizationName
import edu.internet2.tier.shibboleth.admin.ui.domain.OrganizationURL
import edu.internet2.tier.shibboleth.admin.ui.domain.frontend.EntityDescriptorRepresentation
import edu.internet2.tier.shibboleth.admin.ui.repository.EntityDescriptorRepository
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.boot.test.web.client.TestRestTemplate
import org.springframework.http.HttpEntity
import org.springframework.http.HttpHeaders
import org.springframework.http.HttpMethod
import org.springframework.http.MediaType
import org.springframework.test.annotation.DirtiesContext
import org.springframework.test.context.ActiveProfiles
import spock.lang.Specification

Expand Down Expand Up @@ -111,44 +100,9 @@ class EntityDescriptorControllerVersionEndpointsIntegrationTests extends Specifi
edv2.body.serviceProviderName == 'SP2'
}

@DirtiesContext(methodMode = DirtiesContext.MethodMode.AFTER_METHOD)
def 'SHIBUI-1414'() {
given:
def ed = new EntityDescriptor(entityID: 'testme', serviceProviderName: 'testme').with {
entityDescriptorRepository.save(it)
}.with {
it.setOrganization(new Organization().with {
it.organizationNames = [new OrganizationName(value: 'testme', XMLLang: 'en')]
it.organizationDisplayNames = [new OrganizationDisplayName(value: 'testme', XMLLang: 'en')]
it.organizationURLs = [new OrganizationURL(value: 'http://testme.org', XMLLang: 'en')]
it
})
entityDescriptorRepository.save(it)
}
when:
def headers = new HttpHeaders().with {
it.set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
it
}

def allVersions = getAllEntityDescriptorVersions(ed.resourceId, List)
String edv1 = getEntityDescriptorForVersion(ed.resourceId, allVersions.body[0].id, String).body
def tedv2 = getEntityDescriptorForVersion(ed.resourceId, allVersions.body[1].id, EntityDescriptorRepresentation).body

def aedv1 = new JsonSlurper().parseText(edv1).with {
it.put('version', tedv2.version)
it
}.with {
JsonOutput.toJson(it)
}

def request = new HttpEntity(aedv1, headers)
def response = this.restTemplate.exchange("/api/EntityDescriptor/${ed.resourceId}", HttpMethod.PUT, request, String)

then:
response.statusCodeValue != 400
noExceptionThrown()
}
// Moved to its own test in the main testing package
// def 'SHIBUI-1414'() {
// }

private getAllEntityDescriptorVersions(String resourceId, responseType) {
this.restTemplate.getForEntity(resourceUriFor(ALL_VERSIONS_URI, resourceId), responseType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class EnversEntityDescriptorVersionServiceTests extends Specification {

when: 'Second version'
ed.serviceProviderName = 'SP2'
ed = edu.internet2.tier.shibboleth.admin.ui.repository.envers.EnversTestsSupport.doInExplicitTransaction(txMgr) {
ed = EnversTestsSupport.doInExplicitTransaction(txMgr) {
entityDescriptorRepository.save(ed)
}
versions = entityDescriptorVersionService.findVersionsForEntityDescriptor(ed.resourceId)
Expand All @@ -71,7 +71,7 @@ class EnversEntityDescriptorVersionServiceTests extends Specification {

when: 'Third version'
ed.serviceProviderName = 'SP3'
ed = edu.internet2.tier.shibboleth.admin.ui.repository.envers.EnversTestsSupport.doInExplicitTransaction(txMgr) {
ed = EnversTestsSupport.doInExplicitTransaction(txMgr) {
entityDescriptorRepository.save(ed)
}
versions = entityDescriptorVersionService.findVersionsForEntityDescriptor(ed.resourceId)
Expand All @@ -86,7 +86,7 @@ class EnversEntityDescriptorVersionServiceTests extends Specification {
def "versioning service returns correct entity descriptor for version number"() {
when: 'Initial version'
EntityDescriptor ed = new EntityDescriptor(entityID: 'ed', serviceProviderName: 'SP1', createdBy: 'anonymousUser')
ed = edu.internet2.tier.shibboleth.admin.ui.repository.envers.EnversTestsSupport.doInExplicitTransaction(txMgr) {
ed = EnversTestsSupport.doInExplicitTransaction(txMgr) {
entityDescriptorRepository.save(ed)
}
def versions = entityDescriptorVersionService.findVersionsForEntityDescriptor(ed.resourceId)
Expand All @@ -98,7 +98,7 @@ class EnversEntityDescriptorVersionServiceTests extends Specification {

when: 'Update the original'
ed.serviceProviderName = 'SP2'
ed = edu.internet2.tier.shibboleth.admin.ui.repository.envers.EnversTestsSupport.doInExplicitTransaction(txMgr) {
ed = EnversTestsSupport.doInExplicitTransaction(txMgr) {
entityDescriptorRepository.save(ed)
}
versions = entityDescriptorVersionService.findVersionsForEntityDescriptor(ed.resourceId)
Expand All @@ -112,17 +112,17 @@ class EnversEntityDescriptorVersionServiceTests extends Specification {
def "versioning service throws EntityNotFoundException for non existent version number"() {
when: 'Initial version'
EntityDescriptor ed = new EntityDescriptor(entityID: 'ed', serviceProviderName: 'SP1', createdBy: 'anonymousUser')
ed = edu.internet2.tier.shibboleth.admin.ui.repository.envers.EnversTestsSupport.doInExplicitTransaction(txMgr) {
ed = EnversTestsSupport.doInExplicitTransaction(txMgr) {
entityDescriptorRepository.save(ed)
}

then:
try {
def edRepresentation = entityDescriptorVersionService.findSpecificVersionOfEntityDescriptor(ed.resourceId, '1000')
1 == 2
false
}
catch (EntityNotFoundException expected) {
1 == 1
true
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ class SeleniumSIDETest extends Specification {
'SHIBUI-1740: Verify dev profile group membership' | '/SHIBUI-1740-2.side'
'SHIBUI-1740: Verify admin-owned resource not visible to nonadmins' | '/SHIBUI-1740-3.side'
'SHIBUI-1740: Verify nonadmin-owned resource visibility' | '/SHIBUI-1740-4.side'
'SHIBUI-1742: Verify enabler role allows enabling' | '/SHIBUI-1742-1.side'
'SHIBUI-1742: Verify role CRUD operations' | '/SHIBUI-1742-2.side'
}
}

Loading

0 comments on commit f9ccfce

Please sign in to comment.