mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 00:17:20 +02:00
Add flag to delete domain immediately in nomulus too
We've already had the need to do this on a few occasions, so it's best to make it easy rather than requiring hand-generated XML all the time. Also normalizes the boolean --registrar_request parameter to not have arity=1. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=198093829
This commit is contained in:
parent
373b4feeb1
commit
674a914afc
4 changed files with 51 additions and 13 deletions
|
@ -35,6 +35,11 @@ final class DeleteDomainCommand extends MutatingEppToolCommand {
|
|||
required = true)
|
||||
private String domainName;
|
||||
|
||||
@Parameter(
|
||||
names = {"--immediately"},
|
||||
description = "Whether to bypass grace periods and delete the domain immediately.")
|
||||
private boolean immediately = false;
|
||||
|
||||
@Parameter(
|
||||
names = {"--reason"},
|
||||
description = "Reason for the change.",
|
||||
|
@ -43,15 +48,19 @@ final class DeleteDomainCommand extends MutatingEppToolCommand {
|
|||
|
||||
@Parameter(
|
||||
names = {"--registrar_request"},
|
||||
description = "Whether the change was requested by a registrar.",
|
||||
arity = 1)
|
||||
description = "Whether the change was requested by a registrar.")
|
||||
private boolean requestedByRegistrar = false;
|
||||
|
||||
@Override
|
||||
protected void initMutatingEppToolCommand() {
|
||||
if (immediately) {
|
||||
// Immediate deletion is accomplished using the superuser extension.
|
||||
superuser = true;
|
||||
}
|
||||
setSoyTemplate(DeleteDomainSoyInfo.getInstance(), DeleteDomainSoyInfo.DELETEDOMAIN);
|
||||
addSoyRecord(clientId, new SoyMapData(
|
||||
"domainName", domainName,
|
||||
"immediately", immediately,
|
||||
"reason", reason,
|
||||
"requestedByRegistrar", requestedByRegistrar));
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
*/
|
||||
{template .deletedomain stricthtml="false"}
|
||||
{@param domainName: string}
|
||||
{@param immediately: bool}
|
||||
{@param reason: string}
|
||||
{@param requestedByRegistrar: any}
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
|
@ -35,6 +36,12 @@
|
|||
<metadata:reason>Deleted by registry administrator: {$reason}</metadata:reason>
|
||||
<metadata:requestedByRegistrar>{$requestedByRegistrar}</metadata:requestedByRegistrar>
|
||||
</metadata:metadata>
|
||||
{if $immediately}
|
||||
<superuser:domainDelete xmlns:superuser="urn:google:params:xml:ns:superuser-1.0">
|
||||
<superuser:redemptionGracePeriodDays>0</superuser:redemptionGracePeriodDays>
|
||||
<superuser:pendingDeleteDays>0</superuser:pendingDeleteDays>
|
||||
</superuser:domainDelete>
|
||||
{/if}
|
||||
</extension>
|
||||
<clTRID>RegistryTool</clTRID>
|
||||
</command>
|
||||
|
|
|
@ -30,30 +30,31 @@ public class DeleteDomainCommandTest extends EppToolCommandTestCase<DeleteDomain
|
|||
|
||||
@Test
|
||||
public void testSuccess_multipleWordReason() throws Exception {
|
||||
runCommand(
|
||||
"--client=NewRegistrar", "--domain_name=example.tld", "--force", "--reason=\"Test test\"");
|
||||
runCommandForced(
|
||||
"--client=NewRegistrar", "--domain_name=example.tld", "--reason=\"Test test\"");
|
||||
eppVerifier.verifySent("domain_delete_multiple_word_reason.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_immediately() throws Exception {
|
||||
runCommandForced(
|
||||
"--client=NewRegistrar", "--domain_name=example.tld", "--immediately", "--reason=Test");
|
||||
eppVerifier.expectSuperuser().verifySent("domain_delete_immediately.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_requestedByRegistrarFalse() throws Exception {
|
||||
runCommand(
|
||||
"--client=NewRegistrar",
|
||||
"--domain_name=example.tld",
|
||||
"--force",
|
||||
"--reason=Test",
|
||||
"--registrar_request=false");
|
||||
runCommandForced("--client=NewRegistrar", "--domain_name=example.tld", "--reason=Test");
|
||||
eppVerifier.verifySent("domain_delete.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_requestedByRegistrarTrue() throws Exception {
|
||||
runCommand(
|
||||
runCommandForced(
|
||||
"--client=NewRegistrar",
|
||||
"--domain_name=example.tld",
|
||||
"--force",
|
||||
"--reason=Test",
|
||||
"--registrar_request=true");
|
||||
"--registrar_request");
|
||||
eppVerifier.verifySent("domain_delete_by_registrar.xml");
|
||||
}
|
||||
|
||||
|
|
21
javatests/google/registry/tools/server/testdata/domain_delete_immediately.xml
vendored
Normal file
21
javatests/google/registry/tools/server/testdata/domain_delete_immediately.xml
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||
<command>
|
||||
<delete>
|
||||
<domain:delete
|
||||
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||
<domain:name>example.tld</domain:name>
|
||||
</domain:delete>
|
||||
</delete>
|
||||
<extension>
|
||||
<metadata:metadata xmlns:metadata="urn:google:params:xml:ns:metadata-1.0">
|
||||
<metadata:reason>Deleted by registry administrator: Test</metadata:reason>
|
||||
<metadata:requestedByRegistrar>false</metadata:requestedByRegistrar>
|
||||
</metadata:metadata>
|
||||
<superuser:domainDelete xmlns:superuser="urn:google:params:xml:ns:superuser-1.0">
|
||||
<superuser:redemptionGracePeriodDays>0</superuser:redemptionGracePeriodDays>
|
||||
<superuser:pendingDeleteDays>0</superuser:pendingDeleteDays>
|
||||
</superuser:domainDelete>
|
||||
</extension>
|
||||
<clTRID>RegistryTool</clTRID>
|
||||
</command>
|
||||
</epp>
|
Loading…
Add table
Add a link
Reference in a new issue