Skip to content

Commit

Permalink
Merge branch 'master' into NOJIRA-selenium-react-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Bill Smith committed Aug 24, 2021
2 parents ade135d + ae38896 commit 7e9767a
Show file tree
Hide file tree
Showing 130 changed files with 7,057 additions and 2,399 deletions.
11 changes: 8 additions & 3 deletions backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ plugins {
id 'org.springframework.boot' version '2.4.2'
id 'com.gorylenko.gradle-git-properties' version '1.4.21'
id 'io.freefair.lombok' version '5.3.0'
id 'com.palantir.docker' version '0.20.1'
id 'com.palantir.docker-run' version '0.20.1'
id 'com.palantir.docker' version '0.28.0'
id 'com.palantir.docker-run' version '0.28.0'
}

apply plugin: 'io.spring.dependency-management'
Expand Down Expand Up @@ -330,10 +330,15 @@ jacocoTestReport {
}
}

ext {
now = new Date().format("yyyyMMddHHmmss", TimeZone.getTimeZone('GMT'))
}

tasks.docker.dependsOn tasks.bootWar
docker {
name 'unicon/shibui'
tags 'latest'
tag 'version', "unicon/shibui:${project.version}${!project.version.endsWith('SNAPSHOT') ? '' : "-${now}"}"
tag 'latest', "unicon/shibui:latest"
pull true
noCache true
files tasks.bootWar.outputs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import edu.internet2.tier.shibboleth.admin.ui.domain.frontend.ServiceProviderSso
import edu.internet2.tier.shibboleth.admin.ui.opensaml.OpenSamlObjects
import edu.internet2.tier.shibboleth.admin.ui.repository.EntityDescriptorRepository
import edu.internet2.tier.shibboleth.admin.ui.service.EntityDescriptorService
import edu.internet2.tier.shibboleth.admin.util.EntityDescriptorConversionUtils
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.autoconfigure.domain.EntityScan
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest
Expand Down Expand Up @@ -80,6 +81,10 @@ class EntityDescriptorEnversVersioningTests extends Specification {

@Autowired
OpenSamlObjects openSamlObjects

def setup() {
EntityDescriptorConversionUtils.openSamlObjects = openSamlObjects
}

def "test versioning with contact persons"() {
setup:
Expand Down Expand Up @@ -303,7 +308,7 @@ class EntityDescriptorEnversVersioningTests extends Specification {
entityManager)

//Groovy FTW - able to call any private methods on ANY object. Get first revision
UIInfo uiinfo = entityDescriptorService.getUIInfo(getTargetEntityForRevisionIndex(entityDescriptorHistory, 0))
UIInfo uiinfo = EntityDescriptorConversionUtils.getUIInfo(getTargetEntityForRevisionIndex(entityDescriptorHistory, 0))

then:
entityDescriptorHistory.size() == 1
Expand Down Expand Up @@ -336,9 +341,9 @@ class EntityDescriptorEnversVersioningTests extends Specification {
entityManager)

//Get second revision
uiinfo = entityDescriptorService.getUIInfo(getTargetEntityForRevisionIndex(entityDescriptorHistory, 1))
uiinfo = EntityDescriptorConversionUtils.getUIInfo(getTargetEntityForRevisionIndex(entityDescriptorHistory, 1))
//And initial revision
def uiinfoInitialRevision = entityDescriptorService.getUIInfo(getTargetEntityForRevisionIndex(entityDescriptorHistory, 0))
def uiinfoInitialRevision = EntityDescriptorConversionUtils.getUIInfo(getTargetEntityForRevisionIndex(entityDescriptorHistory, 0))

then:
entityDescriptorHistory.size() == 2
Expand Down Expand Up @@ -389,7 +394,7 @@ class EntityDescriptorEnversVersioningTests extends Specification {

//Get initial revision
SPSSODescriptor spssoDescriptor =
entityDescriptorService.getSPSSODescriptorFromEntityDescriptor(getTargetEntityForRevisionIndex(entityDescriptorHistory,0))
EntityDescriptorConversionUtils.getSPSSODescriptorFromEntityDescriptor(getTargetEntityForRevisionIndex(entityDescriptorHistory,0))

KeyDescriptor keyDescriptor = spssoDescriptor.keyDescriptors[0]
X509Certificate x509cert = keyDescriptor.keyInfo.x509Datas[0].x509Certificates[0]
Expand Down Expand Up @@ -421,7 +426,7 @@ class EntityDescriptorEnversVersioningTests extends Specification {


//Get second revision
SPSSODescriptor spssoDescriptor_second = entityDescriptorService.getSPSSODescriptorFromEntityDescriptor(getTargetEntityForRevisionIndex(entityDescriptorHistory,1))
SPSSODescriptor spssoDescriptor_second = EntityDescriptorConversionUtils.getSPSSODescriptorFromEntityDescriptor(getTargetEntityForRevisionIndex(entityDescriptorHistory,1))

KeyDescriptor keyDescriptor_second1 = spssoDescriptor_second.keyDescriptors[0]
X509Certificate x509cert_second1 = keyDescriptor_second1.keyInfo.x509Datas[0].x509Certificates[0]
Expand All @@ -431,7 +436,7 @@ class EntityDescriptorEnversVersioningTests extends Specification {

//Get initial revision
spssoDescriptor =
entityDescriptorService.getSPSSODescriptorFromEntityDescriptor(getTargetEntityForRevisionIndex(entityDescriptorHistory,0))
EntityDescriptorConversionUtils.getSPSSODescriptorFromEntityDescriptor(getTargetEntityForRevisionIndex(entityDescriptorHistory,0))

keyDescriptor = spssoDescriptor.keyDescriptors[0]
x509cert = keyDescriptor.keyInfo.x509Datas[0].x509Certificates[0]
Expand Down Expand Up @@ -475,7 +480,7 @@ class EntityDescriptorEnversVersioningTests extends Specification {
entityManager)

SPSSODescriptor spssoDescriptor =
entityDescriptorService.getSPSSODescriptorFromEntityDescriptor(getTargetEntityForRevisionIndex(entityDescriptorHistory,0))
EntityDescriptorConversionUtils.getSPSSODescriptorFromEntityDescriptor(getTargetEntityForRevisionIndex(entityDescriptorHistory,0))
AssertionConsumerService acs = spssoDescriptor.assertionConsumerServices[0]

then:
Expand All @@ -500,12 +505,12 @@ class EntityDescriptorEnversVersioningTests extends Specification {
entityManager)

SPSSODescriptor spssoDescriptor2 =
entityDescriptorService.getSPSSODescriptorFromEntityDescriptor(getTargetEntityForRevisionIndex(entityDescriptorHistory,1))
EntityDescriptorConversionUtils.getSPSSODescriptorFromEntityDescriptor(getTargetEntityForRevisionIndex(entityDescriptorHistory,1))
def (acs1, acs2) = [spssoDescriptor2.assertionConsumerServices[0], spssoDescriptor2.assertionConsumerServices[1]]

//Initial revision
spssoDescriptor =
entityDescriptorService.getSPSSODescriptorFromEntityDescriptor(getTargetEntityForRevisionIndex(entityDescriptorHistory,0))
EntityDescriptorConversionUtils.getSPSSODescriptorFromEntityDescriptor(getTargetEntityForRevisionIndex(entityDescriptorHistory,0))
acs = spssoDescriptor.assertionConsumerServices[0]

then:
Expand Down Expand Up @@ -543,7 +548,7 @@ class EntityDescriptorEnversVersioningTests extends Specification {
entityManager)

SPSSODescriptor spssoDescriptor =
entityDescriptorService.getSPSSODescriptorFromEntityDescriptor(getTargetEntityForRevisionIndex(entityDescriptorHistory, 0))
EntityDescriptorConversionUtils.getSPSSODescriptorFromEntityDescriptor(getTargetEntityForRevisionIndex(entityDescriptorHistory, 0))
SingleLogoutService slo = spssoDescriptor.singleLogoutServices[0]

then:
Expand All @@ -565,12 +570,12 @@ class EntityDescriptorEnversVersioningTests extends Specification {
entityManager)

SPSSODescriptor spssoDescriptor2 =
entityDescriptorService.getSPSSODescriptorFromEntityDescriptor(getTargetEntityForRevisionIndex(entityDescriptorHistory, 1))
EntityDescriptorConversionUtils.getSPSSODescriptorFromEntityDescriptor(getTargetEntityForRevisionIndex(entityDescriptorHistory, 1))
def (slo1, slo2) = [spssoDescriptor2.singleLogoutServices[0], spssoDescriptor2.singleLogoutServices[1]]

//Initial revision
spssoDescriptor =
entityDescriptorService.getSPSSODescriptorFromEntityDescriptor(getTargetEntityForRevisionIndex(entityDescriptorHistory, 0))
EntityDescriptorConversionUtils.getSPSSODescriptorFromEntityDescriptor(getTargetEntityForRevisionIndex(entityDescriptorHistory, 0))
slo = spssoDescriptor.singleLogoutServices[0]

then:
Expand Down Expand Up @@ -608,7 +613,7 @@ class EntityDescriptorEnversVersioningTests extends Specification {
txMgr,
entityManager)

EntityAttributes attrs = entityDescriptorService.getEntityAttributes(getTargetEntityForRevisionIndex(entityDescriptorHistory, 0))
EntityAttributes attrs = EntityDescriptorConversionUtils.getEntityAttributes(getTargetEntityForRevisionIndex(entityDescriptorHistory, 0))

then:
entityDescriptorHistory.size() == 1
Expand All @@ -628,10 +633,10 @@ class EntityDescriptorEnversVersioningTests extends Specification {
txMgr,
entityManager)

EntityAttributes attrs2 = entityDescriptorService.getEntityAttributes(getTargetEntityForRevisionIndex(entityDescriptorHistory, 1))
EntityAttributes attrs2 = EntityDescriptorConversionUtils.getEntityAttributes(getTargetEntityForRevisionIndex(entityDescriptorHistory, 1))

//Initial revision
attrs = entityDescriptorService.getEntityAttributes(getTargetEntityForRevisionIndex(entityDescriptorHistory, 0))
attrs = EntityDescriptorConversionUtils.getEntityAttributes(getTargetEntityForRevisionIndex(entityDescriptorHistory, 0))

expectedModifiedPersistentEntities = [EntityDescriptor.name,
EntityAttributes.name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import edu.internet2.tier.shibboleth.admin.ui.configuration.Internationalization
import edu.internet2.tier.shibboleth.admin.ui.configuration.SearchConfiguration
import edu.internet2.tier.shibboleth.admin.ui.configuration.TestConfiguration
import edu.internet2.tier.shibboleth.admin.ui.domain.EntityDescriptor
import edu.internet2.tier.shibboleth.admin.ui.exception.EntityNotFoundException
import edu.internet2.tier.shibboleth.admin.ui.repository.EntityDescriptorRepository
import edu.internet2.tier.shibboleth.admin.ui.repository.envers.EnversTestsSupport
import edu.internet2.tier.shibboleth.admin.ui.service.EntityDescriptorService
Expand Down Expand Up @@ -108,15 +109,20 @@ class EnversEntityDescriptorVersionServiceTests extends Specification {
v2EdRepresentation.id == ed.resourceId
}

def "versioning service returns null for non existent version number"() {
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) {
entityDescriptorRepository.save(ed)
}
def edRepresentation = entityDescriptorVersionService.findSpecificVersionOfEntityDescriptor(ed.resourceId, '1000')


then:
!edRepresentation
try {
def edRepresentation = entityDescriptorVersionService.findSpecificVersionOfEntityDescriptor(ed.resourceId, '1000')
1 == 2
}
catch (EntityNotFoundException expected) {
1 == 1
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,12 @@ class SeleniumSIDETest extends Specification {
'SHIBUI-1391: Regex Validation' | '/SHIBUI-1391.side'
'SHIBUI-1407: Metadata source comparison highlights' | '/SHIBUI-1407-1.side'
'SHIBUI-1407: Metadata provider comparison highlights' | '/SHIBUI-1407-2.side'
// 'SHIBUI-1503: Non-admin can create metadata source' | '/SHIBUI-1503-1.side' // bug, see SHIBUI-1974
'SHIBUI-1503: User can be deleted' | '/SHIBUI-1503-2.side' // Note that this script can only be run once successfully (per startup of the app) without first having to add the Bad Robot user back in to the system
'SHIBUI-1503: User can be enabled' | '/SHIBUI-1503-3.side'
'SHIBUI-1503: Non-admin can create metadata source' | '/SHIBUI-1503-1.side' // bug, see SHIBUI-1974
'SHIBUI-1503: User can be deleted' | '/SHIBUI-1503-2.side' // Note that this script can only be run once successfully (per startup of the app) without first having to add the Bad Robot user back in to the system
'SHIBUI-1503: User can be enabled' | '/SHIBUI-1503-3.side'
'SHIBUI-1740: Group can be created, edited, deleted' | '/SHIBUI-1740-1.side'
'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'
}
}
Loading

0 comments on commit 7e9767a

Please sign in to comment.