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

@ -16,9 +16,13 @@ package google.registry.model;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static google.registry.model.registry.Registry.TldState.GENERAL_AVAILABILITY;
import static google.registry.testing.AppEngineRule.makeRegistrar1;
import static google.registry.testing.CertificateSamples.SAMPLE_CERT;
import static google.registry.testing.CertificateSamples.SAMPLE_CERT_HASH;
import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.persistPremiumList;
import static google.registry.testing.DatastoreHelper.persistSimpleResource;
import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.util.DateTimeUtils.START_OF_TIME;
import static org.joda.money.CurrencyUnit.USD;
@ -29,7 +33,6 @@ import google.registry.model.registrar.RegistrarContact;
import google.registry.model.registry.Registry;
import google.registry.model.registry.Registry.TldState;
import google.registry.testing.AppEngineRule;
import google.registry.testing.DatastoreHelper;
import google.registry.util.CidrAddressBlock;
import google.registry.util.SystemClock;
import org.joda.money.Money;
@ -52,7 +55,6 @@ public final class OteAccountBuilderTest {
assertThat(OteAccountBuilder.forClientId("myclientid").getClientIdToTldMap())
.containsExactly(
"myclientid-1", "myclientid-sunrise",
"myclientid-2", "myclientid-landrush",
"myclientid-3", "myclientid-ga",
"myclientid-4", "myclientid-ga",
"myclientid-5", "myclientid-eap");
@ -72,7 +74,7 @@ public final class OteAccountBuilderTest {
assertThat(registry.getAddGracePeriodLength()).isEqualTo(Duration.standardDays(5));
assertThat(registry.getPendingDeleteLength()).isEqualTo(Duration.standardDays(5));
assertThat(registry.getRedemptionGracePeriodLength()).isEqualTo(Duration.standardDays(30));
assertThat(registry.getEapFeeScheduleAsMap()).containsExactly(START_OF_TIME, Money.of(USD, 0));
assertThat(registry.getEapFeeScheduleAsMap()).containsExactly(START_OF_TIME, Money.zero(USD));
}
private void assertTldExistsGa(String tld, Money eapFee) {
@ -80,7 +82,7 @@ public final class OteAccountBuilderTest {
assertThat(registry).isNotNull();
assertThat(registry.getPremiumList().getName()).isEqualTo("default_sandbox_list");
assertThat(registry.getTldStateTransitions())
.containsExactly(START_OF_TIME, TldState.GENERAL_AVAILABILITY);
.containsExactly(START_OF_TIME, GENERAL_AVAILABILITY);
assertThat(registry.getDnsWriters()).containsExactly("VoidDnsWriter");
assertThat(registry.getAddGracePeriodLength()).isEqualTo(Duration.standardHours(1));
assertThat(registry.getPendingDeleteLength()).isEqualTo(Duration.standardMinutes(5));
@ -118,16 +120,13 @@ public final class OteAccountBuilderTest {
OteAccountBuilder.forClientId("myclientid").addContact("email@example.com").buildAndPersist();
assertTldExists("myclientid-sunrise", TldState.START_DATE_SUNRISE);
assertTldExists("myclientid-landrush", TldState.LANDRUSH);
assertTldExistsGa("myclientid-ga", Money.of(USD, 0));
assertTldExistsGa("myclientid-ga", Money.zero(USD));
assertTldExistsGa("myclientid-eap", Money.of(USD, 100));
assertRegistrarExists("myclientid-1", "myclientid-sunrise");
assertRegistrarExists("myclientid-2", "myclientid-landrush");
assertRegistrarExists("myclientid-3", "myclientid-ga");
assertRegistrarExists("myclientid-4", "myclientid-ga");
assertRegistrarExists("myclientid-5", "myclientid-eap");
assertContactExists("myclientid-1", "email@example.com");
assertContactExists("myclientid-2", "email@example.com");
assertContactExists("myclientid-3", "email@example.com");
assertContactExists("myclientid-4", "email@example.com");
assertContactExists("myclientid-5", "email@example.com");
@ -142,26 +141,21 @@ public final class OteAccountBuilderTest {
.buildAndPersist();
assertTldExists("myclientid-sunrise", TldState.START_DATE_SUNRISE);
assertTldExists("myclientid-landrush", TldState.LANDRUSH);
assertTldExistsGa("myclientid-ga", Money.of(USD, 0));
assertTldExistsGa("myclientid-ga", Money.zero(USD));
assertTldExistsGa("myclientid-eap", Money.of(USD, 100));
assertRegistrarExists("myclientid-1", "myclientid-sunrise");
assertRegistrarExists("myclientid-2", "myclientid-landrush");
assertRegistrarExists("myclientid-3", "myclientid-ga");
assertRegistrarExists("myclientid-4", "myclientid-ga");
assertRegistrarExists("myclientid-5", "myclientid-eap");
assertContactExists("myclientid-1", "email@example.com");
assertContactExists("myclientid-2", "email@example.com");
assertContactExists("myclientid-3", "email@example.com");
assertContactExists("myclientid-4", "email@example.com");
assertContactExists("myclientid-5", "email@example.com");
assertContactExists("myclientid-1", "other@example.com");
assertContactExists("myclientid-2", "other@example.com");
assertContactExists("myclientid-3", "other@example.com");
assertContactExists("myclientid-4", "other@example.com");
assertContactExists("myclientid-5", "other@example.com");
assertContactExists("myclientid-1", "someone@example.com");
assertContactExists("myclientid-2", "someone@example.com");
assertContactExists("myclientid-3", "someone@example.com");
assertContactExists("myclientid-4", "someone@example.com");
assertContactExists("myclientid-5", "someone@example.com");
@ -244,8 +238,7 @@ public final class OteAccountBuilderTest {
@Test
public void testCreateOteEntities_entityExists_failsWhenNotReplaceExisting() {
DatastoreHelper.persistSimpleResource(
AppEngineRule.makeRegistrar1().asBuilder().setClientId("myclientid-1").build());
persistSimpleResource(makeRegistrar1().asBuilder().setClientId("myclientid-1").build());
OteAccountBuilder oteSetupHelper = OteAccountBuilder.forClientId("myclientid");
assertThat(assertThrows(IllegalStateException.class, () -> oteSetupHelper.buildAndPersist()))
@ -255,14 +248,14 @@ public final class OteAccountBuilderTest {
@Test
public void testCreateOteEntities_entityExists_succeedsWhenReplaceExisting() {
DatastoreHelper.persistSimpleResource(
AppEngineRule.makeRegistrar1().asBuilder().setClientId("myclientid-1").build());
DatastoreHelper.createTld("myclientid-landrush", Registry.TldState.SUNRUSH);
persistSimpleResource(makeRegistrar1().asBuilder().setClientId("myclientid-4").build());
createTld("myclientid-ga", GENERAL_AVAILABILITY);
OteAccountBuilder.forClientId("myclientid").setReplaceExisting(true).buildAndPersist();
assertTldExists("myclientid-landrush", TldState.LANDRUSH);
assertTldExistsGa("myclientid-ga", Money.zero(USD));
assertRegistrarExists("myclientid-3", "myclientid-ga");
assertRegistrarExists("myclientid-4", "myclientid-ga");
}
@Test
@ -305,7 +298,6 @@ public final class OteAccountBuilderTest {
assertThat(OteAccountBuilder.createClientIdToTldMap("myclientid"))
.containsExactly(
"myclientid-1", "myclientid-sunrise",
"myclientid-2", "myclientid-landrush",
"myclientid-3", "myclientid-ga",
"myclientid-4", "myclientid-ga",
"myclientid-5", "myclientid-eap");

View file

@ -65,11 +65,6 @@ public final class OteStatsTest {
+ "contact transfer rejects: 0\n"
+ "contact transfer requests: 0\n"
+ "contact updates: 0\n"
+ "domain application creates: 0\n"
+ "domain application creates landrush: 0\n"
+ "domain application creates sunrise: 0\n"
+ "domain application deletes: 0\n"
+ "domain application updates: 0\n"
+ "domain autorenews: 0\n"
+ "domain creates: 5\n"
+ "domain creates ascii: 4\n"
@ -111,11 +106,6 @@ public final class OteStatsTest {
+ "contact transfer rejects: 0\n"
+ "contact transfer requests: 0\n"
+ "contact updates: 0\n"
+ "domain application creates: 0\n"
+ "domain application creates landrush: 0\n"
+ "domain application creates sunrise: 0\n"
+ "domain application deletes: 0\n"
+ "domain application updates: 0\n"
+ "domain autorenews: 0\n"
+ "domain creates: 5\n"
+ "domain creates ascii: 4\n"

View file

@ -72,7 +72,7 @@ public final class OteStatsTestHelper {
.build());
persistResource(
new HistoryEntry.Builder()
.setClientId("blobio-2")
.setClientId("blobio-3")
.setType(Type.DOMAIN_DELETE)
.setXmlBytes(getBytes("domain_delete.xml"))
.build());
@ -109,13 +109,13 @@ public final class OteStatsTestHelper {
.build());
persistResource(
new HistoryEntry.Builder()
.setClientId("blobio-1")
.setClientId("blobio-4")
.setType(Type.DOMAIN_UPDATE)
.setXmlBytes(getBytes("domain_update_with_secdns.xml"))
.build());
persistResource(
new HistoryEntry.Builder()
.setClientId("blobio-1")
.setClientId("blobio-5")
.setType(Type.HOST_CREATE)
.setXmlBytes(getBytes("host_create_complete.xml"))
.build());

View file

@ -1,155 +0,0 @@
// Copyright 2017 The Nomulus Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package google.registry.model.domain;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static google.registry.model.EppResourceUtils.loadDomainApplication;
import static google.registry.testing.DatastoreHelper.cloneAndSetAutoTimestamps;
import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.newDomainApplication;
import static google.registry.testing.DatastoreHelper.newHostResource;
import static google.registry.testing.DatastoreHelper.persistActiveContact;
import static google.registry.testing.DatastoreHelper.persistActiveHost;
import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.util.DateTimeUtils.START_OF_TIME;
import static org.joda.money.CurrencyUnit.USD;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.googlecode.objectify.Key;
import google.registry.model.EntityTestCase;
import google.registry.model.domain.launch.ApplicationStatus;
import google.registry.model.domain.launch.LaunchNotice;
import google.registry.model.domain.launch.LaunchPhase;
import google.registry.model.domain.secdns.DelegationSignerData;
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
import google.registry.model.eppcommon.StatusValue;
import google.registry.model.eppcommon.Trid;
import google.registry.model.smd.EncodedSignedMark;
import org.joda.money.Money;
import org.junit.Before;
import org.junit.Test;
/** Unit tests for {@link DomainApplication}. */
public class DomainApplicationTest extends EntityTestCase {
DomainApplication domainApplication;
@Before
public void setUp() {
createTld("com");
// Set up a new persisted domain application entity.
domainApplication = persistResource(cloneAndSetAutoTimestamps(
new DomainApplication.Builder()
.setFullyQualifiedDomainName("example.com")
.setRepoId("1-COM")
.setCreationClientId("a registrar")
.setLastEppUpdateTime(clock.nowUtc())
.setLastEppUpdateClientId("another registrar")
.setStatusValues(ImmutableSet.of(
StatusValue.CLIENT_DELETE_PROHIBITED,
StatusValue.SERVER_DELETE_PROHIBITED,
StatusValue.SERVER_TRANSFER_PROHIBITED,
StatusValue.SERVER_UPDATE_PROHIBITED,
StatusValue.SERVER_RENEW_PROHIBITED,
StatusValue.SERVER_HOLD))
.setRegistrant(Key.create(persistActiveContact("contact_id1")))
.setContacts(ImmutableSet.of(DesignatedContact.create(
DesignatedContact.Type.ADMIN,
Key.create(persistActiveContact("contact_id2")))))
.setNameservers(
ImmutableSet.of(Key.create(persistActiveHost("ns1.example.com"))))
.setPersistedCurrentSponsorClientId("a third registrar")
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("password")))
.setDsData(ImmutableSet.of(DelegationSignerData.create(1, 2, 3, new byte[] {0, 1, 2})))
.setLaunchNotice(
LaunchNotice.create("tcnid", "validatorId", START_OF_TIME, START_OF_TIME))
.setCreationTrid(Trid.create("client-creation-trid", "server-trid"))
.setPhase(LaunchPhase.LANDRUSH)
.setPeriod(Period.create(5, Period.Unit.YEARS))
.setEncodedSignedMarks(ImmutableList.of(EncodedSignedMark.create("base64", "abcdefg=")))
.setApplicationStatus(ApplicationStatus.ALLOCATED)
.setAuctionPrice(Money.of(USD, 11))
.build()));
}
@Test
public void testPersistence() {
assertThat(loadDomainApplication(domainApplication.getForeignKey(), clock.nowUtc()))
.hasValue(domainApplication);
}
@Test
public void testIndexing() throws Exception {
domainApplication = persistResource(
domainApplication.asBuilder().setPeriod(Period.create(5, Period.Unit.YEARS)).build());
verifyIndexing(
domainApplication,
"allContacts.contact",
"fullyQualifiedDomainName",
"nsHosts",
"deletionTime",
"currentSponsorClientId",
"tld");
}
private DomainApplication.Builder emptyBuilder() {
return newDomainApplication("example.com").asBuilder();
}
@Test
public void testEmptyStringsBecomeNull() {
assertThat(emptyBuilder().setPersistedCurrentSponsorClientId(null).build()
.getCurrentSponsorClientId()).isNull();
assertThat(emptyBuilder().setPersistedCurrentSponsorClientId("").build()
.getCurrentSponsorClientId()).isNull();
assertThat(emptyBuilder().setPersistedCurrentSponsorClientId(" ").build()
.getCurrentSponsorClientId()).isNotNull();
}
@Test
public void testEmptySetsAndArraysBecomeNull() {
assertThat(emptyBuilder().setNameservers(ImmutableSet.of()).build().nsHosts).isNull();
assertThat(
emptyBuilder()
.setNameservers(ImmutableSet.of(Key.create(newHostResource("foo.example.tld"))))
.build()
.nsHosts)
.isNotNull();
// This behavior should also hold true for ImmutableObjects nested in collections.
assertThat(emptyBuilder()
.setDsData(ImmutableSet.of(DelegationSignerData.create(1, 1, 1, null)))
.build()
.getDsData().asList().get(0).getDigest())
.isNull();
assertThat(emptyBuilder()
.setDsData(ImmutableSet.of(DelegationSignerData.create(1, 1, 1, new byte[]{})))
.build()
.getDsData().asList().get(0).getDigest())
.isNull();
assertThat(emptyBuilder()
.setDsData(ImmutableSet.of(DelegationSignerData.create(1, 1, 1, new byte[]{1})))
.build()
.getDsData().asList().get(0).getDigest())
.isNotNull();
}
@Test
public void testToHydratedString_notCircular() {
// If there are circular references, this will overflow the stack.
domainApplication.toHydratedString();
}
}

View file

@ -57,11 +57,6 @@ public class DomainCommandTest extends ResourceCommandTestCase {
doXmlRoundtripTest("domain_create_sunrise_encoded_signed_mark.xml");
}
@Test
public void testCreate_landrush() throws Exception {
doXmlRoundtripTest("domain_create_landrush.xml");
}
@Test
public void testCreate_fee() throws Exception {
doXmlRoundtripTest("domain_create_fee.xml");
@ -158,16 +153,6 @@ public class DomainCommandTest extends ResourceCommandTestCase {
doXmlRoundtripTest("domain_info_sunrise.xml");
}
@Test
public void testInfo_landrush() throws Exception {
doXmlRoundtripTest("domain_info_landrush.xml");
}
@Test
public void testInfo_sunriseNoApplicationId() throws Exception {
doXmlRoundtripTest("domain_info_sunrise_no_application_id.xml");
}
@Test
public void testInfo_feeExtension() throws Exception {
doXmlRoundtripTest("domain_info_fee.xml");

View file

@ -60,6 +60,7 @@ import org.junit.Test;
/** Unit tests for {@link DomainResource}. */
public class DomainResourceTest extends EntityTestCase {
DomainResource domain;
@Before
@ -141,8 +142,6 @@ public class DomainResourceTest extends EntityTestCase {
.setAutorenewBillingEvent(recurringBillKey)
.setAutorenewPollMessage(autorenewPollKey)
.setSmdId("smdid")
.setApplicationTime(START_OF_TIME)
.setApplication(Key.create(DomainApplication.class, 1))
.addGracePeriod(
GracePeriod.create(
GracePeriodStatus.ADD, clock.nowUtc().plusDays(1), "registrar", null))

View file

@ -67,17 +67,9 @@ public class GracePeriodTest {
assertThat(gracePeriod.getRecurringBillingEvent()).isNull();
assertThat(gracePeriod.getClientId()).isEqualTo("TheRegistrar");
assertThat(gracePeriod.getExpirationTime()).isEqualTo(now.plusDays(1));
assertThat(gracePeriod.isSunrushAddGracePeriod()).isFalse();
assertThat(gracePeriod.hasBillingEvent()).isTrue();
}
@Test
public void testSuccess_forBillingEvent_sunrushAdd() {
GracePeriod gracePeriod = GracePeriod.forBillingEvent(GracePeriodStatus.SUNRUSH_ADD, onetime);
assertThat(gracePeriod.getType()).isEqualTo(GracePeriodStatus.ADD);
assertThat(gracePeriod.isSunrushAddGracePeriod()).isTrue();
}
@Test
public void testSuccess_createWithoutBillingEvent() {
GracePeriod gracePeriod = GracePeriod.createWithoutBillingEvent(

View file

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<create>
<domain:create
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>example.tld</domain:name>
<domain:registrant>jd1234</domain:registrant>
<domain:contact type="admin">sh8013</domain:contact>
<domain:contact type="tech">sh8013</domain:contact>
<domain:authInfo>
<domain:pw>2fooBAR</domain:pw>
</domain:authInfo>
</domain:create>
</create>
<extension>
<launch:create
xmlns:launch="urn:ietf:params:xml:ns:launch-1.0">
<launch:phase>landrush</launch:phase>
</launch:create>
</extension>
<clTRID>ABC-12345</clTRID>
</command>
</epp>

View file

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<info>
<domain:info
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>example.tld</domain:name>
</domain:info>
</info>
<extension>
<launch:info
xmlns:launch="urn:ietf:params:xml:ns:launch-1.0">
<launch:phase>landrush</launch:phase>
<launch:applicationID>123</launch:applicationID>
</launch:info>
</extension>
<clTRID>ABC-12345</clTRID>
</command>
</epp>

View file

@ -1,19 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<info>
<domain:info
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>example.tld</domain:name>
</domain:info>
</info>
<extension>
<launch:info
xmlns:launch="urn:ietf:params:xml:ns:launch-1.0">
<launch:phase name="landrush">sunrise</launch:phase>
<launch:applicationID>123</launch:applicationID>
</launch:info>
</extension>
<clTRID>ABC-12345</clTRID>
<info>
<domain:info
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>example.tld</domain:name>
</domain:info>
</info>
<extension>
<launch:info
xmlns:launch="urn:ietf:params:xml:ns:launch-1.0"
includeMark="true">
<launch:phase>sunrise</launch:phase>
</launch:info>
</extension>
<clTRID>ABC-12345</clTRID>
</command>
</epp>

View file

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<info>
<domain:info
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>example.tld</domain:name>
</domain:info>
</info>
<extension>
<launch:info
xmlns:launch="urn:ietf:params:xml:ns:launch-1.0"
includeMark="true">
<launch:phase name="landrush">sunrise</launch:phase>
</launch:info>
</extension>
<clTRID>ABC-12345</clTRID>
</command>
</epp>

View file

@ -1,143 +0,0 @@
// Copyright 2017 The Nomulus Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package google.registry.model.index;
import static com.google.common.truth.Truth.assertThat;
import static google.registry.model.index.DomainApplicationIndex.createUpdatedInstance;
import static google.registry.model.index.DomainApplicationIndex.createWithSpecifiedKeys;
import static google.registry.model.index.DomainApplicationIndex.loadActiveApplicationsByDomainName;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.newDomainApplication;
import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.DatastoreHelper.persistSimpleResource;
import static google.registry.testing.JUnitBackports.assertThrows;
import static org.joda.time.DateTimeZone.UTC;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.googlecode.objectify.Key;
import google.registry.model.EntityTestCase;
import google.registry.model.domain.DomainApplication;
import org.joda.time.DateTime;
import org.junit.Before;
import org.junit.Test;
/** Unit tests for {@link DomainApplicationIndex}. */
public class DomainApplicationIndexTest extends EntityTestCase {
@Before
public void init() {
createTld("com");
}
@Test
public void testFailure_create_nullReferences() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
() -> DomainApplicationIndex.createWithSpecifiedKeys("blah.com", null));
assertThat(thrown).hasMessageThat().contains("Keys must not be null or empty.");
}
@Test
public void testFailure_create_emptyReferences() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
() -> createWithSpecifiedKeys("blah.com", ImmutableSet.of()));
assertThat(thrown).hasMessageThat().contains("Keys must not be null or empty.");
}
@Test
public void testSuccess_singleApplication() {
DomainApplication application = persistSimpleResource(newDomainApplication("example.com"));
persistResource(createUpdatedInstance(application));
DomainApplicationIndex savedIndex = DomainApplicationIndex.load("example.com");
assertThat(savedIndex).isNotNull();
assertThat(savedIndex.getKeys()).containsExactly(Key.create(application));
assertThat(loadActiveApplicationsByDomainName("example.com", clock.nowUtc()))
.containsExactly(application);
}
@Test
public void testSuccess_noApplications() {
assertThat(DomainApplicationIndex.load("example.com")).isNull();
assertThat(loadActiveApplicationsByDomainName("example.com", clock.nowUtc())).isEmpty();
}
@Test
public void testSuccess_multipleApplications() {
DomainApplication application1 = persistSimpleResource(newDomainApplication("example.com"));
DomainApplication application2 = persistSimpleResource(newDomainApplication("example.com"));
DomainApplication application3 = persistSimpleResource(newDomainApplication("example.com"));
persistResource(createUpdatedInstance(application1));
persistResource(createUpdatedInstance(application2));
persistResource(createUpdatedInstance(application3));
DomainApplicationIndex savedIndex = DomainApplicationIndex.load("example.com");
assertThat(savedIndex).isNotNull();
assertThat(savedIndex.getKeys()).containsExactly(
Key.create(application1), Key.create(application2), Key.create(application3));
assertThat(loadActiveApplicationsByDomainName("example.com", clock.nowUtc()))
.containsExactly(application1, application2, application3);
}
@Test
public void testSuccess_doesntStoreSameApplicationMultipleTimes() {
DomainApplication application1 = persistSimpleResource(newDomainApplication("example.com"));
DomainApplication application2 = persistSimpleResource(newDomainApplication("example.com"));
persistResource(createUpdatedInstance(application1));
persistResource(createUpdatedInstance(application2));
persistResource(createUpdatedInstance(application1));
assertThat(loadActiveApplicationsByDomainName("example.com", clock.nowUtc()))
.containsExactly(application1, application2);
}
@Test
public void testSuccess_doesntIncludePastApplications() {
DomainApplication application1 = persistSimpleResource(newDomainApplication("example.com"));
DomainApplication application2 =
persistSimpleResource(
newDomainApplication("example.com")
.asBuilder()
.setDeletionTime(DateTime.now(UTC).minusDays(30))
.build());
persistResource(createUpdatedInstance(application1));
persistResource(createUpdatedInstance(application2));
DomainApplicationIndex savedIndex =
DomainApplicationIndex.load(application1.getFullyQualifiedDomainName());
assertThat(savedIndex.getKeys()).hasSize(2);
assertThat(loadActiveApplicationsByDomainName("example.com", DateTime.now(UTC)))
.containsExactly(application1);
}
/** Ensure loading over 25 applications still succeeds (despite being in a transaction.) */
@Test
public void testSuccess_overCrossTransactionLimit() {
final ImmutableList.Builder<DomainApplication> applicationsBuilder =
new ImmutableList.Builder<>();
for (int i = 0; i < 30; i++) {
DomainApplication application = persistSimpleResource(newDomainApplication("example.com"));
persistResource(createUpdatedInstance(application));
applicationsBuilder.add(application);
}
ofy()
.transact(
() -> {
assertThat(DomainApplicationIndex.load("example.com")).isNotNull();
assertThat(loadActiveApplicationsByDomainName("example.com", clock.nowUtc()))
.containsExactlyElementsIn(applicationsBuilder.build());
});
}
}

View file

@ -19,6 +19,10 @@ import static com.google.common.truth.Truth.assertWithMessage;
import static com.google.common.truth.Truth8.assertThat;
import static google.registry.model.common.EntityGroupRoot.getCrossTldKey;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.model.registry.Registry.TldState.GENERAL_AVAILABILITY;
import static google.registry.model.registry.Registry.TldState.PREDELEGATION;
import static google.registry.model.registry.Registry.TldState.QUIET_PERIOD;
import static google.registry.model.registry.Registry.TldState.START_DATE_SUNRISE;
import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.newRegistry;
import static google.registry.testing.DatastoreHelper.persistPremiumList;
@ -216,65 +220,51 @@ public class RegistryTest extends EntityTestCase {
Registry registry = Registry.get("tld").asBuilder()
.setTldStateTransitions(ImmutableSortedMap.of(START_OF_TIME, TldState.PDT))
.build();
assertThat(registry.getTldState(START_OF_TIME)).isEqualTo(TldState.GENERAL_AVAILABILITY);
assertThat(registry.getTldState(START_OF_TIME)).isEqualTo(GENERAL_AVAILABILITY);
}
@Test
public void testTldStateTransitionTimes() {
Registry registry = Registry.get("tld").asBuilder()
.setTldStateTransitions(ImmutableSortedMap.<DateTime, TldState>naturalOrder()
.put(START_OF_TIME, TldState.PREDELEGATION)
.put(clock.nowUtc().plusMonths(1), TldState.SUNRISE)
.put(clock.nowUtc().plusMonths(2), TldState.SUNRUSH)
.put(clock.nowUtc().plusMonths(3), TldState.LANDRUSH)
.put(clock.nowUtc().plusMonths(4), TldState.QUIET_PERIOD)
.put(clock.nowUtc().plusMonths(5), TldState.GENERAL_AVAILABILITY)
.build())
.build();
assertThat(registry.getTldState(clock.nowUtc())).isEqualTo(TldState.PREDELEGATION);
assertThat(registry.getTldState(clock.nowUtc().plusMillis(1)))
.isEqualTo(TldState.PREDELEGATION);
Registry registry =
Registry.get("tld")
.asBuilder()
.setTldStateTransitions(
ImmutableSortedMap.<DateTime, TldState>naturalOrder()
.put(START_OF_TIME, PREDELEGATION)
.put(clock.nowUtc().plusMonths(1), START_DATE_SUNRISE)
.put(clock.nowUtc().plusMonths(2), QUIET_PERIOD)
.put(clock.nowUtc().plusMonths(3), GENERAL_AVAILABILITY)
.build())
.build();
assertThat(registry.getTldState(clock.nowUtc())).isEqualTo(PREDELEGATION);
assertThat(registry.getTldState(clock.nowUtc().plusMillis(1))).isEqualTo(PREDELEGATION);
assertThat(registry.getTldState(clock.nowUtc().plusMonths(1).minusMillis(1)))
.isEqualTo(TldState.PREDELEGATION);
assertThat(registry.getTldState(clock.nowUtc().plusMonths(1))).isEqualTo(TldState.SUNRISE);
.isEqualTo(PREDELEGATION);
assertThat(registry.getTldState(clock.nowUtc().plusMonths(1))).isEqualTo(START_DATE_SUNRISE);
assertThat(registry.getTldState(clock.nowUtc().plusMonths(1).plusMillis(1)))
.isEqualTo(TldState.SUNRISE);
.isEqualTo(START_DATE_SUNRISE);
assertThat(registry.getTldState(clock.nowUtc().plusMonths(2).minusMillis(1)))
.isEqualTo(TldState.SUNRISE);
assertThat(registry.getTldState(clock.nowUtc().plusMonths(2))).isEqualTo(TldState.SUNRUSH);
.isEqualTo(START_DATE_SUNRISE);
assertThat(registry.getTldState(clock.nowUtc().plusMonths(2))).isEqualTo(QUIET_PERIOD);
assertThat(registry.getTldState(clock.nowUtc().plusMonths(2).plusMillis(1)))
.isEqualTo(TldState.SUNRUSH);
.isEqualTo(QUIET_PERIOD);
assertThat(registry.getTldState(clock.nowUtc().plusMonths(3).minusMillis(1)))
.isEqualTo(TldState.SUNRUSH);
assertThat(registry.getTldState(clock.nowUtc().plusMonths(3))).isEqualTo(TldState.LANDRUSH);
.isEqualTo(QUIET_PERIOD);
assertThat(registry.getTldState(clock.nowUtc().plusMonths(3))).isEqualTo(GENERAL_AVAILABILITY);
assertThat(registry.getTldState(clock.nowUtc().plusMonths(3).plusMillis(1)))
.isEqualTo(TldState.LANDRUSH);
assertThat(registry.getTldState(clock.nowUtc().plusMonths(4).minusMillis(1)))
.isEqualTo(TldState.LANDRUSH);
assertThat(registry.getTldState(clock.nowUtc().plusMonths(4)))
.isEqualTo(TldState.QUIET_PERIOD);
assertThat(registry.getTldState(clock.nowUtc().plusMonths(4).plusMillis(1)))
.isEqualTo(TldState.QUIET_PERIOD);
assertThat(registry.getTldState(clock.nowUtc().plusMonths(5).minusMillis(1)))
.isEqualTo(TldState.QUIET_PERIOD);
assertThat(registry.getTldState(clock.nowUtc().plusMonths(5)))
.isEqualTo(TldState.GENERAL_AVAILABILITY);
assertThat(registry.getTldState(clock.nowUtc().plusMonths(5).plusMillis(1)))
.isEqualTo(TldState.GENERAL_AVAILABILITY);
assertThat(registry.getTldState(END_OF_TIME)).isEqualTo(TldState.GENERAL_AVAILABILITY);
.isEqualTo(GENERAL_AVAILABILITY);
assertThat(registry.getTldState(END_OF_TIME)).isEqualTo(GENERAL_AVAILABILITY);
}
@Test
public void testQuietPeriodCanAppearMultipleTimesAnywhere() {
Registry.get("tld").asBuilder()
.setTldStateTransitions(ImmutableSortedMap.<DateTime, TldState>naturalOrder()
.put(START_OF_TIME, TldState.PREDELEGATION)
.put(clock.nowUtc().plusMonths(1), TldState.QUIET_PERIOD)
.put(clock.nowUtc().plusMonths(2), TldState.SUNRISE)
.put(clock.nowUtc().plusMonths(3), TldState.QUIET_PERIOD)
.put(clock.nowUtc().plusMonths(4), TldState.LANDRUSH)
.put(clock.nowUtc().plusMonths(5), TldState.QUIET_PERIOD)
.put(clock.nowUtc().plusMonths(6), TldState.GENERAL_AVAILABILITY)
.put(START_OF_TIME, PREDELEGATION)
.put(clock.nowUtc().plusMonths(1), QUIET_PERIOD)
.put(clock.nowUtc().plusMonths(2), START_DATE_SUNRISE)
.put(clock.nowUtc().plusMonths(3), QUIET_PERIOD)
.put(clock.nowUtc().plusMonths(6), GENERAL_AVAILABILITY)
.build())
.build();
}
@ -366,10 +356,8 @@ public class RegistryTest extends EntityTestCase {
.asBuilder()
.setTldStateTransitions(
ImmutableSortedMap.of(
clock.nowUtc(),
TldState.SUNRUSH,
clock.nowUtc().plusMonths(1),
TldState.SUNRISE))
clock.nowUtc(), GENERAL_AVAILABILITY,
clock.nowUtc().plusMonths(1), START_DATE_SUNRISE))
.build());
}
@ -382,10 +370,8 @@ public class RegistryTest extends EntityTestCase {
.asBuilder()
.setTldStateTransitions(
ImmutableSortedMap.of(
clock.nowUtc(),
TldState.SUNRUSH,
clock.nowUtc().plusMonths(1),
TldState.SUNRUSH))
clock.nowUtc(), START_DATE_SUNRISE,
clock.nowUtc().plusMonths(1), START_DATE_SUNRISE))
.build());
}

View file

@ -157,32 +157,6 @@ enum google.registry.model.domain.DesignatedContact$Type {
REGISTRANT;
TECH;
}
class google.registry.model.domain.DomainApplication {
@Id java.lang.String repoId;
com.google.common.collect.ImmutableSortedMap<org.joda.time.DateTime, com.googlecode.objectify.Key<google.registry.model.ofy.CommitLogManifest>> revisions;
google.registry.model.CreateAutoTimestamp creationTime;
google.registry.model.UpdateAutoTimestamp updateTimestamp;
google.registry.model.domain.DomainAuthInfo authInfo;
google.registry.model.domain.Period period;
google.registry.model.domain.launch.ApplicationStatus applicationStatus;
google.registry.model.domain.launch.LaunchNotice launchNotice;
google.registry.model.domain.launch.LaunchPhase phase;
google.registry.model.eppcommon.Trid creationTrid;
java.lang.String creationClientId;
java.lang.String currentSponsorClientId;
java.lang.String fullyQualifiedDomainName;
java.lang.String idnTableName;
java.lang.String lastEppUpdateClientId;
java.lang.String tld;
java.util.List<google.registry.model.smd.EncodedSignedMark> encodedSignedMarks;
java.util.Set<com.googlecode.objectify.Key<google.registry.model.host.HostResource>> nsHosts;
java.util.Set<google.registry.model.domain.DesignatedContact> allContacts;
java.util.Set<google.registry.model.domain.secdns.DelegationSignerData> dsData;
java.util.Set<google.registry.model.eppcommon.StatusValue> status;
org.joda.money.Money auctionPrice;
org.joda.time.DateTime deletionTime;
org.joda.time.DateTime lastEppUpdateTime;
}
class google.registry.model.domain.DomainAuthInfo {
google.registry.model.eppcommon.AuthInfo$PasswordAuth pw;
}
@ -210,7 +184,6 @@ class google.registry.model.domain.DomainResource {
@Id java.lang.String repoId;
com.google.common.collect.ImmutableSortedMap<org.joda.time.DateTime, com.googlecode.objectify.Key<google.registry.model.ofy.CommitLogManifest>> revisions;
com.googlecode.objectify.Key<google.registry.model.billing.BillingEvent$Recurring> autorenewBillingEvent;
com.googlecode.objectify.Key<google.registry.model.domain.DomainApplication> application;
com.googlecode.objectify.Key<google.registry.model.poll.PollMessage$Autorenew> autorenewPollMessage;
com.googlecode.objectify.Key<google.registry.model.poll.PollMessage$OneTime> deletePollMessage;
google.registry.model.CreateAutoTimestamp creationTime;
@ -231,7 +204,6 @@ class google.registry.model.domain.DomainResource {
java.util.Set<google.registry.model.domain.secdns.DelegationSignerData> dsData;
java.util.Set<google.registry.model.eppcommon.StatusValue> status;
java.util.Set<java.lang.String> subordinateHosts;
org.joda.time.DateTime applicationTime;
org.joda.time.DateTime deletionTime;
org.joda.time.DateTime lastEppUpdateTime;
org.joda.time.DateTime lastTransferTime;
@ -252,20 +224,6 @@ enum google.registry.model.domain.Period$Unit {
MONTHS;
YEARS;
}
enum google.registry.model.domain.launch.ApplicationStatus {
ALLOCATED;
INVALID;
PENDING_ALLOCATION;
PENDING_VALIDATION;
REJECTED;
VALIDATED;
}
class google.registry.model.domain.launch.LaunchInfoResponseExtension {
google.registry.model.domain.launch.ApplicationStatus applicationStatus;
google.registry.model.domain.launch.LaunchPhase phase;
java.lang.String applicationId;
java.util.List<google.registry.model.mark.Mark> marks;
}
class google.registry.model.domain.launch.LaunchNotice {
google.registry.model.domain.launch.LaunchNotice$NoticeIdType noticeId;
org.joda.time.DateTime acceptedTime;
@ -275,10 +233,6 @@ class google.registry.model.domain.launch.LaunchNotice$NoticeIdType {
java.lang.String tcnId;
java.lang.String validatorId;
}
class google.registry.model.domain.launch.LaunchPhase {
java.lang.String phase;
java.lang.String subphase;
}
enum google.registry.model.domain.rgp.GracePeriodStatus {
ADD;
AUTO_RENEW;
@ -286,7 +240,6 @@ enum google.registry.model.domain.rgp.GracePeriodStatus {
PENDING_RESTORE;
REDEMPTION;
RENEW;
SUNRUSH_ADD;
TRANSFER;
}
class google.registry.model.domain.secdns.DelegationSignerData {
@ -349,11 +302,6 @@ class google.registry.model.host.HostResource {
org.joda.time.DateTime lastSuperordinateChange;
org.joda.time.DateTime lastTransferTime;
}
class google.registry.model.index.DomainApplicationIndex {
@Id java.lang.String fullyQualifiedDomainName;
google.registry.model.UpdateAutoTimestamp updateTimestamp;
java.util.Set<com.googlecode.objectify.Key<google.registry.model.domain.DomainApplication>> references;
}
class google.registry.model.index.EppResourceIndex {
@Id java.lang.String id;
@Parent com.googlecode.objectify.Key<google.registry.model.index.EppResourceIndexBucket> bucket;
@ -382,96 +330,6 @@ class google.registry.model.index.ForeignKeyIndex$ForeignKeyHostIndex {
google.registry.model.UpdateAutoTimestamp updateTimestamp;
org.joda.time.DateTime deletionTime;
}
class google.registry.model.mark.CourtMark {
java.lang.String countryCode;
java.lang.String courtName;
java.lang.String goodsAndServices;
java.lang.String id;
java.lang.String markName;
java.lang.String referenceNumber;
java.util.List<google.registry.model.mark.MarkContact> contacts;
java.util.List<google.registry.model.mark.MarkHolder> markHolders;
java.util.List<java.lang.String> labels;
java.util.List<java.lang.String> regions;
org.joda.time.DateTime protectionDate;
}
class google.registry.model.mark.Mark {
java.util.List<google.registry.model.mark.CourtMark> courtMarks;
java.util.List<google.registry.model.mark.Trademark> trademarks;
java.util.List<google.registry.model.mark.TreatyOrStatuteMark> treatyOrStatuteMarks;
}
class google.registry.model.mark.MarkAddress {
java.lang.String city;
java.lang.String countryCode;
java.lang.String state;
java.lang.String zip;
java.util.List<java.lang.String> street;
}
class google.registry.model.mark.MarkContact {
google.registry.model.mark.MarkAddress address;
google.registry.model.mark.MarkContact$ContactType type;
google.registry.model.mark.MarkPhoneNumber fax;
google.registry.model.mark.MarkPhoneNumber voice;
java.lang.String email;
java.lang.String name;
java.lang.String organization;
}
enum google.registry.model.mark.MarkContact$ContactType {
AGENT;
OWNER;
THIRD_PARTY;
}
class google.registry.model.mark.MarkHolder {
google.registry.model.mark.MarkAddress address;
google.registry.model.mark.MarkHolder$EntitlementType entitlement;
google.registry.model.mark.MarkPhoneNumber fax;
google.registry.model.mark.MarkPhoneNumber voice;
java.lang.String email;
java.lang.String name;
java.lang.String organization;
}
enum google.registry.model.mark.MarkHolder$EntitlementType {
ASSIGNEE;
LICENSEE;
OWNER;
}
class google.registry.model.mark.MarkPhoneNumber {
java.lang.String extension;
java.lang.String phoneNumber;
}
class google.registry.model.mark.MarkProtection {
java.lang.String countryCode;
java.lang.String region;
java.util.List<java.lang.String> rulingCountryCodes;
}
class google.registry.model.mark.Trademark {
java.lang.String applicationId;
java.lang.String goodsAndServices;
java.lang.String id;
java.lang.String jurisdiction;
java.lang.String markName;
java.lang.String registrationNumber;
java.util.List<google.registry.model.mark.MarkContact> contacts;
java.util.List<google.registry.model.mark.MarkHolder> markHolders;
java.util.List<java.lang.Long> markClasses;
java.util.List<java.lang.String> labels;
org.joda.time.DateTime applicationDate;
org.joda.time.DateTime expirationDate;
org.joda.time.DateTime registrationDate;
}
class google.registry.model.mark.TreatyOrStatuteMark {
java.lang.String goodsAndServices;
java.lang.String id;
java.lang.String markName;
java.lang.String referenceNumber;
java.lang.String title;
java.util.List<google.registry.model.mark.MarkContact> contacts;
java.util.List<google.registry.model.mark.MarkHolder> markHolders;
java.util.List<google.registry.model.mark.MarkProtection> markProtections;
java.util.List<java.lang.String> labels;
org.joda.time.DateTime executionDate;
org.joda.time.DateTime protectionDate;
}
class google.registry.model.ofy.CommitLogBucket {
@Id long bucketNum;
org.joda.time.DateTime lastWrittenTime;
@ -533,7 +391,6 @@ class google.registry.model.poll.PollMessage$Autorenew {
class google.registry.model.poll.PollMessage$OneTime {
@Id long id;
@Parent com.googlecode.objectify.Key<google.registry.model.reporting.HistoryEntry> parent;
google.registry.model.domain.launch.LaunchInfoResponseExtension launchInfoResponseExtension;
java.lang.String clientId;
java.lang.String msg;
java.util.List<google.registry.model.poll.PendingActionNotificationResponse$ContactPendingActionNotificationResponse> contactPendingActionNotificationResponses;
@ -664,7 +521,6 @@ class google.registry.model.registry.Registry {
org.joda.time.Duration pendingDeleteLength;
org.joda.time.Duration redemptionGracePeriodLength;
org.joda.time.Duration renewGracePeriodLength;
org.joda.time.Duration sunrushAddGracePeriodLength;
org.joda.time.Duration transferGracePeriodLength;
}
class google.registry.model.registry.Registry$BillingCostTransition {
@ -673,13 +529,10 @@ class google.registry.model.registry.Registry$BillingCostTransition {
}
enum google.registry.model.registry.Registry$TldState {
GENERAL_AVAILABILITY;
LANDRUSH;
PDT;
PREDELEGATION;
QUIET_PERIOD;
START_DATE_SUNRISE;
SUNRISE;
SUNRUSH;
}
class google.registry.model.registry.Registry$TldStateTransition {
google.registry.model.registry.Registry$TldState tldState;
@ -790,10 +643,6 @@ enum google.registry.model.reporting.HistoryEntry$Type {
CONTACT_TRANSFER_REQUEST;
CONTACT_UPDATE;
DOMAIN_ALLOCATE;
DOMAIN_APPLICATION_CREATE;
DOMAIN_APPLICATION_DELETE;
DOMAIN_APPLICATION_STATUS_UPDATE;
DOMAIN_APPLICATION_UPDATE;
DOMAIN_AUTORENEW;
DOMAIN_CREATE;
DOMAIN_DELETE;
@ -838,10 +687,6 @@ class google.registry.model.server.ServerSecret {
long leastSignificant;
long mostSignificant;
}
class google.registry.model.smd.EncodedSignedMark {
com.google.appengine.api.datastore.Text encodedData;
java.lang.String encoding;
}
class google.registry.model.smd.SignedMarkRevocationList {
@Id long id;
@Parent com.googlecode.objectify.Key<google.registry.model.common.EntityGroupRoot> parent;