Fix nomulus GetEppResourceCommand (#1865)

* Fix nomulus GetEppResourceCommand

Fixes a bug in read_timestamp validation.

Fixes string representation of Collection fields in Epp Resources.
This commit is contained in:
Weimin Yu
2022-12-01 18:35:15 -05:00
committed by GitHub
parent 63d3453848
commit 46a7956f77
3 changed files with 63 additions and 4 deletions
@@ -14,6 +14,7 @@
package google.registry.model;
import static com.google.common.collect.Iterables.transform;
import static com.google.common.collect.Maps.transformValues;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
@@ -178,7 +179,7 @@ public abstract class ImmutableObject implements Cloneable {
return transformValues((Map<?, ?>) value, ImmutableObject::hydrate);
}
if (value instanceof Collection) {
return ((Collection<?>) value).stream().map(ImmutableObject::hydrate);
return transform((Collection<?>) value, ImmutableObject::hydrate);
}
if (value instanceof ImmutableObject) {
return ((ImmutableObject) value).toHydratedString();
@@ -60,11 +60,11 @@ abstract class GetEppResourceCommand implements CommandWithRemoteApi {
@Override
public void run() {
DateTime now = clock.nowUtc();
if (readTimestamp == null) {
readTimestamp = clock.nowUtc();
readTimestamp = now;
}
checkArgument(
!readTimestamp.isBefore(clock.nowUtc()), "--read_timestamp may not be in the past");
checkArgument(!readTimestamp.isBefore(now), "--read_timestamp may not be in the past");
runAndPrint();
}
}