diff --git a/java/google/registry/model/OteAccountBuilder.java b/java/google/registry/model/OteAccountBuilder.java index 8ce511a87..5c10742df 100644 --- a/java/google/registry/model/OteAccountBuilder.java +++ b/java/google/registry/model/OteAccountBuilder.java @@ -72,8 +72,18 @@ import org.joda.time.Duration; */ public final class OteAccountBuilder { - // Regex: 3-14 lower-case alphanumeric characters or hyphens, the first of which must be a letter. - private static final Pattern REGISTRAR_PATTERN = Pattern.compile("^[a-z][-a-z0-9]{2,13}$"); + /** + * Validation regex for registrar base client IDs (3-14 lowercase alphanumeric characters). + * + *
The base client ID is appended with numbers to create four different test registrar accounts + * (e.g. reg-1, reg-3, reg-4, reg-5). Registrar client IDs are of type clIDType in eppcom.xsd + * which is limited to 16 characters, hence the limit of 14 here to account for the dash and + * numbers. + * + *
The base client ID is also used to generate the OT&E TLDs, hence the restriction to
+ * lowercase alphanumeric characters.
+ */
+ private static final Pattern REGISTRAR_PATTERN = Pattern.compile("^[a-z0-9]{3,14}$");
// Durations are short so that registrars can test with quick transfer (etc.) turnaround.
private static final Duration SHORT_ADD_GRACE_PERIOD = Duration.standardMinutes(60);
diff --git a/java/google/registry/tools/SetupOteCommand.java b/java/google/registry/tools/SetupOteCommand.java
index b53bfcc7c..31197cd4f 100644
--- a/java/google/registry/tools/SetupOteCommand.java
+++ b/java/google/registry/tools/SetupOteCommand.java
@@ -40,51 +40,41 @@ final class SetupOteCommand extends ConfirmingCommand implements CommandWithRemo
private static final int PASSWORD_LENGTH = 16;
@Parameter(
- names = {"-r", "--registrar"},
- description =
- "must 1) consist of only lowercase letters, numbers, or hyphens, "
- + "2) start with a letter, and 3) be between 3 and 14 characters (inclusive). "
- + "We require 1 and 2 since the registrar name will be used to create TLDs,"
- + "and we require 3 since we append \"-[1234]\" to the name to create client"
- + "IDs which are required by the EPP XML schema to be between 3-16 chars.",
- required = true
- )
+ names = {"-r", "--registrar"},
+ description = "The registrar client ID, consisting of 3-14 lowercase letters and numbers.",
+ required = true)
private String registrar;
@Parameter(
- names = {"-w", "--ip_whitelist"},
- description = "comma separated list of IP addreses or CIDR ranges",
- required = true
- )
+ names = {"-w", "--ip_whitelist"},
+ description = "Comma-separated list of IP addreses or CIDR ranges.",
+ required = true)
private List
-
- We require 1 and 2 since the registrar name will be used to create TLDs, and we
- require 3 since we append "-[12345]" to the name to create client IDs which are
- required by the EPP XML schema to be between 3-16 chars.
+ Must consist of 3-14 lower-case letters and numbers.
diff --git a/javatests/google/registry/model/OteAccountBuilderTest.java b/javatests/google/registry/model/OteAccountBuilderTest.java
index f022df3cd..94347a62d 100644
--- a/javatests/google/registry/model/OteAccountBuilderTest.java
+++ b/javatests/google/registry/model/OteAccountBuilderTest.java
@@ -192,9 +192,9 @@ public final class OteAccountBuilderTest {
public void testCreateOteEntities_invalidClientId_fails() {
assertThat(
assertThrows(
- IllegalArgumentException.class, () -> OteAccountBuilder.forClientId("3blobio")))
+ IllegalArgumentException.class, () -> OteAccountBuilder.forClientId("3blo-bio")))
.hasMessageThat()
- .isEqualTo("Invalid registrar name: 3blobio");
+ .isEqualTo("Invalid registrar name: 3blo-bio");
}
@Test
@@ -319,11 +319,6 @@ public final class OteAccountBuilderTest {
assertThat(OteAccountBuilder.getBaseClientId("myclientid-4")).isEqualTo("myclientid");
}
- @Test
- public void testGetBaseClientId_multipleDashesValid() {
- assertThat(OteAccountBuilder.getBaseClientId("two-dashes-3")).isEqualTo("two-dashes");
- }
-
@Test
public void testGetBaseClientId_invalidInput_malformed() {
assertThat(
diff --git a/javatests/google/registry/tools/SetupOteCommandTest.java b/javatests/google/registry/tools/SetupOteCommandTest.java
index ff4a3f2dc..f544930ef 100644
--- a/javatests/google/registry/tools/SetupOteCommandTest.java
+++ b/javatests/google/registry/tools/SetupOteCommandTest.java
@@ -324,10 +324,10 @@ public class SetupOteCommandTest extends CommandTestCase