mirror of
https://github.com/google/nomulus
synced 2026-07-23 00:12:55 +00:00
Refactor bsa, dns, batch, and reporting packages to java.time (#3031)
This commit migrates the BSA, DNS, batch, and reporting packages from Joda-Time to java.time. Key changes include: - Updated Sleeper, Clock, and BigqueryUtils to use java.time types natively. - Refactored models like RdeRevision and Tld to eliminate redundant Joda conversions, utilizing new DateTimeUtils static utilities for LocalDate. - Improved test safety by replacing dynamic Instant.now() calls with static parsed constants. - Migrated temporal arithmetic in test suites to use DateTimeUtils convenience methods (plusDays, minusDays). - Updated BigqueryUtils serialization to preserve millisecond precision and formatting for large years, ensuring consistency with previous Joda behavior. - Enhanced code readability by converting long concatenated strings to Java text blocks in LordnLogTest. - Resolved environmental test failures in SyncRegistrarsSheetTest by synchronizing the FakeClock with the JPA extension. - Updated project engineering standards (GEMINI.md) to prefer Truth's .hasValue() for Optional assertions. Verified with a clean full build and all relevant test suites passing.
This commit is contained in:
@@ -23,6 +23,7 @@ import static google.registry.client.EppClient.LOGGING_REQUEST_COMPLETE;
|
||||
import static google.registry.client.EppClient.REQUEST_SENT;
|
||||
import static google.registry.client.EppClient.RESPONSE_RECEIVED;
|
||||
import static java.nio.file.StandardOpenOption.APPEND;
|
||||
import static java.time.ZoneOffset.UTC;
|
||||
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
@@ -37,7 +38,6 @@ import io.netty.util.concurrent.Promise;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.ZonedDateTime;
|
||||
|
||||
/** Handler that sends EPP requests and receives EPP responses. */
|
||||
@@ -75,7 +75,7 @@ public class EppClientHandler extends ChannelDuplexHandler {
|
||||
|
||||
@Override
|
||||
public void channelRegistered(ChannelHandlerContext ctx) throws Exception {
|
||||
ZonedDateTime now = ZonedDateTime.now(ZoneOffset.UTC);
|
||||
ZonedDateTime now = ZonedDateTime.now(UTC);
|
||||
ctx.channel().attr(REQUEST_SENT).get().add(now);
|
||||
ctx.channel().attr(LOGGING_REQUEST_COMPLETE).set(ctx.executor().newPromise());
|
||||
super.channelRegistered(ctx);
|
||||
@@ -93,7 +93,7 @@ public class EppClientHandler extends ChannelDuplexHandler {
|
||||
|
||||
@Override
|
||||
public void channelRead(ChannelHandlerContext ctx, Object msg) {
|
||||
ZonedDateTime now = ZonedDateTime.now(ZoneOffset.UTC);
|
||||
ZonedDateTime now = ZonedDateTime.now(UTC);
|
||||
Channel ch = ctx.channel();
|
||||
ctx.channel().attr(RESPONSE_RECEIVED).get().add(now);
|
||||
if (msg instanceof ByteBuf buffer) {
|
||||
@@ -118,7 +118,7 @@ public class EppClientHandler extends ChannelDuplexHandler {
|
||||
|
||||
@Override
|
||||
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) {
|
||||
ZonedDateTime now = ZonedDateTime.now(ZoneOffset.UTC);
|
||||
ZonedDateTime now = ZonedDateTime.now(UTC);
|
||||
Channel ch = ctx.channel();
|
||||
ctx.channel().attr(REQUEST_SENT).get().add(now);
|
||||
if (msg instanceof byte[] outputBytes) {
|
||||
|
||||
Reference in New Issue
Block a user