Skip to content

Fixed ResourcePolicyRestRepositoryIT test failing after clock was switched to winter time#1289

Merged
kosarko merged 3 commits intoclarin-v7from
ResourcePolicyRestRepositoryIT-fix
Nov 7, 2025
Merged

Fixed ResourcePolicyRestRepositoryIT test failing after clock was switched to winter time#1289
kosarko merged 3 commits intoclarin-v7from
ResourcePolicyRestRepositoryIT-fix

Conversation

@kuchtiak-ufal
Copy link
Copy Markdown

@kuchtiak-ufal kuchtiak-ufal commented Nov 5, 2025

This is kind of the hot-fix.

Problem was when the test was started after midnight with the java.util.Date value of

Tue Jun 15 00:29:23 IST 2010

When this value is stored in the database - resourcepolicy:startDate [Date] field it's stored as "2010-06-14".
It's some issue with TimeZone

Later this java.util.Date value (long number) is formatted to Date string string, with the default TimeZone (in this case it returns 2010-06-15).

Then this value is compared with the value from database(which is 2010-06-14), and that's the reason why the test fails.

@kosarko kosarko requested a review from Copilot November 7, 2025 12:33
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses a timezone-related issue in date formatting within a test method to ensure consistent behavior across different timezone environments.

  • Adds UTC timezone configuration to SimpleDateFormat in the patchReplaceStartDateUnAuthenticatedTest method
  • Includes explanatory comment documenting why UTC timezone is necessary for database date comparisons

@kosarko
Copy link
Copy Markdown
Member

kosarko commented Nov 7, 2025

regarding the debate we had about resource policy dates potentially being wrong:
DSpace#10119, DSpace#10432 and DSpace#11113 should (eventually) address that

