Fix confusing "now" parameters on persist deleted helper methods

They were taking a DateTime "now", which would seem like it would be the time of
when the resource was deleted, but it was actually the time by which the
resource was deleted, with the actual deletion time being hardcoded to a day
prior.  The confusion was evident because a fair number of tests were passing
the wrong thing.  I renamed the parameter "deletionTime" to make it exactly
clear what it's doing and fixed up some callsites where necessary.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=134818032
This commit is contained in:
mcilwain 2016-09-30 13:10:08 -07:00 committed by Ben McIlwain
parent 35d5307706
commit c517c98d17
23 changed files with 63 additions and 53 deletions

View file

@ -114,14 +114,14 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
@Test
public void testSuccess_externalExistedButWasDeleted() throws Exception {
persistDeletedHost(getUniqueIdFromCommand(), clock.nowUtc());
persistDeletedHost(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1));
doSuccessfulTest();
assertNoDnsTasksEnqueued();
}
@Test
public void testSuccess_internalExistedButWasDeleted() throws Exception {
persistDeletedHost(getUniqueIdFromCommand(), clock.nowUtc());
persistDeletedHost(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1));
doSuccessfulInternalTest("tld");
assertThat(ofy().load().key(reloadResourceByForeignKey().getSuperordinateDomain())
.now().getFullyQualifiedDomainName())