mirror of
https://github.com/google/nomulus.git
synced 2025-06-06 20:45:40 +02:00
Add Carriage Return in WHOIS disclaimer text
WHOIS disclaimer is read from the config yaml file directly and the line breaks within the text does not contain carriage return, which ICANN requires. This CL fixes the non-compliance. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=156359526
This commit is contained in:
parent
16f2799ad9
commit
3f5735ed4b
21 changed files with 60 additions and 9 deletions
|
@ -157,7 +157,7 @@ abstract class WhoisResponseImpl implements WhoisResponse {
|
||||||
|
|
||||||
/** Returns raw text that should be appended to the end of ALL WHOIS responses. */
|
/** Returns raw text that should be appended to the end of ALL WHOIS responses. */
|
||||||
E emitFooter(String disclaimer) {
|
E emitFooter(String disclaimer) {
|
||||||
stringBuilder.append(disclaimer).append("\r\n");
|
stringBuilder.append(disclaimer.replaceAll("\r?\n", "\r\n").trim()).append("\r\n");
|
||||||
return thisCastToDerived();
|
return thisCastToDerived();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -254,7 +254,10 @@ public class DomainWhoisResponseTest {
|
||||||
public void getPlainTextOutputTest() {
|
public void getPlainTextOutputTest() {
|
||||||
DomainWhoisResponse domainWhoisResponse =
|
DomainWhoisResponse domainWhoisResponse =
|
||||||
new DomainWhoisResponse(domainResource, clock.nowUtc());
|
new DomainWhoisResponse(domainResource, clock.nowUtc());
|
||||||
assertThat(domainWhoisResponse.getResponse(false, "Doodle Disclaimer"))
|
assertThat(
|
||||||
|
domainWhoisResponse.getResponse(
|
||||||
|
false,
|
||||||
|
"Doodle Disclaimer\nI exist so that carriage return\nin disclaimer can be tested."))
|
||||||
.isEqualTo(WhoisResponseResults.create(loadWhoisTestFile("whois_domain.txt"), 1));
|
.isEqualTo(WhoisResponseResults.create(loadWhoisTestFile("whois_domain.txt"), 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,7 +266,13 @@ public class DomainWhoisResponseTest {
|
||||||
DomainWhoisResponse domainWhoisResponse =
|
DomainWhoisResponse domainWhoisResponse =
|
||||||
new DomainWhoisResponse(
|
new DomainWhoisResponse(
|
||||||
domainResource.asBuilder().setStatusValues(null).build(), clock.nowUtc());
|
domainResource.asBuilder().setStatusValues(null).build(), clock.nowUtc());
|
||||||
assertThat(domainWhoisResponse.getResponse(false, "Doodle Disclaimer").plainTextOutput())
|
assertThat(
|
||||||
|
domainWhoisResponse
|
||||||
|
.getResponse(
|
||||||
|
false,
|
||||||
|
"Doodle Disclaimer\nI exist so that carriage return\n"
|
||||||
|
+ "in disclaimer can be tested.")
|
||||||
|
.plainTextOutput())
|
||||||
.contains("Domain Status: ok");
|
.contains("Domain Status: ok");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,10 @@ public class NameserverWhoisResponseTest {
|
||||||
public void testGetTextOutput() {
|
public void testGetTextOutput() {
|
||||||
NameserverWhoisResponse nameserverWhoisResponse =
|
NameserverWhoisResponse nameserverWhoisResponse =
|
||||||
new NameserverWhoisResponse(hostResource1, clock.nowUtc());
|
new NameserverWhoisResponse(hostResource1, clock.nowUtc());
|
||||||
assertThat(nameserverWhoisResponse.getResponse(false, "Doodle Disclaimer"))
|
assertThat(
|
||||||
|
nameserverWhoisResponse.getResponse(
|
||||||
|
false,
|
||||||
|
"Doodle Disclaimer\nI exist so that carriage return\nin disclaimer can be tested."))
|
||||||
.isEqualTo(WhoisResponseResults.create(loadWhoisTestFile("whois_nameserver.txt"), 1));
|
.isEqualTo(WhoisResponseResults.create(loadWhoisTestFile("whois_nameserver.txt"), 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +87,10 @@ public class NameserverWhoisResponseTest {
|
||||||
public void testGetMultipleNameserversResponse() {
|
public void testGetMultipleNameserversResponse() {
|
||||||
NameserverWhoisResponse nameserverWhoisResponse =
|
NameserverWhoisResponse nameserverWhoisResponse =
|
||||||
new NameserverWhoisResponse(ImmutableList.of(hostResource1, hostResource2), clock.nowUtc());
|
new NameserverWhoisResponse(ImmutableList.of(hostResource1, hostResource2), clock.nowUtc());
|
||||||
assertThat(nameserverWhoisResponse.getResponse(false, "Doodle Disclaimer"))
|
assertThat(
|
||||||
|
nameserverWhoisResponse.getResponse(
|
||||||
|
false,
|
||||||
|
"Doodle Disclaimer\nI exist so that carriage return\nin disclaimer can be tested."))
|
||||||
.isEqualTo(
|
.isEqualTo(
|
||||||
WhoisResponseResults.create(loadWhoisTestFile("whois_multiple_nameservers.txt"), 2));
|
WhoisResponseResults.create(loadWhoisTestFile("whois_multiple_nameservers.txt"), 2));
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,7 +115,10 @@ public class RegistrarWhoisResponseTest {
|
||||||
|
|
||||||
RegistrarWhoisResponse registrarWhoisResponse =
|
RegistrarWhoisResponse registrarWhoisResponse =
|
||||||
new RegistrarWhoisResponse(registrar, clock.nowUtc());
|
new RegistrarWhoisResponse(registrar, clock.nowUtc());
|
||||||
assertThat(registrarWhoisResponse.getResponse(false, "Doodle Disclaimer"))
|
assertThat(
|
||||||
|
registrarWhoisResponse.getResponse(
|
||||||
|
false,
|
||||||
|
"Doodle Disclaimer\nI exist so that carriage return\nin disclaimer can be tested."))
|
||||||
.isEqualTo(WhoisResponseResults.create(loadWhoisTestFile("whois_registrar.txt"), 1));
|
.isEqualTo(WhoisResponseResults.create(loadWhoisTestFile("whois_registrar.txt"), 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,6 +130,7 @@ public class RegistrarWhoisResponseTest {
|
||||||
RegistrarWhoisResponse registrarWhoisResponse =
|
RegistrarWhoisResponse registrarWhoisResponse =
|
||||||
new RegistrarWhoisResponse(registrar, clock.nowUtc());
|
new RegistrarWhoisResponse(registrar, clock.nowUtc());
|
||||||
// Just make sure this doesn't NPE.
|
// Just make sure this doesn't NPE.
|
||||||
registrarWhoisResponse.getResponse(false, "Doodle Disclaimer");
|
registrarWhoisResponse.getResponse(
|
||||||
|
false, "Doodle Disclaimer\nI exist so that carriage return\nin disclaimer can be tested.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,8 @@ public class WhoisHttpServerTest {
|
||||||
whoisServer.whoisReader = new WhoisReader(new WhoisCommandFactory());
|
whoisServer.whoisReader = new WhoisReader(new WhoisCommandFactory());
|
||||||
whoisServer.whoisMetrics = new WhoisMetrics();
|
whoisServer.whoisMetrics = new WhoisMetrics();
|
||||||
whoisServer.metricBuilder = WhoisMetric.builderForRequest(clock);
|
whoisServer.metricBuilder = WhoisMetric.builderForRequest(clock);
|
||||||
whoisServer.disclaimer = "Doodle Disclaimer";
|
whoisServer.disclaimer =
|
||||||
|
"Doodle Disclaimer\nI exist so that carriage return\nin disclaimer can be tested.";
|
||||||
return whoisServer;
|
return whoisServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,8 @@ public class WhoisServerTest {
|
||||||
whoisServer.whoisReader = new WhoisReader(new WhoisCommandFactory());
|
whoisServer.whoisReader = new WhoisReader(new WhoisCommandFactory());
|
||||||
whoisServer.whoisMetrics = new WhoisMetrics();
|
whoisServer.whoisMetrics = new WhoisMetrics();
|
||||||
whoisServer.metricBuilder = WhoisMetric.builderForRequest(clock);
|
whoisServer.metricBuilder = WhoisMetric.builderForRequest(clock);
|
||||||
whoisServer.disclaimer = "Doodle Disclaimer";
|
whoisServer.disclaimer =
|
||||||
|
"Doodle Disclaimer\nI exist so that carriage return\nin disclaimer can be tested.";
|
||||||
whoisServer.retrier = new Retrier(new FakeSleeper(clock), 3);
|
whoisServer.retrier = new Retrier(new FakeSleeper(clock), 3);
|
||||||
return whoisServer;
|
return whoisServer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,3 +63,5 @@ URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/
|
||||||
For more information on Whois status codes, please visit https://icann.org/epp
|
For more information on Whois status codes, please visit https://icann.org/epp
|
||||||
|
|
||||||
Doodle Disclaimer
|
Doodle Disclaimer
|
||||||
|
I exist so that carriage return
|
||||||
|
in disclaimer can be tested.
|
||||||
|
|
|
@ -14,3 +14,5 @@ Registrar URL: http://www.referral.example/path
|
||||||
>>> Last update of WHOIS database: 2009-05-29T20:15:00Z <<<
|
>>> Last update of WHOIS database: 2009-05-29T20:15:00Z <<<
|
||||||
|
|
||||||
Doodle Disclaimer
|
Doodle Disclaimer
|
||||||
|
I exist so that carriage return
|
||||||
|
in disclaimer can be tested.
|
||||||
|
|
|
@ -7,3 +7,5 @@ Registrar URL: http://www.referral.example/path
|
||||||
>>> Last update of WHOIS database: 2009-05-29T20:15:00Z <<<
|
>>> Last update of WHOIS database: 2009-05-29T20:15:00Z <<<
|
||||||
|
|
||||||
Doodle Disclaimer
|
Doodle Disclaimer
|
||||||
|
I exist so that carriage return
|
||||||
|
in disclaimer can be tested.
|
||||||
|
|
|
@ -24,3 +24,5 @@ Email: johngeek@example-registrar.tld
|
||||||
>>> Last update of WHOIS database: 2009-05-29T20:15:00Z <<<
|
>>> Last update of WHOIS database: 2009-05-29T20:15:00Z <<<
|
||||||
|
|
||||||
Doodle Disclaimer
|
Doodle Disclaimer
|
||||||
|
I exist so that carriage return
|
||||||
|
in disclaimer can be tested.
|
||||||
|
|
|
@ -61,3 +61,5 @@ URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/
|
||||||
For more information on Whois status codes, please visit https://icann.org/epp
|
For more information on Whois status codes, please visit https://icann.org/epp
|
||||||
|
|
||||||
Doodle Disclaimer
|
Doodle Disclaimer
|
||||||
|
I exist so that carriage return
|
||||||
|
in disclaimer can be tested.
|
||||||
|
|
|
@ -2,3 +2,5 @@ Domain not found.
|
||||||
>>> Last update of WHOIS database: 2009-06-29T20:13:00Z <<<
|
>>> Last update of WHOIS database: 2009-06-29T20:13:00Z <<<
|
||||||
|
|
||||||
Doodle Disclaimer
|
Doodle Disclaimer
|
||||||
|
I exist so that carriage return
|
||||||
|
in disclaimer can be tested.
|
||||||
|
|
|
@ -61,3 +61,5 @@ URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/
|
||||||
For more information on Whois status codes, please visit https://icann.org/epp
|
For more information on Whois status codes, please visit https://icann.org/epp
|
||||||
|
|
||||||
Doodle Disclaimer
|
Doodle Disclaimer
|
||||||
|
I exist so that carriage return
|
||||||
|
in disclaimer can be tested.
|
||||||
|
|
|
@ -61,3 +61,5 @@ URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/
|
||||||
For more information on Whois status codes, please visit https://icann.org/epp
|
For more information on Whois status codes, please visit https://icann.org/epp
|
||||||
|
|
||||||
Doodle Disclaimer
|
Doodle Disclaimer
|
||||||
|
I exist so that carriage return
|
||||||
|
in disclaimer can be tested.
|
||||||
|
|
|
@ -2,3 +2,5 @@ No nameservers found.
|
||||||
>>> Last update of WHOIS database: 2009-06-29T20:13:00Z <<<
|
>>> Last update of WHOIS database: 2009-06-29T20:13:00Z <<<
|
||||||
|
|
||||||
Doodle Disclaimer
|
Doodle Disclaimer
|
||||||
|
I exist so that carriage return
|
||||||
|
in disclaimer can be tested.
|
||||||
|
|
|
@ -2,3 +2,5 @@ Malformed path query.
|
||||||
>>> Last update of WHOIS database: 2009-06-29T20:13:00Z <<<
|
>>> Last update of WHOIS database: 2009-06-29T20:13:00Z <<<
|
||||||
|
|
||||||
Doodle Disclaimer
|
Doodle Disclaimer
|
||||||
|
I exist so that carriage return
|
||||||
|
in disclaimer can be tested.
|
||||||
|
|
|
@ -6,3 +6,5 @@ Registrar URL: http://www.referral.example/path
|
||||||
>>> Last update of WHOIS database: 2009-06-29T20:13:00Z <<<
|
>>> Last update of WHOIS database: 2009-06-29T20:13:00Z <<<
|
||||||
|
|
||||||
Doodle Disclaimer
|
Doodle Disclaimer
|
||||||
|
I exist so that carriage return
|
||||||
|
in disclaimer can be tested.
|
||||||
|
|
|
@ -2,3 +2,5 @@ Nameserver not found.
|
||||||
>>> Last update of WHOIS database: 2009-06-29T20:13:00Z <<<
|
>>> Last update of WHOIS database: 2009-06-29T20:13:00Z <<<
|
||||||
|
|
||||||
Doodle Disclaimer
|
Doodle Disclaimer
|
||||||
|
I exist so that carriage return
|
||||||
|
in disclaimer can be tested.
|
||||||
|
|
|
@ -2,3 +2,5 @@ No WHOIS command specified.
|
||||||
>>> Last update of WHOIS database: 2009-06-29T20:13:00Z <<<
|
>>> Last update of WHOIS database: 2009-06-29T20:13:00Z <<<
|
||||||
|
|
||||||
Doodle Disclaimer
|
Doodle Disclaimer
|
||||||
|
I exist so that carriage return
|
||||||
|
in disclaimer can be tested.
|
||||||
|
|
|
@ -20,3 +20,5 @@ Email: johndoe@example.com
|
||||||
>>> Last update of WHOIS database: 2009-06-29T20:13:00Z <<<
|
>>> Last update of WHOIS database: 2009-06-29T20:13:00Z <<<
|
||||||
|
|
||||||
Doodle Disclaimer
|
Doodle Disclaimer
|
||||||
|
I exist so that carriage return
|
||||||
|
in disclaimer can be tested.
|
||||||
|
|
|
@ -2,3 +2,5 @@ No registrar found.
|
||||||
>>> Last update of WHOIS database: 2009-06-29T20:13:00Z <<<
|
>>> Last update of WHOIS database: 2009-06-29T20:13:00Z <<<
|
||||||
|
|
||||||
Doodle Disclaimer
|
Doodle Disclaimer
|
||||||
|
I exist so that carriage return
|
||||||
|
in disclaimer can be tested.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue