Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Change litmus test configuration to allow upper-case in DNS names in …
…scopes
iay committed Feb 21, 2019
1 parent db059a9 commit b6d9f9a
Showing 2 changed files with 7 additions and 8 deletions.
@@ -82,7 +82,10 @@ private List<ErrorStatus> runTest(final Item<Element> item) throws Exception {
private void good(final String value, final boolean isRegex) throws Exception {
final Item<Element> item = new DOMElementItem(buildDocument(value, isRegex));
final List<ErrorStatus> errors = runTest(item);
Assert.assertEquals(errors.size(), 0, "expected no errors for '" + value + "'[" + isRegex + "]");
if (errors.size() != 0) {
Assert.fail("expected no errors for '" + value + "'[" + isRegex + "] " +
"but saw \"" + errors.get(0).getStatusMessage() + "\"");
}
}

/** Test a non-regexp value we expect to be accepted. */
@@ -128,12 +131,12 @@ private void badRegexp(final String value) throws Exception {
@Test
public void litmusTests() throws Exception {
good("example.org");
good("UGent.be");
bad("", "empty");
bad(" ");
bad(" ");
bad(" example.org", "white space");
bad("example.org ", "white space");
bad("EXAMPLE.ORG", "upper-case");
bad("example**.org", "scope is not a valid domain name: example**.org");
bad("uk", "scope is a public suffix");
bad("ac.uk", "scope is a public suffix");
@@ -155,8 +158,6 @@ public void litmusTests() throws Exception {
badRegexp("^([a-zA-Z0-9-]{1,63}\\.){0,2}vho\\.aaf\\.edu\\.nopublic$", "literal tail is not under a public suffix");
// bad literal tail: is a public suffix
badRegexp("^.*\\.ac\\.uk$", "literal tail is a public suffix");
// bad literal tail: upper case
badRegexp("^([a-zA-Z0-9-]{1,63}\\.){0,2}vho\\.aaf\\.edu\\.AU$", "includes upper-case characters");

// UK federation examples
goodRegexp("^.+\\.atomwide\\.com$");
@@ -169,5 +170,7 @@ public void litmusTests() throws Exception {
goodRegexp("^.+\\.identityfor\\.co\\.uk$");
goodRegexp("^.+\\.rmunify\\.com$");

// Combination regexp plus case significance
goodRegexp("^.+\\.UGent\\.be$");
}
}
@@ -20,8 +20,6 @@
p:regex="" p:message="scope element must not be empty"/>
<bean parent="inc.RejectStringRegexValidator"
p:regex=".*\s.*" p:message="scope '%s' includes white space"/>
<bean parent="inc.RejectStringRegexValidator"
p:regex=".*\p{Upper}.*" p:message="scope '%s' includes upper-case characters"/>
<bean parent="inc.AsDomainNameStringValidator"
p:message="scope is not a valid domain name: %s">
<property name="validators">
@@ -51,8 +49,6 @@
<property name="validators">
<!-- validators to apply to the literal tail -->
<list>
<bean parent="inc.RejectStringRegexValidator"
p:regex=".*\p{Upper}.*" p:message="literal tail '%s' includes upper-case characters"/>
<bean parent="inc.AsDomainNameStringValidator"
p:message="literal tail is not a valid domain name: %s">
<property name="validators">

0 comments on commit b6d9f9a

Please sign in to comment.