HAPI FHIR Dependency Bumps (#5576)

* HAPI FHIR Dependency Bumps

* Hibernate search 6

* Dep bumps

* Bump mockito

* Fix memory leak

* Test cleanup

* Test fix

* Test fixes

* Test fix

* Test fix

* Test fix

* Test fix

* Prepare to try and rework max clauses

* Refactor large VS expansion

* Spotless

* Test fix

* Version bump

* Test fixes

* Bump maven container

* Build fix

* Add license headers

* Version bump

* License headers
This commit is contained in:
James Agnew 2024-01-14 14:15:08 -05:00 committed by GitHub
parent 5286829585
commit 878e27b06d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
153 changed files with 580 additions and 418 deletions

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -209,7 +209,7 @@ public class GenericClientDstu3IT {
@Test @Test
public void testClientFailures() { public void testClientFailures() {
ResponseBody body = mock(ResponseBody.class); ResponseBody body = mock(ResponseBody.class);
when(body.source()).thenThrow(IllegalStateException.class, RuntimeException.class); when(body.byteStream()).thenThrow(IllegalStateException.class, RuntimeException.class);
myHttpResponse = new Response.Builder() myHttpResponse = new Response.Builder()
.request(myRequest) .request(myRequest)

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -1,3 +1,22 @@
/*-
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2024 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.model.api; package ca.uhn.fhir.model.api;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-bom</artifactId> <artifactId>hapi-fhir-bom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>HAPI FHIR BOM</name> <name>HAPI FHIR BOM</name>
@ -12,7 +12,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-cli</artifactId> <artifactId>hapi-fhir-cli</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -4,20 +4,24 @@
title: "The version of a few dependencies have been bumped to the latest versions title: "The version of a few dependencies have been bumped to the latest versions
(dependent HAPI modules listed in brackets): (dependent HAPI modules listed in brackets):
<ul> <ul>
<li>Jackson (Base): 2.15.3 -&gt; 2.16.0</li> <li>Jackson (Base): 2.15.3 -&gt; 2.16.1</li>
<li>SLF4j (Base): 2.0.3 -&gt; 2.0.9</li> <li>SLF4j (Base): 2.0.3 -&gt; 2.0.9</li>
<li>Logback (Base): 1.4.7 -&gt; 1.4.14</li> <li>Logback (Base): 1.4.7 -&gt; 1.4.14</li>
<li>Caffeine (Base): 3.1.1 -&gt; 3.1.8</li> <li>Caffeine (Base): 3.1.1 -&gt; 3.1.8</li>
<li>Spring Framework (JPA): 5.3.27 -&gt; 6.1.1</li> <li>Spring Framework (JPA): 5.3.27 -&gt; 6.1.1</li>
<li>Spring Boot (JPA-Starter): 5.3.27 -&gt; 6.2.0</li> <li>Spring Boot (JPA-Starter): 5.3.27 -&gt; 6.2.0</li>
<li>Spring Data BOM (JPA): 2021.2.2 -&gt; 2023.1.0</li> <li>Spring Data BOM (JPA): 2021.2.2 -&gt; 2023.1.0</li>
<li>Hibernate (JPA): 5.6.15.Final -&gt; 6.4.0.Final</li> <li>Hibernate (JPA): 5.6.15.Final -&gt; 6.4.1.Final</li>
<li>Hibernate Validator (JPA): 6.1.5.Final -&gt; 8.0.0.Final</li> <li>Hibernate Validator (JPA): 6.1.5.Final -&gt; 8.0.0.Final</li>
<li>Hibernate Search (JPA): 6.1.6.Final -&gt; 6.2.2.Final</li> <li>Hibernate Search (JPA): 6.1.6.Final -&gt; 7.0.0.Final</li>
<li>Commons-DBCP2 (JPA): 2.9.0 -&gt; 2.11.0</li> <li>Commons-DBCP2 (JPA): 2.9.0 -&gt; 2.11.0</li>
<li>DataSource-Proxy (JPA): 1.9 -&gt; 1.10</li>
<li>Spring Boot (Boot+Starter): 2.7.12 -&gt; 3.1.4</li> <li>Spring Boot (Boot+Starter): 2.7.12 -&gt; 3.1.4</li>
<li>Jetty (CLI): 10.0.14 -&gt; 12.0.3</li> <li>Jetty (CLI): 10.0.14 -&gt; 12.0.3</li>
<li>Jansi (CLI): 2.4.0 -&gt; 2.4.1</li> <li>Jansi (CLI): 2.4.0 -&gt; 2.4.1</li>
<li>Derby (CLI): 10.14.2.0 -&gt; 10.17.1.0</li>
<li>Commons-Lang3 (CLI): 3.12.0 -&gt; 3.14.0</li>
<li>Commons-CSV (CLI): 1.8 -&gt; 1.10.0</li>
<li>Phloc Schematron (Schematron Validator): 5.6.5 -&gt; 7.1.2</li> <li>Phloc Schematron (Schematron Validator): 5.6.5 -&gt; 7.1.2</li>
<li>RestEasy (JAX-RS Server): 5.0.2.Final -&gt; 6.2.5.Final</li> <li>RestEasy (JAX-RS Server): 5.0.2.Final -&gt; 6.2.5.Final</li>
</ul>" </ul>"

View File

@ -11,7 +11,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>
@ -53,7 +53,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.hibernate.search</groupId> <groupId>org.hibernate.search</groupId>
<artifactId>hibernate-search-mapper-orm-orm6</artifactId> <artifactId>hibernate-search-mapper-orm</artifactId>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>org.apache.logging.log4j</groupId> <groupId>org.apache.logging.log4j</groupId>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>
@ -340,11 +340,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.lucene</groupId> <groupId>org.apache.lucene</groupId>
<artifactId>lucene-analyzers-phonetic</artifactId> <artifactId>lucene-analysis-phonetic</artifactId>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-backward-codecs</artifactId>
</dependency> </dependency>
<!-- Misc --> <!-- Misc -->
<dependency> <dependency>

View File

@ -111,7 +111,7 @@ public class JpaBulkExportProcessor implements IBulkExportProcessor<JpaPid> {
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
@Autowired @Autowired
private IMdmLinkDao myMdmLinkDao; protected IMdmLinkDao myMdmLinkDao;
@Autowired @Autowired
private MdmExpansionCacheSvc myMdmExpansionCacheSvc; private MdmExpansionCacheSvc myMdmExpansionCacheSvc;

View File

@ -582,7 +582,7 @@ public class IdHelperService implements IIdHelperService<JpaPid> {
return retVal; return retVal;
} }
RequestPartitionId replaceDefault(RequestPartitionId theRequestPartitionId) { public RequestPartitionId replaceDefault(RequestPartitionId theRequestPartitionId) {
if (myPartitionSettings.getDefaultPartitionId() != null) { if (myPartitionSettings.getDefaultPartitionId() != null) {
if (!theRequestPartitionId.isAllPartitions() && theRequestPartitionId.hasDefaultPartitionId()) { if (!theRequestPartitionId.isAllPartitions() && theRequestPartitionId.hasDefaultPartitionId()) {
List<Integer> partitionIds = theRequestPartitionId.getPartitionIds().stream() List<Integer> partitionIds = theRequestPartitionId.getPartitionIds().stream()
@ -712,7 +712,7 @@ public class IdHelperService implements IIdHelperService<JpaPid> {
} }
@VisibleForTesting @VisibleForTesting
void setPartitionSettingsForUnitTest(PartitionSettings thePartitionSettings) { public void setPartitionSettingsForUnitTest(PartitionSettings thePartitionSettings) {
myPartitionSettings = thePartitionSettings; myPartitionSettings = thePartitionSettings;
} }

View File

@ -71,7 +71,7 @@ public class SynchronousSearchSvcImpl implements ISynchronousSearchSvc {
private JpaStorageSettings myStorageSettings; private JpaStorageSettings myStorageSettings;
@Autowired @Autowired
private SearchBuilderFactory mySearchBuilderFactory; protected SearchBuilderFactory mySearchBuilderFactory;
@Autowired @Autowired
private DaoRegistry myDaoRegistry; private DaoRegistry myDaoRegistry;

View File

@ -98,14 +98,13 @@ import jakarta.persistence.EntityManager;
import jakarta.persistence.NonUniqueResultException; import jakarta.persistence.NonUniqueResultException;
import jakarta.persistence.PersistenceContext; import jakarta.persistence.PersistenceContext;
import jakarta.persistence.PersistenceContextType; import jakarta.persistence.PersistenceContextType;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils; import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.lang3.time.DateUtils;
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;
import org.apache.lucene.search.BooleanQuery; import org.apache.lucene.search.IndexSearcher;
import org.hibernate.CacheMode; import org.hibernate.CacheMode;
import org.hibernate.search.engine.search.predicate.dsl.BooleanPredicateClausesStep; import org.hibernate.search.engine.search.predicate.dsl.BooleanPredicateClausesStep;
import org.hibernate.search.engine.search.predicate.dsl.PredicateFinalStep; import org.hibernate.search.engine.search.predicate.dsl.PredicateFinalStep;
@ -175,6 +174,7 @@ import java.util.StringTokenizer;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.function.Supplier;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static ca.uhn.fhir.jpa.entity.TermConceptPropertyBinder.CONCEPT_PROPERTY_PREFIX_NAME; import static ca.uhn.fhir.jpa.entity.TermConceptPropertyBinder.CONCEPT_PROPERTY_PREFIX_NAME;
@ -1135,39 +1135,51 @@ public class TermReadSvcImpl implements ITermReadSvc, IHasScheduledJobs {
} }
int chunkSize = chunkSizeOpt.get(); int chunkSize = chunkSizeOpt.get();
SearchProperties searchProps = buildSearchScroll( /*
* Turn the filter into one or more Hibernate Search queries. Ideally we want it
* to be handled by a single query, but Lucene/ES don't like it when we exceed
* 1024 different terms in a single query. So if we have that many terms (which
* can happen if a ValueSet has a lot of explicitly enumerated codes that it's
* including) we split this into multiple searches. The method below builds these
* searches lazily, returning a Supplier that creates and executes the search
* when it's actually time to.
*/
SearchProperties searchProps = buildSearchScrolls(
theTermCodeSystemVersion, theTermCodeSystemVersion,
theExpansionFilter, theExpansionFilter,
theSystem, theSystem,
theIncludeOrExclude, theIncludeOrExclude,
chunkSize, chunkSize,
includeOrExcludeVersion); includeOrExcludeVersion);
int accumulatedBatchesSoFar = 0; int accumulatedBatchesSoFar = 0;
try (SearchScroll<EntityReference> scroll = searchProps.getSearchScroll()) { for (var next : searchProps.getSearchScroll()) {
try (SearchScroll<EntityReference> scroll = next.get()) {
ourLog.debug( ourLog.debug(
"Beginning batch expansion for {} with max results per batch: {}", "Beginning batch expansion for {} with max results per batch: {}",
(theAdd ? "inclusion" : "exclusion"), (theAdd ? "inclusion" : "exclusion"),
chunkSize); chunkSize);
for (SearchScrollResult<EntityReference> chunk = scroll.next(); chunk.hasHits(); chunk = scroll.next()) { for (SearchScrollResult<EntityReference> chunk = scroll.next();
chunk.hasHits();
chunk = scroll.next()) {
int countForBatch = 0; int countForBatch = 0;
List<Long> pids = chunk.hits().stream().map(t -> (Long) t.id()).collect(Collectors.toList()); List<Long> pids =
chunk.hits().stream().map(t -> (Long) t.id()).collect(Collectors.toList());
List<TermConcept> termConcepts = myTermConceptDao.fetchConceptsAndDesignationsByPid(pids); List<TermConcept> termConcepts = myTermConceptDao.fetchConceptsAndDesignationsByPid(pids);
// If the include section had multiple codes, return the codes in the same order // If the include section had multiple codes, return the codes in the same order
termConcepts = sortTermConcepts(searchProps, termConcepts); termConcepts = sortTermConcepts(searchProps, termConcepts);
// int firstResult = theQueryIndex * maxResultsPerBatch;// TODO GGG HS we lose the ability to check the // int firstResult = theQueryIndex * maxResultsPerBatch;
// TODO GGG HS we lose the ability to check the
// index of the first result, so just best-guessing it here. // index of the first result, so just best-guessing it here.
Optional<PredicateFinalStep> expansionStepOpt = searchProps.getExpansionStepOpt();
int delta = 0; int delta = 0;
for (TermConcept concept : termConcepts) { for (TermConcept concept : termConcepts) {
count++; count++;
countForBatch++; countForBatch++;
if (theAdd && expansionStepOpt.isPresent()) { if (theAdd && searchProps.hasIncludeOrExcludeCodes()) {
ValueSet.ConceptReferenceComponent theIncludeConcept = ValueSet.ConceptReferenceComponent theIncludeConcept =
getMatchedConceptIncludedInValueSet(theIncludeOrExclude, concept); getMatchedConceptIncludedInValueSet(theIncludeOrExclude, concept);
if (theIncludeConcept != null && isNotBlank(theIncludeConcept.getDisplay())) { if (theIncludeConcept != null && isNotBlank(theIncludeConcept.getDisplay())) {
@ -1208,6 +1220,7 @@ public class TermReadSvcImpl implements ITermReadSvc, IHasScheduledJobs {
fullOperationSw.getMillis()); fullOperationSw.getMillis());
} }
} }
}
private List<TermConcept> sortTermConcepts(SearchProperties searchProps, List<TermConcept> termConcepts) { private List<TermConcept> sortTermConcepts(SearchProperties searchProps, List<TermConcept> termConcepts) {
List<String> codes = searchProps.getIncludeOrExcludeCodes(); List<String> codes = searchProps.getIncludeOrExcludeCodes();
@ -1243,7 +1256,7 @@ public class TermReadSvcImpl implements ITermReadSvc, IHasScheduledJobs {
return maxResultsPerBatch > 0 ? Optional.of(maxResultsPerBatch) : Optional.empty(); return maxResultsPerBatch > 0 ? Optional.of(maxResultsPerBatch) : Optional.empty();
} }
private SearchProperties buildSearchScroll( private SearchProperties buildSearchScrolls(
TermCodeSystemVersion theTermCodeSystemVersion, TermCodeSystemVersion theTermCodeSystemVersion,
ExpansionFilter theExpansionFilter, ExpansionFilter theExpansionFilter,
String theSystem, String theSystem,
@ -1255,15 +1268,39 @@ public class TermReadSvcImpl implements ITermReadSvc, IHasScheduledJobs {
SearchPredicateFactory predicate = SearchPredicateFactory predicate =
searchSession.scope(TermConcept.class).predicate(); searchSession.scope(TermConcept.class).predicate();
List<String> allCodes = theIncludeOrExclude.getConcept().stream()
.filter(Objects::nonNull)
.map(ValueSet.ConceptReferenceComponent::getCode)
.filter(StringUtils::isNotBlank)
.collect(Collectors.toList());
SearchProperties returnProps = new SearchProperties();
returnProps.setIncludeOrExcludeCodes(allCodes);
/*
* Lucene/ES can't typically handle more than 1024 clauses per search, so if
* we have more than that number (e.g. because of a ValueSet that explicitly
* includes thousands of codes), we break this up into multiple searches.
*/
List<List<String>> partitionedCodes = ListUtils.partition(allCodes, IndexSearcher.getMaxClauseCount() - 10);
if (partitionedCodes.isEmpty()) {
partitionedCodes = List.of(List.of());
}
for (List<String> nextCodePartition : partitionedCodes) {
Supplier<SearchScroll<EntityReference>> nextScroll = () -> {
// Build the top-level expansion on filters. // Build the top-level expansion on filters.
PredicateFinalStep step = predicate.bool(b -> { PredicateFinalStep step = predicate.bool(b -> {
b.must(predicate.match().field("myCodeSystemVersionPid").matching(theTermCodeSystemVersion.getPid())); b.must(predicate
.match()
.field("myCodeSystemVersionPid")
.matching(theTermCodeSystemVersion.getPid()));
if (theExpansionFilter.hasCode()) { if (theExpansionFilter.hasCode()) {
b.must(predicate.match().field("myCode").matching(theExpansionFilter.getCode())); b.must(predicate.match().field("myCode").matching(theExpansionFilter.getCode()));
} }
String codeSystemUrlAndVersion = buildCodeSystemUrlAndVersion(theSystem, theIncludeOrExcludeVersion); String codeSystemUrlAndVersion =
buildCodeSystemUrlAndVersion(theSystem, theIncludeOrExcludeVersion);
for (ValueSet.ConceptSetFilterComponent nextFilter : theIncludeOrExclude.getFilter()) { for (ValueSet.ConceptSetFilterComponent nextFilter : theIncludeOrExclude.getFilter()) {
handleFilter(codeSystemUrlAndVersion, predicate, b, nextFilter); handleFilter(codeSystemUrlAndVersion, predicate, b, nextFilter);
} }
@ -1272,29 +1309,14 @@ public class TermReadSvcImpl implements ITermReadSvc, IHasScheduledJobs {
} }
}); });
SearchProperties returnProps = new SearchProperties(); // Add a selector on any explicitly enumerated codes in the VS component
final PredicateFinalStep finishedQuery;
List<String> codes = theIncludeOrExclude.getConcept().stream() if (nextCodePartition.isEmpty()) {
.filter(Objects::nonNull) finishedQuery = step;
.map(ValueSet.ConceptReferenceComponent::getCode) } else {
.filter(StringUtils::isNotBlank) PredicateFinalStep expansionStep = buildExpansionPredicate(nextCodePartition, predicate);
.collect(Collectors.toList()); finishedQuery = predicate.bool().must(step).must(expansionStep);
returnProps.setIncludeOrExcludeCodes(codes); }
Optional<PredicateFinalStep> expansionStepOpt = buildExpansionPredicate(codes, predicate);
final PredicateFinalStep finishedQuery =
expansionStepOpt.isPresent() ? predicate.bool().must(step).must(expansionStepOpt.get()) : step;
returnProps.setExpansionStepOpt(expansionStepOpt);
/*
* DM 2019-08-21 - Processing slows after any ValueSets with many codes explicitly identified. This might
* be due to the dark arts that is memory management. Will monitor but not do anything about this right now.
*/
// BooleanQuery.setMaxClauseCount(SearchBuilder.getMaximumPageSize());
// TODO GGG HS looks like we can't set max clause count, but it can be set server side.
// BooleanQuery.setMaxClauseCount(10000);
// JM 22-02-15 - Hopefully increasing maxClauseCount should be not needed anymore
SearchQuery<EntityReference> termConceptsQuery = searchSession SearchQuery<EntityReference> termConceptsQuery = searchSession
.search(TermConcept.class) .search(TermConcept.class)
@ -1302,7 +1324,12 @@ public class TermReadSvcImpl implements ITermReadSvc, IHasScheduledJobs {
.where(f -> finishedQuery) .where(f -> finishedQuery)
.toQuery(); .toQuery();
returnProps.setSearchScroll(termConceptsQuery.scroll(theScrollChunkSize)); return termConceptsQuery.scroll(theScrollChunkSize);
};
returnProps.addSearchScroll(nextScroll);
}
return returnProps; return returnProps;
} }
@ -1317,29 +1344,9 @@ public class TermReadSvcImpl implements ITermReadSvc, IHasScheduledJobs {
/** /**
* Helper method which builds a predicate for the expansion * Helper method which builds a predicate for the expansion
*/ */
private Optional<PredicateFinalStep> buildExpansionPredicate( private PredicateFinalStep buildExpansionPredicate(List<String> theCodes, SearchPredicateFactory thePredicate) {
List<String> theCodes, SearchPredicateFactory thePredicate) { assert !theCodes.isEmpty();
if (CollectionUtils.isEmpty(theCodes)) { return thePredicate.simpleQueryString().field("myCode").matching(String.join(" | ", theCodes));
return Optional.empty();
}
if (theCodes.size() < BooleanQuery.getMaxClauseCount()) {
return Optional.of(thePredicate.simpleQueryString().field("myCode").matching(String.join(" | ", theCodes)));
}
// Number of codes is larger than maxClauseCount, so we split the query in several clauses
// partition codes in lists of BooleanQuery.getMaxClauseCount() size
List<List<String>> listOfLists = ListUtils.partition(theCodes, BooleanQuery.getMaxClauseCount());
PredicateFinalStep step = thePredicate.bool(b -> {
b.minimumShouldMatchNumber(1);
for (List<String> codeList : listOfLists) {
b.should(p -> p.simpleQueryString().field("myCode").matching(String.join(" | ", codeList)));
}
});
return Optional.of(step);
} }
private String buildCodeSystemUrlAndVersion(String theSystem, String theIncludeOrExcludeVersion) { private String buildCodeSystemUrlAndVersion(String theSystem, String theIncludeOrExcludeVersion) {
@ -3150,24 +3157,15 @@ public class TermReadSvcImpl implements ITermReadSvc, IHasScheduledJobs {
* Properties returned from method buildSearchScroll * Properties returned from method buildSearchScroll
*/ */
private static final class SearchProperties { private static final class SearchProperties {
private SearchScroll<EntityReference> mySearchScroll; private List<Supplier<SearchScroll<EntityReference>>> mySearchScroll = new ArrayList<>();
private Optional<PredicateFinalStep> myExpansionStepOpt;
private List<String> myIncludeOrExcludeCodes; private List<String> myIncludeOrExcludeCodes;
public SearchScroll<EntityReference> getSearchScroll() { public List<Supplier<SearchScroll<EntityReference>>> getSearchScroll() {
return mySearchScroll; return mySearchScroll;
} }
public void setSearchScroll(SearchScroll<EntityReference> theSearchScroll) { public void addSearchScroll(Supplier<SearchScroll<EntityReference>> theSearchScrollSupplier) {
mySearchScroll = theSearchScroll; mySearchScroll.add(theSearchScrollSupplier);
}
public Optional<PredicateFinalStep> getExpansionStepOpt() {
return myExpansionStepOpt;
}
public void setExpansionStepOpt(Optional<PredicateFinalStep> theExpansionStepOpt) {
myExpansionStepOpt = theExpansionStepOpt;
} }
public List<String> getIncludeOrExcludeCodes() { public List<String> getIncludeOrExcludeCodes() {
@ -3177,6 +3175,10 @@ public class TermReadSvcImpl implements ITermReadSvc, IHasScheduledJobs {
public void setIncludeOrExcludeCodes(List<String> theIncludeOrExcludeCodes) { public void setIncludeOrExcludeCodes(List<String> theIncludeOrExcludeCodes) {
myIncludeOrExcludeCodes = theIncludeOrExcludeCodes; myIncludeOrExcludeCodes = theIncludeOrExcludeCodes;
} }
public boolean hasIncludeOrExcludeCodes() {
return !myIncludeOrExcludeCodes.isEmpty();
}
} }
static boolean isValueSetDisplayLanguageMatch(ValueSetExpansionOptions theExpansionOptions, String theStoredLang) { static boolean isValueSetDisplayLanguageMatch(ValueSetExpansionOptions theExpansionOptions, String theStoredLang) {

View File

@ -35,6 +35,7 @@ import org.hl7.fhir.r4.model.Group;
import org.hl7.fhir.r4.model.IdType; import org.hl7.fhir.r4.model.IdType;
import org.hl7.fhir.r4.model.Observation; import org.hl7.fhir.r4.model.Observation;
import org.hl7.fhir.r4.model.Patient; import org.hl7.fhir.r4.model.Patient;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.ParameterizedTest;
@ -152,6 +153,12 @@ public class JpaBulkExportProcessorTest {
@InjectMocks @InjectMocks
private JpaBulkExportProcessor myProcessor; private JpaBulkExportProcessor myProcessor;
@BeforeEach
public void init() {
myProcessor.mySearchBuilderFactory = mySearchBuilderFactory;
myProcessor.myMdmLinkDao = myMdmLinkDao;
}
private ExportPIDIteratorParameters createExportParameters(BulkExportJobParameters.ExportStyle theExportStyle) { private ExportPIDIteratorParameters createExportParameters(BulkExportJobParameters.ExportStyle theExportStyle) {
ExportPIDIteratorParameters parameters = new ExportPIDIteratorParameters(); ExportPIDIteratorParameters parameters = new ExportPIDIteratorParameters();
parameters.setInstanceId("instanceId"); parameters.setInstanceId("instanceId");

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -3,7 +3,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -3,7 +3,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>
@ -86,7 +86,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.hibernate.search</groupId> <groupId>org.hibernate.search</groupId>
<artifactId>hibernate-search-mapper-orm-orm6</artifactId> <artifactId>hibernate-search-mapper-orm</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.hibernate.search</groupId> <groupId>org.hibernate.search</groupId>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>
@ -125,7 +125,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.hibernate.search</groupId> <groupId>org.hibernate.search</groupId>
<artifactId>hibernate-search-mapper-orm-orm6</artifactId> <artifactId>hibernate-search-mapper-orm</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.jscience</groupId> <groupId>org.jscience</groupId>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -38,6 +38,7 @@ public class SynchronousSearchSvcImplTest extends BaseSearchSvc {
@BeforeEach @BeforeEach
public void before() { public void before() {
mySynchronousSearchSvc.setContext(ourCtx); mySynchronousSearchSvc.setContext(ourCtx);
mySynchronousSearchSvc.mySearchBuilderFactory = mySearchBuilderFactory;
} }
@Test @Test

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -21,7 +21,11 @@ import org.hl7.fhir.r4.model.Subscription;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.ArgumentMatchers; import org.mockito.ArgumentMatchers;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.slf4j.event.Level; import org.slf4j.event.Level;
@ -50,6 +54,7 @@ import static org.mockito.Mockito.mock;
/** /**
* Test the rest-hook subscriptions * Test the rest-hook subscriptions
*/ */
@ExtendWith(MockitoExtension.class)
public class RestHookWithInterceptorR4Test extends BaseSubscriptionsR4Test { public class RestHookWithInterceptorR4Test extends BaseSubscriptionsR4Test {
private static final Logger ourLog = LoggerFactory.getLogger(RestHookWithInterceptorR4Test.class); private static final Logger ourLog = LoggerFactory.getLogger(RestHookWithInterceptorR4Test.class);
@ -61,6 +66,9 @@ public class RestHookWithInterceptorR4Test extends BaseSubscriptionsR4Test {
private static boolean ourNextAddHeader; private static boolean ourNextAddHeader;
private static final FhirContext ourCtx = FhirContext.forR4Cached(); private static final FhirContext ourCtx = FhirContext.forR4Cached();
@Mock(strictness = Mock.Strictness.STRICT_STUBS)
Logger loggerMock;
@Autowired @Autowired
StoppableSubscriptionDeliveringRestHookSubscriber myStoppableSubscriptionDeliveringRestHookSubscriber; StoppableSubscriptionDeliveringRestHookSubscriber myStoppableSubscriptionDeliveringRestHookSubscriber;
@Autowired @Autowired
@ -223,14 +231,13 @@ public class RestHookWithInterceptorR4Test extends BaseSubscriptionsR4Test {
@Test @Test
public void testDebugLoggingInterceptor() throws Exception { public void testDebugLoggingInterceptor() throws Exception {
List<String> messages = new ArrayList<>(); List<String> messages = new ArrayList<>();
Logger loggerMock = mock(Logger.class);
doAnswer(t -> { doAnswer(t -> {
Object msg = t.getArguments()[0]; Object msg = t.getArguments()[0];
Object[] args = Arrays.copyOfRange(t.getArguments(), 1, t.getArguments().length); Object[] args = Arrays.copyOfRange(t.getArguments(), 1, t.getArguments().length);
String formattedMessage = MessageFormatter.arrayFormat((String) msg, args).getMessage(); String formattedMessage = MessageFormatter.arrayFormat((String) msg, args).getMessage();
messages.add(formattedMessage); messages.add(formattedMessage);
return null; return null;
}).when(loggerMock).debug(any(), ArgumentMatchers.<Object[]>any()); }).when(loggerMock).debug(any(), any(Object[].class));
SubscriptionDebugLogInterceptor interceptor = new SubscriptionDebugLogInterceptor(); SubscriptionDebugLogInterceptor interceptor = new SubscriptionDebugLogInterceptor();
myInterceptorRegistry.registerInterceptor(interceptor); myInterceptorRegistry.registerInterceptor(interceptor);

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>
@ -85,6 +85,10 @@
<groupId>org.apache.derby</groupId> <groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId> <artifactId>derby</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbytools</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-test</artifactId> <artifactId>spring-boot-test</artifactId>

View File

@ -52,12 +52,8 @@ import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
import ca.uhn.fhir.rest.server.util.ISearchParamRegistry; import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
import org.apache.commons.collections4.ListUtils; import org.apache.commons.collections4.ListUtils;
import org.apache.lucene.search.BooleanQuery; import org.apache.lucene.search.BooleanQuery;
import org.hibernate.search.engine.search.predicate.dsl.PredicateFinalStep; import org.apache.lucene.search.IndexSearcher;
import org.hibernate.search.engine.search.predicate.dsl.SearchPredicateFactory;
import org.hibernate.search.engine.search.query.SearchQuery;
import org.hibernate.search.mapper.orm.Search;
import org.hibernate.search.mapper.orm.common.EntityReference; import org.hibernate.search.mapper.orm.common.EntityReference;
import org.hibernate.search.mapper.orm.session.SearchSession;
import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.r4.model.CodeSystem; import org.hl7.fhir.r4.model.CodeSystem;
import org.hl7.fhir.r4.model.ValueSet; import org.hl7.fhir.r4.model.ValueSet;
@ -72,7 +68,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.util.AopTestUtils; import org.springframework.test.util.AopTestUtils;
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -80,7 +75,6 @@ import jakarta.persistence.EntityManager;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.IntStream; import java.util.stream.IntStream;
@ -1944,7 +1938,7 @@ public abstract class BaseValueSetHSearchExpansionR4Test extends BaseJpaTest {
@Test @Test
public void testShouldNotFindAny() { public void testShouldNotFindAny() {
List<EntityReference> hits = search(allCodesNotIncludingSearched); List<String> hits = search(allCodesNotIncludingSearched);
assertNotNull(hits); assertNotNull(hits);
assertTrue(hits.isEmpty()); assertTrue(hits.isEmpty());
} }
@ -1952,12 +1946,12 @@ public abstract class BaseValueSetHSearchExpansionR4Test extends BaseJpaTest {
@Test @Test
public void testHitsInFirstSublist() { public void testHitsInFirstSublist() {
int insertIndex = BooleanQuery.getMaxClauseCount() / 2; int insertIndex = IndexSearcher.getMaxClauseCount() / 2;
// insert existing codes into list of codes searched // insert existing codes into list of codes searched
allCodesNotIncludingSearched.addAll(insertIndex, existingCodes); allCodesNotIncludingSearched.addAll(insertIndex, existingCodes);
List<EntityReference> hits = search(allCodesNotIncludingSearched); List<String> hits = search(allCodesNotIncludingSearched);
assertEquals(existingCodes.size(), hits.size()); assertEquals(existingCodes.size(), hits.size());
} }
@ -1967,7 +1961,7 @@ public abstract class BaseValueSetHSearchExpansionR4Test extends BaseJpaTest {
// insert existing codes into list of codes searched // insert existing codes into list of codes searched
allCodesNotIncludingSearched.addAll(allCodesNotIncludingSearched.size(), existingCodes); allCodesNotIncludingSearched.addAll(allCodesNotIncludingSearched.size(), existingCodes);
List<EntityReference> hits = search(allCodesNotIncludingSearched); List<String> hits = search(allCodesNotIncludingSearched);
assertEquals(existingCodes.size(), hits.size()); assertEquals(existingCodes.size(), hits.size());
} }
@ -1986,42 +1980,20 @@ public abstract class BaseValueSetHSearchExpansionR4Test extends BaseJpaTest {
// insert last partition of existing codes into last sublist of searched codes // insert last partition of existing codes into last sublist of searched codes
allCodesNotIncludingSearched.addAll(allCodesNotIncludingSearched.size(), partitionedExistingCodes.get(1)); allCodesNotIncludingSearched.addAll(allCodesNotIncludingSearched.size(), partitionedExistingCodes.get(1));
List<EntityReference> hits = search(allCodesNotIncludingSearched); List<String> hits = search(allCodesNotIncludingSearched);
assertEquals(existingCodes.size(), hits.size()); assertEquals(existingCodes.size(), hits.size());
} }
private List<EntityReference> search(List<String> theSearchedCodes) { private List<String> search(List<String> theSearchedCodes) {
return runInTransaction(() -> { // Include
TermCodeSystemVersion termCsVersion = myTermCodeSystemVersionDao.findCurrentVersionForCodeSystemResourcePid(termCsId); ValueSet vs = new ValueSet();
Long termCsvPid = termCsVersion.getPid(); ValueSet.ConceptSetComponent include = vs.getCompose().addInclude();
include.setSystem(LOINC_URI);
SearchSession searchSession = Search.session(myEntityManager); for (var next : theSearchedCodes) {
SearchPredicateFactory predicate = searchSession.scope(TermConcept.class).predicate(); include.addConcept().setCode(next);
}
Optional<PredicateFinalStep> lastStepOpt = ReflectionTestUtils.invokeMethod( ValueSet outcome = myTermSvc.expandValueSet(null, vs);
new TermReadSvcImpl(), "buildExpansionPredicate", theSearchedCodes, predicate); return toCodesContains(outcome.getExpansion().getContains());
assertNotNull(lastStepOpt);
assertTrue(lastStepOpt.isPresent());
PredicateFinalStep step = predicate.bool(b -> {
b.must(predicate.match().field("myCodeSystemVersionPid").matching(termCsvPid));
b.must(lastStepOpt.get());
});
int maxResultsPerBatch = 800;
SearchQuery<EntityReference> termConceptsQuery = searchSession
.search(TermConcept.class)
.selectEntityReference()
.where(f -> step)
.toQuery();
ourLog.trace("About to query: {}", termConceptsQuery.queryString());
return termConceptsQuery.fetchHits(0, maxResultsPerBatch);
});
} }
} }

View File

@ -1,4 +1,4 @@
package ca.uhn.fhir.jpa.dao.index; package ca.uhn.fhir.jpa.cache;
import ca.uhn.fhir.interceptor.model.RequestPartitionId; import ca.uhn.fhir.interceptor.model.RequestPartitionId;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
@ -6,6 +6,7 @@ import ca.uhn.fhir.jpa.api.svc.IIdHelperService;
import ca.uhn.fhir.jpa.cache.ResourcePersistentIdMap; import ca.uhn.fhir.jpa.cache.ResourcePersistentIdMap;
import ca.uhn.fhir.jpa.cache.ResourceVersionSvcDaoImpl; import ca.uhn.fhir.jpa.cache.ResourceVersionSvcDaoImpl;
import ca.uhn.fhir.jpa.dao.data.IResourceTableDao; import ca.uhn.fhir.jpa.dao.data.IResourceTableDao;
import ca.uhn.fhir.jpa.dao.index.IdHelperService;
import ca.uhn.fhir.jpa.model.config.PartitionSettings; import ca.uhn.fhir.jpa.model.config.PartitionSettings;
import ca.uhn.fhir.jpa.model.dao.JpaPid; import ca.uhn.fhir.jpa.model.dao.JpaPid;
import ca.uhn.fhir.jpa.model.entity.ForcedId; import ca.uhn.fhir.jpa.model.entity.ForcedId;
@ -14,6 +15,7 @@ import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.rest.api.server.storage.IResourcePersistentId; import ca.uhn.fhir.rest.api.server.storage.IResourcePersistentId;
import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IIdType;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks; import org.mockito.InjectMocks;
@ -52,6 +54,11 @@ public class ResourceVersionSvcTest {
@InjectMocks @InjectMocks
private ResourceVersionSvcDaoImpl myResourceVersionSvc; private ResourceVersionSvcDaoImpl myResourceVersionSvc;
@BeforeEach
public void before() {
myResourceVersionSvc.myIdHelperService = myIdHelperService;
}
/** /**
* Gets a ResourceTable record for getResourceVersionsForPid * Gets a ResourceTable record for getResourceVersionsForPid
* Order matters! * Order matters!

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -29,7 +29,7 @@ class CdsHooksContextBooterTest {
void validateJsonThrowsExceptionWhenInputIsInvalid() { void validateJsonThrowsExceptionWhenInputIsInvalid() {
// setup // setup
final String expected = "HAPI-2378: Invalid JSON: Unrecognized token 'abc': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')\n" + final String expected = "HAPI-2378: Invalid JSON: Unrecognized token 'abc': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')\n" +
" at [Source: (String)\"abc\"; line: 1, column: 4]"; " at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 4]";
// execute // execute
final UnprocessableEntityException actual = assertThrows(UnprocessableEntityException.class, () -> myFixture.validateJson("abc")); final UnprocessableEntityException actual = assertThrows(UnprocessableEntityException.class, () -> myFixture.validateJson("abc"));
// validate // validate

View File

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -7,7 +7,7 @@
<parent> <parent>
<artifactId>hapi-fhir-serviceloaders</artifactId> <artifactId>hapi-fhir-serviceloaders</artifactId>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -7,7 +7,7 @@
<parent> <parent>
<artifactId>hapi-fhir-serviceloaders</artifactId> <artifactId>hapi-fhir-serviceloaders</artifactId>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@ -21,7 +21,7 @@
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-caching-api</artifactId> <artifactId>hapi-fhir-caching-api</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -7,7 +7,7 @@
<parent> <parent>
<artifactId>hapi-fhir-serviceloaders</artifactId> <artifactId>hapi-fhir-serviceloaders</artifactId>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -7,7 +7,7 @@
<parent> <parent>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot-samples</artifactId> <artifactId>hapi-fhir-spring-boot-samples</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
</parent> </parent>
<artifactId>hapi-fhir-spring-boot-sample-client-apache</artifactId> <artifactId>hapi-fhir-spring-boot-sample-client-apache</artifactId>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot-samples</artifactId> <artifactId>hapi-fhir-spring-boot-samples</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot-samples</artifactId> <artifactId>hapi-fhir-spring-boot-samples</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot</artifactId> <artifactId>hapi-fhir-spring-boot</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -19,6 +19,7 @@
*/ */
package ca.uhn.fhir.jpa.migrate.taskdef; package ca.uhn.fhir.jpa.migrate.taskdef;
import ca.uhn.fhir.jpa.migrate.DriverTypeEnum;
import ca.uhn.fhir.jpa.migrate.JdbcUtils; import ca.uhn.fhir.jpa.migrate.JdbcUtils;
import org.intellij.lang.annotations.Language; import org.intellij.lang.annotations.Language;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -56,6 +57,10 @@ public class DropTableTask extends BaseTableTask {
logInfo(ourLog, "Table {} has the following indexes: {}", getTableName(), indexNames); logInfo(ourLog, "Table {} has the following indexes: {}", getTableName(), indexNames);
for (String next : foreignKeys) { for (String next : foreignKeys) {
if (getDriverType() == DriverTypeEnum.DERBY_EMBEDDED && next.contains("-")) {
// Derby creates special internal indexes with GUID names that can't be deleted
continue;
}
List<String> sql = DropForeignKeyTask.generateSql(getTableName(), next, getDriverType()); List<String> sql = DropForeignKeyTask.generateSql(getTableName(), next, getDriverType());
for (@Language("SQL") String nextSql : sql) { for (@Language("SQL") String nextSql : sql) {
executeSql(getTableName(), nextSql); executeSql(getTableName(), nextSql);
@ -69,6 +74,10 @@ public class DropTableTask extends BaseTableTask {
.setDriverType(getDriverType()) .setDriverType(getDriverType())
.setDryRun(isDryRun()); .setDryRun(isDryRun());
for (String nextIndex : indexNames) { for (String nextIndex : indexNames) {
if (getDriverType() == DriverTypeEnum.DERBY_EMBEDDED && nextIndex.contains("-")) {
// Derby creates special internal indexes with GUID names that can't be deleted
continue;
}
theIndexTask.setIndexName(nextIndex).execute(); theIndexTask.setIndexName(nextIndex).execute();
} }

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -58,6 +58,7 @@ import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
import ca.uhn.fhir.rest.server.interceptor.ResponseTerminologyTranslationSvc; import ca.uhn.fhir.rest.server.interceptor.ResponseTerminologyTranslationSvc;
import ca.uhn.fhir.util.BinaryUtil; import ca.uhn.fhir.util.BinaryUtil;
import ca.uhn.fhir.util.FhirTerser; import ca.uhn.fhir.util.FhirTerser;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ListMultimap; import com.google.common.collect.ListMultimap;
import jakarta.annotation.Nonnull; import jakarta.annotation.Nonnull;
@ -456,4 +457,9 @@ public class ExpandResourceAndWriteBinaryStep
protected OutputStreamWriter getStreamWriter(ByteArrayOutputStream theOutputStream) { protected OutputStreamWriter getStreamWriter(ByteArrayOutputStream theOutputStream) {
return new OutputStreamWriter(theOutputStream, Constants.CHARSET_UTF8); return new OutputStreamWriter(theOutputStream, Constants.CHARSET_UTF8);
} }
@VisibleForTesting
public void setIdHelperServiceForUnitTest(IIdHelperService theIdHelperService) {
myIdHelperService = theIdHelperService;
}
} }

View File

@ -48,6 +48,7 @@ import ca.uhn.fhir.rest.api.server.bulk.BulkExportJobParameters;
import ca.uhn.fhir.rest.api.server.storage.IResourcePersistentId; import ca.uhn.fhir.rest.api.server.storage.IResourcePersistentId;
import ca.uhn.fhir.rest.param.TokenOrListParam; import ca.uhn.fhir.rest.param.TokenOrListParam;
import ca.uhn.fhir.rest.server.interceptor.ResponseTerminologyTranslationSvc; import ca.uhn.fhir.rest.server.interceptor.ResponseTerminologyTranslationSvc;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ListMultimap; import com.google.common.collect.ListMultimap;
import jakarta.annotation.Nonnull; import jakarta.annotation.Nonnull;
@ -287,4 +288,9 @@ public class ExpandResourcesStep
// see WriteBinaryStep as well // see WriteBinaryStep as well
return myFhirContext.newJsonParser().setPrettyPrint(false); return myFhirContext.newJsonParser().setPrettyPrint(false);
} }
@VisibleForTesting
public void setIdHelperServiceForUnitTest(IIdHelperService theIdHelperService) {
myIdHelperService = theIdHelperService;
}
} }

View File

@ -33,6 +33,7 @@ import ca.uhn.fhir.jpa.bulk.export.api.IBulkExportProcessor;
import ca.uhn.fhir.jpa.bulk.export.model.ExportPIDIteratorParameters; import ca.uhn.fhir.jpa.bulk.export.model.ExportPIDIteratorParameters;
import ca.uhn.fhir.rest.api.server.bulk.BulkExportJobParameters; import ca.uhn.fhir.rest.api.server.bulk.BulkExportJobParameters;
import ca.uhn.fhir.rest.api.server.storage.IResourcePersistentId; import ca.uhn.fhir.rest.api.server.storage.IResourcePersistentId;
import com.google.common.annotations.VisibleForTesting;
import jakarta.annotation.Nonnull; import jakarta.annotation.Nonnull;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -159,4 +160,9 @@ public class FetchResourceIdsStep implements IFirstJobStepWorker<BulkExportJobPa
theDataSink.accept(idList); theDataSink.accept(idList);
} }
@VisibleForTesting
public void setBulkExportProcessorForUnitTest(IBulkExportProcessor theBulkExportProcessor) {
myBulkExportProcessor = theBulkExportProcessor;
}
} }

View File

@ -123,6 +123,7 @@ public class ExpandResourceAndWriteBinaryStepTest {
@BeforeEach @BeforeEach
public void init() { public void init() {
ourLog.addAppender(myAppender); ourLog.addAppender(myAppender);
myFinalStep.setIdHelperServiceForUnitTest(myIdHelperService);
} }
@AfterEach @AfterEach

View File

@ -27,6 +27,7 @@ import ca.uhn.fhir.rest.server.SimpleBundleProvider;
import ca.uhn.fhir.rest.server.interceptor.ResponseTerminologyTranslationSvc; import ca.uhn.fhir.rest.server.interceptor.ResponseTerminologyTranslationSvc;
import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.r4.model.Patient; import org.hl7.fhir.r4.model.Patient;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource; import org.junit.jupiter.params.provider.ValueSource;
@ -82,6 +83,11 @@ public class ExpandResourcesStepTest {
@InjectMocks @InjectMocks
private ExpandResourcesStep mySecondStep; private ExpandResourcesStep mySecondStep;
@BeforeEach
public void init() {
mySecondStep.setIdHelperServiceForUnitTest(myIdHelperService);
}
private BulkExportJobParameters createParameters(boolean thePartitioned) { private BulkExportJobParameters createParameters(boolean thePartitioned) {
BulkExportJobParameters parameters = new BulkExportJobParameters(); BulkExportJobParameters parameters = new BulkExportJobParameters();
parameters.setResourceTypes(Arrays.asList("Patient", "Observation")); parameters.setResourceTypes(Arrays.asList("Patient", "Observation"));

View File

@ -65,6 +65,7 @@ public class FetchResourceIdsStepTest {
@BeforeEach @BeforeEach
public void init() { public void init() {
ourLog.addAppender(myAppender); ourLog.addAppender(myAppender);
myFirstStep.setBulkExportProcessorForUnitTest(myBulkExportProcessor);
} }
@AfterEach @AfterEach

View File

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -1,3 +1,22 @@
/*-
* #%L
* HAPI FHIR - Clinical Reasoning
* %%
* Copyright (C) 2014 - 2024 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.cr.r4; package ca.uhn.fhir.cr.r4;
import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.api.server.RequestDetails;

View File

@ -1,3 +1,22 @@
/*-
* #%L
* HAPI FHIR - Clinical Reasoning
* %%
* Copyright (C) 2014 - 2024 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.cr.r4.cpg; package ca.uhn.fhir.cr.r4.cpg;
import ca.uhn.fhir.cr.r4.ILibraryEvaluationServiceFactory; import ca.uhn.fhir.cr.r4.ILibraryEvaluationServiceFactory;

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>
@ -85,7 +85,7 @@
<dependency> <dependency>
<groupId>org.hibernate.search</groupId> <groupId>org.hibernate.search</groupId>
<artifactId>hibernate-search-mapper-orm-orm6</artifactId> <artifactId>hibernate-search-mapper-orm</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.hibernate.search</groupId> <groupId>org.hibernate.search</groupId>
@ -166,12 +166,6 @@
<version>${project.version}</version> <version>${project.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId>
<version>${mockito_version}</version>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>
@ -88,7 +88,7 @@
<!-- Hibernate --> <!-- Hibernate -->
<dependency> <dependency>
<groupId>org.hibernate.search</groupId> <groupId>org.hibernate.search</groupId>
<artifactId>hibernate-search-mapper-orm-orm6</artifactId> <artifactId>hibernate-search-mapper-orm</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.hibernate.validator</groupId> <groupId>org.hibernate.validator</groupId>

View File

@ -20,9 +20,11 @@
package ca.uhn.fhir.test.utilities.server; package ca.uhn.fhir.test.utilities.server;
import jakarta.servlet.ServletConfig; import jakarta.servlet.ServletConfig;
import org.mockito.quality.Strictness;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import static org.mockito.Mockito.withSettings;
public class MockServletUtil { public class MockServletUtil {
@ -34,7 +36,7 @@ public class MockServletUtil {
} }
public static ServletConfig createServletConfig() { public static ServletConfig createServletConfig() {
ServletConfig sc = mock(ServletConfig.class); ServletConfig sc = mock(ServletConfig.class, withSettings().strictness(Strictness.LENIENT));
when(sc.getServletContext()).thenReturn(null); when(sc.getServletContext()).thenReturn(null);
return sc; return sc;
} }

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>6.11.9-SNAPSHOT</version> <version>6.11.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -0,0 +1,21 @@
package ca.uhn.fhir.fhirpath;
import ca.uhn.fhir.test.BaseTest;
import org.junit.jupiter.api.AfterEach;
import org.mockito.Mockito;
public abstract class BaseValidationTestWithInlineMocks extends BaseTest {
/**
* Avoid memory leaks due to inline mocks. See https://github.com/mockito/mockito/pull/1619
* Note that we don't declare the test classes in this
* module with @ExtendWith(MockitoExtension.class) because
* Mockito 5 seems to not like mixing inline mocks with
* extension managed ones.
*/
@AfterEach
public void clearMocks() {
Mockito.framework().clearInlineMocks();
}
}

View File

@ -4,6 +4,7 @@ import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum; import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.util.FhirTerser; import ca.uhn.fhir.util.FhirTerser;
import ca.uhn.fhir.util.TestUtil; import ca.uhn.fhir.util.TestUtil;
import jakarta.annotation.Nonnull;
import org.hl7.fhir.instance.model.api.IBase; import org.hl7.fhir.instance.model.api.IBase;
import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.r4.model.HumanName; import org.hl7.fhir.r4.model.HumanName;
@ -11,7 +12,6 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource; import org.junit.jupiter.params.provider.MethodSource;
import jakarta.annotation.Nonnull;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Stream; import java.util.stream.Stream;
@ -21,7 +21,7 @@ import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.endsWith; import static org.hamcrest.Matchers.endsWith;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
public class FhirPathTest { public class FhirPathTest extends BaseValidationTestWithInlineMocks {
@ParameterizedTest @ParameterizedTest
@MethodSource("provideContexts") @MethodSource("provideContexts")

View File

@ -1,6 +1,7 @@
package ca.uhn.fhir.rest.server; package ca.uhn.fhir.rest.server;
import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.fhirpath.BaseValidationTestWithInlineMocks;
import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.model.primitive.IdDt;
@ -17,13 +18,11 @@ import ca.uhn.fhir.rest.param.StringParam;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor; import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor;
import ca.uhn.fhir.test.utilities.HttpClientExtension; import ca.uhn.fhir.test.utilities.HttpClientExtension;
import ca.uhn.fhir.test.utilities.JettyUtil;
import ca.uhn.fhir.test.utilities.server.RestfulServerExtension; import ca.uhn.fhir.test.utilities.server.RestfulServerExtension;
import ca.uhn.fhir.util.TestUtil; import ca.uhn.fhir.util.TestUtil;
import ca.uhn.fhir.validation.IValidationContext; import ca.uhn.fhir.validation.IValidationContext;
import ca.uhn.fhir.validation.IValidatorModule; import ca.uhn.fhir.validation.IValidatorModule;
import ca.uhn.fhir.validation.ResultSeverityEnum; import ca.uhn.fhir.validation.ResultSeverityEnum;
import ca.uhn.hapi.converters.server.VersionedApiConverterInterceptor;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.http.HttpResponse; import org.apache.http.HttpResponse;
import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.CloseableHttpResponse;
@ -32,12 +31,6 @@ import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType; import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity; import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.ee10.servlet.ServletHandler;
import org.eclipse.jetty.ee10.servlet.ServletHolder;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import org.hl7.fhir.common.hapi.validation.validator.FhirInstanceValidator; import org.hl7.fhir.common.hapi.validation.validator.FhirInstanceValidator;
import org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender; import org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender;
@ -45,7 +38,6 @@ import org.hl7.fhir.dstu3.model.IdType;
import org.hl7.fhir.dstu3.model.Patient; import org.hl7.fhir.dstu3.model.Patient;
import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IBaseResource;
import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.extension.RegisterExtension;
@ -53,13 +45,12 @@ import org.mockito.Mockito;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
public class RequestValidatingInterceptorDstu3Test { public class RequestValidatingInterceptorDstu3Test extends BaseValidationTestWithInlineMocks {
private static final FhirContext ourCtx = FhirContext.forDstu3Cached(); private static final FhirContext ourCtx = FhirContext.forDstu3Cached();
private static boolean ourLastRequestWasSearch; private static boolean ourLastRequestWasSearch;

View File

@ -1,6 +1,7 @@
package ca.uhn.fhir.rest.server; package ca.uhn.fhir.rest.server;
import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.fhirpath.BaseValidationTestWithInlineMocks;
import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.rest.annotation.Create; import ca.uhn.fhir.rest.annotation.Create;
@ -59,7 +60,7 @@ import static org.hamcrest.Matchers.not;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
public class RequestValidatingInterceptorR4Test { public class RequestValidatingInterceptorR4Test extends BaseValidationTestWithInlineMocks {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RequestValidatingInterceptorR4Test.class); private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RequestValidatingInterceptorR4Test.class);
@RegisterExtension @RegisterExtension
static HttpClientExtension ourClient = new HttpClientExtension(); static HttpClientExtension ourClient = new HttpClientExtension();

View File

@ -1,6 +1,7 @@
package ca.uhn.fhir.rest.server; package ca.uhn.fhir.rest.server;
import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.fhirpath.BaseValidationTestWithInlineMocks;
import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.rest.annotation.Delete; import ca.uhn.fhir.rest.annotation.Delete;
import ca.uhn.fhir.rest.annotation.IdParam; import ca.uhn.fhir.rest.annotation.IdParam;
@ -41,7 +42,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
public class ResponseValidatingInterceptorDstu3Test { public class ResponseValidatingInterceptorDstu3Test extends BaseValidationTestWithInlineMocks {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ResponseValidatingInterceptorDstu3Test.class); private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ResponseValidatingInterceptorDstu3Test.class);
public static IBaseResource myReturnResource; public static IBaseResource myReturnResource;
private static final FhirContext ourCtx = FhirContext.forDstu3Cached(); private static final FhirContext ourCtx = FhirContext.forDstu3Cached();

View File

@ -1,6 +1,7 @@
package ca.uhn.fhir.rest.server; package ca.uhn.fhir.rest.server;
import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.fhirpath.BaseValidationTestWithInlineMocks;
import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.rest.api.RestOperationTypeEnum; import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
@ -43,7 +44,7 @@ import static org.hamcrest.Matchers.startsWith;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
public class ResponseValidatingInterceptorR4Test { public class ResponseValidatingInterceptorR4Test extends BaseValidationTestWithInlineMocks {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ResponseValidatingInterceptorR4Test.class); private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ResponseValidatingInterceptorR4Test.class);
@RegisterExtension @RegisterExtension
static HttpClientExtension ourClient = new HttpClientExtension(); static HttpClientExtension ourClient = new HttpClientExtension();

Some files were not shown because too many files have changed in this diff Show More