Rename all testdata loading files to conform to a single naming scheme

The scheme is:
- loadBytes: returns a ByteSource of the data
- loadFile: returns a string using UTF8 encoding, optionally applying
  substitutions

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177606406
This commit is contained in:
guyben 2017-12-01 10:16:22 -08:00 committed by jianglai
parent ebfa27b3ad
commit b8970bfe1b
94 changed files with 428 additions and 449 deletions

View file

@ -20,7 +20,7 @@ import static com.google.common.truth.Truth8.assertThat;
import static google.registry.flows.EppXmlTransformer.marshal; import static google.registry.flows.EppXmlTransformer.marshal;
import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.LogsSubject.assertAboutLogs; import static google.registry.testing.LogsSubject.assertAboutLogs;
import static google.registry.testing.TestDataHelper.loadFileWithSubstitutions; import static google.registry.testing.TestDataHelper.loadFile;
import static google.registry.testing.TestLogHandlerUtils.findFirstLogRecordWithMessagePrefix; import static google.registry.testing.TestLogHandlerUtils.findFirstLogRecordWithMessagePrefix;
import static java.nio.charset.StandardCharsets.UTF_8; import static java.nio.charset.StandardCharsets.UTF_8;
import static java.util.logging.Level.INFO; import static java.util.logging.Level.INFO;
@ -31,7 +31,6 @@ import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import com.google.common.base.Splitter; import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableMap;
import com.google.common.testing.TestLogHandler; import com.google.common.testing.TestLogHandler;
import google.registry.flows.EppException.UnimplementedExtensionException; import google.registry.flows.EppException.UnimplementedExtensionException;
import google.registry.flows.EppTestComponent.FakeServerTridProvider; import google.registry.flows.EppTestComponent.FakeServerTridProvider;
@ -93,9 +92,7 @@ public class EppControllerTest extends ShardableTestCase {
*/ */
private final Logger loggerToIntercept = Logger.getLogger(EppController.class.getCanonicalName()); private final Logger loggerToIntercept = Logger.getLogger(EppController.class.getCanonicalName());
private final String domainCreateXml = private final String domainCreateXml = loadFile(getClass(), "domain_create_prettyprinted.xml");
loadFileWithSubstitutions(
getClass(), "domain_create_prettyprinted.xml", ImmutableMap.<String, String>of());
private EppController eppController; private EppController eppController;

View file

@ -16,7 +16,7 @@ package google.registry.flows;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.testing.TestDataHelper.loadFileWithSubstitutions; import static google.registry.testing.TestDataHelper.loadFile;
import static google.registry.xml.XmlTestUtils.assertXmlEqualsWithMessage; import static google.registry.xml.XmlTestUtils.assertXmlEqualsWithMessage;
import static java.nio.charset.StandardCharsets.UTF_8; import static java.nio.charset.StandardCharsets.UTF_8;
import static javax.servlet.http.HttpServletResponse.SC_OK; import static javax.servlet.http.HttpServletResponse.SC_OK;
@ -88,9 +88,8 @@ public class EppTestCase extends ShardableTestCase {
Map<String, String> outputSubstitutions, Map<String, String> outputSubstitutions,
DateTime now) throws Exception { DateTime now) throws Exception {
clock.setTo(now); clock.setTo(now);
String input = loadFileWithSubstitutions(getClass(), inputFilename, inputSubstitutions); String input = loadFile(getClass(), inputFilename, inputSubstitutions);
String expectedOutput = String expectedOutput = loadFile(getClass(), outputFilename, outputSubstitutions);
loadFileWithSubstitutions(getClass(), outputFilename, outputSubstitutions);
if (sessionMetadata == null) { if (sessionMetadata == null) {
sessionMetadata = new HttpSessionMetadata(new FakeHttpSession()) { sessionMetadata = new HttpSessionMetadata(new FakeHttpSession()) {
@Override @Override

View file

@ -16,14 +16,13 @@ package google.registry.flows;
import static com.google.common.io.BaseEncoding.base64; import static com.google.common.io.BaseEncoding.base64;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.testing.TestDataHelper.loadFileWithSubstitutions; import static google.registry.testing.TestDataHelper.loadFile;
import static google.registry.testing.TestLogHandlerUtils.findFirstLogMessageByPrefix; import static google.registry.testing.TestLogHandlerUtils.findFirstLogMessageByPrefix;
import static java.nio.charset.StandardCharsets.UTF_8; import static java.nio.charset.StandardCharsets.UTF_8;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.testing.TestLogHandler; import com.google.common.testing.TestLogHandler;
import google.registry.flows.annotations.ReportingSpec; import google.registry.flows.annotations.ReportingSpec;
import google.registry.model.eppcommon.Trid; import google.registry.model.eppcommon.Trid;
@ -88,8 +87,7 @@ public class FlowReporterTest extends ShardableTestCase {
@Test @Test
public void testRecordToLogs_eppInput_complex() throws Exception { public void testRecordToLogs_eppInput_complex() throws Exception {
String domainCreateXml = loadFileWithSubstitutions( String domainCreateXml = loadFile(getClass(), "domain_create_prettyprinted.xml");
getClass(), "domain_create_prettyprinted.xml", ImmutableMap.<String, String>of());
flowReporter.inputXmlBytes = domainCreateXml.getBytes(UTF_8); flowReporter.inputXmlBytes = domainCreateXml.getBytes(UTF_8);
flowReporter.recordToLogs(); flowReporter.recordToLogs();
assertThat(parseJsonMap(findFirstLogMessageByPrefix(handler, "FLOW-LOG-SIGNATURE-EPPINPUT: "))) assertThat(parseJsonMap(findFirstLogMessageByPrefix(handler, "FLOW-LOG-SIGNATURE-EPPINPUT: ")))

View file

@ -16,7 +16,7 @@ package google.registry.flows;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat; import static com.google.common.truth.Truth8.assertThat;
import static google.registry.testing.TestDataHelper.loadFileWithSubstitutions; import static google.registry.testing.TestDataHelper.loadFile;
import static google.registry.testing.TestLogHandlerUtils.findFirstLogMessageByPrefix; import static google.registry.testing.TestLogHandlerUtils.findFirstLogMessageByPrefix;
import static java.nio.charset.StandardCharsets.UTF_8; import static java.nio.charset.StandardCharsets.UTF_8;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
@ -26,7 +26,6 @@ import static org.mockito.Mockito.verify;
import com.google.appengine.api.users.User; import com.google.appengine.api.users.User;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.google.common.base.Splitter; import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.testing.TestLogHandler; import com.google.common.testing.TestLogHandler;
import google.registry.model.eppcommon.Trid; import google.registry.model.eppcommon.Trid;
@ -180,8 +179,7 @@ public class FlowRunnerTest extends ShardableTestCase {
@Test @Test
public void testRun_legacyLoggingStatement_complexEppInput() throws Exception { public void testRun_legacyLoggingStatement_complexEppInput() throws Exception {
String domainCreateXml = loadFileWithSubstitutions( String domainCreateXml = loadFile(getClass(), "domain_create_prettyprinted.xml");
getClass(), "domain_create_prettyprinted.xml", ImmutableMap.<String, String>of());
flowRunner.inputXmlBytes = domainCreateXml.getBytes(UTF_8); flowRunner.inputXmlBytes = domainCreateXml.getBytes(UTF_8);
flowRunner.run(eppMetricBuilder); flowRunner.run(eppMetricBuilder);
String logMessage = findFirstLogMessageByPrefix(handler, "EPP Command\n\t"); String logMessage = findFirstLogMessageByPrefix(handler, "EPP Command\n\t");

View file

@ -22,7 +22,6 @@ import static google.registry.flows.EppXmlTransformer.marshal;
import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.testing.DatastoreHelper.BILLING_EVENT_ID_STRIPPER; import static google.registry.testing.DatastoreHelper.BILLING_EVENT_ID_STRIPPER;
import static google.registry.testing.DatastoreHelper.getPollMessages; import static google.registry.testing.DatastoreHelper.getPollMessages;
import static google.registry.testing.TestDataHelper.loadFile;
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 org.joda.time.DateTimeZone.UTC; import static org.joda.time.DateTimeZone.UTC;
@ -135,12 +134,12 @@ public abstract class FlowTestCase<F extends Flow> extends ShardableTestCase {
return eppMetricBuilder.build(); return eppMetricBuilder.build();
} }
protected String readFile(String filename) { protected String loadFile(String filename) {
return loadFile(getClass(), filename); return TestDataHelper.loadFile(getClass(), filename);
} }
protected String readFile(String filename, Map<String, String> substitutions) { protected String loadFile(String filename, Map<String, String> substitutions) {
return TestDataHelper.loadFileWithSubstitutions(getClass(), filename, substitutions); return TestDataHelper.loadFile(getClass(), filename, substitutions);
} }
protected String getClientTrid() throws Exception { protected String getClientTrid() throws Exception {

View file

@ -63,7 +63,7 @@ public class ContactCheckFlowTest
@Test @Test
public void testXmlMatches() throws Exception { public void testXmlMatches() throws Exception {
persistActiveContact("sah8013"); persistActiveContact("sah8013");
runFlowAssertResponse(readFile("contact_check_response.xml")); runFlowAssertResponse(loadFile("contact_check_response.xml"));
} }
@Test @Test

View file

@ -38,7 +38,7 @@ public class ContactCreateFlowTest
private void doSuccessfulTest() throws Exception { private void doSuccessfulTest() throws Exception {
assertTransactionalFlow(true); assertTransactionalFlow(true);
runFlowAssertResponse(readFile("contact_create_response.xml")); runFlowAssertResponse(loadFile("contact_create_response.xml"));
// Check that the contact was created and persisted with a history entry. // Check that the contact was created and persisted with a history entry.
assertAboutContacts().that(reloadResourceByForeignKey()) assertAboutContacts().that(reloadResourceByForeignKey())
.hasOnlyOneHistoryEntryWhich().hasNoXml(); .hasOnlyOneHistoryEntryWhich().hasNoXml();
@ -48,7 +48,7 @@ public class ContactCreateFlowTest
@Test @Test
public void testDryRun() throws Exception { public void testDryRun() throws Exception {
dryRunFlowAssertResponse(readFile("contact_create_response.xml")); dryRunFlowAssertResponse(loadFile("contact_create_response.xml"));
} }
@Test @Test

View file

@ -48,7 +48,7 @@ public class ContactDeleteFlowTest
@Test @Test
public void testDryRun() throws Exception { public void testDryRun() throws Exception {
persistActiveContact(getUniqueIdFromCommand()); persistActiveContact(getUniqueIdFromCommand());
dryRunFlowAssertResponse(readFile("contact_delete_response.xml")); dryRunFlowAssertResponse(loadFile("contact_delete_response.xml"));
} }
@Test @Test
@ -56,7 +56,7 @@ public class ContactDeleteFlowTest
persistActiveContact(getUniqueIdFromCommand()); persistActiveContact(getUniqueIdFromCommand());
clock.advanceOneMilli(); clock.advanceOneMilli();
assertTransactionalFlow(true); assertTransactionalFlow(true);
runFlowAssertResponse(readFile("contact_delete_response.xml")); runFlowAssertResponse(loadFile("contact_delete_response.xml"));
ContactResource deletedContact = reloadResourceByForeignKey(); ContactResource deletedContact = reloadResourceByForeignKey();
assertAboutContacts().that(deletedContact).hasStatusValue(StatusValue.PENDING_DELETE); assertAboutContacts().that(deletedContact).hasStatusValue(StatusValue.PENDING_DELETE);
assertAsyncDeletionTaskEnqueued( assertAsyncDeletionTaskEnqueued(
@ -126,7 +126,7 @@ public class ContactDeleteFlowTest
persistActiveContact(getUniqueIdFromCommand()); persistActiveContact(getUniqueIdFromCommand());
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("contact_delete_response.xml")); CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("contact_delete_response.xml"));
ContactResource deletedContact = reloadResourceByForeignKey(); ContactResource deletedContact = reloadResourceByForeignKey();
assertAboutContacts().that(deletedContact).hasStatusValue(StatusValue.PENDING_DELETE); assertAboutContacts().that(deletedContact).hasStatusValue(StatusValue.PENDING_DELETE);
assertAsyncDeletionTaskEnqueued( assertAsyncDeletionTaskEnqueued(

View file

@ -97,7 +97,7 @@ public class ContactInfoFlowTest extends ResourceFlowTestCase<ContactInfoFlow, C
// Check that the persisted contact info was returned. // Check that the persisted contact info was returned.
assertTransactionalFlow(false); assertTransactionalFlow(false);
runFlowAssertResponse( runFlowAssertResponse(
readFile("contact_info_response.xml"), loadFile("contact_info_response.xml"),
// We use a different roid scheme than the samples so ignore it. // We use a different roid scheme than the samples so ignore it.
"epp.response.resData.infData.roid"); "epp.response.resData.infData.roid");
assertNoHistory(); assertNoHistory();
@ -111,7 +111,7 @@ public class ContactInfoFlowTest extends ResourceFlowTestCase<ContactInfoFlow, C
// Check that the persisted contact info was returned. // Check that the persisted contact info was returned.
assertTransactionalFlow(false); assertTransactionalFlow(false);
runFlowAssertResponse( runFlowAssertResponse(
readFile("contact_info_response_linked.xml"), loadFile("contact_info_response_linked.xml"),
// We use a different roid scheme than the samples so ignore it. // We use a different roid scheme than the samples so ignore it.
"epp.response.resData.infData.roid"); "epp.response.resData.infData.roid");
assertNoHistory(); assertNoHistory();
@ -125,7 +125,7 @@ public class ContactInfoFlowTest extends ResourceFlowTestCase<ContactInfoFlow, C
// Check that the persisted contact info was returned. // Check that the persisted contact info was returned.
assertTransactionalFlow(false); assertTransactionalFlow(false);
runFlowAssertResponse( runFlowAssertResponse(
readFile("contact_info_response.xml"), loadFile("contact_info_response.xml"),
// We use a different roid scheme than the samples so ignore it. // We use a different roid scheme than the samples so ignore it.
"epp.response.resData.infData.roid"); "epp.response.resData.infData.roid");
assertNoHistory(); assertNoHistory();
@ -140,7 +140,7 @@ public class ContactInfoFlowTest extends ResourceFlowTestCase<ContactInfoFlow, C
// Check that the persisted contact info was returned. // Check that the persisted contact info was returned.
assertTransactionalFlow(false); assertTransactionalFlow(false);
runFlowAssertResponse( runFlowAssertResponse(
readFile("contact_info_response_no_authinfo.xml"), loadFile("contact_info_response_no_authinfo.xml"),
// We use a different roid scheme than the samples so ignore it. // We use a different roid scheme than the samples so ignore it.
"epp.response.resData.infData.roid"); "epp.response.resData.infData.roid");
assertNoHistory(); assertNoHistory();
@ -154,7 +154,7 @@ public class ContactInfoFlowTest extends ResourceFlowTestCase<ContactInfoFlow, C
// Check that the persisted contact info was returned. // Check that the persisted contact info was returned.
assertTransactionalFlow(false); assertTransactionalFlow(false);
runFlowAssertResponse( runFlowAssertResponse(
readFile("contact_info_response.xml"), loadFile("contact_info_response.xml"),
// We use a different roid scheme than the samples so ignore it. // We use a different roid scheme than the samples so ignore it.
"epp.response.resData.infData.roid"); "epp.response.resData.infData.roid");
assertNoHistory(); assertNoHistory();

View file

@ -67,7 +67,7 @@ public class ContactTransferApproveFlowTest
contact = reloadResourceByForeignKey(); contact = reloadResourceByForeignKey();
TransferData originalTransferData = contact.getTransferData(); TransferData originalTransferData = contact.getTransferData();
assertTransactionalFlow(true); assertTransactionalFlow(true);
runFlowAssertResponse(readFile(expectedXmlFilename)); runFlowAssertResponse(loadFile(expectedXmlFilename));
// Transfer should have succeeded. Verify correct fields were set. // Transfer should have succeeded. Verify correct fields were set.
contact = reloadResourceByForeignKey(); contact = reloadResourceByForeignKey();
@ -121,7 +121,7 @@ public class ContactTransferApproveFlowTest
@Test @Test
public void testDryRun() throws Exception { public void testDryRun() throws Exception {
setEppInput("contact_transfer_approve.xml"); setEppInput("contact_transfer_approve.xml");
dryRunFlowAssertResponse(readFile("contact_transfer_approve_response.xml")); dryRunFlowAssertResponse(loadFile("contact_transfer_approve_response.xml"));
} }
@Test @Test

View file

@ -61,7 +61,7 @@ public class ContactTransferCancelFlowTest
contact = reloadResourceByForeignKey(); contact = reloadResourceByForeignKey();
TransferData originalTransferData = contact.getTransferData(); TransferData originalTransferData = contact.getTransferData();
assertTransactionalFlow(true); assertTransactionalFlow(true);
runFlowAssertResponse(readFile(expectedXmlFilename)); runFlowAssertResponse(loadFile(expectedXmlFilename));
// Transfer should have been cancelled. Verify correct fields were set. // Transfer should have been cancelled. Verify correct fields were set.
contact = reloadResourceByForeignKey(); contact = reloadResourceByForeignKey();
@ -105,7 +105,7 @@ public class ContactTransferCancelFlowTest
@Test @Test
public void testDryRun() throws Exception { public void testDryRun() throws Exception {
setEppInput("contact_transfer_cancel.xml"); setEppInput("contact_transfer_cancel.xml");
dryRunFlowAssertResponse(readFile("contact_transfer_cancel_response.xml")); dryRunFlowAssertResponse(loadFile("contact_transfer_cancel_response.xml"));
} }
@Test @Test

View file

@ -50,7 +50,7 @@ public class ContactTransferQueryFlowTest
eppLoader.replaceAll("JD1234-REP", contact.getRepoId()); eppLoader.replaceAll("JD1234-REP", contact.getRepoId());
// Setup done; run the test. // Setup done; run the test.
assertTransactionalFlow(false); assertTransactionalFlow(false);
runFlowAssertResponse(readFile(expectedXmlFilename)); runFlowAssertResponse(loadFile(expectedXmlFilename));
assertAboutContacts().that(reloadResourceByForeignKey(clock.nowUtc().minusDays(1))) assertAboutContacts().that(reloadResourceByForeignKey(clock.nowUtc().minusDays(1)))
.hasOneHistoryEntryEachOfTypes(HistoryEntry.Type.CONTACT_TRANSFER_REQUEST); .hasOneHistoryEntryEachOfTypes(HistoryEntry.Type.CONTACT_TRANSFER_REQUEST);
assertNoBillingEvents(); assertNoBillingEvents();

View file

@ -65,7 +65,7 @@ public class ContactTransferRejectFlowTest
contact = reloadResourceByForeignKey(); contact = reloadResourceByForeignKey();
TransferData originalTransferData = contact.getTransferData(); TransferData originalTransferData = contact.getTransferData();
assertTransactionalFlow(true); assertTransactionalFlow(true);
runFlowAssertResponse(readFile(expectedXmlFilename)); runFlowAssertResponse(loadFile(expectedXmlFilename));
// Transfer should have failed. Verify correct fields were set. // Transfer should have failed. Verify correct fields were set.
contact = reloadResourceByForeignKey(); contact = reloadResourceByForeignKey();
@ -120,7 +120,7 @@ public class ContactTransferRejectFlowTest
@Test @Test
public void testDryRun() throws Exception { public void testDryRun() throws Exception {
setEppInput("contact_transfer_reject.xml"); setEppInput("contact_transfer_reject.xml");
dryRunFlowAssertResponse(readFile("contact_transfer_reject_response.xml")); dryRunFlowAssertResponse(loadFile("contact_transfer_reject_response.xml"));
} }
@Test @Test

View file

@ -77,7 +77,7 @@ public class ContactTransferRequestFlowTest
// Setup done; run the test. // Setup done; run the test.
assertTransactionalFlow(true); assertTransactionalFlow(true);
runFlowAssertResponse(readFile(expectedXmlFilename)); runFlowAssertResponse(loadFile(expectedXmlFilename));
// Transfer should have been requested. Verify correct fields were set. // Transfer should have been requested. Verify correct fields were set.
contact = reloadResourceByForeignKey(); contact = reloadResourceByForeignKey();
@ -144,7 +144,7 @@ public class ContactTransferRequestFlowTest
@Test @Test
public void testDryRun() throws Exception { public void testDryRun() throws Exception {
setEppInput("contact_transfer_request.xml"); setEppInput("contact_transfer_request.xml");
dryRunFlowAssertResponse(readFile("contact_transfer_request_response.xml")); dryRunFlowAssertResponse(loadFile("contact_transfer_request_response.xml"));
} }
@Test @Test

View file

@ -51,7 +51,7 @@ public class ContactUpdateFlowTest
persistActiveContact(getUniqueIdFromCommand()); persistActiveContact(getUniqueIdFromCommand());
clock.advanceOneMilli(); clock.advanceOneMilli();
assertTransactionalFlow(true); assertTransactionalFlow(true);
runFlowAssertResponse(readFile("contact_update_response.xml")); runFlowAssertResponse(loadFile("contact_update_response.xml"));
// Check that the contact was updated. This value came from the xml. // Check that the contact was updated. This value came from the xml.
assertAboutContacts().that(reloadResourceByForeignKey()) assertAboutContacts().that(reloadResourceByForeignKey())
.hasAuthInfoPwd("2fooBAR").and() .hasAuthInfoPwd("2fooBAR").and()
@ -63,7 +63,7 @@ public class ContactUpdateFlowTest
@Test @Test
public void testDryRun() throws Exception { public void testDryRun() throws Exception {
persistActiveContact(getUniqueIdFromCommand()); persistActiveContact(getUniqueIdFromCommand());
dryRunFlowAssertResponse(readFile("contact_update_response.xml")); dryRunFlowAssertResponse(loadFile("contact_update_response.xml"));
} }
@Test @Test
@ -94,7 +94,7 @@ public class ContactUpdateFlowTest
.hasNonNullLocalizedPostalInfo().and() .hasNonNullLocalizedPostalInfo().and()
.hasNullInternationalizedPostalInfo(); .hasNullInternationalizedPostalInfo();
runFlowAssertResponse(readFile("contact_update_response.xml")); runFlowAssertResponse(loadFile("contact_update_response.xml"));
assertAboutContacts().that(reloadResourceByForeignKey()) assertAboutContacts().that(reloadResourceByForeignKey())
.hasNullLocalizedPostalInfo().and() .hasNullLocalizedPostalInfo().and()
.hasInternationalizedPostalInfo(new PostalInfo.Builder() .hasInternationalizedPostalInfo(new PostalInfo.Builder()
@ -133,7 +133,7 @@ public class ContactUpdateFlowTest
.hasNonNullInternationalizedPostalInfo().and() .hasNonNullInternationalizedPostalInfo().and()
.hasNullLocalizedPostalInfo(); .hasNullLocalizedPostalInfo();
runFlowAssertResponse(readFile("contact_update_response.xml")); runFlowAssertResponse(loadFile("contact_update_response.xml"));
assertAboutContacts().that(reloadResourceByForeignKey()) assertAboutContacts().that(reloadResourceByForeignKey())
.hasNullInternationalizedPostalInfo().and() .hasNullInternationalizedPostalInfo().and()
.hasLocalizedPostalInfo(new PostalInfo.Builder() .hasLocalizedPostalInfo(new PostalInfo.Builder()
@ -168,7 +168,7 @@ public class ContactUpdateFlowTest
.build()); .build());
clock.advanceOneMilli(); clock.advanceOneMilli();
// The test xml updates the address of the postal info and should leave the name untouched. // The test xml updates the address of the postal info and should leave the name untouched.
runFlowAssertResponse(readFile("contact_update_response.xml")); runFlowAssertResponse(loadFile("contact_update_response.xml"));
assertAboutContacts().that(reloadResourceByForeignKey()).hasLocalizedPostalInfo( assertAboutContacts().that(reloadResourceByForeignKey()).hasLocalizedPostalInfo(
new PostalInfo.Builder() new PostalInfo.Builder()
.setType(Type.LOCALIZED) .setType(Type.LOCALIZED)
@ -220,7 +220,7 @@ public class ContactUpdateFlowTest
// internationalized postal info to the same value it previously had, which causes it to be // internationalized postal info to the same value it previously had, which causes it to be
// preserved. If the xml had not mentioned the internationalized one at all it would have been // preserved. If the xml had not mentioned the internationalized one at all it would have been
// deleted. // deleted.
runFlowAssertResponse(readFile("contact_update_response.xml")); runFlowAssertResponse(loadFile("contact_update_response.xml"));
assertAboutContacts().that(reloadResourceByForeignKey()) assertAboutContacts().that(reloadResourceByForeignKey())
.hasLocalizedPostalInfo( .hasLocalizedPostalInfo(
new PostalInfo.Builder() new PostalInfo.Builder()
@ -284,7 +284,7 @@ public class ContactUpdateFlowTest
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, CommitMode.LIVE,
UserPrivileges.SUPERUSER, UserPrivileges.SUPERUSER,
readFile("contact_update_response.xml")); loadFile("contact_update_response.xml"));
} }
@Test @Test
@ -301,7 +301,7 @@ public class ContactUpdateFlowTest
persistActiveContact(getUniqueIdFromCommand()); persistActiveContact(getUniqueIdFromCommand());
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("contact_update_response.xml")); CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("contact_update_response.xml"));
} }
@Test @Test
@ -327,7 +327,7 @@ public class ContactUpdateFlowTest
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, CommitMode.LIVE,
UserPrivileges.SUPERUSER, UserPrivileges.SUPERUSER,
readFile("contact_update_response.xml")); loadFile("contact_update_response.xml"));
assertAboutContacts().that(reloadResourceByForeignKey()) assertAboutContacts().that(reloadResourceByForeignKey())
.hasStatusValue(StatusValue.CLIENT_UPDATE_PROHIBITED).and() .hasStatusValue(StatusValue.CLIENT_UPDATE_PROHIBITED).and()
.hasStatusValue(StatusValue.SERVER_DELETE_PROHIBITED); .hasStatusValue(StatusValue.SERVER_DELETE_PROHIBITED);

View file

@ -135,7 +135,7 @@ public class DomainAllocateFlowTest
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, CommitMode.LIVE,
UserPrivileges.SUPERUSER, UserPrivileges.SUPERUSER,
readFile("domain_allocate_response.xml")); loadFile("domain_allocate_response.xml"));
// Check that the domain was created and persisted with a history entry. // Check that the domain was created and persisted with a history entry.
DomainResource domain = reloadResourceByForeignKey(); DomainResource domain = reloadResourceByForeignKey();
assertAboutDomains().that(domain) assertAboutDomains().that(domain)

View file

@ -195,8 +195,8 @@ public class DomainApplicationCreateFlowTest
assertTransactionalFlow(true); assertTransactionalFlow(true);
runFlowAssertResponse( runFlowAssertResponse(
(feeExtensionVersion == null) (feeExtensionVersion == null)
? readFile(responseXmlFile) ? loadFile(responseXmlFile)
: readFile( : loadFile(
responseXmlFile, responseXmlFile,
ImmutableMap.of("FEE_VERSION", feeExtensionVersion, "FEE_NS", feeExtensionNamespace)), ImmutableMap.of("FEE_VERSION", feeExtensionVersion, "FEE_NS", feeExtensionNamespace)),
"epp.response.extension.creData.applicationID", "epp.response.extension.creData.applicationID",
@ -222,7 +222,7 @@ public class DomainApplicationCreateFlowTest
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, CommitMode.LIVE,
UserPrivileges.SUPERUSER, UserPrivileges.SUPERUSER,
readFile(filename), loadFile(filename),
"epp.response.extension.creData.applicationID", "epp.response.extension.creData.applicationID",
"epp.response.resData.creData.crDate", "epp.response.resData.creData.crDate",
"epp.response.extension.creData.phase"); "epp.response.extension.creData.phase");
@ -234,7 +234,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrush_encoded_signed_mark.xml"); setEppInput("domain_create_sunrush_encoded_signed_mark.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
dryRunFlowAssertResponse(readFile("domain_create_sunrush_encoded_signed_mark_response.xml"), dryRunFlowAssertResponse(loadFile("domain_create_sunrush_encoded_signed_mark_response.xml"),
"epp.response.extension.creData.applicationID", "epp.response.resData.creData.crDate"); "epp.response.extension.creData.applicationID", "epp.response.resData.creData.crDate");
} }
@ -326,7 +326,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrush.xml"); setEppInput("domain_create_sunrush.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
dryRunFlowAssertResponse(readFile("domain_create_sunrush_response.xml"), dryRunFlowAssertResponse(loadFile("domain_create_sunrush_response.xml"),
"epp.response.extension.creData.applicationID", "epp.response.resData.creData.crDate"); "epp.response.extension.creData.applicationID", "epp.response.resData.creData.crDate");
} }
@ -338,7 +338,7 @@ public class DomainApplicationCreateFlowTest
persistClaimsList(ImmutableMap.of("example-one", CLAIMS_KEY)); persistClaimsList(ImmutableMap.of("example-one", CLAIMS_KEY));
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
dryRunFlowAssertResponse(readFile("domain_create_sunrush_response_claims.xml"), dryRunFlowAssertResponse(loadFile("domain_create_sunrush_response_claims.xml"),
"epp.response.extension.creData.applicationID", "epp.response.resData.creData.crDate"); "epp.response.extension.creData.applicationID", "epp.response.resData.creData.crDate");
} }
@ -819,7 +819,7 @@ public class DomainApplicationCreateFlowTest
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse( runFlowAssertResponse(
readFile("domain_create_landrush_premium_response.xml"), loadFile("domain_create_landrush_premium_response.xml"),
"epp.response.extension.creData.applicationID", "epp.response.extension.creData.applicationID",
"epp.response.resData.creData.crDate", "epp.response.resData.creData.crDate",
"epp.response.extension.creData.phase"); "epp.response.extension.creData.phase");

View file

@ -67,7 +67,7 @@ public class DomainApplicationDeleteFlowTest
public void doSuccessfulTest() throws Exception { public void doSuccessfulTest() throws Exception {
assertTransactionalFlow(true); assertTransactionalFlow(true);
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse(readFile("domain_delete_response.xml")); runFlowAssertResponse(loadFile("domain_delete_response.xml"));
// Check that the domain is fully deleted. // Check that the domain is fully deleted.
assertThat(reloadDomainApplication()).isNull(); assertThat(reloadDomainApplication()).isNull();
assertNoBillingEvents(); assertNoBillingEvents();
@ -77,7 +77,7 @@ public class DomainApplicationDeleteFlowTest
public void testDryRun() throws Exception { public void testDryRun() throws Exception {
persistResource( persistResource(
newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build()); newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build());
dryRunFlowAssertResponse(readFile("domain_delete_response.xml")); dryRunFlowAssertResponse(loadFile("domain_delete_response.xml"));
} }
@Test @Test
@ -157,7 +157,7 @@ public class DomainApplicationDeleteFlowTest
newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build()); newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build());
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_delete_response.xml")); CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_delete_response.xml"));
} }
@Test @Test
@ -176,7 +176,7 @@ public class DomainApplicationDeleteFlowTest
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_delete_response.xml")); CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_delete_response.xml"));
} }
@Test @Test
@ -203,7 +203,7 @@ public class DomainApplicationDeleteFlowTest
.build()); .build());
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_delete_response.xml")); CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_delete_response.xml"));
} }
@Test @Test
@ -281,7 +281,7 @@ public class DomainApplicationDeleteFlowTest
newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build()); newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build());
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_delete_response.xml")); CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_delete_response.xml"));
} }
@Test @Test
@ -291,7 +291,7 @@ public class DomainApplicationDeleteFlowTest
newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build()); newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build());
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_delete_response.xml")); CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_delete_response.xml"));
} }
@Test @Test
@ -301,7 +301,7 @@ public class DomainApplicationDeleteFlowTest
newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build()); newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build());
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_delete_response.xml")); CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_delete_response.xml"));
} }
@Test @Test

