Upgrade to OpenMRS core 2.7.5 with Java 8/11/17/21 support#134
Upgrade to OpenMRS core 2.7.5 with Java 8/11/17/21 support#134
Conversation
- Update openMRSVersion from 1.10.2 to 2.7.5 - Update webservices.rest from 2.23.0 to 3.0.0 (Spring 5 compatible) - Add legacyui-omod 1.16.0 dependency for AdministrationSectionExt - Update config.xml require_version to 2.7.5 API changes: - Replace Expression.xyz() with Restrictions.xyz() (Hibernate 5) - Use PrivilegeConstants.EDIT_PATIENT_IDENTIFIERS (OpenMRS 2.x) Test infrastructure: - Migrate PowerMock tests to Mockito MockedStatic - Replace mockito-core with mockito-inline for static mocking - Add --add-opens JVM args for Java 9+ via Maven profile - Add -Dnet.bytebuddy.experimental=true for Java 21 support - Create TestTransactionAttributeSource to downgrade REQUIRES_NEW to REQUIRED for H2 MVStore compatibility in tests - Fix TestData.xml for OpenMRS 2.7.5 schema (CHECK_DIGIT, user IDs) - Fix DuplicateIdentifiersPoolComponentTest concurrency issues - Add @PropertyGetter for identifiers on IdentifierPoolResourceHandler - Add javax.servlet-api 3.1.0 test dependency - Remove dummy CodedOrFreeText.java (now in core) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
@wikumChamith i did this not to replace your pull request but just for experimental purposes. I switched to CLI and it did what i wanted of running in a loop until all errors are fixed. How do you compare this with yours in terms of quality, completeness, and other things? 😊 |
pom.xml
Outdated
| <profiles> | ||
| <profile> | ||
| <id>java9plus</id> | ||
| <activation> | ||
| <jdk>[9,)</jdk> | ||
| </activation> | ||
| <properties> | ||
| <surefire.argLine> | ||
| -Dnet.bytebuddy.experimental=true | ||
| --add-opens java.base/java.lang=ALL-UNNAMED | ||
| --add-opens java.base/java.lang.reflect=ALL-UNNAMED | ||
| --add-opens java.base/java.util=ALL-UNNAMED | ||
| --add-opens java.base/java.text=ALL-UNNAMED | ||
| --add-opens java.base/java.io=ALL-UNNAMED | ||
| --add-opens java.base/java.net=ALL-UNNAMED | ||
| --add-opens java.rmi/sun.rmi.transport=ALL-UNNAMED | ||
| </surefire.argLine> | ||
| </properties> | ||
| </profile> | ||
| </profiles> |
There was a problem hiding this comment.
I completely agree. Let me prompt it further about these. Like i said again, not to replace yours, but for learning how out get the best out of these guys. 😊
There was a problem hiding this comment.
What do you think about its followup commit after asking the agent to remove that? 240dd09
Refactor tests to avoid MockedStatic<Context> (which requires mockito-inline and many --add-opens JVM arguments on Java 9+): - SequentialIdentifierGeneratorTest: Use spy with stubbed getPrefixProvider/getSuffixProvider instead of mocking Context - LocationBasedPrefixProviderTest: Set prefixLocationAttributeType via reflection instead of mocking Context.getAdministrationService() - Remove java9plus Maven profile with all --add-opens flags - Remove surefire argLine configuration Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
This looks good but it does something different than the ways my Claude and I tried. I might be able to steal something from this :) |
| * uncommitted data from suspended transactions, which causes REQUIRES_NEW to fail | ||
| * in tests where data is loaded within a test transaction. | ||
| */ | ||
| public class TestTransactionAttributeSource extends AnnotationTransactionAttributeSource { |
There was a problem hiding this comment.
This is really interesting.
There was a problem hiding this comment.
Same Claude Opus 4.6 (Different Harness Copilot CLI). Please steal as much as you can. This agent will not feel jealous! 🤣
Something i have also done several times is to simply ask it for alternatives. 😊
Summary
Upgrades the idgen module to compile and pass all tests on OpenMRS core 2.7.5 with Java 8, 11, 17, and 21.
Changes
Dependency Updates
openMRSVersion: 1.10.2 → 2.7.5webservices.rest: 2.23.0 → 3.0.0 (Spring 5 / Servlet 3.1 compatible)legacyui-omod:1.16.0(provided) forAdministrationSectionExtmockito-inline:4.11.0for static mockingjavax.servlet-api:3.1.0test dependencyAPI Fixes (Hibernate 5 / OpenMRS 2.x)
HibernateIdentifierSourceDAO: Replaced allExpression.xyz()withRestrictions.xyz()IdentifierSourceService: Switched toPrivilegeConstants.EDIT_PATIENT_IDENTIFIERSconfig.xml: Updatedrequire_versionto 2.7.5Test Infrastructure
SequentialIdentifierGeneratorTestandLocationBasedPrefixProviderTestfrom PowerMock to MockitoMockedStaticIdentifierSourceControllerTestTestTransactionAttributeSourceto downgradeREQUIRES_NEW→REQUIREDfor H2 1.4.200 MVStore compatibilitypackagesToScanfor JPA entity scanning inTestingApplicationContext.xmlTestData.xml: removedCHECK_DIGITcolumn, used valid user IDs (1, 501, 502)DuplicateIdentifiersPoolComponentTest: explicit transaction commit, synchronized auth@PropertyGetter("identifiers")toIdentifierPoolResourceHandlerfor proper JSON serializationCodedOrFreeText.java(now in OpenMRS core)Java Version Compatibility
java9pluswith--add-opensJVM args (activated for JDK 9+)-Dnet.bytebuddy.experimental=truefor ByteBuddy/Java 21 support--add-opens(not supported)Test Results