mirror of
https://github.com/google/nomulus.git
synced 2025-08-05 17:28:25 +02:00
Add premium support to nomulus create_domain command
Premium prices are automatically detected and set, with an informational message displayed to the user prior to executing the command. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=199223541
This commit is contained in:
parent
61f6e666b1
commit
7c0b8cab0b
8 changed files with 165 additions and 18 deletions
|
@ -15,6 +15,7 @@
|
|||
package google.registry.tools;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
|
||||
import com.beust.jcommander.ParameterException;
|
||||
|
@ -60,6 +61,7 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomain
|
|||
|
||||
@Test
|
||||
public void testSuccess_multipleDomains() throws Exception {
|
||||
createTld("abc");
|
||||
runCommandForced(
|
||||
"--client=NewRegistrar",
|
||||
"--registrant=crr-admin",
|
||||
|
@ -72,6 +74,43 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomain
|
|||
.verifySent("domain_create_minimal_abc.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_premiumDomain() throws Exception {
|
||||
runCommandForced(
|
||||
"--client=NewRegistrar",
|
||||
"--registrant=crr-admin",
|
||||
"--admins=crr-admin",
|
||||
"--techs=crr-tech",
|
||||
"--period=3",
|
||||
"--force_premiums",
|
||||
"parajiumu.tld");
|
||||
eppVerifier.verifySent("domain_create_parajiumu_3yrs.xml");
|
||||
assertInStdout(
|
||||
"parajiumu.tld is premium at JPY 96083 per year; "
|
||||
+ "sending total cost for 3 year(s) of JPY 288249.");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_multipleDomainsWithPremium() throws Exception {
|
||||
createTld("abc");
|
||||
runCommandForced(
|
||||
"--client=NewRegistrar",
|
||||
"--registrant=crr-admin",
|
||||
"--admins=crr-admin",
|
||||
"--techs=crr-tech",
|
||||
"--force_premiums",
|
||||
"example.tld",
|
||||
"palladium.tld",
|
||||
"example.abc");
|
||||
eppVerifier
|
||||
.verifySent("domain_create_minimal.xml")
|
||||
.verifySent("domain_create_palladium.xml")
|
||||
.verifySent("domain_create_minimal_abc.xml");
|
||||
assertInStdout(
|
||||
"palladium.tld is premium at USD 877.00 per year; "
|
||||
+ "sending total cost for 1 year(s) of USD 877.00.");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_duplicateDomains() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
|
@ -288,4 +327,21 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomain
|
|||
"example.tld"));
|
||||
assertThat(thrown).hasMessageThat().contains("length 5");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_cantForceCreatePremiumDomain_withoutForcePremiums() {
|
||||
IllegalArgumentException thrown =
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
"--client=NewRegistrar",
|
||||
"--registrant=crr-admin",
|
||||
"--admins=crr-admin",
|
||||
"--techs=crr-tech",
|
||||
"gold.tld"));
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.isEqualTo("Forced creates on premium domain(s) require --force_premiums");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<domain:create
|
||||
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||
<domain:name>example.tld</domain:name>
|
||||
<domain:period unit="y">1</domain:period>
|
||||
<domain:registrant>crr-admin</domain:registrant>
|
||||
<domain:contact type="admin">crr-admin</domain:contact>
|
||||
<domain:contact type="tech">crr-tech</domain:contact>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<domain:create
|
||||
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||
<domain:name>example.abc</domain:name>
|
||||
<domain:period unit="y">1</domain:period>
|
||||
<domain:registrant>crr-admin</domain:registrant>
|
||||
<domain:contact type="admin">crr-admin</domain:contact>
|
||||
<domain:contact type="tech">crr-tech</domain:contact>
|
||||
|
|
25
javatests/google/registry/tools/server/testdata/domain_create_palladium.xml
vendored
Normal file
25
javatests/google/registry/tools/server/testdata/domain_create_palladium.xml
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||
<command>
|
||||
<create>
|
||||
<domain:create
|
||||
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||
<domain:name>palladium.tld</domain:name>
|
||||
<domain:period unit="y">1</domain:period>
|
||||
<domain:registrant>crr-admin</domain:registrant>
|
||||
<domain:contact type="admin">crr-admin</domain:contact>
|
||||
<domain:contact type="tech">crr-tech</domain:contact>
|
||||
<domain:authInfo>
|
||||
<domain:pw>abcdefghijklmnop</domain:pw>
|
||||
</domain:authInfo>
|
||||
</domain:create>
|
||||
</create>
|
||||
<extension>
|
||||
<fee:create xmlns:fee="urn:ietf:params:xml:ns:fee-0.12">
|
||||
<fee:currency>USD</fee:currency>
|
||||
<fee:fee>877.00</fee:fee>
|
||||
</fee:create>
|
||||
</extension>
|
||||
<clTRID>RegistryTool</clTRID>
|
||||
</command>
|
||||
</epp>
|
25
javatests/google/registry/tools/server/testdata/domain_create_parajiumu_3yrs.xml
vendored
Normal file
25
javatests/google/registry/tools/server/testdata/domain_create_parajiumu_3yrs.xml
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||
<command>
|
||||
<create>
|
||||
<domain:create
|
||||
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||
<domain:name>parajiumu.tld</domain:name>
|
||||
<domain:period unit="y">3</domain:period>
|
||||
<domain:registrant>crr-admin</domain:registrant>
|
||||
<domain:contact type="admin">crr-admin</domain:contact>
|
||||
<domain:contact type="tech">crr-tech</domain:contact>
|
||||
<domain:authInfo>
|
||||
<domain:pw>abcdefghijklmnop</domain:pw>
|
||||
</domain:authInfo>
|
||||
</domain:create>
|
||||
</create>
|
||||
<extension>
|
||||
<fee:create xmlns:fee="urn:ietf:params:xml:ns:fee-0.12">
|
||||
<fee:currency>JPY</fee:currency>
|
||||
<fee:fee>288249</fee:fee>
|
||||
</fee:create>
|
||||
</extension>
|
||||
<clTRID>RegistryTool</clTRID>
|
||||
</command>
|
||||
</epp>
|
Loading…
Add table
Add a link
Reference in a new issue