View file

@ -22,7 +22,6 @@ import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.persistActiveContact; import static google.registry.testing.DatastoreHelper.persistActiveContact;
import static google.registry.testing.DatastoreHelper.persistActiveHost; import static google.registry.testing.DatastoreHelper.persistActiveHost;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.TestDataHelper.loadFileWithSubstitutions;
import com.google.common.base.Predicates; import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
@ -113,8 +112,7 @@ public class DomainApplicationInfoFlowTest
private void doSuccessfulTest(String expectedXmlFilename, HostsState hostsState) private void doSuccessfulTest(String expectedXmlFilename, HostsState hostsState)
throws Exception { throws Exception {
assertTransactionalFlow(false); assertTransactionalFlow(false);
String expected = loadFileWithSubstitutions( String expected = loadFile(expectedXmlFilename, ImmutableMap.of("ROID", "123-TLD"));
getClass(), expectedXmlFilename, ImmutableMap.of("ROID", "123-TLD"));
if (hostsState.equals(HostsState.NO_HOSTS_EXIST)) { if (hostsState.equals(HostsState.NO_HOSTS_EXIST)) {
expected = expected.replaceAll("\"ok\"", "\"inactive\""); expected = expected.replaceAll("\"ok\"", "\"inactive\"");
} }

View file

@ -129,7 +129,7 @@ public class DomainApplicationUpdateFlowTest
private void doSuccessfulTest() throws Exception { private void doSuccessfulTest() throws Exception {
assertTransactionalFlow(true); assertTransactionalFlow(true);
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse(readFile("domain_update_response.xml")); runFlowAssertResponse(loadFile("domain_update_response.xml"));
// Check that the application was updated. These values came from the xml. // Check that the application was updated. These values came from the xml.
DomainApplication application = reloadDomainApplication(); DomainApplication application = reloadDomainApplication();
assertAboutApplications().that(application) assertAboutApplications().that(application)
@ -145,7 +145,7 @@ public class DomainApplicationUpdateFlowTest
public void testDryRun() throws Exception { public void testDryRun() throws Exception {
persistReferencedEntities(); persistReferencedEntities();
persistApplication(); persistApplication();
dryRunFlowAssertResponse(readFile("domain_update_response.xml")); dryRunFlowAssertResponse(loadFile("domain_update_response.xml"));
} }
@Test @Test
@ -179,7 +179,7 @@ public class DomainApplicationUpdateFlowTest
persistResource( persistResource(
newApplicationBuilder().setRegistrant(Key.create(sh8013)).build()); newApplicationBuilder().setRegistrant(Key.create(sh8013)).build());
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse(readFile("domain_update_response.xml")); runFlowAssertResponse(loadFile("domain_update_response.xml"));
} }
@Test @Test
@ -196,7 +196,7 @@ public class DomainApplicationUpdateFlowTest
DesignatedContact.create(Type.TECH, sh8013Key))) DesignatedContact.create(Type.TECH, sh8013Key)))
.build()); .build());
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse(readFile("domain_update_response.xml")); runFlowAssertResponse(loadFile("domain_update_response.xml"));
} }
@Test @Test
@ -219,7 +219,7 @@ public class DomainApplicationUpdateFlowTest
persistResource(newApplicationBuilder().setDsData(originalDsData).build()); persistResource(newApplicationBuilder().setDsData(originalDsData).build());
assertTransactionalFlow(true); assertTransactionalFlow(true);
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse(readFile("domain_update_response.xml")); runFlowAssertResponse(loadFile("domain_update_response.xml"));
assertAboutApplications().that(reloadDomainApplication()) assertAboutApplications().that(reloadDomainApplication())
.hasExactlyDsData(expectedDsData).and() .hasExactlyDsData(expectedDsData).and()
.hasOnlyOneHistoryEntryWhich() .hasOnlyOneHistoryEntryWhich()
@ -531,7 +531,7 @@ public class DomainApplicationUpdateFlowTest
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, CommitMode.LIVE,
UserPrivileges.SUPERUSER, UserPrivileges.SUPERUSER,
readFile("domain_update_response.xml")); loadFile("domain_update_response.xml"));
} }
@Test @Test
@ -569,7 +569,7 @@ public class DomainApplicationUpdateFlowTest
persistApplication(); persistApplication();
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_update_response.xml")); CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_update_response.xml"));
} }
@Test @Test
@ -590,7 +590,7 @@ public class DomainApplicationUpdateFlowTest
persistApplication(); persistApplication();
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_update_response.xml")); CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_update_response.xml"));
} }
@Test @Test

View file

@ -178,7 +178,7 @@ public class DomainCheckFlowTest
@Test @Test
public void testSuccess_xmlMatches() throws Exception { public void testSuccess_xmlMatches() throws Exception {
persistActiveDomain("example2.tld"); persistActiveDomain("example2.tld");
runFlowAssertResponse(readFile("domain_check_one_tld_response.xml")); runFlowAssertResponse(loadFile("domain_check_one_tld_response.xml"));
} }
@Test @Test
@ -298,7 +298,7 @@ public class DomainCheckFlowTest
persistResource( persistResource(
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_check_one_tld_response.xml")); CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_check_one_tld_response.xml"));
} }
private void doFailingBadLabelTest(String label, Class<? extends Exception> expectedException) private void doFailingBadLabelTest(String label, Class<? extends Exception> expectedException)
@ -433,7 +433,7 @@ public class DomainCheckFlowTest
public void testFeeExtension_v06() throws Exception { public void testFeeExtension_v06() throws Exception {
persistActiveDomain("example1.tld"); persistActiveDomain("example1.tld");
setEppInput("domain_check_fee_v06.xml"); setEppInput("domain_check_fee_v06.xml");
runFlowAssertResponse(readFile("domain_check_fee_response_v06.xml")); runFlowAssertResponse(loadFile("domain_check_fee_response_v06.xml"));
} }
@Test @Test
@ -446,21 +446,21 @@ public class DomainCheckFlowTest
.build()); .build());
persistActiveDomain("example1.tld"); persistActiveDomain("example1.tld");
setEppInput("domain_check_fee_v06.xml"); setEppInput("domain_check_fee_v06.xml");
runFlowAssertResponse(readFile("domain_check_fee_response_v06.xml")); runFlowAssertResponse(loadFile("domain_check_fee_response_v06.xml"));
} }
@Test @Test
public void testFeeExtension_v11() throws Exception { public void testFeeExtension_v11() throws Exception {
persistActiveDomain("example1.tld"); persistActiveDomain("example1.tld");
setEppInput("domain_check_fee_v11.xml"); setEppInput("domain_check_fee_v11.xml");
runFlowAssertResponse(readFile("domain_check_fee_response_v11.xml")); runFlowAssertResponse(loadFile("domain_check_fee_response_v11.xml"));
} }
@Test @Test
public void testFeeExtension_v12() throws Exception { public void testFeeExtension_v12() throws Exception {
persistActiveDomain("example1.tld"); persistActiveDomain("example1.tld");
setEppInput("domain_check_fee_v12.xml"); setEppInput("domain_check_fee_v12.xml");
runFlowAssertResponse(readFile("domain_check_fee_response_v12.xml")); runFlowAssertResponse(loadFile("domain_check_fee_response_v12.xml"));
} }
/** /**
@ -469,7 +469,7 @@ public class DomainCheckFlowTest
@Test @Test
public void testFeeExtension_multipleCommands_v06() throws Exception { public void testFeeExtension_multipleCommands_v06() throws Exception {
setEppInput("domain_check_fee_multiple_commands_v06.xml"); setEppInput("domain_check_fee_multiple_commands_v06.xml");
runFlowAssertResponse(readFile("domain_check_fee_multiple_commands_response_v06.xml")); runFlowAssertResponse(loadFile("domain_check_fee_multiple_commands_response_v06.xml"));
} }
// Version 11 cannot have multiple commands. // Version 11 cannot have multiple commands.
@ -477,7 +477,7 @@ public class DomainCheckFlowTest
@Test @Test
public void testFeeExtension_multipleCommands_v12() throws Exception { public void testFeeExtension_multipleCommands_v12() throws Exception {
setEppInput("domain_check_fee_multiple_commands_v12.xml"); setEppInput("domain_check_fee_multiple_commands_v12.xml");
runFlowAssertResponse(readFile("domain_check_fee_multiple_commands_response_v12.xml")); runFlowAssertResponse(loadFile("domain_check_fee_multiple_commands_response_v12.xml"));
} }
/** Test the same as {@link #testFeeExtension_multipleCommands_v06} with premium labels. */ /** Test the same as {@link #testFeeExtension_multipleCommands_v06} with premium labels. */
@ -485,49 +485,49 @@ public class DomainCheckFlowTest
public void testFeeExtension_premiumLabels_v06() throws Exception { public void testFeeExtension_premiumLabels_v06() throws Exception {
createTld("example"); createTld("example");
setEppInput("domain_check_fee_premium_v06.xml"); setEppInput("domain_check_fee_premium_v06.xml");
runFlowAssertResponse(readFile("domain_check_fee_premium_response_v06.xml")); runFlowAssertResponse(loadFile("domain_check_fee_premium_response_v06.xml"));
} }
@Test @Test
public void testFeeExtension_premiumLabels_v11_create() throws Exception { public void testFeeExtension_premiumLabels_v11_create() throws Exception {
createTld("example"); createTld("example");
setEppInput("domain_check_fee_premium_v11_create.xml"); setEppInput("domain_check_fee_premium_v11_create.xml");
runFlowAssertResponse(readFile("domain_check_fee_premium_response_v11_create.xml")); runFlowAssertResponse(loadFile("domain_check_fee_premium_response_v11_create.xml"));
} }
@Test @Test
public void testFeeExtension_premiumLabels_v11_renew() throws Exception { public void testFeeExtension_premiumLabels_v11_renew() throws Exception {
createTld("example"); createTld("example");
setEppInput("domain_check_fee_premium_v11_renew.xml"); setEppInput("domain_check_fee_premium_v11_renew.xml");
runFlowAssertResponse(readFile("domain_check_fee_premium_response_v11_renew.xml")); runFlowAssertResponse(loadFile("domain_check_fee_premium_response_v11_renew.xml"));
} }
@Test @Test
public void testFeeExtension_premiumLabels_v11_transfer() throws Exception { public void testFeeExtension_premiumLabels_v11_transfer() throws Exception {
createTld("example"); createTld("example");
setEppInput("domain_check_fee_premium_v11_transfer.xml"); setEppInput("domain_check_fee_premium_v11_transfer.xml");
runFlowAssertResponse(readFile("domain_check_fee_premium_response_v11_transfer.xml")); runFlowAssertResponse(loadFile("domain_check_fee_premium_response_v11_transfer.xml"));
} }
@Test @Test
public void testFeeExtension_premiumLabels_v11_restore() throws Exception { public void testFeeExtension_premiumLabels_v11_restore() throws Exception {
createTld("example"); createTld("example");
setEppInput("domain_check_fee_premium_v11_restore.xml"); setEppInput("domain_check_fee_premium_v11_restore.xml");
runFlowAssertResponse(readFile("domain_check_fee_premium_response_v11_restore.xml")); runFlowAssertResponse(loadFile("domain_check_fee_premium_response_v11_restore.xml"));
} }
@Test @Test
public void testFeeExtension_premiumLabels_v11_update() throws Exception { public void testFeeExtension_premiumLabels_v11_update() throws Exception {
createTld("example"); createTld("example");
setEppInput("domain_check_fee_premium_v11_update.xml"); setEppInput("domain_check_fee_premium_v11_update.xml");
runFlowAssertResponse(readFile("domain_check_fee_premium_response_v11_update.xml")); runFlowAssertResponse(loadFile("domain_check_fee_premium_response_v11_update.xml"));
} }
@Test @Test
public void testFeeExtension_premiumLabels_v12() throws Exception { public void testFeeExtension_premiumLabels_v12() throws Exception {
createTld("example"); createTld("example");
setEppInput("domain_check_fee_premium_v12.xml"); setEppInput("domain_check_fee_premium_v12.xml");
runFlowAssertResponse(readFile("domain_check_fee_premium_response_v12.xml")); runFlowAssertResponse(loadFile("domain_check_fee_premium_response_v12.xml"));
} }
@Test @Test
@ -539,7 +539,7 @@ public class DomainCheckFlowTest
.setCreateBillingCost(Money.of(CurrencyUnit.USD, 11.1)) .setCreateBillingCost(Money.of(CurrencyUnit.USD, 11.1))
.build()); .build());
setEppInput("domain_check_fee_fractional.xml"); setEppInput("domain_check_fee_fractional.xml");
runFlowAssertResponse(readFile("domain_check_fee_fractional_response.xml")); runFlowAssertResponse(loadFile("domain_check_fee_fractional_response.xml"));
} }
/** Test that create fees are properly omitted/classed on names on reserved lists. */ /** Test that create fees are properly omitted/classed on names on reserved lists. */
@ -550,7 +550,7 @@ public class DomainCheckFlowTest
.setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70")) .setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70"))
.build()); .build());
setEppInput("domain_check_fee_reserved_v06.xml"); setEppInput("domain_check_fee_reserved_v06.xml");
runFlowAssertResponse(readFile("domain_check_fee_reserved_response_v06.xml")); runFlowAssertResponse(loadFile("domain_check_fee_reserved_response_v06.xml"));
} }
/** The tests must be split up for version 11, which allows only one command at a time. */ /** The tests must be split up for version 11, which allows only one command at a time. */
@ -561,7 +561,7 @@ public class DomainCheckFlowTest
.setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70")) .setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70"))
.build()); .build());
setEppInput("domain_check_fee_reserved_v11_create.xml"); setEppInput("domain_check_fee_reserved_v11_create.xml");
runFlowAssertResponse(readFile("domain_check_fee_reserved_response_v11_create.xml")); runFlowAssertResponse(loadFile("domain_check_fee_reserved_response_v11_create.xml"));
} }
@Test @Test
@ -571,7 +571,7 @@ public class DomainCheckFlowTest
.setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70")) .setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70"))
.build()); .build());
setEppInput("domain_check_fee_reserved_v11_renew.xml"); setEppInput("domain_check_fee_reserved_v11_renew.xml");
runFlowAssertResponse(readFile("domain_check_fee_reserved_response_v11_renew.xml")); runFlowAssertResponse(loadFile("domain_check_fee_reserved_response_v11_renew.xml"));
} }
@Test @Test
@ -581,7 +581,7 @@ public class DomainCheckFlowTest
.setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70")) .setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70"))
.build()); .build());
setEppInput("domain_check_fee_reserved_v11_transfer.xml"); setEppInput("domain_check_fee_reserved_v11_transfer.xml");
runFlowAssertResponse(readFile("domain_check_fee_reserved_response_v11_transfer.xml")); runFlowAssertResponse(loadFile("domain_check_fee_reserved_response_v11_transfer.xml"));
} }
@Test @Test
@ -591,7 +591,7 @@ public class DomainCheckFlowTest
.setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70")) .setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70"))
.build()); .build());
setEppInput("domain_check_fee_reserved_v11_restore.xml"); setEppInput("domain_check_fee_reserved_v11_restore.xml");
runFlowAssertResponse(readFile("domain_check_fee_reserved_response_v11_restore.xml")); runFlowAssertResponse(loadFile("domain_check_fee_reserved_response_v11_restore.xml"));
} }
@Test @Test
@ -601,7 +601,7 @@ public class DomainCheckFlowTest
.setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70")) .setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70"))
.build()); .build());
setEppInput("domain_check_fee_reserved_v12.xml"); setEppInput("domain_check_fee_reserved_v12.xml");
runFlowAssertResponse(readFile("domain_check_fee_reserved_response_v12.xml")); runFlowAssertResponse(loadFile("domain_check_fee_reserved_response_v12.xml"));
} }
@Test @Test
@ -612,7 +612,7 @@ public class DomainCheckFlowTest
.setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70")) .setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70"))
.build()); .build());
setEppInput("domain_check_fee_reserved_v06.xml"); setEppInput("domain_check_fee_reserved_v06.xml");
runFlowAssertResponse(readFile("domain_check_fee_reserved_sunrise_response_v06.xml")); runFlowAssertResponse(loadFile("domain_check_fee_reserved_sunrise_response_v06.xml"));
} }
@Test @Test
@ -624,7 +624,7 @@ public class DomainCheckFlowTest
.setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70")) .setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70"))
.build()); .build());
setEppInput("domain_check_fee_reserved_v11_create.xml"); setEppInput("domain_check_fee_reserved_v11_create.xml");
runFlowAssertResponse(readFile("domain_check_fee_reserved_sunrise_response_v11_create.xml")); runFlowAssertResponse(loadFile("domain_check_fee_reserved_sunrise_response_v11_create.xml"));
} }
@Test @Test
@ -636,7 +636,7 @@ public class DomainCheckFlowTest
.setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70")) .setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70"))
.build()); .build());
setEppInput("domain_check_fee_reserved_v11_renew.xml"); setEppInput("domain_check_fee_reserved_v11_renew.xml");
runFlowAssertResponse(readFile("domain_check_fee_reserved_sunrise_response_v11_renew.xml")); runFlowAssertResponse(loadFile("domain_check_fee_reserved_sunrise_response_v11_renew.xml"));
} }
@Test @Test
@ -648,7 +648,7 @@ public class DomainCheckFlowTest
.setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70")) .setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70"))
.build()); .build());
setEppInput("domain_check_fee_reserved_v11_transfer.xml"); setEppInput("domain_check_fee_reserved_v11_transfer.xml");
runFlowAssertResponse(readFile("domain_check_fee_reserved_sunrise_response_v11_transfer.xml")); runFlowAssertResponse(loadFile("domain_check_fee_reserved_sunrise_response_v11_transfer.xml"));
} }
@Test @Test
@ -660,7 +660,7 @@ public class DomainCheckFlowTest
.setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70")) .setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70"))
.build()); .build());
setEppInput("domain_check_fee_reserved_v11_restore.xml"); setEppInput("domain_check_fee_reserved_v11_restore.xml");
runFlowAssertResponse(readFile("domain_check_fee_reserved_sunrise_response_v11_restore.xml")); runFlowAssertResponse(loadFile("domain_check_fee_reserved_sunrise_response_v11_restore.xml"));
} }
@Test @Test
@ -671,7 +671,7 @@ public class DomainCheckFlowTest
.setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70")) .setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70"))
.build()); .build());
setEppInput("domain_check_fee_reserved_v12.xml"); setEppInput("domain_check_fee_reserved_v12.xml");
runFlowAssertResponse(readFile("domain_check_fee_reserved_sunrise_response_v12.xml")); runFlowAssertResponse(loadFile("domain_check_fee_reserved_sunrise_response_v12.xml"));
} }
@Test @Test
@ -861,7 +861,7 @@ public class DomainCheckFlowTest
clock.nowUtc().plusDays(2), Money.of(USD, 0))) clock.nowUtc().plusDays(2), Money.of(USD, 0)))
.build()); .build());
setEppInput(inputFile); setEppInput(inputFile);
runFlowAssertResponse(readFile(outputFile)); runFlowAssertResponse(loadFile(outputFile));
} }
@Test @Test

View file

@ -52,7 +52,7 @@ public class DomainClaimsCheckFlowTest
assertTransactionalFlow(false); assertTransactionalFlow(false);
assertNoHistory(); // Checks don't create a history event. assertNoHistory(); // Checks don't create a history event.
assertNoBillingEvents(); // Checks are always free. assertNoBillingEvents(); // Checks are always free.
runFlowAssertResponse(readFile(expectedXmlFilename)); runFlowAssertResponse(loadFile(expectedXmlFilename));
} }
@Test @Test
@ -130,7 +130,7 @@ public class DomainClaimsCheckFlowTest
assertNoHistory(); // Checks don't create a history event. assertNoHistory(); // Checks don't create a history event.
assertNoBillingEvents(); // Checks are always free. assertNoBillingEvents(); // Checks are always free.
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_check_claims_response.xml")); CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_check_claims_response.xml"));
} }
@Test @Test

View file

