diff --git a/java/com/google/domain/registry/env/common/default/WEB-INF/datastore-indexes.xml b/java/com/google/domain/registry/env/common/default/WEB-INF/datastore-indexes.xml index 7fcad1d41..3f75c1209 100644 --- a/java/com/google/domain/registry/env/common/default/WEB-INF/datastore-indexes.xml +++ b/java/com/google/domain/registry/env/common/default/WEB-INF/datastore-indexes.xml @@ -4,55 +4,28 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -63,43 +36,22 @@ - - - - - - - - - - - - - - - - - - - - - @@ -128,9 +80,4 @@ - - - - - diff --git a/java/com/google/domain/registry/model/EppResource.java b/java/com/google/domain/registry/model/EppResource.java index 60aca3d58..79580dc4c 100644 --- a/java/com/google/domain/registry/model/EppResource.java +++ b/java/com/google/domain/registry/model/EppResource.java @@ -22,7 +22,6 @@ import static com.google.domain.registry.util.DateTimeUtils.END_OF_TIME; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Optional; -import com.google.common.collect.FluentIterable; import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSortedMap; import com.google.domain.registry.model.eppcommon.StatusValue; @@ -31,11 +30,8 @@ import com.google.domain.registry.model.ofy.CommitLogManifest; import com.google.domain.registry.model.transfer.TransferData; import com.googlecode.objectify.Ref; -import com.googlecode.objectify.annotation.Embed; import com.googlecode.objectify.annotation.Id; -import com.googlecode.objectify.annotation.IgnoreSave; import com.googlecode.objectify.annotation.Index; -import com.googlecode.objectify.condition.IfNull; import org.joda.time.DateTime; @@ -57,13 +53,6 @@ public abstract class EppResource extends BackupGroupRoot implements Buildable, @XmlElement(name = "roid") String repoId; - /** The shared fields for this resource. */ - // TODO(b/19035583): Remove this after touching all resources and waiting long enough to be sure - // we don't need to reload old commit logs. - @XmlTransient - @Deprecated - SharedFields sharedFields = new SharedFields(); - /** The ID of the registrar that is currently sponsoring this resource. */ @Index @XmlElement(name = "clID") @@ -209,69 +198,6 @@ public abstract class EppResource extends BackupGroupRoot implements Buildable, /** EppResources that are loaded via foreign keys should implement this marker interface. */ public interface ForeignKeyedEppResource {} - /** Common shared fields for {@link EppResource} types. */ - //TODO(b/19035583): Delete this class. - @Embed - public static class SharedFields extends ImmutableObject { - - /** The id of the registry client that is currently sponsoring this resource. */ - @Index - String currentSponsorClientId; - - /** The ID of the registry client that created this resource. */ - String creationRegistryClientId; - - /** - * The ID of the last registry client to update this resource. This does not refer to the last - * delta made on this object, which might include transfer flows or out-of-band edits; a - * resource must literally have had an EPP {@literal } called on it for this field to be - * set. Can be null if the resource has never had {@literal } called on it. - */ - @IgnoreSave(IfNull.class) - String lastUpdateRegistryClientId; - - /** The time when this resource was created. */ - @XmlTransient - CreateAutoTimestamp creationTime = CreateAutoTimestamp.create(null); - - /** - * The time when this resource was or will be deleted. - *

- * For deleted resources, this is in the past. - * For pending-delete resources, this is in the near future. - * For active resources, this is {@code END_OF_TIME}. - *

