Change DomainApplication to store period instead of year

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137426843
This commit is contained in:
mountford 2016-10-27 12:32:39 -07:00 committed by Ben McIlwain
parent 60cb1b4dfb
commit 8b068250d6
6 changed files with 16 additions and 12 deletions

View file

@ -219,7 +219,7 @@ public final class DomainApplicationCreateFlow extends LoggedInFlow implements T
.setLaunchNotice(launchCreate == null ? null : launchCreate.getNotice())
.setIdnTableName(idnTableName)
.setPhase(launchCreate.getPhase())
.setYears(command.getPeriod().getValue())
.setPeriod(command.getPeriod())
.setApplicationStatus(ApplicationStatus.VALIDATED)
.addStatusValue(StatusValue.PENDING_CREATE)
.setDsData(secDnsCreate == null ? null : secDnsCreate.getDsData())

View file

@ -69,9 +69,9 @@ public class DomainApplication extends DomainBase {
@XmlTransient
LaunchPhase phase;
/** The requested number of years of registration. */
/** The requested registration period. */
@XmlTransient
int years;
Period period;
/** The current status of this application. */
@XmlTransient
@ -98,8 +98,8 @@ public class DomainApplication extends DomainBase {
return phase;
}
public int getYears() {
return years;
public Period getPeriod() {
return period;
}
public ApplicationStatus getApplicationStatus() {
@ -159,8 +159,8 @@ public class DomainApplication extends DomainBase {
return this;
}
public Builder setYears(int years) {
getInstance().years = years;
public Builder setPeriod(Period period) {
getInstance().period = period;
return this;
}

View file

@ -220,7 +220,7 @@ public class DomainApplicationCreateFlowTest
assertAboutApplications().that(getLast(applications))
.hasFullyQualifiedDomainName(getUniqueIdFromCommand()).and()
.hasNumEncodedSignedMarks(sunriseApplication ? 1 : 0).and()
.hasYears(years).and()
.hasPeriodYears(years).and()
.hasOnlyOneHistoryEntryWhich()
.hasType(HistoryEntry.Type.DOMAIN_APPLICATION_CREATE).and()
.hasPeriodYears(years);

View file

@ -60,7 +60,7 @@ public class DomainApplicationTest extends EntityTestCase {
@Before
public void setUp() throws Exception {
createTld("com");
// Set up a new persisted domain entity.
// Set up a new persisted domain application entity.
domainApplication = cloneAndSetAutoTimestamps(
new DomainApplication.Builder()
.setFullyQualifiedDomainName("example.com")
@ -102,6 +102,7 @@ public class DomainApplicationTest extends EntityTestCase {
.build())
.setCreationTrid(Trid.create("client creation trid"))
.setPhase(LaunchPhase.LANDRUSH)
.setPeriod(Period.create(5, Period.Unit.YEARS))
.setEncodedSignedMarks(ImmutableList.of(EncodedSignedMark.create("base64", "abcdefg=")))
.setApplicationStatus(ApplicationStatus.ALLOCATED)
.setAuctionPrice(Money.of(USD, 11))

View file

@ -203,12 +203,12 @@ class google.registry.model.domain.DomainApplication {
google.registry.model.CreateAutoTimestamp creationTime;
google.registry.model.UpdateAutoTimestamp updateTimestamp;
google.registry.model.domain.DomainAuthInfo authInfo;
google.registry.model.domain.Period period;
google.registry.model.domain.launch.ApplicationStatus applicationStatus;
google.registry.model.domain.launch.LaunchNotice launchNotice;
google.registry.model.domain.launch.LaunchPhase phase;
google.registry.model.eppcommon.Trid creationTrid;
google.registry.model.transfer.TransferData transferData;
int years;
java.lang.String creationClientId;
java.lang.String currentSponsorClientId;
java.lang.String fullyQualifiedDomainName;

View file

@ -22,6 +22,7 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.truth.AbstractVerb.DelegatedVerb;
import com.google.common.truth.FailureStrategy;
import google.registry.model.domain.DomainApplication;
import google.registry.model.domain.Period;
import google.registry.model.domain.launch.ApplicationStatus;
import google.registry.model.smd.EncodedSignedMark;
import google.registry.testing.TruthChainer.And;
@ -31,8 +32,10 @@ import java.util.Objects;
public final class DomainApplicationSubject
extends AbstractDomainBaseSubject<DomainApplication, DomainApplicationSubject> {
public And<DomainApplicationSubject> hasYears(int years) {
assertThat(actual().getYears()).isEqualTo(years);
public And<DomainApplicationSubject> hasPeriodYears(int years) {
assertThat(actual().getPeriod()).isNotNull();
assertThat(actual().getPeriod().getUnit()).isEqualTo(Period.Unit.YEARS);
assertThat(actual().getPeriod().getValue()).isEqualTo(years);
return andChainer();
}