Skip to content

Commit b04ca90

Browse files
author
nehashri
committed
Neha | bdshr-1272 | minor refactoring.
1 parent 81f1c57 commit b04ca90

3 files changed

Lines changed: 3 additions & 12 deletions

File tree

shrclient-omod/src/main/java/org/openmrs/module/shrclient/advice/SHREncounterEventService.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,20 @@
2424

2525
@Component
2626
public class SHREncounterEventService {
27-
private AtomFeedSpringTransactionManager atomFeedSpringTransactionManager;
28-
private final EventService eventService;
2927
private GlobalPropertyLookUpService globalPropertyLookUpService;
3028

3129
@Autowired
3230
public SHREncounterEventService(GlobalPropertyLookUpService globalPropertyLookUpService) {
3331
this.globalPropertyLookUpService = globalPropertyLookUpService;
34-
this.atomFeedSpringTransactionManager = findTransactionManager();
35-
this.eventService = getEventService(atomFeedSpringTransactionManager);
3632
}
3733

3834
public void raiseShrEncounterDownloadEvent(Encounter newEmrEncounter) {
3935
String shrEncounterEventCategory = globalPropertyLookUpService.getGlobalPropertyValue(GLOBAL_PROPERTY_SHR_CATEGORY_EVENT);
4036
if (StringUtils.isNotBlank(shrEncounterEventCategory)) {
4137
String url = String.format(ENCOUNTER_REST_URL, newEmrEncounter.getUuid());
4238
final Event event = new Event(UUID.randomUUID().toString(), shrEncounterEventCategory, DateTime.now(), (URI) null, url, shrEncounterEventCategory);
39+
AtomFeedSpringTransactionManager atomFeedSpringTransactionManager = findTransactionManager();
40+
final EventService eventService = getEventService(atomFeedSpringTransactionManager);
4341
atomFeedSpringTransactionManager.executeWithTransaction(
4442
new AFTransactionWorkWithoutResult() {
4543
@Override

shrclient-omod/src/test/java/org/openmrs/module/shrclient/service/EMREncounterServiceIT.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313
import org.openmrs.*;
1414
import org.openmrs.api.*;
1515
import org.openmrs.module.fhir.mapper.emr.FHIRMapper;
16-
import org.openmrs.api.EncounterService;
17-
import org.openmrs.api.PatientService;
18-
import org.openmrs.api.ProviderService;
19-
import org.openmrs.api.VisitService;
2016
import org.openmrs.module.fhir.utils.DateUtil;
2117
import org.openmrs.module.fhir.utils.FHIRBundleHelper;
2218
import org.openmrs.module.shrclient.advice.SHREncounterEventService;
@@ -72,14 +68,13 @@ public class EMREncounterServiceIT extends BaseModuleWebContextSensitiveTest {
7268
private EMRPatientMergeService emrPatientMergeService;
7369
@Autowired
7470
private VisitLookupService visitLookupService;
75-
@Mock
71+
@Autowired
7672
private SHREncounterEventService shrEncounterEventService;
7773

7874
private EMREncounterService emrEncounterService;
7975

8076
@Before
8177
public void setUp() throws Exception {
82-
initMocks();
8378
emrEncounterService = new EMREncounterServiceImpl(emrPatientService, idMappingRepository, propertiesReader, systemUserService,
8479
visitService, fhirMapper, orderService, patientDeathService, emrPatientMergeService, visitLookupService, shrEncounterEventService);
8580
executeDataSet("testDataSets/omrsGlobalPropertyTestDS.xml");

shrclient-omod/src/test/resources/testDataSets/shrClientEncounterReverseSyncTestDS.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@
4949
<shr_id_mapping id="222" internal_id="50ab30be-98af-4dfd-bd04-5455937c443f" external_id="10000069" type="fr_location" uri="http://localhost:9997/api/1.0/facilities/10000069.json"></shr_id_mapping>
5050

5151
<global_property property="shr.system.user" property_value="777" description="Shr System User" uuid="lkieyg88-efd9-fda3-2b99-z12aalsa677h"/>
52-
<global_property property="shr.system.shrCategoryForEncounterEvents" property_value="ShrEncounter" description="Shr System Encounter Event Category" uuid="lkieyg88-efd9-fda3-2b99-z12aalsx67xh"/>
53-
5452

5553
<concept_reference_source concept_source_id="1" name="ICD10-BD" creator="1" date_created="2004-08-12 00:00:00.0" uuid="b5e44116-778f-11e2-ad73-903c7bb72694"/>
5654

0 commit comments

Comments
 (0)