@ -48,7 +48,6 @@ import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued;
import static google.registry.testing.TaskQueueHelper.assertNoDnsTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertNoDnsTasksEnqueued;
import static google.registry.testing.TaskQueueHelper.assertNoTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertNoTasksEnqueued;
import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued;
import static google.registry.testing.TestDataHelper.loadFileWithSubstitutions;
import static google.registry.tmch.LordnTask.QUEUE_CLAIMS; import static google.registry.tmch.LordnTask.QUEUE_CLAIMS;
import static google.registry.tmch.LordnTask.QUEUE_SUNRISE; import static google.registry.tmch.LordnTask.QUEUE_SUNRISE;
import static google.registry.util.DateTimeUtils.END_OF_TIME; import static google.registry.util.DateTimeUtils.END_OF_TIME;
@ -331,7 +330,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
Map<String, String> substitutions) throws Exception { Map<String, String> substitutions) throws Exception {
assertTransactionalFlow(true); assertTransactionalFlow(true);
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, userPrivileges, readFile(responseXmlFile, substitutions)); CommitMode.LIVE, userPrivileges, loadFile(responseXmlFile, substitutions));
assertSuccessfulCreate(domainTld, false); assertSuccessfulCreate(domainTld, false);
assertNoLordn(); assertNoLordn();
} }
@ -358,7 +357,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
@Test @Test
public void testDryRun() throws Exception { public void testDryRun() throws Exception {
persistContactsAndHosts(); persistContactsAndHosts();
dryRunFlowAssertResponse(readFile("domain_create_response.xml")); dryRunFlowAssertResponse(loadFile("domain_create_response.xml"));
} }
@Test @Test
@ -373,8 +372,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_with_tld.xml", ImmutableMap.of("TLD", "foo.tld")); setEppInput("domain_create_with_tld.xml", ImmutableMap.of("TLD", "foo.tld"));
persistContactsAndHosts("foo.tld"); persistContactsAndHosts("foo.tld");
assertTransactionalFlow(true); assertTransactionalFlow(true);
String expectedResponseXml = loadFileWithSubstitutions( String expectedResponseXml = loadFile(
DomainCreateFlowTest.class,
"domain_create_response_wildcard.xml", "domain_create_response_wildcard.xml",
ImmutableMap.of("DOMAIN", "example.foo.tld")); ImmutableMap.of("DOMAIN", "example.foo.tld"));
runFlowAssertResponse(CommitMode.LIVE, UserPrivileges.NORMAL, expectedResponseXml); runFlowAssertResponse(CommitMode.LIVE, UserPrivileges.NORMAL, expectedResponseXml);
@ -405,7 +403,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
eppRequestSource = EppRequestSource.TOOL; eppRequestSource = EppRequestSource.TOOL;
setEppInput("domain_create_anchor_tenant.xml"); setEppInput("domain_create_anchor_tenant.xml");
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse(readFile("domain_create_response.xml")); runFlowAssertResponse(loadFile("domain_create_response.xml"));
assertSuccessfulCreate("tld", true); assertSuccessfulCreate("tld", true);
assertNoLordn(); assertNoLordn();
} }
@ -424,7 +422,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.build()); .build());
setEppInput("domain_create_lrp.xml"); setEppInput("domain_create_lrp.xml");
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse(readFile("domain_create_response.xml")); runFlowAssertResponse(loadFile("domain_create_response.xml"));
assertSuccessfulCreate("tld", false); assertSuccessfulCreate("tld", false);
assertNoLordn(); assertNoLordn();
assertThat(ofy().load().entity(token).now().getRedemptionHistoryEntry()).isNotNull(); assertThat(ofy().load().entity(token).now().getRedemptionHistoryEntry()).isNotNull();
@ -446,7 +444,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.build()); .build());
setEppInput("domain_create_lrp.xml"); setEppInput("domain_create_lrp.xml");
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse(readFile("domain_create_response.xml")); runFlowAssertResponse(loadFile("domain_create_response.xml"));
assertSuccessfulCreate("tld", false); assertSuccessfulCreate("tld", false);
assertNoLordn(); assertNoLordn();
assertThat(ofy().load().entity(token).now().getRedemptionHistoryEntry()).isNull(); assertThat(ofy().load().entity(token).now().getRedemptionHistoryEntry()).isNull();
@ -722,7 +720,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
createTld("xn--q9jyb4c"); createTld("xn--q9jyb4c");
setEppInput("domain_create_idn_minna.xml"); setEppInput("domain_create_idn_minna.xml");
persistContactsAndHosts("net"); persistContactsAndHosts("net");
runFlowAssertResponse(readFile("domain_create_response_idn_minna.xml")); runFlowAssertResponse(loadFile("domain_create_response_idn_minna.xml"));
assertSuccessfulCreate("xn--q9jyb4c", false); assertSuccessfulCreate("xn--q9jyb4c", false);
assertDnsTasksEnqueued("xn--abc-873b2e7eb1k8a4lpjvv.xn--q9jyb4c"); assertDnsTasksEnqueued("xn--abc-873b2e7eb1k8a4lpjvv.xn--q9jyb4c");
} }
@ -731,7 +729,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testSuccess_noNameserversOrDsData() throws Exception { public void testSuccess_noNameserversOrDsData() throws Exception {
setEppInput("domain_create_no_hosts_or_dsdata.xml"); setEppInput("domain_create_no_hosts_or_dsdata.xml");
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse(readFile("domain_create_response.xml")); runFlowAssertResponse(loadFile("domain_create_response.xml"));
assertNoDnsTasksEnqueued(); assertNoDnsTasksEnqueued();
} }
@ -739,7 +737,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testSuccess_periodNotSpecified() throws Exception { public void testSuccess_periodNotSpecified() throws Exception {
setEppInput("domain_create_missing_period.xml"); setEppInput("domain_create_missing_period.xml");
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse(readFile("domain_create_response.xml"), runFlowAssertResponse(loadFile("domain_create_response.xml"),
"epp.response.resData.creData.exDate"); // Ignore expiration date; we verify it below "epp.response.resData.creData.exDate"); // Ignore expiration date; we verify it below
assertAboutDomains().that(reloadResourceByForeignKey()) assertAboutDomains().that(reloadResourceByForeignKey())
.hasRegistrationExpirationTime(clock.nowUtc().plusYears(1)); .hasRegistrationExpirationTime(clock.nowUtc().plusYears(1));
@ -759,7 +757,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
clock.setTo(DateTime.parse("2009-08-16T09:00:00.0Z")); clock.setTo(DateTime.parse("2009-08-16T09:00:00.0Z"));
setEppInput("domain_create_claim_notice.xml"); setEppInput("domain_create_claim_notice.xml");
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse(readFile("domain_create_response_claims.xml")); runFlowAssertResponse(loadFile("domain_create_response_claims.xml"));
assertSuccessfulCreate("tld", false); assertSuccessfulCreate("tld", false);
assertDnsTasksEnqueued("example-one.tld"); assertDnsTasksEnqueued("example-one.tld");
assertClaimsLordn(); assertClaimsLordn();
@ -773,7 +771,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
persistResource(Registry.get("tld").asBuilder() persistResource(Registry.get("tld").asBuilder()
.setClaimsPeriodEnd(clock.nowUtc()) .setClaimsPeriodEnd(clock.nowUtc())
.build()); .build());
runFlowAssertResponse(readFile("domain_create_response.xml")); runFlowAssertResponse(loadFile("domain_create_response.xml"));
assertSuccessfulCreate("tld", false); assertSuccessfulCreate("tld", false);
assertDnsTasksEnqueued("example.tld"); assertDnsTasksEnqueued("example.tld");
} }
@ -971,7 +969,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, CommitMode.LIVE,
UserPrivileges.SUPERUSER, UserPrivileges.SUPERUSER,
readFile("domain_create_anchor_response.xml")); loadFile("domain_create_anchor_response.xml"));
assertSuccessfulCreate("tld", true); assertSuccessfulCreate("tld", true);
// Token should not be marked as used, since interpreting the authcode as anchor tenant should // Token should not be marked as used, since interpreting the authcode as anchor tenant should
// take precedence. // take precedence.
@ -982,7 +980,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testSuccess_anchorTenantViaAuthCode() throws Exception { public void testSuccess_anchorTenantViaAuthCode() throws Exception {
setEppInput("domain_create_anchor_authcode.xml"); setEppInput("domain_create_anchor_authcode.xml");
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse(readFile("domain_create_anchor_response.xml")); runFlowAssertResponse(loadFile("domain_create_anchor_response.xml"));
assertSuccessfulCreate("tld", true); assertSuccessfulCreate("tld", true);
assertNoLordn(); assertNoLordn();
} }
@ -994,7 +992,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.build()); .build());
setEppInput("domain_create_anchor_authcode.xml"); setEppInput("domain_create_anchor_authcode.xml");
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse(readFile("domain_create_anchor_response.xml")); runFlowAssertResponse(loadFile("domain_create_anchor_response.xml"));
assertSuccessfulCreate("tld", true); assertSuccessfulCreate("tld", true);
assertNoLordn(); assertNoLordn();
} }
@ -1007,7 +1005,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
eppRequestSource = EppRequestSource.TOOL; eppRequestSource = EppRequestSource.TOOL;
setEppInput("domain_create_anchor_tenant.xml"); setEppInput("domain_create_anchor_tenant.xml");
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse(readFile("domain_create_response.xml")); runFlowAssertResponse(loadFile("domain_create_response.xml"));
assertSuccessfulCreate("tld", true); assertSuccessfulCreate("tld", true);
assertNoLordn(); assertNoLordn();
} }
@ -1023,7 +1021,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_claim_notice.xml"); setEppInput("domain_create_claim_notice.xml");
clock.setTo(DateTime.parse("2009-08-16T09:00:00.0Z")); clock.setTo(DateTime.parse("2009-08-16T09:00:00.0Z"));
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse(readFile("domain_create_response_claims.xml")); runFlowAssertResponse(loadFile("domain_create_response_claims.xml"));
assertSuccessfulCreate("tld", true); assertSuccessfulCreate("tld", true);
assertDnsTasksEnqueued("example-one.tld"); assertDnsTasksEnqueued("example-one.tld");
assertClaimsLordn(); assertClaimsLordn();
@ -1036,7 +1034,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, CommitMode.LIVE,
UserPrivileges.SUPERUSER, UserPrivileges.SUPERUSER,
readFile("domain_create_reserved_response.xml")); loadFile("domain_create_reserved_response.xml"));
assertSuccessfulCreate("tld", false); assertSuccessfulCreate("tld", false);
} }
@ -1198,7 +1196,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, CommitMode.LIVE,
UserPrivileges.SUPERUSER, UserPrivileges.SUPERUSER,
readFile("domain_create_response_premium.xml")); loadFile("domain_create_response_premium.xml"));
assertSuccessfulCreate("example", false); assertSuccessfulCreate("example", false);
} }
@ -1211,7 +1209,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, CommitMode.LIVE,
UserPrivileges.NORMAL, UserPrivileges.NORMAL,
readFile("domain_create_response_wildcard.xml", substitutions)); loadFile("domain_create_response_wildcard.xml", substitutions));
DomainResource domain = reloadResourceByForeignKey(); DomainResource domain = reloadResourceByForeignKey();
HistoryEntry historyEntry = getHistoryEntries(domain).get(0); HistoryEntry historyEntry = getHistoryEntries(domain).get(0);
assertPollMessagesForResource( assertPollMessagesForResource(
@ -1557,7 +1555,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_registration_qlp_sunrise.xml"); setEppInput("domain_create_registration_qlp_sunrise.xml");
eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata. eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata.
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse(readFile("domain_create_response.xml")); runFlowAssertResponse(loadFile("domain_create_response.xml"));
assertSuccessfulCreate("tld", true); assertSuccessfulCreate("tld", true);
assertNoLordn(); assertNoLordn();
} }
@ -1569,7 +1567,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_registration_qlp_sunrise_encoded_signed_mark.xml"); setEppInput("domain_create_registration_qlp_sunrise_encoded_signed_mark.xml");
eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata. eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata.
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse(readFile("domain_create_response_encoded_signed_mark_name.xml")); runFlowAssertResponse(loadFile("domain_create_response_encoded_signed_mark_name.xml"));
assertSuccessfulCreate("tld", true); assertSuccessfulCreate("tld", true);
assertSunriseLordn(); assertSunriseLordn();
} }
@ -1581,7 +1579,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_registration_qlp_sunrise_claims_notice.xml"); setEppInput("domain_create_registration_qlp_sunrise_claims_notice.xml");
eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata. eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata.
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse(readFile("domain_create_response_claims.xml")); runFlowAssertResponse(loadFile("domain_create_response_claims.xml"));
assertSuccessfulCreate("tld", true); assertSuccessfulCreate("tld", true);
assertClaimsLordn(); assertClaimsLordn();
} }
@ -1622,7 +1620,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_registration_qlp_sunrush.xml"); setEppInput("domain_create_registration_qlp_sunrush.xml");
eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata. eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata.
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse(readFile("domain_create_response.xml")); runFlowAssertResponse(loadFile("domain_create_response.xml"));
assertSuccessfulCreate("tld", true); assertSuccessfulCreate("tld", true);
assertNoLordn(); assertNoLordn();
} }
@ -1634,7 +1632,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_registration_qlp_sunrush_encoded_signed_mark.xml"); setEppInput("domain_create_registration_qlp_sunrush_encoded_signed_mark.xml");
eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata. eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata.
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse(readFile("domain_create_response_encoded_signed_mark_name.xml")); runFlowAssertResponse(loadFile("domain_create_response_encoded_signed_mark_name.xml"));
assertSuccessfulCreate("tld", true); assertSuccessfulCreate("tld", true);
assertSunriseLordn(); assertSunriseLordn();
} }
@ -1646,7 +1644,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_registration_qlp_sunrush_claims_notice.xml"); setEppInput("domain_create_registration_qlp_sunrush_claims_notice.xml");
eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata. eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata.
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse(readFile("domain_create_response_claims.xml")); runFlowAssertResponse(loadFile("domain_create_response_claims.xml"));
assertSuccessfulCreate("tld", true); assertSuccessfulCreate("tld", true);
assertClaimsLordn(); assertClaimsLordn();
} }
@ -1674,7 +1672,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_registration_qlp_landrush.xml"); setEppInput("domain_create_registration_qlp_landrush.xml");
eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata. eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata.
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse(readFile("domain_create_response.xml")); runFlowAssertResponse(loadFile("domain_create_response.xml"));
assertSuccessfulCreate("tld", true); assertSuccessfulCreate("tld", true);
assertNoLordn(); assertNoLordn();
} }
@ -1698,7 +1696,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_registration_qlp_landrush_claims_notice.xml"); setEppInput("domain_create_registration_qlp_landrush_claims_notice.xml");
eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata. eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata.
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse(readFile("domain_create_response_claims.xml")); runFlowAssertResponse(loadFile("domain_create_response_claims.xml"));
assertSuccessfulCreate("tld", true); assertSuccessfulCreate("tld", true);
assertClaimsLordn(); assertClaimsLordn();
} }

View file

@ -249,13 +249,13 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
setUpSuccessfulTest(); setUpSuccessfulTest();
setUpGracePeriods(GracePeriod.create( setUpGracePeriods(GracePeriod.create(
GracePeriodStatus.ADD, TIME_BEFORE_FLOW.plusDays(1), "foo", null)); GracePeriodStatus.ADD, TIME_BEFORE_FLOW.plusDays(1), "foo", null));
dryRunFlowAssertResponse(readFile("domain_delete_response.xml")); dryRunFlowAssertResponse(loadFile("domain_delete_response.xml"));
} }
@Test @Test
public void testDryRun_noGracePeriods() throws Exception { public void testDryRun_noGracePeriods() throws Exception {
setUpSuccessfulTest(); setUpSuccessfulTest();
dryRunFlowAssertResponse(readFile("domain_delete_response_pending.xml")); dryRunFlowAssertResponse(loadFile("domain_delete_response_pending.xml"));
} }
private void doImmediateDeleteTest(GracePeriodStatus gracePeriodStatus, String responseFilename) private void doImmediateDeleteTest(GracePeriodStatus gracePeriodStatus, String responseFilename)
@ -275,7 +275,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
// We should see exactly one poll message, which is for the autorenew 1 month in the future. // We should see exactly one poll message, which is for the autorenew 1 month in the future.
assertPollMessages(createAutorenewPollMessage("TheRegistrar").build()); assertPollMessages(createAutorenewPollMessage("TheRegistrar").build());
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse(readFile(responseFilename, substitutions)); runFlowAssertResponse(loadFile(responseFilename, substitutions));
// Check that the domain is fully deleted. // Check that the domain is fully deleted.
assertThat(reloadResourceByForeignKey()).isNull(); assertThat(reloadResourceByForeignKey()).isNull();
// The add grace period is for a billable action, so it should trigger a cancellation. // The add grace period is for a billable action, so it should trigger a cancellation.
@ -334,7 +334,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
assertPollMessages(createAutorenewPollMessage("TheRegistrar").build()); assertPollMessages(createAutorenewPollMessage("TheRegistrar").build());
DateTime originalExpirationTime = domain.getRegistrationExpirationTime(); DateTime originalExpirationTime = domain.getRegistrationExpirationTime();
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse(readFile(responseFilename, substitutions)); runFlowAssertResponse(loadFile(responseFilename, substitutions));
DomainResource resource = reloadResourceByForeignKey(); DomainResource resource = reloadResourceByForeignKey();
// Check that the domain is in the pending delete state. // Check that the domain is in the pending delete state.
assertAboutDomains().that(resource) assertAboutDomains().that(resource)
@ -403,7 +403,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
.setEventTime(A_MONTH_FROM_NOW.minusYears(3)) .setEventTime(A_MONTH_FROM_NOW.minusYears(3))
.build()); .build());
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse(readFile("domain_delete_response_pending.xml")); runFlowAssertResponse(loadFile("domain_delete_response_pending.xml"));
// There should now be two poll messages; one for the delete of the domain (in the future), and // There should now be two poll messages; one for the delete of the domain (in the future), and
// another for the unacked autorenew messages. // another for the unacked autorenew messages.
DateTime deletionTime = reloadResourceByForeignKey().getDeletionTime(); DateTime deletionTime = reloadResourceByForeignKey().getDeletionTime();
@ -440,7 +440,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
removeServiceExtensionUri(ServiceExtension.FEE_0_12.getUri()); removeServiceExtensionUri(ServiceExtension.FEE_0_12.getUri());
setUpAutorenewGracePeriod(); setUpAutorenewGracePeriod();
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse(readFile("domain_delete_response_autorenew_fee.xml", FEE_06_MAP)); runFlowAssertResponse(loadFile("domain_delete_response_autorenew_fee.xml", FEE_06_MAP));
} }
@Test @Test
@ -448,14 +448,14 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
removeServiceExtensionUri(ServiceExtension.FEE_0_12.getUri()); removeServiceExtensionUri(ServiceExtension.FEE_0_12.getUri());
setUpAutorenewGracePeriod(); setUpAutorenewGracePeriod();
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse(readFile("domain_delete_response_autorenew_fee.xml", FEE_11_MAP)); runFlowAssertResponse(loadFile("domain_delete_response_autorenew_fee.xml", FEE_11_MAP));
} }
@Test @Test
public void testSuccess_autoRenewGracePeriod_v12() throws Exception { public void testSuccess_autoRenewGracePeriod_v12() throws Exception {
setUpAutorenewGracePeriod(); setUpAutorenewGracePeriod();
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse(readFile("domain_delete_response_autorenew_fee.xml", FEE_12_MAP)); runFlowAssertResponse(loadFile("domain_delete_response_autorenew_fee.xml", FEE_12_MAP));
} }
@Test @Test
@ -470,7 +470,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
.build()); .build());
setUpAutorenewGracePeriod(); setUpAutorenewGracePeriod();
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse(readFile("domain_delete_response_autorenew_fee.xml", FEE_06_MAP)); runFlowAssertResponse(loadFile("domain_delete_response_autorenew_fee.xml", FEE_06_MAP));
} }
@Test @Test
@ -484,7 +484,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
.build()); .build());
setUpAutorenewGracePeriod(); setUpAutorenewGracePeriod();
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse(readFile("domain_delete_response_autorenew_fee.xml", FEE_11_MAP)); runFlowAssertResponse(loadFile("domain_delete_response_autorenew_fee.xml", FEE_11_MAP));
} }
@Test @Test
@ -497,7 +497,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
.build()); .build());
setUpAutorenewGracePeriod(); setUpAutorenewGracePeriod();
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse(readFile("domain_delete_response_autorenew_fee.xml", FEE_12_MAP)); runFlowAssertResponse(loadFile("domain_delete_response_autorenew_fee.xml", FEE_12_MAP));
} }
@Test @Test
@ -505,7 +505,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
setClientIdForFlow("TheRegistrar"); setClientIdForFlow("TheRegistrar");
setUpSuccessfulTest(); setUpSuccessfulTest();
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse(readFile("domain_delete_response_pending.xml")); runFlowAssertResponse(loadFile("domain_delete_response_pending.xml"));
DomainResource domain = reloadResourceByForeignKey(); DomainResource domain = reloadResourceByForeignKey();
assertThat(domain.getTransferData()).isEqualTo(TransferData.EMPTY); assertThat(domain.getTransferData()).isEqualTo(TransferData.EMPTY);
} }
@ -518,7 +518,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
TransferData oldTransferData = TransferData oldTransferData =
persistWithPendingTransfer(reloadResourceByForeignKey()).getTransferData(); persistWithPendingTransfer(reloadResourceByForeignKey()).getTransferData();
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse(readFile("domain_delete_response_pending.xml")); runFlowAssertResponse(loadFile("domain_delete_response_pending.xml"));
DomainResource domain = reloadResourceByForeignKey(); DomainResource domain = reloadResourceByForeignKey();
// Check that the domain is in the pending delete state. // Check that the domain is in the pending delete state.
// The PENDING_TRANSFER status should be gone. // The PENDING_TRANSFER status should be gone.
@ -611,7 +611,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
.setDeletionTime(START_OF_TIME) .setDeletionTime(START_OF_TIME)
.build()); .build());
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse(readFile("domain_delete_response.xml")); runFlowAssertResponse(loadFile("domain_delete_response.xml"));
assertDnsTasksEnqueued("example.tld"); assertDnsTasksEnqueued("example.tld");
assertAutorenewClosedAndCancellationCreatedFor( assertAutorenewClosedAndCancellationCreatedFor(
graceBillingEvent, graceBillingEvent,
@ -627,7 +627,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
.setDeletionTime(clock.nowUtc().minusDays(1)) .setDeletionTime(clock.nowUtc().minusDays(1))
.build()); .build());
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse(readFile("domain_delete_response_pending.xml")); runFlowAssertResponse(loadFile("domain_delete_response_pending.xml"));
assertDnsTasksEnqueued("example.tld"); assertDnsTasksEnqueued("example.tld");
assertOnlyBillingEventIsClosedAutorenew("TheRegistrar"); assertOnlyBillingEventIsClosedAutorenew("TheRegistrar");
} }
@ -646,7 +646,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
setUpSuccessfulTest(); setUpSuccessfulTest();
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_delete_response_pending.xml")); CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_delete_response_pending.xml"));
} }
@Test @Test
@ -694,7 +694,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
setUpSuccessfulTest(); setUpSuccessfulTest();
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_delete_response_pending.xml")); CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_delete_response_pending.xml"));
} }
@Test @Test
@ -713,7 +713,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_delete_response_pending.xml")); CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_delete_response_pending.xml"));
} }
@Test @Test
@ -951,7 +951,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
setUpSuccessfulTest(); setUpSuccessfulTest();
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_delete_response_pending.xml")); CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_delete_response_pending.xml"));
DomainResource resource = reloadResourceByForeignKey(); DomainResource resource = reloadResourceByForeignKey();
assertAboutDomains() assertAboutDomains()
.that(resource) .that(resource)
@ -977,7 +977,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
setUpSuccessfulTest(); setUpSuccessfulTest();
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_delete_response_pending.xml")); CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_delete_response_pending.xml"));
DomainResource resource = reloadResourceByForeignKey(); DomainResource resource = reloadResourceByForeignKey();
assertAboutDomains() assertAboutDomains()
.that(resource) .that(resource)
@ -997,7 +997,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
setUpSuccessfulTest(); setUpSuccessfulTest();
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_delete_response_pending.xml")); CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_delete_response_pending.xml"));
DomainResource resource = reloadResourceByForeignKey(); DomainResource resource = reloadResourceByForeignKey();
assertAboutDomains() assertAboutDomains()
.that(resource) .that(resource)
@ -1022,7 +1022,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
setUpSuccessfulTest(); setUpSuccessfulTest();
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_delete_response.xml")); CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_delete_response.xml"));
assertThat(reloadResourceByForeignKey()).isNull(); assertThat(reloadResourceByForeignKey()).isNull();
} }
} }

View file

@ -23,7 +23,6 @@ import static google.registry.testing.DatastoreHelper.newDomainResource;
import static google.registry.testing.DatastoreHelper.persistActiveContact; import static google.registry.testing.DatastoreHelper.persistActiveContact;
import static google.registry.testing.DatastoreHelper.persistActiveHost; import static google.registry.testing.DatastoreHelper.persistActiveHost;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.TestDataHelper.loadFileWithSubstitutions;
import com.google.common.base.Predicates; import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
@ -123,8 +122,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
private void doSuccessfulTest(String expectedXmlFilename, boolean inactive) throws Exception { private void doSuccessfulTest(String expectedXmlFilename, boolean inactive) throws Exception {
assertTransactionalFlow(false); assertTransactionalFlow(false);
String expected = loadFileWithSubstitutions( String expected = loadFile(expectedXmlFilename, ImmutableMap.of("ROID", "2FF-TLD"));
getClass(), expectedXmlFilename, ImmutableMap.of("ROID", "2FF-TLD"));
if (inactive) { if (inactive) {
expected = expected.replaceAll("\"ok\"", "\"inactive\""); expected = expected.replaceAll("\"ok\"", "\"inactive\"");
} }

View file

@ -147,7 +147,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
assertTransactionalFlow(true); assertTransactionalFlow(true);
DateTime currentExpiration = reloadResourceByForeignKey().getRegistrationExpirationTime(); DateTime currentExpiration = reloadResourceByForeignKey().getRegistrationExpirationTime();
DateTime newExpiration = currentExpiration.plusYears(renewalYears); DateTime newExpiration = currentExpiration.plusYears(renewalYears);
runFlowAssertResponse(readFile(responseFilename, substitutions)); runFlowAssertResponse(loadFile(responseFilename, substitutions));
DomainResource domain = reloadResourceByForeignKey(); DomainResource domain = reloadResourceByForeignKey();
HistoryEntry historyEntryDomainRenew = HistoryEntry historyEntryDomainRenew =
getOnlyHistoryEntryOfType(domain, HistoryEntry.Type.DOMAIN_RENEW); getOnlyHistoryEntryOfType(domain, HistoryEntry.Type.DOMAIN_RENEW);
@ -215,7 +215,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
@Test @Test
public void testDryRun() throws Exception { public void testDryRun() throws Exception {
persistDomain(); persistDomain();
dryRunFlowAssertResponse(readFile("domain_renew_response.xml")); dryRunFlowAssertResponse(loadFile("domain_renew_response.xml"));
} }
@Test @Test
@ -385,7 +385,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
ofy().load().key(reloadResourceByForeignKey().getAutorenewPollMessage()).now().asBuilder() ofy().load().key(reloadResourceByForeignKey().getAutorenewPollMessage()).now().asBuilder()
.setEventTime(expirationTime.minusYears(1)) .setEventTime(expirationTime.minusYears(1))
.build()); .build());
runFlowAssertResponse(readFile("domain_renew_response.xml")); runFlowAssertResponse(loadFile("domain_renew_response.xml"));
HistoryEntry historyEntryDomainRenew = HistoryEntry historyEntryDomainRenew =
getOnlyHistoryEntryOfType(reloadResourceByForeignKey(), HistoryEntry.Type.DOMAIN_RENEW); getOnlyHistoryEntryOfType(reloadResourceByForeignKey(), HistoryEntry.Type.DOMAIN_RENEW);
assertPollMessages( assertPollMessages(
@ -618,7 +618,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
sessionMetadata.setClientId("NewRegistrar"); sessionMetadata.setClientId("NewRegistrar");
persistDomain(); persistDomain();
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_renew_response.xml")); CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_renew_response.xml"));
} }
@Test @Test
@ -636,7 +636,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
persistDomain(); persistDomain();
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_renew_response.xml")); CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_renew_response.xml"));
} }
@Test @Test

