mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 08:27:14 +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)
|
required = true)
|
||||||
private String domainName;
|
private String domainName;
|
||||||
|
|
||||||
|
@Parameter(
|
||||||
|
names = {"--immediately"},
|
||||||
|
description = "Whether to bypass grace periods and delete the domain immediately.")
|
||||||
|
private boolean immediately = false;
|
||||||
|
|
||||||
@Parameter(
|
@Parameter(
|
||||||
names = {"--reason"},
|
names = {"--reason"},
|
||||||
description = "Reason for the change.",
|
description = "Reason for the change.",
|
||||||
|
@ -43,15 +48,19 @@ final class DeleteDomainCommand extends MutatingEppToolCommand {
|
||||||
|
|
||||||
@Parameter(
|
@Parameter(
|
||||||
names = {"--registrar_request"},
|
names = {"--registrar_request"},
|
||||||
description = "Whether the change was requested by a registrar.",
|
description = "Whether the change was requested by a registrar.")
|
||||||
arity = 1)
|
|
||||||
private boolean requestedByRegistrar = false;
|
private boolean requestedByRegistrar = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initMutatingEppToolCommand() {
|
protected void initMutatingEppToolCommand() {
|
||||||
|
if (immediately) {
|
||||||
|
// Immediate deletion is accomplished using the superuser extension.
|
||||||
|
superuser = true;
|
||||||
|
}
|
||||||
setSoyTemplate(DeleteDomainSoyInfo.getInstance(), DeleteDomainSoyInfo.DELETEDOMAIN);
|
setSoyTemplate(DeleteDomainSoyInfo.getInstance(), DeleteDomainSoyInfo.DELETEDOMAIN);
|
||||||
addSoyRecord(clientId, new SoyMapData(
|
addSoyRecord(clientId, new SoyMapData(
|
||||||
"domainName", domainName,
|
"domainName", domainName,
|
||||||
|
"immediately", immediately,
|
||||||
"reason", reason,
|
"reason", reason,
|
||||||
"requestedByRegistrar", requestedByRegistrar));
|
"requestedByRegistrar", requestedByRegistrar));
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
*/
|
*/
|
||||||
{template .deletedomain stricthtml="false"}
|
{template .deletedomain stricthtml="false"}
|
||||||
{@param domainName: string}
|
{@param domainName: string}
|
||||||
|
{@param immediately: bool}
|
||||||
{@param reason: string}
|
{@param reason: string}
|
||||||
{@param requestedByRegistrar: any}
|
{@param requestedByRegistrar: any}
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
@ -35,6 +36,12 @@
|
||||||
<metadata:reason>Deleted by registry administrator: {$reason}</metadata:reason>
|
<metadata:reason>Deleted by registry administrator: {$reason}</metadata:reason>
|
||||||
<metadata:requestedByRegistrar>{$requestedByRegistrar}</metadata:requestedByRegistrar>
|
<metadata:requestedByRegistrar>{$requestedByRegistrar}</metadata:requestedByRegistrar>
|
||||||
</metadata:metadata>
|
</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>
|
</extension>
|
||||||
<clTRID>RegistryTool</clTRID>
|
<clTRID>RegistryTool</clTRID>
|
||||||
</command>
|
</command>
|
||||||
|
|
|
@ -30,30 +30,31 @@ public class DeleteDomainCommandTest extends EppToolCommandTestCase<DeleteDomain
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_multipleWordReason() throws Exception {
|
public void testSuccess_multipleWordReason() throws Exception {
|
||||||
runCommand(
|
runCommandForced(
|
||||||
"--client=NewRegistrar", "--domain_name=example.tld", "--force", "--reason=\"Test test\"");
|
"--client=NewRegistrar", "--domain_name=example.tld", "--reason=\"Test test\"");
|
||||||
eppVerifier.verifySent("domain_delete_multiple_word_reason.xml");
|
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
|
@Test
|
||||||
public void testSuccess_requestedByRegistrarFalse() throws Exception {
|
public void testSuccess_requestedByRegistrarFalse() throws Exception {
|
||||||
runCommand(
|
runCommandForced("--client=NewRegistrar", "--domain_name=example.tld", "--reason=Test");
|
||||||
"--client=NewRegistrar",
|
|
||||||
"--domain_name=example.tld",
|
|
||||||
"--force",
|
|
||||||
"--reason=Test",
|
|
||||||
"--registrar_request=false");
|
|
||||||
eppVerifier.verifySent("domain_delete.xml");
|
eppVerifier.verifySent("domain_delete.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_requestedByRegistrarTrue() throws Exception {
|
public void testSuccess_requestedByRegistrarTrue() throws Exception {
|
||||||
runCommand(
|
runCommandForced(
|
||||||
"--client=NewRegistrar",
|
"--client=NewRegistrar",
|
||||||
"--domain_name=example.tld",
|
"--domain_name=example.tld",
|
||||||
"--force",
|
|
||||||
"--reason=Test",
|
"--reason=Test",
|
||||||
"--registrar_request=true");
|
"--registrar_request");
|
||||||
eppVerifier.verifySent("domain_delete_by_registrar.xml");
|
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