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

@ -127,7 +127,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
public void testDryRun() throws Exception {
createTld("tld");
persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.tld"));
dryRunFlowAssertResponse(readFile("host_update_response.xml"));
dryRunFlowAssertResponse(loadFile("host_update_response.xml"));
}
private HostResource doSuccessfulTest() throws Exception {
@ -144,7 +144,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
runFlowAssertResponse(
CommitMode.LIVE,
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)
// should now return null.
assertThat(reloadResourceByForeignKey()).isNull();
@ -204,7 +204,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
DomainResource domain = persistActiveDomain("example.tld");
HostResource oldHost = persistActiveSubordinateHost(oldHostName(), domain);
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.
assertAboutHosts().that(reloadResourceByForeignKey())
.hasLastSuperordinateChange(oldHost.getLastSuperordinateChange()).and()
@ -225,7 +225,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
DomainResource domain = persistResource(createDomainWithServerApprovedTransfer("example.tld"));
HostResource oldHost = persistActiveSubordinateHost(oldHostName(), domain);
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.
assertAboutHosts().that(reloadResourceByForeignKey())
.hasLastSuperordinateChange(oldHost.getLastSuperordinateChange()).and()
@ -439,7 +439,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
runFlowAssertResponse(
CommitMode.LIVE,
UserPrivileges.SUPERUSER,
readFile("host_update_response.xml"));
loadFile("host_update_response.xml"));
assertAboutHosts().that(reloadResourceByForeignKey())
.hasPersistedCurrentSponsorClientId("TheRegistrar").and()
.hasLastTransferTime(null).and()
@ -1013,7 +1013,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
runFlowAssertResponse(
CommitMode.LIVE,
UserPrivileges.SUPERUSER,
readFile("host_update_response.xml"));
loadFile("host_update_response.xml"));
}
@Test
@ -1031,7 +1031,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
clock.advanceOneMilli();
runFlowAssertResponse(
CommitMode.DRY_RUN, UserPrivileges.SUPERUSER, readFile("host_update_response.xml"));
CommitMode.DRY_RUN, UserPrivileges.SUPERUSER, loadFile("host_update_response.xml"));
}
@Test
@ -1050,7 +1050,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
.build());
clock.advanceOneMilli();
runFlowAssertResponse(readFile("host_update_response.xml"));
runFlowAssertResponse(loadFile("host_update_response.xml"));
}
@Test
@ -1086,7 +1086,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
.build());
clock.advanceOneMilli();
runFlowAssertResponse(readFile("host_update_response.xml"));
runFlowAssertResponse(loadFile("host_update_response.xml"));
}
@Test
@ -1170,7 +1170,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
.build());
clock.advanceOneMilli();
runFlowAssertResponse(readFile("host_update_response.xml"));
runFlowAssertResponse(loadFile("host_update_response.xml"));
}
private void doFailingHostNameTest(
@ -1242,7 +1242,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
clock.advanceOneMilli();
setEppInput("host_update_metadata.xml");
eppRequestSource = EppRequestSource.TOOL;
runFlowAssertResponse(readFile("host_update_response.xml"));
runFlowAssertResponse(loadFile("host_update_response.xml"));
assertAboutHistoryEntries()
.that(getOnlyHistoryEntryOfType(
reloadResourceByForeignKey(), HistoryEntry.Type.HOST_UPDATE))