Skip to content

Commit

Permalink
remove deprecated BaseModuleContextSensitiveTest
Browse files Browse the repository at this point in the history
  • Loading branch information
mherman22 committed Dec 18, 2023
1 parent 7b1cfcb commit b20611d
Show file tree
Hide file tree
Showing 23 changed files with 67 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
*/
package org.openmrs.module.fhir2.api.util;

import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.SessionFactory;
import org.openmrs.module.fhir2.api.dao.impl.OpenmrsFhirCriteriaContext;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -22,6 +25,8 @@
public class OpenmrsCriteriaContextUtils {

@Autowired
@Getter(AccessLevel.PUBLIC)
@Setter(AccessLevel.PUBLIC)
@Qualifier("sessionFactory")
public static SessionFactory sessionFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
import org.openmrs.module.fhir2.TestFhirSpringConfiguration;
import org.openmrs.module.fhir2.api.FhirGlobalPropertyService;
import org.openmrs.module.fhir2.api.dao.FhirConceptDao;
import org.openmrs.test.BaseModuleContextSensitiveTest;
import org.openmrs.module.fhir2.api.util.OpenmrsCriteriaContextUtils;
import org.openmrs.test.jupiter.BaseModuleContextSensitiveTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.ContextConfiguration;
Expand Down Expand Up @@ -57,7 +58,7 @@ public class FhirAllergyIntoleranceDaoImplTest extends BaseModuleContextSensitiv
@Before
public void setup() throws Exception {
allergyDao = new FhirAllergyIntoleranceDaoImpl();
allergyDao.setSessionFactory(sessionFactory);
OpenmrsCriteriaContextUtils.setSessionFactory(sessionFactory);
allergyDao.setGlobalPropertyService(globalPropertyService);
executeDataSet(ALLERGY_INTOLERANCE_INITIAL_DATA_XML);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import org.openmrs.api.context.Context;
import org.openmrs.module.fhir2.TestFhirSpringConfiguration;
import org.openmrs.module.fhir2.api.dao.FhirConceptDao;
import org.openmrs.test.BaseModuleContextSensitiveTest;
import org.openmrs.test.jupiter.BaseModuleContextSensitiveTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.ContextConfiguration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
import org.openmrs.api.ConceptService;
import org.openmrs.api.PatientService;
import org.openmrs.module.fhir2.TestFhirSpringConfiguration;
import org.openmrs.test.BaseModuleContextSensitiveTest;
import org.openmrs.module.fhir2.api.util.OpenmrsCriteriaContextUtils;
import org.openmrs.test.jupiter.BaseModuleContextSensitiveTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.ContextConfiguration;
Expand Down Expand Up @@ -67,7 +68,7 @@ public class FhirConditionDaoImpl_Test extends BaseModuleContextSensitiveTest {
@Before
public void setUp() {
dao = new FhirConditionDaoImpl();
dao.setSessionFactory(sessionFactory);
OpenmrsCriteriaContextUtils.setSessionFactory(sessionFactory);

executeDataSet(CONDITION_INITIAL_DATA_XML);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@
import org.openmrs.api.ProviderService;
import org.openmrs.module.fhir2.TestFhirSpringConfiguration;
import org.openmrs.module.fhir2.api.FhirContactPointMapService;
import org.openmrs.module.fhir2.api.util.OpenmrsCriteriaContextUtils;
import org.openmrs.module.fhir2.model.FhirContactPointMap;
import org.openmrs.test.BaseModuleContextSensitiveTest;
import org.openmrs.test.jupiter.BaseModuleContextSensitiveTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;

Expand Down Expand Up @@ -74,7 +75,7 @@ public class FhirContactPointMapDaoImplTest extends BaseModuleContextSensitiveTe
@Before
public void setup() throws Exception {
fhirContactPointMapDao = new FhirContactPointMapDaoImpl();
fhirContactPointMapDao.setSessionFactory(sessionFactory);
OpenmrsCriteriaContextUtils.setSessionFactory(sessionFactory);
personAttributeType = new PersonAttributeType();
locationAttributeType = new LocationAttributeType();
providerAttributeType = new ProviderAttributeType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
import org.openmrs.api.ObsService;
import org.openmrs.api.PatientService;
import org.openmrs.module.fhir2.TestFhirSpringConfiguration;
import org.openmrs.module.fhir2.api.util.OpenmrsCriteriaContextUtils;
import org.openmrs.module.fhir2.model.FhirDiagnosticReport;
import org.openmrs.test.BaseModuleContextSensitiveTest;
import org.openmrs.test.jupiter.BaseModuleContextSensitiveTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.ContextConfiguration;
Expand Down Expand Up @@ -59,7 +60,7 @@ public class FhirDiagnosticReportDaoImplTest extends BaseModuleContextSensitiveT
@Before
public void setup() throws Exception {
dao = new FhirDiagnosticReportDaoImpl();
dao.setSessionFactory(sessionFactory);
OpenmrsCriteriaContextUtils.setSessionFactory(sessionFactory);
executeDataSet(DATA_XML);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
import org.openmrs.module.fhir2.FhirConstants;
import org.openmrs.module.fhir2.TestFhirSpringConfiguration;
import org.openmrs.module.fhir2.api.search.param.SearchParameterMap;
import org.openmrs.test.BaseModuleContextSensitiveTest;
import org.openmrs.module.fhir2.api.util.OpenmrsCriteriaContextUtils;
import org.openmrs.test.jupiter.BaseModuleContextSensitiveTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.ContextConfiguration;
Expand Down Expand Up @@ -71,7 +72,7 @@ public class FhirEncounterDaoImplTest extends BaseModuleContextSensitiveTest {
@Before
public void setUp() throws Exception {
dao = new FhirEncounterDaoImpl();
dao.setSessionFactory(sessionFactory);
OpenmrsCriteriaContextUtils.setSessionFactory(sessionFactory);

executeDataSet(ENCOUNTER_INITIAL_DATA_XML);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
import org.openmrs.GlobalProperty;
import org.openmrs.module.fhir2.FhirConstants;
import org.openmrs.module.fhir2.TestFhirSpringConfiguration;
import org.openmrs.test.BaseModuleContextSensitiveTest;
import org.openmrs.module.fhir2.api.util.OpenmrsCriteriaContextUtils;
import org.openmrs.test.jupiter.BaseModuleContextSensitiveTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;

Expand All @@ -50,7 +51,7 @@ public class FhirGlobalPropertyDaoImplTest extends BaseModuleContextSensitiveTes
@Before
public void setUp() throws Exception {
dao = new FhirGlobalPropertyDaoImpl();
dao.setSessionFactory(sessionFactory);
OpenmrsCriteriaContextUtils.setSessionFactory(sessionFactory);
executeDataSet(PERSON_ATTRIBUTE_TYPE_INITIAL_DATA_XML);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
import org.junit.Test;
import org.openmrs.Cohort;
import org.openmrs.module.fhir2.TestFhirSpringConfiguration;
import org.openmrs.test.BaseModuleContextSensitiveTest;
import org.openmrs.module.fhir2.api.util.OpenmrsCriteriaContextUtils;
import org.openmrs.test.jupiter.BaseModuleContextSensitiveTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.ContextConfiguration;
Expand All @@ -47,7 +48,7 @@ public class FhirGroupDaoImplTest extends BaseModuleContextSensitiveTest {
@Before
public void setup() throws Exception {
dao = new FhirGroupDaoImpl();
dao.setSessionFactory(sessionFactory);
OpenmrsCriteriaContextUtils.setSessionFactory(sessionFactory);
executeDataSet(COHORT_INITIAL_DATA_XML);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
import org.openmrs.LocationTag;
import org.openmrs.api.LocationService;
import org.openmrs.module.fhir2.TestFhirSpringConfiguration;
import org.openmrs.test.BaseModuleContextSensitiveTest;
import org.openmrs.module.fhir2.api.util.OpenmrsCriteriaContextUtils;
import org.openmrs.test.jupiter.BaseModuleContextSensitiveTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.ContextConfiguration;
Expand Down Expand Up @@ -60,7 +61,7 @@ public class FhirLocationDaoImplTest extends BaseModuleContextSensitiveTest {
public void setup() throws Exception {
fhirLocationDao = new FhirLocationDaoImpl();
fhirLocationDao.setLocationService(locationService);
fhirLocationDao.setSessionFactory(sessionFactory);
OpenmrsCriteriaContextUtils.setSessionFactory(sessionFactory);
executeDataSet(LOCATION_INITIAL_DATA_XML);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
import org.openmrs.DrugIngredient;
import org.openmrs.module.fhir2.TestFhirSpringConfiguration;
import org.openmrs.module.fhir2.api.dao.FhirConceptDao;
import org.openmrs.test.BaseModuleContextSensitiveTest;
import org.openmrs.module.fhir2.api.util.OpenmrsCriteriaContextUtils;
import org.openmrs.test.jupiter.BaseModuleContextSensitiveTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.ContextConfiguration;
Expand Down Expand Up @@ -57,7 +58,7 @@ public class FhirMedicationDaoImplTest extends BaseModuleContextSensitiveTest {
@Before
public void setup() throws Exception {
medicationDao = new FhirMedicationDaoImpl();
medicationDao.setSessionFactory(sessionFactory);
OpenmrsCriteriaContextUtils.setSessionFactory(sessionFactory);
executeDataSet(MEDICATION_INITIAL_DATA_XML);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
import org.openmrs.module.fhir2.FhirConstants;
import org.openmrs.module.fhir2.TestFhirSpringConfiguration;
import org.openmrs.module.fhir2.api.search.param.SearchParameterMap;
import org.openmrs.test.BaseModuleContextSensitiveTest;
import org.openmrs.module.fhir2.api.util.OpenmrsCriteriaContextUtils;
import org.openmrs.test.jupiter.BaseModuleContextSensitiveTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.ContextConfiguration;
Expand Down Expand Up @@ -63,7 +64,7 @@ public class FhirMedicationRequestDaoImplTest extends BaseModuleContextSensitive
@Before
public void setup() throws Exception {
medicationRequestDao = new FhirMedicationRequestDaoImpl();
medicationRequestDao.setSessionFactory(sessionFactory);
OpenmrsCriteriaContextUtils.setSessionFactory(sessionFactory);
executeDataSet(MEDICATION_REQUEST_INITIAL_DATA_XML);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.openmrs.module.fhir2.TestFhirSpringConfiguration;
import org.openmrs.module.fhir2.api.dao.FhirObservationDao;
import org.openmrs.module.fhir2.api.search.param.SearchParameterMap;
import org.openmrs.test.BaseModuleContextSensitiveTest;
import org.openmrs.test.jupiter.BaseModuleContextSensitiveTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
import org.junit.Test;
import org.openmrs.PatientIdentifierType;
import org.openmrs.module.fhir2.TestFhirSpringConfiguration;
import org.openmrs.test.BaseModuleContextSensitiveTest;
import org.openmrs.module.fhir2.api.util.OpenmrsCriteriaContextUtils;
import org.openmrs.test.jupiter.BaseModuleContextSensitiveTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;

Expand All @@ -44,7 +45,7 @@ public class FhirPatientDaoImplPatientIdentifierTest extends BaseModuleContextSe
@Before
public void setup() throws Exception {
dao = new FhirPatientDaoImpl();
dao.setSessionFactory(sessionFactory);
OpenmrsCriteriaContextUtils.setSessionFactory(sessionFactory);
executeDataSet(PATIENT_IDENTIFIER_DATA_XML);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
import org.junit.Test;
import org.openmrs.Patient;
import org.openmrs.module.fhir2.TestFhirSpringConfiguration;
import org.openmrs.test.BaseModuleContextSensitiveTest;
import org.openmrs.module.fhir2.api.util.OpenmrsCriteriaContextUtils;
import org.openmrs.test.jupiter.BaseModuleContextSensitiveTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;

Expand All @@ -42,7 +43,7 @@ public class FhirPatientDaoImplTest extends BaseModuleContextSensitiveTest {
@Before
public void setup() throws Exception {
dao = new FhirPatientDaoImpl();
dao.setSessionFactory(sessionFactory);
OpenmrsCriteriaContextUtils.setSessionFactory(sessionFactory);
for (String search_data : PATIENT_SEARCH_DATA_FILES) {
executeDataSet(search_data);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
import org.openmrs.api.PatientService;
import org.openmrs.module.fhir2.TestFhirSpringConfiguration;
import org.openmrs.module.fhir2.api.FhirPatientIdentifierSystemService;
import org.openmrs.module.fhir2.api.util.OpenmrsCriteriaContextUtils;
import org.openmrs.module.fhir2.model.FhirPatientIdentifierSystem;
import org.openmrs.test.BaseModuleContextSensitiveTest;
import org.openmrs.test.jupiter.BaseModuleContextSensitiveTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;

Expand All @@ -50,7 +51,7 @@ public class FhirPatientIdentifierSystemDaoImplTest extends BaseModuleContextSen
@Before
public void setup() throws Exception {
dao = new FhirPatientIdentifierSystemDaoImpl();
dao.setSessionFactory(sessionFactory);
OpenmrsCriteriaContextUtils.setSessionFactory(sessionFactory);
executeDataSet(PATIENT_IDENTIFIER_DATA_XML);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
import org.openmrs.PersonAttribute;
import org.openmrs.api.context.Context;
import org.openmrs.module.fhir2.TestFhirSpringConfiguration;
import org.openmrs.test.BaseModuleContextSensitiveTest;
import org.openmrs.module.fhir2.api.util.OpenmrsCriteriaContextUtils;
import org.openmrs.test.jupiter.BaseModuleContextSensitiveTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.ContextConfiguration;
Expand All @@ -52,7 +53,7 @@ public class FhirPersonDaoImplTest extends BaseModuleContextSensitiveTest {
@Before
public void setup() throws Exception {
fhirPersonDao = new FhirPersonDaoImpl();
fhirPersonDao.setSessionFactory(sessionFactory);
OpenmrsCriteriaContextUtils.setSessionFactory(sessionFactory);
executeDataSet(PERSON_INITIAL_DATA_XML);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
import org.junit.Test;
import org.openmrs.ProviderAttribute;
import org.openmrs.module.fhir2.TestFhirSpringConfiguration;
import org.openmrs.test.BaseModuleContextSensitiveTest;
import org.openmrs.module.fhir2.api.util.OpenmrsCriteriaContextUtils;
import org.openmrs.test.jupiter.BaseModuleContextSensitiveTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.ContextConfiguration;
Expand All @@ -43,7 +44,7 @@ public class FhirPractitionerDaoImplTest extends BaseModuleContextSensitiveTest
@Before
public void setUp() throws Exception {
dao = new FhirPractitionerDaoImpl();
dao.setSessionFactory(sessionFactory);
OpenmrsCriteriaContextUtils.setSessionFactory(sessionFactory);
executeDataSet(PRACTITIONER_INITIAL_DATA_XML);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
import org.junit.Test;
import org.openmrs.Relationship;
import org.openmrs.module.fhir2.TestFhirSpringConfiguration;
import org.openmrs.test.BaseModuleContextSensitiveTest;
import org.openmrs.module.fhir2.api.util.OpenmrsCriteriaContextUtils;
import org.openmrs.test.jupiter.BaseModuleContextSensitiveTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.ContextConfiguration;
Expand All @@ -46,7 +47,7 @@ public class FhirRelatedPersonDaoImplTest extends BaseModuleContextSensitiveTest
@Before
public void setup() throws Exception {
relatedPersonDao = new FhirRelatedPersonDaoImpl();
relatedPersonDao.setSessionFactory(sessionFactory);
OpenmrsCriteriaContextUtils.setSessionFactory(sessionFactory);
executeDataSet(RELATIONSHIP_DATA_XML);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
import org.openmrs.OrderType;
import org.openmrs.TestOrder;
import org.openmrs.module.fhir2.TestFhirSpringConfiguration;
import org.openmrs.test.BaseModuleContextSensitiveTest;
import org.openmrs.module.fhir2.api.util.OpenmrsCriteriaContextUtils;
import org.openmrs.test.jupiter.BaseModuleContextSensitiveTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.ContextConfiguration;
Expand All @@ -48,7 +49,7 @@ public void setup() throws Exception {
executeDataSet(TEST_ORDER_INITIAL_DATA);

dao = new FhirServiceRequestDaoImpl();
dao.setSessionFactory(sessionFactory);
OpenmrsCriteriaContextUtils.setSessionFactory(sessionFactory);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@
import org.openmrs.api.db.hibernate.HibernateConceptDAO;
import org.openmrs.module.fhir2.FhirConstants;
import org.openmrs.module.fhir2.TestFhirSpringConfiguration;
import org.openmrs.module.fhir2.api.util.OpenmrsCriteriaContextUtils;
import org.openmrs.module.fhir2.model.FhirReference;
import org.openmrs.module.fhir2.model.FhirTask;
import org.openmrs.module.fhir2.model.FhirTaskInput;
import org.openmrs.module.fhir2.model.FhirTaskOutput;
import org.openmrs.test.BaseModuleContextSensitiveTest;
import org.openmrs.test.jupiter.BaseModuleContextSensitiveTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;

Expand Down Expand Up @@ -70,7 +71,7 @@ public class FhirTaskDaoImplTest extends BaseModuleContextSensitiveTest {
@Before
public void setup() throws Exception {
dao = new FhirTaskDaoImpl();
dao.setSessionFactory(sessionFactory);
OpenmrsCriteriaContextUtils.setSessionFactory(sessionFactory);
executeDataSet(TASK_DATA_XML);
}

Expand Down
Loading

0 comments on commit b20611d

Please sign in to comment.