mirror of
https://github.com/google/nomulus
synced 2026-08-02 05:16:08 +00:00
Make code change for AllocationToken schema change (#1581)
* Make code change for AllocationToken schema change
This commit is contained in:
@@ -34,6 +34,7 @@ import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSortedMap;
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.model.EntityTestCase;
|
||||
import google.registry.model.billing.BillingEvent.RenewalPriceBehavior;
|
||||
import google.registry.model.domain.DomainBase;
|
||||
import google.registry.model.domain.token.AllocationToken.TokenStatus;
|
||||
import google.registry.model.domain.token.AllocationToken.TokenType;
|
||||
@@ -160,6 +161,52 @@ public class AllocationTokenTest extends EntityTestCase {
|
||||
assertThat(tokenAfterPersisting.getCreationTime()).hasValue(fakeClock.nowUtc());
|
||||
}
|
||||
|
||||
@TestOfyAndSql
|
||||
void testgetRenewalBehavior_returnsDefaultRenewBehavior() {
|
||||
assertThat(
|
||||
persistResource(
|
||||
new AllocationToken.Builder()
|
||||
.setToken("abc123")
|
||||
.setTokenType(SINGLE_USE)
|
||||
.build())
|
||||
.getRenewalPriceBehavior())
|
||||
.isEqualTo(RenewalPriceBehavior.DEFAULT);
|
||||
}
|
||||
|
||||
@TestOfyAndSql
|
||||
void testsetRenewalBehavior_assertsRenewalBehaviorIsNotDefault() {
|
||||
assertThat(
|
||||
persistResource(
|
||||
new AllocationToken.Builder()
|
||||
.setToken("abc123")
|
||||
.setTokenType(SINGLE_USE)
|
||||
.setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED)
|
||||
.build())
|
||||
.getRenewalPriceBehavior())
|
||||
.isEqualTo(RenewalPriceBehavior.SPECIFIED);
|
||||
}
|
||||
|
||||
@TestOfyAndSql
|
||||
void testsetRenewalBehavior_assertRenewalBehaviorIsModified() {
|
||||
AllocationToken token =
|
||||
persistResource(
|
||||
new AllocationToken.Builder()
|
||||
.setToken("abc123")
|
||||
.setTokenType(SINGLE_USE)
|
||||
.setRenewalPriceBehavior(RenewalPriceBehavior.NONPREMIUM)
|
||||
.build());
|
||||
AllocationToken loadedToken = loadByEntity(token);
|
||||
assertThat(token).isEqualTo(loadedToken);
|
||||
AllocationToken modifiedToken =
|
||||
persistResource(
|
||||
loadedToken
|
||||
.asBuilder()
|
||||
.setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED)
|
||||
.build());
|
||||
assertThat(loadByEntity(token).getRenewalPriceBehavior())
|
||||
.isEqualTo(RenewalPriceBehavior.SPECIFIED);
|
||||
}
|
||||
|
||||
@TestOfyAndSql
|
||||
void testSetCreationTime_cantCallMoreThanOnce() {
|
||||
AllocationToken.Builder builder =
|
||||
|
||||
@@ -350,6 +350,7 @@ class google.registry.model.domain.token.AllocationToken {
|
||||
double discountFraction;
|
||||
google.registry.model.CreateAutoTimestamp creationTime;
|
||||
google.registry.model.UpdateAutoTimestamp updateTimestamp;
|
||||
google.registry.model.billing.BillingEvent$RenewalPriceBehavior renewalPriceBehavior;
|
||||
google.registry.model.common.TimedTransitionProperty<google.registry.model.domain.token.AllocationToken$TokenStatus, google.registry.model.domain.token.AllocationToken$TokenStatusTransition> tokenStatusTransitions;
|
||||
google.registry.model.domain.token.AllocationToken$TokenType tokenType;
|
||||
google.registry.persistence.DomainHistoryVKey redemptionHistoryEntry;
|
||||
|
||||
Reference in New Issue
Block a user