@kosarko kosarko merged commit 48d9ae5 into clarin-v7 Nov 7, 2025
16 checks passed
kosarko pushed a commit that referenced this pull request Nov 20, 2025
…tched to winter time (#1289)

* fixed ResourcePolicyRestRepositoryIT test failing after WinterTime was setup

* another fix

* Better fix for failing tests

(cherry picked from commit 48d9ae5)
milanmajchrak added a commit to dataquest-dev/DSpace that referenced this pull request Jan 14, 2026
* issue_1150: implementation of MatomoReportDAO, MatomoReportService and MatomoReportRestRepository

* rest api improvement

* implement Matomo PDF exporter

* allow authenticated users to get Matomo Reports related to this user

* improve error messages

* fixed NPE

* rename table to matomo_report_registry, rename entity to MatomoReportSubscription

* improve API for registration

* changed URI for subscribe/unsubscribe REST API

* MatomoHelperTest

* dual uri for subscribe/unsubscribe

* MatomoReportSubscriptionRestRepositoryIT test

* Pull Request comments 1

* get rid of json-simple dependency

* replace Integer.parseInt with JsonNode.asInt()

* more reasonable toString() method

* dependencies cleanup

* resolved comments from copilot (AI)

* updated email template to match the other ones

there was an update in 1136183

* this is never used

* rename the sql scripts

meanwhile the clarin-v7 got an additional script; this change is to keep
the migrations in a proper order

* issue 1233: requiredmetadata curation task - fix NPE + few other issues (#1245)

* issue 1233: requiredmetadata curation task - fix NPE + few other issues

* use constant rather that hardcoded value

* resolve pull request comments

* integration test

* attempt to fix failing test

* update test to test usecase with workspace item

* cleanup handles properly in Integration test (no avoid clashing handles with other potential test)

* pull check for null outside of try catch block

* Add comprehensive copilot instructions for CLARIN-DSpace repository (#1255)

* Initial plan

* Add comprehensive .github/copilot-instructions.md for CLARIN-DSpace

Co-authored-by: kosarko <1842385+kosarko@users.noreply.github.com>

* Update copilot instructions - networking issue resolved

Co-authored-by: kosarko <1842385+kosarko@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: kosarko <1842385+kosarko@users.noreply.github.com>

* fixes Issue ufal#1250 (PR ufal#1251)

* issue 1250: allow submitters to create new versions of their own items

* formatting

* fixed failing tests

* Update build.yml

change the schedule from every 4 hrs to once a day

* Issue 1253: clarin-dspace will not unarchive previous item version, when new item version is created (#1258)

* Issue 1253: clarin-dspace will not unarchive previous item version when new item version is created

* add config property controlling whether previous item versions should be unarchived or not

* fixed failing IT tests

* attempt to fix unit tests

* unarchive item before removal

* attempt to find tests using VersioningServiceImpl#delete

* move workaround to VersioningServiceImpl

* add test for removing older version, fix cases when item is being removed twice in the same session

* resolve Copilot comments

* improve the message

* add a test case for the new "do not unarchive" behavior

* Update dspace-api/src/main/java/org/dspace/versioning/VersioningServiceImpl.java

comment grammar

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* The previous commit broke the syntax

---------

Co-authored-by: Ondřej Košarko <ko_ok@centrum.cz>
Co-authored-by: Ondřej Košarko <kosarko@ufal.mff.cuni.cz>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fixes issue ufal#1267

don't rely on dso.getHandle when registering new handle

* attempt to fix integration test failure

* Issue ufal#1217 epic handles (ufal#1221)

* Issue 1217: new EpicPidService implementation

* renamed EpicPidService to EpicHandleService

* implement REST API for epic handles

* small improvements: enable to search all ePIC handles with URL

* refactor  EpicHandleRestHelper + integration test for EpicHandleRestController

* add more test cases for search

* code improvement, JavaDoc

* runSynchronously -> runCountSynchronously

* extent integration test with content matchers

* allow to create new handles with PUT method

* change updateHandle to updateOrCreateHandle

* resolve copilot findings

---------

Co-authored-by: Milan Kuchtiak <mkuchtiak@Milans-MacBook-Pro.local>

* Issue ufal#1259 - Personal Access Tokens (ufal#1260)

* Issue 1259: personal_access_token implementation

* create personall-access-token-manager script to manage tokens

* move PersonalAccessTokenAdministrator from script commands to launcher commands

* PersonamAccessToken -> Unit test + Integration test

* set maximum expiration time for token to 90days

* removed empty line

* no need for token to start with PAT_ prefix

* separate Personal Access Token better from regular token

* change personal access token to be encrypted

* PersonalAccessToken renamed to ClarinToken + allow to create multiple tokens for single user

* remove unused test

* scripts improvements: enable to generate encryption/decryption secret key

* update user process script to be consistent with admin script, with regards to delete parameter

* resolve Pull Request comments

* attempt to fix integration test failure

* typo fix Gey -> Key

* resolve additional PR comments

* Issue #1269 - Curation task for checking handles (#1274)

* implement handle checker

* improve implementation + integration test

* formatting

* implement copilot suggestion + changing GET requests to HEAD request

* append the intermediate Locations and their results as well

* toLowerCase is before database search

this doesn't work with LRT-123

* split the test into individual tests

---------

Co-authored-by: Ondřej Košarko <ko_ok@centrum.cz>

* fixed interation test

* fix mismerge

* Revert "Update build.yml"

This reverts commit 058a3c1.

* Configure the test, it expects that versioning unarchives items

* add the options to trigger build manually

* Issue 1217: EPIC Handle API fix: add links to search response (#1283)

* Issue 1217: add links to search response

* restObjects -> epicHandleResources

(cherry picked from commit 947fa3a)

* Fixed ResourcePolicyRestRepositoryIT test failing after clock was switched to winter time (ufal#1289)

* fixed ResourcePolicyRestRepositoryIT test failing after WinterTime was setup

* another fix

* Better fix for failing tests

(cherry picked from commit 48d9ae5)

* Issue ufal#1072 file previews (ufal#1287)

* issue 1072: implement file preview feature for .gz, tar.gz, .xz, tar.xz and .7z files

* test for 7z format

* resolve copilot comments

* add unit tests for different mime-types and file extensions, handle IO exceptions when trying to parse archive files

* resolve copilot comments 2

* fixed incorrect bitstream name, description

* removed private logos

* accept also application/g-gzip archive mime-type

---------

Co-authored-by: Ondřej Košarko <ko_ok@centrum.cz>
(cherry picked from commit 736ae67)

* ufal#1084: allow existing users to use name/password authentication (ufal#1288)

* Issue-1084: allow existing users to use name/password authentication

* Resolve Copilot comment

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
(cherry picked from commit aeeb7a3)

* resolve Copilot comments, add author to classes

* improve JavaDoc

* resolve PR comments

* resolve anothe comments

* fixing ConnectionTimeout issue in tests: increasing connection timeout for redirect requests from 2 to 5 seconds

* use other handle URL for testing

* fixed failing BitstreamFormatRestRepositoryIT test

* fix User registration tests

* resolve MR comments from J.Misutka

* reorder list of extensions for bitstream name validation

* Change variable name from LINDAT_LOGO to ITEM_STATISTICS_LOGO

---------

Co-authored-by: Milan Kuchtiak <mkuchtiak@Milans-MacBook-Pro.local>
Co-authored-by: Milan Kuchtiak <kuchtiak@ufal.mff.cuni.cz>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: kosarko <1842385+kosarko@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: milanmajchrak <90026355+milanmajchrak@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants