From c32e8d42b3c07d8761770def40817483039defdc Mon Sep 17 00:00:00 2001 From: James Agnew Date: Tue, 5 Sep 2017 18:04:46 -0700 Subject: [PATCH] Fix more tests --- .../src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java | 2 +- .../jpa/dao/dstu3/FhirResourceDaoSearchParameterDstu3.java | 5 +++++ .../src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java | 6 ++++-- .../java/ca/uhn/fhir/jpa/dao/dstu2/BaseJpaDstu2Test.java | 4 +++- .../java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java | 2 +- .../FhirResourceDaoDstu3SearchWithLuceneDisabledTest.java | 4 +++- .../src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java | 2 +- .../r4/FhirResourceDaoR4SearchWithLuceneDisabledTest.java | 4 +++- 8 files changed, 21 insertions(+), 8 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java index 36a7a8c36c5..e750cbb110b 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java @@ -1423,7 +1423,7 @@ public abstract class BaseHapiFhirDao implements IDao { coordsParams = Collections.emptySet(); links = Collections.emptySet(); compositeStringUniques = Collections.emptySet(); - + theEntity.setDeleted(theDeletedTimestampOrNull); theEntity.setUpdated(theDeletedTimestampOrNull); theEntity.setNarrativeTextParsedIntoWords(null); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoSearchParameterDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoSearchParameterDstu3.java index 7a5388e979e..01b06e06048 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoSearchParameterDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoSearchParameterDstu3.java @@ -7,6 +7,7 @@ import ca.uhn.fhir.jpa.dao.ISearchParamRegistry; import ca.uhn.fhir.jpa.entity.ResourceTable; import ca.uhn.fhir.parser.DataFormatException; import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException; +import ca.uhn.fhir.util.ElementUtil; import org.apache.commons.lang3.time.DateUtils; import org.hl7.fhir.dstu3.model.Bundle; import org.hl7.fhir.dstu3.model.Enumerations; @@ -126,6 +127,10 @@ public class FhirResourceDaoSearchParameterDstu3 extends FhirResourceDaoDstu3 toCodes(Set theConcepts) { - HashSet retVal = new HashSet(); + HashSet retVal = new HashSet<>(); for (TermConcept next : theConcepts) { retVal.add(next.getCode()); } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/BaseJpaDstu2Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/BaseJpaDstu2Test.java index f985491609a..ec8a5b9f58e 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/BaseJpaDstu2Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/BaseJpaDstu2Test.java @@ -146,6 +146,8 @@ protected IFhirResourceDao myMedicationAdministrationD @Autowired @Qualifier("myValueSetDaoDstu2") protected IFhirResourceDaoValueSet myValueSetDao; + @Autowired + private ISearchParamRegistry mySearchParamRegistry; @Before public void beforeCreateInterceptor() { @@ -167,7 +169,7 @@ protected IFhirResourceDao myMedicationAdministrationD @Transactional() public void beforePurgeDatabase() { final EntityManager entityManager = this.myEntityManager; - purgeDatabase(entityManager, myTxManager, mySearchParamPresenceSvc, mySearchCoordinatorSvc); + purgeDatabase(entityManager, myTxManager, mySearchParamPresenceSvc, mySearchCoordinatorSvc, mySearchParamRegistry); } @Before diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java index 41837e312b6..6e21d4d9094 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java @@ -250,7 +250,7 @@ public abstract class BaseJpaDstu3Test extends BaseJpaTest { @Transactional() public void beforePurgeDatabase() { final EntityManager entityManager = this.myEntityManager; - purgeDatabase(entityManager, myTxManager, mySearchParamPresenceSvc, mySearchCoordinatorSvc); + purgeDatabase(entityManager, myTxManager, mySearchParamPresenceSvc, mySearchCoordinatorSvc, mySearchParamRegsitry); } @Before diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchWithLuceneDisabledTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchWithLuceneDisabledTest.java index 563cd6e7fbf..481e9e4ccd9 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchWithLuceneDisabledTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchWithLuceneDisabledTest.java @@ -146,12 +146,14 @@ public class FhirResourceDaoDstu3SearchWithLuceneDisabledTest extends BaseJpaTes private IValidationSupport myValidationSupport; @Autowired protected ISearchCoordinatorSvc mySearchCoordinatorSvc; + @Autowired + protected ISearchParamRegistry mySearchParamRegistry; @Before @Transactional() public void beforePurgeDatabase() { final EntityManager entityManager = this.myEntityManager; - purgeDatabase(entityManager, myTxManager, mySearchParamPresenceSvc, mySearchCoordinatorSvc); + purgeDatabase(entityManager, myTxManager, mySearchParamPresenceSvc, mySearchCoordinatorSvc, mySearchParamRegistry); } @Before diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java index e2b34d7eef5..3891ab361ef 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java @@ -247,7 +247,7 @@ public abstract class BaseJpaR4Test extends BaseJpaTest { @Transactional() public void beforePurgeDatabase() { final EntityManager entityManager = this.myEntityManager; - purgeDatabase(entityManager, myTxManager, mySearchParamPresenceSvc, mySearchCoordinatorSvc); + purgeDatabase(entityManager, myTxManager, mySearchParamPresenceSvc, mySearchCoordinatorSvc, mySearchParamRegsitry); } @Before diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchWithLuceneDisabledTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchWithLuceneDisabledTest.java index 3010af0f871..58b6ec334cf 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchWithLuceneDisabledTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchWithLuceneDisabledTest.java @@ -146,12 +146,14 @@ public class FhirResourceDaoR4SearchWithLuceneDisabledTest extends BaseJpaTest { private IValidationSupport myValidationSupport; @Autowired protected ISearchCoordinatorSvc mySearchCoordinatorSvc; + @Autowired + protected ISearchParamRegistry mySearchParamRegistry; @Before @Transactional() public void beforePurgeDatabase() { final EntityManager entityManager = this.myEntityManager; - purgeDatabase(entityManager, myTxManager, mySearchParamPresenceSvc, mySearchCoordinatorSvc); + purgeDatabase(entityManager, myTxManager, mySearchParamPresenceSvc, mySearchCoordinatorSvc, mySearchParamRegistry); } @Before