diff --git a/shrclient-omod/src/main/java/org/openmrs/module/shrclient/advice/SHREncounterEventService.java b/shrclient-omod/src/main/java/org/openmrs/module/shrclient/advice/SHREncounterEventService.java
index c38ae70f..b515a953 100644
--- a/shrclient-omod/src/main/java/org/openmrs/module/shrclient/advice/SHREncounterEventService.java
+++ b/shrclient-omod/src/main/java/org/openmrs/module/shrclient/advice/SHREncounterEventService.java
@@ -24,15 +24,11 @@
@Component
public class SHREncounterEventService {
- private AtomFeedSpringTransactionManager atomFeedSpringTransactionManager;
- private final EventService eventService;
private GlobalPropertyLookUpService globalPropertyLookUpService;
@Autowired
public SHREncounterEventService(GlobalPropertyLookUpService globalPropertyLookUpService) {
this.globalPropertyLookUpService = globalPropertyLookUpService;
- this.atomFeedSpringTransactionManager = findTransactionManager();
- this.eventService = getEventService(atomFeedSpringTransactionManager);
}
public void raiseShrEncounterDownloadEvent(Encounter newEmrEncounter) {
@@ -40,6 +36,8 @@ public void raiseShrEncounterDownloadEvent(Encounter newEmrEncounter) {
if (StringUtils.isNotBlank(shrEncounterEventCategory)) {
String url = String.format(ENCOUNTER_REST_URL, newEmrEncounter.getUuid());
final Event event = new Event(UUID.randomUUID().toString(), shrEncounterEventCategory, DateTime.now(), (URI) null, url, shrEncounterEventCategory);
+ AtomFeedSpringTransactionManager atomFeedSpringTransactionManager = findTransactionManager();
+ final EventService eventService = getEventService(atomFeedSpringTransactionManager);
atomFeedSpringTransactionManager.executeWithTransaction(
new AFTransactionWorkWithoutResult() {
@Override
diff --git a/shrclient-omod/src/test/java/org/openmrs/module/shrclient/service/EMREncounterServiceIT.java b/shrclient-omod/src/test/java/org/openmrs/module/shrclient/service/EMREncounterServiceIT.java
index 52652571..9a293ea8 100644
--- a/shrclient-omod/src/test/java/org/openmrs/module/shrclient/service/EMREncounterServiceIT.java
+++ b/shrclient-omod/src/test/java/org/openmrs/module/shrclient/service/EMREncounterServiceIT.java
@@ -13,10 +13,6 @@
import org.openmrs.*;
import org.openmrs.api.*;
import org.openmrs.module.fhir.mapper.emr.FHIRMapper;
-import org.openmrs.api.EncounterService;
-import org.openmrs.api.PatientService;
-import org.openmrs.api.ProviderService;
-import org.openmrs.api.VisitService;
import org.openmrs.module.fhir.utils.DateUtil;
import org.openmrs.module.fhir.utils.FHIRBundleHelper;
import org.openmrs.module.shrclient.advice.SHREncounterEventService;
@@ -72,14 +68,13 @@ public class EMREncounterServiceIT extends BaseModuleWebContextSensitiveTest {
private EMRPatientMergeService emrPatientMergeService;
@Autowired
private VisitLookupService visitLookupService;
- @Mock
+ @Autowired
private SHREncounterEventService shrEncounterEventService;
private EMREncounterService emrEncounterService;
@Before
public void setUp() throws Exception {
- initMocks();
emrEncounterService = new EMREncounterServiceImpl(emrPatientService, idMappingRepository, propertiesReader, systemUserService,
visitService, fhirMapper, orderService, patientDeathService, emrPatientMergeService, visitLookupService, shrEncounterEventService);
executeDataSet("testDataSets/omrsGlobalPropertyTestDS.xml");
diff --git a/shrclient-omod/src/test/resources/testDataSets/shrClientEncounterReverseSyncTestDS.xml b/shrclient-omod/src/test/resources/testDataSets/shrClientEncounterReverseSyncTestDS.xml
index 84b05077..1a2be589 100644
--- a/shrclient-omod/src/test/resources/testDataSets/shrClientEncounterReverseSyncTestDS.xml
+++ b/shrclient-omod/src/test/resources/testDataSets/shrClientEncounterReverseSyncTestDS.xml
@@ -49,8 +49,6 @@
-
-