Delete end-date sunrise, landrush, and sunrush phases

This also deletes the associated commands and domain application specific
entities.

We haven't used any of these TLD phases since early 2015 and have no
intent to do so in the future, so it makes sense to delete them now so we
don't have to carry them through the Registry 3.0 migration.

Note that, while there are data model changes, there should be no required
data migrations. The fields and entities being removed will simply remain
as orphans. I confirmed that the removed types (such as the SUNRUSH_ADD
GracePeriodType) are no longer used in production data, and left types
that are still used, e.g. BillingEvent.Flag.LANDRUSH or
HistoryEntry.Type.ALLOCATE.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=228752843
This commit is contained in:
mcilwain 2019-01-10 12:09:14 -08:00 committed by Ben McIlwain
parent c74ffd7559
commit 580302898d
282 changed files with 344 additions and 17634 deletions

View file

@ -84,15 +84,12 @@ import google.registry.model.contact.ContactResource;
import google.registry.model.domain.DesignatedContact;
import google.registry.model.domain.DesignatedContact.Type;
import google.registry.model.domain.DomainResource;
import google.registry.model.domain.GracePeriod;
import google.registry.model.domain.rgp.GracePeriodStatus;
import google.registry.model.domain.secdns.DelegationSignerData;
import google.registry.model.eppcommon.StatusValue;
import google.registry.model.host.HostResource;
import google.registry.model.registry.Registry;
import google.registry.model.reporting.HistoryEntry;
import org.joda.money.Money;
import org.joda.time.DateTime;
import org.junit.Before;
import org.junit.Test;
@ -215,196 +212,6 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
private void doSunrushAddTest(
BillingEvent.OneTime sunrushAddBillingEvent,
UserPrivileges userPrivileges,
DateTime addExpirationTime)
throws Exception {
// The billing event for the original sunrush add should already exist; check for it now to
// avoid a confusing assertBillingEvents() later if it doesn't exist.
assertBillingEvents(sunrushAddBillingEvent);
runFlowAssertResponse(
CommitMode.LIVE, userPrivileges, loadFile("generic_success_response.xml"));
// Verify that the domain now has the new nameserver and is in the add grace period.
DomainResource resource = reloadResourceByForeignKey();
HistoryEntry historyEntryDomainUpdate =
getOnlyHistoryEntryOfType(resource, HistoryEntry.Type.DOMAIN_UPDATE);
assertThat(resource.getNameservers())
.containsExactly(
Key.create(
loadByForeignKey(HostResource.class, "ns2.example.foo", clock.nowUtc()).get()));
BillingEvent.OneTime regularAddBillingEvent =
new BillingEvent.OneTime.Builder()
.setReason(Reason.CREATE)
.setTargetId("example.tld")
.setClientId("TheRegistrar")
.setCost(Money.of(USD, 50))
.setPeriodYears(4)
.setEventTime(clock.nowUtc())
.setBillingTime(addExpirationTime)
.setParent(historyEntryDomainUpdate)
.build();
assertBillingEvents(
sunrushAddBillingEvent,
// There should be a cancellation for the original sunrush add billing event.
new BillingEvent.Cancellation.Builder()
.setReason(Reason.CREATE)
.setTargetId("example.tld")
.setClientId("TheRegistrar")
.setEventTime(clock.nowUtc())
.setBillingTime(sunrushAddBillingEvent.getBillingTime())
.setOneTimeEventKey(Key.create(sunrushAddBillingEvent))
.setParent(historyEntryDomainUpdate)
.build(),
regularAddBillingEvent);
assertGracePeriods(
resource.getGracePeriods(),
ImmutableMap.of(
GracePeriod.create(GracePeriodStatus.ADD, addExpirationTime, "TheRegistrar", null),
regularAddBillingEvent));
}
private BillingEvent.OneTime getSunrushAddBillingEvent(DateTime billingTime) {
return new BillingEvent.OneTime.Builder()
.setReason(Reason.CREATE)
.setTargetId("example.tld")
.setClientId("TheRegistrar")
.setCost(Money.of(USD, 50))
.setPeriodYears(4)
.setEventTime(billingTime.minusDays(30))
.setBillingTime(billingTime)
.setParent(historyEntryDomainCreate)
.build();
}
@Test
public void testSuccess_sunrushAddGracePeriod() throws Exception {
setEppInput("domain_update_add_nameserver.xml");
persistReferencedEntities();
persistDomain();
BillingEvent.OneTime sunrushAddBillingEvent =
persistResource(getSunrushAddBillingEvent(clock.nowUtc().plusDays(20)));
// Modify domain so it has no nameservers and is in the sunrush add grace period.
persistResource(
reloadResourceByForeignKey()
.asBuilder()
.setNameservers(ImmutableSet.of())
.addGracePeriod(
GracePeriod.forBillingEvent(GracePeriodStatus.SUNRUSH_ADD, sunrushAddBillingEvent))
.build());
clock.advanceOneMilli();
doSunrushAddTest(
sunrushAddBillingEvent,
UserPrivileges.NORMAL,
clock.nowUtc().plus(Registry.get("tld").getAddGracePeriodLength()));
}
@Test
public void testSuccess_truncatedSunrushAddGracePeriod() throws Exception {
setEppInput("domain_update_add_nameserver.xml");
persistReferencedEntities();
persistDomain();
DateTime billingTime = clock.nowUtc().plusDays(2);
BillingEvent.OneTime sunrushAddBillingEvent =
persistResource(getSunrushAddBillingEvent(billingTime));
// Modify domain so it has no nameservers and is in the sunrush add grace period, but make sure
// that grace period only has a couple days left so that the resultant add grace period will get
// truncated.
persistResource(
reloadResourceByForeignKey()
.asBuilder()
.setNameservers(ImmutableSet.of())
.addGracePeriod(
GracePeriod.forBillingEvent(GracePeriodStatus.SUNRUSH_ADD, sunrushAddBillingEvent))
.build());
clock.advanceOneMilli();
doSunrushAddTest(sunrushAddBillingEvent, UserPrivileges.NORMAL, billingTime);
}
@Test
public void testSuccess_sunrushAddGracePeriodRemoveServerHold() throws Exception {
setEppInput("domain_update_remove_server_hold.xml");
persistReferencedEntities();
persistDomain();
BillingEvent.OneTime sunrushAddBillingEvent =
persistResource(getSunrushAddBillingEvent(clock.nowUtc().plusDays(20)));
// Modify domain so that it is in the sunrush add grace period, has nameservers, but has a
// serverHold on it.
persistResource(
reloadResourceByForeignKey()
.asBuilder()
.setNameservers(
Key.create(
loadByForeignKey(HostResource.class, "ns2.example.foo", clock.nowUtc()).get()))
.addGracePeriod(
GracePeriod.forBillingEvent(GracePeriodStatus.SUNRUSH_ADD, sunrushAddBillingEvent))
.addStatusValue(StatusValue.SERVER_HOLD)
.build());
clock.advanceOneMilli();
doSunrushAddTest(
sunrushAddBillingEvent,
UserPrivileges.SUPERUSER,
clock.nowUtc().plus(Registry.get("tld").getAddGracePeriodLength()));
}
@Test
public void testSuccess_sunrushAddGracePeriodRemoveClientHold() throws Exception {
setEppInput("domain_update_remove_client_hold.xml");
persistReferencedEntities();
persistDomain();
BillingEvent.OneTime sunrushAddBillingEvent =
persistResource(getSunrushAddBillingEvent(clock.nowUtc().plusDays(20)));
// Modify domain so that it is in the sunrush add grace period, has nameservers, but has a
// serverHold on it.
persistResource(
reloadResourceByForeignKey()
.asBuilder()
.setNameservers(
Key.create(
loadByForeignKey(HostResource.class, "ns2.example.foo", clock.nowUtc()).get()))
.addGracePeriod(
GracePeriod.forBillingEvent(GracePeriodStatus.SUNRUSH_ADD, sunrushAddBillingEvent))
.addStatusValue(StatusValue.CLIENT_HOLD)
.build());
clock.advanceOneMilli();
doSunrushAddTest(
sunrushAddBillingEvent,
UserPrivileges.NORMAL,
clock.nowUtc().plus(Registry.get("tld").getAddGracePeriodLength()));
}
@Test
public void testSuccess_sunrushAddGracePeriodRemainsBecauseOfServerHold() throws Exception {
setEppInput("domain_update_add_nameserver.xml");
persistReferencedEntities();
persistDomain();
DateTime endOfGracePeriod = clock.nowUtc().plusDays(20);
BillingEvent.OneTime sunrushAddBillingEvent =
persistResource(getSunrushAddBillingEvent(endOfGracePeriod));
// Modify domain so it has no nameservers and is in the sunrush add grace period, but also has a
// server hold on it that will prevent the sunrush add grace period from being removed.
persistResource(
reloadResourceByForeignKey()
.asBuilder()
.setNameservers(ImmutableSet.of())
.addGracePeriod(
GracePeriod.forBillingEvent(GracePeriodStatus.SUNRUSH_ADD, sunrushAddBillingEvent))
.addStatusValue(StatusValue.SERVER_HOLD)
.build());
clock.advanceOneMilli();
runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.NORMAL, loadFile("generic_success_response.xml"));
// Verify that the domain is still in the sunrush add grace period.
assertGracePeriods(
reloadResourceByForeignKey().getGracePeriods(),
ImmutableMap.of(
GracePeriod.create(
GracePeriodStatus.SUNRUSH_ADD, endOfGracePeriod, "TheRegistrar", null),
sunrushAddBillingEvent));
}
private void modifyDomainToHave13Nameservers() throws Exception {
ImmutableSet.Builder<Key<HostResource>> nameservers = new ImmutableSet.Builder<>();
for (int i = 1; i < 15; i++) {