diff --git a/backend/src/enversTest/groovy/edu/internet2/tier/shibboleth/admin/ui/controller/EntityDescriptorControllerVersionEndpointsIntegrationTests.groovy b/backend/src/enversTest/groovy/edu/internet2/tier/shibboleth/admin/ui/controller/EntityDescriptorControllerVersionEndpointsIntegrationTests.groovy index 99b5810ce..82b143c00 100644 --- a/backend/src/enversTest/groovy/edu/internet2/tier/shibboleth/admin/ui/controller/EntityDescriptorControllerVersionEndpointsIntegrationTests.groovy +++ b/backend/src/enversTest/groovy/edu/internet2/tier/shibboleth/admin/ui/controller/EntityDescriptorControllerVersionEndpointsIntegrationTests.groovy @@ -1,11 +1,22 @@ 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 @@ -100,6 +111,46 @@ 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) + def 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() + } + private getAllEntityDescriptorVersions(String resourceId, responseType) { this.restTemplate.getForEntity(resourceUriFor(ALL_VERSIONS_URI, resourceId), responseType) } diff --git a/backend/src/integration/groovy/edu/internet2/tier/shibboleth/admin/ui/SeleniumSIDETest.groovy b/backend/src/integration/groovy/edu/internet2/tier/shibboleth/admin/ui/SeleniumSIDETest.groovy index b96f4c476..e61c9dc26 100644 --- a/backend/src/integration/groovy/edu/internet2/tier/shibboleth/admin/ui/SeleniumSIDETest.groovy +++ b/backend/src/integration/groovy/edu/internet2/tier/shibboleth/admin/ui/SeleniumSIDETest.groovy @@ -118,6 +118,7 @@ class SeleniumSIDETest extends Specification { 'SHIBUI-1335: Verify Filesystem Metadata Provider Filters' | '/SHIBUI-1335-2.side' 'SHIBUI-1335: Verify Local Dynamic Metadata Provider Filters' | '/SHIBUI-1335-3.side' 'SHIBUI-1335: Verify Dynamic HTTP Metadata Provider Filters' | '/SHIBUI-1335-4.side' + 'SHIBUI-1392: Verify provider with script filter is persistable' | '/SHIBUI-1392.side' } } diff --git a/backend/src/integration/resources/SHIBUI-1335-1.side b/backend/src/integration/resources/SHIBUI-1335-1.side index 1af0bba89..f38eac2ce 100644 --- a/backend/src/integration/resources/SHIBUI-1335-1.side +++ b/backend/src/integration/resources/SHIBUI-1335-1.side @@ -117,6 +117,13 @@ ["xpath=//li[2]/button", "xpath:position"] ], "value": "" + }, { + "id": "352f066f-c2af-4735-81b1-5440ba7a3432", + "comment": "", + "command": "waitForElementVisible", + "target": "id=/xmlId", + "targets": [], + "value": "10000" }, { "id": "e7462621-f4e4-4512-b200-20afa5685fc6", "comment": "", @@ -1352,14 +1359,10 @@ }, { "id": "c28d683a-552d-4752-aa89-465e33d60887", "comment": "", - "command": "waitForElementVisible", - "target": "css=tr:nth-child(2) > .td-lg:nth-child(4)", - "targets": [ - ["css=tr:nth-child(2) > .td-lg:nth-child(4)", "css:finder"], - ["xpath=//tr[2]/td[4]", "xpath:position"], - ["xpath=//td[contains(.,'NameIDFormat')]", "xpath:innerText"] - ], - "value": "10000" + "command": "pause", + "target": "2000", + "targets": [], + "value": "" }, { "id": "100902ee-6d6e-4148-a69b-b37746a4ad6e", "comment": "", @@ -1381,6 +1384,13 @@ ["xpath=//button[2]/i", "xpath:position"] ], "value": "" + }, { + "id": "febfcea8-8f72-4a17-b1a8-b1e323c8cced", + "comment": "", + "command": "pause", + "target": "2000", + "targets": [], + "value": "" }, { "id": "c9d498da-9f59-40ae-b5d4-cae397a13766", "comment": "", @@ -1402,6 +1412,13 @@ ["xpath=//button[2]/i", "xpath:position"] ], "value": "" + }, { + "id": "4fdc2334-0b93-4f4c-b44e-80656f808f6d", + "comment": "", + "command": "pause", + "target": "2000", + "targets": [], + "value": "" }, { "id": "441608df-24a3-4a60-bfce-50a90ff0ee16", "comment": "", diff --git a/backend/src/integration/resources/SHIBUI-1335-2.side b/backend/src/integration/resources/SHIBUI-1335-2.side index 3a1c51b24..88ef75013 100644 --- a/backend/src/integration/resources/SHIBUI-1335-2.side +++ b/backend/src/integration/resources/SHIBUI-1335-2.side @@ -691,10 +691,10 @@ }, { "id": "eca1d3dd-9e47-49d2-b4a1-a45c2b6c8c3a", "comment": "", - "command": "waitForElementVisible", - "target": "css=tr:nth-child(1) > .td-lg:nth-child(4)", + "command": "pause", + "target": "2000", "targets": [], - "value": "10000" + "value": "" }, { "id": "d722902b-5c10-45dc-99df-d96f46e78313", "comment": "", @@ -716,6 +716,13 @@ ["xpath=//button[2]/i", "xpath:position"] ], "value": "" + }, { + "id": "d25400e1-127e-4b8c-b7e2-ade937cfd5a0", + "comment": "", + "command": "pause", + "target": "2000", + "targets": [], + "value": "" }, { "id": "d7909094-96ce-4532-98b4-446cc013c9c8", "comment": "", diff --git a/backend/src/integration/resources/SHIBUI-1335-3.side b/backend/src/integration/resources/SHIBUI-1335-3.side index f85088621..865b8aa0e 100644 --- a/backend/src/integration/resources/SHIBUI-1335-3.side +++ b/backend/src/integration/resources/SHIBUI-1335-3.side @@ -785,10 +785,10 @@ }, { "id": "455e24c1-5093-4da3-a62d-457bbf0cd5db", "comment": "", - "command": "waitForElementVisible", - "target": "css=tr:nth-child(2) > .td-lg:nth-child(4)", + "command": "pause", + "target": "2000", "targets": [], - "value": "10000" + "value": "" }, { "id": "9f7e95cf-4dd5-415f-8577-a6f1bc54a85d", "comment": "", @@ -810,6 +810,13 @@ ["xpath=//td[contains(.,'NameIDFormat')]", "xpath:innerText"] ], "value": "NameIDFormat" + }, { + "id": "81970d9d-2892-4b42-ba56-ba1a14f453d2", + "comment": "", + "command": "pause", + "target": "2000", + "targets": [], + "value": "" }, { "id": "63ac7307-0538-4c0d-8e98-2f05c767baaf", "comment": "", diff --git a/backend/src/integration/resources/SHIBUI-1335-4.side b/backend/src/integration/resources/SHIBUI-1335-4.side index 8ffe35e98..e20483cf2 100644 --- a/backend/src/integration/resources/SHIBUI-1335-4.side +++ b/backend/src/integration/resources/SHIBUI-1335-4.side @@ -914,7 +914,7 @@ "id": "77dfeb05-38e3-4ef8-9566-06e7597d464c", "comment": "", "command": "click", - "target": "css=.btn-primary > translate-i18n", + "target": "css=.btn-primary", "targets": [ ["css=.btn-primary > translate-i18n", "css:finder"], ["xpath=//div/button/translate-i18n", "xpath:position"], @@ -924,10 +924,10 @@ }, { "id": "f79371b5-0081-45a0-bfb3-c403db903043", "comment": "", - "command": "waitForElementVisible", - "target": "css=tr:nth-child(1) > .td-lg:nth-child(4)", + "command": "pause", + "target": "2000", "targets": [], - "value": "10000" + "value": "" }, { "id": "a8ed628c-53f7-4551-9ce8-fef976cc96ce", "comment": "", @@ -938,6 +938,13 @@ ["xpath=//button[2]/i", "xpath:position"] ], "value": "" + }, { + "id": "6b3ec8f1-8b9a-40f5-816f-3a1e415b9d8d", + "comment": "", + "command": "pause", + "target": "2000", + "targets": [], + "value": "" }, { "id": "be805934-2692-4a1c-a28f-afb3cc4eb5f4", "comment": "", @@ -959,6 +966,13 @@ ["xpath=//button[2]/i", "xpath:position"] ], "value": "" + }, { + "id": "403570ff-e1f0-4db9-925f-f90c5994b60e", + "comment": "", + "command": "pause", + "target": "2000", + "targets": [], + "value": "" }, { "id": "8f2da627-e8ad-473a-a71a-bec5dd1f0999", "comment": "", diff --git a/backend/src/integration/resources/SHIBUI-1392.side b/backend/src/integration/resources/SHIBUI-1392.side new file mode 100644 index 000000000..a0a5b5b55 --- /dev/null +++ b/backend/src/integration/resources/SHIBUI-1392.side @@ -0,0 +1,479 @@ +{ + "id": "4e005712-0763-4f93-9934-d44663672a48", + "version": "2.0", + "name": "SHIBUI-1392", + "url": "http://localhost:10101", + "tests": [{ + "id": "d35b1f2b-5534-4ddb-9b37-1cc7b809ec9f", + "name": "SHIBUI-1392", + "commands": [{ + "id": "0c418562-dd1c-4727-a304-3f8977acc29f", + "comment": "", + "command": "open", + "target": "/login", + "targets": [], + "value": "" + }, { + "id": "0b42793e-c9ac-47fc-ab89-5996c89eb3d7", + "comment": "", + "command": "type", + "target": "name=username", + "targets": [ + ["name=username", "name"], + ["css=tr:nth-child(1) input", "css:finder"], + ["xpath=//input[@name='username']", "xpath:attributes"], + ["xpath=//input", "xpath:position"] + ], + "value": "admin" + }, { + "id": "ae4326d2-6db3-425e-8cec-3e8d95cef71c", + "comment": "", + "command": "type", + "target": "name=password", + "targets": [ + ["name=password", "name"], + ["css=tr:nth-child(2) input", "css:finder"], + ["xpath=//input[@name='password']", "xpath:attributes"], + ["xpath=//tr[2]/td[2]/input", "xpath:position"] + ], + "value": "adminpass" + }, { + "id": "993b1b6d-5eac-426c-b6fe-89cef25ebc91", + "comment": "", + "command": "click", + "target": "name=submit", + "targets": [ + ["name=submit", "name"], + ["css=td:nth-child(1) > input", "css:finder"], + ["xpath=//input[@name='submit']", "xpath:attributes"], + ["xpath=//tr[3]/td/input", "xpath:position"] + ], + "value": "" + }, { + "id": "db2bbd13-3808-4b40-a236-3fe82c1afece", + "comment": "", + "command": "click", + "target": "css=#addNewDropdown", + "targets": [ + ["css=#addNewDropdown > translate-i18n", "css:finder"], + ["xpath=//button[@id='addNewDropdown']/translate-i18n", "xpath:idRelative"], + ["xpath=//translate-i18n", "xpath:position"], + ["xpath=//translate-i18n[contains(.,'Add New')]", "xpath:innerText"] + ], + "value": "" + }, { + "id": "32133aaa-76a4-4dd4-8ee6-a9fc5af25ded", + "comment": "", + "command": "click", + "target": "linkText=Metadata Provider", + "targets": [ + ["linkText=Metadata Provider", "linkText"], + ["css=.nav-link:nth-child(2)", "css:finder"], + ["xpath=//div[@id='navbar']/ul/li/div/a[2]", "xpath:idRelative"], + ["xpath=(//a[contains(@href, '')])[3]", "xpath:href"], + ["xpath=//a[2]", "xpath:position"] + ], + "value": "" + }, { + "id": "ea32c92b-9487-499a-8f7a-242ab6fd196f", + "comment": "", + "command": "waitForElementEditable", + "target": "id=/name", + "targets": [], + "value": "10000" + }, { + "id": "845b34e9-fd90-45de-a38a-469405915292", + "comment": "", + "command": "type", + "target": "id=/name", + "targets": [ + ["id=/name", "id"], + ["name=field1", "name"], + ["css=#\\/name", "css:finder"], + ["xpath=//input[@id='/name']", "xpath:attributes"], + ["xpath=//input", "xpath:position"] + ], + "value": "Test Provider with Script Filter" + }, { + "id": "6daa658d-2560-4448-a522-233ed88e1ad0", + "comment": "", + "command": "select", + "target": "id=/type", + "targets": [], + "value": "label=DynamicHttpMetadataProvider" + }, { + "id": "fb561471-270c-4633-8fe9-ad457ef38459", + "comment": "", + "command": "click", + "target": "css=.next", + "targets": [ + ["css=.next", "css:finder"], + ["xpath=//li[2]/button", "xpath:position"] + ], + "value": "" + }, { + "id": "ba2c6633-3813-42e4-95fc-b1b22da875fa", + "comment": "", + "command": "waitForElementEditable", + "target": "id=/xmlId", + "targets": [], + "value": "10000" + }, { + "id": "09c4adf4-0142-4931-8ffc-ff6ff821e78e", + "comment": "", + "command": "type", + "target": "id=/xmlId", + "targets": [ + ["id=/xmlId", "id"], + ["name=field7", "name"], + ["css=#\\/xmlId", "css:finder"], + ["xpath=//input[@id='/xmlId']", "xpath:attributes"], + ["xpath=//input", "xpath:position"] + ], + "value": "12345" + }, { + "id": "b18627a3-0487-42c0-b3bb-44aa53da8ba3", + "comment": "", + "command": "select", + "target": "id=/metadataRequestURLConstructionScheme/type", + "targets": [], + "value": "label=MetadataQueryProtocol" + }, { + "id": "6548ef95-6862-49ce-82e0-024502aeb9eb", + "comment": "", + "command": "click", + "target": "css=option:nth-child(2)", + "targets": [ + ["css=option:nth-child(2)", "css:finder"], + ["xpath=//option[@value='1: MetadataQueryProtocol']", "xpath:attributes"], + ["xpath=//select[@id='/metadataRequestURLConstructionScheme/type']/option[2]", "xpath:idRelative"], + ["xpath=//option[2]", "xpath:position"], + ["xpath=//option[contains(.,'MetadataQueryProtocol')]", "xpath:innerText"] + ], + "value": "" + }, { + "id": "33263ebe-368a-4804-acb5-8324b822f3ea", + "comment": "", + "command": "click", + "target": "id=/metadataRequestURLConstructionScheme/content", + "targets": [ + ["id=/metadataRequestURLConstructionScheme/content", "id"], + ["name=field10", "name"], + ["css=#\\/metadataRequestURLConstructionScheme\\/content", "css:finder"], + ["xpath=//input[@id='/metadataRequestURLConstructionScheme/content']", "xpath:attributes"], + ["xpath=//div[2]/sf-form-element/div/sf-widget-chooser/custom-string/div/input", "xpath:position"] + ], + "value": "" + }, { + "id": "99061d82-049c-40cc-a7d8-98d792061daf", + "comment": "", + "command": "type", + "target": "id=/metadataRequestURLConstructionScheme/content", + "targets": [ + ["id=/metadataRequestURLConstructionScheme/content", "id"], + ["name=field10", "name"], + ["css=#\\/metadataRequestURLConstructionScheme\\/content", "css:finder"], + ["xpath=//input[@id='/metadataRequestURLConstructionScheme/content']", "xpath:attributes"], + ["xpath=//div[2]/sf-form-element/div/sf-widget-chooser/custom-string/div/input", "xpath:position"] + ], + "value": "someString" + }, { + "id": "e771b05f-e720-40e9-8c8c-c9f65725e34c", + "comment": "", + "command": "click", + "target": "css=div:nth-child(4) .form-check:nth-child(4) > .control-label", + "targets": [ + ["css=div:nth-child(4) .form-check:nth-child(4) > .control-label", "css:finder"], + ["xpath=//div[4]/sf-form-element/div/sf-widget-chooser/boolean-radio/div/div[2]/label", "xpath:position"] + ], + "value": "" + }, { + "id": "c2af34fb-1edd-4824-bc7a-b0232dcbe841", + "comment": "", + "command": "click", + "target": "id=/requireValidMetadata.false", + "targets": [ + ["id=/requireValidMetadata.false", "id"], + ["css=#\\/requireValidMetadata\\.false", "css:finder"], + ["xpath=//input[@id='/requireValidMetadata.false']", "xpath:attributes"], + ["xpath=//div[2]/label/input", "xpath:position"] + ], + "value": "" + }, { + "id": "9c8db077-8e61-40db-96ca-e19dd43132ba", + "comment": "", + "command": "click", + "target": "css=.label:nth-child(1)", + "targets": [ + ["css=.label:nth-child(1)", "css:finder"], + ["xpath=//li[3]/button/span", "xpath:position"] + ], + "value": "" + }, { + "id": "f0b9d3be-705a-4811-8651-d1bba323afd0", + "comment": "", + "command": "click", + "target": "css=.next", + "targets": [ + ["css=.next", "css:finder"], + ["xpath=//li[3]/button", "xpath:position"] + ], + "value": "" + }, { + "id": "e84a4b1e-9e16-4c0f-ba21-5edaac18011e", + "comment": "", + "command": "click", + "target": "css=#\\/metadataFilters\\/SignatureValidation\\/requireSignedRoot\\.parent > .custom-control-label", + "targets": [ + ["css=#\\/metadataFilters\\/SignatureValidation\\/requireSignedRoot\\.parent > .custom-control-label", "css:finder"], + ["xpath=//div[@id='/metadataFilters/SignatureValidation/requireSignedRoot.parent']/label", "xpath:idRelative"], + ["xpath=//div/div/label", "xpath:position"], + ["xpath=//label[contains(.,'Require Signed Root')]", "xpath:innerText"] + ], + "value": "" + }, { + "id": "45e080c0-8ea2-4641-951b-aa819d5b9d64", + "comment": "", + "command": "click", + "target": "css=.next", + "targets": [ + ["css=.next", "css:finder"], + ["xpath=//li[3]/button", "xpath:position"] + ], + "value": "" + }, { + "id": "cce4434c-9723-4ecb-832d-2e200aefe7e1", + "comment": "", + "command": "click", + "target": "css=.custom-control-label", + "targets": [ + ["css=.custom-control-label", "css:finder"], + ["xpath=//div[@id='/enabled.parent']/label", "xpath:idRelative"], + ["xpath=//label", "xpath:position"], + ["xpath=//label[contains(.,'Enable Metadata Provider?')]", "xpath:innerText"] + ], + "value": "" + }, { + "id": "542d9338-36f9-4922-89c2-7109c2d288e0", + "comment": "", + "command": "click", + "target": "css=.save", + "targets": [ + ["css=.save", "css:finder"], + ["xpath=//li[3]/button", "xpath:position"] + ], + "value": "" + }, { + "id": "1566f2a0-790c-4594-806c-7dd6c9c47143", + "comment": "", + "command": "click", + "target": "linkText=Test Provider with Script Filter", + "targets": [ + ["linkText=Test Provider with Script Filter", "linkText"], + ["css=td > a", "css:finder"], + ["xpath=//a[contains(text(),'Test Provider with Script Filter')]", "xpath:link"], + ["xpath=//a[contains(@href, '/metadata/provider/194c05bb-df26-4fd3-b970-ca30f8855e0b/configuration/options')]", "xpath:href"], + ["xpath=//td[2]/a", "xpath:position"], + ["xpath=//a[contains(.,'Test Provider with Script Filter')]", "xpath:innerText"] + ], + "value": "" + }, { + "id": "3b38c153-5b8d-4a3c-a8c2-f089d86e2ae3", + "comment": "", + "command": "click", + "target": "css=#filters .actions span", + "targets": [ + ["css=#filters .actions span", "css:finder"], + ["xpath=//div[@id='filters']/div/div/a/span", "xpath:idRelative"], + ["xpath=//div/a/span", "xpath:position"], + ["xpath=//span[contains(.,'Add Filter')]", "xpath:innerText"] + ], + "value": "" + }, { + "id": "2a2922be-ca4d-4b85-9656-2e6813152ccc", + "comment": "", + "command": "select", + "target": "name=type", + "targets": [], + "value": "label=NameIDFormat" + }, { + "id": "b32ea0ea-16ea-472a-bd28-09082ef35ca5", + "comment": "", + "command": "click", + "target": "id=/name", + "targets": [ + ["id=/name", "id"], + ["name=field38", "name"], + ["css=#\\/name", "css:finder"], + ["xpath=//input[@id='/name']", "xpath:attributes"], + ["xpath=//input", "xpath:position"] + ], + "value": "" + }, { + "id": "62e1fdf7-cfb5-4175-8b75-6d2ca52e73f2", + "comment": "", + "command": "type", + "target": "id=/name", + "targets": [ + ["id=/name", "id"], + ["name=field38", "name"], + ["css=#\\/name", "css:finder"], + ["xpath=//input[@id='/name']", "xpath:attributes"], + ["xpath=//input", "xpath:position"] + ], + "value": "Filter with Script" + }, { + "id": "c92e936c-d516-472f-9f28-36de89117e14", + "comment": "", + "command": "click", + "target": "id=/nameIdFormatFilterTarget.valuedd", + "targets": [ + ["id=/nameIdFormatFilterTarget.valuedd", "id"], + ["css=#\\/nameIdFormatFilterTarget\\.valuedd", "css:finder"], + ["xpath=//button[@id='/nameIdFormatFilterTarget.valuedd']", "xpath:attributes"], + ["xpath=//fieldset/div/div/div/div/button", "xpath:position"], + ["xpath=//button[contains(.,'Entity ID')]", "xpath:innerText"] + ], + "value": "" + }, { + "id": "5699a5a2-d3df-4f99-b95d-f340f9156ffe", + "comment": "", + "command": "click", + "target": "linkText=Script", + "targets": [ + ["linkText=Script", "linkText"], + ["css=.dropdown-item:nth-child(3)", "css:finder"], + ["xpath=//a[contains(text(),'Script')]", "xpath:link"], + ["xpath=(//a[contains(@href, '#')])[3]", "xpath:href"], + ["xpath=//a[3]", "xpath:position"], + ["xpath=//a[contains(.,'Script')]", "xpath:innerText"] + ], + "value": "" + }, { + "id": "786cd3cb-46b2-4361-b449-8f679ff97135", + "comment": "", + "command": "waitForElementPresent", + "target": "id=/nameIdFormatFilterTarget.target", + "targets": [], + "value": "10000" + }, { + "id": "dcf31546-0976-44ae-9ffc-c29a5255d646", + "comment": "", + "command": "click", + "target": "id=/nameIdFormatFilterTarget.target", + "targets": [ + ["id=/nameIdFormatFilterTarget.target", "id"], + ["css=#\\/nameIdFormatFilterTarget\\.target", "css:finder"], + ["xpath=//p[@id='/nameIdFormatFilterTarget.target']", "xpath:attributes"], + ["xpath=//p", "xpath:position"] + ], + "value": "" + }, { + "id": "84be6a98-5739-42e8-b7ca-06a6c86e9f40", + "comment": "", + "command": "editContent", + "target": "id=/nameIdFormatFilterTarget.target", + "targets": [], + "value": "eval(true)" + }, { + "id": "05870356-d3db-4540-bb3f-db34b1cf65f1", + "comment": "", + "command": "sendKeys", + "target": "id=/nameIdFormatFilterTarget.target", + "targets": [], + "value": "${KEY_END};" + }, { + "id": "d7721254-68c9-4140-af2a-1757cce99da7", + "comment": "", + "command": "click", + "target": "css=.section-body", + "targets": [ + ["css=.section-body", "css:finder"], + ["xpath=//section/div[2]", "xpath:position"] + ], + "value": "" + }, { + "id": "ed6eb266-04f0-4517-b874-ea1d0ba68441", + "comment": "", + "command": "click", + "target": "css=#\\/filterEnabled\\.parent > .custom-control-label", + "targets": [ + ["css=#\\/filterEnabled\\.parent > .custom-control-label", "css:finder"], + ["xpath=//div[@id='/filterEnabled.parent']/label", "xpath:idRelative"], + ["xpath=//checkbox-component/div/div/div/label", "xpath:position"], + ["xpath=//label[contains(.,'Enable Filter?')]", "xpath:innerText"] + ], + "value": "" + }, { + "id": "07ddc80d-1df7-43d3-adf9-a75a2a1348bc", + "comment": "", + "command": "click", + "target": "css=.btn-primary", + "targets": [ + ["css=.btn-primary", "css:finder"], + ["xpath=//button[@type='submit']", "xpath:attributes"], + ["xpath=//div/button", "xpath:position"], + ["xpath=//button[contains(.,'Save')]", "xpath:innerText"] + ], + "value": "" + }, { + "id": "c51608a2-5e1a-4f70-8856-cbef5eb588ed", + "comment": "", + "command": "waitForElementVisible", + "target": "css=.td-lg:nth-child(4)", + "targets": [], + "value": "10000" + }, { + "id": "83f6f403-40b0-4f12-82e2-a14e301dd7ff", + "comment": "", + "command": "verifyText", + "target": "css=.td-lg:nth-child(4)", + "targets": [ + ["css=.td-lg:nth-child(4)", "css:finder"], + ["xpath=//td[4]", "xpath:position"], + ["xpath=//td[contains(.,'NameIDFormat')]", "xpath:innerText"] + ], + "value": "NameIDFormat" + }, { + "id": "1b449f50-1c54-41a0-a50b-65364340b7d2", + "comment": "", + "command": "click", + "target": "css=.fa-edit", + "targets": [ + ["css=.fa-edit", "css:finder"], + ["xpath=//td[6]/a/i", "xpath:position"] + ], + "value": "" + }, { + "id": "ad613704-0718-4b83-97f1-b49897f510eb", + "comment": "", + "command": "waitForElementVisible", + "target": "id=/nameIdFormatFilterTarget.target", + "targets": [], + "value": "10000" + }, { + "id": "6762fdb2-6744-4238-a2df-d529ab3b6102", + "comment": "", + "command": "verifyText", + "target": "id=/nameIdFormatFilterTarget.target", + "targets": [ + ["id=/nameIdFormatFilterTarget.target", "id"], + ["css=#\\/nameIdFormatFilterTarget\\.target", "css:finder"], + ["xpath=//p[@id='/nameIdFormatFilterTarget.target']", "xpath:attributes"], + ["xpath=//p", "xpath:position"], + ["xpath=//p[contains(.,'eval(true)')]", "xpath:innerText"] + ], + "value": "eval(true);" + }] + }], + "suites": [{ + "id": "4f69a686-bcaa-4963-84af-2e592e8c8842", + "name": "Default Suite", + "persistSession": false, + "parallel": false, + "timeout": 300, + "tests": ["d35b1f2b-5534-4ddb-9b37-1cc7b809ec9f"] + }], + "urls": ["http://localhost:10101/"], + "plugins": [] +} \ No newline at end of file diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties index 559a6c082..909b2943a 100644 --- a/backend/src/main/resources/application.properties +++ b/backend/src/main/resources/application.properties @@ -20,6 +20,7 @@ spring.jpa.database-platform=org.hibernate.dialect.H2Dialect spring.h2.console.enabled=true # spring.jackson.default-property-inclusion=non_absent +spring.jackson.default-property-inclusion=NON_NULL # Database Configuration PostgreSQL #spring.datasource.url=jdbc:postgresql://localhost:5432/shibui diff --git a/backend/src/main/resources/i18n/messages.properties b/backend/src/main/resources/i18n/messages.properties index ef48de5a2..673a47728 100644 --- a/backend/src/main/resources/i18n/messages.properties +++ b/backend/src/main/resources/i18n/messages.properties @@ -474,7 +474,7 @@ message.database-constraint=There was a database constraint problem processing t message.no-filters=No Filters message.no-filters-added=No filters have been added to this Metadata Provider -message.create-new-version-from-version=Create New Version from Version ({ date }) Settings +message.create-new-version-from-version=Create New Version from Previous Settings message.restoring-this-version-will-copy=Restoring this version will copy the Version ({ date }) configuration and create a new Version from the selected version settings. You can then edit the configuration before saving the new version. tooltip.entity-id=Entity ID diff --git a/backend/src/test/groovy/edu/internet2/tier/shibboleth/admin/ui/controller/BadJSONMetadataSourcesUiDefinitionControllerIntegrationTests.groovy b/backend/src/test/groovy/edu/internet2/tier/shibboleth/admin/ui/controller/BadJSONMetadataSourcesUiDefinitionControllerIntegrationTests.groovy index af758f131..b9789201f 100644 --- a/backend/src/test/groovy/edu/internet2/tier/shibboleth/admin/ui/controller/BadJSONMetadataSourcesUiDefinitionControllerIntegrationTests.groovy +++ b/backend/src/test/groovy/edu/internet2/tier/shibboleth/admin/ui/controller/BadJSONMetadataSourcesUiDefinitionControllerIntegrationTests.groovy @@ -7,6 +7,7 @@ import org.springframework.boot.test.context.SpringBootTest import org.springframework.boot.test.context.TestConfiguration import org.springframework.boot.test.web.client.TestRestTemplate import org.springframework.context.annotation.Bean +import org.springframework.context.annotation.Profile import org.springframework.core.io.ResourceLoader import org.springframework.test.context.ActiveProfiles import spock.lang.Specification @@ -23,7 +24,7 @@ import static edu.internet2.tier.shibboleth.admin.ui.jsonschema.JsonSchemaResour * @author Dmitriy Kopylenko */ @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles("no-auth") +@ActiveProfiles(["no-auth", "badjson"]) class BadJSONMetadataSourcesUiDefinitionControllerIntegrationTests extends Specification { @Autowired @@ -42,6 +43,7 @@ class BadJSONMetadataSourcesUiDefinitionControllerIntegrationTests extends Speci } @TestConfiguration + @Profile('badjson') static class Config { @Bean JsonSchemaResourceLocationRegistry jsonSchemaResourceLocationRegistry(ResourceLoader resourceLoader, diff --git a/backend/src/test/groovy/edu/internet2/tier/shibboleth/admin/ui/controller/EntitiesControllerIntegrationTests.groovy b/backend/src/test/groovy/edu/internet2/tier/shibboleth/admin/ui/controller/EntitiesControllerIntegrationTests.groovy index 8bf12484a..d8d9e7afb 100644 --- a/backend/src/test/groovy/edu/internet2/tier/shibboleth/admin/ui/controller/EntitiesControllerIntegrationTests.groovy +++ b/backend/src/test/groovy/edu/internet2/tier/shibboleth/admin/ui/controller/EntitiesControllerIntegrationTests.groovy @@ -42,25 +42,16 @@ class EntitiesControllerIntegrationTests extends Specification { def "GET /api/entities returns the proper json"() { given: def expectedBody = ''' - { - "id":null, - "serviceProviderName":null, - "entityId":"http://test.scaldingspoon.org/test1", - "organization":null, - "contacts":null, - "mdui":null, + { + "entityId":"http://test.scaldingspoon.org/test1", "serviceProviderSsoDescriptor": { "protocolSupportEnum":"SAML 2", "nameIdFormats":["urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"] - }, - "logoutEndpoints":null, - "securityInfo":null, + }, "assertionConsumerServices":[ {"locationUrl":"https://test.scaldingspoon.org/test1/acs","binding":"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST","makeDefault":false} ], - "serviceEnabled":false, - "createdDate":null, - "modifiedDate":null, + "serviceEnabled":false, "relyingPartyOverrides":{}, "attributeRelease":["givenName","employeeNumber"] } diff --git a/ui/src/app/metadata/configuration/component/metadata-header.component.ts b/ui/src/app/metadata/configuration/component/metadata-header.component.ts index 558353304..cc0df37b1 100644 --- a/ui/src/app/metadata/configuration/component/metadata-header.component.ts +++ b/ui/src/app/metadata/configuration/component/metadata-header.component.ts @@ -1,6 +1,8 @@ import { Component, Input } from '@angular/core'; import { Metadata } from '../../domain/domain.type'; +import { CONFIG_DATE_FORMAT } from '../configuration.values'; + @Component({ selector: 'metadata-header', templateUrl: './metadata-header.component.html', @@ -12,6 +14,8 @@ export class MetadataHeaderComponent { @Input() version: Metadata; @Input() isCurrent: boolean; + DATE_FORMAT = CONFIG_DATE_FORMAT; + constructor() {} } diff --git a/ui/src/app/metadata/configuration/container/restore.component.html b/ui/src/app/metadata/configuration/container/restore.component.html index 12638024f..855426142 100644 --- a/ui/src/app/metadata/configuration/container/restore.component.html +++ b/ui/src/app/metadata/configuration/container/restore.component.html @@ -6,13 +6,11 @@
+ [translateParams]="{ 'date': date$ | async }"> Restoring this version will copy the Version ( date ) configuration and create a new Version from the selected version settings. You can then edit the configuration before saving the new version.
diff --git a/ui/src/app/metadata/configuration/container/restore.component.spec.ts b/ui/src/app/metadata/configuration/container/restore.component.spec.ts index 433a11ebd..e79cbcac9 100644 --- a/ui/src/app/metadata/configuration/container/restore.component.spec.ts +++ b/ui/src/app/metadata/configuration/container/restore.component.spec.ts @@ -10,6 +10,7 @@ import * as fromResolvers from '../../resolver/reducer'; import { MockI18nModule } from '../../../../testing/i18n.stub'; import { RestoreComponent } from './restore.component'; import { of } from 'rxjs'; +import { DatePipe } from '@angular/common'; @Component({ template: ` @@ -44,6 +45,9 @@ describe('Metadata Restore Page Component', () => { RestoreComponent, TestHostComponent ], + providers: [ + DatePipe + ] }).compileComponents(); store = TestBed.get(Store); diff --git a/ui/src/app/metadata/configuration/container/restore.component.ts b/ui/src/app/metadata/configuration/container/restore.component.ts index d87302ff6..6fc4181c1 100644 --- a/ui/src/app/metadata/configuration/container/restore.component.ts +++ b/ui/src/app/metadata/configuration/container/restore.component.ts @@ -4,8 +4,9 @@ import { Observable } from 'rxjs'; import * as fromConfiguration from '../reducer'; import { CONFIG_DATE_FORMAT } from '../configuration.values'; -import { RestoreVersionRequest, CancelRestore } from '../action/restore.action'; +import { CancelRestore } from '../action/restore.action'; import { map } from 'rxjs/operators'; + import { DatePipe } from '@angular/common'; import { Router, ActivatedRoute } from '@angular/router'; diff --git a/ui/src/app/metadata/configuration/effect/restore.effect.ts b/ui/src/app/metadata/configuration/effect/restore.effect.ts index 4825c32dc..b34cfe997 100644 --- a/ui/src/app/metadata/configuration/effect/restore.effect.ts +++ b/ui/src/app/metadata/configuration/effect/restore.effect.ts @@ -21,13 +21,13 @@ import { Store } from '@ngrx/store'; import { ConfigurationState, getConfigurationModel, - getVersionModel, getConfigurationModelId, getConfigurationModelKind, getConfigurationDefinition, getRestorationModel } from '../reducer'; import { SetMetadata } from '../action/configuration.action'; +import { removeNulls } from '../../../shared/util'; @Injectable() @@ -43,10 +43,10 @@ export class RestoreEffects { this.store.select(getRestorationModel) ), switchMap(([action, id, kind, current, version]) => - this.historyService.updateVersion(id, kind, { + this.historyService.updateVersion(id, kind, removeNulls({ ...version, version: current.version - }).pipe( + })).pipe( map(v => new RestoreVersionSuccess({ id, type: kind, model: v })), catchError(err => of(new RestoreVersionError(err))) ) diff --git a/ui/src/app/metadata/configuration/reducer/index.ts b/ui/src/app/metadata/configuration/reducer/index.ts index b26766af9..fe961cfc3 100644 --- a/ui/src/app/metadata/configuration/reducer/index.ts +++ b/ui/src/app/metadata/configuration/reducer/index.ts @@ -229,4 +229,4 @@ export const getConfigurationModelType = createSelector(getConfigurationModel, g export const getConfigurationHasXml = createSelector(getConfigurationXml, xml => !!xml); export const getConfigurationFilters = createSelector(getConfigurationModel, model => model.metadataFilters); -export const getConfigurationVersionDate = createSelector(getConfigurationModel, version => version.modifiedDate); +export const getConfigurationVersionDate = createSelector(getRestoreModel, version => version && version.modifiedDate); diff --git a/ui/src/app/metadata/filter/effect/collection.effect.ts b/ui/src/app/metadata/filter/effect/collection.effect.ts index 58ecd41f7..dcf67b246 100644 --- a/ui/src/app/metadata/filter/effect/collection.effect.ts +++ b/ui/src/app/metadata/filter/effect/collection.effect.ts @@ -35,8 +35,7 @@ import { FilterCollectionActionTypes } from '../action/collection.action'; import * as fromFilter from '../reducer'; import * as fromProvider from '../../provider/reducer'; import { MetadataFilter } from '../../domain/model'; -import { removeNulls, array_move } from '../../../shared/util'; -import { EntityAttributesFilterEntity } from '../../domain/entity/filter/entity-attributes-filter'; +import { array_move } from '../../../shared/util'; import { MetadataFilterService } from '../../domain/service/filter.service'; import { SelectProviderRequest } from '../../provider/action/collection.action'; import { UpdateFilterChanges, ClearFilter } from '../action/filter.action'; diff --git a/ui/src/app/metadata/filter/model/entity-attributes-configuration.filter.ts b/ui/src/app/metadata/filter/model/entity-attributes-configuration.filter.ts index 5333e08f1..06a6609b6 100644 --- a/ui/src/app/metadata/filter/model/entity-attributes-configuration.filter.ts +++ b/ui/src/app/metadata/filter/model/entity-attributes-configuration.filter.ts @@ -1,6 +1,5 @@ import { Wizard } from '../../../wizard/model'; import { MetadataFilter } from '../../domain/model'; -import { removeNulls } from '../../../shared/util'; import { EntityAttributesFilter } from './entity-attributes.filter'; export const EntityAttributesFilterConfiguration: Wizard