mirror of
https://github.com/google/nomulus.git
synced 2025-08-03 00:12:11 +02:00
Merge DomainResource into DomainBase
This eliminates the use of Objectify polymorphism for EPP resources entirely (yay!), which makes the Registry 3.0 database migration easier. It is unfortunate that the naming parallelism of EppResources is lost between ContactResource, HostResource, and DomainResource, but the actual type as far as Datastore was concerned was DomainBase all along, and it would be a much more substantial data migration to allow us to continue using the class name DomainResource now that we're no longer using Objectify polymorphism. This simply isn't worth it. This also removes the polymorphic Datastore indexes (which will no longer function as of this change). The non-polymorphic replacement indexes were added in [] ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=230930546
This commit is contained in:
parent
97c2049669
commit
e2528875b2
166 changed files with 1525 additions and 1666 deletions
|
@ -18,7 +18,7 @@ import static com.google.common.io.BaseEncoding.base16;
|
|||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static com.google.common.truth.Truth8.assertThat;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.newDomainResource;
|
||||
import static google.registry.testing.DatastoreHelper.newDomainBase;
|
||||
import static google.registry.testing.DatastoreHelper.persistEppResource;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
|
@ -40,7 +40,7 @@ import google.registry.model.contact.ContactResource;
|
|||
import google.registry.model.contact.PostalInfo;
|
||||
import google.registry.model.domain.DesignatedContact;
|
||||
import google.registry.model.domain.DomainAuthInfo;
|
||||
import google.registry.model.domain.DomainResource;
|
||||
import google.registry.model.domain.DomainBase;
|
||||
import google.registry.model.domain.GracePeriod;
|
||||
import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||
|
@ -77,13 +77,13 @@ import org.junit.runner.RunWith;
|
|||
import org.junit.runners.JUnit4;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link DomainResourceToXjcConverter}.
|
||||
* Unit tests for {@link DomainBaseToXjcConverter}.
|
||||
*
|
||||
* <p>This tests the mapping between {@link DomainResource} and {@link XjcRdeDomain} as well as
|
||||
* <p>This tests the mapping between {@link DomainBase} and {@link XjcRdeDomain} as well as
|
||||
* some exceptional conditions.
|
||||
*/
|
||||
@RunWith(JUnit4.class)
|
||||
public class DomainResourceToXjcConverterTest {
|
||||
public class DomainBaseToXjcConverterTest {
|
||||
|
||||
@Rule
|
||||
public final AppEngineRule appEngine = AppEngineRule.builder()
|
||||
|
@ -101,7 +101,7 @@ public class DomainResourceToXjcConverterTest {
|
|||
@Test
|
||||
public void testConvertThick() {
|
||||
XjcRdeDomain bean =
|
||||
DomainResourceToXjcConverter.convertDomain(makeDomainResource(clock), RdeMode.FULL);
|
||||
DomainBaseToXjcConverter.convertDomain(makeDomainBase(clock), RdeMode.FULL);
|
||||
|
||||
assertThat(bean.getClID()).isEqualTo("GetTheeBack");
|
||||
|
||||
|
@ -184,7 +184,7 @@ public class DomainResourceToXjcConverterTest {
|
|||
@Test
|
||||
public void testConvertThin() {
|
||||
XjcRdeDomain bean =
|
||||
DomainResourceToXjcConverter.convertDomain(makeDomainResource(clock), RdeMode.THIN);
|
||||
DomainBaseToXjcConverter.convertDomain(makeDomainBase(clock), RdeMode.THIN);
|
||||
assertThat(bean.getRegistrant()).isNull();
|
||||
assertThat(bean.getContacts()).isEmpty();
|
||||
assertThat(bean.getSecDNS()).isNull();
|
||||
|
@ -193,14 +193,14 @@ public class DomainResourceToXjcConverterTest {
|
|||
@Test
|
||||
public void testMarshalThick() throws Exception {
|
||||
XjcRdeDomain bean =
|
||||
DomainResourceToXjcConverter.convertDomain(makeDomainResource(clock), RdeMode.FULL);
|
||||
DomainBaseToXjcConverter.convertDomain(makeDomainBase(clock), RdeMode.FULL);
|
||||
wrapDeposit(bean).marshal(new ByteArrayOutputStream(), UTF_8);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMarshalThin() throws Exception {
|
||||
XjcRdeDomain bean =
|
||||
DomainResourceToXjcConverter.convertDomain(makeDomainResource(clock), RdeMode.THIN);
|
||||
DomainBaseToXjcConverter.convertDomain(makeDomainBase(clock), RdeMode.THIN);
|
||||
wrapDeposit(bean).marshal(new ByteArrayOutputStream(), UTF_8);
|
||||
}
|
||||
|
||||
|
@ -221,9 +221,9 @@ public class DomainResourceToXjcConverterTest {
|
|||
return deposit;
|
||||
}
|
||||
|
||||
static DomainResource makeDomainResource(FakeClock clock) {
|
||||
DomainResource domain =
|
||||
newDomainResource("example.xn--q9jyb4c").asBuilder().setRepoId("2-Q9JYB4C").build();
|
||||
static DomainBase makeDomainBase(FakeClock clock) {
|
||||
DomainBase domain =
|
||||
newDomainBase("example.xn--q9jyb4c").asBuilder().setRepoId("2-Q9JYB4C").build();
|
||||
HistoryEntry historyEntry =
|
||||
persistResource(new HistoryEntry.Builder().setParent(domain).build());
|
||||
BillingEvent.OneTime billingEvent = persistResource(
|
|
@ -16,7 +16,7 @@ package google.registry.rde;
|
|||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.newDomainResource;
|
||||
import static google.registry.testing.DatastoreHelper.newDomainBase;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.xjc.XjcXmlTransformer.marshalStrict;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
@ -24,7 +24,7 @@ import static java.nio.charset.StandardCharsets.UTF_8;
|
|||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.net.InetAddresses;
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.model.domain.DomainResource;
|
||||
import google.registry.model.domain.DomainBase;
|
||||
import google.registry.model.eppcommon.StatusValue;
|
||||
import google.registry.model.host.HostResource;
|
||||
import google.registry.testing.AppEngineRule;
|
||||
|
@ -61,7 +61,7 @@ public class HostResourceToXjcConverterTest {
|
|||
|
||||
@Test
|
||||
public void testConvertSubordinateHost() {
|
||||
DomainResource domain = newDomainResource("love.foobar").asBuilder()
|
||||
DomainBase domain = newDomainBase("love.foobar").asBuilder()
|
||||
.setPersistedCurrentSponsorClientId("LeisureDog")
|
||||
.setLastTransferTime(DateTime.parse("2010-01-01T00:00:00Z"))
|
||||
.addStatusValue(StatusValue.PENDING_TRANSFER)
|
||||
|
|
|
@ -36,7 +36,7 @@ import google.registry.model.contact.ContactResource;
|
|||
import google.registry.model.contact.PostalInfo;
|
||||
import google.registry.model.domain.DesignatedContact;
|
||||
import google.registry.model.domain.DomainAuthInfo;
|
||||
import google.registry.model.domain.DomainResource;
|
||||
import google.registry.model.domain.DomainBase;
|
||||
import google.registry.model.domain.GracePeriod;
|
||||
import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||
|
@ -57,8 +57,8 @@ import org.joda.time.DateTime;
|
|||
/** Utility class for creating {@code EppResource} entities that'll successfully marshal. */
|
||||
final class RdeFixtures {
|
||||
|
||||
static DomainResource makeDomainResource(FakeClock clock, String tld) {
|
||||
DomainResource domain = new DomainResource.Builder()
|
||||
static DomainBase makeDomainBase(FakeClock clock, String tld) {
|
||||
DomainBase domain = new DomainBase.Builder()
|
||||
.setFullyQualifiedDomainName("example." + tld)
|
||||
.setRepoId(generateNewDomainRoid(tld))
|
||||
.setRegistrant(Key.create(
|
||||
|
|
|
@ -20,7 +20,7 @@ import static google.registry.model.common.Cursor.CursorType.BRDA;
|
|||
import static google.registry.model.common.Cursor.CursorType.RDE_STAGING;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.rde.RdeFixtures.makeContactResource;
|
||||
import static google.registry.rde.RdeFixtures.makeDomainResource;
|
||||
import static google.registry.rde.RdeFixtures.makeDomainBase;
|
||||
import static google.registry.rde.RdeFixtures.makeHostResource;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
|
@ -322,7 +322,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
|
|||
public void testMapReduce_bunchOfResources_headerHasCorrectCounts() throws Exception {
|
||||
clock.setTo(DateTime.parse("1999-12-31TZ"));
|
||||
createTldWithEscrowEnabled("lol");
|
||||
makeDomainResource(clock, "lol");
|
||||
makeDomainBase(clock, "lol");
|
||||
|
||||
clock.setTo(DateTime.parse("2000-01-01TZ"));
|
||||
action.run();
|
||||
|
@ -417,7 +417,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
|
|||
public void testMapReduce_sameDayRdeDeposit_advancesCursorToTomorrow() throws Exception {
|
||||
clock.setTo(DateTime.parse("1999-12-31TZ"));
|
||||
createTldWithEscrowEnabled("lol");
|
||||
makeDomainResource(clock, "lol");
|
||||
makeDomainBase(clock, "lol");
|
||||
setCursor(Registry.get("lol"), RDE_STAGING, DateTime.parse("2000-01-01TZ"));
|
||||
setCursor(Registry.get("lol"), BRDA, DateTime.parse("2000-01-04TZ"));
|
||||
clock.setTo(DateTime.parse("2000-01-01TZ")); // Saturday
|
||||
|
@ -438,7 +438,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
|
|||
public void testMapReduce_onBrdaDay_advancesBothCursors() throws Exception {
|
||||
clock.setTo(DateTime.parse("1999-12-31TZ"));
|
||||
createTldWithEscrowEnabled("lol");
|
||||
makeDomainResource(clock, "lol");
|
||||
makeDomainBase(clock, "lol");
|
||||
setCursor(Registry.get("lol"), RDE_STAGING, DateTime.parse("2000-01-04TZ"));
|
||||
setCursor(Registry.get("lol"), BRDA, DateTime.parse("2000-01-04TZ"));
|
||||
clock.setTo(DateTime.parse("2000-01-04TZ")); // Tuesday
|
||||
|
@ -459,7 +459,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
|
|||
public void testMapReduce_onBrdaDay_enqueuesBothTasks() throws Exception {
|
||||
clock.setTo(DateTime.parse("1999-12-31TZ"));
|
||||
createTldWithEscrowEnabled("lol");
|
||||
makeDomainResource(clock, "lol");
|
||||
makeDomainBase(clock, "lol");
|
||||
setCursor(Registry.get("lol"), RDE_STAGING, DateTime.parse("2000-01-04TZ"));
|
||||
setCursor(Registry.get("lol"), BRDA, DateTime.parse("2000-01-04TZ"));
|
||||
clock.setTo(DateTime.parse("2000-01-04TZ")); // Tuesday
|
||||
|
@ -515,7 +515,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
|
|||
public void testMapReduce_idnTables_goInDeposit() throws Exception {
|
||||
clock.setTo(DateTime.parse("1999-12-31TZ"));
|
||||
createTldWithEscrowEnabled("fop");
|
||||
makeDomainResource(clock, "fop");
|
||||
makeDomainBase(clock, "fop");
|
||||
|
||||
clock.setTo(DateTime.parse("2000-01-01TZ"));
|
||||
action.run();
|
||||
|
@ -541,7 +541,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
|
|||
public void testMapReduce_withDomain_producesExpectedXml() throws Exception {
|
||||
clock.setTo(DateTime.parse("1999-12-31TZ"));
|
||||
createTldWithEscrowEnabled("lol");
|
||||
makeDomainResource(clock, "lol");
|
||||
makeDomainBase(clock, "lol");
|
||||
|
||||
clock.setTo(DateTime.parse("2000-01-01TZ"));
|
||||
action.run();
|
||||
|
@ -558,7 +558,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
|
|||
public void testMapReduce_withDomain_producesCorrectLengthFile() throws Exception {
|
||||
clock.setTo(DateTime.parse("1999-12-31TZ"));
|
||||
createTldWithEscrowEnabled("lol");
|
||||
makeDomainResource(clock, "lol");
|
||||
makeDomainBase(clock, "lol");
|
||||
|
||||
clock.setTo(DateTime.parse("2000-01-01TZ"));
|
||||
action.run();
|
||||
|
@ -573,7 +573,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
|
|||
public void testMapReduce_withDomain_producesReportXml() throws Exception {
|
||||
clock.setTo(DateTime.parse("1999-12-31TZ"));
|
||||
createTldWithEscrowEnabled("lol");
|
||||
makeDomainResource(clock, "lol");
|
||||
makeDomainBase(clock, "lol");
|
||||
|
||||
clock.setTo(DateTime.parse("2000-01-01TZ"));
|
||||
action.run();
|
||||
|
@ -590,9 +590,9 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
|
|||
public void testMapReduce_twoDomainsDifferentTlds_isolatesDomains() throws Exception {
|
||||
clock.setTo(DateTime.parse("1999-12-31TZ"));
|
||||
createTldWithEscrowEnabled("boggle");
|
||||
makeDomainResource(clock, "boggle");
|
||||
makeDomainBase(clock, "boggle");
|
||||
createTldWithEscrowEnabled("lol");
|
||||
makeDomainResource(clock, "lol");
|
||||
makeDomainBase(clock, "lol");
|
||||
|
||||
clock.setTo(DateTime.parse("2000-01-01TZ"));
|
||||
action.run();
|
||||
|
@ -746,7 +746,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
|
|||
clock.setTo(DateTime.parse("1999-12-31TZ"));
|
||||
for (String tld : tlds) {
|
||||
createTldWithEscrowEnabled(tld);
|
||||
makeDomainResource(clock, tld);
|
||||
makeDomainBase(clock, tld);
|
||||
setCursor(Registry.get(tld), RDE_STAGING, DateTime.parse("1999-01-01TZ"));
|
||||
setCursor(Registry.get(tld), BRDA, DateTime.parse("2001-01-01TZ"));
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import org.junit.runners.Suite.SuiteClasses;
|
|||
/** Convenience class to run all RDE tests inside IDE with one keystroke. */
|
||||
@RunWith(Suite.class)
|
||||
@SuiteClasses({
|
||||
DomainResourceToXjcConverterTest.class,
|
||||
DomainBaseToXjcConverterTest.class,
|
||||
GhostrydeGpgIntegrationTest.class,
|
||||
GhostrydeTest.class,
|
||||
HostResourceToXjcConverterTest.class,
|
||||
|
|
|
@ -19,7 +19,7 @@ import static google.registry.model.ofy.ObjectifyService.ofy;
|
|||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.getHistoryEntries;
|
||||
import static google.registry.testing.DatastoreHelper.getPollMessages;
|
||||
import static google.registry.testing.DatastoreHelper.newDomainResource;
|
||||
import static google.registry.testing.DatastoreHelper.newDomainBase;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveContact;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.DatastoreHelper.persistSimpleResource;
|
||||
|
@ -40,7 +40,7 @@ import google.registry.config.RegistryConfig.ConfigModule;
|
|||
import google.registry.gcs.GcsUtils;
|
||||
import google.registry.mapreduce.MapreduceRunner;
|
||||
import google.registry.model.billing.BillingEvent;
|
||||
import google.registry.model.domain.DomainResource;
|
||||
import google.registry.model.domain.DomainBase;
|
||||
import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||
import google.registry.model.eppcommon.Trid;
|
||||
import google.registry.model.poll.PollMessage;
|
||||
|
@ -108,7 +108,7 @@ public class RdeDomainImportActionTest extends MapreduceTestCase<RdeDomainImport
|
|||
public void testMapreduceSuccessfullyImportsDomain() throws Exception {
|
||||
pushToGcs(DEPOSIT_1_DOMAIN);
|
||||
runMapreduce();
|
||||
List<DomainResource> domains = ofy().load().type(DomainResource.class).list();
|
||||
List<DomainBase> domains = ofy().load().type(DomainBase.class).list();
|
||||
assertThat(domains).hasSize(1);
|
||||
checkDomain(domains.get(0));
|
||||
}
|
||||
|
@ -117,8 +117,8 @@ public class RdeDomainImportActionTest extends MapreduceTestCase<RdeDomainImport
|
|||
public void testMapreduceSuccessfullyCreatesHistoryEntry() throws Exception {
|
||||
pushToGcs(DEPOSIT_1_DOMAIN);
|
||||
runMapreduce();
|
||||
List<DomainResource> domains = ofy().load().type(DomainResource.class).list();
|
||||
DomainResource domain = domains.get(0);
|
||||
List<DomainBase> domains = ofy().load().type(DomainBase.class).list();
|
||||
DomainBase domain = domains.get(0);
|
||||
// verify history entry
|
||||
List<HistoryEntry> historyEntries = getHistoryEntries(domain);
|
||||
assertThat(historyEntries).hasSize(1);
|
||||
|
@ -130,9 +130,9 @@ public class RdeDomainImportActionTest extends MapreduceTestCase<RdeDomainImport
|
|||
public void testMapreduceTwiceDoesNotDuplicateResources() throws Exception {
|
||||
pushToGcs(DEPOSIT_1_DOMAIN);
|
||||
// Create domain and history entry first
|
||||
DomainResource existingDomain =
|
||||
DomainBase existingDomain =
|
||||
persistResource(
|
||||
newDomainResource("example1.test").asBuilder().setRepoId("Dexample1-TEST").build());
|
||||
newDomainBase("example1.test").asBuilder().setRepoId("Dexample1-TEST").build());
|
||||
persistSimpleResource(createHistoryEntry(
|
||||
existingDomain.getRepoId(),
|
||||
existingDomain.getCurrentSponsorClientId(),
|
||||
|
@ -141,9 +141,9 @@ public class RdeDomainImportActionTest extends MapreduceTestCase<RdeDomainImport
|
|||
// aren't imported twice (only one domain, and one history entry)
|
||||
pushToGcs(DEPOSIT_1_DOMAIN);
|
||||
runMapreduce();
|
||||
List<DomainResource> domains = ofy().load().type(DomainResource.class).list();
|
||||
List<DomainBase> domains = ofy().load().type(DomainBase.class).list();
|
||||
assertThat(domains.size()).isEqualTo(1);
|
||||
DomainResource domain = domains.get(0);
|
||||
DomainBase domain = domains.get(0);
|
||||
// verify history entry
|
||||
List<HistoryEntry> historyEntries = getHistoryEntries(domain);
|
||||
assertThat(historyEntries).hasSize(1);
|
||||
|
@ -165,13 +165,13 @@ public class RdeDomainImportActionTest extends MapreduceTestCase<RdeDomainImport
|
|||
public void testMapreducePendingTransferServerApproval() throws Exception {
|
||||
pushToGcs(DEPOSIT_1_DOMAIN_PENDING_TRANSFER);
|
||||
runMapreduce();
|
||||
List<DomainResource> domains = ofy().load().type(DomainResource.class).list();
|
||||
List<DomainBase> domains = ofy().load().type(DomainBase.class).list();
|
||||
assertThat(domains).hasSize(1);
|
||||
checkDomain(domains.get(0));
|
||||
// implicit server approval happens at 2015-01-08T22:00:00.0Z
|
||||
DateTime serverApprovalTime = DateTime.parse("2015-01-08T22:00:00.0Z");
|
||||
// Domain should be assigned to RegistrarX before server approval
|
||||
DomainResource beforeApproval =
|
||||
DomainBase beforeApproval =
|
||||
domains.get(0).cloneProjectedAtTime(serverApprovalTime.minus(Seconds.ONE));
|
||||
assertThat(beforeApproval.getCurrentSponsorClientId()).isEqualTo("RegistrarX");
|
||||
assertThat(loadAutorenewBillingEventForDomain(beforeApproval).getClientId())
|
||||
|
@ -199,7 +199,7 @@ public class RdeDomainImportActionTest extends MapreduceTestCase<RdeDomainImport
|
|||
DateTime.parse("2015-01-08T22:00:00.0Z"));
|
||||
|
||||
// Domain should be assigned to RegistrarY after server approval
|
||||
DomainResource afterApproval =
|
||||
DomainBase afterApproval =
|
||||
domains.get(0).cloneProjectedAtTime(serverApprovalTime);
|
||||
assertThat(afterApproval.getCurrentSponsorClientId()).isEqualTo("RegistrarY");
|
||||
assertThat(loadAutorenewBillingEventForDomain(afterApproval).getClientId())
|
||||
|
@ -227,12 +227,12 @@ public class RdeDomainImportActionTest extends MapreduceTestCase<RdeDomainImport
|
|||
DateTime serverApprovalTime = DateTime.parse("2015-02-03T22:00:00.0Z");
|
||||
pushToGcs(DEPOSIT_1_DOMAIN_PENDING_TRANSFER_REG_CAP);
|
||||
runMapreduce();
|
||||
List<DomainResource> domains = ofy().load().type(DomainResource.class).list();
|
||||
List<DomainBase> domains = ofy().load().type(DomainBase.class).list();
|
||||
assertThat(domains).hasSize(1);
|
||||
checkDomain(domains.get(0));
|
||||
|
||||
// Domain should be assigned to RegistrarX before server approval
|
||||
DomainResource beforeApproval =
|
||||
DomainBase beforeApproval =
|
||||
domains.get(0).cloneProjectedAtTime(serverApprovalTime.minus(Seconds.ONE));
|
||||
assertThat(beforeApproval.getCurrentSponsorClientId()).isEqualTo("RegistrarX");
|
||||
assertThat(loadAutorenewBillingEventForDomain(beforeApproval).getClientId())
|
||||
|
@ -244,7 +244,7 @@ public class RdeDomainImportActionTest extends MapreduceTestCase<RdeDomainImport
|
|||
.isEqualTo(DateTime.parse("2024-04-03T22:00:00.0Z"));
|
||||
|
||||
// Domain should be assigned to RegistrarY after server approval
|
||||
DomainResource afterApproval =
|
||||
DomainBase afterApproval =
|
||||
domains.get(0).cloneProjectedAtTime(serverApprovalTime);
|
||||
assertThat(afterApproval.getCurrentSponsorClientId()).isEqualTo("RegistrarY");
|
||||
// New expiration should be capped at 10 years from server approval time, which is 2025-02-03,
|
||||
|
@ -268,7 +268,7 @@ public class RdeDomainImportActionTest extends MapreduceTestCase<RdeDomainImport
|
|||
public void testMapreducePendingTransferEvents() throws Exception {
|
||||
pushToGcs(DEPOSIT_1_DOMAIN_PENDING_TRANSFER);
|
||||
runMapreduce();
|
||||
List<DomainResource> domains = ofy().load().type(DomainResource.class).list();
|
||||
List<DomainBase> domains = ofy().load().type(DomainBase.class).list();
|
||||
assertThat(domains).hasSize(1);
|
||||
checkDomain(domains.get(0));
|
||||
checkTransferRequestPollMessage(
|
||||
|
@ -289,7 +289,7 @@ public class RdeDomainImportActionTest extends MapreduceTestCase<RdeDomainImport
|
|||
}
|
||||
|
||||
private static void checkTransferBillingEvent(
|
||||
DomainResource domain, DateTime automaticTransferTime) {
|
||||
DomainBase domain, DateTime automaticTransferTime) {
|
||||
for (BillingEvent.OneTime event :
|
||||
ofy().load().type(BillingEvent.OneTime.class).ancestor(domain).list()) {
|
||||
if (event.getReason() == BillingEvent.Reason.TRANSFER) {
|
||||
|
@ -302,7 +302,7 @@ public class RdeDomainImportActionTest extends MapreduceTestCase<RdeDomainImport
|
|||
|
||||
/** Verifies the existence of a transfer request poll message */
|
||||
private static void checkTransferRequestPollMessage(
|
||||
DomainResource domain, String clientId, DateTime expectedAt, DateTime expectedExpiration) {
|
||||
DomainBase domain, String clientId, DateTime expectedAt, DateTime expectedExpiration) {
|
||||
for (PollMessage message : getPollMessages(domain)) {
|
||||
if (TransferStatus.PENDING.getMessage().equals(message.getMsg())
|
||||
&& clientId.equals(message.getClientId())
|
||||
|
@ -321,7 +321,7 @@ public class RdeDomainImportActionTest extends MapreduceTestCase<RdeDomainImport
|
|||
|
||||
/** Verifies the existence of a transfer server approved poll message */
|
||||
private static void checkTransferServerApprovalPollMessage(
|
||||
DomainResource domain, String clientId, DateTime expectedAt) {
|
||||
DomainBase domain, String clientId, DateTime expectedAt) {
|
||||
for (PollMessage message : getPollMessages(domain)) {
|
||||
if (TransferStatus.SERVER_APPROVED.getMessage().equals(message.getMsg())
|
||||
&& clientId.equals(message.getClientId())
|
||||
|
@ -334,7 +334,7 @@ public class RdeDomainImportActionTest extends MapreduceTestCase<RdeDomainImport
|
|||
|
||||
/** Verifies autorenew {@link PollMessage} is correct */
|
||||
private static void checkAutorenewPollMessage(
|
||||
DomainResource domain, String clientId, DateTime expectedAt, DateTime recurrenceEndTime) {
|
||||
DomainBase domain, String clientId, DateTime expectedAt, DateTime recurrenceEndTime) {
|
||||
PollMessage.Autorenew autorenewPollMessage = loadAutorenewPollMessageForDomain(domain);
|
||||
assertThat(autorenewPollMessage).isNotNull();
|
||||
assertThat(autorenewPollMessage.getClientId()).isEqualTo(clientId);
|
||||
|
@ -344,7 +344,7 @@ public class RdeDomainImportActionTest extends MapreduceTestCase<RdeDomainImport
|
|||
|
||||
/** Verifies autorenew {@link BillingEvent} is correct */
|
||||
private static void checkAutorenewBillingEvent(
|
||||
DomainResource domain, String clientId, DateTime expectedAt, DateTime recurrenceEndTime) {
|
||||
DomainBase domain, String clientId, DateTime expectedAt, DateTime recurrenceEndTime) {
|
||||
BillingEvent.Recurring autorenewBillingEvent = loadAutorenewBillingEventForDomain(domain);
|
||||
assertThat(autorenewBillingEvent).isNotNull();
|
||||
assertThat(autorenewBillingEvent.getClientId()).isEqualTo(clientId);
|
||||
|
@ -353,7 +353,7 @@ public class RdeDomainImportActionTest extends MapreduceTestCase<RdeDomainImport
|
|||
}
|
||||
|
||||
/** Verify history entry fields are correct */
|
||||
private static void checkHistoryEntry(HistoryEntry entry, DomainResource parent) {
|
||||
private static void checkHistoryEntry(HistoryEntry entry, DomainBase parent) {
|
||||
assertThat(entry.getType()).isEqualTo(HistoryEntry.Type.RDE_IMPORT);
|
||||
assertThat(entry.getClientId()).isEqualTo(parent.getCurrentSponsorClientId());
|
||||
assertThat(entry.getXmlBytes().length).isGreaterThan(0);
|
||||
|
@ -364,7 +364,7 @@ public class RdeDomainImportActionTest extends MapreduceTestCase<RdeDomainImport
|
|||
}
|
||||
|
||||
/** Verifies that domain fields match expected values */
|
||||
private static void checkDomain(DomainResource domain) {
|
||||
private static void checkDomain(DomainBase domain) {
|
||||
assertThat(domain.getFullyQualifiedDomainName()).isEqualTo("example1.test");
|
||||
assertThat(domain.getRepoId()).isEqualTo("Dexample1-TEST");
|
||||
}
|
||||
|
@ -392,12 +392,12 @@ public class RdeDomainImportActionTest extends MapreduceTestCase<RdeDomainImport
|
|||
}
|
||||
|
||||
@Nullable
|
||||
private static BillingEvent.Recurring loadAutorenewBillingEventForDomain(DomainResource domain) {
|
||||
private static BillingEvent.Recurring loadAutorenewBillingEventForDomain(DomainBase domain) {
|
||||
return ofy().load().key(domain.getAutorenewBillingEvent()).now();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static PollMessage.Autorenew loadAutorenewPollMessageForDomain(DomainResource domain) {
|
||||
private static PollMessage.Autorenew loadAutorenewPollMessageForDomain(DomainBase domain) {
|
||||
return ofy().load().key(domain.getAutorenewPollMessage()).now();
|
||||
}
|
||||
|
||||
|
@ -411,7 +411,7 @@ public class RdeDomainImportActionTest extends MapreduceTestCase<RdeDomainImport
|
|||
.setBySuperuser(true)
|
||||
.setReason("RDE Import")
|
||||
.setRequestedByRegistrar(false)
|
||||
.setParent(Key.create(null, DomainResource.class, roid))
|
||||
.setParent(Key.create(null, DomainBase.class, roid))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import static google.registry.model.eppcommon.StatusValue.PENDING_DELETE;
|
|||
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.newDomainResource;
|
||||
import static google.registry.testing.DatastoreHelper.newDomainBase;
|
||||
import static google.registry.testing.DatastoreHelper.newHostResource;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveDomain;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
|
@ -36,7 +36,7 @@ import com.googlecode.objectify.Key;
|
|||
import google.registry.config.RegistryConfig.ConfigModule;
|
||||
import google.registry.gcs.GcsUtils;
|
||||
import google.registry.mapreduce.MapreduceRunner;
|
||||
import google.registry.model.domain.DomainResource;
|
||||
import google.registry.model.domain.DomainBase;
|
||||
import google.registry.model.host.HostResource;
|
||||
import google.registry.model.index.ForeignKeyIndex.ForeignKeyDomainIndex;
|
||||
import google.registry.model.ofy.Ofy;
|
||||
|
@ -98,8 +98,8 @@ public class RdeHostLinkActionTest extends MapreduceTestCase<RdeHostLinkAction>
|
|||
.asBuilder()
|
||||
.setRepoId("Hns1_example1_test-TEST")
|
||||
.build());
|
||||
DomainResource superordinateDomain = persistActiveDomain("example1.test");
|
||||
Key<DomainResource> superOrdinateDomainKey = Key.create(superordinateDomain);
|
||||
DomainBase superordinateDomain = persistActiveDomain("example1.test");
|
||||
Key<DomainBase> superOrdinateDomainKey = Key.create(superordinateDomain);
|
||||
pushToGcs(DEPOSIT_1_HOST);
|
||||
// set transaction time to slightly after resource save
|
||||
clock.advanceOneMilli();
|
||||
|
@ -111,7 +111,7 @@ public class RdeHostLinkActionTest extends MapreduceTestCase<RdeHostLinkAction>
|
|||
assertThat(hosts.get(0).getLastSuperordinateChange())
|
||||
.isEqualTo(DateTime.parse("2016-05-07T14:55:38.001Z"));
|
||||
// verify that domain is linked to host
|
||||
List<DomainResource> domains = ofy().load().type(DomainResource.class).list();
|
||||
List<DomainBase> domains = ofy().load().type(DomainBase.class).list();
|
||||
assertThat(domains).hasSize(1);
|
||||
assertThat(domains.get(0).getSubordinateHosts()).containsExactly("ns1.example1.test");
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ public class RdeHostLinkActionTest extends MapreduceTestCase<RdeHostLinkAction>
|
|||
.asBuilder()
|
||||
.setRepoId("wrong-repoid")
|
||||
.build());
|
||||
DomainResource superordinateDomain = persistActiveDomain("example1.test");
|
||||
DomainBase superordinateDomain = persistActiveDomain("example1.test");
|
||||
ForeignKeyDomainIndex.create(superordinateDomain, END_OF_TIME);
|
||||
pushToGcs(DEPOSIT_1_HOST);
|
||||
// set transaction time to slightly after resource save
|
||||
|
@ -146,7 +146,7 @@ public class RdeHostLinkActionTest extends MapreduceTestCase<RdeHostLinkAction>
|
|||
.setRepoId("Hns1_example1_test-TEST")
|
||||
.build());
|
||||
persistResource(
|
||||
newDomainResource("example1.test")
|
||||
newDomainBase("example1.test")
|
||||
.asBuilder()
|
||||
.setStatusValues(ImmutableSet.of(PENDING_DELETE))
|
||||
.build());
|
||||
|
|
|
@ -41,7 +41,7 @@ import google.registry.model.EppResource.ForeignKeyedEppResource;
|
|||
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.DomainBase;
|
||||
import google.registry.model.eppcommon.StatusValue;
|
||||
import google.registry.model.host.HostResource;
|
||||
import google.registry.model.index.EppResourceIndex;
|
||||
|
@ -174,10 +174,10 @@ public class RdeImportUtilsTest extends ShardableTestCase {
|
|||
|
||||
@Test
|
||||
public void testImportNewDomain() {
|
||||
final DomainResource newDomain = buildNewDomain();
|
||||
final DomainBase newDomain = buildNewDomain();
|
||||
importResourceInTransaction(newDomain);
|
||||
|
||||
DomainResource saved = getDomain("Dexample1-TEST");
|
||||
DomainBase saved = getDomain("Dexample1-TEST");
|
||||
assertThat(saved.getFullyQualifiedDomainName())
|
||||
.isEqualTo(newDomain.getFullyQualifiedDomainName());
|
||||
assertThat(saved.getStatusValues()).isEqualTo(newDomain.getStatusValues());
|
||||
|
@ -192,15 +192,15 @@ public class RdeImportUtilsTest extends ShardableTestCase {
|
|||
|
||||
@Test
|
||||
public void testImportExistingDomain() {
|
||||
DomainResource newDomain = buildNewDomain();
|
||||
DomainBase newDomain = buildNewDomain();
|
||||
persistResource(newDomain);
|
||||
final DomainResource updatedDomain =
|
||||
final DomainBase updatedDomain =
|
||||
newDomain
|
||||
.asBuilder()
|
||||
.setFullyQualifiedDomainName("1" + newDomain.getFullyQualifiedDomainName())
|
||||
.build();
|
||||
assertThrows(ResourceExistsException.class, () -> importResourceInTransaction(updatedDomain));
|
||||
DomainResource saved = getDomain("Dexample1-TEST");
|
||||
DomainBase saved = getDomain("Dexample1-TEST");
|
||||
assertThat(saved.getFullyQualifiedDomainName())
|
||||
.isEqualTo(newDomain.getFullyQualifiedDomainName());
|
||||
assertThat(saved.getStatusValues()).isEqualTo(newDomain.getStatusValues());
|
||||
|
@ -235,10 +235,10 @@ public class RdeImportUtilsTest extends ShardableTestCase {
|
|||
.build();
|
||||
}
|
||||
|
||||
private DomainResource buildNewDomain() {
|
||||
private DomainBase buildNewDomain() {
|
||||
ContactResource registrant = persistActiveContact("jd1234");
|
||||
ContactResource admin = persistActiveContact("sh8013");
|
||||
return new DomainResource.Builder()
|
||||
return new DomainBase.Builder()
|
||||
.setFullyQualifiedDomainName("example1.example")
|
||||
.setRepoId("Dexample1-TEST")
|
||||
.setStatusValues(ImmutableSet.of(StatusValue.OK))
|
||||
|
@ -317,8 +317,8 @@ public class RdeImportUtilsTest extends ShardableTestCase {
|
|||
}
|
||||
|
||||
/** Gets the domain with the specified ROID */
|
||||
private static DomainResource getDomain(String repoId) {
|
||||
final Key<DomainResource> key = Key.create(DomainResource.class, repoId);
|
||||
private static DomainBase getDomain(String repoId) {
|
||||
final Key<DomainBase> key = Key.create(DomainBase.class, repoId);
|
||||
return ofy().transact(() -> ofy().load().key(key).now());
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ import google.registry.model.billing.BillingEvent.Flag;
|
|||
import google.registry.model.billing.BillingEvent.Reason;
|
||||
import google.registry.model.contact.ContactResource;
|
||||
import google.registry.model.domain.DesignatedContact;
|
||||
import google.registry.model.domain.DomainResource;
|
||||
import google.registry.model.domain.DomainBase;
|
||||
import google.registry.model.domain.GracePeriod;
|
||||
import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||
|
@ -68,9 +68,9 @@ import org.junit.Test;
|
|||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.JUnit4;
|
||||
|
||||
/** Tests for {@link XjcToDomainResourceConverter} */
|
||||
/** Tests for {@link XjcToDomainBaseConverter} */
|
||||
@RunWith(JUnit4.class)
|
||||
public class XjcToDomainResourceConverterTest {
|
||||
public class XjcToDomainBaseConverterTest {
|
||||
|
||||
//List of packages to initialize JAXBContext
|
||||
private static final String JAXB_CONTEXT_PACKAGES = Joiner.on(":").join(asList(
|
||||
|
@ -102,7 +102,7 @@ public class XjcToDomainResourceConverterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testConvertDomainResource() {
|
||||
public void testConvertDomainBase() {
|
||||
final ContactResource jd1234 = persistActiveContact("jd1234");
|
||||
final ContactResource sh8013 = persistActiveContact("sh8013");
|
||||
ImmutableSet<DesignatedContact> expectedContacts =
|
||||
|
@ -110,10 +110,10 @@ public class XjcToDomainResourceConverterTest {
|
|||
DesignatedContact.create(DesignatedContact.Type.ADMIN, Key.create(sh8013)),
|
||||
DesignatedContact.create(DesignatedContact.Type.TECH, Key.create(sh8013)));
|
||||
final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment.xml");
|
||||
DomainResource domain = convertDomainInTransaction(xjcDomain);
|
||||
DomainBase domain = convertDomainInTransaction(xjcDomain);
|
||||
assertThat(domain.getFullyQualifiedDomainName()).isEqualTo("example1.example");
|
||||
assertThat(domain.getRepoId()).isEqualTo("Dexample1-TEST");
|
||||
// A DomainResource has status INACTIVE if there are no nameservers.
|
||||
// A DomainBase has status INACTIVE if there are no nameservers.
|
||||
assertThat(domain.getStatusValues()).isEqualTo(ImmutableSet.of(StatusValue.INACTIVE));
|
||||
assertThat(domain.getRegistrant().getName()).isEqualTo(jd1234.getRepoId());
|
||||
assertThat(domain.getContacts()).isEqualTo(expectedContacts);
|
||||
|
@ -133,20 +133,20 @@ public class XjcToDomainResourceConverterTest {
|
|||
|
||||
/** Verifies that uppercase domain names are converted to lowercase */
|
||||
@Test
|
||||
public void testConvertDomainResourceUpperCase() {
|
||||
public void testConvertDomainBaseUpperCase() {
|
||||
persistActiveContact("jd1234");
|
||||
persistActiveContact("sh8013");
|
||||
final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_ucase.xml");
|
||||
DomainResource domain = convertDomainInTransaction(xjcDomain);
|
||||
DomainBase domain = convertDomainInTransaction(xjcDomain);
|
||||
assertThat(domain.getFullyQualifiedDomainName()).isEqualTo("example1.example");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConvertDomainResourceAddPeriod() {
|
||||
public void testConvertDomainBaseAddPeriod() {
|
||||
persistActiveContact("jd1234");
|
||||
persistActiveContact("sh8013");
|
||||
final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_addPeriod.xml");
|
||||
DomainResource domain = convertDomainInTransaction(xjcDomain);
|
||||
DomainBase domain = convertDomainInTransaction(xjcDomain);
|
||||
assertThat(domain.getGracePeriods()).hasSize(1);
|
||||
GracePeriod gracePeriod = domain.getGracePeriods().asList().get(0);
|
||||
assertThat(gracePeriod.getType()).isEqualTo(GracePeriodStatus.ADD);
|
||||
|
@ -155,11 +155,11 @@ public class XjcToDomainResourceConverterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testConvertDomainResourceAutoRenewPeriod() {
|
||||
public void testConvertDomainBaseAutoRenewPeriod() {
|
||||
persistActiveContact("jd1234");
|
||||
persistActiveContact("sh8013");
|
||||
final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_autoRenewPeriod.xml");
|
||||
DomainResource domain = convertDomainInTransaction(xjcDomain);
|
||||
DomainBase domain = convertDomainInTransaction(xjcDomain);
|
||||
assertThat(domain.getGracePeriods()).hasSize(1);
|
||||
GracePeriod gracePeriod = domain.getGracePeriods().asList().get(0);
|
||||
assertThat(gracePeriod.getType()).isEqualTo(GracePeriodStatus.AUTO_RENEW);
|
||||
|
@ -168,11 +168,11 @@ public class XjcToDomainResourceConverterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testConvertDomainResourceRedemptionPeriod() {
|
||||
public void testConvertDomainBaseRedemptionPeriod() {
|
||||
persistActiveContact("jd1234");
|
||||
persistActiveContact("sh8013");
|
||||
final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_redemptionPeriod.xml");
|
||||
DomainResource domain = convertDomainInTransaction(xjcDomain);
|
||||
DomainBase domain = convertDomainInTransaction(xjcDomain);
|
||||
assertThat(domain.getGracePeriods()).hasSize(1);
|
||||
GracePeriod gracePeriod = domain.getGracePeriods().asList().get(0);
|
||||
assertThat(gracePeriod.getType()).isEqualTo(GracePeriodStatus.REDEMPTION);
|
||||
|
@ -181,11 +181,11 @@ public class XjcToDomainResourceConverterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testConvertDomainResourceRenewPeriod() {
|
||||
public void testConvertDomainBaseRenewPeriod() {
|
||||
persistActiveContact("jd1234");
|
||||
persistActiveContact("sh8013");
|
||||
final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_renewPeriod.xml");
|
||||
DomainResource domain = convertDomainInTransaction(xjcDomain);
|
||||
DomainBase domain = convertDomainInTransaction(xjcDomain);
|
||||
assertThat(domain.getGracePeriods()).hasSize(1);
|
||||
GracePeriod gracePeriod = domain.getGracePeriods().asList().get(0);
|
||||
assertThat(gracePeriod.getType()).isEqualTo(GracePeriodStatus.RENEW);
|
||||
|
@ -194,11 +194,11 @@ public class XjcToDomainResourceConverterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testConvertDomainResourcePendingDeletePeriod() {
|
||||
public void testConvertDomainBasePendingDeletePeriod() {
|
||||
persistActiveContact("jd1234");
|
||||
persistActiveContact("sh8013");
|
||||
final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_pendingDeletePeriod.xml");
|
||||
DomainResource domain = convertDomainInTransaction(xjcDomain);
|
||||
DomainBase domain = convertDomainInTransaction(xjcDomain);
|
||||
assertThat(domain.getGracePeriods()).hasSize(1);
|
||||
GracePeriod gracePeriod = domain.getGracePeriods().asList().get(0);
|
||||
assertThat(gracePeriod.getType()).isEqualTo(GracePeriodStatus.PENDING_DELETE);
|
||||
|
@ -207,7 +207,7 @@ public class XjcToDomainResourceConverterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testConvertDomainResourcePendingRestorePeriodUnsupported() {
|
||||
public void testConvertDomainBasePendingRestorePeriodUnsupported() {
|
||||
persistActiveContact("jd1234");
|
||||
persistActiveContact("sh8013");
|
||||
final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_pendingRestorePeriod.xml");
|
||||
|
@ -219,11 +219,11 @@ public class XjcToDomainResourceConverterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testConvertDomainResourceTransferPeriod() {
|
||||
public void testConvertDomainBaseTransferPeriod() {
|
||||
persistActiveContact("jd1234");
|
||||
persistActiveContact("sh8013");
|
||||
final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_transferPeriod.xml");
|
||||
DomainResource domain = convertDomainInTransaction(xjcDomain);
|
||||
DomainBase domain = convertDomainInTransaction(xjcDomain);
|
||||
assertThat(domain.getGracePeriods()).hasSize(1);
|
||||
GracePeriod gracePeriod = domain.getGracePeriods().asList().get(0);
|
||||
assertThat(gracePeriod.getType()).isEqualTo(GracePeriodStatus.TRANSFER);
|
||||
|
@ -241,27 +241,27 @@ public class XjcToDomainResourceConverterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testConvertDomainResourceEppUpdateRegistrar() {
|
||||
public void testConvertDomainBaseEppUpdateRegistrar() {
|
||||
persistActiveContact("jd1234");
|
||||
persistActiveContact("sh8013");
|
||||
final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_up_rr.xml");
|
||||
DomainResource domain = convertDomainInTransaction(xjcDomain);
|
||||
DomainBase domain = convertDomainInTransaction(xjcDomain);
|
||||
assertThat(domain.getLastEppUpdateClientId()).isEqualTo("RegistrarX");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConvertDomainResourceWithHostObjs() {
|
||||
public void testConvertDomainBaseWithHostObjs() {
|
||||
persistActiveContact("jd1234");
|
||||
persistActiveContact("sh8013");
|
||||
HostResource host1 = persistActiveHost("ns1.example.net");
|
||||
HostResource host2 = persistActiveHost("ns2.example.net");
|
||||
final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_host_objs.xml");
|
||||
DomainResource domain = convertDomainInTransaction(xjcDomain);
|
||||
DomainBase domain = convertDomainInTransaction(xjcDomain);
|
||||
assertThat(domain.getNameservers()).containsExactly(Key.create(host1), Key.create(host2));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConvertDomainResourceWithHostAttrs() {
|
||||
public void testConvertDomainBaseWithHostAttrs() {
|
||||
persistActiveContact("jd1234");
|
||||
persistActiveContact("sh8013");
|
||||
persistActiveHost("ns1.example.net");
|
||||
|
@ -273,7 +273,7 @@ public class XjcToDomainResourceConverterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testConvertDomainResourceHostNotFound() {
|
||||
public void testConvertDomainBaseHostNotFound() {
|
||||
persistActiveContact("jd1234");
|
||||
persistActiveContact("sh8013");
|
||||
persistActiveHost("ns1.example.net");
|
||||
|
@ -286,7 +286,7 @@ public class XjcToDomainResourceConverterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testConvertDomainResourceRegistrantNotFound() {
|
||||
public void testConvertDomainBaseRegistrantNotFound() {
|
||||
persistActiveContact("sh8013");
|
||||
final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment.xml");
|
||||
IllegalStateException thrown =
|
||||
|
@ -295,7 +295,7 @@ public class XjcToDomainResourceConverterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testConvertDomainResourceRegistrantMissing() {
|
||||
public void testConvertDomainBaseRegistrantMissing() {
|
||||
persistActiveContact("jd1234");
|
||||
persistActiveContact("sh8013");
|
||||
final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_registrant_missing.xml");
|
||||
|
@ -307,7 +307,7 @@ public class XjcToDomainResourceConverterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testConvertDomainResourceAdminNotFound() {
|
||||
public void testConvertDomainBaseAdminNotFound() {
|
||||
persistActiveContact("jd1234");
|
||||
final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment.xml");
|
||||
IllegalStateException thrown =
|
||||
|
@ -316,24 +316,24 @@ public class XjcToDomainResourceConverterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testConvertDomainResourceSecDnsData() {
|
||||
public void testConvertDomainBaseSecDnsData() {
|
||||
persistActiveContact("jd1234");
|
||||
persistActiveContact("sh8013");
|
||||
final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_secdns.xml");
|
||||
DomainResource domain = convertDomainInTransaction(xjcDomain);
|
||||
DomainBase domain = convertDomainInTransaction(xjcDomain);
|
||||
byte[] digest =
|
||||
base16().decode("5FA1FA1C2F70AA483FE178B765D82B272072B4E4167902C5B7F97D46C8899F44");
|
||||
assertThat(domain.getDsData()).containsExactly(DelegationSignerData.create(4609, 8, 2, digest));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConvertDomainResourceHistoryEntry() throws Exception {
|
||||
public void testConvertDomainBaseHistoryEntry() throws Exception {
|
||||
persistActiveContact("jd1234");
|
||||
persistActiveContact("sh8013");
|
||||
final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment.xml");
|
||||
// First import in a transaction, then verify in another transaction.
|
||||
// Ancestor queries don't work within the same transaction.
|
||||
DomainResource domain = persistResource(convertDomainInTransaction(xjcDomain));
|
||||
DomainBase domain = persistResource(convertDomainInTransaction(xjcDomain));
|
||||
List<HistoryEntry> historyEntries = getHistoryEntries(domain);
|
||||
assertThat(historyEntries).hasSize(1);
|
||||
HistoryEntry entry = historyEntries.get(0);
|
||||
|
@ -352,13 +352,13 @@ public class XjcToDomainResourceConverterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testConvertDomainResourceAutoRenewBillingEvent() {
|
||||
public void testConvertDomainBaseAutoRenewBillingEvent() {
|
||||
persistActiveContact("jd1234");
|
||||
persistActiveContact("sh8013");
|
||||
final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment.xml");
|
||||
// First import in a transaction, then verify in another transaction.
|
||||
// Ancestor queries don't work within the same transaction.
|
||||
DomainResource domain = persistResource(convertDomainInTransaction(xjcDomain));
|
||||
DomainBase domain = persistResource(convertDomainInTransaction(xjcDomain));
|
||||
BillingEvent.Recurring autoRenewEvent =
|
||||
ofy().load().key(domain.getAutorenewBillingEvent()).now();
|
||||
assertThat(autoRenewEvent.getReason()).isEqualTo(Reason.RENEW);
|
||||
|
@ -370,13 +370,13 @@ public class XjcToDomainResourceConverterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testConvertDomainResourceAutoRenewPollMessage() {
|
||||
public void testConvertDomainBaseAutoRenewPollMessage() {
|
||||
persistActiveContact("jd1234");
|
||||
persistActiveContact("sh8013");
|
||||
final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment.xml");
|
||||
// First import in a transaction, then verify in another transaction.
|
||||
// Ancestor queries don't work within the same transaction.
|
||||
DomainResource domain = persistResource(convertDomainInTransaction(xjcDomain));
|
||||
DomainBase domain = persistResource(convertDomainInTransaction(xjcDomain));
|
||||
PollMessage pollMessage = ofy().load().key(domain.getAutorenewPollMessage()).now();
|
||||
assertThat(pollMessage).isInstanceOf(PollMessage.Autorenew.class);
|
||||
assertThat(((PollMessage.Autorenew) pollMessage).getTargetId()).isEqualTo(xjcDomain.getRoid());
|
||||
|
@ -386,11 +386,11 @@ public class XjcToDomainResourceConverterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testConvertDomainResourcePendingTransfer() {
|
||||
public void testConvertDomainBasePendingTransfer() {
|
||||
persistActiveContact("jd1234");
|
||||
persistActiveContact("sh8013");
|
||||
final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_pending_transfer.xml");
|
||||
DomainResource domain = persistResource(convertDomainInTransaction(xjcDomain));
|
||||
DomainBase domain = persistResource(convertDomainInTransaction(xjcDomain));
|
||||
assertThat(domain.getTransferData()).isNotNull();
|
||||
assertThat(domain.getTransferData().getTransferStatus()).isEqualTo(TransferStatus.PENDING);
|
||||
assertThat(domain.getTransferData().getGainingClientId()).isEqualTo("RegistrarY");
|
||||
|
@ -402,18 +402,18 @@ public class XjcToDomainResourceConverterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testConvertDomainResourcePendingTransferRegistrationCap() {
|
||||
public void testConvertDomainBasePendingTransferRegistrationCap() {
|
||||
persistActiveContact("jd1234");
|
||||
persistActiveContact("sh8013");
|
||||
final XjcRdeDomain xjcDomain =
|
||||
loadDomainFromRdeXml("domain_fragment_pending_transfer_registration_cap.xml");
|
||||
DomainResource domain = persistResource(convertDomainInTransaction(xjcDomain));
|
||||
DomainBase domain = persistResource(convertDomainInTransaction(xjcDomain));
|
||||
assertThat(domain.getTransferData()).isNotNull();
|
||||
// This test will be imcomplete until b/36405140 is fixed to store exDate on TransferData, since
|
||||
// without that there's no way to actually test the capping of the projected registration here.
|
||||
}
|
||||
|
||||
private DomainResource convertDomainInTransaction(final XjcRdeDomain xjcDomain) {
|
||||
private DomainBase convertDomainInTransaction(final XjcRdeDomain xjcDomain) {
|
||||
return ofy()
|
||||
.transact(
|
||||
() -> {
|
||||
|
@ -423,7 +423,7 @@ public class XjcToDomainResourceConverterTest {
|
|||
PollMessage.Autorenew autorenewPollMessage =
|
||||
createAutoRenewPollMessageForDomainImport(xjcDomain, historyEntry);
|
||||
ofy().save().entities(historyEntry, autorenewBillingEvent, autorenewPollMessage);
|
||||
return XjcToDomainResourceConverter.convertDomain(
|
||||
return XjcToDomainBaseConverter.convertDomain(
|
||||
xjcDomain, autorenewBillingEvent, autorenewPollMessage, stringGenerator);
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue