Unnest transactionFieldAmount from DomainTransactionRecord

After working further with domain deletes, I realized we'll need to record multiple reportingTimes under a single historyEntry when issuing a -1 counter to cancel grace-period adds. Since the TLD would be the only shared component within a record, we'll just duplicate it across all records to save an unnecessary layer of hierarchy.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166261413
This commit is contained in:
larryruili
2017-08-29 17:05:15 -04:00
committed by Ben McIlwain
parent f9a2415954
commit 97581e519d
12 changed files with 175 additions and 188 deletions
@@ -16,7 +16,6 @@ package google.registry.model.reporting;
import static com.google.common.truth.Truth.assertThat;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.model.reporting.DomainTransactionRecord.TransactionFieldAmount.TransactionReportField.NET_ADDS_1_YR;
import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.newDomainResource;
import static google.registry.testing.DatastoreHelper.persistResource;
@@ -26,7 +25,7 @@ import com.google.common.collect.ImmutableSet;
import google.registry.model.EntityTestCase;
import google.registry.model.domain.Period;
import google.registry.model.eppcommon.Trid;
import google.registry.model.reporting.DomainTransactionRecord.TransactionFieldAmount;
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
import org.junit.Before;
import org.junit.Test;
@@ -42,8 +41,8 @@ public class HistoryEntryTest extends EntityTestCase {
new DomainTransactionRecord.Builder()
.setTld("foobar")
.setReportingTime(clock.nowUtc())
.setTransactionFieldAmounts(
ImmutableSet.of(TransactionFieldAmount.create(NET_ADDS_1_YR, 1)))
.setReportField(TransactionReportField.NET_ADDS_1_YR)
.setReportAmount(1)
.build();
// Set up a new persisted HistoryEntry entity.
historyEntry =
@@ -59,7 +58,7 @@ public class HistoryEntryTest extends EntityTestCase {
.setBySuperuser(false)
.setReason("reason")
.setRequestedByRegistrar(false)
.setDomainTransactionRecord(transactionRecord)
.setDomainTransactionRecords(ImmutableSet.of(transactionRecord))
.build();
persistResource(historyEntry);
}