diff --git a/java/google/registry/dns/DnsWriterProxy.java b/java/google/registry/dns/DnsWriterProxy.java
index d5c1fecb7..4c7833dea 100644
--- a/java/google/registry/dns/DnsWriterProxy.java
+++ b/java/google/registry/dns/DnsWriterProxy.java
@@ -15,6 +15,7 @@
package google.registry.dns;
import static com.google.common.base.Preconditions.checkState;
+import static com.google.common.collect.Iterables.getOnlyElement;
import static google.registry.util.FormattingLogger.getLoggerForCallerClass;
import com.google.common.collect.ImmutableMap;
@@ -40,7 +41,7 @@ public final class DnsWriterProxy {
// TODO(b/63385597): Delete this method after DNS writers migration is complete.
@Deprecated
public DnsWriter getForTld(String tld) {
- return getByClassNameForTld(Registry.get(tld).getDnsWriter(), tld);
+ return getByClassNameForTld(getOnlyElement(Registry.get(tld).getDnsWriters()), tld);
}
/** Returns the instance of {@link DnsWriter} by class name. */
diff --git a/java/google/registry/model/registry/Registry.java b/java/google/registry/model/registry/Registry.java
index cc5b10985..31f1e910a 100644
--- a/java/google/registry/model/registry/Registry.java
+++ b/java/google/registry/model/registry/Registry.java
@@ -18,7 +18,6 @@ import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Predicates.equalTo;
import static com.google.common.base.Predicates.not;
-import static com.google.common.collect.Iterables.getOnlyElement;
import static google.registry.config.RegistryConfig.getSingletonCacheRefreshDuration;
import static google.registry.model.common.EntityGroupRoot.getCrossTldKey;
import static google.registry.model.ofy.ObjectifyService.ofy;
@@ -50,7 +49,6 @@ import com.googlecode.objectify.annotation.Embed;
import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.Id;
import com.googlecode.objectify.annotation.Mapify;
-import com.googlecode.objectify.annotation.OnLoad;
import com.googlecode.objectify.annotation.OnSave;
import com.googlecode.objectify.annotation.Parent;
import google.registry.model.Buildable;
@@ -266,18 +264,6 @@ public class Registry extends ImmutableObject implements Buildable {
*/
String pricingEngineClassName;
- /**
- * The name of the DnsWriter that this TLD uses.
- *
- *
This must be a valid key for the map of DnsWriters injected by
- * @Inject Map
- *
- * @deprecated by dnsWriters
- */
- // TODO(b/63385623): Delete this field when the data migration is complete.
- @Deprecated
- String dnsWriter;
-
/**
* The set of name(s) of the {@code DnsWriter} implementations that this TLD uses.
*
@@ -288,13 +274,6 @@ public class Registry extends ImmutableObject implements Buildable {
*/
Set dnsWriters;
- @OnLoad
- public void migrateDnsWriters() {
- if (dnsWriter == null) {
- dnsWriter = getOnlyElement(dnsWriters);
- }
- }
-
/**
* The unicode-aware representation of the TLD associated with this {@link Registry}.
*
@@ -611,11 +590,6 @@ public class Registry extends ImmutableObject implements Buildable {
return pricingEngineClassName;
}
- @Deprecated
- public String getDnsWriter() {
- return getOnlyElement(dnsWriters);
- }
-
public ImmutableSet getDnsWriters() {
return ImmutableSet.copyOf(dnsWriters);
}
@@ -703,9 +677,9 @@ public class Registry extends ImmutableObject implements Buildable {
}
public Builder setDnsWriters(ImmutableSet dnsWriters) {
+ // TODO(b/63385597): Remove this restriction once DNS task queue migration is complete.
checkArgument(dnsWriters.size() == 1, "Multiple DNS writers are not yet supported");
getInstance().dnsWriters = dnsWriters;
- getInstance().dnsWriter = getOnlyElement(dnsWriters);
return this;
}
@@ -972,9 +946,6 @@ public class Registry extends ImmutableObject implements Buildable {
"All EAP fees must be in the registry's currency");
checkArgumentNotNull(
instance.pricingEngineClassName, "All registries must have a configured pricing engine");
- checkArgumentNotNull(
- instance.dnsWriter,
- "A DNS writer must be specified. VoidDnsWriter can be used if DNS writing isn't wanted");
checkArgument(
instance.dnsWriters != null && !instance.dnsWriters.isEmpty(),
"At least one DNS writer must be specified."
diff --git a/java/google/registry/tools/CreateOrUpdateTldCommand.java b/java/google/registry/tools/CreateOrUpdateTldCommand.java
index d8056e7ea..de4099704 100644
--- a/java/google/registry/tools/CreateOrUpdateTldCommand.java
+++ b/java/google/registry/tools/CreateOrUpdateTldCommand.java
@@ -25,6 +25,8 @@ import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSortedMap;
+import com.google.common.collect.ImmutableSortedSet;
+import com.google.common.collect.Sets;
import google.registry.model.pricing.StaticPremiumListPricingEngine;
import google.registry.model.registry.Registries;
import google.registry.model.registry.Registry;
@@ -51,7 +53,7 @@ abstract class CreateOrUpdateTldCommand extends MutatingCommand {
@Inject
@Named("dnsWriterNames")
- Set dnsWriterNames;
+ Set validDnsWriterNames;
@Parameter(description = "Names of the TLDs", required = true)
List mainParameters;
@@ -220,11 +222,9 @@ abstract class CreateOrUpdateTldCommand extends MutatingCommand {
@Nullable
@Parameter(
- names = "--dns_writer",
- description = "The name of the DnsWriter implementation to use",
- converter = OptionalStringParameter.class,
- validateWith = OptionalStringParameter.class)
- Optional dnsWriter;
+ names = "--dns_writers",
+ description = "A comma-separated list of DnsWriter implementations to use")
+ List dnsWriters;
@Nullable
@Parameter(
@@ -388,12 +388,15 @@ abstract class CreateOrUpdateTldCommand extends MutatingCommand {
}
}
- if (dnsWriter != null && dnsWriter.isPresent()) {
- checkArgument(
- dnsWriterNames.contains(dnsWriter.get()),
- "The DNS writer '%s' doesn't exist",
- dnsWriter.get());
- builder.setDnsWriters(ImmutableSet.of(dnsWriter.get()));
+ if (dnsWriters != null) {
+ ImmutableSet dnsWritersSet = ImmutableSet.copyOf(dnsWriters);
+ ImmutableSortedSet invalidDnsWriters =
+ ImmutableSortedSet.copyOf(Sets.difference(dnsWritersSet, validDnsWriterNames));
+ checkArgument(
+ invalidDnsWriters.isEmpty(),
+ "Invalid DNS writer name(s) specified: %s",
+ invalidDnsWriters);
+ builder.setDnsWriters(dnsWritersSet);
}
if (lrpPeriod != null) {
diff --git a/java/google/registry/tools/SetupOteCommand.java b/java/google/registry/tools/SetupOteCommand.java
index 6cbe4cf8c..7cad6d72e 100644
--- a/java/google/registry/tools/SetupOteCommand.java
+++ b/java/google/registry/tools/SetupOteCommand.java
@@ -56,7 +56,7 @@ final class SetupOteCommand extends ConfirmingCommand implements RemoteApiComman
@Inject
@Named("dnsWriterNames")
- Set dnsWriterNames;
+ Set validDnsWriterNames;
@Parameter(
names = {"-r", "--registrar"},
@@ -82,10 +82,10 @@ final class SetupOteCommand extends ConfirmingCommand implements RemoteApiComman
private Path certFile;
@Parameter(
- names = {"--dns_writer"},
- description = "DNS writer to use on all TLDs",
+ names = {"--dns_writers"},
+ description = "comma separated list of DNS writers to use on all TLDs",
required = true)
- private String dnsWriter;
+ private List dnsWriters;
@Parameter(
names = {"--premium_list"},
@@ -110,8 +110,8 @@ final class SetupOteCommand extends ConfirmingCommand implements RemoteApiComman
Duration pendingDeleteLength) throws Exception {
CreateTldCommand command = new CreateTldCommand();
command.addGracePeriod = addGracePeriod;
- command.dnsWriter = Optional.of(dnsWriter);
- command.dnsWriterNames = dnsWriterNames;
+ command.dnsWriters = dnsWriters;
+ command.validDnsWriterNames = validDnsWriterNames;
command.force = force;
command.initialTldState = initialTldState;
command.mainParameters = ImmutableList.of(tldName);
diff --git a/javatests/google/registry/model/schema.txt b/javatests/google/registry/model/schema.txt
index 2b8eb8109..36a086d37 100644
--- a/javatests/google/registry/model/schema.txt
+++ b/javatests/google/registry/model/schema.txt
@@ -690,7 +690,6 @@ class google.registry.model.registry.Registry {
google.registry.model.common.TimedTransitionProperty eapFeeSchedule;
google.registry.model.common.TimedTransitionProperty renewBillingCostTransitions;
google.registry.model.registry.Registry$TldType tldType;
- java.lang.String dnsWriter;
java.lang.String driveFolderId;
java.lang.String lordnUsername;
java.lang.String pricingEngineClassName;
diff --git a/javatests/google/registry/tools/CreateTldCommandTest.java b/javatests/google/registry/tools/CreateTldCommandTest.java
index c057c0794..2294abd13 100644
--- a/javatests/google/registry/tools/CreateTldCommandTest.java
+++ b/javatests/google/registry/tools/CreateTldCommandTest.java
@@ -52,13 +52,13 @@ public class CreateTldCommandTest extends CommandTestCase {
persistReservedList("tld_banned", "kilo,FULLY_BLOCKED", "lima,MISTAKEN_PREMIUM");
persistReservedList("soy_expurgated", "fireflies,FULLY_BLOCKED");
persistPremiumList("xn--q9jyb4c", "minecraft,USD 1000");
- command.dnsWriterNames = ImmutableSet.of("VoidDnsWriter", "FooDnsWriter");
+ command.validDnsWriterNames = ImmutableSet.of("VoidDnsWriter", "FooDnsWriter");
}
@Test
public void testSuccess() throws Exception {
DateTime before = DateTime.now(UTC);
- runCommandForced("xn--q9jyb4c", "--roid_suffix=Q9JYB4C", "--dns_writer=FooDnsWriter");
+ runCommandForced("xn--q9jyb4c", "--roid_suffix=Q9JYB4C", "--dns_writers=FooDnsWriter");
DateTime after = DateTime.now(UTC);
Registry registry = Registry.get("xn--q9jyb4c");
@@ -76,13 +76,13 @@ public class CreateTldCommandTest extends CommandTestCase {
@Test
public void testFailure_multipleArguments() throws Exception {
thrown.expect(IllegalArgumentException.class, "Can't create more than one TLD at a time");
- runCommandForced("--roid_suffix=blah", "--dns_writer=VoidDnsWriter", "xn--q9jyb4c", "test");
+ runCommandForced("--roid_suffix=blah", "--dns_writers=VoidDnsWriter", "xn--q9jyb4c", "test");
}
@Test
public void testFailure_multipleDuplicateArguments() throws Exception {
thrown.expect(IllegalArgumentException.class, "Can't create more than one TLD at a time");
- runCommandForced("--roid_suffix=blah", "--dns_writer=VoidDnsWriter", "test", "test");
+ runCommandForced("--roid_suffix=blah", "--dns_writers=VoidDnsWriter", "test", "test");
}
@Test
@@ -90,7 +90,7 @@ public class CreateTldCommandTest extends CommandTestCase {
runCommandForced(
"--initial_tld_state=GENERAL_AVAILABILITY",
"--roid_suffix=Q9JYB4C",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"xn--q9jyb4c");
assertThat(Registry.get("xn--q9jyb4c").getTldState(DateTime.now(UTC)))
.isEqualTo(TldState.GENERAL_AVAILABILITY);
@@ -101,7 +101,7 @@ public class CreateTldCommandTest extends CommandTestCase {
runCommandForced(
"--initial_renew_billing_cost=\"USD 42.42\"",
"--roid_suffix=Q9JYB4C",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"xn--q9jyb4c");
assertThat(Registry.get("xn--q9jyb4c").getStandardRenewCost(DateTime.now(UTC)))
.isEqualTo(Money.of(USD, 42.42));
@@ -118,7 +118,7 @@ public class CreateTldCommandTest extends CommandTestCase {
now.toString(DATETIME_FORMAT),
tomorrow.toString(DATETIME_FORMAT)),
"--roid_suffix=Q9JYB4C",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"xn--q9jyb4c");
Registry registry = Registry.get("xn--q9jyb4c");
@@ -135,28 +135,28 @@ public class CreateTldCommandTest extends CommandTestCase {
runCommandForced(
"--add_grace_period=PT300S",
"--roid_suffix=Q9JYB4C",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"xn--q9jyb4c");
assertThat(Registry.get("xn--q9jyb4c").getAddGracePeriodLength()).isEqualTo(standardMinutes(5));
}
@Test
public void testSuccess_roidSuffixWorks() throws Exception {
- runCommandForced("--roid_suffix=RSUFFIX", "--dns_writer=VoidDnsWriter", "tld");
+ runCommandForced("--roid_suffix=RSUFFIX", "--dns_writers=VoidDnsWriter", "tld");
assertThat(Registry.get("tld").getRoidSuffix()).isEqualTo("RSUFFIX");
}
@Test
public void testSuccess_escrow() throws Exception {
runCommandForced(
- "--escrow=true", "--roid_suffix=Q9JYB4C", "--dns_writer=VoidDnsWriter", "xn--q9jyb4c");
+ "--escrow=true", "--roid_suffix=Q9JYB4C", "--dns_writers=VoidDnsWriter", "xn--q9jyb4c");
assertThat(Registry.get("xn--q9jyb4c").getEscrowEnabled()).isTrue();
}
@Test
public void testSuccess_noEscrow() throws Exception {
runCommandForced(
- "--escrow=false", "--roid_suffix=Q9JYB4C", "--dns_writer=VoidDnsWriter", "xn--q9jyb4c");
+ "--escrow=false", "--roid_suffix=Q9JYB4C", "--dns_writers=VoidDnsWriter", "xn--q9jyb4c");
assertThat(Registry.get("xn--q9jyb4c").getEscrowEnabled()).isFalse();
}
@@ -165,7 +165,7 @@ public class CreateTldCommandTest extends CommandTestCase {
runCommandForced(
"--redemption_grace_period=PT300S",
"--roid_suffix=Q9JYB4C",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"xn--q9jyb4c");
assertThat(Registry.get("xn--q9jyb4c").getRedemptionGracePeriodLength())
.isEqualTo(standardMinutes(5));
@@ -176,7 +176,7 @@ public class CreateTldCommandTest extends CommandTestCase {
runCommandForced(
"--pending_delete_length=PT300S",
"--roid_suffix=Q9JYB4C",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"xn--q9jyb4c");
assertThat(Registry.get("xn--q9jyb4c").getPendingDeleteLength()).isEqualTo(standardMinutes(5));
}
@@ -186,7 +186,7 @@ public class CreateTldCommandTest extends CommandTestCase {
runCommandForced(
"--automatic_transfer_length=PT300S",
"--roid_suffix=Q9JYB4C",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"xn--q9jyb4c");
assertThat(Registry.get("xn--q9jyb4c").getAutomaticTransferLength())
.isEqualTo(standardMinutes(5));
@@ -197,7 +197,7 @@ public class CreateTldCommandTest extends CommandTestCase {
runCommandForced(
"--create_billing_cost=\"USD 42.42\"",
"--roid_suffix=Q9JYB4C",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"xn--q9jyb4c");
assertThat(Registry.get("xn--q9jyb4c").getStandardCreateCost()).isEqualTo(Money.of(USD, 42.42));
}
@@ -207,7 +207,7 @@ public class CreateTldCommandTest extends CommandTestCase {
runCommandForced(
"--restore_billing_cost=\"USD 42.42\"",
"--roid_suffix=Q9JYB4C",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"xn--q9jyb4c");
assertThat(Registry.get("xn--q9jyb4c").getStandardRestoreCost())
.isEqualTo(Money.of(USD, 42.42));
@@ -218,7 +218,7 @@ public class CreateTldCommandTest extends CommandTestCase {
runCommandForced(
"--server_status_change_cost=\"USD 42.42\"",
"--roid_suffix=Q9JYB4C",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"xn--q9jyb4c");
assertThat(Registry.get("xn--q9jyb4c").getServerStatusChangeCost())
.isEqualTo(Money.of(USD, 42.42));
@@ -232,7 +232,7 @@ public class CreateTldCommandTest extends CommandTestCase {
"--initial_renew_billing_cost=\"JPY 101112\"",
"--server_status_change_cost=\"JPY 97865\"",
"--roid_suffix=Q9JYB4C",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"xn--q9jyb4c");
Registry registry = Registry.get("xn--q9jyb4c");
assertThat(registry.getStandardCreateCost()).isEqualTo(Money.ofMajor(JPY, 12345));
@@ -242,7 +242,7 @@ public class CreateTldCommandTest extends CommandTestCase {
@Test
public void testSuccess_multipartTld() throws Exception {
- runCommandForced("co.uk", "--roid_suffix=COUK", "--dns_writer=VoidDnsWriter");
+ runCommandForced("co.uk", "--roid_suffix=COUK", "--dns_writers=VoidDnsWriter");
Registry registry = Registry.get("co.uk");
assertThat(registry.getTldState(new DateTime())).isEqualTo(TldState.PREDELEGATION);
@@ -257,7 +257,7 @@ public class CreateTldCommandTest extends CommandTestCase {
runCommandForced(
"--reserved_lists=xn--q9jyb4c_abuse,common_abuse",
"--roid_suffix=Q9JYB4C",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"xn--q9jyb4c");
assertThat(transform(Registry.get("xn--q9jyb4c").getReservedLists(), GET_NAME_FUNCTION))
.containsExactly("xn--q9jyb4c_abuse", "common_abuse");
@@ -268,7 +268,7 @@ public class CreateTldCommandTest extends CommandTestCase {
runCommandForced(
"--lrp_period=2004-06-09T12:30:00Z/2004-07-10T13:30:00Z",
"--roid_suffix=Q9JYB4C",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"xn--q9jyb4c");
assertThat(Registry.get("xn--q9jyb4c").getLrpPeriod()).isEqualTo(
new Interval(
@@ -280,7 +280,7 @@ public class CreateTldCommandTest extends CommandTestCase {
runCommandForced(
"--premium_price_ack_required=true",
"--roid_suffix=Q9JYB4C",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"xn--q9jyb4c");
assertThat(Registry.get("xn--q9jyb4c").getPremiumPriceAckRequired()).isTrue();
}
@@ -291,7 +291,7 @@ public class CreateTldCommandTest extends CommandTestCase {
runCommandForced(
"--add_grace_period=5m",
"--roid_suffix=Q9JYB4C",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"xn--q9jyb4c");
}
@@ -301,7 +301,7 @@ public class CreateTldCommandTest extends CommandTestCase {
runCommandForced(
"--redemption_grace_period=5m",
"--roid_suffix=Q9JYB4C",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"xn--q9jyb4c");
}
@@ -311,7 +311,7 @@ public class CreateTldCommandTest extends CommandTestCase {
runCommandForced(
"--pending_delete_length=5m",
"--roid_suffix=Q9JYB4C",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"xn--q9jyb4c");
}
@@ -321,7 +321,7 @@ public class CreateTldCommandTest extends CommandTestCase {
runCommandForced(
"--initial_tld_state=INVALID_STATE",
"--roid_suffix=Q9JYB4C",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"xn--q9jyb4c");
}
@@ -334,7 +334,7 @@ public class CreateTldCommandTest extends CommandTestCase {
runCommandForced(
String.format("--tld_state_transitions=%s=PREDELEGATION,%s=SUNRISE", now, now.plus(1)),
"--initial_tld_state=GENERAL_AVAILABILITY",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"xn--q9jyb4c");
}
@@ -344,7 +344,7 @@ public class CreateTldCommandTest extends CommandTestCase {
runCommandForced(
"--initial_renew_billing_cost=USD -42",
"--roid_suffix=Q9JYB4C",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"xn--q9jyb4c");
}
@@ -356,7 +356,7 @@ public class CreateTldCommandTest extends CommandTestCase {
String.format(
"--eap_fee_schedule=\"%s=JPY 123456\"", START_OF_TIME.toString(DATETIME_FORMAT)),
"--roid_suffix=Q9JYB4C",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"xn--q9jyb4c");
}
@@ -368,21 +368,21 @@ public class CreateTldCommandTest extends CommandTestCase {
@Test
public void testFailure_noDnsWriter() throws Exception {
- thrown.expect(IllegalArgumentException.class, "A DNS writer must be specified");
- runCommandForced("xn--q9jyb4c", "--roid_suffix=Q9JYB4C");
+ thrown.expect(IllegalArgumentException.class, "At least one DNS writer must be specified");
+ runCommandForced("xn--q9jyb4c", "--roid_suffix=Q9JYB4C");
}
@Test
public void testFailure_alreadyExists() throws Exception {
createTld("xn--q9jyb4c");
thrown.expect(IllegalStateException.class, "TLD 'xn--q9jyb4c' already exists");
- runCommandForced("--roid_suffix=NOTDUPE", "--dns_writer=VoidDnsWriter", "xn--q9jyb4c");
+ runCommandForced("--roid_suffix=NOTDUPE", "--dns_writers=VoidDnsWriter", "xn--q9jyb4c");
}
@Test
public void testFailure_tldStartsWithDigit() throws Exception {
thrown.expect(IllegalArgumentException.class, "TLDs cannot begin with a number");
- runCommandForced("1foo", "--roid_suffix=1FOO", "--dns_writer=VoidDnsWriter");
+ runCommandForced("1foo", "--roid_suffix=1FOO", "--dns_writers=VoidDnsWriter");
}
@Test
@@ -390,7 +390,7 @@ public class CreateTldCommandTest extends CommandTestCase {
runCommandForced(
"--allowed_registrants=alice,bob",
"--roid_suffix=Q9JYB4C",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"xn--q9jyb4c");
assertThat(Registry.get("xn--q9jyb4c").getAllowedRegistrantContactIds())
.containsExactly("alice", "bob");
@@ -401,7 +401,7 @@ public class CreateTldCommandTest extends CommandTestCase {
runCommandForced(
"--allowed_nameservers=ns1.example.com,ns2.example.com",
"--roid_suffix=Q9JYB4C",
- "--dns_writer=FooDnsWriter",
+ "--dns_writers=FooDnsWriter",
"xn--q9jyb4c");
assertThat(Registry.get("xn--q9jyb4c").getAllowedFullyQualifiedHostNames())
.containsExactly("ns1.example.com", "ns2.example.com");
@@ -412,7 +412,7 @@ public class CreateTldCommandTest extends CommandTestCase {
runCommandForced(
"--domain_create_restricted=true",
"--roid_suffix=Q9JYB4C",
- "--dns_writer=FooDnsWriter",
+ "--dns_writers=FooDnsWriter",
"xn--q9jyb4c");
assertThat(Registry.get("xn--q9jyb4c").getDomainCreateRestricted()).isTrue();
}
@@ -490,7 +490,7 @@ public class CreateTldCommandTest extends CommandTestCase {
runCommandForced(
"--premium_list=xn--q9jyb4c",
"--roid_suffix=Q9JYB4C",
- "--dns_writer=FooDnsWriter",
+ "--dns_writers=FooDnsWriter",
"xn--q9jyb4c");
assertThat(Registry.get("xn--q9jyb4c").getPremiumList().getName()).isEqualTo("xn--q9jyb4c");
}
@@ -500,7 +500,7 @@ public class CreateTldCommandTest extends CommandTestCase {
runCommandForced(
"--drive_folder_id=madmax2030",
"--roid_suffix=Q9JYB4C",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"xn--q9jyb4c");
assertThat(Registry.get("xn--q9jyb4c").getDriveFolderId()).isEqualTo("madmax2030");
}
@@ -510,7 +510,7 @@ public class CreateTldCommandTest extends CommandTestCase {
runCommandForced(
"--drive_folder_id=null",
"--roid_suffix=Q9JYB4C",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"xn--q9jyb4c");
assertThat(Registry.get("xn--q9jyb4c").getDriveFolderId()).isNull();
}
@@ -521,7 +521,7 @@ public class CreateTldCommandTest extends CommandTestCase {
runCommandForced(
"--premium_list=phonies",
"--roid_suffix=Q9JYB4C",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"xn--q9jyb4c");
}
@@ -533,7 +533,7 @@ public class CreateTldCommandTest extends CommandTestCase {
runCommandForced(
"--lrp_period=2005-06-09T12:30:00Z/2004-07-10T13:30:00Z",
"--roid_suffix=Q9JYB4C",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"xn--q9jyb4c");
}
@@ -543,15 +543,16 @@ public class CreateTldCommandTest extends CommandTestCase {
runCommandForced(
"--lrp_period=foobar",
"--roid_suffix=Q9JYB4C",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"xn--q9jyb4c");
}
@Test
- public void testFailure_specifiedDnsWriter_doesntExist() throws Exception {
+ public void testFailure_specifiedDnsWriters_dontExist() throws Exception {
thrown.expect(
- IllegalArgumentException.class, "The DNS writer 'InvalidDnsWriter' doesn't exist");
- runCommandForced("xn--q9jyb4c", "--roid_suffix=Q9JYB4C", "--dns_writer=InvalidDnsWriter");
+ IllegalArgumentException.class,
+ "Invalid DNS writer name(s) specified: [Deadbeef, Invalid]");
+ runCommandForced("xn--q9jyb4c", "--roid_suffix=Q9JYB4C", "--dns_writers=Invalid,Deadbeef");
}
private void runSuccessfulReservedListsTest(String reservedLists) throws Exception {
@@ -559,7 +560,7 @@ public class CreateTldCommandTest extends CommandTestCase {
"--reserved_lists",
reservedLists,
"--roid_suffix=Q9JYB4C",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"xn--q9jyb4c");
}
@@ -569,7 +570,7 @@ public class CreateTldCommandTest extends CommandTestCase {
"--reserved_lists",
reservedLists,
"--roid_suffix=Q9JYB4C",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"xn--q9jyb4c");
}
@@ -581,7 +582,7 @@ public class CreateTldCommandTest extends CommandTestCase {
"--reserved_lists",
reservedLists,
"--roid_suffix=Q9JYB4C",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"xn--q9jyb4c");
}
}
diff --git a/javatests/google/registry/tools/SetupOteCommandTest.java b/javatests/google/registry/tools/SetupOteCommandTest.java
index c7c11067b..d1ec3894c 100644
--- a/javatests/google/registry/tools/SetupOteCommandTest.java
+++ b/javatests/google/registry/tools/SetupOteCommandTest.java
@@ -47,7 +47,7 @@ public class SetupOteCommandTest extends CommandTestCase {
@Before
public void init() {
- command.dnsWriterNames = ImmutableSet.of("FooDnsWriter", "BarDnsWriter", "VoidDnsWriter");
+ command.validDnsWriterNames = ImmutableSet.of("FooDnsWriter", "BarDnsWriter", "VoidDnsWriter");
command.passwordGenerator = passwordGenerator;
persistPremiumList("default_sandbox_list", "sandbox,USD 1000");
persistPremiumList("alternate_list", "rich,USD 3000");
@@ -67,7 +67,6 @@ public class SetupOteCommandTest extends CommandTestCase {
assertThat(registry).isNotNull();
assertThat(registry.getRoidSuffix()).isEqualTo(roidSuffix);
assertThat(registry.getTldState(DateTime.now(UTC))).isEqualTo(tldState);
- assertThat(registry.getDnsWriter()).isEqualTo(dnsWriter);
assertThat(registry.getDnsWriters()).containsExactly(dnsWriter);
assertThat(registry.getPremiumList()).isNotNull();
assertThat(registry.getPremiumList().getName()).isEqualTo(premiumList);
@@ -111,7 +110,7 @@ public class SetupOteCommandTest extends CommandTestCase {
runCommandForced(
"--ip_whitelist=1.1.1.1",
"--registrar=blobio",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"--certfile=" + getCertFilename());
verifyTldCreation(
@@ -142,7 +141,7 @@ public class SetupOteCommandTest extends CommandTestCase {
runCommandForced(
"--ip_whitelist=1.1.1.1,2.2.2.2",
"--registrar=blobio",
- "--dns_writer=FooDnsWriter",
+ "--dns_writers=FooDnsWriter",
"--certfile=" + getCertFilename());
verifyTldCreation(
@@ -175,7 +174,7 @@ public class SetupOteCommandTest extends CommandTestCase {
"--ip_whitelist=1.1.1.1",
"--registrar=blobio",
"--certfile=" + getCertFilename(),
- "--dns_writer=BarDnsWriter",
+ "--dns_writers=BarDnsWriter",
"--premium_list=alternate_list");
verifyTldCreation(
@@ -206,7 +205,7 @@ public class SetupOteCommandTest extends CommandTestCase {
thrown.expect(ParameterException.class, "option is required: -w, --ip_whitelist");
runCommandForced(
"--registrar=blobio",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"--certfile=" + getCertFilename());
}
@@ -215,7 +214,7 @@ public class SetupOteCommandTest extends CommandTestCase {
thrown.expect(ParameterException.class, "option is required: -r, --registrar");
runCommandForced(
"--ip_whitelist=1.1.1.1",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"--certfile=" + getCertFilename());
}
@@ -224,13 +223,13 @@ public class SetupOteCommandTest extends CommandTestCase {
thrown.expect(ParameterException.class, "option is required: -c, --certfile");
runCommandForced(
"--ip_whitelist=1.1.1.1",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"--registrar=blobio");
}
@Test
public void testFailure_missingDnsWriter() throws Exception {
- thrown.expect(ParameterException.class, "option is required: --dns_writer");
+ thrown.expect(ParameterException.class, "option is required: --dns_writers");
runCommandForced(
"--ip_whitelist=1.1.1.1",
"--certfile=" + getCertFilename(),
@@ -243,7 +242,7 @@ public class SetupOteCommandTest extends CommandTestCase {
runCommandForced(
"--ip_whitelist=1.1.1.1",
"--registrar=blobio",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"--certfile=/dev/null");
}
@@ -253,18 +252,18 @@ public class SetupOteCommandTest extends CommandTestCase {
runCommandForced(
"--ip_whitelist=1.1.1.1",
"--registrar=3blobio",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"--certfile=" + getCertFilename());
}
@Test
public void testFailure_invalidDnsWriter() throws Exception {
thrown.expect(
- IllegalArgumentException.class, "The DNS writer 'InvalidDnsWriter' doesn't exist");
+ IllegalArgumentException.class, "Invalid DNS writer name(s) specified: [InvalidDnsWriter]");
runCommandForced(
"--ip_whitelist=1.1.1.1",
"--registrar=blobio",
- "--dns_writer=InvalidDnsWriter",
+ "--dns_writers=InvalidDnsWriter",
"--certfile=" + getCertFilename());
}
@@ -274,7 +273,7 @@ public class SetupOteCommandTest extends CommandTestCase {
runCommandForced(
"--ip_whitelist=1.1.1.1",
"--registrar=bl",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"--certfile=" + getCertFilename());
}
@@ -284,7 +283,7 @@ public class SetupOteCommandTest extends CommandTestCase {
runCommandForced(
"--ip_whitelist=1.1.1.1",
"--registrar=blobiotoooolong",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"--certfile=" + getCertFilename());
}
@@ -294,7 +293,7 @@ public class SetupOteCommandTest extends CommandTestCase {
runCommandForced(
"--ip_whitelist=1.1.1.1",
"--registrar=blo#bio",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"--certfile=" + getCertFilename());
}
@@ -304,7 +303,7 @@ public class SetupOteCommandTest extends CommandTestCase {
runCommandForced(
"--ip_whitelist=1.1.1.1",
"--registrar=blobio",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"--certfile=" + getCertFilename(),
"--premium_list=foo");
}
@@ -316,7 +315,7 @@ public class SetupOteCommandTest extends CommandTestCase {
runCommandForced(
"--ip_whitelist=1.1.1.1",
"--registrar=blobio",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"--certfile=" + getCertFilename());
}
@@ -331,7 +330,7 @@ public class SetupOteCommandTest extends CommandTestCase {
runCommandForced(
"--ip_whitelist=1.1.1.1",
"--registrar=blobio",
- "--dns_writer=VoidDnsWriter",
+ "--dns_writers=VoidDnsWriter",
"--certfile=" + getCertFilename());
}
}
diff --git a/javatests/google/registry/tools/UpdateTldCommandTest.java b/javatests/google/registry/tools/UpdateTldCommandTest.java
index fd02ff6f3..36dfa7389 100644
--- a/javatests/google/registry/tools/UpdateTldCommandTest.java
+++ b/javatests/google/registry/tools/UpdateTldCommandTest.java
@@ -59,7 +59,7 @@ public class UpdateTldCommandTest extends CommandTestCase {
persistReservedList("xn--q9jyb4c_r1", "foo,FULLY_BLOCKED");
persistReservedList("xn--q9jyb4c_r2", "moop,FULLY_BLOCKED");
createTld("xn--q9jyb4c");
- command.dnsWriterNames = ImmutableSet.of("VoidDnsWriter", "FooDnsWriter");
+ command.validDnsWriterNames = ImmutableSet.of("VoidDnsWriter", "FooDnsWriter");
}
@Test
@@ -176,14 +176,18 @@ public class UpdateTldCommandTest extends CommandTestCase {
@Test
public void testSuccess_dnsWriter() throws Exception {
- assertThat(Registry.get("xn--q9jyb4c").getDnsWriter()).isEqualTo("VoidDnsWriter");
assertThat(Registry.get("xn--q9jyb4c").getDnsWriters()).containsExactly("VoidDnsWriter");
- runCommandForced("--dns_writer=FooDnsWriter", "xn--q9jyb4c");
- assertThat(Registry.get("xn--q9jyb4c").getDnsWriter()).isEqualTo("FooDnsWriter");
+ runCommandForced("--dns_writers=FooDnsWriter", "xn--q9jyb4c");
assertThat(Registry.get("xn--q9jyb4c").getDnsWriters()).containsExactly("FooDnsWriter");
}
+ @Test
+ public void testFailure_multipleDnsWritersNotYetSupported() throws Exception {
+ thrown.expect(IllegalArgumentException.class, "Multiple DNS writers are not yet supported");
+ runCommandForced("--dns_writers=FooDnsWriter,VoidDnsWriter", "xn--q9jyb4c");
+ }
+
@Test
public void testSuccess_escrow() throws Exception {
runCommandForced("--escrow=true", "xn--q9jyb4c");
@@ -653,8 +657,8 @@ public class UpdateTldCommandTest extends CommandTestCase {
@Test
public void testFailure_specifiedDnsWriter_doesntExist() throws Exception {
thrown.expect(
- IllegalArgumentException.class, "The DNS writer 'InvalidDnsWriter' doesn't exist");
- runCommandForced("xn--q9jyb4c", "--dns_writer=InvalidDnsWriter");
+ IllegalArgumentException.class, "Invalid DNS writer name(s) specified: [InvalidDnsWriter]");
+ runCommandForced("xn--q9jyb4c", "--dns_writers=InvalidDnsWriter");
}
@Test