Some configs don't publish and FullText service at all. Make it optional.
This commit is contained in:
parent
79e2800f3e
commit
11c5f7ee87
|
@ -63,7 +63,9 @@ import org.hibernate.SessionFactory;
|
|||
import org.hibernate.search.backend.lucene.cfg.LuceneBackendSettings;
|
||||
import org.hibernate.search.backend.lucene.cfg.LuceneIndexSettings;
|
||||
import org.hibernate.search.engine.cfg.BackendSettings;
|
||||
import org.hibernate.search.mapper.orm.Search;
|
||||
import org.hibernate.search.mapper.orm.cfg.HibernateOrmMapperSettings;
|
||||
import org.hibernate.search.mapper.orm.session.SearchSession;
|
||||
import org.hl7.fhir.common.hapi.validation.validator.FhirInstanceValidator;
|
||||
import org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent;
|
||||
import org.hl7.fhir.dstu3.model.Resource;
|
||||
|
@ -90,6 +92,7 @@ import org.springframework.transaction.support.TransactionCallbackWithoutResult;
|
|||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.persistence.EntityManager;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
|
@ -185,10 +188,9 @@ public abstract class BaseJpaTest extends BaseTest {
|
|||
private IResourceHistoryTableDao myResourceHistoryTableDao;
|
||||
@Autowired
|
||||
private IForcedIdDao myForcedIdDao;
|
||||
@Autowired
|
||||
@Autowired(required = false)
|
||||
protected IFulltextSearchSvc myFulltestSearchSvc;
|
||||
|
||||
|
||||
@AfterEach
|
||||
public void afterPerformCleanup() {
|
||||
BaseHapiFhirDao.setDisableIncrementOnUpdateForUnitTest(false);
|
||||
|
@ -259,6 +261,16 @@ public abstract class BaseJpaTest extends BaseTest {
|
|||
return deliveryLatch;
|
||||
}
|
||||
|
||||
protected void purgeHibernateSearch(EntityManager theEntityManager) {
|
||||
runInTransaction(() -> {
|
||||
if (myFulltestSearchSvc != null && !myFulltestSearchSvc.isDisabled()) {
|
||||
SearchSession searchSession = Search.session(theEntityManager);
|
||||
searchSession.workspace(ResourceTable.class).purge();
|
||||
searchSession.indexingPlan().execute();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected abstract FhirContext getContext();
|
||||
|
||||
protected abstract PlatformTransactionManager getTxManager();
|
||||
|
|
|
@ -226,15 +226,7 @@ public abstract class BaseJpaDstu2Test extends BaseJpaTest {
|
|||
|
||||
@BeforeEach
|
||||
public void beforeFlushFT() {
|
||||
if (!myFulltestSearchSvc.isDisabled()) {
|
||||
runInTransaction(() -> {
|
||||
SearchSession searchSession = Search.session(myEntityManager);
|
||||
searchSession.workspace(ResourceTable.class).purge();
|
||||
// searchSession.workspace(ResourceIndexedSearchParamString.class).purge();
|
||||
searchSession.indexingPlan().execute();
|
||||
});
|
||||
}
|
||||
|
||||
purgeHibernateSearch(myEntityManager);
|
||||
|
||||
myDaoConfig.setSchedulingDisabled(true);
|
||||
myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED);
|
||||
|
|
|
@ -386,14 +386,7 @@ public abstract class BaseJpaDstu3Test extends BaseJpaTest {
|
|||
|
||||
@BeforeEach
|
||||
public void beforeFlushFT() {
|
||||
if (!myFulltestSearchSvc.isDisabled()) {
|
||||
runInTransaction(() -> {
|
||||
SearchSession searchSession = Search.session(myEntityManager);
|
||||
searchSession.workspace(ResourceTable.class).purge();
|
||||
// searchSession.workspace(ResourceIndexedSearchParamString.class).purge();
|
||||
searchSession.indexingPlan().execute();
|
||||
});
|
||||
}
|
||||
purgeHibernateSearch(myEntityManager);
|
||||
|
||||
myDaoConfig.setSchedulingDisabled(true);
|
||||
myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED);
|
||||
|
|
|
@ -550,13 +550,7 @@ public abstract class BaseJpaR4Test extends BaseJpaTest implements ITestDataBuil
|
|||
|
||||
@BeforeEach
|
||||
public void beforeFlushFT() {
|
||||
runInTransaction(() -> {
|
||||
if (!myFulltestSearchSvc.isDisabled()) {
|
||||
SearchSession searchSession = Search.session(myEntityManager);
|
||||
searchSession.workspace(ResourceTable.class).purge();
|
||||
searchSession.indexingPlan().execute();
|
||||
}
|
||||
});
|
||||
purgeHibernateSearch(this.myEntityManager);
|
||||
|
||||
myDaoConfig.setSchedulingDisabled(true);
|
||||
myDaoConfig.setIndexMissingFields(new DaoConfig().getIndexMissingFields());
|
||||
|
|
|
@ -477,13 +477,7 @@ public abstract class BaseJpaR5Test extends BaseJpaTest implements ITestDataBuil
|
|||
|
||||
@BeforeEach
|
||||
public void beforeFlushFT() {
|
||||
runInTransaction(() -> {
|
||||
if (!myFulltestSearchSvc.isDisabled()) {
|
||||
SearchSession searchSession = Search.session(myEntityManager);
|
||||
searchSession.workspace(ResourceTable.class).purge();
|
||||
searchSession.indexingPlan().execute();
|
||||
}
|
||||
});
|
||||
purgeHibernateSearch(myEntityManager);
|
||||
|
||||
myDaoConfig.setSchedulingDisabled(true);
|
||||
myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED);
|
||||
|
|
Loading…
Reference in New Issue