View file

@ -115,7 +115,7 @@ public class DomainRestoreRequestFlowTest extends
public void testDryRun() throws Exception { public void testDryRun() throws Exception {
setEppInput("domain_update_restore_request.xml"); setEppInput("domain_update_restore_request.xml");
persistPendingDeleteDomain(); persistPendingDeleteDomain();
dryRunFlowAssertResponse(readFile("domain_update_response.xml")); dryRunFlowAssertResponse(loadFile("domain_update_response.xml"));
} }
@Test @Test
@ -126,7 +126,7 @@ public class DomainRestoreRequestFlowTest extends
// Double check that we see a poll message in the future for when the delete happens. // Double check that we see a poll message in the future for when the delete happens.
assertThat(getPollMessages("TheRegistrar", clock.nowUtc().plusMonths(1))) assertThat(getPollMessages("TheRegistrar", clock.nowUtc().plusMonths(1)))
.hasSize(1); .hasSize(1);
runFlowAssertResponse(readFile("domain_update_response.xml")); runFlowAssertResponse(loadFile("domain_update_response.xml"));
DomainResource domain = reloadResourceByForeignKey(); DomainResource domain = reloadResourceByForeignKey();
HistoryEntry historyEntryDomainRestore = HistoryEntry historyEntryDomainRestore =
getOnlyHistoryEntryOfType(domain, HistoryEntry.Type.DOMAIN_RESTORE); getOnlyHistoryEntryOfType(domain, HistoryEntry.Type.DOMAIN_RESTORE);
@ -191,41 +191,41 @@ public class DomainRestoreRequestFlowTest extends
public void testSuccess_fee_v06() throws Exception { public void testSuccess_fee_v06() throws Exception {
setEppInput("domain_update_restore_request_fee.xml", FEE_06_MAP); setEppInput("domain_update_restore_request_fee.xml", FEE_06_MAP);
persistPendingDeleteDomain(); persistPendingDeleteDomain();
runFlowAssertResponse(readFile("domain_update_restore_request_response_fee.xml", FEE_06_MAP)); runFlowAssertResponse(loadFile("domain_update_restore_request_response_fee.xml", FEE_06_MAP));
} }
@Test @Test
public void testSuccess_fee_v11() throws Exception { public void testSuccess_fee_v11() throws Exception {
setEppInput("domain_update_restore_request_fee.xml", FEE_11_MAP); setEppInput("domain_update_restore_request_fee.xml", FEE_11_MAP);
persistPendingDeleteDomain(); persistPendingDeleteDomain();
runFlowAssertResponse(readFile("domain_update_restore_request_response_fee.xml", FEE_11_MAP)); runFlowAssertResponse(loadFile("domain_update_restore_request_response_fee.xml", FEE_11_MAP));
} }
@Test @Test
public void testSuccess_fee_v12() throws Exception { public void testSuccess_fee_v12() throws Exception {
setEppInput("domain_update_restore_request_fee.xml", FEE_12_MAP); setEppInput("domain_update_restore_request_fee.xml", FEE_12_MAP);
persistPendingDeleteDomain(); persistPendingDeleteDomain();
runFlowAssertResponse(readFile("domain_update_restore_request_response_fee.xml", FEE_12_MAP)); runFlowAssertResponse(loadFile("domain_update_restore_request_response_fee.xml", FEE_12_MAP));
} }
@Test @Test
public void testSuccess_fee_withDefaultAttributes_v06() throws Exception { public void testSuccess_fee_withDefaultAttributes_v06() throws Exception {
setEppInput("domain_update_restore_request_fee_defaults.xml", FEE_06_MAP); setEppInput("domain_update_restore_request_fee_defaults.xml", FEE_06_MAP);
persistPendingDeleteDomain(); persistPendingDeleteDomain();
runFlowAssertResponse(readFile("domain_update_restore_request_response_fee.xml", FEE_06_MAP)); runFlowAssertResponse(loadFile("domain_update_restore_request_response_fee.xml", FEE_06_MAP));
} }
@Test @Test
public void testSuccess_fee_withDefaultAttributes_v11() throws Exception { public void testSuccess_fee_withDefaultAttributes_v11() throws Exception {
setEppInput("domain_update_restore_request_fee_defaults.xml", FEE_11_MAP); setEppInput("domain_update_restore_request_fee_defaults.xml", FEE_11_MAP);
persistPendingDeleteDomain(); persistPendingDeleteDomain();
runFlowAssertResponse(readFile("domain_update_restore_request_response_fee.xml", FEE_11_MAP)); runFlowAssertResponse(loadFile("domain_update_restore_request_response_fee.xml", FEE_11_MAP));
} }
@Test @Test
public void testSuccess_fee_withDefaultAttributes_v12() throws Exception { public void testSuccess_fee_withDefaultAttributes_v12() throws Exception {
setEppInput("domain_update_restore_request_fee_defaults.xml", FEE_12_MAP); setEppInput("domain_update_restore_request_fee_defaults.xml", FEE_12_MAP);
persistPendingDeleteDomain(); persistPendingDeleteDomain();
runFlowAssertResponse(readFile("domain_update_restore_request_response_fee.xml", FEE_12_MAP)); runFlowAssertResponse(loadFile("domain_update_restore_request_response_fee.xml", FEE_12_MAP));
} }
@Test @Test
@ -320,7 +320,7 @@ public class DomainRestoreRequestFlowTest extends
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, CommitMode.LIVE,
UserPrivileges.SUPERUSER, UserPrivileges.SUPERUSER,
readFile("domain_update_response.xml")); loadFile("domain_update_response.xml"));
} }
@Test @Test
@ -335,7 +335,7 @@ public class DomainRestoreRequestFlowTest extends
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, CommitMode.LIVE,
UserPrivileges.SUPERUSER, UserPrivileges.SUPERUSER,
readFile("domain_update_response.xml")); loadFile("domain_update_response.xml"));
} }
@Test @Test
@ -503,7 +503,7 @@ public class DomainRestoreRequestFlowTest extends
sessionMetadata.setClientId("NewRegistrar"); sessionMetadata.setClientId("NewRegistrar");
persistPendingDeleteDomain(); persistPendingDeleteDomain();
thrown.expect(ResourceNotOwnedException.class); thrown.expect(ResourceNotOwnedException.class);
runFlowAssertResponse(readFile("domain_update_response.xml")); runFlowAssertResponse(loadFile("domain_update_response.xml"));
} }
@Test @Test
@ -521,7 +521,7 @@ public class DomainRestoreRequestFlowTest extends
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
persistPendingDeleteDomain(); persistPendingDeleteDomain();
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_update_response.xml")); CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_update_response.xml"));
} }
@Test @Test

View file

@ -168,7 +168,7 @@ public class DomainTransferApproveFlowTest
// Setup done; run the test. // Setup done; run the test.
TransferData originalTransferData = domain.getTransferData(); TransferData originalTransferData = domain.getTransferData();
assertTransactionalFlow(true); assertTransactionalFlow(true);
runFlowAssertResponse(readFile(expectedXmlFilename)); runFlowAssertResponse(loadFile(expectedXmlFilename));
// Transfer should have succeeded. Verify correct fields were set. // Transfer should have succeeded. Verify correct fields were set.
domain = reloadResourceByForeignKey(); domain = reloadResourceByForeignKey();
assertAboutDomains() assertAboutDomains()
@ -332,7 +332,7 @@ public class DomainTransferApproveFlowTest
@Test @Test
public void testDryRun() throws Exception { public void testDryRun() throws Exception {
setEppLoader("domain_transfer_approve.xml"); setEppLoader("domain_transfer_approve.xml");
dryRunFlowAssertResponse(readFile("domain_transfer_approve_response.xml")); dryRunFlowAssertResponse(loadFile("domain_transfer_approve_response.xml"));
} }
@Test @Test
@ -508,7 +508,7 @@ public class DomainTransferApproveFlowTest
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, CommitMode.LIVE,
UserPrivileges.SUPERUSER, UserPrivileges.SUPERUSER,
readFile("domain_transfer_approve_response.xml")); loadFile("domain_transfer_approve_response.xml"));
} }
// NB: No need to test pending delete status since pending transfers will get cancelled upon // NB: No need to test pending delete status since pending transfers will get cancelled upon

View file

@ -117,7 +117,7 @@ public class DomainTransferCancelFlowTest
DateTime originalExpirationTime = domain.getRegistrationExpirationTime(); DateTime originalExpirationTime = domain.getRegistrationExpirationTime();
ImmutableSet<GracePeriod> originalGracePeriods = domain.getGracePeriods(); ImmutableSet<GracePeriod> originalGracePeriods = domain.getGracePeriods();
TransferData originalTransferData = domain.getTransferData(); TransferData originalTransferData = domain.getTransferData();
runFlowAssertResponse(readFile(expectedXmlFilename)); runFlowAssertResponse(loadFile(expectedXmlFilename));
// Transfer should have been cancelled. Verify correct fields were set. // Transfer should have been cancelled. Verify correct fields were set.
domain = reloadResourceByForeignKey(); domain = reloadResourceByForeignKey();
@ -184,7 +184,7 @@ public class DomainTransferCancelFlowTest
public void testDryRun() throws Exception { public void testDryRun() throws Exception {
setEppInput("domain_transfer_cancel.xml"); setEppInput("domain_transfer_cancel.xml");
eppLoader.replaceAll("JD1234-REP", contact.getRepoId()); eppLoader.replaceAll("JD1234-REP", contact.getRepoId());
dryRunFlowAssertResponse(readFile("domain_transfer_cancel_response.xml")); dryRunFlowAssertResponse(loadFile("domain_transfer_cancel_response.xml"));
} }
@Test @Test
@ -314,7 +314,7 @@ public class DomainTransferCancelFlowTest
loadRegistrar("NewRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); loadRegistrar("NewRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_transfer_cancel_response.xml")); CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_transfer_cancel_response.xml"));
} }
// NB: No need to test pending delete status since pending transfers will get cancelled upon // NB: No need to test pending delete status since pending transfers will get cancelled upon

View file

@ -53,7 +53,7 @@ public class DomainTransferQueryFlowTest
eppLoader.replaceAll("JD1234-REP", contact.getRepoId()); eppLoader.replaceAll("JD1234-REP", contact.getRepoId());
// Setup done; run the test. // Setup done; run the test.
assertTransactionalFlow(false); assertTransactionalFlow(false);
runFlowAssertResponse(readFile(expectedXmlFilename)); runFlowAssertResponse(loadFile(expectedXmlFilename));
assertAboutDomains().that(domain).hasOneHistoryEntryEachOfTypes( assertAboutDomains().that(domain).hasOneHistoryEntryEachOfTypes(
HistoryEntry.Type.DOMAIN_CREATE, HistoryEntry.Type.DOMAIN_CREATE,
HistoryEntry.Type.DOMAIN_TRANSFER_REQUEST); HistoryEntry.Type.DOMAIN_TRANSFER_REQUEST);

View file

@ -90,7 +90,7 @@ public class DomainTransferRejectFlowTest
DateTime originalExpirationTime = domain.getRegistrationExpirationTime(); DateTime originalExpirationTime = domain.getRegistrationExpirationTime();
ImmutableSet<GracePeriod> originalGracePeriods = domain.getGracePeriods(); ImmutableSet<GracePeriod> originalGracePeriods = domain.getGracePeriods();
TransferData originalTransferData = domain.getTransferData(); TransferData originalTransferData = domain.getTransferData();
runFlowAssertResponse(readFile(expectedXmlFilename)); runFlowAssertResponse(loadFile(expectedXmlFilename));
// Transfer should have been rejected. Verify correct fields were set. // Transfer should have been rejected. Verify correct fields were set.
domain = reloadResourceByForeignKey(); domain = reloadResourceByForeignKey();
assertTransferFailed(domain, TransferStatus.CLIENT_REJECTED, originalTransferData); assertTransferFailed(domain, TransferStatus.CLIENT_REJECTED, originalTransferData);
@ -155,7 +155,7 @@ public class DomainTransferRejectFlowTest
public void testDryRun() throws Exception { public void testDryRun() throws Exception {
setEppInput("domain_transfer_reject.xml"); setEppInput("domain_transfer_reject.xml");
eppLoader.replaceAll("JD1234-REP", contact.getRepoId()); eppLoader.replaceAll("JD1234-REP", contact.getRepoId());
dryRunFlowAssertResponse(readFile("domain_transfer_reject_response.xml")); dryRunFlowAssertResponse(loadFile("domain_transfer_reject_response.xml"));
} }
@Test @Test
@ -183,7 +183,7 @@ public class DomainTransferRejectFlowTest
persistResource( persistResource(
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_transfer_reject_response.xml")); CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_transfer_reject_response.xml"));
} }
@Test @Test

View file

@ -210,7 +210,7 @@ public class DomainTransferRequestFlowTest
DateTime implicitTransferTime = clock.nowUtc().plus(registry.getAutomaticTransferLength()); DateTime implicitTransferTime = clock.nowUtc().plus(registry.getAutomaticTransferLength());
// Setup done; run the test. // Setup done; run the test.
assertTransactionalFlow(true); assertTransactionalFlow(true);
runFlowAssertResponse(readFile(expectedXmlFilename, substitutions)); runFlowAssertResponse(loadFile(expectedXmlFilename, substitutions));
// Transfer should have been requested. // Transfer should have been requested.
domain = reloadResourceByForeignKey(); domain = reloadResourceByForeignKey();
// Verify that HistoryEntry was created. // Verify that HistoryEntry was created.
@ -512,7 +512,7 @@ public class DomainTransferRequestFlowTest
// Setup done; run the test. // Setup done; run the test.
assertTransactionalFlow(true); assertTransactionalFlow(true);
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile(expectedXmlFilename, substitutions)); CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile(expectedXmlFilename, substitutions));
if (expectedAutomaticTransferLength.equals(Duration.ZERO)) { if (expectedAutomaticTransferLength.equals(Duration.ZERO)) {
// The transfer is going to happen immediately. To observe the domain in the pending transfer // The transfer is going to happen immediately. To observe the domain in the pending transfer
@ -583,7 +583,7 @@ public class DomainTransferRequestFlowTest
setupDomain("example", "tld"); setupDomain("example", "tld");
setEppInput("domain_transfer_request.xml"); setEppInput("domain_transfer_request.xml");
eppLoader.replaceAll("JD1234-REP", contact.getRepoId()); eppLoader.replaceAll("JD1234-REP", contact.getRepoId());
dryRunFlowAssertResponse(readFile("domain_transfer_request_response.xml")); dryRunFlowAssertResponse(loadFile("domain_transfer_request_response.xml"));
} }
@Test @Test

View file

@ -142,7 +142,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
private void doSuccessfulTest() throws Exception { private void doSuccessfulTest() throws Exception {
assertTransactionalFlow(true); assertTransactionalFlow(true);
runFlowAssertResponse(readFile("domain_update_response.xml")); runFlowAssertResponse(loadFile("domain_update_response.xml"));
// Check that the domain was updated. These values came from the xml. // Check that the domain was updated. These values came from the xml.
assertAboutDomains().that(reloadResourceByForeignKey()) assertAboutDomains().that(reloadResourceByForeignKey())
.hasStatusValue(StatusValue.CLIENT_HOLD).and() .hasStatusValue(StatusValue.CLIENT_HOLD).and()
@ -158,7 +158,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
public void testDryRun() throws Exception { public void testDryRun() throws Exception {
persistReferencedEntities(); persistReferencedEntities();
persistDomain(); persistDomain();
dryRunFlowAssertResponse(readFile("domain_update_response.xml")); dryRunFlowAssertResponse(loadFile("domain_update_response.xml"));
} }
@Test @Test
@ -177,7 +177,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
assertBillingEvents(sunrushAddBillingEvent); assertBillingEvents(sunrushAddBillingEvent);
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, userPrivileges, readFile("domain_update_response.xml")); CommitMode.LIVE, userPrivileges, loadFile("domain_update_response.xml"));
// Verify that the domain now has the new nameserver and is in the add grace period. // Verify that the domain now has the new nameserver and is in the add grace period.
DomainResource resource = reloadResourceByForeignKey(); DomainResource resource = reloadResourceByForeignKey();
@ -338,7 +338,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
.build()); .build());
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.NORMAL, readFile("domain_update_response.xml")); CommitMode.LIVE, UserPrivileges.NORMAL, loadFile("domain_update_response.xml"));
// Verify that the domain is still in the sunrush add grace period. // Verify that the domain is still in the sunrush add grace period.
assertGracePeriods( assertGracePeriods(
reloadResourceByForeignKey().getGracePeriods(), reloadResourceByForeignKey().getGracePeriods(),
@ -401,7 +401,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
.build()); .build());
clock.advanceOneMilli(); clock.advanceOneMilli();
assertTransactionalFlow(true); assertTransactionalFlow(true);
runFlowAssertResponse(readFile("domain_update_response.xml")); runFlowAssertResponse(loadFile("domain_update_response.xml"));
DomainResource domain = reloadResourceByForeignKey(); DomainResource domain = reloadResourceByForeignKey();
assertAboutDomains().that(domain) assertAboutDomains().that(domain)
.hasOneHistoryEntryEachOfTypes( .hasOneHistoryEntryEachOfTypes(
@ -468,7 +468,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
.build()); .build());
clock.advanceOneMilli(); clock.advanceOneMilli();
assertTransactionalFlow(true); assertTransactionalFlow(true);
runFlowAssertResponse(readFile("domain_update_response.xml")); runFlowAssertResponse(loadFile("domain_update_response.xml"));
domain = reloadResourceByForeignKey(); domain = reloadResourceByForeignKey();
assertThat(domain.getNameservers()).containsExactly(Key.create(addedHost)); assertThat(domain.getNameservers()).containsExactly(Key.create(addedHost));
assertThat(domain.getSubordinateHosts()).containsExactly("ns1.example.tld", "ns2.example.tld"); assertThat(domain.getSubordinateHosts()).containsExactly("ns1.example.tld", "ns2.example.tld");
@ -488,7 +488,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
.setRegistrant(Key.create(sh8013)) .setRegistrant(Key.create(sh8013))
.build()); .build());
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse(readFile("domain_update_response.xml")); runFlowAssertResponse(loadFile("domain_update_response.xml"));
} }
@Test @Test
@ -506,7 +506,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
DesignatedContact.create(Type.TECH, sh8013Key))) DesignatedContact.create(Type.TECH, sh8013Key)))
.build()); .build());
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse(readFile("domain_update_response.xml")); runFlowAssertResponse(loadFile("domain_update_response.xml"));
} }
@Test @Test
@ -534,7 +534,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
.build()); .build());
assertTransactionalFlow(true); assertTransactionalFlow(true);
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse(readFile("domain_update_response.xml")); runFlowAssertResponse(loadFile("domain_update_response.xml"));
DomainResource resource = reloadResourceByForeignKey(); DomainResource resource = reloadResourceByForeignKey();
assertAboutDomains().that(resource) assertAboutDomains().that(resource)
.hasOnlyOneHistoryEntryWhich() .hasOnlyOneHistoryEntryWhich()
@ -650,7 +650,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, CommitMode.LIVE,
UserPrivileges.SUPERUSER, UserPrivileges.SUPERUSER,
readFile("domain_update_response.xml")); loadFile("domain_update_response.xml"));
if (isBillable) { if (isBillable) {
assertBillingEvents( assertBillingEvents(
@ -743,7 +743,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, CommitMode.LIVE,
UserPrivileges.SUPERUSER, UserPrivileges.SUPERUSER,
readFile("domain_update_response.xml")); loadFile("domain_update_response.xml"));
assertAboutDomains().that(reloadResourceByForeignKey()) assertAboutDomains().that(reloadResourceByForeignKey())
.hasStatusValue(StatusValue.CLIENT_UPDATE_PROHIBITED).and() .hasStatusValue(StatusValue.CLIENT_UPDATE_PROHIBITED).and()
.hasStatusValue(StatusValue.SERVER_HOLD); .hasStatusValue(StatusValue.SERVER_HOLD);
@ -894,7 +894,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
persistReferencedEntities(); persistReferencedEntities();
persistDomain(); persistDomain();
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_update_response.xml")); CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_update_response.xml"));
} }
@Test @Test
@ -915,7 +915,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
persistResource(persistDomain().asBuilder().addStatusValue(SERVER_UPDATE_PROHIBITED).build()); persistResource(persistDomain().asBuilder().addStatusValue(SERVER_UPDATE_PROHIBITED).build());
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_update_response.xml")); CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_update_response.xml"));
} }
@Test @Test
@ -933,7 +933,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
persistReferencedEntities(); persistReferencedEntities();
persistDomain(); persistDomain();
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_update_response.xml")); CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_update_response.xml"));
} }
@Test @Test
@ -1007,7 +1007,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
persistDomain(); persistDomain();
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_update_response.xml")); CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_update_response.xml"));
} }
@Test @Test
@ -1028,7 +1028,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
persistDomain(); persistDomain();
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_update_response.xml")); CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_update_response.xml"));
} }
@Test @Test

View file

@ -62,7 +62,7 @@ public class HostCheckFlowTest extends ResourceCheckFlowTestCase<HostCheckFlow,
@Test @Test
public void testXmlMatches() throws Exception { public void testXmlMatches() throws Exception {
persistActiveHost("ns2.example.tld"); persistActiveHost("ns2.example.tld");
runFlowAssertResponse(readFile("host_check_response.xml")); runFlowAssertResponse(loadFile("host_check_response.xml"));
} }
@Test @Test

View file

@ -79,7 +79,7 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
private void doSuccessfulTest() throws Exception { private void doSuccessfulTest() throws Exception {
clock.advanceOneMilli(); clock.advanceOneMilli();
assertTransactionalFlow(true); assertTransactionalFlow(true);
runFlowAssertResponse(readFile("host_create_response.xml")); runFlowAssertResponse(loadFile("host_create_response.xml"));
// Check that the host was created and persisted with a history entry. // Check that the host was created and persisted with a history entry.
assertAboutHosts().that(reloadResourceByForeignKey()) assertAboutHosts().that(reloadResourceByForeignKey())
.hasLastSuperordinateChange(null).and() .hasLastSuperordinateChange(null).and()
@ -98,7 +98,7 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
@Test @Test
public void testDryRun() throws Exception { public void testDryRun() throws Exception {
dryRunFlowAssertResponse(readFile("host_create_response.xml")); dryRunFlowAssertResponse(loadFile("host_create_response.xml"));
} }
@Test @Test

View file

@ -59,7 +59,7 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
@Test @Test
public void testDryRun() throws Exception { public void testDryRun() throws Exception {
persistActiveHost("ns1.example.tld"); persistActiveHost("ns1.example.tld");
dryRunFlowAssertResponse(readFile("host_delete_response.xml")); dryRunFlowAssertResponse(loadFile("host_delete_response.xml"));
} }
@Test @Test
@ -67,7 +67,7 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
persistActiveHost("ns1.example.tld"); persistActiveHost("ns1.example.tld");
clock.advanceOneMilli(); clock.advanceOneMilli();
assertTransactionalFlow(true); assertTransactionalFlow(true);
runFlowAssertResponse(readFile("host_delete_response.xml")); runFlowAssertResponse(loadFile("host_delete_response.xml"));
HostResource deletedHost = reloadResourceByForeignKey(); HostResource deletedHost = reloadResourceByForeignKey();
assertAboutHosts().that(deletedHost).hasStatusValue(StatusValue.PENDING_DELETE); assertAboutHosts().that(deletedHost).hasStatusValue(StatusValue.PENDING_DELETE);
assertAsyncDeletionTaskEnqueued( assertAsyncDeletionTaskEnqueued(
@ -134,7 +134,7 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
persistActiveHost("ns1.example.tld"); persistActiveHost("ns1.example.tld");
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("host_delete_response.xml")); CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("host_delete_response.xml"));
HostResource deletedHost = reloadResourceByForeignKey(); HostResource deletedHost = reloadResourceByForeignKey();
assertAboutHosts().that(deletedHost).hasStatusValue(StatusValue.PENDING_DELETE); assertAboutHosts().that(deletedHost).hasStatusValue(StatusValue.PENDING_DELETE);
assertAsyncDeletionTaskEnqueued( assertAsyncDeletionTaskEnqueued(
@ -160,7 +160,7 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
.setSuperordinateDomain(Key.create(domain)) .setSuperordinateDomain(Key.create(domain))
.build()); .build());
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse(readFile("host_delete_response.xml")); runFlowAssertResponse(loadFile("host_delete_response.xml"));
} }
@Test @Test
@ -205,7 +205,7 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
.setSuperordinateDomain(Key.create(domain)) .setSuperordinateDomain(Key.create(domain))
.build()); .build());
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse(readFile("host_delete_response.xml")); runFlowAssertResponse(loadFile("host_delete_response.xml"));
} }
@Test @Test

View file

@ -75,7 +75,7 @@ public class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, HostRes
assertTransactionalFlow(false); assertTransactionalFlow(false);
// Check that the persisted host info was returned. // Check that the persisted host info was returned.
runFlowAssertResponse( runFlowAssertResponse(
readFile("host_info_response.xml"), loadFile("host_info_response.xml"),
// We use a different roid scheme than the samples so ignore it. // We use a different roid scheme than the samples so ignore it.
"epp.response.resData.infData.roid"); "epp.response.resData.infData.roid");
assertNoHistory(); assertNoHistory();
@ -92,7 +92,7 @@ public class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, HostRes
assertTransactionalFlow(false); assertTransactionalFlow(false);
// Check that the persisted host info was returned. // Check that the persisted host info was returned.
runFlowAssertResponse( runFlowAssertResponse(
readFile("host_info_response_linked.xml"), loadFile("host_info_response_linked.xml"),
// We use a different roid scheme than the samples so ignore it. // We use a different roid scheme than the samples so ignore it.
"epp.response.resData.infData.roid"); "epp.response.resData.infData.roid");
assertNoHistory(); assertNoHistory();
@ -115,7 +115,7 @@ public class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, HostRes
.build()); .build());
assertTransactionalFlow(false); assertTransactionalFlow(false);
runFlowAssertResponse( runFlowAssertResponse(
readFile("host_info_response_superordinate_clientid.xml"), loadFile("host_info_response_superordinate_clientid.xml"),
// We use a different roid scheme than the samples so ignore it. // We use a different roid scheme than the samples so ignore it.
"epp.response.resData.infData.roid"); "epp.response.resData.infData.roid");
assertNoHistory(); assertNoHistory();

