Skip to content

Commit cbac1fb

Browse files
Copilotdkayiwa
andcommitted
Fix remaining test issues: null locale in getMessage, test datasets, duplicate handler adapter, WebComponentRegistrar null check
Co-authored-by: dkayiwa <1390773+dkayiwa@users.noreply.github.com>
1 parent 8e173bb commit cbac1fb

File tree

8 files changed

+16
-10
lines changed

8 files changed

+16
-10
lines changed

omod/src/main/java/org/openmrs/web/WebComponentRegistrar.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ public void setServletContext(ServletContext servletContext) {
6666
}
6767

6868
private void addMappings(ServletRegistration reg, String... mappings) {
69+
if (reg == null) {
70+
return;
71+
}
6972
for (String mapping : mappings) {
7073
reg.addMapping(mapping);
7174
}

omod/src/main/java/org/openmrs/web/controller/ConceptFormValidator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ private void setReferenceRangeErrorsWithValue(BindException errors, long index,
209209
Double value, Double thresholdValue) {
210210
errors.pushNestedPath("referenceRanges[" + index + "]");
211211
errors.rejectValue(field,
212-
Context.getMessageSourceService().getMessage(errorCode, new Object[] { value, thresholdValue }, null),
212+
Context.getMessageSourceService().getMessage(errorCode, new Object[] { value, thresholdValue }, Context.getLocale()),
213213
"Concept.referenceRanges.error.absolute.value.invalid");
214214
errors.popNestedPath();
215215
}

omod/src/main/java/org/openmrs/web/controller/OptionsFormController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ protected Map<String, Object> referenceData(HttpServletRequest request) throws E
378378
//ignore
379379
}
380380

