use of org.openmrs.module.pihcore.config.Config in project openmrs-module-pihcore by PIH.
the class PihRadiologyOrdersMergeActionsComponentTest method shouldMergePatientsWhenNonPreferredPatientHasRadiologyOrdersInOverlappingVisit.
// TODO un-ignore once we have the EMR API module updated
@Test
@Ignore
public void shouldMergePatientsWhenNonPreferredPatientHasRadiologyOrdersInOverlappingVisit() throws Exception {
PihRadiologyOrdersMergeActions pihRadiologyOrdersMergeActions = Context.getRegisteredComponent("pihRadiologyOrdersMergeActions", PihRadiologyOrdersMergeActions.class);
Config config = mock(Config.class);
runtimeProperties.setProperty(ConfigLoader.PIH_CONFIGURATION_RUNTIME_PROPERTY, "mirebalais");
config = new Config(ConfigLoader.loadFromRuntimeProperties());
pihRadiologyOrdersMergeActions.setConfig(config);
Patient preferredPatient = patientService.getPatient(6);
Patient nonPreferredPatient = patientService.getPatient(10004);
List<Encounter> encountersByPatient = encounterService.getEncountersByPatient(nonPreferredPatient);
// patient has 1 Radiology Encounter
Assert.assertEquals(1, encountersByPatient.size());
Assert.assertEquals("RadiologyOrder", encountersByPatient.get(0).getEncounterType().getName());
Set<Order> orders = encountersByPatient.get(0).getOrders();
Assert.assertEquals(1, orders.size());
Order radiologyOrder = null;
for (Order order : orders) {
radiologyOrder = order;
}
Assert.assertEquals("RadiologyOrder", radiologyOrder.getOrderType().getName());
adtService.mergePatients(preferredPatient, nonPreferredPatient);
assertTrue("RadiologyOrder was not merged", orderService.getAllOrdersByPatient(preferredPatient).contains(radiologyOrder));
}
use of org.openmrs.module.pihcore.config.Config in project openmrs-module-pihcore by PIH.
the class BaseReportTest method getConfig.
protected Config getConfig() {
ConfigDescriptor d = new ConfigDescriptor();
d.setCountry(ConfigDescriptor.Country.HAITI);
d.setSite(ConfigDescriptor.Site.MIREBALAIS);
return new Config(d);
}
use of org.openmrs.module.pihcore.config.Config in project openmrs-module-pihcore by PIH.
the class PihCloseStaleVisitsTaskTest method getConfig.
protected Config getConfig() {
ConfigDescriptor d = new ConfigDescriptor();
d.setCountry(ConfigDescriptor.Country.HAITI);
d.setSite(ConfigDescriptor.Site.MIREBALAIS);
return new Config(d);
}
use of org.openmrs.module.pihcore.config.Config in project openmrs-module-mirebalais by PIH.
the class CustomAppUtilTest method shouldFindResourceAtCountryLevel.
@Test
public void shouldFindResourceAtCountryLevel() {
File file = mock(File.class);
ResourceFactory resourceFactory = mock(ResourceFactory.class);
when(resourceFactory.getResource("pihcore", "htmlforms/checkin.xml")).thenReturn(file);
when(resourceFactory.getResource("pihcore", "htmlforms/other/checkin.xml")).thenReturn(file);
Config config = mock(Config.class);
when(config.getCountry()).thenReturn(ConfigDescriptor.Country.OTHER);
when(config.getSite()).thenReturn(ConfigDescriptor.Site.OTHER);
String resourcePath = CustomAppLoaderUtil.determineResourcePath(config, "pihcore", "htmlforms", "checkin.xml");
assertThat(resourcePath, is("pihcore:htmlforms/other/checkin.xml"));
}
use of org.openmrs.module.pihcore.config.Config in project openmrs-module-mirebalais by PIH.
the class CustomAppUtilTest method shouldFindResourceAtTopLevel.
@Test
public void shouldFindResourceAtTopLevel() {
URL url = mock(URL.class);
when(moduleClassLoader.getResource("web/module/resources/htmlforms/checkin.xml")).thenReturn(url);
Config config = mock(Config.class);
when(config.getCountry()).thenReturn(ConfigDescriptor.Country.OTHER);
when(config.getSite()).thenReturn(ConfigDescriptor.Site.OTHER);
String resourcePath = CustomAppLoaderUtil.determineResourcePath(config, "pihcore", "htmlforms", "checkin.xml");
assertThat(resourcePath, is("pihcore:htmlforms/checkin.xml"));
}
Aggregations