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