mirror of
https://github.com/google/nomulus.git
synced 2025-04-30 12:07:51 +02:00
Remove grace period ID @OnLoads now that migration is complete (#1016)
* Remove grace period ID @OnLoads now that migration is complete I verified in BigQuery that all grace period IDs are now allocated (as expected given that the re-save all EPP resource mapreduce has been run several times since this migration started last year). The query I used for verification is: SELECT fullyQualifiedDomainName, gp, ot FROM `domain-registry.latest_datastore_export.DomainBase` JOIN UNNEST(gracePeriods.billingEventRecurring) AS gp JOIN UNNEST(gracePeriods.billingEventOneTime) AS ot WHERE gp.id IS NULL or ot.id IS NULL BUG=169873747
This commit is contained in:
parent
fe98741275
commit
087dcb071a
3 changed files with 0 additions and 26 deletions
|
@ -321,9 +321,6 @@ public class DomainContent extends EppResource
|
||||||
nullToEmptyImmutableCopy(gracePeriods).stream()
|
nullToEmptyImmutableCopy(gracePeriods).stream()
|
||||||
.map(gracePeriod -> gracePeriod.cloneAfterOfyLoad(getRepoId()))
|
.map(gracePeriod -> gracePeriod.cloneAfterOfyLoad(getRepoId()))
|
||||||
.collect(toImmutableSet());
|
.collect(toImmutableSet());
|
||||||
// TODO(b/169873747): Remove this method after explicitly re-saving all domain entities.
|
|
||||||
// See also: GradePeriod.onLoad.
|
|
||||||
gracePeriods.forEach(GracePeriod::onLoad);
|
|
||||||
|
|
||||||
// Restore history record ids.
|
// Restore history record ids.
|
||||||
autorenewPollMessageHistoryId = getHistoryId(autorenewPollMessage);
|
autorenewPollMessageHistoryId = getHistoryId(autorenewPollMessage);
|
||||||
|
|
|
@ -54,17 +54,6 @@ public class GracePeriod extends GracePeriodBase implements DatastoreAndSqlEntit
|
||||||
return super.getGracePeriodId();
|
return super.getGracePeriodId();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(b/169873747): Remove this method after explicitly re-saving all domain entities.
|
|
||||||
// This method is invoked from DomainContent.load(): Objectify's @OnLoad annotation
|
|
||||||
// apparently does not work on embedded objects inside an entity.
|
|
||||||
// Changing signature to void onLoad(@AlsoLoad("gracePeriodId") Long gracePeriodId)
|
|
||||||
// would not work. Method is not called if gracePeriodId is null.
|
|
||||||
void onLoad() {
|
|
||||||
if (gracePeriodId == null) {
|
|
||||||
gracePeriodId = ObjectifyService.allocateId();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static GracePeriod createInternal(
|
private static GracePeriod createInternal(
|
||||||
GracePeriodStatus type,
|
GracePeriodStatus type,
|
||||||
String domainRepoId,
|
String domainRepoId,
|
||||||
|
|
|
@ -19,8 +19,6 @@ import static com.google.common.collect.Iterables.getOnlyElement;
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static com.google.common.truth.Truth8.assertThat;
|
import static com.google.common.truth.Truth8.assertThat;
|
||||||
import static google.registry.model.EppResourceUtils.loadByForeignKey;
|
import static google.registry.model.EppResourceUtils.loadByForeignKey;
|
||||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
|
||||||
import static google.registry.persistence.transaction.TransactionManagerFactory.ofyTm;
|
|
||||||
import static google.registry.testing.DatabaseHelper.cloneAndSetAutoTimestamps;
|
import static google.registry.testing.DatabaseHelper.cloneAndSetAutoTimestamps;
|
||||||
import static google.registry.testing.DatabaseHelper.createTld;
|
import static google.registry.testing.DatabaseHelper.createTld;
|
||||||
import static google.registry.testing.DatabaseHelper.newDomainBase;
|
import static google.registry.testing.DatabaseHelper.newDomainBase;
|
||||||
|
@ -32,7 +30,6 @@ import static org.joda.money.CurrencyUnit.USD;
|
||||||
import static org.joda.time.DateTimeZone.UTC;
|
import static org.joda.time.DateTimeZone.UTC;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
|
|
||||||
import com.google.appengine.api.datastore.Entity;
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.ImmutableSortedMap;
|
import com.google.common.collect.ImmutableSortedMap;
|
||||||
|
@ -167,15 +164,6 @@ public class DomainBaseTest extends EntityTestCase {
|
||||||
.build()));
|
.build()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
void testGracePeriod_nullIdFromOfy() {
|
|
||||||
Entity entity = ofyTm().transact(() -> ofy().save().toEntity(domain));
|
|
||||||
entity.setUnindexedProperty("gracePeriods.gracePeriodId", null);
|
|
||||||
DomainBase domainFromEntity = ofyTm().transact(() -> ofy().load().fromEntity(entity));
|
|
||||||
GracePeriod gracePeriod = domainFromEntity.getGracePeriods().iterator().next();
|
|
||||||
assertThat(gracePeriod.gracePeriodId).isNotNull();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testPersistence() {
|
void testPersistence() {
|
||||||
// Note that this only verifies that the value stored under the foreign key is the same as that
|
// Note that this only verifies that the value stored under the foreign key is the same as that
|
||||||
|
|
Loading…
Add table
Reference in a new issue