- * This scheme allows for setting pending deletes in the future and having them magically drop - * out of the index at that time, as long as we query for resources whose delete time is - * before now. - */ - @Index - DateTime deletionTime; - - /** - * The time that this resource was last updated. Can be null if the resource has never had - * {@literal } called on it. - */ - @IgnoreSave(IfNull.class) - DateTime lastUpdateTime; - - /** - * The time that this resource was last transferred. Can be null if the resource has never been - * transferred. - */ - @IgnoreSave(IfNull.class) - DateTime lastTransferTime; - - /** Legacy field for status values associated with this resource. */ - // TODO(b/25442343): Remove this. - @XmlTransient - Set statusValues; - - /** Data about any pending or past transfers on this contact. */ - @IgnoreSave(IfNull.class) - TransferData transferData; - } - /** Abstract builder for {@link EppResource} types. */ public abstract static class Builder> extends GenericBuilder { @@ -282,76 +208,54 @@ public abstract class EppResource extends BackupGroupRoot implements Buildable, /** Create a {@link Builder} wrapping the given instance. */ protected Builder(T instance) { super(instance); - // Clone the SharedFields since the setters on this builder mutate its fields directly. - instance.sharedFields = ImmutableObject.clone(instance.sharedFields); } /** Set the time this resource was created. Should only be used in tests. */ @VisibleForTesting public B setCreationTimeForTest(DateTime creationTime) { getInstance().creationTime = CreateAutoTimestamp.create(creationTime); - // TODO(b/19035583): Stop setting the legacy field. - getInstance().sharedFields.creationTime = CreateAutoTimestamp.create(creationTime); return thisCastToDerived(); } /** Set the time after which this resource should be considered deleted. */ public B setDeletionTime(DateTime deletionTime) { getInstance().deletionTime = deletionTime; - // TODO(b/19035583): Stop setting the legacy field. - getInstance().sharedFields.deletionTime = deletionTime; return thisCastToDerived(); } /** Set the current sponsoring registrar. */ public B setCurrentSponsorClientId(String currentSponsorClientId) { getInstance().currentSponsorClientId = currentSponsorClientId; - // TODO(b/19035583): Stop setting the legacy field. - getInstance().sharedFields.currentSponsorClientId = currentSponsorClientId; return thisCastToDerived(); } /** Set the registrar that created this resource. */ public B setCreationClientId(String creationClientId) { getInstance().creationClientId = creationClientId; - // TODO(b/19035583): Stop setting the legacy field. - getInstance().sharedFields.creationRegistryClientId = creationClientId; return thisCastToDerived(); } /** Set the time when a {@literal } was performed on this resource. */ public B setLastEppUpdateTime(DateTime lastEppUpdateTime) { getInstance().lastEppUpdateTime = lastEppUpdateTime; - // TODO(b/19035583): Stop setting the legacy field. - getInstance().sharedFields.lastUpdateTime = lastEppUpdateTime; return thisCastToDerived(); } /** Set the registrar who last performed a {@literal } on this resource. */ public B setLastEppUpdateClientId(String lastEppUpdateClientId) { getInstance().lastEppUpdateClientId = lastEppUpdateClientId; - // TODO(b/19035583): Stop setting the legacy field. - getInstance().sharedFields.lastUpdateRegistryClientId = lastEppUpdateClientId; return thisCastToDerived(); } /** Set the time when this resource was transferred. */ public B setLastTransferTime(DateTime lastTransferTime) { getInstance().lastTransferTime = lastTransferTime; - // TODO(b/19035583): Stop setting the legacy field. - getInstance().sharedFields.lastTransferTime = lastTransferTime; return thisCastToDerived(); } /** Set this resource's status values. */ public B setStatusValues(ImmutableSet statusValues) { getInstance().status = statusValues; - // TODO(b/25442343): Stop setting the legacy field. - getInstance().sharedFields.statusValues = statusValues == null - ? null - : FluentIterable.from(statusValues) - .transform(StatusValue.LEGACY_CONVERTER) - .toSet(); return thisCastToDerived(); } @@ -380,8 +284,6 @@ public abstract class EppResource extends BackupGroupRoot implements Buildable, /** Set this resource's transfer data. */ public B setTransferData(TransferData transferData) { getInstance().transferData = transferData; - // TODO(b/19035583): Stop setting the legacy field. - getInstance().sharedFields.transferData = transferData; return thisCastToDerived(); } diff --git a/javatests/com/google/domain/registry/model/contact/ContactResourceTest.java b/javatests/com/google/domain/registry/model/contact/ContactResourceTest.java index c223164cf..d5e2d0752 100644 --- a/javatests/com/google/domain/registry/model/contact/ContactResourceTest.java +++ b/javatests/com/google/domain/registry/model/contact/ContactResourceTest.java @@ -24,8 +24,6 @@ import static com.google.domain.registry.testing.DatastoreHelper.persistResource import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.domain.registry.model.EntityTestCase; -import com.google.domain.registry.model.EppResource; -import com.google.domain.registry.model.EppResource.SharedFields; import com.google.domain.registry.model.billing.BillingEvent; import com.google.domain.registry.model.contact.Disclose.PostalInfoChoice; import com.google.domain.registry.model.contact.PostalInfo.Type; @@ -44,8 +42,6 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; -import java.lang.reflect.Field; - /** Unit tests for {@link ContactResource}. */ public class ContactResourceTest extends EntityTestCase { @@ -134,9 +130,7 @@ public class ContactResourceTest extends EntityTestCase { verifyIndexing( contactResource, "deletionTime", - "currentSponsorClientId", - "sharedFields.deletionTime", - "sharedFields.currentSponsorClientId"); + "currentSponsorClientId"); } @Test @@ -173,12 +167,7 @@ public class ContactResourceTest extends EntityTestCase { ContactResource withNull = new ContactResource.Builder().setTransferData(null).build(); ContactResource withEmpty = withNull.asBuilder().setTransferData(TransferData.EMPTY).build(); assertThat(withNull).isEqualTo(withEmpty); - // We don't have package access to SharedFields so we need to use reflection to check for null. - Field sharedFieldsField = EppResource.class.getDeclaredField("sharedFields"); - sharedFieldsField.setAccessible(true); - Field transferDataField = SharedFields.class.getDeclaredField("transferData"); - transferDataField.setAccessible(true); - assertThat(transferDataField.get(sharedFieldsField.get(withEmpty))).isNull(); + assertThat(withEmpty.hasTransferData()).isFalse(); } @Test diff --git a/javatests/com/google/domain/registry/model/domain/DomainApplicationTest.java b/javatests/com/google/domain/registry/model/domain/DomainApplicationTest.java index ee016d24e..d40ac7e3f 100644 --- a/javatests/com/google/domain/registry/model/domain/DomainApplicationTest.java +++ b/javatests/com/google/domain/registry/model/domain/DomainApplicationTest.java @@ -28,8 +28,6 @@ import static org.joda.money.CurrencyUnit.USD; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.domain.registry.model.EntityTestCase; -import com.google.domain.registry.model.EppResource; -import com.google.domain.registry.model.EppResource.SharedFields; import com.google.domain.registry.model.billing.BillingEvent; import com.google.domain.registry.model.domain.launch.ApplicationStatus; import com.google.domain.registry.model.domain.launch.LaunchNotice; @@ -52,8 +50,6 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; -import java.lang.reflect.Field; - /** Unit tests for {@link DomainApplication}. */ public class DomainApplicationTest extends EntityTestCase { @@ -131,8 +127,6 @@ public class DomainApplicationTest extends EntityTestCase { "nameservers.linked", "deletionTime", "currentSponsorClientId", - "sharedFields.deletionTime", - "sharedFields.currentSponsorClientId", "tld"); } @@ -186,11 +180,6 @@ public class DomainApplicationTest extends EntityTestCase { DomainApplication withNull = emptyBuilder().setTransferData(null).build(); DomainApplication withEmpty = withNull.asBuilder().setTransferData(TransferData.EMPTY).build(); assertThat(withNull).isEqualTo(withEmpty); - // We don't have package access to SharedFields so we need to use reflection to check for null. - Field sharedFieldsField = EppResource.class.getDeclaredField("sharedFields"); - sharedFieldsField.setAccessible(true); - Field transferDataField = SharedFields.class.getDeclaredField("transferData"); - transferDataField.setAccessible(true); - assertThat(transferDataField.get(sharedFieldsField.get(withEmpty))).isNull(); + assertThat(withEmpty.hasTransferData()).isFalse(); } } diff --git a/javatests/com/google/domain/registry/model/domain/DomainResourceTest.java b/javatests/com/google/domain/registry/model/domain/DomainResourceTest.java index 2e7f582ce..ff0b68227 100644 --- a/javatests/com/google/domain/registry/model/domain/DomainResourceTest.java +++ b/javatests/com/google/domain/registry/model/domain/DomainResourceTest.java @@ -31,8 +31,6 @@ import com.google.common.collect.ImmutableSortedMap; import com.google.common.collect.Iterables; import com.google.common.collect.Ordering; import com.google.domain.registry.model.EntityTestCase; -import com.google.domain.registry.model.EppResource; -import com.google.domain.registry.model.EppResource.SharedFields; import com.google.domain.registry.model.billing.BillingEvent; import com.google.domain.registry.model.billing.BillingEvent.Reason; import com.google.domain.registry.model.contact.ContactResource; @@ -60,7 +58,6 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; -import java.lang.reflect.Field; import java.util.List; /** Unit tests for {@link DomainResource}. */ @@ -165,8 +162,6 @@ public class DomainResourceTest extends EntityTestCase { "nameservers.linked", "currentSponsorClientId", "deletionTime", - "sharedFields.currentSponsorClientId", - "sharedFields.deletionTime", "tld"); } @@ -221,12 +216,7 @@ public class DomainResourceTest extends EntityTestCase { newDomainResource("example.com").asBuilder().setTransferData(null).build(); DomainResource withEmpty = withNull.asBuilder().setTransferData(TransferData.EMPTY).build(); assertThat(withNull).isEqualTo(withEmpty); - // We don't have package access to SharedFields so we need to use reflection to check for null. - Field sharedFieldsField = EppResource.class.getDeclaredField("sharedFields"); - sharedFieldsField.setAccessible(true); - Field transferDataField = SharedFields.class.getDeclaredField("transferData"); - transferDataField.setAccessible(true); - assertThat(transferDataField.get(sharedFieldsField.get(withEmpty))).isNull(); + assertThat(withEmpty.hasTransferData()).isFalse(); } @Test diff --git a/javatests/com/google/domain/registry/model/host/HostResourceTest.java b/javatests/com/google/domain/registry/model/host/HostResourceTest.java index d35bc7321..0d404ba17 100644 --- a/javatests/com/google/domain/registry/model/host/HostResourceTest.java +++ b/javatests/com/google/domain/registry/model/host/HostResourceTest.java @@ -24,8 +24,6 @@ import static com.google.domain.registry.testing.HostResourceSubject.assertAbout import com.google.common.collect.ImmutableSet; import com.google.domain.registry.model.EntityTestCase; -import com.google.domain.registry.model.EppResource; -import com.google.domain.registry.model.EppResource.SharedFields; import com.google.domain.registry.model.billing.BillingEvent; import com.google.domain.registry.model.domain.DomainResource; import com.google.domain.registry.model.eppcommon.StatusValue; @@ -45,7 +43,6 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; -import java.lang.reflect.Field; import java.net.InetAddress; import javax.annotation.Nullable; @@ -108,12 +105,10 @@ public class HostResourceTest extends EntityTestCase { verifyIndexing( persistResource(hostResource.cloneProjectedAtTime(clock.nowUtc())), "deletionTime", - "sharedFields.deletionTime", "fullyQualifiedHostName", "inetAddresses", "superordinateDomain", - "currentSponsorClientId", - "sharedFields.currentSponsorClientId"); + "currentSponsorClientId"); } @Test @@ -158,12 +153,7 @@ public class HostResourceTest extends EntityTestCase { HostResource withNull = new HostResource.Builder().setTransferData(null).build(); HostResource withEmpty = withNull.asBuilder().setTransferData(TransferData.EMPTY).build(); assertThat(withNull).isEqualTo(withEmpty); - // We don't have package access to SharedFields so we need to use reflection to check for null. - Field sharedFieldsField = EppResource.class.getDeclaredField("sharedFields"); - sharedFieldsField.setAccessible(true); - Field transferDataField = SharedFields.class.getDeclaredField("transferData"); - transferDataField.setAccessible(true); - assertThat(transferDataField.get(sharedFieldsField.get(withEmpty))).isNull(); + assertThat(withEmpty.hasTransferData()).isFalse(); } @Test diff --git a/javatests/com/google/domain/registry/model/schema.txt b/javatests/com/google/domain/registry/model/schema.txt index 7be58ce9b..a8c32d76d 100644 --- a/javatests/com/google/domain/registry/model/schema.txt +++ b/javatests/com/google/domain/registry/model/schema.txt @@ -5,17 +5,6 @@ enum com.google.common.collect.BoundType { class com.google.domain.registry.model.CreateAutoTimestamp { org.joda.time.DateTime timestamp; } -class com.google.domain.registry.model.EppResource$SharedFields { - com.google.domain.registry.model.CreateAutoTimestamp creationTime; - com.google.domain.registry.model.transfer.TransferData transferData; - java.lang.String creationRegistryClientId; - java.lang.String currentSponsorClientId; - java.lang.String lastUpdateRegistryClientId; - java.util.Set statusValues; - org.joda.time.DateTime deletionTime; - org.joda.time.DateTime lastTransferTime; - org.joda.time.DateTime lastUpdateTime; -} class com.google.domain.registry.model.UpdateAutoTimestamp { org.joda.time.DateTime timestamp; } @@ -146,7 +135,6 @@ class com.google.domain.registry.model.contact.ContactResource { @Id java.lang.String repoId; com.google.common.collect.ImmutableSortedMap> revisions; com.google.domain.registry.model.CreateAutoTimestamp creationTime; - com.google.domain.registry.model.EppResource$SharedFields sharedFields; com.google.domain.registry.model.UpdateAutoTimestamp updateTimestamp; com.google.domain.registry.model.contact.ContactAuthInfo authInfo; com.google.domain.registry.model.contact.ContactPhoneNumber fax; @@ -201,7 +189,6 @@ class com.google.domain.registry.model.domain.DomainApplication { @Id java.lang.String repoId; com.google.common.collect.ImmutableSortedMap> revisions; com.google.domain.registry.model.CreateAutoTimestamp creationTime; - com.google.domain.registry.model.EppResource$SharedFields sharedFields; com.google.domain.registry.model.UpdateAutoTimestamp updateTimestamp; com.google.domain.registry.model.domain.DomainAuthInfo authInfo; com.google.domain.registry.model.domain.launch.ApplicationStatus applicationStatus; @@ -232,7 +219,6 @@ class com.google.domain.registry.model.domain.DomainBase { @Id java.lang.String repoId; com.google.common.collect.ImmutableSortedMap> revisions; com.google.domain.registry.model.CreateAutoTimestamp creationTime; - com.google.domain.registry.model.EppResource$SharedFields sharedFields; com.google.domain.registry.model.UpdateAutoTimestamp updateTimestamp; com.google.domain.registry.model.domain.DomainAuthInfo authInfo; com.google.domain.registry.model.domain.launch.LaunchNotice launchNotice; @@ -255,7 +241,6 @@ class com.google.domain.registry.model.domain.DomainResource { @Id java.lang.String repoId; com.google.common.collect.ImmutableSortedMap> revisions; com.google.domain.registry.model.CreateAutoTimestamp creationTime; - com.google.domain.registry.model.EppResource$SharedFields sharedFields; com.google.domain.registry.model.UpdateAutoTimestamp updateTimestamp; com.google.domain.registry.model.domain.DomainAuthInfo authInfo; com.google.domain.registry.model.domain.launch.LaunchNotice launchNotice; @@ -370,9 +355,6 @@ enum com.google.domain.registry.model.eppcommon.StatusValue { SERVER_TRANSFER_PROHIBITED; SERVER_UPDATE_PROHIBITED; } -class com.google.domain.registry.model.eppcommon.StatusValue$LegacyStatusValue { - java.lang.String xmlStatusValue; -} class com.google.domain.registry.model.eppcommon.Trid { java.lang.String clientTransactionId; java.lang.String serverTransactionId; @@ -387,7 +369,6 @@ class com.google.domain.registry.model.host.HostResource { @Id java.lang.String repoId; com.google.common.collect.ImmutableSortedMap> revisions; com.google.domain.registry.model.CreateAutoTimestamp creationTime; - com.google.domain.registry.model.EppResource$SharedFields sharedFields; com.google.domain.registry.model.UpdateAutoTimestamp updateTimestamp; com.google.domain.registry.model.transfer.TransferData transferData; com.googlecode.objectify.Ref superordinateDomain; diff --git a/javatests/com/google/domain/registry/tools/MutatingCommandTest.java b/javatests/com/google/domain/registry/tools/MutatingCommandTest.java index e73315fa9..0e2c37388 100644 --- a/javatests/com/google/domain/registry/tools/MutatingCommandTest.java +++ b/javatests/com/google/domain/registry/tools/MutatingCommandTest.java @@ -108,11 +108,9 @@ public class MutatingCommandTest { String changes = command.prompt(); assertThat(changes).isEqualTo( "Update HostResource@2-ROID\n" - + "sharedFields.lastUpdateTime -> [null, 2014-09-09T09:09:09.000Z]\n" + "lastEppUpdateTime -> [null, 2014-09-09T09:09:09.000Z]\n" + "\n" + "Update HostResource@3-ROID\n" - + "sharedFields.currentSponsorClientId -> [TheRegistrar, Registrar2]\n" + "currentSponsorClientId -> [TheRegistrar, Registrar2]\n" + "\n" + "Update Registrar@Registrar1\n" @@ -240,7 +238,6 @@ public class MutatingCommandTest { + host1 + "\n" + "\n" + "Update HostResource@3-ROID\n" - + "sharedFields.currentSponsorClientId -> [TheRegistrar, Registrar2]\n" + "currentSponsorClientId -> [TheRegistrar, Registrar2]\n" + "\n" + "Delete Registrar@Registrar1\n" @@ -281,7 +278,6 @@ public class MutatingCommandTest { + host1 + "\n" + "\n" + "Update HostResource@3-ROID\n" - + "sharedFields.currentSponsorClientId -> [TheRegistrar, Registrar2]\n" + "currentSponsorClientId -> [TheRegistrar, Registrar2]\n" + "\n" + "Delete Registrar@Registrar1\n"