Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions core/src/main/java/google/registry/model/tld/Tld.java
Original file line number Diff line number Diff line change
Expand Up @@ -1034,12 +1034,13 @@ public Builder setEapFeeSchedule(ImmutableSortedMap<DateTime, Money> eapFeeSched
return this;
}

public static final Pattern ROID_SUFFIX_PATTERN = Pattern.compile("^[A-Z\\d_]{1,8}$");
public static final Pattern ROID_SUFFIX_PATTERN = Pattern.compile("^[A-Z\\d]{1,8}$");

public Builder setRoidSuffix(String roidSuffix) {
checkArgument(
ROID_SUFFIX_PATTERN.matcher(roidSuffix).matches(),
"ROID suffix must be in format %s",
"ROID suffix %s must be in format %s",
roidSuffix,
ROID_SUFFIX_PATTERN.pattern());
getInstance().roidSuffix = roidSuffix;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ void testSuccess_readFromCloudSqlMissingPAK() throws Exception {
.build();
persistResource(registrar);
Tld test =
newTld("test", "_TEST", ImmutableSortedMap.of(START_OF_TIME, GENERAL_AVAILABILITY))
newTld("test", "TEST", ImmutableSortedMap.of(START_OF_TIME, GENERAL_AVAILABILITY))
.asBuilder()
.setInvoicingEnabled(true)
.build();
Expand Down Expand Up @@ -391,7 +391,7 @@ void testSuccess_makeCloudSqlQuery() throws Exception {
// Test that comments are removed from the .sql file correctly
assertThat(InvoicingPipeline.makeCloudSqlQuery("2017-10"))
.isEqualTo(
"""
"""

SELECT b, r FROM BillingEvent b
JOIN Registrar r ON b.clientId = r.registrarId
Expand Down Expand Up @@ -449,13 +449,13 @@ private static void setupCloudSql() {
persistResource(registrar3);

Tld test =
newTld("test", "_TEST", ImmutableSortedMap.of(START_OF_TIME, GENERAL_AVAILABILITY))
newTld("test", "TEST", ImmutableSortedMap.of(START_OF_TIME, GENERAL_AVAILABILITY))
.asBuilder()
.setInvoicingEnabled(true)
.build();
persistResource(test);
Tld hello =
newTld("hello", "_HELLO", ImmutableSortedMap.of(START_OF_TIME, GENERAL_AVAILABILITY))
newTld("hello", "HELLO", ImmutableSortedMap.of(START_OF_TIME, GENERAL_AVAILABILITY))
.asBuilder()
.setInvoicingEnabled(true)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ void readWithStringTypedQuery() {
}

private void setupForJoinQuery() {
Tld registry = newTld("com", "ABCD_APP");
Tld registry = newTld("com", "ABCDAPP");
Registrar registrar =
makeRegistrar1()
.asBuilder()
Expand Down
10 changes: 9 additions & 1 deletion core/src/test/java/google/registry/model/tld/TldTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,9 @@ void testFailure_roidSuffixTooLong() {
assertThrows(
IllegalArgumentException.class,
() -> Tld.get("tld").asBuilder().setRoidSuffix("123456789"));
assertThat(e).hasMessageThat().isEqualTo("ROID suffix must be in format ^[A-Z\\d_]{1,8}$");
assertThat(e)
.hasMessageThat()
.isEqualTo("ROID suffix 123456789 must be in format ^[A-Z\\d]{1,8}$");
}

@Test
Expand All @@ -766,6 +768,12 @@ void testFailure_roidSuffixContainsInvalidCharacters() {
IllegalArgumentException.class, () -> Tld.get("tld").asBuilder().setRoidSuffix("ABC-DEF"));
}

@Test
void testFailure_roidSuffixContainsUnderscores() {
assertThrows(
IllegalArgumentException.class, () -> Tld.get("tld").asBuilder().setRoidSuffix("ABC_DEF"));
}

@Test
void testSuccess_setDefaultPromoTokens() {
Tld registry = Tld.get("tld");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ void testMultilevelDomain_works() {
.isEqualTo(
addDomainBoilerplateNotices(
jsonFileBuilder()
.addDomain("cat.1.tld", "D-1_TLD")
.addDomain("cat.1.tld", "D-1TLD")
.addNameserver("ns1.cat.lol", "2-ROID")
.addNameserver("ns2.cat.lol", "4-ROID")
.addRegistrar("Multilevel Registrar")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ void testDomainMatch_cat_1_test_found() {
RequestType.NAME,
"cat.1.test",
jsonFileBuilder()
.addDomain("cat.1.test", "1B-1_TEST")
.addDomain("cat.1.test", "1B-1TEST")
.addRegistrar("1.test")
.addNameserver("ns1.cat.1.test", "17-ROID")
.addNameserver("ns2.cat.2.test", "19-ROID")
Expand All @@ -746,7 +746,7 @@ void testDomainMatch_castar_1_test_found() {
RequestType.NAME,
"ca*.1.test",
jsonFileBuilder()
.addDomain("cat.1.test", "1B-1_TEST")
.addDomain("cat.1.test", "1B-1TEST")
.addRegistrar("1.test")
.addNameserver("ns1.cat.1.test", "17-ROID")
.addNameserver("ns2.cat.2.test", "19-ROID")
Expand Down Expand Up @@ -822,7 +822,7 @@ void testDomainMatch_cat_star_found_sql() {
.that(generateActualJson(RequestType.NAME, "cat.*"))
.isEqualTo(
jsonFileBuilder()
.addDomain("cat.1.test", "1B-1_TEST")
.addDomain("cat.1.test", "1B-1TEST")
.addDomain("cat.example", "F-EXAMPLE")
.addDomain("cat.lol", "6-LOL")
.addDomain("cat.みんな", "15-Q9JYB4C")
Expand Down Expand Up @@ -860,7 +860,7 @@ void testDomainMatch_catstar_found_sql() {
.that(generateActualJson(RequestType.NAME, "cat*"))
.isEqualTo(
jsonFileBuilder()
.addDomain("cat.1.test", "1B-1_TEST")
.addDomain("cat.1.test", "1B-1TEST")
.addDomain("cat.example", "F-EXAMPLE")
.addDomain("cat.lol", "6-LOL")
.addDomain("cat.みんな", "15-Q9JYB4C")
Expand Down Expand Up @@ -1284,7 +1284,7 @@ void testNameserverMatch_ns1_cat_1_test_found() {
RequestType.NS_LDH_NAME,
"ns1.cat.1.test",
jsonFileBuilder()
.addDomain("cat.1.test", "1B-1_TEST")
.addDomain("cat.1.test", "1B-1TEST")
.addRegistrar("1.test")
.addNameserver("ns1.cat.1.test", "17-ROID")
.addNameserver("ns2.cat.2.test", "19-ROID")
Expand All @@ -1298,7 +1298,7 @@ void testNameserverMatch_nsstar_cat_1_test_found() {
RequestType.NS_LDH_NAME,
"ns*.cat.1.test",
jsonFileBuilder()
.addDomain("cat.1.test", "1B-1_TEST")
.addDomain("cat.1.test", "1B-1TEST")
.addRegistrar("1.test")
.addNameserver("ns1.cat.1.test", "17-ROID")
.addNameserver("ns2.cat.2.test", "19-ROID")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,7 @@ public static Tld createTld(String tld, TldState tldState) {
public static Tld createTld(String tld, ImmutableSortedMap<DateTime, TldState> tldStates) {
// Coerce the TLD string into a valid ROID suffix.
String roidSuffix =
Ascii.toUpperCase(tld.replaceFirst(ACE_PREFIX_REGEX, "").replace('.', '_'))
.replace('-', '_');
Ascii.toUpperCase(tld.replaceFirst(ACE_PREFIX_REGEX, "").replace(".", "")).replace("-", "");
return createTld(
tld, roidSuffix.length() > 8 ? roidSuffix.substring(0, 8) : roidSuffix, tldStates);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ void testFailure_invalidRoidSuffix() throws Exception {
"TLDSTR", name, "TLDUNICODE", name, "ROIDSUFFIX", "TLLLLLLLLLLLLLLLLLLLLLLD")));
IllegalArgumentException thrown =
assertThrows(IllegalArgumentException.class, () -> runCommandForced("--input=" + tldFile));
assertThat(thrown.getMessage()).isEqualTo("ROID suffix must be in format ^[A-Z\\d_]{1,8}$");
assertThat(thrown.getMessage()).isEqualTo("ROID suffix must be in format ^[A-Z\\d]{1,8}$");
}

@Test
Expand Down
Loading