Migrate bsa, dns, batch, and reporting packages to java.time#3031
Open
CydeWeys wants to merge 1 commit intogoogle:masterfrom
Open
Migrate bsa, dns, batch, and reporting packages to java.time#3031CydeWeys wants to merge 1 commit intogoogle:masterfrom
CydeWeys wants to merge 1 commit intogoogle:masterfrom
Conversation
2fb2275 to
28812b7
Compare
| this.sigOutput = sigOutput; | ||
| signer = closer.register(new RydePgpSigningOutputStream(checkNotNull(rydeOutput), signingKey)); | ||
| signer = | ||
| closer.register(new RydePgpSigningOutputStream(checkNotNull(receiverOutput), signingKey)); |
| // If cursor time is before now, upload the corresponding report | ||
| cursors.entrySet().stream() | ||
| .filter(entry -> entry.getKey().getCursorTime().isBefore(clock.nowUtc())) | ||
| .filter(entry -> toInstant(entry.getKey().getCursorTime()).isBefore(clock.now())) |
| private void uploadReport( | ||
| Cursor cursor, String tldStr, ImmutableMap.Builder<String, Boolean> reportSummaryBuilder) { | ||
| DateTime cursorTime = cursor.getCursorTime(); | ||
| Instant cursorTime = toInstant(cursor.getCursorTime()); |
| Cursor cursor = | ||
| loadByKey(Cursor.createScopedVKey(CursorType.ICANN_UPLOAD_ACTIVITY, Tld.get("tld"))); | ||
| assertThat(cursor.getCursorTime()).isEqualTo(DateTime.parse("2006-08-02T10:00:00Z")); | ||
| assertThat(toInstant(cursor.getCursorTime())).isEqualTo(Instant.parse("2006-08-02T10:00:00Z")); |
| Cursor cursor = | ||
| loadByKey(Cursor.createScopedVKey(CursorType.ICANN_UPLOAD_ACTIVITY, Tld.get("tld"))); | ||
| assertThat(cursor.getCursorTime()).isEqualTo(DateTime.parse("2006-07-01TZ")); | ||
| assertThat(toInstant(cursor.getCursorTime())).isEqualTo(Instant.parse("2006-07-01T00:00:00Z")); |
| Cursor cursor = | ||
| loadByKey(Cursor.createScopedVKey(CursorType.ICANN_UPLOAD_ACTIVITY, Tld.get("foo"))); | ||
| assertThat(cursor.getCursorTime()).isEqualTo(DateTime.parse("2006-07-01TZ")); | ||
| assertThat(toInstant(cursor.getCursorTime())).isEqualTo(Instant.parse("2006-07-01T00:00:00Z")); |
| Cursor newActivityCursor = | ||
| loadByKey(Cursor.createScopedVKey(CursorType.ICANN_UPLOAD_ACTIVITY, Tld.get("new"))); | ||
| assertThat(newActivityCursor.getCursorTime()).isEqualTo(DateTime.parse("2006-08-02T10:00:00Z")); | ||
| assertThat(toInstant(newActivityCursor.getCursorTime())) |
| loadByKey(Cursor.createScopedVKey(CursorType.ICANN_UPLOAD_TX, Tld.get("new"))); | ||
| assertThat(newTransactionCursor.getCursorTime()) | ||
| .isEqualTo(DateTime.parse("2006-08-02T10:00:00Z")); | ||
| assertThat(toInstant(newTransactionCursor.getCursorTime())) |
702da9d to
a0b8231
Compare
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.
a0b8231 to
67bdec7
Compare
gbrodman
requested changes
May 5, 2026
Collaborator
gbrodman
left a comment
There was a problem hiding this comment.
@gbrodman reviewed 184 files and all commit messages, and made 11 comments.
Reviewable status: all files reviewed, 12 unresolved discussions (waiting on CydeWeys).
core/src/main/java/google/registry/rde/RdeUtils.java line 41 at r3 (raw file):
private static final int PEEK_SIZE = 2048; public static final DateTimeFormatter RDE_WATERMARK_FORMATTER =
this is used in more than just RDE, maybe consider moving it to a more generic class?
core/src/main/java/google/registry/rde/RydeEncoder.java line 144 at r3 (raw file):
/** Returns the built {@link RydeEncoder}. */ public RydeEncoder build() throws IOException {
why are these exceptions added?
core/src/main/java/google/registry/rde/RydeTar.java line 47 at r3 (raw file):
static ImprovedOutputStream openTarWriter( @WillNotClose OutputStream os, long expectedSize, String filename, Instant modified) throws IOException {
why did it make these changes?
core/src/test/java/google/registry/batch/BulkDomainTransferActionTest.java line 82 at r3 (raw file):
persistResource( persistDomainWithDependentResources( "pendingdelete", "tld", now, minusDays(now, 1), plusDays(now, 30))
why are you switching the plusMonths to plusDays in this test?
| // If cursor time is before now, upload the corresponding report | ||
| cursors.entrySet().stream() | ||
| .filter(entry -> entry.getKey().getCursorTime().isBefore(clock.nowUtc())) | ||
| .filter(entry -> toInstant(entry.getKey().getCursorTime()).isBefore(clock.now())) |
| private void uploadReport( | ||
| Cursor cursor, String tldStr, ImmutableMap.Builder<String, Boolean> reportSummaryBuilder) { | ||
| DateTime cursorTime = cursor.getCursorTime(); | ||
| Instant cursorTime = toInstant(cursor.getCursorTime()); |
| Cursor cursor = | ||
| loadByKey(Cursor.createScopedVKey(CursorType.ICANN_UPLOAD_ACTIVITY, Tld.get("tld"))); | ||
| assertThat(cursor.getCursorTime()).isEqualTo(DateTime.parse("2006-08-02T10:00:00Z")); | ||
| assertThat(toInstant(cursor.getCursorTime())).isEqualTo(Instant.parse("2006-08-02T10:00:00Z")); |
| Cursor cursor = | ||
| loadByKey(Cursor.createScopedVKey(CursorType.ICANN_UPLOAD_ACTIVITY, Tld.get("tld"))); | ||
| assertThat(cursor.getCursorTime()).isEqualTo(DateTime.parse("2006-07-01TZ")); | ||
| assertThat(toInstant(cursor.getCursorTime())).isEqualTo(Instant.parse("2006-07-01T00:00:00Z")); |
| Cursor cursor = | ||
| loadByKey(Cursor.createScopedVKey(CursorType.ICANN_UPLOAD_ACTIVITY, Tld.get("foo"))); | ||
| assertThat(cursor.getCursorTime()).isEqualTo(DateTime.parse("2006-07-01TZ")); | ||
| assertThat(toInstant(cursor.getCursorTime())).isEqualTo(Instant.parse("2006-07-01T00:00:00Z")); |
| Cursor newActivityCursor = | ||
| loadByKey(Cursor.createScopedVKey(CursorType.ICANN_UPLOAD_ACTIVITY, Tld.get("new"))); | ||
| assertThat(newActivityCursor.getCursorTime()).isEqualTo(DateTime.parse("2006-08-02T10:00:00Z")); | ||
| assertThat(toInstant(newActivityCursor.getCursorTime())) |
| loadByKey(Cursor.createScopedVKey(CursorType.ICANN_UPLOAD_TX, Tld.get("new"))); | ||
| assertThat(newTransactionCursor.getCursorTime()) | ||
| .isEqualTo(DateTime.parse("2006-08-02T10:00:00Z")); | ||
| assertThat(toInstant(newTransactionCursor.getCursorTime())) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change is