-
Notifications
You must be signed in to change notification settings - Fork 603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated testcase to use zoneddatetime instead of instant #30270
Open
revijay
wants to merge
5
commits into
OpenLiberty:integration
Choose a base branch
from
revijay:29443-incorrect-result
base: integration
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
19390bf
Updated testcase to use zoneddatetime instead of instant
revijay 4fcd586
Merge branch 'OpenLiberty:integration' into 29443-incorrect-result
revijay 4f69228
Changed ZonedDateTime to OffsetDateTime in testcase
revijay 302125e
Created test for OffsetDateTime instead of using Instant
revijay 43cd479
Updated test case to compare instant tyoes after casting
revijay File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
...tions/jakartadata/src/io/openliberty/jpa/data/tests/models/DemographicInfoWithOffset.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 IBM Corporation and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*******************************************************************************/ | ||
package io.openliberty.jpa.data.tests.models; | ||
|
||
import java.math.BigDecimal; | ||
import java.math.BigInteger; | ||
import java.time.OffsetDateTime; | ||
import java.time.ZoneId; | ||
import java.time.ZonedDateTime; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.Id; | ||
|
||
/** | ||
* Recreate from io.openliberty.data.internal_fat_jpa | ||
* Same as DemographicInfo but uses OffsetDateTime instead of Instance | ||
*/ | ||
@Entity | ||
public class DemographicInfoWithOffset { | ||
|
||
@Column | ||
public OffsetDateTime collectedOn; | ||
|
||
@GeneratedValue | ||
@Id | ||
public BigInteger id; | ||
|
||
@Column | ||
public BigDecimal publicDebt; | ||
|
||
@Column | ||
public BigDecimal intragovernmentalDebt; | ||
|
||
@Column | ||
public BigInteger numFullTimeWorkers; | ||
|
||
public static DemographicInfoWithOffset of(int year, int month, int day, | ||
long numFullTimeWorkers, | ||
double intragovernmentalDebt, double publicDebt) { | ||
DemographicInfoWithOffset inst = new DemographicInfoWithOffset(); | ||
inst.collectedOn = ZonedDateTime.of(year, month, day, 12, 0, 0, 0, ZoneId.of("America/New_York")).toOffsetDateTime(); | ||
inst.numFullTimeWorkers = BigInteger.valueOf(numFullTimeWorkers); | ||
inst.intragovernmentalDebt = BigDecimal.valueOf(intragovernmentalDebt); | ||
inst.publicDebt = BigDecimal.valueOf(publicDebt); | ||
return inst; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "DemographicInfo from " + collectedOn; | ||
} | ||
} |
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't match the original query raised in #29443
What is the purpose of this test if not to re-create the original issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created this purely for testing purposes, so I did not request a review. Kindly disregard it.