381-
hints.add(mss.getMessage("options.login.password.minCharacterCount", new Object[] { minChar }, null));
381+
hints.add(mss.getMessage("options.login.password.minCharacterCount", new Object[] { minChar }, Context.getLocale()));
382382
addHint(hints, as.getGlobalProperty(OpenmrsConstants.GP_PASSWORD_CANNOT_MATCH_USERNAME_OR_SYSTEMID),
383383
mss.getMessage("options.login.password.cannotMatchUsername"));
384384
addHint(hints, as.getGlobalProperty(OpenmrsConstants.GP_PASSWORD_REQUIRES_UPPER_AND_LOWER_CASE),

omod/src/main/resources/webModuleApplicationContext.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@
3939
<!-- Alias for messageSource resolution - in Platform 3.0.0 services use @Service annotation -->
4040
<alias name="messageSourceService" alias="messageSource"/>
4141

42+
<!-- Prevent duplicate SimpleControllerHandlerAdapter registration from MVC namespace and @EnableWebMvc -->
43+
<bean id="simpleControllerHandlerAdapter" class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter"/>
44+
4245
<bean id="legacyUiUrlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
4346
<property name="interceptors">
4447
<list>

omod/src/test/resources/org/openmrs/web/include/SchedulerFormControllerTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
1212
-->
1313
<dataset>
14-
<scheduler_task_config task_config_id="1" name="Hello World Task" description="Hello World Test Task" schedulable_class="org.openmrs.scheduler.tasks.HelloWorldTask" repeat_interval="3600" started="0" start_on_startup="0" uuid="29754c38-6711-11e0-9d74-18a905e044dc" created_by="1" date_created="2006-07-18 11:03:31.0" />
14+
<scheduler_task_config task_config_id="1" name="Hello World Task" description="Hello World Test Task" schedulable_class="org.openmrs.scheduler.tasks.HelloWorldTask" repeat_interval="3600" started="0" start_on_startup="0" uuid="29754c38-6711-11e0-9d74-18a905e044dc" creator="1" date_created="2006-07-18 11:03:31.0" retired="false" />
1515
</dataset>

omod/src/test/resources/org/openmrs/web/include/TaskHelperTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
1212
-->
1313
<dataset>
14-
<scheduler_task_config task_config_id="2" name="Hello World Task" description="Hello World Test Task" schedulable_class="org.openmrs.scheduler.tasks.HelloWorldTask" repeat_interval="3600" started="0" start_on_startup="0" uuid="FA010D31-4040-4574-A083-315A781106FA" created_by="1" date_created="2006-07-18 11:03:31.0" />
14+
<scheduler_task_config task_config_id="2" name="Hello World Task" description="Hello World Test Task" schedulable_class="org.openmrs.scheduler.tasks.HelloWorldTask" repeat_interval="3600" started="0" start_on_startup="0" uuid="FA010D31-4040-4574-A083-315A781106FA" creator="1" date_created="2006-07-18 11:03:31.0" retired="false" />
1515
</dataset>

omod/src/test/resources/org/openmrs/web/taglib/include/PrivilegeTagTest.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
1212
-->
1313
<dataset>
14-
<privilege privilege="Manage Patients" description="Able to manage patients" uuid="b0da53a7-e5f5-4584-a9b9-bf911470fe57" creator="1" date_created="2005-01-01 00:00:00.0"/>
15-
<privilege privilege="View Patients" description="Able to view patients" uuid="83756836-aa91-44d0-97de-2cfcf3a64808" creator="1" date_created="2005-01-01 00:00:00.0"/>
16-
<privilege privilege="Edit Patients" description="Able to edit patients" uuid="68ba469c-22cc-46fd-a992-e4ec7db92b7f" creator="1" date_created="2005-01-01 00:00:00.0"/>
14+
<privilege privilege="Manage Patients" description="Able to manage patients" uuid="b0da53a7-e5f5-4584-a9b9-bf911470fe57" creator="1" date_created="2005-01-01 00:00:00.0" retired="false"/>
15+
<privilege privilege="View Patients" description="Able to view patients" uuid="83756836-aa91-44d0-97de-2cfcf3a64808" creator="1" date_created="2005-01-01 00:00:00.0" retired="false"/>
16+
<privilege privilege="Edit Patients" description="Able to edit patients" uuid="68ba469c-22cc-46fd-a992-e4ec7db92b7f" creator="1" date_created="2005-01-01 00:00:00.0" retired="false"/>
1717

1818
<role role="Data Clerk" description="Takes care of entering, editing patients." uuid="dddf8f8e-c6e3-49d3-8f70-2107a60f7df2"/>
1919
<role role="Clinician" description="Looks up patients." uuid="fa2fd77d-a586-4e89-9bd0-193a34b6d01e"/>

omod/src/test/resources/org/openmrs/web/taglib/include/RequireTagTest.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
<person person_id="2" gender="M" dead="false" creator="1" date_created="2005-01-01 00:00:00.0" voided="false" uuid="2d70a8dc-d233-460b-8717-35169091f03f"/>
1515
<person_name person_name_id="2" preferred="true" person_id="2" given_name="John" middle_name=" " family_name="Doe" creator="1" date_created="2005-01-01 00:00:00.0" voided="false" uuid="55ccd5eb-aaab-458f-9507-7beffda23855"/>
1616

17-
<privilege privilege="Manage WhirleyGigs" description="Able to manage whirleygigs" uuid="b0da53a7-e5f5-4584-a9b9-bf911470fe57" creator="1" date_created="2005-01-01 00:00:00.0"/>
18-
<privilege privilege="Manage WhoopDeDoos" description="Able to manage whoopdedoos" uuid="83756836-aa91-44d0-97de-2cfcf3a64808" creator="1" date_created="2005-01-01 00:00:00.0"/>
19-
<privilege privilege="Manage Thingamajigs" description="Able to manage thingamajigs" uuid="68ba469c-22cc-46fd-a992-e4ec7db92b7f" creator="1" date_created="2005-01-01 00:00:00.0"/>
17+
<privilege privilege="Manage WhirleyGigs" description="Able to manage whirleygigs" uuid="b0da53a7-e5f5-4584-a9b9-bf911470fe57" creator="1" date_created="2005-01-01 00:00:00.0" retired="false"/>
18+
<privilege privilege="Manage WhoopDeDoos" description="Able to manage whoopdedoos" uuid="83756836-aa91-44d0-97de-2cfcf3a64808" creator="1" date_created="2005-01-01 00:00:00.0" retired="false"/>
19+
<privilege privilege="Manage Thingamajigs" description="Able to manage thingamajigs" uuid="68ba469c-22cc-46fd-a992-e4ec7db92b7f" creator="1" date_created="2005-01-01 00:00:00.0" retired="false"/>
2020

2121
<role role="WhirleyGig Manager" description="Works with WhirleyGigs only" uuid="dddf8f8e-c6e3-49d3-8f70-2107a60f7df2"/>
2222
<role role="Manager" description="Works with all objects" uuid="fa2fd77d-a586-4e89-9bd0-193a34b6d01e"/>

0 commit comments

Comments
 (0)