-
Notifications
You must be signed in to change notification settings - Fork 149
EA-219: Update to OpenMRS Platform 2.8.x #263
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
Conversation
|
@dkayiwa, why are we seeing a forbidden class exception even though the MetadataPackagesConfig class is on the whitelisting list? openmrs-module-emrapi/omod/src/main/resources/config.xml Lines 151 to 155 in 5d0e79d
|
| public void setProviderRole(Provider provider, ProviderRole providerRole) { | ||
| provider.setProviderRole(providerRole); | ||
| } | ||
| } |
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.
We should be able to delete this class, no?
|
|
||
| void setProviderRole(Provider provider, Object providerRole); | ||
| void setProviderRole(Provider provider, ProviderRole providerRole); | ||
| } |
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.
We should be able to delete this class, no?
| import static org.openmrs.util.OpenmrsConstants.USER_PROPERTY_LOGIN_ATTEMPTS; | ||
|
|
||
| public class AccountDomainWrapperTest extends EmrApiContextSensitiveTest { | ||
| public class AccountDomainWrapperTest extends BaseModuleContextSensitiveTest { |
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.
If you are going to switch from EmrApiContextSensitiveTest to BaseModuleContextSensitiveTest, why aren't you deleting the (now empty) EmrApiContextSensitiveTest. Any reason not to keep it around and use it even if it is empty? Gives a convenient place to put code that you need to execute for every test in this module.
| providerManagementService = mock(ProviderManagementService.class); | ||
| providerServiceFacade = new MockProviderServiceFacade(new ProviderManagementProviderService(providerService, providerManagementService)); | ||
| providerManagementService = mock(ProviderService.class); | ||
| providerServiceFacade = new MockProviderServiceFacade(new CoreProviderService(providerService)); |
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 entire providerServiceFacade idea is no longer needed. Just remove it and use providerService directly
|
|
||
| providerIdentifierGenerator = mock(ProviderIdentifierGenerator.class); | ||
| when(providerIdentifierGenerator.generateIdentifier(any(Provider.class))).thenReturn("456"); | ||
| lenient().when(providerIdentifierGenerator.generateIdentifier(any(Provider.class))).thenReturn("456"); |
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.
What do these lenient() calls do?
| <argLine>-Xmx512m -XX:MaxPermSize=512m -Djdk.net.URLClassPath.disableClassPathURLCheck=true</argLine> | ||
| <includes> | ||
| <include>**/*Test.java</include> | ||
| <include>**/*_IT.java</include> |
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.
Just want to confirm that after removing this that all tests are still executed (eg all _IT tests)
|
@mseaton I updated the PR according to your suggestions. Do you know why I am getting the xstream.security.ForbiddenClassException in MetadataUtilTest ? |
|
Should I remove the MetadataUtilTest, since MetadataUtil has been deprecated and its functionality has been moved to the Metadata Sharing module? |
I think this is fine @wikumChamith . If you do so, please also remove MetadataUtil. It has been deprecated for a long time, and in any event this new change you are introducing definitely requires a new major version anyway. So please update this PR to change the version in the pom to 3.0.0-SNAPSHOT. (I am doing a release from the master branch now which will be 2.4.0, and we can fork off from there as needed as a maintenance branch for those that cannot move to 2.8.x in the near term) |
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.
LGTM (though I don't know about the changes to the findPatient DAO, I didn't review these in detail and don't have a good sense of why they are required)
PatientSearchCriteria has been deprecated, and this was showing some errors. So, I decided to replace it with the JPA Criteria API, which is the recommended approach starting from Platform 2.7.0. |
|
@wikumChamith did you get a chance to look at the build errors? |
@dkayiwa Looks like these errors are coming from core, specifically after this commit: openmrs/openmrs-core@ec1f42c cc: @rkorytkowski |
|
The issue is TestingApplicationContext overrides sessionFactory from core and doesn't set cacheConfig property. I think I need to move cacheConfig to be autowired again in case of this kind of overwrite... Overwriting bean definition is hacky and we will want to come up with some better approach here. I'll think about it. |
|
Reverted to use |
|
@rkorytkowski are we reverting simply for tests? How about making tests hack this out without having to revert the changes in core, if they were for the better running of the application? |
Is this a feature or a bug? |
|
My change in Autowired doesn't improve anything in core. It was a leftover after experimenting with code that I didn't think would impact anything... but life can't be that predictable. I reverted the change. Another thing is that overwriting sessionFactory as many modules do in TestingApplicationContext isn't the best approach so we could think of a cleaner idea. |
@rkorytkowski, now we are getting a different error. |
I missed this: openmrs/openmrs-module-reporting@ac35bc7 |
| for (int i = 0; i < len; i++) { | ||
| char c = localeString.charAt(i); | ||
| // allow only ASCII letters and "_" character | ||
| if ((c <= 0x20 || c >= 0x7f) || ((c >= 0x20 || c <= 0x7f) && (!Character.isLetter(c) && c != 0x5f))) { |
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.
Is there a reason why you dropped ((c >= 0x20 || c <= 0x7f)?
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.
It is always true in here.
|
Does this compile on Java 21? |
| .distinct(true); | ||
|
|
||
| TypedQuery<Patient> typed = em.createQuery(cq); | ||
| if (start != null) typed.setFirstResult(start); |
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.
|
|
||
| } | ||
|
|
||
| private Criteria buildCriteria(String query, Criteria criteria) { |
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.
Why did we get rid of this one?
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.
PatientSearchCriteria is deprecated. The same logic is now inside the findPatients method.
if (StringUtils.isNotBlank(query)) {
if (query.matches(".*\\d.*")) {
Join<Patient, PatientIdentifier> ids = patient.join("identifiers", JoinType.LEFT);
preds.add(cb.like(cb.lower(ids.get("identifier")),
"%" + query.toLowerCase() + "%"));
} else {
Join<Patient, PersonName> names = patient.join("names");
String like = "%" + query.toLowerCase() + "%";
preds.add(cb.or(cb.like(cb.lower(names.get("givenName")), like),
cb.like(cb.lower(names.get("familyName")), like)));
}
}
No. There are some modules that this depends on that do not yet support Java 21. |
|
Can't we do as for other modules that we have given support for all the way from Java 8 to 21? |
| @@ -1,341 +0,0 @@ | |||
| /** | |||
| * The contents of this file are subject to the OpenMRS Public License | |||
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.
@wikumChamith why did we delete this file?
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.
org.openmrs.module.ModuleException: Unable to start OpenMRS. Error thrown was: org/openmrs/module/emrapi/utils/MetadataUtil
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.
Since this is deprecated and this class also caused an error.
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.
org.openmrs.module.ModuleException: Unable to start OpenMRS. Error thrown was: org/openmrs/module/emrapi/utils/MetadataUtil
In which module?
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.
When starting O2
Ticket: https://openmrs.atlassian.net/browse/EA-219
Legacy branch: https://github.com/openmrs/openmrs-module-emrapi/tree/2.x