From 09d2599ce5ef08e837b88df0fb98a97f7e856249 Mon Sep 17 00:00:00 2001 From: Ken Stevens Date: Tue, 3 Dec 2019 16:01:52 -0500 Subject: [PATCH] fix test --- .../jpa/search/reindex/ResourceReindexingSvcImpl.java | 5 +++++ .../search/reindex/ResourceReindexingSvcImplTest.java | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/reindex/ResourceReindexingSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/reindex/ResourceReindexingSvcImpl.java index d26bcf28657..deb7ab62ef1 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/reindex/ResourceReindexingSvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/reindex/ResourceReindexingSvcImpl.java @@ -142,6 +142,11 @@ public class ResourceReindexingSvcImpl implements IResourceReindexingSvc { myContext = theContext; } + @VisibleForTesting + void setSchedulerServiceForUnitTest(ISchedulerService theSchedulerService) { + mySchedulerService = theSchedulerService; + } + @PostConstruct public void start() { myTxTemplate = new TransactionTemplate(myTxManager); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/search/reindex/ResourceReindexingSvcImplTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/search/reindex/ResourceReindexingSvcImplTest.java index df545aa87fe..626957b7a3d 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/search/reindex/ResourceReindexingSvcImplTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/search/reindex/ResourceReindexingSvcImplTest.java @@ -1,16 +1,13 @@ package ca.uhn.fhir.jpa.search.reindex; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.dao.BaseHapiFhirDao; -import ca.uhn.fhir.jpa.dao.BaseJpaTest; -import ca.uhn.fhir.jpa.dao.DaoConfig; -import ca.uhn.fhir.jpa.dao.DaoRegistry; -import ca.uhn.fhir.jpa.dao.IFhirResourceDao; +import ca.uhn.fhir.jpa.dao.*; import ca.uhn.fhir.jpa.dao.data.IForcedIdDao; import ca.uhn.fhir.jpa.dao.data.IResourceReindexJobDao; import ca.uhn.fhir.jpa.dao.data.IResourceTableDao; import ca.uhn.fhir.jpa.entity.ResourceReindexJobEntity; import ca.uhn.fhir.jpa.model.entity.ResourceTable; +import ca.uhn.fhir.jpa.model.sched.ISchedulerService; import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistry; import org.apache.commons.lang3.time.DateUtils; import org.hl7.fhir.instance.model.api.IBaseResource; @@ -72,6 +69,8 @@ public class ResourceReindexingSvcImplTest extends BaseJpaTest { private ISearchParamRegistry mySearchParamRegistry; @Mock private TransactionStatus myTxStatus; + @Mock + private ISchedulerService mySchedulerService; @Override protected FhirContext getContext() { @@ -97,6 +96,7 @@ public class ResourceReindexingSvcImplTest extends BaseJpaTest { mySvc.setResourceTableDaoForUnitTest(myResourceTableDao); mySvc.setTxManagerForUnitTest(myTxManager); mySvc.setSearchParamRegistryForUnitTest(mySearchParamRegistry); + mySvc.setSchedulerServiceForUnitTest(mySchedulerService); mySvc.start(); when(myTxManager.getTransaction(any())).thenReturn(myTxStatus);