View file

@ -127,7 +127,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
public void testDryRun() throws Exception { public void testDryRun() throws Exception {
createTld("tld"); createTld("tld");
persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.tld")); persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.tld"));
dryRunFlowAssertResponse(readFile("host_update_response.xml")); dryRunFlowAssertResponse(loadFile("host_update_response.xml"));
} }
private HostResource doSuccessfulTest() throws Exception { private HostResource doSuccessfulTest() throws Exception {
@ -144,7 +144,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, CommitMode.LIVE,
isSuperuser ? UserPrivileges.SUPERUSER : UserPrivileges.NORMAL, isSuperuser ? UserPrivileges.SUPERUSER : UserPrivileges.NORMAL,
readFile("host_update_response.xml")); loadFile("host_update_response.xml"));
// The example xml does a host rename, so reloading the host (which uses the original host name) // The example xml does a host rename, so reloading the host (which uses the original host name)
// should now return null. // should now return null.
assertThat(reloadResourceByForeignKey()).isNull(); assertThat(reloadResourceByForeignKey()).isNull();
@ -204,7 +204,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
DomainResource domain = persistActiveDomain("example.tld"); DomainResource domain = persistActiveDomain("example.tld");
HostResource oldHost = persistActiveSubordinateHost(oldHostName(), domain); HostResource oldHost = persistActiveSubordinateHost(oldHostName(), domain);
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse(readFile("host_update_response.xml")); runFlowAssertResponse(loadFile("host_update_response.xml"));
// The example xml doesn't do a host rename, so reloading the host should work. // The example xml doesn't do a host rename, so reloading the host should work.
assertAboutHosts().that(reloadResourceByForeignKey()) assertAboutHosts().that(reloadResourceByForeignKey())
.hasLastSuperordinateChange(oldHost.getLastSuperordinateChange()).and() .hasLastSuperordinateChange(oldHost.getLastSuperordinateChange()).and()
@ -225,7 +225,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
DomainResource domain = persistResource(createDomainWithServerApprovedTransfer("example.tld")); DomainResource domain = persistResource(createDomainWithServerApprovedTransfer("example.tld"));
HostResource oldHost = persistActiveSubordinateHost(oldHostName(), domain); HostResource oldHost = persistActiveSubordinateHost(oldHostName(), domain);
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse(readFile("host_update_response.xml")); runFlowAssertResponse(loadFile("host_update_response.xml"));
// The example xml doesn't do a host rename, so reloading the host should work. // The example xml doesn't do a host rename, so reloading the host should work.
assertAboutHosts().that(reloadResourceByForeignKey()) assertAboutHosts().that(reloadResourceByForeignKey())
.hasLastSuperordinateChange(oldHost.getLastSuperordinateChange()).and() .hasLastSuperordinateChange(oldHost.getLastSuperordinateChange()).and()
@ -439,7 +439,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, CommitMode.LIVE,
UserPrivileges.SUPERUSER, UserPrivileges.SUPERUSER,
readFile("host_update_response.xml")); loadFile("host_update_response.xml"));
assertAboutHosts().that(reloadResourceByForeignKey()) assertAboutHosts().that(reloadResourceByForeignKey())
.hasPersistedCurrentSponsorClientId("TheRegistrar").and() .hasPersistedCurrentSponsorClientId("TheRegistrar").and()
.hasLastTransferTime(null).and() .hasLastTransferTime(null).and()
@ -1013,7 +1013,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, CommitMode.LIVE,
UserPrivileges.SUPERUSER, UserPrivileges.SUPERUSER,
readFile("host_update_response.xml")); loadFile("host_update_response.xml"));
} }
@Test @Test
@ -1031,7 +1031,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.DRY_RUN, UserPrivileges.SUPERUSER, readFile("host_update_response.xml")); CommitMode.DRY_RUN, UserPrivileges.SUPERUSER, loadFile("host_update_response.xml"));
} }
@Test @Test
@ -1050,7 +1050,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
.build()); .build());
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse(readFile("host_update_response.xml")); runFlowAssertResponse(loadFile("host_update_response.xml"));
} }
@Test @Test
@ -1086,7 +1086,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
.build()); .build());
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse(readFile("host_update_response.xml")); runFlowAssertResponse(loadFile("host_update_response.xml"));
} }
@Test @Test
@ -1170,7 +1170,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
.build()); .build());
clock.advanceOneMilli(); clock.advanceOneMilli();
runFlowAssertResponse(readFile("host_update_response.xml")); runFlowAssertResponse(loadFile("host_update_response.xml"));
} }
private void doFailingHostNameTest( private void doFailingHostNameTest(
@ -1242,7 +1242,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
clock.advanceOneMilli(); clock.advanceOneMilli();
setEppInput("host_update_metadata.xml"); setEppInput("host_update_metadata.xml");
eppRequestSource = EppRequestSource.TOOL; eppRequestSource = EppRequestSource.TOOL;
runFlowAssertResponse(readFile("host_update_response.xml")); runFlowAssertResponse(loadFile("host_update_response.xml"));
assertAboutHistoryEntries() assertAboutHistoryEntries()
.that(getOnlyHistoryEntryOfType( .that(getOnlyHistoryEntryOfType(
reloadResourceByForeignKey(), HistoryEntry.Type.HOST_UPDATE)) reloadResourceByForeignKey(), HistoryEntry.Type.HOST_UPDATE))

View file

@ -82,7 +82,7 @@ public class PollAckFlowTest extends FlowTestCase<PollAckFlow> {
@Test @Test
public void testDryRun() throws Exception { public void testDryRun() throws Exception {
persistOneTimePollMessage(MESSAGE_ID); persistOneTimePollMessage(MESSAGE_ID);
dryRunFlowAssertResponse(readFile("poll_ack_response_empty.xml")); dryRunFlowAssertResponse(loadFile("poll_ack_response_empty.xml"));
} }
@Test @Test
@ -97,21 +97,21 @@ public class PollAckFlowTest extends FlowTestCase<PollAckFlow> {
.setParent(createHistoryEntryForEppResource(contact)) .setParent(createHistoryEntryForEppResource(contact))
.build()); .build());
assertTransactionalFlow(true); assertTransactionalFlow(true);
runFlowAssertResponse(readFile("poll_ack_response_empty.xml")); runFlowAssertResponse(loadFile("poll_ack_response_empty.xml"));
} }
@Test @Test
public void testSuccess_messageOnContactResource() throws Exception { public void testSuccess_messageOnContactResource() throws Exception {
persistOneTimePollMessage(MESSAGE_ID); persistOneTimePollMessage(MESSAGE_ID);
assertTransactionalFlow(true); assertTransactionalFlow(true);
runFlowAssertResponse(readFile("poll_ack_response_empty.xml")); runFlowAssertResponse(loadFile("poll_ack_response_empty.xml"));
} }
@Test @Test
public void testSuccess_recentActiveAutorenew() throws Exception { public void testSuccess_recentActiveAutorenew() throws Exception {
persistAutorenewPollMessage(clock.nowUtc().minusMonths(6), END_OF_TIME); persistAutorenewPollMessage(clock.nowUtc().minusMonths(6), END_OF_TIME);
assertTransactionalFlow(true); assertTransactionalFlow(true);
runFlowAssertResponse(readFile("poll_ack_response_empty.xml")); runFlowAssertResponse(loadFile("poll_ack_response_empty.xml"));
} }
@Test @Test
@ -123,14 +123,14 @@ public class PollAckFlowTest extends FlowTestCase<PollAckFlow> {
persistOneTimePollMessage(MESSAGE_ID + i); persistOneTimePollMessage(MESSAGE_ID + i);
} }
assertTransactionalFlow(true); assertTransactionalFlow(true);
runFlowAssertResponse(readFile("poll_ack_response.xml")); runFlowAssertResponse(loadFile("poll_ack_response.xml"));
} }
@Test @Test
public void testSuccess_oldInactiveAutorenew() throws Exception { public void testSuccess_oldInactiveAutorenew() throws Exception {
persistAutorenewPollMessage(clock.nowUtc().minusMonths(6), clock.nowUtc()); persistAutorenewPollMessage(clock.nowUtc().minusMonths(6), clock.nowUtc());
assertTransactionalFlow(true); assertTransactionalFlow(true);
runFlowAssertResponse(readFile("poll_ack_response_empty.xml")); runFlowAssertResponse(loadFile("poll_ack_response_empty.xml"));
} }
@Test @Test
@ -140,7 +140,7 @@ public class PollAckFlowTest extends FlowTestCase<PollAckFlow> {
persistOneTimePollMessage(MESSAGE_ID + i); persistOneTimePollMessage(MESSAGE_ID + i);
} }
assertTransactionalFlow(true); assertTransactionalFlow(true);
runFlowAssertResponse(readFile("poll_ack_response.xml")); runFlowAssertResponse(loadFile("poll_ack_response.xml"));
} }
@Test @Test

View file

@ -75,7 +75,7 @@ public class PollRequestFlowTest extends FlowTestCase<PollRequestFlow> {
.setParent(createHistoryEntryForEppResource(domain)) .setParent(createHistoryEntryForEppResource(domain))
.build()); .build());
assertTransactionalFlow(false); assertTransactionalFlow(false);
runFlowAssertResponse(readFile("poll_response_domain_transfer.xml")); runFlowAssertResponse(loadFile("poll_response_domain_transfer.xml"));
} }
@Test @Test
@ -99,7 +99,7 @@ public class PollRequestFlowTest extends FlowTestCase<PollRequestFlow> {
.setParent(createHistoryEntryForEppResource(contact)) .setParent(createHistoryEntryForEppResource(contact))
.build()); .build());
assertTransactionalFlow(false); assertTransactionalFlow(false);
runFlowAssertResponse(readFile("poll_response_contact_transfer.xml")); runFlowAssertResponse(loadFile("poll_response_contact_transfer.xml"));
} }
@Test @Test
@ -114,7 +114,7 @@ public class PollRequestFlowTest extends FlowTestCase<PollRequestFlow> {
.setParent(createHistoryEntryForEppResource(domain)) .setParent(createHistoryEntryForEppResource(domain))
.build()); .build());
assertTransactionalFlow(false); assertTransactionalFlow(false);
runFlowAssertResponse(readFile("poll_response_domain_pending_notification.xml")); runFlowAssertResponse(loadFile("poll_response_domain_pending_notification.xml"));
} }
@Test @Test
@ -128,12 +128,12 @@ public class PollRequestFlowTest extends FlowTestCase<PollRequestFlow> {
.setParent(createHistoryEntryForEppResource(domain)) .setParent(createHistoryEntryForEppResource(domain))
.build()); .build());
assertTransactionalFlow(false); assertTransactionalFlow(false);
runFlowAssertResponse(readFile("poll_response_autorenew.xml")); runFlowAssertResponse(loadFile("poll_response_autorenew.xml"));
} }
@Test @Test
public void testSuccess_empty() throws Exception { public void testSuccess_empty() throws Exception {
runFlowAssertResponse(readFile("poll_response_empty.xml")); runFlowAssertResponse(loadFile("poll_response_empty.xml"));
} }
@Test @Test
@ -145,7 +145,7 @@ public class PollRequestFlowTest extends FlowTestCase<PollRequestFlow> {
.setMsg("Poll message") .setMsg("Poll message")
.setParent(createHistoryEntryForEppResource(domain)) .setParent(createHistoryEntryForEppResource(domain))
.build()); .build());
runFlowAssertResponse(readFile("poll_response_empty.xml")); runFlowAssertResponse(loadFile("poll_response_empty.xml"));
} }
@Test @Test
@ -157,7 +157,7 @@ public class PollRequestFlowTest extends FlowTestCase<PollRequestFlow> {
.setMsg("Poll message") .setMsg("Poll message")
.setParent(createHistoryEntryForEppResource(domain)) .setParent(createHistoryEntryForEppResource(domain))
.build()); .build());
runFlowAssertResponse(readFile("poll_response_empty.xml")); runFlowAssertResponse(loadFile("poll_response_empty.xml"));
} }
@Test @Test
@ -171,7 +171,7 @@ public class PollRequestFlowTest extends FlowTestCase<PollRequestFlow> {
.setParent(createHistoryEntryForEppResource(domain)) .setParent(createHistoryEntryForEppResource(domain))
.build()); .build());
assertTransactionalFlow(false); assertTransactionalFlow(false);
runFlowAssertResponse(readFile("poll_response_empty.xml")); runFlowAssertResponse(loadFile("poll_response_empty.xml"));
} }
@Test @Test
@ -192,7 +192,7 @@ public class PollRequestFlowTest extends FlowTestCase<PollRequestFlow> {
.setEventTime(clock.nowUtc().minusDays(1)) .setEventTime(clock.nowUtc().minusDays(1))
.build()); .build());
assertTransactionalFlow(false); assertTransactionalFlow(false);
runFlowAssertResponse(readFile("poll_response_contact_delete.xml")); runFlowAssertResponse(loadFile("poll_response_contact_delete.xml"));
} }
@Test @Test
@ -213,7 +213,7 @@ public class PollRequestFlowTest extends FlowTestCase<PollRequestFlow> {
.setEventTime(clock.nowUtc().minusDays(1)) .setEventTime(clock.nowUtc().minusDays(1))
.build()); .build());
assertTransactionalFlow(false); assertTransactionalFlow(false);
runFlowAssertResponse(readFile("poll_response_host_delete.xml")); runFlowAssertResponse(loadFile("poll_response_host_delete.xml"));
} }
@Test @Test

View file

@ -14,7 +14,6 @@
package google.registry.flows.session; package google.registry.flows.session;
import static google.registry.testing.TestDataHelper.loadFileWithSubstitutions;
import static org.joda.time.format.ISODateTimeFormat.dateTimeNoMillis; import static org.joda.time.format.ISODateTimeFormat.dateTimeNoMillis;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
@ -29,9 +28,7 @@ public class HelloFlowTest extends FlowTestCase<HelloFlow> {
setEppInput("hello.xml"); setEppInput("hello.xml");
assertTransactionalFlow(false); assertTransactionalFlow(false);
runFlowAssertResponse( runFlowAssertResponse(
loadFileWithSubstitutions( loadFile(
getClass(), "greeting.xml", ImmutableMap.of("DATE", clock.nowUtc().toString(dateTimeNoMillis()))));
"greeting.xml",
ImmutableMap.of("DATE", clock.nowUtc().toString(dateTimeNoMillis()))));
} }
} }

View file

