mirror of
https://github.com/google/nomulus.git
synced 2025-05-18 18:29:36 +02:00
Add new DomainResource.getGracePeriodsOfType() method
This adds a new method which will be used in an upcoming CL affecting domain transfer logic. It also removes two older methods that are unused (they were originally going to be used for TLD-specific logic which is now obsolete). ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=148928965
This commit is contained in:
parent
13249db5cf
commit
c56959b62b
2 changed files with 23 additions and 27 deletions
|
@ -26,6 +26,7 @@ import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
|
|||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
import static org.joda.money.CurrencyUnit.USD;
|
||||
|
||||
import com.google.common.collect.FluentIterable;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSortedMap;
|
||||
|
@ -51,7 +52,6 @@ import google.registry.model.transfer.TransferData;
|
|||
import google.registry.model.transfer.TransferData.TransferServerApproveEntity;
|
||||
import google.registry.model.transfer.TransferStatus;
|
||||
import google.registry.testing.ExceptionRule;
|
||||
import java.util.List;
|
||||
import org.joda.money.Money;
|
||||
import org.joda.time.DateTime;
|
||||
import org.junit.Before;
|
||||
|
@ -346,7 +346,7 @@ public class DomainResourceTest extends EntityTestCase {
|
|||
|
||||
@Test
|
||||
public void testStackedGracePeriods() {
|
||||
List<GracePeriod> gracePeriods = ImmutableList.of(
|
||||
ImmutableList<GracePeriod> gracePeriods = ImmutableList.of(
|
||||
GracePeriod.create(GracePeriodStatus.ADD, clock.nowUtc().plusDays(3), "foo", null),
|
||||
GracePeriod.create(GracePeriodStatus.ADD, clock.nowUtc().plusDays(2), "bar", null),
|
||||
GracePeriod.create(GracePeriodStatus.ADD, clock.nowUtc().plusDays(1), "baz", null));
|
||||
|
@ -357,6 +357,22 @@ public class DomainResourceTest extends EntityTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGracePeriodsByType() {
|
||||
ImmutableSet<GracePeriod> addGracePeriods = ImmutableSet.of(
|
||||
GracePeriod.create(GracePeriodStatus.ADD, clock.nowUtc().plusDays(3), "foo", null),
|
||||
GracePeriod.create(GracePeriodStatus.ADD, clock.nowUtc().plusDays(1), "baz", null));
|
||||
ImmutableSet<GracePeriod> renewGracePeriods = ImmutableSet.of(
|
||||
GracePeriod.create(GracePeriodStatus.RENEW, clock.nowUtc().plusDays(3), "foo", null),
|
||||
GracePeriod.create(GracePeriodStatus.RENEW, clock.nowUtc().plusDays(1), "baz", null));
|
||||
domain = domain.asBuilder()
|
||||
.setGracePeriods(FluentIterable.from(addGracePeriods).append(renewGracePeriods).toSet())
|
||||
.build();
|
||||
assertThat(domain.getGracePeriodsOfType(GracePeriodStatus.ADD)).isEqualTo(addGracePeriods);
|
||||
assertThat(domain.getGracePeriodsOfType(GracePeriodStatus.RENEW)).isEqualTo(renewGracePeriods);
|
||||
assertThat(domain.getGracePeriodsOfType(GracePeriodStatus.TRANSFER)).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRenewalsHappenAtExpiration() {
|
||||
DomainResource renewed =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue