Skip to content

Commit

Permalink
Merged in release (pull request #543)
Browse files Browse the repository at this point in the history
Release 1.10.0
  • Loading branch information
Jonathan Johnson committed Oct 21, 2021
2 parents 1a901ca + 006b7fb commit 57046c4
Show file tree
Hide file tree
Showing 281 changed files with 35,759 additions and 14,735 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -408,3 +408,7 @@ beacon/spring/out
*.project
*bin
/a.json
/testbed/authentication/.idea/workspace.xml

# macOS jenv
.java-version
1 change: 1 addition & 0 deletions backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ task integrationTest(type: Test) {
classpath = sourceSets.integrationTest.runtimeClasspath
systemProperties = System.properties
systemProperties['user.dir'] = workingDir
systemProperties['spring.profiles.include'] = 'very-dangerous'
}

task enversTest(type: Test) {
Expand Down
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 All @@ -165,4 +119,4 @@ class EntityDescriptorControllerVersionEndpointsIntegrationTests extends Specifi
private static resourceUriFor(String uriTemplate, String resourceId) {
String.format(uriTemplate, resourceId)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class SeleniumSIDETest extends Specification {
def runner = new Runner()
runner.varsMap.put('xmlUpload', Paths.get(this.class.getResource('/TestUpload.xml').toURI()).toString())
runner.varsMap.put('SHIBUI950', Paths.get(this.class.getResource('/SHIBUI-950.xml').toURI()).toString())
runner.varsMap.put('driver', config.driver)
main.setupRunner(runner, config, [] as String[])

expect:
Expand All @@ -98,10 +99,9 @@ class SeleniumSIDETest extends Specification {
cleanup:
runner.getWrappedDriver().quit()

// TODO: Uncomment the below commented tests once they've been updated to use the new configuration screen
where:
name | file
/* 'SHIBUI-1364: Compare FBHTTPMP with filters' | '/SHIBUI-1364-1.side'
'SHIBUI-1364: Compare FBHTTPMP with filters' | '/SHIBUI-1364-1.side'
'SHIBUI-1364: Compare FSMP with filters' | '/SHIBUI-1364-2.side'
'SHIBUI-1364: Compare LDMP with filters' | '/SHIBUI-1364-3.side'
'SHIBUI-1364: Compare DHTTPMP with filters' | '/SHIBUI-1364-4.side'
Expand All @@ -114,25 +114,38 @@ class SeleniumSIDETest extends Specification {
'SHIBUI-1334: Verify metadata source versioning' | '/SHIBUI-1334-1.side'
'SHIBUI-1334: Verify metadata provider versioning' | '/SHIBUI-1334-2.side'
'SHIBUI-1335: Verify File Backed HTTP Metadata Provider Filters' | '/SHIBUI-1335-1.side'
'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 Filesystem Metadata Provider Filters' | '/SHIBUI-1335-2.side' // adding filters to this resolver type was removed in the react update
'SHIBUI-1335: Verify Local Dynamic Metadata Provider Filters' | '/SHIBUI-1335-3.side' // adding filters to this resolver type was removed in the react update
'SHIBUI-1335: Verify Dynamic HTTP Metadata Provider Filters' | '/SHIBUI-1335-4.side'
'SHIBUI-1392: Verify provider with script filter is persistable' | '/SHIBUI-1392.side'
'SHIBUI-1361: Verify dates display in proper format' | '/SHIBUI-1361.side'
'SHIBUI-1361: Verify dates display in proper format' | '/SHIBUI-1361.side' // Note that this script WILL NOT PASS in the Selenium IDE. There is a bug in the IDE where it thinks there is a missing ')'.
'SHIBUI-1385: Restore a metadata source version' | '/SHIBUI-1385-1.side'
'SHIBUI-1385: Restore a metadata provider version' | '/SHIBUI-1385-2.side'
'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-1407: Metadata provider comparison highlights' | '/SHIBUI-1407-2.side'
'SHIBUI-1503: Non-admin can create metadata source' | '/SHIBUI-1503-1.side'
'SHIBUI-1503: User can be deleted' | '/SHIBUI-1503-2.side'
/* 'SHIBUI-1503: User can be enabled' | '/SHIBUI-1503-3.side'
'SHIBUI-1503: User can be enabled' | '/SHIBUI-1503-3.side'
'SHIBUI-2052: Logged in user & role appear on dashboard' | '/SHIBUI-2052.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'
'SHIBUI-1742: Verify enabler role allows enabling' | '/SHIBUI-1742-1.side'
'SHIBUI-1742: Verify role CRUD operations' | '/SHIBUI-1742-2.side'*/
'SHIBUI-1742: Verify role CRUD operations' | '/SHIBUI-1742-2.side'
'SHIBUI-1743: Verify group regex CRUD operations' | '/SHIBUI-1743-1.side'
'SHIBUI-1743: Verify nonadmin group regex validation' | '/SHIBUI-1743-2.side'
'SHIBUI-1744: Verify attribute bundle CRUD operations' | '/SHIBUI-1744-1.side'
'SHIBUI-1744: Verify attribute bundles in metadata sources' | '/SHIBUI-1744-2.side'
'SHIBUI-1744: Verify attribute bundles in entity attribute filters' | '/SHIBUI-1744-3.side'
'SHIBUI-2116: Verify entity attribute bundle highlights' | '/SHIBUI-2116.side' // Note that this script WILL NOT PASS in the Selenium IDE due to ${driver} not being set (it is provided by this groovy script).
'SHIBUI-1732: Create, use, and delete CEA String' | '/SHIBUI-1732-1.side'
'SHIBUI-1732: Create, use, and delete CEA Boolean' | '/SHIBUI-1732-2.side'
'SHIBUI-1732: Create, use, and delete CEA List' | '/SHIBUI-1732-3.side'
'SHIBUI-1732: Create, use, and delete CEA Long' | '/SHIBUI-1732-4.side'
'SHIBUI-1732: Create, use, and delete CEA Double' | '/SHIBUI-1732-5.side'
'SHIBUI-1732: Create, use, and delete CEA Duration' | '/SHIBUI-1732-6.side'
'SHIBUI-1732: Create, use, and delete CEA Spring Bean' | '/SHIBUI-1732-7.side'
'SHIBUI-1392: Verify provider with script filter is persistable' | '/SHIBUI-1392.side' // Something about this test breaks all the other ones after it
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
// This code is based on:
//
// com.thoughtworks.selenium.webdriven.commands.AttachFile
//
// in Selenium WebDriver.
//
// The following copyright is copied from original.
// ---
// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The SFC licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

package jp.vmi.selenium.selenese.command;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;

import org.apache.commons.io.FilenameUtils;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.io.TemporaryFilesystem;

import com.google.common.io.Resources;

import jp.vmi.selenium.selenese.Context;
import jp.vmi.selenium.selenese.result.Error;
import jp.vmi.selenium.selenese.result.Result;
import jp.vmi.selenium.selenese.result.Warning;

import static jp.vmi.selenium.selenese.command.ArgumentType.*;
import static jp.vmi.selenium.selenese.result.Success.*;

/**
* Re-implementation of AttachFile.
*/
public class AttachFile extends AbstractCommand {

private static final int ARG_LOCATOR = 0;
private static final int ARG_FILENAME = 1;

AttachFile(int index, String name, String... args) {
super(index, name, args, LOCATOR, VALUE);
}

@Override
protected Result executeImpl(Context context, String... curArgs) {
String name = curArgs[ARG_FILENAME];
File outputTo = null;
if (name.contains("://")) {
// process (remote) url
URL url;
try {
url = new URL(name);
} catch (MalformedURLException e) {
return new Error("Malformed URL: " + name);
}
File dir = TemporaryFilesystem.getDefaultTmpFS().createTempDir("attachFile", "dir");
outputTo = new File(dir, new File(url.getFile()).getName());
FileOutputStream fos = null;
try {
fos = new FileOutputStream(outputTo);
Resources.copy(url, fos);
} catch (IOException e) {
return new Error("Can't access file to upload: " + url, e);
} finally {
try {
if (fos != null) {
fos.close();
}
} catch (IOException e) {
return new Warning("Unable to close stream used for reading file: " + name, e);
}
}
} else {
// process file besides testcase file
// okay, let's fix some cases...
if (name.matches("([a-zA-Z]:)?\\\\.+")) {
// windows absolute path
outputTo = new File(name);
} else {
outputTo = new File(FilenameUtils.getPath(context.getCurrentTestCase().getFilename()), name);
}
if (!outputTo.exists()) {
return new Error("Can't access file: " + outputTo);
}
}

WebElement element = context.findElement(curArgs[ARG_LOCATOR]);
try {
element.clear();
} catch (Exception e) {
// ignore exceptions from some drivers when file-input cannot be cleared;
}
element.sendKeys(outputTo.getAbsolutePath());
return SUCCESS;
}
}
Loading

0 comments on commit 57046c4

Please sign in to comment.