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:
mcilwain 2019-01-25 10:53:10 -08:00 committed by Ben McIlwain
parent 97c2049669
commit e2528875b2
166 changed files with 1525 additions and 1666 deletions

View file

@ -17,7 +17,7 @@ package google.registry.tools.server;
import static com.google.appengine.tools.cloudstorage.GcsServiceFactory.createGcsService;
import static com.google.common.truth.Truth.assertThat;
import static google.registry.testing.DatastoreHelper.createTlds;
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.persistActiveContact;
import static google.registry.testing.DatastoreHelper.persistActiveDomain;
@ -72,43 +72,43 @@ public class GenerateZoneFilesActionTest extends MapreduceTestCase<GenerateZoneF
// This domain will have glue records, because it has a subordinate host which is its own
// nameserver. None of the other domains should have glue records, because their nameservers are
// subordinate to different domains.
persistResource(newDomainResource("bar.tld").asBuilder()
persistResource(newDomainBase("bar.tld").asBuilder()
.addNameservers(nameservers)
.addSubordinateHost("ns.bar.tld")
.build());
persistResource(newDomainResource("foo.tld").asBuilder()
persistResource(newDomainBase("foo.tld").asBuilder()
.addSubordinateHost("ns.foo.tld")
.build());
persistResource(newDomainResource("ns-and-ds.tld").asBuilder()
persistResource(newDomainBase("ns-and-ds.tld").asBuilder()
.addNameservers(nameservers)
.setDsData(ImmutableSet.of(DelegationSignerData.create(1, 2, 3, new byte[] {0, 1, 2})))
.build());
persistResource(newDomainResource("ns-only.tld").asBuilder()
persistResource(newDomainBase("ns-only.tld").asBuilder()
.addNameservers(nameservers)
.build());
persistResource(newDomainResource("ns-only-client-hold.tld").asBuilder()
persistResource(newDomainBase("ns-only-client-hold.tld").asBuilder()
.addNameservers(nameservers)
.setStatusValues(ImmutableSet.of(StatusValue.CLIENT_HOLD))
.build());
persistResource(newDomainResource("ns-only-pending-delete.tld").asBuilder()
persistResource(newDomainBase("ns-only-pending-delete.tld").asBuilder()
.addNameservers(nameservers)
.setStatusValues(ImmutableSet.of(StatusValue.PENDING_DELETE))
.build());
persistResource(newDomainResource("ns-only-server-hold.tld").asBuilder()
persistResource(newDomainBase("ns-only-server-hold.tld").asBuilder()
.addNameservers(nameservers)
.setStatusValues(ImmutableSet.of(StatusValue.SERVER_HOLD))
.build());
// These should be ignored; contacts aren't in DNS, hosts need to be from the same tld and have
// IP addresses, and domains need to be from the same TLD and have hosts (even in the case where
// domains contain DS data).
persistResource(newDomainResource("ds-only.tld").asBuilder()
persistResource(newDomainBase("ds-only.tld").asBuilder()
.setDsData(ImmutableSet.of(DelegationSignerData.create(1, 2, 3, new byte[] {0, 1, 2})))
.build());
persistActiveContact("ignored_contact");
persistActiveHost("ignored.host.tld"); // No ips.
persistActiveDomain("ignored_domain.tld"); // No hosts or DS data.
persistResource(newHostResource("ignored.foo.com").asBuilder().addInetAddresses(ips).build());
persistResource(newDomainResource("ignored.com")
persistResource(newDomainBase("ignored.com")
.asBuilder()
.addNameservers(nameservers)
.setDsData(ImmutableSet.of(DelegationSignerData.create(1, 2, 3, new byte[] {0, 1, 2})))