@ -56,7 +56,7 @@ public abstract class LoginFlowTestCase extends FlowTestCase<LoginFlow> {
void doSuccessfulTest(String xmlFilename) throws Exception { void doSuccessfulTest(String xmlFilename) throws Exception {
setEppInput(xmlFilename); setEppInput(xmlFilename);
assertTransactionalFlow(false); assertTransactionalFlow(false);
runFlowAssertResponse(readFile("login_response.xml")); runFlowAssertResponse(loadFile("login_response.xml"));
} }
// Also called in subclasses. // Also called in subclasses.

View file

@ -37,7 +37,7 @@ public class LogoutFlowTest extends FlowTestCase<LogoutFlow> {
public void testSuccess() throws Exception { public void testSuccess() throws Exception {
assertTransactionalFlow(false); assertTransactionalFlow(false);
// All flow tests are implicitly logged in, so logout should work. // All flow tests are implicitly logged in, so logout should work.
runFlowAssertResponse(readFile("logout_response.xml")); runFlowAssertResponse(loadFile("logout_response.xml"));
} }
@Test @Test

View file

@ -19,7 +19,7 @@ import static com.google.common.truth.Truth.assertThat;
import static google.registry.request.Action.Method.GET; import static google.registry.request.Action.Method.GET;
import static google.registry.request.Action.Method.HEAD; import static google.registry.request.Action.Method.HEAD;
import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.TestDataHelper.loadFileWithSubstitutions; import static google.registry.testing.TestDataHelper.loadFile;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
@ -166,7 +166,7 @@ public class RdapActionBaseTest {
@Test @Test
public void testValidName_works() throws Exception { public void testValidName_works() throws Exception {
assertThat(generateActualJson("no.thing")).isEqualTo(JSONValue.parse( assertThat(generateActualJson("no.thing")).isEqualTo(JSONValue.parse(
loadFileWithSubstitutions(this.getClass(), "rdapjson_toplevel.json", null))); loadFile(this.getClass(), "rdapjson_toplevel.json")));
assertThat(response.getStatus()).isEqualTo(200); assertThat(response.getStatus()).isEqualTo(200);
} }
@ -234,7 +234,7 @@ public class RdapActionBaseTest {
} }
private String loadFileWithoutTrailingNewline(String fileName) { private String loadFileWithoutTrailingNewline(String fileName) {
String contents = loadFileWithSubstitutions(this.getClass(), fileName, null); String contents = loadFile(this.getClass(), fileName);
return contents.endsWith("\n") ? contents.substring(0, contents.length() - 1) : contents; return contents.endsWith("\n") ? contents.substring(0, contents.length() - 1) : contents;
} }

View file

@ -24,7 +24,7 @@ import static google.registry.testing.FullFieldsTestEntityHelper.makeDomainResou
import static google.registry.testing.FullFieldsTestEntityHelper.makeHistoryEntry; import static google.registry.testing.FullFieldsTestEntityHelper.makeHistoryEntry;
import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar;
import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrarContacts; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrarContacts;
import static google.registry.testing.TestDataHelper.loadFileWithSubstitutions; import static google.registry.testing.TestDataHelper.loadFile;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
@ -341,8 +341,7 @@ public class RdapDomainActionTest {
substitutionsBuilder.put("NAMESERVER2PUNYCODENAME", "ns2.cat.lol"); substitutionsBuilder.put("NAMESERVER2PUNYCODENAME", "ns2.cat.lol");
} }
return JSONValue.parse( return JSONValue.parse(
loadFileWithSubstitutions( loadFile(this.getClass(), expectedOutputFile, substitutionsBuilder.build()));
this.getClass(), expectedOutputFile, substitutionsBuilder.build()));
} }
private Object generateExpectedJsonWithTopLevelEntries( private Object generateExpectedJsonWithTopLevelEntries(

View file

@ -30,7 +30,7 @@ import static google.registry.testing.FullFieldsTestEntityHelper.makeDomainResou
import static google.registry.testing.FullFieldsTestEntityHelper.makeHistoryEntry; import static google.registry.testing.FullFieldsTestEntityHelper.makeHistoryEntry;
import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar;
import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrarContacts; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrarContacts;
import static google.registry.testing.TestDataHelper.loadFileWithSubstitutions; import static google.registry.testing.TestDataHelper.loadFile;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
@ -405,7 +405,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase {
String domain1Handle, String domain1Handle,
String domain2Name, String domain2Name,
String domain2Handle) { String domain2Handle) {
return JSONValue.parse(loadFileWithSubstitutions( return JSONValue.parse(loadFile(
this.getClass(), this.getClass(),
"rdap_domains_two.json", "rdap_domains_two.json",
ImmutableMap.of( ImmutableMap.of(
@ -427,7 +427,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase {
String domain4Handle, String domain4Handle,
String expectedOutputFile) { String expectedOutputFile) {
return JSONValue.parse( return JSONValue.parse(
loadFileWithSubstitutions( loadFile(
this.getClass(), this.getClass(),
expectedOutputFile, expectedOutputFile,
new ImmutableMap.Builder<String, String>() new ImmutableMap.Builder<String, String>()
@ -481,8 +481,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase {
} }
} }
return JSONValue.parse( return JSONValue.parse(
loadFileWithSubstitutions( loadFile(this.getClass(), expectedOutputFile, substitutionsBuilder.build()));
this.getClass(), expectedOutputFile, substitutionsBuilder.build()));
} }
private Object generateExpectedJsonForDomain( private Object generateExpectedJsonForDomain(
@ -568,7 +567,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase {
String domainHandle3, String domainHandle3,
String domainName4, String domainName4,
String domainHandle4) { String domainHandle4) {
return JSONValue.parse(loadFileWithSubstitutions( return JSONValue.parse(loadFile(
this.getClass(), this.getClass(),
fileName, fileName,
new ImmutableMap.Builder<String, String>() new ImmutableMap.Builder<String, String>()

View file

@ -24,7 +24,7 @@ import static google.registry.testing.FullFieldsTestEntityHelper.makeDomainResou
import static google.registry.testing.FullFieldsTestEntityHelper.makeHostResource; import static google.registry.testing.FullFieldsTestEntityHelper.makeHostResource;
import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar;
import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrarContacts; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrarContacts;
import static google.registry.testing.TestDataHelper.loadFileWithSubstitutions; import static google.registry.testing.TestDataHelper.loadFile;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
@ -221,7 +221,7 @@ public class RdapEntityActionTest {
@Nullable String address, @Nullable String address,
String expectedOutputFile) { String expectedOutputFile) {
return JSONValue.parse( return JSONValue.parse(
loadFileWithSubstitutions( loadFile(
this.getClass(), this.getClass(),
expectedOutputFile, expectedOutputFile,
new ImmutableMap.Builder<String, String>() new ImmutableMap.Builder<String, String>()

View file

@ -28,7 +28,7 @@ import static google.registry.testing.FullFieldsTestEntityHelper.makeAndPersistD
import static google.registry.testing.FullFieldsTestEntityHelper.makeContactResource; import static google.registry.testing.FullFieldsTestEntityHelper.makeContactResource;
import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar;
import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrarContacts; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrarContacts;
import static google.registry.testing.TestDataHelper.loadFileWithSubstitutions; import static google.registry.testing.TestDataHelper.loadFile;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
@ -180,10 +180,8 @@ public class RdapEntitySearchActionTest extends RdapSearchActionTestCase {
} }
private Object generateExpectedJson(String expectedOutputFile) { private Object generateExpectedJson(String expectedOutputFile) {
return JSONValue.parse(loadFileWithSubstitutions( return JSONValue.parse(
this.getClass(), loadFile(this.getClass(), expectedOutputFile, ImmutableMap.of("TYPE", "entity")));
expectedOutputFile,
ImmutableMap.of("TYPE", "entity")));
} }
private Object generateExpectedJson( private Object generateExpectedJson(
@ -212,8 +210,7 @@ public class RdapEntitySearchActionTest extends RdapSearchActionTestCase {
} }
builder.put("TYPE", "entity"); builder.put("TYPE", "entity");
builder.put("STATUS", status); builder.put("STATUS", status);
String substitutedFile = String substitutedFile = loadFile(this.getClass(), expectedOutputFile, builder.build());
loadFileWithSubstitutions(this.getClass(), expectedOutputFile, builder.build());
Object jsonObject = JSONValue.parse(substitutedFile); Object jsonObject = JSONValue.parse(substitutedFile);
checkNotNull(jsonObject, "substituted file is not valid JSON: %s", substitutedFile); checkNotNull(jsonObject, "substituted file is not valid JSON: %s", substitutedFile);
return jsonObject; return jsonObject;

View file

@ -15,7 +15,7 @@
package google.registry.rdap; package google.registry.rdap;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.testing.TestDataHelper.loadFileWithSubstitutions; import static google.registry.testing.TestDataHelper.loadFile;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
@ -85,8 +85,8 @@ public class RdapHelpActionTest {
} }
private Object generateExpectedJson(String name, String expectedOutputFile) { private Object generateExpectedJson(String name, String expectedOutputFile) {
return JSONValue.parse(loadFileWithSubstitutions( return JSONValue.parse(
this.getClass(), expectedOutputFile, ImmutableMap.of("NAME", name))); loadFile(this.getClass(), expectedOutputFile, ImmutableMap.of("NAME", name)));
} }
@Test @Test

View file

@ -23,7 +23,7 @@ import static google.registry.testing.FullFieldsTestEntityHelper.makeAndPersistH
import static google.registry.testing.FullFieldsTestEntityHelper.makeDomainResource; import static google.registry.testing.FullFieldsTestEntityHelper.makeDomainResource;
import static google.registry.testing.FullFieldsTestEntityHelper.makeHistoryEntry; import static google.registry.testing.FullFieldsTestEntityHelper.makeHistoryEntry;
import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar;
import static google.registry.testing.TestDataHelper.loadFileWithSubstitutions; import static google.registry.testing.TestDataHelper.loadFile;
import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST; import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
@ -260,7 +260,7 @@ public class RdapJsonFormatterTest {
} }
private Object loadJson(String expectedFileName) { private Object loadJson(String expectedFileName) {
return JSONValue.parse(loadFileWithSubstitutions(this.getClass(), expectedFileName, null)); return JSONValue.parse(loadFile(this.getClass(), expectedFileName));
} }
@Test @Test

View file

@ -19,7 +19,7 @@ import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.FullFieldsTestEntityHelper.makeAndPersistHostResource; import static google.registry.testing.FullFieldsTestEntityHelper.makeAndPersistHostResource;
import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar;
import static google.registry.testing.TestDataHelper.loadFileWithSubstitutions; import static google.registry.testing.TestDataHelper.loadFile;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
@ -160,7 +160,7 @@ public class RdapNameserverActionTest {
if (!punycodeSet) { if (!punycodeSet) {
builder.put("PUNYCODENAME", name); builder.put("PUNYCODENAME", name);
} }
return JSONValue.parse(loadFileWithSubstitutions( return JSONValue.parse(loadFile(
this.getClass(), this.getClass(),
expectedOutputFile, expectedOutputFile,
builder.build())); builder.build()));

View file

@ -28,7 +28,7 @@ import static google.registry.testing.FullFieldsTestEntityHelper.makeDomainResou
import static google.registry.testing.FullFieldsTestEntityHelper.makeHostResource; import static google.registry.testing.FullFieldsTestEntityHelper.makeHostResource;
import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar;
import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrarContacts; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrarContacts;
import static google.registry.testing.TestDataHelper.loadFileWithSubstitutions; import static google.registry.testing.TestDataHelper.loadFile;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
@ -217,7 +217,7 @@ public class RdapNameserverSearchActionTest extends RdapSearchActionTestCase {
builder.put("STATUS", "active"); builder.put("STATUS", "active");
builder.put("TYPE", "nameserver"); builder.put("TYPE", "nameserver");
return JSONValue.parse( return JSONValue.parse(
loadFileWithSubstitutions(this.getClass(), expectedOutputFile, builder.build())); loadFile(this.getClass(), expectedOutputFile, builder.build()));
} }
private Object generateExpectedJsonForNameserver( private Object generateExpectedJsonForNameserver(

View file

@ -56,7 +56,7 @@ import org.junit.runners.JUnit4;
@RunWith(JUnit4.class) @RunWith(JUnit4.class)
public class BrdaCopyActionTest extends ShardableTestCase { public class BrdaCopyActionTest extends ShardableTestCase {
private static final ByteSource DEPOSIT_XML = RdeTestData.get("deposit_full.xml"); // 2010-10-17 private static final ByteSource DEPOSIT_XML = RdeTestData.loadBytes("deposit_full.xml");
private static final GcsFilename STAGE_FILE = private static final GcsFilename STAGE_FILE =
new GcsFilename("keg", "lol_2010-10-17_thin_S1_R0.xml.ghostryde"); new GcsFilename("keg", "lol_2010-10-17_thin_S1_R0.xml.ghostryde");
@ -77,8 +77,8 @@ public class BrdaCopyActionTest extends ShardableTestCase {
@Rule @Rule
public final GpgSystemCommandRule gpg = new GpgSystemCommandRule( public final GpgSystemCommandRule gpg = new GpgSystemCommandRule(
RdeTestData.get("pgp-public-keyring.asc"), RdeTestData.loadBytes("pgp-public-keyring.asc"),
RdeTestData.get("pgp-private-keyring-escrow.asc")); RdeTestData.loadBytes("pgp-private-keyring-escrow.asc"));
private static PGPPublicKey encryptKey; private static PGPPublicKey encryptKey;
private static PGPPrivateKey decryptKey; private static PGPPrivateKey decryptKey;

View file

@ -53,8 +53,8 @@ public class GhostrydeGpgIntegrationTest extends ShardableTestCase {
@Rule @Rule
public final GpgSystemCommandRule gpg = public final GpgSystemCommandRule gpg =
new GpgSystemCommandRule( new GpgSystemCommandRule(
RdeTestData.get("pgp-public-keyring.asc"), RdeTestData.loadBytes("pgp-public-keyring.asc"),
RdeTestData.get("pgp-private-keyring-registry.asc")); RdeTestData.loadBytes("pgp-private-keyring-registry.asc"));
@DataPoints @DataPoints
public static GpgCommand[] commands = new GpgCommand[] { public static GpgCommand[] commands = new GpgCommand[] {

View file

@ -74,9 +74,9 @@ import org.mockito.ArgumentCaptor;
@RunWith(JUnit4.class) @RunWith(JUnit4.class)
public class RdeReportActionTest { public class RdeReportActionTest {
private static final ByteSource REPORT_XML = RdeTestData.get("report.xml"); private static final ByteSource REPORT_XML = RdeTestData.loadBytes("report.xml");
private static final ByteSource IIRDEA_BAD_XML = RdeTestData.get("iirdea_bad.xml"); private static final ByteSource IIRDEA_BAD_XML = RdeTestData.loadBytes("iirdea_bad.xml");
private static final ByteSource IIRDEA_GOOD_XML = RdeTestData.get("iirdea_good.xml"); private static final ByteSource IIRDEA_GOOD_XML = RdeTestData.loadBytes("iirdea_good.xml");
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExceptionRule thrown = new ExceptionRule();

View file

@ -21,14 +21,14 @@ import google.registry.testing.TestDataHelper;
public final class RdeTestData { public final class RdeTestData {
/** Returns {@link ByteSource} for file in {@code rde/testdata/} directory. */ /** Returns {@link ByteSource} for file in {@code rde/testdata/} directory. */
public static ByteSource get(String filename) { public static ByteSource loadBytes(String filename) {
return TestDataHelper.loadBytes(RdeTestData.class, filename); return TestDataHelper.loadBytes(RdeTestData.class, filename);
} }
/** /**
* Loads data from file in {@code rde/testdata/} as a String (assuming file is UTF-8). * Loads data from file in {@code rde/testdata/} as a String (assuming file is UTF-8).
*/ */
public static String loadUtf8(String filename) { public static String loadFile(String filename) {
return TestDataHelper.loadFile(RdeTestData.class, filename); return TestDataHelper.loadFile(RdeTestData.class, filename);
} }
} }

View file

@ -97,8 +97,8 @@ import org.mockito.stubbing.OngoingStubbing;
public class RdeUploadActionTest { public class RdeUploadActionTest {
private static final int BUFFER_SIZE = 64 * 1024; private static final int BUFFER_SIZE = 64 * 1024;
private static final ByteSource REPORT_XML = RdeTestData.get("report.xml"); private static final ByteSource REPORT_XML = RdeTestData.loadBytes("report.xml");
private static final ByteSource DEPOSIT_XML = RdeTestData.get("deposit_full.xml"); // 2010-10-17 private static final ByteSource DEPOSIT_XML = RdeTestData.loadBytes("deposit_full.xml");
private static final GcsFilename GHOSTRYDE_FILE = private static final GcsFilename GHOSTRYDE_FILE =
new GcsFilename("bucket", "tld_2010-10-17_full_S1_R0.xml.ghostryde"); new GcsFilename("bucket", "tld_2010-10-17_full_S1_R0.xml.ghostryde");
@ -128,8 +128,8 @@ public class RdeUploadActionTest {
@Rule @Rule
public final GpgSystemCommandRule gpg = new GpgSystemCommandRule( public final GpgSystemCommandRule gpg = new GpgSystemCommandRule(
RdeTestData.get("pgp-public-keyring.asc"), RdeTestData.loadBytes("pgp-public-keyring.asc"),
RdeTestData.get("pgp-private-keyring-escrow.asc")); RdeTestData.loadBytes("pgp-private-keyring-escrow.asc"));
@Rule @Rule
public final IoSpyRule ioSpy = new IoSpyRule() public final IoSpyRule ioSpy = new IoSpyRule()

View file

@ -57,8 +57,8 @@ public class RydeGpgIntegrationTest extends ShardableTestCase {
@Rule @Rule
public final GpgSystemCommandRule gpg = new GpgSystemCommandRule( public final GpgSystemCommandRule gpg = new GpgSystemCommandRule(
RdeTestData.get("pgp-public-keyring.asc"), RdeTestData.loadBytes("pgp-public-keyring.asc"),
RdeTestData.get("pgp-private-keyring-escrow.asc")); RdeTestData.loadBytes("pgp-private-keyring-escrow.asc"));
private final FakeKeyringModule keyringFactory = new FakeKeyringModule(); private final FakeKeyringModule keyringFactory = new FakeKeyringModule();

View file

@ -54,7 +54,7 @@ import org.junit.runners.JUnit4;
public class RdeContactImportActionTest extends MapreduceTestCase<RdeContactImportAction> { public class RdeContactImportActionTest extends MapreduceTestCase<RdeContactImportAction> {
private static final ByteSource DEPOSIT_1_CONTACT = private static final ByteSource DEPOSIT_1_CONTACT =
RdeImportsTestData.get("deposit_1_contact.xml"); RdeImportsTestData.loadBytes("deposit_1_contact.xml");
private static final String IMPORT_BUCKET_NAME = "import-bucket"; private static final String IMPORT_BUCKET_NAME = "import-bucket";
private static final String IMPORT_FILE_NAME = "escrow-file.xml"; private static final String IMPORT_FILE_NAME = "escrow-file.xml";

View file

@ -40,17 +40,17 @@ import org.junit.runners.JUnit4;
public class RdeContactInputTest { public class RdeContactInputTest {
private static final ByteSource DEPOSIT_0_CONTACT = private static final ByteSource DEPOSIT_0_CONTACT =
RdeImportsTestData.get("deposit_0_contact_header.xml"); RdeImportsTestData.loadBytes("deposit_0_contact_header.xml");
private static final ByteSource DEPOSIT_1_CONTACT = private static final ByteSource DEPOSIT_1_CONTACT =
RdeImportsTestData.get("deposit_1_contact.xml"); RdeImportsTestData.loadBytes("deposit_1_contact.xml");
private static final ByteSource DEPOSIT_199_CONTACT = private static final ByteSource DEPOSIT_199_CONTACT =
RdeImportsTestData.get("deposit_199_contact_header.xml"); RdeImportsTestData.loadBytes("deposit_199_contact_header.xml");
private static final ByteSource DEPOSIT_200_CONTACT = private static final ByteSource DEPOSIT_200_CONTACT =
RdeImportsTestData.get("deposit_200_contact_header.xml"); RdeImportsTestData.loadBytes("deposit_200_contact_header.xml");
private static final ByteSource DEPOSIT_1000_CONTACT = private static final ByteSource DEPOSIT_1000_CONTACT =
RdeImportsTestData.get("deposit_1000_contact_header.xml"); RdeImportsTestData.loadBytes("deposit_1000_contact_header.xml");
private static final ByteSource DEPOSIT_10000_CONTACT = private static final ByteSource DEPOSIT_10000_CONTACT =
RdeImportsTestData.get("deposit_10000_contact_header.xml"); RdeImportsTestData.loadBytes("deposit_10000_contact_header.xml");
private static final String IMPORT_BUCKET_NAME = "import-bucket"; private static final String IMPORT_BUCKET_NAME = "import-bucket";
private static final String IMPORT_FILE_NAME = "escrow-file.xml"; private static final String IMPORT_FILE_NAME = "escrow-file.xml";

View file

@ -47,13 +47,13 @@ import org.junit.runners.JUnit4;
public class RdeContactReaderTest { public class RdeContactReaderTest {
private static final ByteSource DEPOSIT_1_CONTACT = private static final ByteSource DEPOSIT_1_CONTACT =
RdeImportsTestData.get("deposit_1_contact.xml"); RdeImportsTestData.loadBytes("deposit_1_contact.xml");
private static final ByteSource DEPOSIT_3_CONTACT = private static final ByteSource DEPOSIT_3_CONTACT =
RdeImportsTestData.get("deposit_3_contact.xml"); RdeImportsTestData.loadBytes("deposit_3_contact.xml");
private static final ByteSource DEPOSIT_4_CONTACT = private static final ByteSource DEPOSIT_4_CONTACT =
RdeImportsTestData.get("deposit_4_contact.xml"); RdeImportsTestData.loadBytes("deposit_4_contact.xml");
private static final ByteSource DEPOSIT_10_CONTACT = private static final ByteSource DEPOSIT_10_CONTACT =
RdeImportsTestData.get("deposit_10_contact.xml"); RdeImportsTestData.loadBytes("deposit_10_contact.xml");
private static final String IMPORT_BUCKET_NAME = "rde-import"; private static final String IMPORT_BUCKET_NAME = "rde-import";
private static final String IMPORT_FILE_NAME = "escrow-file.xml"; private static final String IMPORT_FILE_NAME = "escrow-file.xml";

View file

@ -68,11 +68,12 @@ import org.junit.runners.JUnit4;
@RunWith(JUnit4.class) @RunWith(JUnit4.class)
public class RdeDomainImportActionTest extends MapreduceTestCase<RdeDomainImportAction> { public class RdeDomainImportActionTest extends MapreduceTestCase<RdeDomainImportAction> {
private static final ByteSource DEPOSIT_1_DOMAIN = RdeImportsTestData.get("deposit_1_domain.xml"); private static final ByteSource DEPOSIT_1_DOMAIN =
RdeImportsTestData.loadBytes("deposit_1_domain.xml");
private static final ByteSource DEPOSIT_1_DOMAIN_PENDING_TRANSFER = private static final ByteSource DEPOSIT_1_DOMAIN_PENDING_TRANSFER =
RdeImportsTestData.get("deposit_1_domain_pending_transfer.xml"); RdeImportsTestData.loadBytes("deposit_1_domain_pending_transfer.xml");
private static final ByteSource DEPOSIT_1_DOMAIN_PENDING_TRANSFER_REG_CAP = private static final ByteSource DEPOSIT_1_DOMAIN_PENDING_TRANSFER_REG_CAP =
RdeImportsTestData.get("deposit_1_domain_pending_transfer_registration_cap.xml"); RdeImportsTestData.loadBytes("deposit_1_domain_pending_transfer_registration_cap.xml");
private static final String IMPORT_BUCKET_NAME = "import-bucket"; private static final String IMPORT_BUCKET_NAME = "import-bucket";
private static final String IMPORT_FILE_NAME = "escrow-file.xml"; private static final String IMPORT_FILE_NAME = "escrow-file.xml";

View file

@ -15,6 +15,7 @@
package google.registry.rde.imports; package google.registry.rde.imports;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.rde.imports.RdeImportsTestData.loadBytes;
import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.persistActiveContact; import static google.registry.testing.DatastoreHelper.persistActiveContact;
@ -49,11 +50,10 @@ import org.junit.runners.JUnit4;
@RunWith(JUnit4.class) @RunWith(JUnit4.class)
public class RdeDomainReaderTest { public class RdeDomainReaderTest {
private static final ByteSource DEPOSIT_1_DOMAIN = RdeImportsTestData.get("deposit_1_domain.xml"); private static final ByteSource DEPOSIT_1_DOMAIN = loadBytes("deposit_1_domain.xml");
private static final ByteSource DEPOSIT_3_DOMAIN = RdeImportsTestData.get("deposit_3_domain.xml"); private static final ByteSource DEPOSIT_3_DOMAIN = loadBytes("deposit_3_domain.xml");
private static final ByteSource DEPOSIT_4_DOMAIN = RdeImportsTestData.get("deposit_4_domain.xml"); private static final ByteSource DEPOSIT_4_DOMAIN = loadBytes("deposit_4_domain.xml");
private static final ByteSource DEPOSIT_10_DOMAIN = private static final ByteSource DEPOSIT_10_DOMAIN = loadBytes("deposit_10_domain.xml");
RdeImportsTestData.get("deposit_10_domain.xml");
private static final String IMPORT_BUCKET_NAME = "rde-import"; private static final String IMPORT_BUCKET_NAME = "rde-import";
private static final String IMPORT_FILE_NAME = "escrow-file.xml"; private static final String IMPORT_FILE_NAME = "escrow-file.xml";

View file

@ -16,6 +16,7 @@ package google.registry.rde.imports;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.rde.imports.RdeImportsTestData.loadBytes;
import static google.registry.testing.DatastoreHelper.getHistoryEntries; import static google.registry.testing.DatastoreHelper.getHistoryEntries;
import static google.registry.testing.DatastoreHelper.newHostResource; import static google.registry.testing.DatastoreHelper.newHostResource;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
@ -53,7 +54,7 @@ import org.junit.runners.JUnit4;
@RunWith(JUnit4.class) @RunWith(JUnit4.class)
public class RdeHostImportActionTest extends MapreduceTestCase<RdeHostImportAction> { public class RdeHostImportActionTest extends MapreduceTestCase<RdeHostImportAction> {
private static final ByteSource DEPOSIT_1_HOST = RdeImportsTestData.get("deposit_1_host.xml"); private static final ByteSource DEPOSIT_1_HOST = loadBytes("deposit_1_host.xml");
private static final String IMPORT_BUCKET_NAME = "import-bucket"; private static final String IMPORT_BUCKET_NAME = "import-bucket";
private static final String IMPORT_FILE_NAME = "escrow-file.xml"; private static final String IMPORT_FILE_NAME = "escrow-file.xml";

View file

@ -15,6 +15,7 @@
package google.registry.rde.imports; package google.registry.rde.imports;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.rde.imports.RdeImportsTestData.loadBytes;
import com.google.appengine.tools.cloudstorage.GcsFilename; import com.google.appengine.tools.cloudstorage.GcsFilename;
import com.google.appengine.tools.cloudstorage.GcsService; import com.google.appengine.tools.cloudstorage.GcsService;
@ -40,17 +41,12 @@ import org.junit.runners.JUnit4;
@RunWith(JUnit4.class) @RunWith(JUnit4.class)
public class RdeHostInputTest { public class RdeHostInputTest {
private static final ByteSource DEPOSIT_0_HOST = private static final ByteSource DEPOSIT_0_HOST = loadBytes("deposit_0_host_header.xml");
RdeImportsTestData.get("deposit_0_host_header.xml"); private static final ByteSource DEPOSIT_1_HOST = loadBytes("deposit_1_host.xml");
private static final ByteSource DEPOSIT_1_HOST = RdeImportsTestData.get("deposit_1_host.xml"); private static final ByteSource DEPOSIT_199_HOST = loadBytes("deposit_199_host_header.xml");
private static final ByteSource DEPOSIT_199_HOST = private static final ByteSource DEPOSIT_200_HOST = loadBytes("deposit_200_host_header.xml");
RdeImportsTestData.get("deposit_199_host_header.xml"); private static final ByteSource DEPOSIT_1000_HOST = loadBytes("deposit_1000_host_header.xml");
private static final ByteSource DEPOSIT_200_HOST = private static final ByteSource DEPOSIT_10000_HOST = loadBytes("deposit_10000_host_header.xml");
RdeImportsTestData.get("deposit_200_host_header.xml");
private static final ByteSource DEPOSIT_1000_HOST =
RdeImportsTestData.get("deposit_1000_host_header.xml");
private static final ByteSource DEPOSIT_10000_HOST =
RdeImportsTestData.get("deposit_10000_host_header.xml");
private static final String IMPORT_BUCKET_NAME = "import-bucket"; private static final String IMPORT_BUCKET_NAME = "import-bucket";
private static final String IMPORT_FILE_NAME = "escrow-file.xml"; private static final String IMPORT_FILE_NAME = "escrow-file.xml";
@ -220,7 +216,7 @@ public class RdeHostInputTest {
/** /**
* Verify bucket, filename, offset and max results for a specific reader * Verify bucket, filename, offset and max results for a specific reader
* *
* @param numberOfShards Number of desired shards ({@link Optional#absent} uses default of 50) * @param numberOfShards Number of desired shards ({@link Optional#empty} uses default of 50)
* @param whichReader Index of the reader in the list that is produced by the {@link RdeHostInput} * @param whichReader Index of the reader in the list that is produced by the {@link RdeHostInput}
* @param expectedOffset Expected offset of the reader * @param expectedOffset Expected offset of the reader
* @param expectedMaxResults Expected maxResults of the reader * @param expectedMaxResults Expected maxResults of the reader
@ -248,7 +244,7 @@ public class RdeHostInputTest {
/** /**
* Verify the number of readers produced by the {@link RdeHostInput} * Verify the number of readers produced by the {@link RdeHostInput}
* *
* @param numberOfShards Number of desired shards ({@link Optional#absent} uses default of 50) * @param numberOfShards Number of desired shards ({@link Optional#empty} uses default of 50)
* @param expectedNumberOfReaders Expected size of the list returned * @param expectedNumberOfReaders Expected size of the list returned
*/ */
private void assertNumberOfReaders(Optional<Integer> numberOfShards, int expectedNumberOfReaders) private void assertNumberOfReaders(Optional<Integer> numberOfShards, int expectedNumberOfReaders)
@ -260,7 +256,7 @@ public class RdeHostInputTest {
/** /**
* Creates a new testable instance of {@link RdeHostInput} * Creates a new testable instance of {@link RdeHostInput}
* @param mapShards Number of desired shards ({@link Optional#absent} uses default of 50) * @param mapShards Number of desired shards ({@link Optional#empty} uses default of 50)
*/ */
private RdeHostInput getInput(Optional<Integer> mapShards) { private RdeHostInput getInput(Optional<Integer> mapShards) {
return new RdeHostInput(mapShards, IMPORT_BUCKET_NAME, IMPORT_FILE_NAME); return new RdeHostInput(mapShards, IMPORT_BUCKET_NAME, IMPORT_FILE_NAME);

View file

@ -17,6 +17,7 @@ package google.registry.rde.imports;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.model.eppcommon.StatusValue.PENDING_DELETE; import static google.registry.model.eppcommon.StatusValue.PENDING_DELETE;
import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.rde.imports.RdeImportsTestData.loadBytes;
import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.newDomainResource; import static google.registry.testing.DatastoreHelper.newDomainResource;
import static google.registry.testing.DatastoreHelper.newHostResource; import static google.registry.testing.DatastoreHelper.newHostResource;
@ -60,7 +61,7 @@ import org.junit.runners.JUnit4;
@RunWith(JUnit4.class) @RunWith(JUnit4.class)
public class RdeHostLinkActionTest extends MapreduceTestCase<RdeHostLinkAction> { public class RdeHostLinkActionTest extends MapreduceTestCase<RdeHostLinkAction> {
private static final ByteSource DEPOSIT_1_HOST = RdeImportsTestData.get("deposit_1_host.xml"); private static final ByteSource DEPOSIT_1_HOST = loadBytes("deposit_1_host.xml");
private static final String IMPORT_BUCKET_NAME = "import-bucket"; private static final String IMPORT_BUCKET_NAME = "import-bucket";
private static final String IMPORT_FILE_NAME = "escrow-file.xml"; private static final String IMPORT_FILE_NAME = "escrow-file.xml";

View file

@ -15,6 +15,7 @@
package google.registry.rde.imports; package google.registry.rde.imports;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.rde.imports.RdeImportsTestData.loadBytes;
import com.google.appengine.tools.cloudstorage.GcsFilename; import com.google.appengine.tools.cloudstorage.GcsFilename;
import com.google.appengine.tools.cloudstorage.GcsService; import com.google.appengine.tools.cloudstorage.GcsService;
@ -46,10 +47,10 @@ import org.junit.runners.JUnit4;
@RunWith(JUnit4.class) @RunWith(JUnit4.class)
public class RdeHostReaderTest { public class RdeHostReaderTest {
private static final ByteSource DEPOSIT_1_HOST = RdeImportsTestData.get("deposit_1_host.xml"); private static final ByteSource DEPOSIT_1_HOST = loadBytes("deposit_1_host.xml");
private static final ByteSource DEPOSIT_3_HOST = RdeImportsTestData.get("deposit_3_host.xml"); private static final ByteSource DEPOSIT_3_HOST = loadBytes("deposit_3_host.xml");
private static final ByteSource DEPOSIT_4_HOST = RdeImportsTestData.get("deposit_4_host.xml"); private static final ByteSource DEPOSIT_4_HOST = loadBytes("deposit_4_host.xml");
private static final ByteSource DEPOSIT_10_HOST = RdeImportsTestData.get("deposit_10_host.xml"); private static final ByteSource DEPOSIT_10_HOST = loadBytes("deposit_10_host.xml");
private static final String IMPORT_BUCKET_NAME = "rde-import"; private static final String IMPORT_BUCKET_NAME = "rde-import";
private static final String IMPORT_FILE_NAME = "escrow-file.xml"; private static final String IMPORT_FILE_NAME = "escrow-file.xml";

View file

@ -67,13 +67,13 @@ import org.junit.runners.JUnit4;
@RunWith(JUnit4.class) @RunWith(JUnit4.class)
public class RdeImportUtilsTest extends ShardableTestCase { public class RdeImportUtilsTest extends ShardableTestCase {
private static final ByteSource DEPOSIT_XML = RdeImportsTestData.get("deposit_full.xml"); private static final ByteSource DEPOSIT_XML = RdeImportsTestData.loadBytes("deposit_full.xml");
private static final ByteSource DEPOSIT_BADTLD_XML = private static final ByteSource DEPOSIT_BADTLD_XML =
RdeImportsTestData.get("deposit_full_badtld.xml"); RdeImportsTestData.loadBytes("deposit_full_badtld.xml");
private static final ByteSource DEPOSIT_GETLD_XML = private static final ByteSource DEPOSIT_GETLD_XML =
RdeImportsTestData.get("deposit_full_getld.xml"); RdeImportsTestData.loadBytes("deposit_full_getld.xml");
private static final ByteSource DEPOSIT_BADREGISTRAR_XML = private static final ByteSource DEPOSIT_BADREGISTRAR_XML =
RdeImportsTestData.get("deposit_full_badregistrar.xml"); RdeImportsTestData.loadBytes("deposit_full_badregistrar.xml");
private InputStream xmlInput; private InputStream xmlInput;

View file

@ -21,14 +21,14 @@ import google.registry.testing.TestDataHelper;
public final class RdeImportsTestData { public final class RdeImportsTestData {
/** Returns {@link ByteSource} for file in {@code rde/imports/testdata/} directory. */ /** Returns {@link ByteSource} for file in {@code rde/imports/testdata/} directory. */
public static ByteSource get(String filename) { public static ByteSource loadBytes(String filename) {
return TestDataHelper.loadBytes(RdeImportsTestData.class, filename); return TestDataHelper.loadBytes(RdeImportsTestData.class, filename);
} }
/** /**
* Loads data from file in {@code rde/imports/testdata/} as a String (assuming file is UTF-8). * Loads data from file in {@code rde/imports/testdata/} as a String (assuming file is UTF-8).
*/ */
public static String loadUtf8(String filename) { public static String loadFile(String filename) {
return TestDataHelper.loadFile(RdeImportsTestData.class, filename); return TestDataHelper.loadFile(RdeImportsTestData.class, filename);
} }
} }

View file

@ -15,6 +15,7 @@
package google.registry.rde.imports; package google.registry.rde.imports;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.rde.imports.RdeImportsTestData.loadBytes;
import com.google.common.io.ByteSource; import com.google.common.io.ByteSource;
import google.registry.rde.imports.RdeParser.RdeHeader; import google.registry.rde.imports.RdeParser.RdeHeader;
@ -40,7 +41,7 @@ import org.junit.runners.JUnit4;
@RunWith(JUnit4.class) @RunWith(JUnit4.class)
public class RdeParserTest { public class RdeParserTest {
private static final ByteSource DEPOSIT_XML = RdeImportsTestData.get("deposit_full_parser.xml"); private static final ByteSource DEPOSIT_XML = loadBytes("deposit_full_parser.xml");
private InputStream xml; private InputStream xml;

View file

@ -17,6 +17,7 @@ package google.registry.rde.imports;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.rde.imports.RdeImportTestUtils.checkTrid; import static google.registry.rde.imports.RdeImportTestUtils.checkTrid;
import static google.registry.rde.imports.RdeImportsTestData.loadBytes;
import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.getHistoryEntries; import static google.registry.testing.DatastoreHelper.getHistoryEntries;
import static java.util.Arrays.asList; import static java.util.Arrays.asList;
@ -63,7 +64,7 @@ public class XjcToContactResourceConverterTest {
"google.registry.xjc.rderegistrar", "google.registry.xjc.rderegistrar",
"google.registry.xjc.smd")); "google.registry.xjc.smd"));
private static final ByteSource CONTACT_XML = RdeImportsTestData.get("contact_fragment.xml"); private static final ByteSource CONTACT_XML = loadBytes("contact_fragment.xml");
@Rule @Rule
public final AppEngineRule appEngine = AppEngineRule.builder() public final AppEngineRule appEngine = AppEngineRule.builder()

View file

@ -426,7 +426,7 @@ public class XjcToDomainResourceConverterTest {
private XjcRdeDomain loadDomainFromRdeXml(String filename) { private XjcRdeDomain loadDomainFromRdeXml(String filename) {
try { try {
ByteSource source = RdeImportsTestData.get(filename); ByteSource source = RdeImportsTestData.loadBytes(filename);
try (InputStream ins = source.openStream()) { try (InputStream ins = source.openStream()) {
return ((XjcRdeDomainElement) unmarshaller.unmarshal(ins)).getValue(); return ((XjcRdeDomainElement) unmarshaller.unmarshal(ins)).getValue();
} }

View file

@ -49,9 +49,9 @@ import org.junit.runners.JUnit4;
@RunWith(JUnit4.class) @RunWith(JUnit4.class)
public class XjcToHostResourceConverterTest extends ShardableTestCase { public class XjcToHostResourceConverterTest extends ShardableTestCase {
private static final ByteSource HOST_XML = RdeImportsTestData.get("host_fragment.xml"); private static final ByteSource HOST_XML = RdeImportsTestData.loadBytes("host_fragment.xml");
private static final ByteSource HOST_XML_UCASE = private static final ByteSource HOST_XML_UCASE =
RdeImportsTestData.get("host_fragment_ucase.xml"); RdeImportsTestData.loadBytes("host_fragment_ucase.xml");
// List of packages to initialize JAXBContext // List of packages to initialize JAXBContext
private static final String JAXB_CONTEXT_PACKAGES = Joiner.on(":") private static final String JAXB_CONTEXT_PACKAGES = Joiner.on(":")

View file

@ -61,7 +61,7 @@ public class ActivityReportingQueryBuilderTest {
String actualTableName = String.format("%s_201709", queryName); String actualTableName = String.format("%s_201709", queryName);
String testFilename = String.format("%s_test.sql", queryName); String testFilename = String.format("%s_test.sql", queryName);
assertThat(actualQueries.get(actualTableName)) assertThat(actualQueries.get(actualTableName))
.isEqualTo(ReportingTestData.getString(testFilename)); .isEqualTo(ReportingTestData.loadFile(testFilename));
} }
} }

View file

@ -45,8 +45,8 @@ import org.junit.runners.JUnit4;
@RunWith(JUnit4.class) @RunWith(JUnit4.class)
public class IcannHttpReporterTest { public class IcannHttpReporterTest {
private static final ByteSource IIRDEA_GOOD_XML = ReportingTestData.get("iirdea_good.xml"); private static final ByteSource IIRDEA_GOOD_XML = ReportingTestData.loadBytes("iirdea_good.xml");
private static final ByteSource IIRDEA_BAD_XML = ReportingTestData.get("iirdea_bad.xml"); private static final ByteSource IIRDEA_BAD_XML = ReportingTestData.loadBytes("iirdea_bad.xml");
private static final byte[] FAKE_PAYLOAD = "test,csv\n1,2".getBytes(UTF_8); private static final byte[] FAKE_PAYLOAD = "test,csv\n1,2".getBytes(UTF_8);
private MockLowLevelHttpRequest mockRequest; private MockLowLevelHttpRequest mockRequest;

View file

@ -21,12 +21,12 @@ import google.registry.testing.TestDataHelper;
public final class ReportingTestData { public final class ReportingTestData {
/** Returns {@link ByteSource} for file in {@code reporting/testdata/} directory. */ /** Returns {@link ByteSource} for file in {@code reporting/testdata/} directory. */
public static ByteSource get(String filename) { public static ByteSource loadBytes(String filename) {
return TestDataHelper.loadBytes(ReportingTestData.class, filename); return TestDataHelper.loadBytes(ReportingTestData.class, filename);
} }
/** Returns a {@link String} from a file in the {@code reporting/testdata/} directory. */ /** Returns a {@link String} from a file in the {@code reporting/testdata/} directory. */
public static String getString(String filename) { public static String loadFile(String filename) {
return TestDataHelper.loadFile(ReportingTestData.class, filename); return TestDataHelper.loadFile(ReportingTestData.class, filename);
} }
} }

View file

@ -62,7 +62,7 @@ public class TransactionsReportingQueryBuilderTest {
String actualTableName = String.format("%s_201709", queryName); String actualTableName = String.format("%s_201709", queryName);
String testFilename = String.format("%s_test.sql", queryName); String testFilename = String.format("%s_test.sql", queryName);
assertThat(actualQueries.get(actualTableName)) assertThat(actualQueries.get(actualTableName))
.isEqualTo(ReportingTestData.getString(testFilename)); .isEqualTo(ReportingTestData.loadFile(testFilename));
} }
} }
} }

View file

@ -15,7 +15,7 @@
package google.registry.testing; package google.registry.testing;
import static google.registry.flows.EppXmlTransformer.unmarshal; import static google.registry.flows.EppXmlTransformer.unmarshal;
import static google.registry.testing.TestDataHelper.loadFileWithSubstitutions; import static google.registry.testing.TestDataHelper.loadFile;
import static java.nio.charset.StandardCharsets.UTF_8; import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
@ -33,7 +33,7 @@ public class EppLoader {
} }
public EppLoader(Object context, String eppXmlFilename, Map<String, String> substitutions) { public EppLoader(Object context, String eppXmlFilename, Map<String, String> substitutions) {
this.eppXml = loadFileWithSubstitutions(context.getClass(), eppXmlFilename, substitutions); this.eppXml = loadFile(context.getClass(), eppXmlFilename, substitutions);
} }
public EppInput getEpp() throws EppException { public EppInput getEpp() throws EppException {

View file

@ -55,7 +55,7 @@ public final class TestDataHelper {
* Loads a text file from the "testdata" directory relative to the location of the specified * Loads a text file from the "testdata" directory relative to the location of the specified
* context class, and substitutes in values for placeholders of the form <code>%tagname%</code>. * context class, and substitutes in values for placeholders of the form <code>%tagname%</code>.
*/ */
public static String loadFileWithSubstitutions( public static String loadFile(
Class<?> context, String filename, Map<String, String> substitutions) { Class<?> context, String filename, Map<String, String> substitutions) {
String fileContents = loadFile(context, filename); String fileContents = loadFile(context, filename);
for (Entry<String, String> entry : nullToEmpty(substitutions).entrySet()) { for (Entry<String, String> entry : nullToEmpty(substitutions).entrySet()) {

View file

@ -16,7 +16,7 @@ package google.registry.tmch;
import static google.registry.config.RegistryConfig.ConfigModule.TmchCaMode.PILOT; import static google.registry.config.RegistryConfig.ConfigModule.TmchCaMode.PILOT;
import static google.registry.config.RegistryConfig.ConfigModule.TmchCaMode.PRODUCTION; import static google.registry.config.RegistryConfig.ConfigModule.TmchCaMode.PRODUCTION;
import static google.registry.tmch.TmchTestData.loadString; import static google.registry.tmch.TmchTestData.loadFile;
import static google.registry.util.ResourceUtils.readResourceUtf8; import static google.registry.util.ResourceUtils.readResourceUtf8;
import static google.registry.util.X509Utils.loadCertificate; import static google.registry.util.X509Utils.loadCertificate;
@ -40,8 +40,8 @@ import org.junit.runners.JUnit4;
@RunWith(JUnit4.class) @RunWith(JUnit4.class)
public class TmchCertificateAuthorityTest { public class TmchCertificateAuthorityTest {
public static final String GOOD_TEST_CERTIFICATE = loadString("icann-tmch-test-good.crt"); public static final String GOOD_TEST_CERTIFICATE = loadFile("icann-tmch-test-good.crt");
public static final String REVOKED_TEST_CERTIFICATE = loadString("icann-tmch-test-revoked.crt"); public static final String REVOKED_TEST_CERTIFICATE = loadFile("icann-tmch-test-revoked.crt");
@Rule @Rule
public final AppEngineRule appEngine = AppEngineRule.builder() public final AppEngineRule appEngine = AppEngineRule.builder()

View file

@ -32,13 +32,13 @@ public final class TmchTestData {
} }
/** Loads data from file in {@code tmch/testdata/} as a String. */ /** Loads data from file in {@code tmch/testdata/} as a String. */
public static String loadString(String filename) { public static String loadFile(String filename) {
return TestDataHelper.loadFile(TmchTestData.class, filename); return TestDataHelper.loadFile(TmchTestData.class, filename);
} }
/** Extracts SMD XML from an ASCII-armored file. */ /** Extracts SMD XML from an ASCII-armored file. */
public static byte[] loadSmd(String file) { public static byte[] loadSmd(String file) {
String data = loadString(file); String data = loadFile(file);
return base64().decode(whitespace().removeFrom(data.substring( return base64().decode(whitespace().removeFrom(data.substring(
data.indexOf(BEGIN_ENCODED_SMD) + BEGIN_ENCODED_SMD.length(), data.indexOf(BEGIN_ENCODED_SMD) + BEGIN_ENCODED_SMD.length(),
data.indexOf(END_ENCODED_SMD)))); data.indexOf(END_ENCODED_SMD))));

View file

@ -104,7 +104,7 @@ public class AllocateDomainCommandTest extends CommandTestCase<AllocateDomainCom
.setClientId("NewRegistrar") .setClientId("NewRegistrar")
.setModificationTime(application.getCreationTime()) .setModificationTime(application.getCreationTime())
.setTrid(Trid.create("ABC-123", "server-trid")) .setTrid(Trid.create("ABC-123", "server-trid"))
.setXmlBytes(ToolsTestData.get(xmlFile).read()) .setXmlBytes(ToolsTestData.loadBytes(xmlFile).read())
.build()); .build());
} }
@ -149,7 +149,7 @@ public class AllocateDomainCommandTest extends CommandTestCase<AllocateDomainCom
@Test @Test
public void testXmlInstantiatesFlow() throws Exception { public void testXmlInstantiatesFlow() throws Exception {
byte[] xmlBytes = ToolsTestData.get("allocate_domain.xml").read(); byte[] xmlBytes = ToolsTestData.loadBytes("allocate_domain.xml").read();
assertThat(getFlowClass(unmarshal(EppInput.class, xmlBytes))) assertThat(getFlowClass(unmarshal(EppInput.class, xmlBytes)))
.isEqualTo(DomainAllocateFlow.class); .isEqualTo(DomainAllocateFlow.class);
} }

View file

@ -51,7 +51,7 @@ public class EppToolCommandTest extends EppToolCommandTestCase<EppToolCommand> {
// The choice of xml file is arbitrary. // The choice of xml file is arbitrary.
runCommandForced( runCommandForced(
"--client=NewRegistrar", "--client=NewRegistrar",
ToolsTestData.loadUtf8("contact_create.xml")); ToolsTestData.loadFile("contact_create.xml"));
eppVerifier.verifySent("contact_create.xml"); eppVerifier.verifySent("contact_create.xml");
} }
@ -60,9 +60,9 @@ public class EppToolCommandTest extends EppToolCommandTestCase<EppToolCommand> {
// The choice of xml files is arbitrary. // The choice of xml files is arbitrary.
runCommandForced( runCommandForced(
"--client=NewRegistrar", "--client=NewRegistrar",
ToolsTestData.loadUtf8("contact_create.xml"), ToolsTestData.loadFile("contact_create.xml"),
ToolsTestData.loadUtf8("domain_check.xml"), ToolsTestData.loadFile("domain_check.xml"),
ToolsTestData.loadUtf8("domain_check_fee.xml")); ToolsTestData.loadFile("domain_check_fee.xml"));
eppVerifier eppVerifier
.verifySent("contact_create.xml") .verifySent("contact_create.xml")
.verifySent("domain_check.xml") .verifySent("domain_check.xml")

View file

@ -68,7 +68,7 @@ public class EppToolVerifier {
/** /**
* Sets the expected clientId for any following verifySent command. * Sets the expected clientId for any following verifySent command.
* *
* <p>Must be called at least once before any {@link verifySent} calls. * <p>Must be called at least once before any {@link #verifySent} calls.
*/ */
public EppToolVerifier expectClientId(String clientId) { public EppToolVerifier expectClientId(String clientId) {
this.clientId = clientId; this.clientId = clientId;
@ -78,7 +78,7 @@ public class EppToolVerifier {
/** /**
* Declares that any following verifySent command expects the "superuser" flag to be set. * Declares that any following verifySent command expects the "superuser" flag to be set.
* *
* <p>If not called, {@link verifySent} will expect the "superuser" flag to be false. * <p>If not called, {@link #verifySent} will expect the "superuser" flag to be false.
*/ */
public EppToolVerifier expectSuperuser() { public EppToolVerifier expectSuperuser() {
this.superuser = true; this.superuser = true;
@ -88,7 +88,7 @@ public class EppToolVerifier {
/** /**
* Declares that any following verifySent command expects the "dryRun" flag to be set. * Declares that any following verifySent command expects the "dryRun" flag to be set.
* *
* <p>If not called, {@link verifySent} will expect the "dryRun" flag to be false. * <p>If not called, {@link #verifySent} will expect the "dryRun" flag to be false.
*/ */
public EppToolVerifier expectDryRun() { public EppToolVerifier expectDryRun() {
this.dryRun = true; this.dryRun = true;
@ -109,7 +109,7 @@ public class EppToolVerifier {
* resides in the tools/server/testdata directory. * resides in the tools/server/testdata directory.
*/ */
public EppToolVerifier verifySent(String expectedXmlFile) throws Exception { public EppToolVerifier verifySent(String expectedXmlFile) throws Exception {
return verifySentContents(ToolsTestData.loadUtf8(expectedXmlFile)); return verifySentContents(ToolsTestData.loadFile(expectedXmlFile));
} }
/** /**
@ -129,7 +129,7 @@ public class EppToolVerifier {
*/ */
public EppToolVerifier verifySent(String expectedXmlFile, Map<String, String> substitutions) public EppToolVerifier verifySent(String expectedXmlFile, Map<String, String> substitutions)
throws Exception { throws Exception {
return verifySentContents(ToolsTestData.loadUtf8(expectedXmlFile, substitutions)); return verifySentContents(ToolsTestData.loadFile(expectedXmlFile, substitutions));
} }
/** /**

View file

@ -35,7 +35,7 @@ public class ExecuteEppCommandTest extends EppToolCommandTestCase<ExecuteEppComm
@Before @Before
public void initCommand() throws Exception { public void initCommand() throws Exception {
xmlInput = ToolsTestData.loadUtf8("contact_create.xml"); xmlInput = ToolsTestData.loadFile("contact_create.xml");
eppFile = writeToNamedTmpFile("eppFile", xmlInput); eppFile = writeToNamedTmpFile("eppFile", xmlInput);
} }
@ -67,7 +67,7 @@ public class ExecuteEppCommandTest extends EppToolCommandTestCase<ExecuteEppComm
@Test @Test
public void testSuccess_multipleFiles() throws Exception { public void testSuccess_multipleFiles() throws Exception {
String xmlInput2 = ToolsTestData.loadUtf8("domain_check.xml"); String xmlInput2 = ToolsTestData.loadFile("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);
eppVerifier eppVerifier

View file

@ -29,7 +29,7 @@ public class ValidateEscrowDepositCommandTest
@Test @Test
public void testRun_plainXml() throws Exception { public void testRun_plainXml() throws Exception {
String file = writeToTmpFile(RdeTestData.get("deposit_full.xml").read()); String file = writeToTmpFile(RdeTestData.loadBytes("deposit_full.xml").read());
runCommand("--input=" + file); runCommand("--input=" + file);
assertThat(getStdoutAsString()).isEqualTo("" assertThat(getStdoutAsString()).isEqualTo(""
+ "ID: 20101017001\n" + "ID: 20101017001\n"
@ -64,7 +64,7 @@ public class ValidateEscrowDepositCommandTest
@Test @Test
public void testRun_plainXml_badReference() throws Exception { public void testRun_plainXml_badReference() throws Exception {
String file = writeToTmpFile(RdeTestData.get("deposit_full_badref.xml").read()); String file = writeToTmpFile(RdeTestData.loadBytes("deposit_full_badref.xml").read());
runCommand("--input=" + file); runCommand("--input=" + file);
assertThat(getStdoutAsString()).isEqualTo("" assertThat(getStdoutAsString()).isEqualTo(""
+ "ID: 20101017001\n" + "ID: 20101017001\n"
@ -100,7 +100,7 @@ public class ValidateEscrowDepositCommandTest
@Test @Test
public void testRun_badXml() throws Exception { public void testRun_badXml() throws Exception {
String file = writeToTmpFile(RdeTestData.loadUtf8("deposit_full.xml").substring(0, 2000)); String file = writeToTmpFile(RdeTestData.loadFile("deposit_full.xml").substring(0, 2000));
thrown.expect(XmlException.class, "Syntax error at line 46, column 38: " thrown.expect(XmlException.class, "Syntax error at line 46, column 38: "
+ "XML document structures must start and end within the same entity."); + "XML document structures must start and end within the same entity.");
runCommand("--input=" + file); runCommand("--input=" + file);

View file

@ -22,21 +22,21 @@ import java.util.Map;
public final class ToolsTestData { public final class ToolsTestData {
/** Returns {@link ByteSource} for file in {@code tools/server/testdata/} directory. */ /** Returns {@link ByteSource} for file in {@code tools/server/testdata/} directory. */
public static ByteSource get(String filename) { public static ByteSource loadBytes(String filename) {
return TestDataHelper.loadBytes(ToolsTestData.class, filename); return TestDataHelper.loadBytes(ToolsTestData.class, filename);
} }
/** /**
* Loads data from file in {@code tools/server/testdata/} as a UTF-8 String. * Loads data from file in {@code tools/server/testdata/} as a UTF-8 String.
*/ */
public static String loadUtf8(String filename) { public static String loadFile(String filename) {
return TestDataHelper.loadFile(ToolsTestData.class, filename); return TestDataHelper.loadFile(ToolsTestData.class, filename);
} }
/** /**
* Loads data from file in {@code tools/server/testdata/} as a UTF-8 String, with substitutions. * Loads data from file in {@code tools/server/testdata/} as a UTF-8 String, with substitutions.
*/ */
public static String loadUtf8(String filename, Map<String, String> substitutions) { public static String loadFile(String filename, Map<String, String> substitutions) {
return TestDataHelper.loadFileWithSubstitutions(ToolsTestData.class, filename, substitutions); return TestDataHelper.loadFile(ToolsTestData.class, filename, substitutions);
} }
} }

View file

@ -48,128 +48,128 @@ public class VerifyOteActionTest {
new HistoryEntry.Builder() new HistoryEntry.Builder()
.setClientId("blobio-1") .setClientId("blobio-1")
.setType(Type.DOMAIN_APPLICATION_CREATE) .setType(Type.DOMAIN_APPLICATION_CREATE)
.setXmlBytes(ToolsTestData.get("domain_create_complete.xml").read()) .setXmlBytes(ToolsTestData.loadBytes("domain_create_complete.xml").read())
.build()); .build());
persistResource( persistResource(
new HistoryEntry.Builder() new HistoryEntry.Builder()
.setClientId("blobio-1") .setClientId("blobio-1")
.setType(Type.DOMAIN_APPLICATION_CREATE) .setType(Type.DOMAIN_APPLICATION_CREATE)
.setXmlBytes(ToolsTestData.get("domain_create_sunrise.xml").read()) .setXmlBytes(ToolsTestData.loadBytes("domain_create_sunrise.xml").read())
.build()); .build());
persistResource( persistResource(
new HistoryEntry.Builder() new HistoryEntry.Builder()
.setClientId("blobio-1") .setClientId("blobio-1")
.setType(Type.DOMAIN_APPLICATION_DELETE) .setType(Type.DOMAIN_APPLICATION_DELETE)
.setXmlBytes(ToolsTestData.get("domain_delete.xml").read()) .setXmlBytes(ToolsTestData.loadBytes("domain_delete.xml").read())
.build()); .build());
persistResource( persistResource(
new HistoryEntry.Builder() new HistoryEntry.Builder()
.setClientId("blobio-2") .setClientId("blobio-2")
.setType(Type.DOMAIN_APPLICATION_DELETE) .setType(Type.DOMAIN_APPLICATION_DELETE)
.setXmlBytes(ToolsTestData.get("domain_delete.xml").read()) .setXmlBytes(ToolsTestData.loadBytes("domain_delete.xml").read())
.build()); .build());
persistResource( persistResource(
new HistoryEntry.Builder() new HistoryEntry.Builder()
.setClientId("blobio-1") .setClientId("blobio-1")
.setType(Type.DOMAIN_APPLICATION_UPDATE) .setType(Type.DOMAIN_APPLICATION_UPDATE)
.setXmlBytes(ToolsTestData.get("domain_update_complete.xml").read()) .setXmlBytes(ToolsTestData.loadBytes("domain_update_complete.xml").read())
.build()); .build());
persistResource( persistResource(
new HistoryEntry.Builder() new HistoryEntry.Builder()
.setClientId("blobio-2") .setClientId("blobio-2")
.setType(Type.DOMAIN_APPLICATION_UPDATE) .setType(Type.DOMAIN_APPLICATION_UPDATE)
.setXmlBytes(ToolsTestData.get("domain_update_complete.xml").read()) .setXmlBytes(ToolsTestData.loadBytes("domain_update_complete.xml").read())
.build()); .build());
persistResource( persistResource(
new HistoryEntry.Builder() new HistoryEntry.Builder()
.setClientId("blobio-1") .setClientId("blobio-1")
.setType(Type.DOMAIN_CREATE) .setType(Type.DOMAIN_CREATE)
.setXmlBytes(ToolsTestData.get("domain_create_idn.xml").read()) .setXmlBytes(ToolsTestData.loadBytes("domain_create_idn.xml").read())
.build()); .build());
persistResource( persistResource(
new HistoryEntry.Builder() new HistoryEntry.Builder()
.setClientId("blobio-1") .setClientId("blobio-1")
.setType(Type.DOMAIN_CREATE) .setType(Type.DOMAIN_CREATE)
.setXmlBytes(ToolsTestData.get("domain_create_claim_notice.xml").read()) .setXmlBytes(ToolsTestData.loadBytes("domain_create_claim_notice.xml").read())
.build()); .build());
persistResource( persistResource(
new HistoryEntry.Builder() new HistoryEntry.Builder()
.setClientId("blobio-1") .setClientId("blobio-1")
.setType(Type.DOMAIN_CREATE) .setType(Type.DOMAIN_CREATE)
.setXmlBytes(ToolsTestData.get("domain_create_anchor_tenant_fee_standard.xml").read()) .setXmlBytes(ToolsTestData.loadBytes("domain_create_anchor_tenant_fee_standard.xml").read())
.build()); .build());
persistResource( persistResource(
new HistoryEntry.Builder() new HistoryEntry.Builder()
.setClientId("blobio-1") .setClientId("blobio-1")
.setType(Type.DOMAIN_CREATE) .setType(Type.DOMAIN_CREATE)
.setXmlBytes(ToolsTestData.get("allocate_domain.xml").read()) .setXmlBytes(ToolsTestData.loadBytes("allocate_domain.xml").read())
.build()); .build());
persistResource( persistResource(
new HistoryEntry.Builder() new HistoryEntry.Builder()
.setClientId("blobio-1") .setClientId("blobio-1")
.setType(Type.DOMAIN_DELETE) .setType(Type.DOMAIN_DELETE)
.setXmlBytes(ToolsTestData.get("domain_delete.xml").read()) .setXmlBytes(ToolsTestData.loadBytes("domain_delete.xml").read())
.build()); .build());
persistResource( persistResource(
new HistoryEntry.Builder() new HistoryEntry.Builder()
.setClientId("blobio-2") .setClientId("blobio-2")
.setType(Type.DOMAIN_DELETE) .setType(Type.DOMAIN_DELETE)
.setXmlBytes(ToolsTestData.get("domain_delete.xml").read()) .setXmlBytes(ToolsTestData.loadBytes("domain_delete.xml").read())
.build()); .build());
persistResource( persistResource(
new HistoryEntry.Builder() new HistoryEntry.Builder()
.setClientId("blobio-1") .setClientId("blobio-1")
.setType(Type.DOMAIN_RESTORE) .setType(Type.DOMAIN_RESTORE)
.setXmlBytes(ToolsTestData.get("domain_restore.xml").read()) .setXmlBytes(ToolsTestData.loadBytes("domain_restore.xml").read())
.build()); .build());
persistResource( persistResource(
new HistoryEntry.Builder() new HistoryEntry.Builder()
.setClientId("blobio-1") .setClientId("blobio-1")
.setType(Type.DOMAIN_TRANSFER_APPROVE) .setType(Type.DOMAIN_TRANSFER_APPROVE)
.setXmlBytes(ToolsTestData.get("domain_transfer_approve.xml").read()) .setXmlBytes(ToolsTestData.loadBytes("domain_transfer_approve.xml").read())
.build()); .build());
persistResource( persistResource(
new HistoryEntry.Builder() new HistoryEntry.Builder()
.setClientId("blobio-1") .setClientId("blobio-1")
.setType(Type.DOMAIN_TRANSFER_CANCEL) .setType(Type.DOMAIN_TRANSFER_CANCEL)
.setXmlBytes(ToolsTestData.get("domain_transfer_cancel.xml").read()) .setXmlBytes(ToolsTestData.loadBytes("domain_transfer_cancel.xml").read())
.build()); .build());
persistResource( persistResource(
new HistoryEntry.Builder() new HistoryEntry.Builder()
.setClientId("blobio-1") .setClientId("blobio-1")
.setType(Type.DOMAIN_TRANSFER_REJECT) .setType(Type.DOMAIN_TRANSFER_REJECT)
.setXmlBytes(ToolsTestData.get("domain_transfer_reject.xml").read()) .setXmlBytes(ToolsTestData.loadBytes("domain_transfer_reject.xml").read())
.build()); .build());
persistResource( persistResource(
new HistoryEntry.Builder() new HistoryEntry.Builder()
.setClientId("blobio-1") .setClientId("blobio-1")
.setType(Type.DOMAIN_TRANSFER_REQUEST) .setType(Type.DOMAIN_TRANSFER_REQUEST)
.setXmlBytes(ToolsTestData.get("domain_transfer_request.xml").read()) .setXmlBytes(ToolsTestData.loadBytes("domain_transfer_request.xml").read())
.build()); .build());
persistResource( persistResource(
new HistoryEntry.Builder() new HistoryEntry.Builder()
.setClientId("blobio-1") .setClientId("blobio-1")
.setType(Type.DOMAIN_UPDATE) .setType(Type.DOMAIN_UPDATE)
.setXmlBytes(ToolsTestData.get("domain_update_with_secdns.xml").read()) .setXmlBytes(ToolsTestData.loadBytes("domain_update_with_secdns.xml").read())
.build()); .build());
persistResource( persistResource(
new HistoryEntry.Builder() new HistoryEntry.Builder()
.setClientId("blobio-1") .setClientId("blobio-1")
.setType(Type.HOST_CREATE) .setType(Type.HOST_CREATE)
.setXmlBytes(ToolsTestData.get("host_create_complete.xml").read()) .setXmlBytes(ToolsTestData.loadBytes("host_create_complete.xml").read())
.build()); .build());
hostDeleteHistoryEntry = hostDeleteHistoryEntry =
persistResource( persistResource(
new HistoryEntry.Builder() new HistoryEntry.Builder()
.setClientId("blobio-1") .setClientId("blobio-1")
.setType(Type.HOST_DELETE) .setType(Type.HOST_DELETE)
.setXmlBytes(ToolsTestData.get("host_delete.xml").read()) .setXmlBytes(ToolsTestData.loadBytes("host_delete.xml").read())
.build()); .build());
persistResource( persistResource(
new HistoryEntry.Builder() new HistoryEntry.Builder()
.setClientId("blobio-1") .setClientId("blobio-1")
.setType(Type.HOST_UPDATE) .setType(Type.HOST_UPDATE)
.setXmlBytes(ToolsTestData.get("host_update.xml").read()) .setXmlBytes(ToolsTestData.loadBytes("host_update.xml").read())
.build()); .build());
} }

View file

@ -19,7 +19,7 @@ import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.loadRegistrar; import static google.registry.testing.DatastoreHelper.loadRegistrar;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.util.DateTimeUtils.END_OF_TIME; import static google.registry.util.DateTimeUtils.END_OF_TIME;
import static google.registry.whois.WhoisHelper.loadWhoisTestFile; import static google.registry.whois.WhoisTestData.loadFile;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
@ -256,7 +256,7 @@ public class DomainWhoisResponseTest {
domainWhoisResponse.getResponse( domainWhoisResponse.getResponse(
false, false,
"Doodle Disclaimer\nI exist so that carriage return\nin disclaimer can be tested.")) "Doodle Disclaimer\nI exist so that carriage return\nin disclaimer can be tested."))
.isEqualTo(WhoisResponseResults.create(loadWhoisTestFile("whois_domain.txt"), 1)); .isEqualTo(WhoisResponseResults.create(loadFile("whois_domain.txt"), 1));
} }
@Test @Test

View file

@ -17,7 +17,7 @@ package google.registry.whois;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.persistNewRegistrar; import static google.registry.testing.DatastoreHelper.persistNewRegistrar;
import static google.registry.whois.WhoisHelper.loadWhoisTestFile; import static google.registry.whois.WhoisTestData.loadFile;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
@ -80,7 +80,7 @@ public class NameserverWhoisResponseTest {
nameserverWhoisResponse.getResponse( nameserverWhoisResponse.getResponse(
false, false,
"Doodle Disclaimer\nI exist so that carriage return\nin disclaimer can be tested.")) "Doodle Disclaimer\nI exist so that carriage return\nin disclaimer can be tested."))
.isEqualTo(WhoisResponseResults.create(loadWhoisTestFile("whois_nameserver.txt"), 1)); .isEqualTo(WhoisResponseResults.create(loadFile("whois_nameserver.txt"), 1));
} }
@Test @Test
@ -92,6 +92,6 @@ public class NameserverWhoisResponseTest {
false, false,
"Doodle Disclaimer\nI exist so that carriage return\nin disclaimer can be tested.")) "Doodle Disclaimer\nI exist so that carriage return\nin disclaimer can be tested."))
.isEqualTo( .isEqualTo(
WhoisResponseResults.create(loadWhoisTestFile("whois_multiple_nameservers.txt"), 2)); WhoisResponseResults.create(loadFile("whois_multiple_nameservers.txt"), 2));
} }
} }

View file

@ -18,7 +18,7 @@ import static com.google.common.truth.Truth.assertThat;
import static google.registry.testing.DatastoreHelper.persistNewRegistrar; import static google.registry.testing.DatastoreHelper.persistNewRegistrar;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.DatastoreHelper.persistSimpleResources; import static google.registry.testing.DatastoreHelper.persistSimpleResources;
import static google.registry.whois.WhoisHelper.loadWhoisTestFile; import static google.registry.whois.WhoisTestData.loadFile;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
@ -119,7 +119,7 @@ public class RegistrarWhoisResponseTest {
registrarWhoisResponse.getResponse( registrarWhoisResponse.getResponse(
false, false,
"Doodle Disclaimer\nI exist so that carriage return\nin disclaimer can be tested.")) "Doodle Disclaimer\nI exist so that carriage return\nin disclaimer can be tested."))
.isEqualTo(WhoisResponseResults.create(loadWhoisTestFile("whois_registrar.txt"), 1)); .isEqualTo(WhoisResponseResults.create(loadFile("whois_registrar.txt"), 1));
} }
@Test @Test

View file

@ -25,7 +25,7 @@ import static google.registry.testing.FullFieldsTestEntityHelper.makeDomainResou
import static google.registry.testing.FullFieldsTestEntityHelper.makeHostResource; import static google.registry.testing.FullFieldsTestEntityHelper.makeHostResource;
import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar;
import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrarContacts; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrarContacts;
import static google.registry.whois.WhoisHelper.loadWhoisTestFile; import static google.registry.whois.WhoisTestData.loadFile;
import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST; import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST;
import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR; import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
import static javax.servlet.http.HttpServletResponse.SC_OK; import static javax.servlet.http.HttpServletResponse.SC_OK;
@ -102,7 +102,7 @@ public class WhoisHttpServerTest {
newWhoisHttpServer("").run(); newWhoisHttpServer("").run();
assertThat(response.getStatus()).isEqualTo(400); assertThat(response.getStatus()).isEqualTo(400);
assertThat(response.getContentType()).isEqualTo(PLAIN_TEXT_UTF_8); assertThat(response.getContentType()).isEqualTo(PLAIN_TEXT_UTF_8);
assertThat(response.getPayload()).isEqualTo(loadWhoisTestFile("whois_server_no_command.txt")); assertThat(response.getPayload()).isEqualTo(loadFile("whois_server_no_command.txt"));
} }
@Test @Test
@ -111,7 +111,7 @@ public class WhoisHttpServerTest {
assertThat(response.getStatus()).isEqualTo(400); assertThat(response.getStatus()).isEqualTo(400);
assertThat(response.getContentType()).isEqualTo(PLAIN_TEXT_UTF_8); assertThat(response.getContentType()).isEqualTo(PLAIN_TEXT_UTF_8);
assertThat(response.getPayload()) assertThat(response.getPayload())
.isEqualTo(loadWhoisTestFile("whois_server_malformed_path.txt")); .isEqualTo(loadFile("whois_server_malformed_path.txt"));
} }
@Test @Test
@ -120,7 +120,7 @@ public class WhoisHttpServerTest {
assertThat(response.getStatus()).isEqualTo(404); assertThat(response.getStatus()).isEqualTo(404);
assertThat(response.getContentType()).isEqualTo(PLAIN_TEXT_UTF_8); assertThat(response.getContentType()).isEqualTo(PLAIN_TEXT_UTF_8);
assertThat(response.getPayload()) assertThat(response.getPayload())
.isEqualTo(loadWhoisTestFile("whois_server_domain_not_found.txt")); .isEqualTo(loadFile("whois_server_domain_not_found.txt"));
} }
// todo (b/27378695): reenable or delete this test // todo (b/27378695): reenable or delete this test
@ -143,7 +143,7 @@ public class WhoisHttpServerTest {
assertThat(response.getStatus()).isEqualTo(404); assertThat(response.getStatus()).isEqualTo(404);
assertThat(response.getContentType()).isEqualTo(PLAIN_TEXT_UTF_8); assertThat(response.getContentType()).isEqualTo(PLAIN_TEXT_UTF_8);
assertThat(response.getPayload()) assertThat(response.getPayload())
.isEqualTo(loadWhoisTestFile("whois_server_domain_not_found.txt")); .isEqualTo(loadFile("whois_server_domain_not_found.txt"));
} }
@Test @Test
@ -161,7 +161,7 @@ public class WhoisHttpServerTest {
persistSimpleResources(makeRegistrarContacts(registrar)); persistSimpleResources(makeRegistrarContacts(registrar));
newWhoisHttpServer("/domain/cat.みんな").run(); newWhoisHttpServer("/domain/cat.みんな").run();
assertThat(response.getStatus()).isEqualTo(200); assertThat(response.getStatus()).isEqualTo(200);
assertThat(response.getPayload()).isEqualTo(loadWhoisTestFile("whois_server_idn_utf8.txt")); assertThat(response.getPayload()).isEqualTo(loadFile("whois_server_idn_utf8.txt"));
} }
@Test @Test
@ -175,7 +175,7 @@ public class WhoisHttpServerTest {
trl, trl,
persistResource(makeHostResource("ns1.cat.みんな", "1.2.3.4")), persistResource(makeHostResource("ns1.cat.みんな", "1.2.3.4")),
persistResource(makeHostResource("ns2.cat.みんな", "bad:f00d:cafe::15:beef")), persistResource(makeHostResource("ns2.cat.みんな", "bad:f00d:cafe::15:beef")),
persistResource( makeRegistrar("example", "Example Registrar", Registrar.State.ACTIVE)))); persistResource(makeRegistrar("example", "Example Registrar", Registrar.State.ACTIVE))));
newWhoisHttpServer("/domain/cat.みんな").run(); newWhoisHttpServer("/domain/cat.みんな").run();
assertThat(response.getPayload()).contains("Eric Schmidt"); assertThat(response.getPayload()).contains("Eric Schmidt");
} }
@ -230,14 +230,14 @@ public class WhoisHttpServerTest {
registrar)); registrar));
persistSimpleResources(makeRegistrarContacts(registrar)); persistSimpleResources(makeRegistrarContacts(registrar));
newWhoisHttpServer("/domain/cat.xn--q9jyb4c").run(); newWhoisHttpServer("/domain/cat.xn--q9jyb4c").run();
assertThat(response.getPayload()).isEqualTo(loadWhoisTestFile("whois_server_idn_utf8.txt")); assertThat(response.getPayload()).isEqualTo(loadFile("whois_server_idn_utf8.txt"));
} }
@Test @Test
public void testRun_nameserverQuery_works() throws Exception { public void testRun_nameserverQuery_works() throws Exception {
persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4")); persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4"));
newWhoisHttpServer("/nameserver/ns1.cat.lol").run(); newWhoisHttpServer("/nameserver/ns1.cat.lol").run();
assertThat(response.getPayload()).isEqualTo(loadWhoisTestFile("whois_server_nameserver.txt")); assertThat(response.getPayload()).isEqualTo(loadFile("whois_server_nameserver.txt"));
} }
// todo (b/27378695): reenable or delete this test // todo (b/27378695): reenable or delete this test
@ -246,7 +246,7 @@ public class WhoisHttpServerTest {
public void testRun_nameserverQueryInTestTld_notFound() throws Exception { public void testRun_nameserverQueryInTestTld_notFound() throws Exception {
persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4")); persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4"));
newWhoisHttpServer("/nameserver/ns1.cat.lol").run(); newWhoisHttpServer("/nameserver/ns1.cat.lol").run();
assertThat(response.getPayload()).isEqualTo(loadWhoisTestFile("whois_server_nameserver.txt")); assertThat(response.getPayload()).isEqualTo(loadFile("whois_server_nameserver.txt"));
} }
@Test @Test
@ -319,7 +319,7 @@ public class WhoisHttpServerTest {
// Notice the partial search without "inc". // Notice the partial search without "inc".
newWhoisHttpServer("/registrar/Example%20Registrar").run(); newWhoisHttpServer("/registrar/Example%20Registrar").run();
assertThat(response.getStatus()).isEqualTo(200); assertThat(response.getStatus()).isEqualTo(200);
assertThat(response.getPayload()).isEqualTo(loadWhoisTestFile("whois_server_registrar.txt")); assertThat(response.getPayload()).isEqualTo(loadFile("whois_server_registrar.txt"));
} }
@Test @Test
@ -330,7 +330,7 @@ public class WhoisHttpServerTest {
newWhoisHttpServer("/registrar/Example%20Registrar,%20Inc.").run(); newWhoisHttpServer("/registrar/Example%20Registrar,%20Inc.").run();
assertThat(response.getStatus()).isEqualTo(404); assertThat(response.getStatus()).isEqualTo(404);
assertThat(response.getPayload()) assertThat(response.getPayload())
.isEqualTo(loadWhoisTestFile("whois_server_registrar_not_found.txt")); .isEqualTo(loadFile("whois_server_registrar_not_found.txt"));
} }
@Test @Test
@ -342,7 +342,7 @@ public class WhoisHttpServerTest {
newWhoisHttpServer("/registrar/Example%20Registrar,%20Inc.").run(); newWhoisHttpServer("/registrar/Example%20Registrar,%20Inc.").run();
assertThat(response.getStatus()).isEqualTo(404); assertThat(response.getStatus()).isEqualTo(404);
assertThat(response.getPayload()) assertThat(response.getPayload())
.isEqualTo(loadWhoisTestFile("whois_server_registrar_not_found.txt")); .isEqualTo(loadFile("whois_server_registrar_not_found.txt"));
} }
@Test @Test

View file

@ -26,7 +26,7 @@ import static google.registry.testing.FullFieldsTestEntityHelper.makeDomainResou
import static google.registry.testing.FullFieldsTestEntityHelper.makeHostResource; import static google.registry.testing.FullFieldsTestEntityHelper.makeHostResource;
import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar;
import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrarContacts; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrarContacts;
import static google.registry.whois.WhoisHelper.loadWhoisTestFile; import static google.registry.whois.WhoisTestData.loadFile;
import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR; import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
import static javax.servlet.http.HttpServletResponse.SC_NOT_FOUND; import static javax.servlet.http.HttpServletResponse.SC_NOT_FOUND;
import static javax.servlet.http.HttpServletResponse.SC_OK; import static javax.servlet.http.HttpServletResponse.SC_OK;
@ -94,7 +94,7 @@ public class WhoisServerTest {
public void testRun_badRequest_stillSends200() throws Exception { public void testRun_badRequest_stillSends200() throws Exception {
newWhoisServer("\r\n").run(); newWhoisServer("\r\n").run();
assertThat(response.getStatus()).isEqualTo(200); assertThat(response.getStatus()).isEqualTo(200);
assertThat(response.getPayload()).isEqualTo(loadWhoisTestFile("whois_server_no_command.txt")); assertThat(response.getPayload()).isEqualTo(loadFile("whois_server_no_command.txt"));
} }
@Test @Test
@ -112,7 +112,7 @@ public class WhoisServerTest {
persistSimpleResources(makeRegistrarContacts(registrar)); persistSimpleResources(makeRegistrarContacts(registrar));
newWhoisServer("domain cat.lol\r\n").run(); newWhoisServer("domain cat.lol\r\n").run();
assertThat(response.getStatus()).isEqualTo(200); assertThat(response.getStatus()).isEqualTo(200);
assertThat(response.getPayload()).isEqualTo(loadWhoisTestFile("whois_server_domain.txt")); assertThat(response.getPayload()).isEqualTo(loadFile("whois_server_domain.txt"));
} }
@Test @Test
@ -130,7 +130,7 @@ public class WhoisServerTest {
persistSimpleResources(makeRegistrarContacts(registrar)); persistSimpleResources(makeRegistrarContacts(registrar));
newWhoisServer("domain cat.みんな\r\n").run(); newWhoisServer("domain cat.みんな\r\n").run();
assertThat(response.getStatus()).isEqualTo(200); assertThat(response.getStatus()).isEqualTo(200);
assertThat(response.getPayload()).isEqualTo(loadWhoisTestFile("whois_server_idn_punycode.txt")); assertThat(response.getPayload()).isEqualTo(loadFile("whois_server_idn_punycode.txt"));
} }
@Test @Test
@ -148,7 +148,7 @@ public class WhoisServerTest {
persistSimpleResources(makeRegistrarContacts(registrar)); persistSimpleResources(makeRegistrarContacts(registrar));
newWhoisServer("domain cat.xn--q9jyb4c\r\n").run(); newWhoisServer("domain cat.xn--q9jyb4c\r\n").run();
assertThat(response.getStatus()).isEqualTo(200); assertThat(response.getStatus()).isEqualTo(200);
assertThat(response.getPayload()).isEqualTo(loadWhoisTestFile("whois_server_idn_punycode.txt")); assertThat(response.getPayload()).isEqualTo(loadFile("whois_server_idn_punycode.txt"));
} }
@Test @Test
@ -156,7 +156,7 @@ public class WhoisServerTest {
newWhoisServer("domain cat.lol\r\n").run(); newWhoisServer("domain cat.lol\r\n").run();
assertThat(response.getStatus()).isEqualTo(200); assertThat(response.getStatus()).isEqualTo(200);
assertThat(response.getPayload()) assertThat(response.getPayload())
.isEqualTo(loadWhoisTestFile("whois_server_domain_not_found.txt")); .isEqualTo(loadFile("whois_server_domain_not_found.txt"));
} }
// todo (b/27378695): reenable or delete this test // todo (b/27378695): reenable or delete this test
@ -178,7 +178,7 @@ public class WhoisServerTest {
newWhoisServer("domain cat.lol\r\n").run(); newWhoisServer("domain cat.lol\r\n").run();
assertThat(response.getStatus()).isEqualTo(200); assertThat(response.getStatus()).isEqualTo(200);
assertThat(response.getPayload()) assertThat(response.getPayload())
.isEqualTo(loadWhoisTestFile("whois_server_domain_not_found.txt")); .isEqualTo(loadFile("whois_server_domain_not_found.txt"));
} }
@Test @Test
@ -200,7 +200,7 @@ public class WhoisServerTest {
newWhoisServer("domain cat.lol\r\n").run(); newWhoisServer("domain cat.lol\r\n").run();
assertThat(response.getStatus()).isEqualTo(200); assertThat(response.getStatus()).isEqualTo(200);
assertThat(response.getPayload()) assertThat(response.getPayload())
.isEqualTo(loadWhoisTestFile("whois_server_domain_not_found.txt")); .isEqualTo(loadFile("whois_server_domain_not_found.txt"));
} }
/** /**
@ -249,7 +249,7 @@ public class WhoisServerTest {
persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4")); persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4"));
newWhoisServer("nameserver ns1.cat.lol\r\n").run(); newWhoisServer("nameserver ns1.cat.lol\r\n").run();
assertThat(response.getStatus()).isEqualTo(200); assertThat(response.getStatus()).isEqualTo(200);
assertThat(response.getPayload()).isEqualTo(loadWhoisTestFile("whois_server_nameserver.txt")); assertThat(response.getPayload()).isEqualTo(loadFile("whois_server_nameserver.txt"));
} }
@Test @Test
@ -287,7 +287,7 @@ public class WhoisServerTest {
newWhoisServer("nameserver ns1.cat.lulz\r\n").run(); newWhoisServer("nameserver ns1.cat.lulz\r\n").run();
assertThat(response.getStatus()).isEqualTo(200); assertThat(response.getStatus()).isEqualTo(200);
assertThat(response.getPayload()) assertThat(response.getPayload())
.isEqualTo(loadWhoisTestFile("whois_server_nameserver_not_found.txt")); .isEqualTo(loadFile("whois_server_nameserver_not_found.txt"));
} }
@Test @Test
@ -298,7 +298,7 @@ public class WhoisServerTest {
newWhoisServer("nameserver ns1.cat.lol\r\n").run(); newWhoisServer("nameserver ns1.cat.lol\r\n").run();
assertThat(response.getStatus()).isEqualTo(200); assertThat(response.getStatus()).isEqualTo(200);
assertThat(response.getPayload()) assertThat(response.getPayload())
.isEqualTo(loadWhoisTestFile("whois_server_nameserver_not_found.txt")); .isEqualTo(loadFile("whois_server_nameserver_not_found.txt"));
} }
@Test @Test
@ -334,7 +334,7 @@ public class WhoisServerTest {
public void testRun_ipNameserverEntityDoesNotExist_returns200NotFound() throws Exception { public void testRun_ipNameserverEntityDoesNotExist_returns200NotFound() throws Exception {
newWhoisServer("nameserver feed:a:bee::acab\r\n").run(); newWhoisServer("nameserver feed:a:bee::acab\r\n").run();
assertThat(response.getStatus()).isEqualTo(200); assertThat(response.getStatus()).isEqualTo(200);
assertThat(response.getPayload()).isEqualTo(loadWhoisTestFile("whois_server_ip_not_found.txt")); assertThat(response.getPayload()).isEqualTo(loadFile("whois_server_ip_not_found.txt"));
} }
@Test @Test
@ -343,7 +343,7 @@ public class WhoisServerTest {
persistResource(makeHostResource("ns1.google.com", "1.2.3.4")); persistResource(makeHostResource("ns1.google.com", "1.2.3.4"));
newWhoisServer("nameserver 1.2.3.4").run(); newWhoisServer("nameserver 1.2.3.4").run();
assertThat(response.getStatus()).isEqualTo(200); assertThat(response.getStatus()).isEqualTo(200);
assertThat(response.getPayload()).isEqualTo(loadWhoisTestFile("whois_server_ip_not_found.txt")); assertThat(response.getPayload()).isEqualTo(loadFile("whois_server_ip_not_found.txt"));
} }
@Test @Test
@ -353,7 +353,7 @@ public class WhoisServerTest {
newWhoisServer("nameserver ns1.google.com").run(); newWhoisServer("nameserver ns1.google.com").run();
assertThat(response.getStatus()).isEqualTo(200); assertThat(response.getStatus()).isEqualTo(200);
assertThat(response.getPayload()) assertThat(response.getPayload())
.isEqualTo(loadWhoisTestFile("whois_server_nameserver_not_found.txt")); .isEqualTo(loadFile("whois_server_nameserver_not_found.txt"));
} }
// todo (b/27378695): reenable or delete this test // todo (b/27378695): reenable or delete this test
@ -365,7 +365,7 @@ public class WhoisServerTest {
newWhoisServer("nameserver ns1.cat.lol").run(); newWhoisServer("nameserver ns1.cat.lol").run();
assertThat(response.getStatus()).isEqualTo(200); assertThat(response.getStatus()).isEqualTo(200);
assertThat(response.getPayload()) assertThat(response.getPayload())
.isEqualTo(loadWhoisTestFile("whois_server_nameserver_not_found.txt")); .isEqualTo(loadFile("whois_server_nameserver_not_found.txt"));
} }
@Test @Test
@ -376,7 +376,7 @@ public class WhoisServerTest {
// Notice the partial search without "inc". // Notice the partial search without "inc".
newWhoisServer("registrar example registrar").run(); newWhoisServer("registrar example registrar").run();
assertThat(response.getStatus()).isEqualTo(200); assertThat(response.getStatus()).isEqualTo(200);
assertThat(response.getPayload()).isEqualTo(loadWhoisTestFile("whois_server_registrar.txt")); assertThat(response.getPayload()).isEqualTo(loadFile("whois_server_registrar.txt"));
} }
@Test @Test
@ -392,7 +392,7 @@ public class WhoisServerTest {
// Notice the partial search without "inc". // Notice the partial search without "inc".
newWhoisServer("registrar example registrar").run(); newWhoisServer("registrar example registrar").run();
assertThat(response.getStatus()).isEqualTo(200); assertThat(response.getStatus()).isEqualTo(200);
assertThat(response.getPayload()).isEqualTo(loadWhoisTestFile("whois_server_registrar.txt")); assertThat(response.getPayload()).isEqualTo(loadFile("whois_server_registrar.txt"));
} }
@Test @Test
@ -403,7 +403,7 @@ public class WhoisServerTest {
newWhoisServer("registrar Example Registrar, Inc.").run(); newWhoisServer("registrar Example Registrar, Inc.").run();
assertThat(response.getStatus()).isEqualTo(200); assertThat(response.getStatus()).isEqualTo(200);
assertThat(response.getPayload()) assertThat(response.getPayload())
.isEqualTo(loadWhoisTestFile("whois_server_registrar_not_found.txt")); .isEqualTo(loadFile("whois_server_registrar_not_found.txt"));
} }
@Test @Test
@ -418,7 +418,7 @@ public class WhoisServerTest {
newWhoisServer("registrar Example Registrar, Inc.").run(); newWhoisServer("registrar Example Registrar, Inc.").run();
assertThat(response.getStatus()).isEqualTo(200); assertThat(response.getStatus()).isEqualTo(200);
assertThat(response.getPayload()) assertThat(response.getPayload())
.isEqualTo(loadWhoisTestFile("whois_server_registrar_not_found.txt")); .isEqualTo(loadFile("whois_server_registrar_not_found.txt"));
} }
@Test @Test
@ -514,6 +514,6 @@ public class WhoisServerTest {
server.whoisReader = mockReader; server.whoisReader = mockReader;
server.run(); server.run();
assertThat(response.getPayload()).isEqualTo(loadWhoisTestFile("whois_server_nameserver.txt")); assertThat(response.getPayload()).isEqualTo(loadFile("whois_server_nameserver.txt"));
} }
} }

View file

@ -17,13 +17,13 @@ package google.registry.whois;
import google.registry.testing.TestDataHelper; import google.registry.testing.TestDataHelper;
/** Test helper methods for the whois package. */ /** Test helper methods for the whois package. */
final class WhoisHelper { final class WhoisTestData {
/** /**
* Loads test data from file in {@code testdata/} directory, "fixing" newlines to have the ending * Loads test data from file in {@code testdata/} directory, "fixing" newlines to have the ending
* that WHOIS requires. * that WHOIS requires.
*/ */
static String loadWhoisTestFile(String filename) { static String loadFile(String filename) {
return TestDataHelper.loadFile(WhoisHelper.class, filename).replaceAll("\r?\n", "\r\n"); return TestDataHelper.loadFile(WhoisTestData.class, filename).replaceAll("\r?\n", "\r\n");
} }
} }