Add LRP TLD states to Registry and *_tld tools

Also had to add an EnumParameter class to support
List<T extends Enum<T>>, as these aren't natively supported by
JCommander (although single Enum parameters are.)

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=129464699
This commit is contained in:
Chris Tingue 2016-08-05 11:39:06 -07:00 committed by Justine Tunney
parent 751df4b488
commit 1ef8716177
10 changed files with 259 additions and 2 deletions

View file

@ -211,6 +211,29 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
.containsExactly("xn--q9jyb4c_abuse", "common_abuse");
}
@Test
public void testSuccess_addLrpTldState() throws Exception {
runCommandForced(
"--lrp_tld_states=SUNRISE",
"--initial_tld_state=SUNRISE",
"--roid_suffix=Q9JYB4C",
"xn--q9jyb4c");
assertThat(Registry.get("xn--q9jyb4c").getLrpTldStates())
.containsExactly(TldState.SUNRISE);
}
@Test
public void testSuccess_addMultipleLrpTldStates() throws Exception {
DateTime now = DateTime.now(UTC);
runCommandForced(
"--lrp_tld_states=SUNRISE,LANDRUSH",
String.format("--tld_state_transitions=%s=SUNRISE,%s=LANDRUSH", START_OF_TIME, now.plus(1)),
"--roid_suffix=Q9JYB4C",
"xn--q9jyb4c");
assertThat(Registry.get("xn--q9jyb4c").getLrpTldStates())
.containsExactly(TldState.SUNRISE, TldState.LANDRUSH);
}
@Test
public void testSuccess_setPremiumPriceAckRequired() throws Exception {
runCommandForced("--premium_price_ack_required=true", "--roid_suffix=Q9JYB4C", "xn--q9jyb4c");
@ -406,6 +429,30 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
runCommandForced("--roid_suffix=BLAH", "randomtld");
}
@Test
public void testFailure_lrpTldState_notInTldStateTransitions() throws Exception {
thrown.expect(
IllegalArgumentException.class,
"Cannot specify an LRP TLD state that is not part of the TLD state transitions.");
runCommandForced(
"--lrp_tld_states=SUNRISE",
"--initial_tld_state=PREDELEGATION",
"--roid_suffix=Q9JYB4C",
"xn--q9jyb4c");
}
@Test
public void testFailure_lrpTldState_badTldState() throws Exception {
thrown.expect(
IllegalArgumentException.class,
"No enum constant google.registry.model.registry.Registry.TldState.LANDRISE");
runCommandForced(
"--lrp_tld_states=LANDRISE",
"--initial_tld_state=PREDELEGATION",
"--roid_suffix=Q9JYB4C",
"xn--q9jyb4c");
}
private void runSuccessfulReservedListsTest(String reservedLists) throws Exception {
runCommandForced("--reserved_lists", reservedLists, "--roid_suffix=Q9JYB4C", "xn--q9jyb4c");
}