mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 16:07:15 +02:00
Fix two nits in DotAppDomainInfo
1) By our convention, entity fields are package-private, not private. 2) Static analysis can't tell that checkArgumentNotNull prevents continuing with a null on the next line. Change the code to make a warning in eclipse go away. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=121944468
This commit is contained in:
parent
b60ceda055
commit
758a4ac387
10 changed files with 88 additions and 99 deletions
|
@ -37,35 +37,35 @@ public class CreateAnchorTenantCommandTest
|
||||||
public void testSuccess() throws Exception {
|
public void testSuccess() throws Exception {
|
||||||
runCommandForced("--client=NewRegistrar", "--superuser",
|
runCommandForced("--client=NewRegistrar", "--superuser",
|
||||||
"--reason=anchor-tenant-test", "--contact=jd1234", "--domain_name=example.tld");
|
"--reason=anchor-tenant-test", "--contact=jd1234", "--domain_name=example.tld");
|
||||||
verifySent("testdata/domain_create_anchor_tenant.xml", false, true);
|
eppVerifier().asSuperuser().verifySent("testdata/domain_create_anchor_tenant.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_suppliedPassword() throws Exception {
|
public void testSuccess_suppliedPassword() throws Exception {
|
||||||
runCommandForced("--client=NewRegistrar", "--superuser", "--password=foo",
|
runCommandForced("--client=NewRegistrar", "--superuser", "--password=foo",
|
||||||
"--reason=anchor-tenant-test", "--contact=jd1234", "--domain_name=example.tld");
|
"--reason=anchor-tenant-test", "--contact=jd1234", "--domain_name=example.tld");
|
||||||
verifySent("testdata/domain_create_anchor_tenant_password.xml", false, true);
|
eppVerifier().asSuperuser().verifySent("testdata/domain_create_anchor_tenant_password.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_multipleWordReason() throws Exception {
|
public void testSuccess_multipleWordReason() throws Exception {
|
||||||
runCommandForced("--client=NewRegistrar", "--superuser",
|
runCommandForced("--client=NewRegistrar", "--superuser",
|
||||||
"--reason=\"anchor tenant test\"", "--contact=jd1234", "--domain_name=example.tld");
|
"--reason=\"anchor tenant test\"", "--contact=jd1234", "--domain_name=example.tld");
|
||||||
verifySent("testdata/domain_create_anchor_tenant_multiple_word_reason.xml", false, true);
|
eppVerifier().asSuperuser().verifySent("testdata/domain_create_anchor_tenant_multiple_word_reason.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_noReason() throws Exception {
|
public void testSuccess_noReason() throws Exception {
|
||||||
runCommandForced("--client=NewRegistrar", "--superuser",
|
runCommandForced("--client=NewRegistrar", "--superuser",
|
||||||
"--contact=jd1234", "--domain_name=example.tld");
|
"--contact=jd1234", "--domain_name=example.tld");
|
||||||
verifySent("testdata/domain_create_anchor_tenant_no_reason.xml", false, true);
|
eppVerifier().asSuperuser().verifySent("testdata/domain_create_anchor_tenant_no_reason.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_feeStandard() throws Exception {
|
public void testSuccess_feeStandard() throws Exception {
|
||||||
runCommandForced("--client=NewRegistrar", "--superuser", "--fee",
|
runCommandForced("--client=NewRegistrar", "--superuser", "--fee",
|
||||||
"--reason=anchor-tenant-test", "--contact=jd1234", "--domain_name=example.tld");
|
"--reason=anchor-tenant-test", "--contact=jd1234", "--domain_name=example.tld");
|
||||||
verifySent("testdata/domain_create_anchor_tenant_fee_standard.xml", false, true);
|
eppVerifier().asSuperuser().verifySent("testdata/domain_create_anchor_tenant_fee_standard.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -78,7 +78,7 @@ public class CreateAnchorTenantCommandTest
|
||||||
.build());
|
.build());
|
||||||
runCommandForced("--client=NewRegistrar", "--superuser", "--fee",
|
runCommandForced("--client=NewRegistrar", "--superuser", "--fee",
|
||||||
"--reason=anchor-tenant-test", "--contact=jd1234", "--domain_name=premium.tld");
|
"--reason=anchor-tenant-test", "--contact=jd1234", "--domain_name=premium.tld");
|
||||||
verifySent("testdata/domain_create_anchor_tenant_fee_premium.xml", false, true);
|
eppVerifier().asSuperuser().verifySent("testdata/domain_create_anchor_tenant_fee_premium.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class CreateContactCommandTest
|
||||||
"--fax=+1.7035555556",
|
"--fax=+1.7035555556",
|
||||||
"--email=jdoe@example.com",
|
"--email=jdoe@example.com",
|
||||||
"--password=2fooBAR");
|
"--password=2fooBAR");
|
||||||
verifySent("testdata/contact_create_complete.xml", false, false);
|
eppVerifier().verifySent("testdata/contact_create_complete.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -53,7 +53,7 @@ public class CreateContactCommandTest
|
||||||
// Will never be the case, but tests that each field can be omitted.
|
// Will never be the case, but tests that each field can be omitted.
|
||||||
// Also tests the auto-gen password.
|
// Also tests the auto-gen password.
|
||||||
runCommandForced("--client=NewRegistrar");
|
runCommandForced("--client=NewRegistrar");
|
||||||
verifySent("testdata/contact_create_minimal.xml", false, false);
|
eppVerifier().verifySent("testdata/contact_create_minimal.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -25,28 +25,28 @@ public class DeleteDomainCommandTest extends EppToolCommandTestCase<DeleteDomain
|
||||||
public void testSuccess() throws Exception {
|
public void testSuccess() throws Exception {
|
||||||
runCommand("--client=NewRegistrar", "--domain_name=example.tld", "--force",
|
runCommand("--client=NewRegistrar", "--domain_name=example.tld", "--force",
|
||||||
"--reason=Test");
|
"--reason=Test");
|
||||||
verifySent("testdata/domain_delete.xml", false, false);
|
new EppVerifier().verifySent("testdata/domain_delete.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_multipleWordReason() throws Exception {
|
public void testSuccess_multipleWordReason() throws Exception {
|
||||||
runCommand("--client=NewRegistrar", "--domain_name=example.tld", "--force",
|
runCommand("--client=NewRegistrar", "--domain_name=example.tld", "--force",
|
||||||
"--reason=\"Test test\"");
|
"--reason=\"Test test\"");
|
||||||
verifySent("testdata/domain_delete_multiple_word_reason.xml", false, false);
|
new EppVerifier().verifySent("testdata/domain_delete_multiple_word_reason.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_requestedByRegistrarFalse() throws Exception {
|
public void testSuccess_requestedByRegistrarFalse() throws Exception {
|
||||||
runCommand("--client=NewRegistrar", "--domain_name=example.tld", "--force",
|
runCommand("--client=NewRegistrar", "--domain_name=example.tld", "--force",
|
||||||
"--reason=Test", "--registrar_request=false");
|
"--reason=Test", "--registrar_request=false");
|
||||||
verifySent("testdata/domain_delete.xml", false, false);
|
new EppVerifier().verifySent("testdata/domain_delete.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_requestedByRegistrarTrue() throws Exception {
|
public void testSuccess_requestedByRegistrarTrue() throws Exception {
|
||||||
runCommand("--client=NewRegistrar", "--domain_name=example.tld", "--force",
|
runCommand("--client=NewRegistrar", "--domain_name=example.tld", "--force",
|
||||||
"--reason=Test", "--registrar_request=true");
|
"--reason=Test", "--registrar_request=true");
|
||||||
verifySent("testdata/domain_delete_by_registrar.xml", false, false);
|
new EppVerifier().verifySent("testdata/domain_delete_by_registrar.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class DomainApplicationInfoCommandTest
|
||||||
public void testSuccess() throws Exception {
|
public void testSuccess() throws Exception {
|
||||||
runCommandForced("--client=NewRegistrar", "--domain_name=example.tld",
|
runCommandForced("--client=NewRegistrar", "--domain_name=example.tld",
|
||||||
"--phase=landrush", "--id=123");
|
"--phase=landrush", "--id=123");
|
||||||
verifySent("testdata/domain_info_landrush.xml", false, false);
|
eppVerifier().verifySent("testdata/domain_info_landrush.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -34,7 +34,7 @@ public class DomainApplicationInfoCommandTest
|
||||||
// Sunrush: phase=sunrise, subphase=landrush
|
// Sunrush: phase=sunrise, subphase=landrush
|
||||||
runCommandForced("--client=NewRegistrar", "--domain_name=example.tld",
|
runCommandForced("--client=NewRegistrar", "--domain_name=example.tld",
|
||||||
"--phase=sunrush", "--id=123");
|
"--phase=sunrush", "--id=123");
|
||||||
verifySent("testdata/domain_info_sunrush.xml", false, false);
|
eppVerifier().verifySent("testdata/domain_info_sunrush.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -14,8 +14,6 @@
|
||||||
|
|
||||||
package google.registry.tools;
|
package google.registry.tools;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
|
|
||||||
import com.beust.jcommander.ParameterException;
|
import com.beust.jcommander.ParameterException;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -26,18 +24,15 @@ public class DomainCheckClaimsCommandTest extends EppToolCommandTestCase<DomainC
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess() throws Exception {
|
public void testSuccess() throws Exception {
|
||||||
runCommandForced("--client=NewRegistrar", "example.tld");
|
runCommandForced("--client=NewRegistrar", "example.tld");
|
||||||
verifySent("testdata/domain_check_claims.xml", false, false);
|
eppVerifier().verifySent("testdata/domain_check_claims.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_multipleTlds() throws Exception {
|
public void testSuccess_multipleTlds() throws Exception {
|
||||||
runCommandForced("--client=NewRegistrar", "example.tld", "example.tld2");
|
runCommandForced("--client=NewRegistrar", "example.tld", "example.tld2");
|
||||||
verifySent(
|
eppVerifier().verifySent(
|
||||||
ImmutableList.of(
|
|
||||||
"testdata/domain_check_claims.xml",
|
"testdata/domain_check_claims.xml",
|
||||||
"testdata/domain_check_claims_second_tld.xml"),
|
"testdata/domain_check_claims_second_tld.xml");
|
||||||
false,
|
|
||||||
false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -47,7 +42,7 @@ public class DomainCheckClaimsCommandTest extends EppToolCommandTestCase<DomainC
|
||||||
"example.tld",
|
"example.tld",
|
||||||
"example2.tld",
|
"example2.tld",
|
||||||
"example3.tld");
|
"example3.tld");
|
||||||
verifySent("testdata/domain_check_claims_multiple.xml", false, false);
|
eppVerifier().verifySent("testdata/domain_check_claims_multiple.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -58,12 +53,9 @@ public class DomainCheckClaimsCommandTest extends EppToolCommandTestCase<DomainC
|
||||||
"example2.tld",
|
"example2.tld",
|
||||||
"example3.tld",
|
"example3.tld",
|
||||||
"example.tld2");
|
"example.tld2");
|
||||||
verifySent(
|
eppVerifier().verifySent(
|
||||||
ImmutableList.of(
|
|
||||||
"testdata/domain_check_claims_multiple.xml",
|
"testdata/domain_check_claims_multiple.xml",
|
||||||
"testdata/domain_check_claims_second_tld.xml"),
|
"testdata/domain_check_claims_second_tld.xml");
|
||||||
false,
|
|
||||||
false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -14,8 +14,6 @@
|
||||||
|
|
||||||
package google.registry.tools;
|
package google.registry.tools;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
|
|
||||||
import com.beust.jcommander.ParameterException;
|
import com.beust.jcommander.ParameterException;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -26,18 +24,15 @@ public class DomainCheckCommandTest extends EppToolCommandTestCase<DomainCheckCo
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess() throws Exception {
|
public void testSuccess() throws Exception {
|
||||||
runCommandForced("--client=NewRegistrar", "example.tld");
|
runCommandForced("--client=NewRegistrar", "example.tld");
|
||||||
verifySent("testdata/domain_check.xml", false, false);
|
eppVerifier().verifySent("testdata/domain_check.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_multipleTlds() throws Exception {
|
public void testSuccess_multipleTlds() throws Exception {
|
||||||
runCommandForced("--client=NewRegistrar", "example.tld", "example.tld2");
|
runCommandForced("--client=NewRegistrar", "example.tld", "example.tld2");
|
||||||
verifySent(
|
eppVerifier().verifySent(
|
||||||
ImmutableList.of(
|
|
||||||
"testdata/domain_check.xml",
|
"testdata/domain_check.xml",
|
||||||
"testdata/domain_check_second_tld.xml"),
|
"testdata/domain_check_second_tld.xml");
|
||||||
false,
|
|
||||||
false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -47,7 +42,7 @@ public class DomainCheckCommandTest extends EppToolCommandTestCase<DomainCheckCo
|
||||||
"example.tld",
|
"example.tld",
|
||||||
"example2.tld",
|
"example2.tld",
|
||||||
"example3.tld");
|
"example3.tld");
|
||||||
verifySent("testdata/domain_check_multiple.xml", false, false);
|
eppVerifier().verifySent("testdata/domain_check_multiple.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -58,12 +53,9 @@ public class DomainCheckCommandTest extends EppToolCommandTestCase<DomainCheckCo
|
||||||
"example2.tld",
|
"example2.tld",
|
||||||
"example3.tld",
|
"example3.tld",
|
||||||
"example.tld2");
|
"example.tld2");
|
||||||
verifySent(
|
eppVerifier().verifySent(
|
||||||
ImmutableList.of(
|
|
||||||
"testdata/domain_check_multiple.xml",
|
"testdata/domain_check_multiple.xml",
|
||||||
"testdata/domain_check_second_tld.xml"),
|
"testdata/domain_check_second_tld.xml");
|
||||||
false,
|
|
||||||
false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -14,8 +14,6 @@
|
||||||
|
|
||||||
package google.registry.tools;
|
package google.registry.tools;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
|
|
||||||
import com.beust.jcommander.ParameterException;
|
import com.beust.jcommander.ParameterException;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -26,18 +24,15 @@ public class DomainCheckFeeCommandTest extends EppToolCommandTestCase<DomainChec
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess() throws Exception {
|
public void testSuccess() throws Exception {
|
||||||
runCommandForced("--client=NewRegistrar", "example.tld");
|
runCommandForced("--client=NewRegistrar", "example.tld");
|
||||||
verifySent("testdata/domain_check_fee.xml", false, false);
|
eppVerifier().verifySent("testdata/domain_check_fee.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_multipleTlds() throws Exception {
|
public void testSuccess_multipleTlds() throws Exception {
|
||||||
runCommandForced("--client=NewRegistrar", "example.tld", "example.tld2");
|
runCommandForced("--client=NewRegistrar", "example.tld", "example.tld2");
|
||||||
verifySent(
|
eppVerifier().verifySent(
|
||||||
ImmutableList.of(
|
|
||||||
"testdata/domain_check_fee.xml",
|
"testdata/domain_check_fee.xml",
|
||||||
"testdata/domain_check_fee_second_tld.xml"),
|
"testdata/domain_check_fee_second_tld.xml");
|
||||||
false,
|
|
||||||
false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -47,7 +42,7 @@ public class DomainCheckFeeCommandTest extends EppToolCommandTestCase<DomainChec
|
||||||
"example.tld",
|
"example.tld",
|
||||||
"example2.tld",
|
"example2.tld",
|
||||||
"example3.tld");
|
"example3.tld");
|
||||||
verifySent("testdata/domain_check_fee_multiple.xml", false, false);
|
eppVerifier().verifySent("testdata/domain_check_fee_multiple.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -58,12 +53,9 @@ public class DomainCheckFeeCommandTest extends EppToolCommandTestCase<DomainChec
|
||||||
"example2.tld",
|
"example2.tld",
|
||||||
"example3.tld",
|
"example3.tld",
|
||||||
"example.tld2");
|
"example.tld2");
|
||||||
verifySent(
|
eppVerifier().verifySent(
|
||||||
ImmutableList.of(
|
|
||||||
"testdata/domain_check_fee_multiple.xml",
|
"testdata/domain_check_fee_multiple.xml",
|
||||||
"testdata/domain_check_fee_second_tld.xml"),
|
"testdata/domain_check_fee_second_tld.xml");
|
||||||
false,
|
|
||||||
false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -20,6 +20,7 @@ import static google.registry.testing.DatastoreHelper.createTlds;
|
||||||
import static google.registry.util.ResourceUtils.readResourceUtf8;
|
import static google.registry.util.ResourceUtils.readResourceUtf8;
|
||||||
import static google.registry.xml.XmlTestUtils.assertXmlEquals;
|
import static google.registry.xml.XmlTestUtils.assertXmlEquals;
|
||||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||||
|
import static java.util.Arrays.binarySearch;
|
||||||
import static org.mockito.Matchers.eq;
|
import static org.mockito.Matchers.eq;
|
||||||
import static org.mockito.Mockito.times;
|
import static org.mockito.Mockito.times;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
|
@ -64,29 +65,47 @@ public abstract class EppToolCommandTestCase<C extends EppToolCommand> extends C
|
||||||
/** Subclasses can override this to perform additional initialization. */
|
/** Subclasses can override this to perform additional initialization. */
|
||||||
void initEppToolCommandTestCase() throws Exception {}
|
void initEppToolCommandTestCase() throws Exception {}
|
||||||
|
|
||||||
void verifySent(String fileToMatch, boolean dryRun, boolean superuser) throws Exception {
|
/** Helper to get a new {@link EppVerifier} instance. */
|
||||||
ImmutableMap<String, ?> params = ImmutableMap.of(
|
EppVerifier eppVerifier() {
|
||||||
"clientIdentifier", "NewRegistrar",
|
return new EppVerifier();
|
||||||
"superuser", superuser,
|
|
||||||
"dryRun", dryRun);
|
|
||||||
verify(connection)
|
|
||||||
.send(eq("/_dr/epptool"), eq(params), eq(APPLICATION_EPP_XML_UTF8), xml.capture());
|
|
||||||
assertXmlEquals(readResourceUtf8(getClass(), fileToMatch), new String(xml.getValue(), UTF_8));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void verifySent(List<String> filesToMatch, boolean dryRun, boolean superuser) throws Exception {
|
/** Builder pattern class for verifying EPP commands sent to the server. */
|
||||||
|
class EppVerifier {
|
||||||
|
|
||||||
|
String clientIdentifier = "NewRegistrar";
|
||||||
|
boolean superuser = false;
|
||||||
|
boolean dryRun = false;
|
||||||
|
|
||||||
|
EppVerifier setClientIdentifier(String clientIdentifier) {
|
||||||
|
this.clientIdentifier = clientIdentifier;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
EppVerifier asSuperuser() {
|
||||||
|
this.superuser = true;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
EppVerifier asDryRun() {
|
||||||
|
this.dryRun = true;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
void verifySent(String... filesToMatch) throws Exception {
|
||||||
ImmutableMap<String, ?> params = ImmutableMap.of(
|
ImmutableMap<String, ?> params = ImmutableMap.of(
|
||||||
"clientIdentifier", "NewRegistrar",
|
"clientIdentifier", clientIdentifier,
|
||||||
"superuser", superuser,
|
"superuser", superuser,
|
||||||
"dryRun", dryRun);
|
"dryRun", dryRun);
|
||||||
verify(connection, times(filesToMatch.size()))
|
verify(connection, times(filesToMatch.length))
|
||||||
.send(eq("/_dr/epptool"), eq(params), eq(APPLICATION_EPP_XML_UTF8), xml.capture());
|
.send(eq("/_dr/epptool"), eq(params), eq(APPLICATION_EPP_XML_UTF8), xml.capture());
|
||||||
List<byte[]> capturedXml = xml.getAllValues();
|
List<byte[]> capturedXml = xml.getAllValues();
|
||||||
assertThat(filesToMatch).hasSize(capturedXml.size());
|
assertThat(filesToMatch).hasLength(capturedXml.size());
|
||||||
for (String fileToMatch : filesToMatch) {
|
for (String fileToMatch : filesToMatch) {
|
||||||
assertXmlEquals(
|
assertXmlEquals(
|
||||||
readResourceUtf8(getClass(), fileToMatch),
|
readResourceUtf8(getClass(), fileToMatch),
|
||||||
new String(capturedXml.get(filesToMatch.indexOf(fileToMatch)), UTF_8));
|
new String(capturedXml.get(binarySearch(filesToMatch, fileToMatch)), UTF_8));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,6 @@ package google.registry.tools;
|
||||||
import static google.registry.util.ResourceUtils.readResourceUtf8;
|
import static google.registry.util.ResourceUtils.readResourceUtf8;
|
||||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
|
|
||||||
import com.beust.jcommander.ParameterException;
|
import com.beust.jcommander.ParameterException;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -40,19 +38,19 @@ public class ExecuteEppCommandTest extends EppToolCommandTestCase<ExecuteEppComm
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess() throws Exception {
|
public void testSuccess() throws Exception {
|
||||||
runCommand("--client=NewRegistrar", "--force", eppFile);
|
runCommand("--client=NewRegistrar", "--force", eppFile);
|
||||||
verifySent("testdata/contact_create.xml", false, false);
|
eppVerifier().verifySent("testdata/contact_create.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_dryRun() throws Exception {
|
public void testSuccess_dryRun() throws Exception {
|
||||||
runCommand("--client=NewRegistrar", "--dry_run", eppFile);
|
runCommand("--client=NewRegistrar", "--dry_run", eppFile);
|
||||||
verifySent("testdata/contact_create.xml", true, false);
|
eppVerifier().asDryRun().verifySent("testdata/contact_create.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_withSuperuser() throws Exception {
|
public void testSuccess_withSuperuser() throws Exception {
|
||||||
runCommand("--client=NewRegistrar", "--superuser", "--force", eppFile);
|
runCommand("--client=NewRegistrar", "--superuser", "--force", eppFile);
|
||||||
verifySent("testdata/contact_create.xml", false, true);
|
eppVerifier().asSuperuser().verifySent("testdata/contact_create.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -60,7 +58,7 @@ public class ExecuteEppCommandTest extends EppToolCommandTestCase<ExecuteEppComm
|
||||||
inject.setStaticField(
|
inject.setStaticField(
|
||||||
ExecuteEppCommand.class, "stdin", new ByteArrayInputStream(xmlInput.getBytes(UTF_8)));
|
ExecuteEppCommand.class, "stdin", new ByteArrayInputStream(xmlInput.getBytes(UTF_8)));
|
||||||
runCommand("--client=NewRegistrar", "--force");
|
runCommand("--client=NewRegistrar", "--force");
|
||||||
verifySent("testdata/contact_create.xml", false, false);
|
eppVerifier().verifySent("testdata/contact_create.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -68,10 +66,7 @@ public class ExecuteEppCommandTest extends EppToolCommandTestCase<ExecuteEppComm
|
||||||
String xmlInput2 = readResourceUtf8(ExecuteEppCommandTest.class, "testdata/domain_check.xml");
|
String xmlInput2 = readResourceUtf8(ExecuteEppCommandTest.class, "testdata/domain_check.xml");
|
||||||
String eppFile2 = writeToNamedTmpFile("eppFile2", xmlInput2);
|
String eppFile2 = writeToNamedTmpFile("eppFile2", xmlInput2);
|
||||||
runCommand("--client=NewRegistrar", "--force", eppFile, eppFile2);
|
runCommand("--client=NewRegistrar", "--force", eppFile, eppFile2);
|
||||||
verifySent(
|
eppVerifier().verifySent("testdata/contact_create.xml", "testdata/domain_check.xml");
|
||||||
ImmutableList.of("testdata/contact_create.xml", "testdata/domain_check.xml"),
|
|
||||||
false,
|
|
||||||
false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -25,35 +25,35 @@ public class UpdateServerLocksCommandTest extends EppToolCommandTestCase<UpdateS
|
||||||
public void testSuccess_applyOne() throws Exception {
|
public void testSuccess_applyOne() throws Exception {
|
||||||
runCommandForced("--client=NewRegistrar", "--registrar_request=true", "--reason=Test",
|
runCommandForced("--client=NewRegistrar", "--registrar_request=true", "--reason=Test",
|
||||||
"--domain_name=example.tld", "--apply=serverRenewProhibited");
|
"--domain_name=example.tld", "--apply=serverRenewProhibited");
|
||||||
verifySent("testdata/update_server_locks_apply_one.xml", false, false);
|
eppVerifier().verifySent("testdata/update_server_locks_apply_one.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_multipleWordReason() throws Exception {
|
public void testSuccess_multipleWordReason() throws Exception {
|
||||||
runCommandForced("--client=NewRegistrar", "--registrar_request=false",
|
runCommandForced("--client=NewRegistrar", "--registrar_request=false",
|
||||||
"--reason=\"Test this\"", "--domain_name=example.tld", "--apply=serverRenewProhibited");
|
"--reason=\"Test this\"", "--domain_name=example.tld", "--apply=serverRenewProhibited");
|
||||||
verifySent("testdata/update_server_locks_multiple_word_reason.xml", false, false);
|
eppVerifier().verifySent("testdata/update_server_locks_multiple_word_reason.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_removeOne() throws Exception {
|
public void testSuccess_removeOne() throws Exception {
|
||||||
runCommandForced("--client=NewRegistrar", "--registrar_request=true", "--reason=Test",
|
runCommandForced("--client=NewRegistrar", "--registrar_request=true", "--reason=Test",
|
||||||
"--domain_name=example.tld", "--remove=serverRenewProhibited");
|
"--domain_name=example.tld", "--remove=serverRenewProhibited");
|
||||||
verifySent("testdata/update_server_locks_remove_one.xml", false, false);
|
eppVerifier().verifySent("testdata/update_server_locks_remove_one.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_applyAll() throws Exception {
|
public void testSuccess_applyAll() throws Exception {
|
||||||
runCommandForced("--client=NewRegistrar", "--registrar_request=true", "--reason=Test",
|
runCommandForced("--client=NewRegistrar", "--registrar_request=true", "--reason=Test",
|
||||||
"--domain_name=example.tld", "--apply=all");
|
"--domain_name=example.tld", "--apply=all");
|
||||||
verifySent("testdata/update_server_locks_apply_all.xml", false, false);
|
eppVerifier().verifySent("testdata/update_server_locks_apply_all.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_removeAll() throws Exception {
|
public void testSuccess_removeAll() throws Exception {
|
||||||
runCommandForced("--client=NewRegistrar", "--registrar_request=true", "--reason=Test",
|
runCommandForced("--client=NewRegistrar", "--registrar_request=true", "--reason=Test",
|
||||||
"--domain_name=example.tld", "--remove=all");
|
"--domain_name=example.tld", "--remove=all");
|
||||||
verifySent("testdata/update_server_locks_remove_all.xml", false, false);
|
eppVerifier().verifySent("testdata/update_server_locks_remove_all.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -123,5 +123,4 @@ public class UpdateServerLocksCommandTest extends EppToolCommandTestCase<UpdateS
|
||||||
runCommandForced("--client=NewRegistrar", "--reason=Test",
|
runCommandForced("--client=NewRegistrar", "--reason=Test",
|
||||||
"--domain_name=example.tld", "--apply=serverRenewProhibited");
|
"--domain_name=example.tld", "--apply=serverRenewProhibited");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue