mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 08:27:14 +02:00
Use an empty interval instead of null to signal no LRP
This removes the need for some null checks ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=136146549
This commit is contained in:
parent
148270a813
commit
064026a4a5
3 changed files with 5 additions and 4 deletions
|
@ -201,8 +201,7 @@ public abstract class BaseDomainCreateFlow<R extends DomainBase, B extends Build
|
||||||
isAnchorTenantViaReservation = matchesAnchorTenantReservation(
|
isAnchorTenantViaReservation = matchesAnchorTenantReservation(
|
||||||
domainLabel, tld, command.getAuthInfo().getPw().getValue());
|
domainLabel, tld, command.getAuthInfo().getPw().getValue());
|
||||||
boolean isLrpApplication =
|
boolean isLrpApplication =
|
||||||
registry.getLrpPeriod() != null
|
registry.getLrpPeriod().contains(now)
|
||||||
&& registry.getLrpPeriod().contains(now)
|
|
||||||
&& !command.getAuthInfo().getPw().getValue().isEmpty()
|
&& !command.getAuthInfo().getPw().getValue().isEmpty()
|
||||||
&& !isAnchorTenantViaReservation;
|
&& !isAnchorTenantViaReservation;
|
||||||
lrpToken = isLrpApplication
|
lrpToken = isLrpApplication
|
||||||
|
|
|
@ -574,7 +574,7 @@ public class Registry extends ImmutableObject implements Buildable {
|
||||||
@Nullable
|
@Nullable
|
||||||
public Interval getLrpPeriod() {
|
public Interval getLrpPeriod() {
|
||||||
return (lrpPeriodStart == null && lrpPeriodEnd == null)
|
return (lrpPeriodStart == null && lrpPeriodEnd == null)
|
||||||
? null
|
? new Interval(START_OF_TIME, Duration.ZERO)
|
||||||
: new Interval(lrpPeriodStart, lrpPeriodEnd);
|
: new Interval(lrpPeriodStart, lrpPeriodEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@ import java.io.ByteArrayOutputStream;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import org.joda.money.Money;
|
import org.joda.money.Money;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
|
import org.joda.time.Duration;
|
||||||
import org.joda.time.Interval;
|
import org.joda.time.Interval;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -414,7 +415,8 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
||||||
DateTime.parse("2004-06-09T12:30:00Z"), DateTime.parse("2004-07-10T13:30:00Z")))
|
DateTime.parse("2004-06-09T12:30:00Z"), DateTime.parse("2004-07-10T13:30:00Z")))
|
||||||
.build());
|
.build());
|
||||||
runCommandForced("--lrp_period=null", "xn--q9jyb4c");
|
runCommandForced("--lrp_period=null", "xn--q9jyb4c");
|
||||||
assertThat(Registry.get("xn--q9jyb4c").getLrpPeriod()).isNull();
|
assertThat(Registry.get("xn--q9jyb4c").getLrpPeriod())
|
||||||
|
.isEqualTo(new Interval(START_OF_TIME, Duration.ZERO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue