diff --git a/core/src/main/java/google/registry/flows/domain/DomainRenewFlow.java b/core/src/main/java/google/registry/flows/domain/DomainRenewFlow.java index 1ff5eeff2..68da19693 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainRenewFlow.java +++ b/core/src/main/java/google/registry/flows/domain/DomainRenewFlow.java @@ -328,7 +328,7 @@ public final class DomainRenewFlow implements MutatingFlow { checkHasBillingAccount(registrarId, existingDomain.getTld()); } verifyUnitIsYears(command.getPeriod()); - // We only allow __REMOVE_PACKAGE__ token on bulk pricing domains for now + // We only allow __REMOVEDOMAIN__ token on bulk pricing domains for now verifyTokenAllowedOnDomain(existingDomain, allocationToken); // If the date they specify doesn't match the expiration, fail. (This is an idempotence check). if (!command.getCurrentExpirationDate().equals( diff --git a/core/src/main/java/google/registry/model/domain/token/AllocationToken.java b/core/src/main/java/google/registry/model/domain/token/AllocationToken.java index e684ec897..6c08dd3d5 100644 --- a/core/src/main/java/google/registry/model/domain/token/AllocationToken.java +++ b/core/src/main/java/google/registry/model/domain/token/AllocationToken.java @@ -352,6 +352,10 @@ public class AllocationToken extends UpdateAutoTimestampEntity implements Builda !getInstance().tokenType.equals(TokenType.BULK_PRICING) || getInstance().renewalPriceBehavior.equals(RenewalPriceBehavior.SPECIFIED), "Bulk tokens must have renewalPriceBehavior set to SPECIFIED"); + checkArgument( + !getInstance().tokenType.equals(TokenType.BULK_PRICING) + || ImmutableSet.of(CommandName.CREATE).equals(getInstance().allowedEppActions), + "Bulk tokens may only be valid for CREATE actions"); checkArgument( !getInstance().tokenType.equals(TokenType.BULK_PRICING) || !getInstance().discountPremiums, diff --git a/core/src/test/java/google/registry/batch/CheckBulkComplianceActionTest.java b/core/src/test/java/google/registry/batch/CheckBulkComplianceActionTest.java index 97bb5644b..6f93a1868 100644 --- a/core/src/test/java/google/registry/batch/CheckBulkComplianceActionTest.java +++ b/core/src/test/java/google/registry/batch/CheckBulkComplianceActionTest.java @@ -31,6 +31,7 @@ import com.google.common.testing.TestLogHandler; import google.registry.groups.GmailClient; import google.registry.model.billing.BillingBase.RenewalPriceBehavior; import google.registry.model.contact.Contact; +import google.registry.model.domain.fee.FeeQueryCommandExtensionItem.CommandName; import google.registry.model.domain.token.AllocationToken; import google.registry.model.domain.token.AllocationToken.TokenType; import google.registry.model.domain.token.BulkPricingPackage; @@ -113,6 +114,7 @@ public class CheckBulkComplianceActionTest { .setAllowedTlds(ImmutableSet.of("foo")) .setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar")) .setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .setDiscountFraction(1) .build()); bulkPricingPackage = @@ -207,6 +209,7 @@ public class CheckBulkComplianceActionTest { .setAllowedTlds(ImmutableSet.of("foo")) .setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar")) .setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .setDiscountFraction(1) .build()); BulkPricingPackage bulkPricingPackage2 = @@ -263,6 +266,7 @@ public class CheckBulkComplianceActionTest { .setAllowedTlds(ImmutableSet.of("foo")) .setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar")) .setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .setDiscountFraction(1) .build()); BulkPricingPackage packagePromotion2 = @@ -337,6 +341,7 @@ public class CheckBulkComplianceActionTest { .setAllowedTlds(ImmutableSet.of("foo")) .setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar")) .setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .setDiscountFraction(1) .build()); BulkPricingPackage bulkPricingPackage2 = @@ -402,6 +407,7 @@ public class CheckBulkComplianceActionTest { .setAllowedTlds(ImmutableSet.of("foo")) .setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar")) .setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .setDiscountFraction(1) .build()); BulkPricingPackage bulkPricingPackage2 = diff --git a/core/src/test/java/google/registry/flows/domain/DomainCreateFlowTest.java b/core/src/test/java/google/registry/flows/domain/DomainCreateFlowTest.java index 97dc74469..035f04190 100644 --- a/core/src/test/java/google/registry/flows/domain/DomainCreateFlowTest.java +++ b/core/src/test/java/google/registry/flows/domain/DomainCreateFlowTest.java @@ -158,6 +158,7 @@ import google.registry.model.domain.DomainHistory; import google.registry.model.domain.GracePeriod; import google.registry.model.domain.fee.BaseFee.FeeType; import google.registry.model.domain.fee.Fee; +import google.registry.model.domain.fee.FeeQueryCommandExtensionItem.CommandName; import google.registry.model.domain.launch.LaunchNotice; import google.registry.model.domain.rgp.GracePeriodStatus; import google.registry.model.domain.secdns.DomainDsData; @@ -3681,6 +3682,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase { .setAllowedTlds(ImmutableSet.of("foo")) .setAllowedRegistrarIds(ImmutableSet.of("NewRegistrar")) .setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .setDiscountFraction(1) .build()); domain = domain.asBuilder().setCurrentBulkToken(token.createVKey()).build(); @@ -1116,6 +1118,7 @@ class DomainInfoFlowTest extends ResourceFlowTestCase { .setAllowedTlds(ImmutableSet.of("foo")) .setAllowedRegistrarIds(ImmutableSet.of("NewRegistrar")) .setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .setDiscountFraction(1) .build()); domain = domain.asBuilder().setCurrentBulkToken(token.createVKey()).build(); @@ -1148,6 +1151,7 @@ class DomainInfoFlowTest extends ResourceFlowTestCase { .setAllowedTlds(ImmutableSet.of("foo")) .setAllowedRegistrarIds(ImmutableSet.of("NewRegistrar")) .setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .setDiscountFraction(1) .build()); domain = domain.asBuilder().setCurrentBulkToken(token.createVKey()).build(); diff --git a/core/src/test/java/google/registry/flows/domain/DomainRenewFlowTest.java b/core/src/test/java/google/registry/flows/domain/DomainRenewFlowTest.java index 33902c7a6..ea76dc675 100644 --- a/core/src/test/java/google/registry/flows/domain/DomainRenewFlowTest.java +++ b/core/src/test/java/google/registry/flows/domain/DomainRenewFlowTest.java @@ -1258,14 +1258,22 @@ class DomainRenewFlowTest extends ResourceFlowTestCase .setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar")) .setAllowedTlds(ImmutableSet.of("tld")) .setRenewalPriceBehavior(SPECIFIED) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .build()); persistDomain(); persistResource( reloadResourceByForeignKey().asBuilder().setCurrentBulkToken(token.createVKey()).build()); + persistResource( + new AllocationToken.Builder() + .setToken("token") + .setTokenType(SINGLE_USE) + .setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar")) + .build()); + setEppInput( "domain_renew_allocationtoken.xml", - ImmutableMap.of("DOMAIN", "example.tld", "YEARS", "2", "TOKEN", "abc123")); + ImmutableMap.of("DOMAIN", "example.tld", "YEARS", "2", "TOKEN", "token")); EppException thrown = assertThrows(MissingRemoveDomainTokenOnBulkPricingDomainException.class, this::runFlow); @@ -1282,6 +1290,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase .setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar")) .setAllowedTlds(ImmutableSet.of("tld")) .setRenewalPriceBehavior(SPECIFIED) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .build()); persistDomain(); persistResource( @@ -1317,6 +1326,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase .setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar")) .setAllowedTlds(ImmutableSet.of("tld")) .setRenewalPriceBehavior(SPECIFIED) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .build()); persistDomain(SPECIFIED, Money.of(USD, 2)); persistResource( @@ -1346,6 +1356,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase .setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar")) .setAllowedTlds(ImmutableSet.of("tld")) .setRenewalPriceBehavior(SPECIFIED) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .build()); persistDomain(SPECIFIED, Money.of(USD, 2)); persistResource( diff --git a/core/src/test/java/google/registry/flows/domain/DomainTransferApproveFlowTest.java b/core/src/test/java/google/registry/flows/domain/DomainTransferApproveFlowTest.java index 36c350253..59a6b359b 100644 --- a/core/src/test/java/google/registry/flows/domain/DomainTransferApproveFlowTest.java +++ b/core/src/test/java/google/registry/flows/domain/DomainTransferApproveFlowTest.java @@ -73,6 +73,7 @@ import google.registry.model.domain.DomainHistory; import google.registry.model.domain.GracePeriod; import google.registry.model.domain.Period; import google.registry.model.domain.Period.Unit; +import google.registry.model.domain.fee.FeeQueryCommandExtensionItem.CommandName; import google.registry.model.domain.rgp.GracePeriodStatus; import google.registry.model.domain.token.AllocationToken; import google.registry.model.domain.token.AllocationToken.TokenStatus; @@ -390,6 +391,7 @@ class DomainTransferApproveFlowTest .setTokenType(BULK_PRICING) .setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED) .setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar")) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .build()); domain = reloadResourceByForeignKey(); persistResource( @@ -417,6 +419,7 @@ class DomainTransferApproveFlowTest .setToken("abc123") .setTokenType(BULK_PRICING) .setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar")) .build()); domain = reloadResourceByForeignKey(); diff --git a/core/src/test/java/google/registry/flows/domain/DomainTransferRequestFlowTest.java b/core/src/test/java/google/registry/flows/domain/DomainTransferRequestFlowTest.java index 8b3d435ea..3610a0d44 100644 --- a/core/src/test/java/google/registry/flows/domain/DomainTransferRequestFlowTest.java +++ b/core/src/test/java/google/registry/flows/domain/DomainTransferRequestFlowTest.java @@ -105,6 +105,7 @@ import google.registry.model.domain.DomainHistory; import google.registry.model.domain.GracePeriod; import google.registry.model.domain.Period; import google.registry.model.domain.Period.Unit; +import google.registry.model.domain.fee.FeeQueryCommandExtensionItem.CommandName; import google.registry.model.domain.rgp.GracePeriodStatus; import google.registry.model.domain.token.AllocationToken; import google.registry.model.domain.token.AllocationToken.TokenStatus; @@ -1345,6 +1346,7 @@ class DomainTransferRequestFlowTest .setToken("abc123") .setTokenType(BULK_PRICING) .setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar")) .build()); domain = @@ -1403,6 +1405,7 @@ class DomainTransferRequestFlowTest .setToken("abc123") .setTokenType(BULK_PRICING) .setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar")) .build()); domain = @@ -1460,6 +1463,7 @@ class DomainTransferRequestFlowTest .setToken("abc123") .setTokenType(BULK_PRICING) .setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar")) .build()); domain = diff --git a/core/src/test/java/google/registry/model/domain/DomainSqlTest.java b/core/src/test/java/google/registry/model/domain/DomainSqlTest.java index b73a565ad..fac773cec 100644 --- a/core/src/test/java/google/registry/model/domain/DomainSqlTest.java +++ b/core/src/test/java/google/registry/model/domain/DomainSqlTest.java @@ -37,6 +37,7 @@ import com.google.common.collect.Sets; import google.registry.model.billing.BillingBase.RenewalPriceBehavior; import google.registry.model.contact.Contact; import google.registry.model.domain.DesignatedContact.Type; +import google.registry.model.domain.fee.FeeQueryCommandExtensionItem.CommandName; import google.registry.model.domain.launch.LaunchNotice; import google.registry.model.domain.rgp.GracePeriodStatus; import google.registry.model.domain.secdns.DomainDsData; @@ -136,6 +137,7 @@ public class DomainSqlTest { .setAllowedTlds(ImmutableSet.of("dev", "app")) .setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar")) .setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .setTokenStatusTransitions( ImmutableSortedMap.naturalOrder() .put(START_OF_TIME, NOT_STARTED) diff --git a/core/src/test/java/google/registry/model/domain/DomainTest.java b/core/src/test/java/google/registry/model/domain/DomainTest.java index 6cf9033a7..6bcf3ecfa 100644 --- a/core/src/test/java/google/registry/model/domain/DomainTest.java +++ b/core/src/test/java/google/registry/model/domain/DomainTest.java @@ -52,6 +52,7 @@ import google.registry.model.billing.BillingEvent; import google.registry.model.billing.BillingRecurrence; import google.registry.model.contact.Contact; import google.registry.model.domain.DesignatedContact.Type; +import google.registry.model.domain.fee.FeeQueryCommandExtensionItem.CommandName; import google.registry.model.domain.launch.LaunchNotice; import google.registry.model.domain.rgp.GracePeriodStatus; import google.registry.model.domain.secdns.DomainDsData; @@ -833,6 +834,7 @@ public class DomainTest { .setToken("abc123") .setTokenType(BULK_PRICING) .setRenewalPriceBehavior(SPECIFIED) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar")) .build()); domain = @@ -894,6 +896,7 @@ public class DomainTest { .setToken("abc123") .setTokenType(BULK_PRICING) .setRenewalPriceBehavior(SPECIFIED) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar")) .build()); domain = @@ -1063,6 +1066,7 @@ public class DomainTest { .setToken("abc123") .setTokenType(BULK_PRICING) .setRenewalPriceBehavior(SPECIFIED) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar")) .build(); IllegalArgumentException thrown = @@ -1080,6 +1084,7 @@ public class DomainTest { .setToken("abc123") .setTokenType(BULK_PRICING) .setRenewalPriceBehavior(SPECIFIED) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar")) .build()); domain = domain.asBuilder().setCurrentBulkToken(allocationToken.createVKey()).build(); diff --git a/core/src/test/java/google/registry/model/domain/token/AllocationTokenTest.java b/core/src/test/java/google/registry/model/domain/token/AllocationTokenTest.java index 02b4aad11..15ea3ee3c 100644 --- a/core/src/test/java/google/registry/model/domain/token/AllocationTokenTest.java +++ b/core/src/test/java/google/registry/model/domain/token/AllocationTokenTest.java @@ -223,6 +223,7 @@ public class AllocationTokenTest extends EntityTestCase { new AllocationToken.Builder() .setToken("abc123") .setTokenType(TokenType.BULK_PRICING) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .setRenewalPriceBehavior(RenewalPriceBehavior.DEFAULT); IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, builder::build); assertThat(thrown) @@ -230,12 +231,40 @@ public class AllocationTokenTest extends EntityTestCase { .isEqualTo("Bulk tokens must have renewalPriceBehavior set to SPECIFIED"); } + @Test + void testFail_bulkTokenMultipleEppActions() { + AllocationToken.Builder builder = + new AllocationToken.Builder() + .setToken("abc123") + .setTokenType(TokenType.BULK_PRICING) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE, CommandName.RESTORE)) + .setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED); + IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, builder::build); + assertThat(thrown) + .hasMessageThat() + .isEqualTo("Bulk tokens may only be valid for CREATE actions"); + } + + @Test + void testFail_bulkTokenNullEppActions() { + AllocationToken.Builder builder = + new AllocationToken.Builder() + .setToken("abc123") + .setTokenType(TokenType.BULK_PRICING) + .setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED); + IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, builder::build); + assertThat(thrown) + .hasMessageThat() + .isEqualTo("Bulk tokens may only be valid for CREATE actions"); + } + @Test void testFail_bulkTokenDiscountPremium() { AllocationToken.Builder builder = new AllocationToken.Builder() .setToken("abc123") .setTokenType(TokenType.BULK_PRICING) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED) .setDiscountPremiums(true); IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, builder::build); @@ -297,6 +326,7 @@ public class AllocationTokenTest extends EntityTestCase { new AllocationToken.Builder() .setToken("foobar") .setTokenType(BULK_PRICING) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED) .setAllowedRegistrarIds(ImmutableSet.of("foo", "bar")); IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, builder::build); diff --git a/core/src/test/java/google/registry/model/domain/token/BulkPricingPackageTest.java b/core/src/test/java/google/registry/model/domain/token/BulkPricingPackageTest.java index f8208d74d..d733b1fe4 100644 --- a/core/src/test/java/google/registry/model/domain/token/BulkPricingPackageTest.java +++ b/core/src/test/java/google/registry/model/domain/token/BulkPricingPackageTest.java @@ -23,6 +23,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import google.registry.model.EntityTestCase; import google.registry.model.billing.BillingBase.RenewalPriceBehavior; +import google.registry.model.domain.fee.FeeQueryCommandExtensionItem.CommandName; import google.registry.model.domain.token.AllocationToken.TokenType; import org.joda.money.CurrencyUnit; import org.joda.money.Money; @@ -54,6 +55,7 @@ public class BulkPricingPackageTest extends EntityTestCase { .setAllowedTlds(ImmutableSet.of("foo")) .setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar")) .setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .setDiscountFraction(1) .build()); diff --git a/core/src/test/java/google/registry/tools/CreateBulkPricingPackageCommandTest.java b/core/src/test/java/google/registry/tools/CreateBulkPricingPackageCommandTest.java index fc7ef238d..ac017b46b 100644 --- a/core/src/test/java/google/registry/tools/CreateBulkPricingPackageCommandTest.java +++ b/core/src/test/java/google/registry/tools/CreateBulkPricingPackageCommandTest.java @@ -22,6 +22,7 @@ import static google.registry.util.DateTimeUtils.END_OF_TIME; import static org.junit.jupiter.api.Assertions.assertThrows; import google.registry.model.billing.BillingBase.RenewalPriceBehavior; +import google.registry.model.domain.fee.FeeQueryCommandExtensionItem.CommandName; import google.registry.model.domain.token.AllocationToken; import google.registry.model.domain.token.AllocationToken.TokenType; import google.registry.model.domain.token.BulkPricingPackage; @@ -46,6 +47,7 @@ public class CreateBulkPricingPackageCommandTest .setAllowedTlds(ImmutableSet.of("foo")) .setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar")) .setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .setDiscountFraction(1) .build()); runCommandForced( @@ -121,6 +123,7 @@ public class CreateBulkPricingPackageCommandTest .setAllowedTlds(ImmutableSet.of("foo")) .setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar")) .setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .setDiscountFraction(1) .build()); runCommandForced( @@ -156,6 +159,7 @@ public class CreateBulkPricingPackageCommandTest .setAllowedTlds(ImmutableSet.of("foo")) .setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar")) .setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .setDiscountFraction(1) .build()); runCommandForced("--price=USD 1000.00", "--next_billing_date=2012-03-17", "abc123"); @@ -181,6 +185,7 @@ public class CreateBulkPricingPackageCommandTest .setAllowedTlds(ImmutableSet.of("foo")) .setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar")) .setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .setDiscountFraction(1) .build()); runCommandForced("--max_domains=100", "--max_creates=500", "--price=USD 1000.00", "abc123"); @@ -206,6 +211,7 @@ public class CreateBulkPricingPackageCommandTest .setAllowedTlds(ImmutableSet.of("foo")) .setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar")) .setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .setDiscountFraction(1) .build()); IllegalArgumentException thrown = diff --git a/core/src/test/java/google/registry/tools/GetBulkPricingPackageCommandTest.java b/core/src/test/java/google/registry/tools/GetBulkPricingPackageCommandTest.java index fbbd43c29..95d7b7a4b 100644 --- a/core/src/test/java/google/registry/tools/GetBulkPricingPackageCommandTest.java +++ b/core/src/test/java/google/registry/tools/GetBulkPricingPackageCommandTest.java @@ -22,6 +22,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import com.beust.jcommander.ParameterException; import com.google.common.collect.ImmutableSet; import google.registry.model.billing.BillingBase.RenewalPriceBehavior; +import google.registry.model.domain.fee.FeeQueryCommandExtensionItem.CommandName; import google.registry.model.domain.token.AllocationToken; import google.registry.model.domain.token.AllocationToken.TokenType; import google.registry.model.domain.token.BulkPricingPackage; @@ -51,6 +52,7 @@ public class GetBulkPricingPackageCommandTest .setAllowedTlds(ImmutableSet.of("foo")) .setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar")) .setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .setDiscountFraction(1) .build()); BulkPricingPackage bulkPricingPackage = @@ -77,6 +79,7 @@ public class GetBulkPricingPackageCommandTest .setAllowedTlds(ImmutableSet.of("foo")) .setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar")) .setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .setDiscountFraction(1) .build()); tm().transact( @@ -99,6 +102,7 @@ public class GetBulkPricingPackageCommandTest .setAllowedTlds(ImmutableSet.of("foo")) .setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar")) .setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .setDiscountFraction(1) .build()); tm().transact( diff --git a/core/src/test/java/google/registry/tools/UpdateAllocationTokensCommandTest.java b/core/src/test/java/google/registry/tools/UpdateAllocationTokensCommandTest.java index 285a43c97..148a268fd 100644 --- a/core/src/test/java/google/registry/tools/UpdateAllocationTokensCommandTest.java +++ b/core/src/test/java/google/registry/tools/UpdateAllocationTokensCommandTest.java @@ -352,6 +352,7 @@ class UpdateAllocationTokensCommandTest extends CommandTestCasenaturalOrder() @@ -379,6 +380,7 @@ class UpdateAllocationTokensCommandTest extends CommandTestCasenaturalOrder() diff --git a/core/src/test/java/google/registry/tools/UpdateBulkPricingPackageCommandTest.java b/core/src/test/java/google/registry/tools/UpdateBulkPricingPackageCommandTest.java index 36e692b98..c9337d33c 100644 --- a/core/src/test/java/google/registry/tools/UpdateBulkPricingPackageCommandTest.java +++ b/core/src/test/java/google/registry/tools/UpdateBulkPricingPackageCommandTest.java @@ -21,6 +21,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import com.google.common.truth.Truth; import google.registry.model.billing.BillingBase.RenewalPriceBehavior; +import google.registry.model.domain.fee.FeeQueryCommandExtensionItem.CommandName; import google.registry.model.domain.token.AllocationToken; import google.registry.model.domain.token.AllocationToken.TokenType; import google.registry.model.domain.token.BulkPricingPackage; @@ -47,6 +48,7 @@ public class UpdateBulkPricingPackageCommandTest .setAllowedTlds(ImmutableSet.of("foo")) .setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar")) .setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .setDiscountFraction(1) .build()); BulkPricingPackage bulkPricingPackage = @@ -93,6 +95,7 @@ public class UpdateBulkPricingPackageCommandTest .setAllowedTlds(ImmutableSet.of("foo")) .setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar")) .setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED) + .setAllowedEppActions(ImmutableSet.of(CommandName.CREATE)) .setDiscountFraction(1) .build()); IllegalArgumentException thrown =