mirror of
https://github.com/google/nomulus.git
synced 2025-05-15 00:47:11 +02:00
Allow setting DS records in create_domain and update_domain
The DS records consist of 4 values: - keyTag: unsigned short (2 bytes) - alg: unsigned byte - digestType: unsigned byte - digest: binary hex NOTE: the current CL doesn't support keyData, neither as the optional field in dsData nor as a replacement for dsData The command tool accepts DS records as a string, where the 4 values are given as one string separated by white-spaces as follows: <keyTag> <alg> <digestType> <digest> e.g. something like: 60485 5 2 D4B7D520E7BB5F0F67674A0CCEB1E3E0614B93C4F9E99B8383F6A1E4469DA50A which is how it's written in Zone files, allowing easy copy-paste from existing values. ommas is confusing when using spaces. The various "numbers" (keyTag, alg, digestType) are only checked that they are positive integers - the rest is left for the server. digest it checked to be an even-lengthed hex string. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=184583068
This commit is contained in:
parent
e5b000638b
commit
2e62ad2658
17 changed files with 565 additions and 5 deletions
|
@ -42,10 +42,12 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
|
|||
"--add_admins=crr-admin2",
|
||||
"--add_techs=crr-tech2",
|
||||
"--add_statuses=serverDeleteProhibited",
|
||||
"--add_ds_records=1 2 3 abcd,4 5 6 EF01",
|
||||
"--remove_nameservers=ns4.zdns.google",
|
||||
"--remove_admins=crr-admin1",
|
||||
"--remove_techs=crr-tech1",
|
||||
"--remove_statuses=serverHold",
|
||||
"--remove_ds_records=7 8 9 12ab,6 5 4 34CD",
|
||||
"--registrant=crr-admin",
|
||||
"--password=2fooBAR",
|
||||
"example.tld");
|
||||
|
@ -60,10 +62,12 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
|
|||
"--add_admins=crr-admin2",
|
||||
"--add_techs=crr-tech2",
|
||||
"--add_statuses=serverDeleteProhibited",
|
||||
"--add_ds_records=1 2 3 abcd,4 5 6 EF01",
|
||||
"--remove_nameservers=ns4.zdns.google",
|
||||
"--remove_admins=crr-admin1",
|
||||
"--remove_techs=crr-tech1",
|
||||
"--remove_statuses=serverHold",
|
||||
"--remove_ds_records=7 8 9 12ab,6 5 4 34CD",
|
||||
"--registrant=crr-admin",
|
||||
"--password=2fooBAR",
|
||||
"example.tld",
|
||||
|
@ -81,6 +85,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
|
|||
"--add_admins=crr-admin2",
|
||||
"--add_techs=crr-tech2",
|
||||
"--add_statuses=serverDeleteProhibited",
|
||||
"--add_ds_records=1 2 3 abcd,4 5 6 EF01",
|
||||
"example.tld");
|
||||
eppVerifier.verifySent("domain_update_add.xml");
|
||||
}
|
||||
|
@ -93,6 +98,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
|
|||
"--remove_admins=crr-admin1",
|
||||
"--remove_techs=crr-tech1",
|
||||
"--remove_statuses=serverHold",
|
||||
"--remove_ds_records=7 8 9 12ab,6 5 4 34CD",
|
||||
"example.tld");
|
||||
eppVerifier.verifySent("domain_update_remove.xml");
|
||||
}
|
||||
|
@ -165,6 +171,32 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
|
|||
eppVerifier.verifySent("domain_update_set_statuses.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_setDsRecords() throws Exception {
|
||||
runCommandForced(
|
||||
"--client=NewRegistrar", "--ds_records=1 2 3 abcd,4 5 6 EF01", "example.tld");
|
||||
eppVerifier.verifySent("domain_update_set_ds_records.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_setDsRecords_withUnneededClear() throws Exception {
|
||||
runCommandForced(
|
||||
"--client=NewRegistrar",
|
||||
"--ds_records=1 2 3 abcd,4 5 6 EF01",
|
||||
"--clear_ds_records",
|
||||
"example.tld");
|
||||
eppVerifier.verifySent("domain_update_set_ds_records.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_clearDsRecords() throws Exception {
|
||||
runCommandForced(
|
||||
"--client=NewRegistrar",
|
||||
"--clear_ds_records",
|
||||
"example.tld");
|
||||
eppVerifier.verifySent("domain_update_clear_ds_records.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_cantUpdateRegistryLockedDomainEvenAsSuperuser() throws Exception {
|
||||
HostResource host = persistActiveHost("ns1.zdns.google");
|
||||
|
@ -385,4 +417,76 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
|
|||
"If you provide the statuses flag, "
|
||||
+ "you cannot use the add_statuses and remove_statuses flags.");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_provideDsRecordsAndAddDsRecords() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
"--client=NewRegistrar",
|
||||
"--add_ds_records=1 2 3 abcd",
|
||||
"--ds_records=4 5 6 EF01",
|
||||
"example.tld"));
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.contains(
|
||||
"If you provide the ds_records or clear_ds_records flags, "
|
||||
+ "you cannot use the add_ds_records and remove_ds_records flags.");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_provideDsRecordsAndRemoveDsRecords() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
"--client=NewRegistrar",
|
||||
"--remove_ds_records=7 8 9 12ab",
|
||||
"--ds_records=4 5 6 EF01",
|
||||
"example.tld"));
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.contains(
|
||||
"If you provide the ds_records or clear_ds_records flags, "
|
||||
+ "you cannot use the add_ds_records and remove_ds_records flags.");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_clearDsRecordsAndAddDsRecords() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
"--client=NewRegistrar",
|
||||
"--add_ds_records=1 2 3 abcd",
|
||||
"--clear_ds_records",
|
||||
"example.tld"));
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.contains(
|
||||
"If you provide the ds_records or clear_ds_records flags, "
|
||||
+ "you cannot use the add_ds_records and remove_ds_records flags.");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_clearDsRecordsAndRemoveDsRecords() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
"--client=NewRegistrar",
|
||||
"--remove_ds_records=7 8 9 12ab",
|
||||
"--clear_ds_records",
|
||||
"example.tld"));
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.contains(
|
||||
"If you provide the ds_records or clear_ds_records flags, "
|
||||
+ "you cannot use the add_ds_records and remove_ds_records flags.");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue