Merge branch 'master' into 2958-consistent-error-handling
This commit is contained in:
commit
3ccadd636e
|
@ -4,7 +4,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>hapi-fhir</artifactId>
|
<artifactId>hapi-fhir</artifactId>
|
||||||
<version>5.6.0-PRE4-SNAPSHOT</version>
|
<version>5.6.0-PRE5-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -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>5.6.0-PRE4-SNAPSHOT</version>
|
<version>5.6.0-PRE5-SNAPSHOT</version>
|
||||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -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>5.6.0-PRE4-SNAPSHOT</version>
|
<version>5.6.0-PRE5-SNAPSHOT</version>
|
||||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -225,6 +225,14 @@ public class FhirContext {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 5.6.0
|
||||||
|
*/
|
||||||
|
public static FhirContext forDstu2Cached() {
|
||||||
|
return forCached(FhirVersionEnum.DSTU2);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 5.5.0
|
* @since 5.5.0
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -73,7 +73,6 @@ import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||||
|
|
||||||
class ModelScanner {
|
class ModelScanner {
|
||||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ModelScanner.class);
|
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ModelScanner.class);
|
||||||
|
|
||||||
private Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> myClassToElementDefinitions = new HashMap<>();
|
private Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> myClassToElementDefinitions = new HashMap<>();
|
||||||
private FhirContext myContext;
|
private FhirContext myContext;
|
||||||
private Map<String, RuntimeResourceDefinition> myIdToResourceDefinition = new HashMap<>();
|
private Map<String, RuntimeResourceDefinition> myIdToResourceDefinition = new HashMap<>();
|
||||||
|
@ -90,6 +89,7 @@ class ModelScanner {
|
||||||
@Nonnull Collection<Class<? extends IBase>> theResourceTypes) throws ConfigurationException {
|
@Nonnull Collection<Class<? extends IBase>> theResourceTypes) throws ConfigurationException {
|
||||||
myContext = theContext;
|
myContext = theContext;
|
||||||
myVersion = theVersion;
|
myVersion = theVersion;
|
||||||
|
|
||||||
Set<Class<? extends IBase>> toScan = new HashSet<>(theResourceTypes);
|
Set<Class<? extends IBase>> toScan = new HashSet<>(theResourceTypes);
|
||||||
init(theExistingDefinitions, toScan);
|
init(theExistingDefinitions, toScan);
|
||||||
}
|
}
|
||||||
|
@ -405,8 +405,8 @@ class ModelScanner {
|
||||||
List<RuntimeSearchParam.Component> components = null;
|
List<RuntimeSearchParam.Component> components = null;
|
||||||
if (paramType == RestSearchParameterTypeEnum.COMPOSITE) {
|
if (paramType == RestSearchParameterTypeEnum.COMPOSITE) {
|
||||||
components = new ArrayList<>();
|
components = new ArrayList<>();
|
||||||
for (String next : searchParam.compositeOf()) {
|
for (String name : searchParam.compositeOf()) {
|
||||||
String ref = "http://hl7.org/fhir/SearchParameter/" + theResourceDef.getName().toLowerCase() + "-" + next;
|
String ref = toCanonicalSearchParameterUri(theResourceDef, name);
|
||||||
components.add(new RuntimeSearchParam.Component(null, ref));
|
components.add(new RuntimeSearchParam.Component(null, ref));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -414,7 +414,8 @@ class ModelScanner {
|
||||||
Collection<String> base = Collections.singletonList(theResourceDef.getName());
|
Collection<String> base = Collections.singletonList(theResourceDef.getName());
|
||||||
String url = null;
|
String url = null;
|
||||||
if (theResourceDef.isStandardType()) {
|
if (theResourceDef.isStandardType()) {
|
||||||
url = "http://hl7.org/fhir/SearchParameter/" + theResourceDef.getName().toLowerCase() + "-" + searchParam.name();
|
String name = searchParam.name();
|
||||||
|
url = toCanonicalSearchParameterUri(theResourceDef, name);
|
||||||
}
|
}
|
||||||
RuntimeSearchParam param = new RuntimeSearchParam(null, url, searchParam.name(), searchParam.description(), searchParam.path(), paramType, providesMembershipInCompartments, toTargetList(searchParam.target()), RuntimeSearchParamStatusEnum.ACTIVE, null, components, base);
|
RuntimeSearchParam param = new RuntimeSearchParam(null, url, searchParam.name(), searchParam.description(), searchParam.path(), paramType, providesMembershipInCompartments, toTargetList(searchParam.target()), RuntimeSearchParamStatusEnum.ACTIVE, null, components, base);
|
||||||
theResourceDef.addSearchParam(param);
|
theResourceDef.addSearchParam(param);
|
||||||
|
@ -424,6 +425,10 @@ class ModelScanner {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String toCanonicalSearchParameterUri(RuntimeResourceDefinition theResourceDef, String theName) {
|
||||||
|
return "http://hl7.org/fhir/SearchParameter/" + theResourceDef.getName() + "-" + theName;
|
||||||
|
}
|
||||||
|
|
||||||
private Set<String> toTargetList(Class<? extends IBaseResource>[] theTarget) {
|
private Set<String> toTargetList(Class<? extends IBaseResource>[] theTarget) {
|
||||||
HashSet<String> retVal = new HashSet<>();
|
HashSet<String> retVal = new HashSet<>();
|
||||||
|
|
||||||
|
|
|
@ -233,18 +233,7 @@ public class RuntimeSearchParam {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getPathsSplit() {
|
public List<String> getPathsSplit() {
|
||||||
String path = getPath();
|
return getPathsSplitForResourceType(null);
|
||||||
if (path.indexOf('|') == -1) {
|
|
||||||
return Collections.singletonList(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<String> retVal = new ArrayList<>();
|
|
||||||
StringTokenizer tok = new StringTokenizer(path, "|");
|
|
||||||
while (tok.hasMoreElements()) {
|
|
||||||
String nextPath = tok.nextToken().trim();
|
|
||||||
retVal.add(nextPath.trim());
|
|
||||||
}
|
|
||||||
return retVal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -266,6 +255,41 @@ public class RuntimeSearchParam {
|
||||||
return myPhoneticEncoder.encode(theString);
|
return myPhoneticEncoder.encode(theString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getPathsSplitForResourceType(@Nullable String theResourceName) {
|
||||||
|
String path = getPath();
|
||||||
|
if (path.indexOf('|') == -1) {
|
||||||
|
if (theResourceName != null && !pathMatchesResourceType(theResourceName, path)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
return Collections.singletonList(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> retVal = new ArrayList<>();
|
||||||
|
StringTokenizer tok = new StringTokenizer(path, "|");
|
||||||
|
while (tok.hasMoreElements()) {
|
||||||
|
String nextPath = tok.nextToken().trim();
|
||||||
|
if (theResourceName != null && !pathMatchesResourceType(theResourceName, nextPath)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
retVal.add(nextPath.trim());
|
||||||
|
}
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean pathMatchesResourceType(String theResourceName, String thePath) {
|
||||||
|
if (thePath.startsWith(theResourceName + ".")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (thePath.startsWith("Resouce.") || thePath.startsWith("DomainResource.")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (Character.isLowerCase(thePath.charAt(0))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public enum RuntimeSearchParamStatusEnum {
|
public enum RuntimeSearchParamStatusEnum {
|
||||||
ACTIVE,
|
ACTIVE,
|
||||||
DRAFT,
|
DRAFT,
|
||||||
|
|
|
@ -28,13 +28,6 @@ import ca.uhn.fhir.rest.gclient.TokenClientParam;
|
||||||
*/
|
*/
|
||||||
public interface IAnyResource extends IBaseResource {
|
public interface IAnyResource extends IBaseResource {
|
||||||
|
|
||||||
/**
|
|
||||||
* Search parameter constant for <b>_language</b>
|
|
||||||
*/
|
|
||||||
@SearchParamDefinition(name="_language", path="", description="The language of the resource", type="string" )
|
|
||||||
String SP_RES_LANGUAGE = "_language";
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search parameter constant for <b>_id</b>
|
* Search parameter constant for <b>_id</b>
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -3,14 +3,14 @@
|
||||||
<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>5.6.0-PRE4-SNAPSHOT</version>
|
<version>5.6.0-PRE5-SNAPSHOT</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<name>HAPI FHIR BOM</name>
|
<name>HAPI FHIR BOM</name>
|
||||||
|
|
||||||
<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>5.6.0-PRE4-SNAPSHOT</version>
|
<version>5.6.0-PRE5-SNAPSHOT</version>
|
||||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -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>5.6.0-PRE4-SNAPSHOT</version>
|
<version>5.6.0-PRE5-SNAPSHOT</version>
|
||||||
<relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
|
<relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -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>5.6.0-PRE4-SNAPSHOT</version>
|
<version>5.6.0-PRE5-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -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>5.6.0-PRE4-SNAPSHOT</version>
|
<version>5.6.0-PRE5-SNAPSHOT</version>
|
||||||
<relativePath>../../hapi-deployable-pom</relativePath>
|
<relativePath>../../hapi-deployable-pom</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -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>5.6.0-PRE4-SNAPSHOT</version>
|
<version>5.6.0-PRE5-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -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>5.6.0-PRE4-SNAPSHOT</version>
|
<version>5.6.0-PRE5-SNAPSHOT</version>
|
||||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -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>5.6.0-PRE4-SNAPSHOT</version>
|
<version>5.6.0-PRE5-SNAPSHOT</version>
|
||||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -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>5.6.0-PRE4-SNAPSHOT</version>
|
<version>5.6.0-PRE5-SNAPSHOT</version>
|
||||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -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>5.6.0-PRE4-SNAPSHOT</version>
|
<version>5.6.0-PRE5-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -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>5.6.0-PRE4-SNAPSHOT</version>
|
<version>5.6.0-PRE5-SNAPSHOT</version>
|
||||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
type: perf
|
||||||
|
issue: 2457
|
||||||
|
title: "A regression in HAPI FHIR 5.3.0 resulted in concurrent searches being executed in a sequential
|
||||||
|
(and not parallel) fashion in some circumstances."
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
type: fix
|
||||||
|
issue: 2790
|
||||||
|
title: "The SearchParameter canonical URLs exported by the JPA server have been adjusted to match the URLs
|
||||||
|
specified in the FHIR specification."
|
|
@ -0,0 +1,7 @@
|
||||||
|
---
|
||||||
|
type: change
|
||||||
|
issue: 2790
|
||||||
|
title: "Support for the `_language` search parameter has been dropped from the JPA server. This search parameter
|
||||||
|
was specified in FHIR DSTU1 but was dropped in later versions. It is rarely used in practice and imposes
|
||||||
|
an indexing cost, so it has now been removed. A custom search parameter may be used in order to achieve
|
||||||
|
the same functionality if needed."
|
|
@ -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>5.6.0-PRE4-SNAPSHOT</version>
|
<version>5.6.0-PRE5-SNAPSHOT</version>
|
||||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -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>5.6.0-PRE4-SNAPSHOT</version>
|
<version>5.6.0-PRE5-SNAPSHOT</version>
|
||||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -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>5.6.0-PRE4-SNAPSHOT</version>
|
<version>5.6.0-PRE5-SNAPSHOT</version>
|
||||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -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>5.6.0-PRE4-SNAPSHOT</version>
|
<version>5.6.0-PRE5-SNAPSHOT</version>
|
||||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -54,4 +54,8 @@ public class PartitionedUrl implements IModelJson {
|
||||||
public void setRequestPartitionId(RequestPartitionId theRequestPartitionId) {
|
public void setRequestPartitionId(RequestPartitionId theRequestPartitionId) {
|
||||||
myRequestPartitionId = theRequestPartitionId;
|
myRequestPartitionId = theRequestPartitionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isPartitioned() {
|
||||||
|
return myRequestPartitionId != null && !myRequestPartitionId.isDefaultPartition();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1228,12 +1228,6 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> extends BaseStora
|
||||||
}
|
}
|
||||||
|
|
||||||
entity.setUpdated(theTransactionDetails.getTransactionDate());
|
entity.setUpdated(theTransactionDetails.getTransactionDate());
|
||||||
if (theResource instanceof IResource) {
|
|
||||||
entity.setLanguage(((IResource) theResource).getLanguage().getValue());
|
|
||||||
} else {
|
|
||||||
entity.setLanguage(((IAnyResource) theResource).getLanguageElement().getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
newParams.populateResourceTableSearchParamsPresentFlags(entity);
|
newParams.populateResourceTableSearchParamsPresentFlags(entity);
|
||||||
entity.setIndexStatus(INDEX_STATUS_INDEXED);
|
entity.setIndexStatus(INDEX_STATUS_INDEXED);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,25 @@
|
||||||
package ca.uhn.fhir.jpa.dao;
|
package ca.uhn.fhir.jpa.dao;
|
||||||
|
|
||||||
|
/*-
|
||||||
|
* #%L
|
||||||
|
* HAPI FHIR JPA Server
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2014 - 2021 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%
|
||||||
|
*/
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -559,11 +559,6 @@ class PredicateBuilderReference extends BasePredicateBuilder {
|
||||||
myPredicateBuilder.addPredicateResourceId(theAndOrParams, theResourceName, theRequestPartitionId);
|
myPredicateBuilder.addPredicateResourceId(theAndOrParams, theResourceName, theRequestPartitionId);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IAnyResource.SP_RES_LANGUAGE:
|
|
||||||
addPredicateLanguage(theAndOrParams,
|
|
||||||
null);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Constants.PARAM_HAS:
|
case Constants.PARAM_HAS:
|
||||||
addPredicateHas(theResourceName, theAndOrParams, theRequest, theRequestPartitionId);
|
addPredicateHas(theResourceName, theAndOrParams, theRequest, theRequestPartitionId);
|
||||||
break;
|
break;
|
||||||
|
@ -733,9 +728,6 @@ class PredicateBuilderReference extends BasePredicateBuilder {
|
||||||
null,
|
null,
|
||||||
theFilter.getValue());
|
theFilter.getValue());
|
||||||
return myPredicateBuilder.addPredicateResourceId(Collections.singletonList(Collections.singletonList(param)), myResourceName, theFilter.getOperation(), theRequestPartitionId);
|
return myPredicateBuilder.addPredicateResourceId(Collections.singletonList(Collections.singletonList(param)), myResourceName, theFilter.getOperation(), theRequestPartitionId);
|
||||||
} else if (theFilter.getParamPath().getName().equals(IAnyResource.SP_RES_LANGUAGE)) {
|
|
||||||
return addPredicateLanguage(Collections.singletonList(Collections.singletonList(new StringParam(theFilter.getValue()))),
|
|
||||||
theFilter.getOperation());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RuntimeSearchParam searchParam = mySearchParamRegistry.getActiveSearchParam(theResourceName, theFilter.getParamPath().getName());
|
RuntimeSearchParam searchParam = mySearchParamRegistry.getActiveSearchParam(theResourceName, theFilter.getParamPath().getName());
|
||||||
|
@ -828,45 +820,6 @@ class PredicateBuilderReference extends BasePredicateBuilder {
|
||||||
return qp;
|
return qp;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Predicate addPredicateLanguage(List<List<IQueryParameterType>> theList,
|
|
||||||
SearchFilterParser.CompareOperation operation) {
|
|
||||||
for (List<? extends IQueryParameterType> nextList : theList) {
|
|
||||||
|
|
||||||
Set<String> values = new HashSet<>();
|
|
||||||
for (IQueryParameterType next : nextList) {
|
|
||||||
if (next instanceof StringParam) {
|
|
||||||
String nextValue = ((StringParam) next).getValue();
|
|
||||||
if (isBlank(nextValue)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
values.add(nextValue);
|
|
||||||
} else {
|
|
||||||
throw new InternalErrorException("Language parameter must be of type " + StringParam.class.getCanonicalName() + " - Got " + next.getClass().getCanonicalName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (values.isEmpty()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Predicate predicate;
|
|
||||||
if ((operation == null) ||
|
|
||||||
(operation == SearchFilterParser.CompareOperation.eq)) {
|
|
||||||
predicate = myQueryStack.get("myLanguage").as(String.class).in(values);
|
|
||||||
} else if (operation == SearchFilterParser.CompareOperation.ne) {
|
|
||||||
predicate = myQueryStack.get("myLanguage").as(String.class).in(values).not();
|
|
||||||
} else {
|
|
||||||
throw new InvalidRequestException("Unsupported operator specified in language query, only \"eq\" and \"ne\" are supported");
|
|
||||||
}
|
|
||||||
myQueryStack.addPredicate(predicate);
|
|
||||||
if (operation != null) {
|
|
||||||
return predicate;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addPredicateSource(List<List<IQueryParameterType>> theAndOrParams, RequestDetails theRequest) {
|
private void addPredicateSource(List<List<IQueryParameterType>> theAndOrParams, RequestDetails theRequest) {
|
||||||
for (List<? extends IQueryParameterType> nextAnd : theAndOrParams) {
|
for (List<? extends IQueryParameterType> nextAnd : theAndOrParams) {
|
||||||
addPredicateSource(nextAnd, SearchFilterParser.CompareOperation.eq, theRequest);
|
addPredicateSource(nextAnd, SearchFilterParser.CompareOperation.eq, theRequest);
|
||||||
|
|
|
@ -261,6 +261,9 @@ class PredicateBuilderToken extends BasePredicateBuilder implements IPredicateBu
|
||||||
if (theSearchParam != null) {
|
if (theSearchParam != null) {
|
||||||
Set<String> valueSetUris = Sets.newHashSet();
|
Set<String> valueSetUris = Sets.newHashSet();
|
||||||
for (String nextPath : theSearchParam.getPathsSplit()) {
|
for (String nextPath : theSearchParam.getPathsSplit()) {
|
||||||
|
if (!nextPath.startsWith(myResourceType + ".")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
BaseRuntimeChildDefinition def = myContext.newTerser().getDefinition(myResourceType, nextPath);
|
BaseRuntimeChildDefinition def = myContext.newTerser().getDefinition(myResourceType, nextPath);
|
||||||
if (def instanceof BaseRuntimeDeclaredChildDefinition) {
|
if (def instanceof BaseRuntimeDeclaredChildDefinition) {
|
||||||
String valueSet = ((BaseRuntimeDeclaredChildDefinition) def).getBindingValueSet();
|
String valueSet = ((BaseRuntimeDeclaredChildDefinition) def).getBindingValueSet();
|
||||||
|
|
|
@ -92,8 +92,12 @@ public class FhirResourceDaoSearchParameterR4 extends BaseHapiFhirResourceDao<Se
|
||||||
for (IPrimitiveType<?> nextBaseType : theResource.getBase()) {
|
for (IPrimitiveType<?> nextBaseType : theResource.getBase()) {
|
||||||
String nextBase = nextBaseType.getValueAsString();
|
String nextBase = nextBaseType.getValueAsString();
|
||||||
RuntimeSearchParam existingSearchParam = theSearchParamRegistry.getActiveSearchParam(nextBase, theResource.getCode());
|
RuntimeSearchParam existingSearchParam = theSearchParamRegistry.getActiveSearchParam(nextBase, theResource.getCode());
|
||||||
if (existingSearchParam != null && existingSearchParam.getId() == null) {
|
if (existingSearchParam != null) {
|
||||||
throw new UnprocessableEntityException("Can not override built-in search parameter " + nextBase + ":" + theResource.getCode() + " because overriding is disabled on this server");
|
boolean isBuiltIn = existingSearchParam.getId() == null;
|
||||||
|
isBuiltIn |= existingSearchParam.getUri().startsWith("http://hl7.org/fhir/SearchParameter/");
|
||||||
|
if (isBuiltIn) {
|
||||||
|
throw new UnprocessableEntityException("Can not override built-in search parameter " + nextBase + ":" + theResource.getCode() + " because overriding is disabled on this server");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -434,9 +434,6 @@ public class QueryStack {
|
||||||
param.setValueAsQueryToken(null, null, null, theFilter.getValue());
|
param.setValueAsQueryToken(null, null, null, theFilter.getValue());
|
||||||
return theQueryStack3.createPredicateResourceId(null, Collections.singletonList(Collections.singletonList(param)), theResourceName, theFilter.getOperation(), theRequestPartitionId);
|
return theQueryStack3.createPredicateResourceId(null, Collections.singletonList(Collections.singletonList(param)), theResourceName, theFilter.getOperation(), theRequestPartitionId);
|
||||||
}
|
}
|
||||||
case IAnyResource.SP_RES_LANGUAGE: {
|
|
||||||
return theQueryStack3.createPredicateLanguage(Collections.singletonList(Collections.singletonList(new StringParam(theFilter.getValue()))), theFilter.getOperation());
|
|
||||||
}
|
|
||||||
case Constants.PARAM_SOURCE: {
|
case Constants.PARAM_SOURCE: {
|
||||||
TokenParam param = new TokenParam();
|
TokenParam param = new TokenParam();
|
||||||
param.setValueAsQueryToken(null, null, null, theFilter.getValue());
|
param.setValueAsQueryToken(null, null, null, theFilter.getValue());
|
||||||
|
@ -579,44 +576,6 @@ public class QueryStack {
|
||||||
return toAndPredicate(andPredicates);
|
return toAndPredicate(andPredicates);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Condition createPredicateLanguage(List<List<IQueryParameterType>> theList, Object theOperation) {
|
|
||||||
|
|
||||||
ResourceTablePredicateBuilder rootTable = mySqlBuilder.getOrCreateResourceTablePredicateBuilder();
|
|
||||||
|
|
||||||
List<Condition> predicates = new ArrayList<>();
|
|
||||||
for (List<? extends IQueryParameterType> nextList : theList) {
|
|
||||||
|
|
||||||
Set<String> values = new HashSet<>();
|
|
||||||
for (IQueryParameterType next : nextList) {
|
|
||||||
if (next instanceof StringParam) {
|
|
||||||
String nextValue = ((StringParam) next).getValue();
|
|
||||||
if (isBlank(nextValue)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
values.add(nextValue);
|
|
||||||
} else {
|
|
||||||
throw new InternalErrorException("Language parameter must be of type " + StringParam.class.getCanonicalName() + " - Got " + next.getClass().getCanonicalName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (values.isEmpty()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((theOperation == null) ||
|
|
||||||
(theOperation == SearchFilterParser.CompareOperation.eq)) {
|
|
||||||
predicates.add(rootTable.createLanguagePredicate(values, false));
|
|
||||||
} else if (theOperation == SearchFilterParser.CompareOperation.ne) {
|
|
||||||
predicates.add(rootTable.createLanguagePredicate(values, true));
|
|
||||||
} else {
|
|
||||||
throw new InvalidRequestException("Unsupported operator specified in language query, only \"eq\" and \"ne\" are supported");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return toAndPredicate(predicates);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Condition createPredicateNumber(@Nullable DbColumn theSourceJoinColumn, String theResourceName,
|
public Condition createPredicateNumber(@Nullable DbColumn theSourceJoinColumn, String theResourceName,
|
||||||
String theSpnamePrefix, RuntimeSearchParam theSearchParam, List<? extends IQueryParameterType> theList,
|
String theSpnamePrefix, RuntimeSearchParam theSearchParam, List<? extends IQueryParameterType> theList,
|
||||||
SearchFilterParser.CompareOperation theOperation, RequestPartitionId theRequestPartitionId) {
|
SearchFilterParser.CompareOperation theOperation, RequestPartitionId theRequestPartitionId) {
|
||||||
|
@ -1099,9 +1058,6 @@ public class QueryStack {
|
||||||
case IAnyResource.SP_RES_ID:
|
case IAnyResource.SP_RES_ID:
|
||||||
return createPredicateResourceId(theSourceJoinColumn, theAndOrParams, theResourceName, null, theRequestPartitionId);
|
return createPredicateResourceId(theSourceJoinColumn, theAndOrParams, theResourceName, null, theRequestPartitionId);
|
||||||
|
|
||||||
case IAnyResource.SP_RES_LANGUAGE:
|
|
||||||
return createPredicateLanguage(theAndOrParams, null);
|
|
||||||
|
|
||||||
case Constants.PARAM_HAS:
|
case Constants.PARAM_HAS:
|
||||||
return createPredicateHas(theSourceJoinColumn, theResourceName, theAndOrParams, theRequest, theRequestPartitionId);
|
return createPredicateHas(theSourceJoinColumn, theResourceName, theAndOrParams, theRequest, theRequestPartitionId);
|
||||||
|
|
||||||
|
|
|
@ -222,7 +222,7 @@ public class TokenPredicateBuilder extends BaseSearchParamPredicateBuilder {
|
||||||
if (retVal == null) {
|
if (retVal == null) {
|
||||||
if (theSearchParam != null) {
|
if (theSearchParam != null) {
|
||||||
Set<String> valueSetUris = Sets.newHashSet();
|
Set<String> valueSetUris = Sets.newHashSet();
|
||||||
for (String nextPath : theSearchParam.getPathsSplit()) {
|
for (String nextPath : theSearchParam.getPathsSplitForResourceType(getResourceType())) {
|
||||||
Class<? extends IBaseResource> type = getFhirContext().getResourceDefinition(getResourceType()).getImplementingClass();
|
Class<? extends IBaseResource> type = getFhirContext().getResourceDefinition(getResourceType()).getImplementingClass();
|
||||||
BaseRuntimeChildDefinition def = getFhirContext().newTerser().getDefinition(type, nextPath);
|
BaseRuntimeChildDefinition def = getFhirContext().newTerser().getDefinition(type, nextPath);
|
||||||
if (def instanceof BaseRuntimeDeclaredChildDefinition) {
|
if (def instanceof BaseRuntimeDeclaredChildDefinition) {
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
package ca.uhn.fhir.jpa.bulk;
|
package ca.uhn.fhir.jpa.bulk;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
|
import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
|
||||||
import ca.uhn.fhir.rest.api.server.bulk.BulkDataExportOptions;
|
|
||||||
import ca.uhn.fhir.jpa.bulk.export.api.IBulkDataExportSvc;
|
import ca.uhn.fhir.jpa.bulk.export.api.IBulkDataExportSvc;
|
||||||
import ca.uhn.fhir.jpa.bulk.export.model.BulkExportResponseJson;
|
|
||||||
import ca.uhn.fhir.jpa.bulk.export.model.BulkExportJobStatusEnum;
|
import ca.uhn.fhir.jpa.bulk.export.model.BulkExportJobStatusEnum;
|
||||||
|
import ca.uhn.fhir.jpa.bulk.export.model.BulkExportResponseJson;
|
||||||
import ca.uhn.fhir.jpa.bulk.export.provider.BulkDataExportProvider;
|
import ca.uhn.fhir.jpa.bulk.export.provider.BulkDataExportProvider;
|
||||||
import ca.uhn.fhir.jpa.model.util.JpaConstants;
|
import ca.uhn.fhir.jpa.model.util.JpaConstants;
|
||||||
import ca.uhn.fhir.rest.api.Constants;
|
import ca.uhn.fhir.rest.api.Constants;
|
||||||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||||
|
import ca.uhn.fhir.rest.api.server.bulk.BulkDataExportOptions;
|
||||||
import ca.uhn.fhir.rest.client.apache.ResourceEntity;
|
import ca.uhn.fhir.rest.client.apache.ResourceEntity;
|
||||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
|
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
|
||||||
|
@ -55,11 +54,8 @@ import static org.hamcrest.Matchers.is;
|
||||||
import static org.hamcrest.Matchers.notNullValue;
|
import static org.hamcrest.Matchers.notNullValue;
|
||||||
import static org.hamcrest.Matchers.nullValue;
|
import static org.hamcrest.Matchers.nullValue;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
import static org.mockito.ArgumentMatchers.anyBoolean;
|
import static org.mockito.ArgumentMatchers.anyBoolean;
|
||||||
import static org.mockito.ArgumentMatchers.isNull;
|
|
||||||
import static org.mockito.ArgumentMatchers.nullable;
|
import static org.mockito.ArgumentMatchers.nullable;
|
||||||
import static org.mockito.Mockito.eq;
|
import static org.mockito.Mockito.eq;
|
||||||
import static org.mockito.Mockito.times;
|
import static org.mockito.Mockito.times;
|
||||||
|
@ -74,7 +70,7 @@ public class BulkDataExportProviderTest {
|
||||||
private static final String GROUP_ID = "Group/G2401";
|
private static final String GROUP_ID = "Group/G2401";
|
||||||
private static final String G_JOB_ID = "0000000-GGGGGG";
|
private static final String G_JOB_ID = "0000000-GGGGGG";
|
||||||
private Server myServer;
|
private Server myServer;
|
||||||
private final FhirContext myCtx = FhirContext.forCached(FhirVersionEnum.R4);
|
private final FhirContext myCtx = FhirContext.forR4Cached();
|
||||||
private int myPort;
|
private int myPort;
|
||||||
@Mock
|
@Mock
|
||||||
private IBulkDataExportSvc myBulkDataExportSvc;
|
private IBulkDataExportSvc myBulkDataExportSvc;
|
||||||
|
@ -478,9 +474,9 @@ public class BulkDataExportProviderTest {
|
||||||
when(myBulkDataExportSvc.submitJob(any(), any(), nullable(RequestDetails.class))).thenReturn(jobInfo);
|
when(myBulkDataExportSvc.submitJob(any(), any(), nullable(RequestDetails.class))).thenReturn(jobInfo);
|
||||||
|
|
||||||
String url = "http://localhost:" + myPort + "/" + "Group/123/" +JpaConstants.OPERATION_EXPORT
|
String url = "http://localhost:" + myPort + "/" + "Group/123/" +JpaConstants.OPERATION_EXPORT
|
||||||
+ "?" + JpaConstants.PARAM_EXPORT_OUTPUT_FORMAT + "=" + UrlUtil.escapeUrlParam(Constants.CT_FHIR_NDJSON);;
|
+ "?" + JpaConstants.PARAM_EXPORT_OUTPUT_FORMAT + "=" + UrlUtil.escapeUrlParam(Constants.CT_FHIR_NDJSON);
|
||||||
|
|
||||||
HttpGet get = new HttpGet(url);
|
HttpGet get = new HttpGet(url);
|
||||||
get.addHeader(Constants.HEADER_PREFER, Constants.HEADER_PREFER_RESPOND_ASYNC);
|
get.addHeader(Constants.HEADER_PREFER, Constants.HEADER_PREFER_RESPOND_ASYNC);
|
||||||
CloseableHttpResponse execute = myClient.execute(get);
|
CloseableHttpResponse execute = myClient.execute(get);
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,18 @@
|
||||||
package ca.uhn.fhir.jpa.dao;
|
package ca.uhn.fhir.jpa.dao;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.parser.DataFormatException;
|
import ca.uhn.fhir.parser.DataFormatException;
|
||||||
import ca.uhn.fhir.parser.LenientErrorHandler;
|
import ca.uhn.fhir.parser.LenientErrorHandler;
|
||||||
import org.hl7.fhir.r4.model.Observation;
|
import org.hl7.fhir.r4.model.Observation;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
|
||||||
|
|
||||||
public class TolerantJsonParserR4Test {
|
public class TolerantJsonParserR4Test {
|
||||||
|
|
||||||
private FhirContext myFhirContext = FhirContext.forCached(FhirVersionEnum.R4);
|
private final FhirContext myFhirContext = FhirContext.forR4Cached();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParseInvalidNumeric_LeadingDecimal() {
|
public void testParseInvalidNumeric_LeadingDecimal() {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ca.uhn.fhir.jpa.dao;
|
package ca.uhn.fhir.jpa.dao;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.interceptor.executor.InterceptorService;
|
import ca.uhn.fhir.interceptor.executor.InterceptorService;
|
||||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||||
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
|
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
|
||||||
|
@ -123,7 +122,7 @@ public class TransactionProcessorTest {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public FhirContext fhirContext() {
|
public FhirContext fhirContext() {
|
||||||
return FhirContext.forCached(FhirVersionEnum.R4);
|
return FhirContext.forR4Cached();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|
|
@ -1033,7 +1033,7 @@ public class FhirResourceDaoDstu2SearchCustomSearchParamTest extends BaseJpaDstu
|
||||||
myPatientDao.search(map).size();
|
myPatientDao.search(map).size();
|
||||||
fail();
|
fail();
|
||||||
} catch (InvalidRequestException e) {
|
} catch (InvalidRequestException e) {
|
||||||
assertEquals("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _language, _lastUpdated, active, address, address-city, address-country, address-postalcode, address-state, address-use, animal-breed, animal-species, birthdate, careprovider, deathdate, deceased, email, family, gender, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
|
assertEquals("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _lastUpdated, active, address, address-city, address-country, address-postalcode, address-state, address-use, animal-breed, animal-species, birthdate, careprovider, deathdate, deceased, email, family, gender, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1070,7 +1070,7 @@ public class FhirResourceDaoDstu2SearchCustomSearchParamTest extends BaseJpaDstu
|
||||||
myPatientDao.search(map).size();
|
myPatientDao.search(map).size();
|
||||||
fail();
|
fail();
|
||||||
} catch (InvalidRequestException e) {
|
} catch (InvalidRequestException e) {
|
||||||
assertEquals("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _language, _lastUpdated, active, address, address-city, address-country, address-postalcode, address-state, address-use, animal-breed, animal-species, birthdate, careprovider, deathdate, deceased, email, family, gender, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
|
assertEquals("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _lastUpdated, active, address, address-city, address-country, address-postalcode, address-state, address-use, animal-breed, animal-species, birthdate, careprovider, deathdate, deceased, email, family, gender, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try with normal gender SP
|
// Try with normal gender SP
|
||||||
|
|
|
@ -727,9 +727,6 @@ public class FhirResourceDaoDstu2SearchNoFtTest extends BaseJpaDstu2Test {
|
||||||
params.add("_id", new StringDt("TEST"));
|
params.add("_id", new StringDt("TEST"));
|
||||||
assertEquals(1, toList(myPatientDao.search(params)).size());
|
assertEquals(1, toList(myPatientDao.search(params)).size());
|
||||||
|
|
||||||
params.add("_language", new StringParam("TEST"));
|
|
||||||
assertEquals(1, toList(myPatientDao.search(params)).size());
|
|
||||||
|
|
||||||
params.add(Patient.SP_IDENTIFIER, new TokenParam("TEST", "TEST"));
|
params.add(Patient.SP_IDENTIFIER, new TokenParam("TEST", "TEST"));
|
||||||
assertEquals(1, toList(myPatientDao.search(params)).size());
|
assertEquals(1, toList(myPatientDao.search(params)).size());
|
||||||
|
|
||||||
|
@ -744,9 +741,6 @@ public class FhirResourceDaoDstu2SearchNoFtTest extends BaseJpaDstu2Test {
|
||||||
params.add("_id", new StringDt("TEST"));
|
params.add("_id", new StringDt("TEST"));
|
||||||
assertEquals(0, toList(myPatientDao.search(params)).size());
|
assertEquals(0, toList(myPatientDao.search(params)).size());
|
||||||
|
|
||||||
params.add("_language", new StringParam("TEST"));
|
|
||||||
assertEquals(0, toList(myPatientDao.search(params)).size());
|
|
||||||
|
|
||||||
params.add(Patient.SP_IDENTIFIER, new TokenParam("TEST", "TEST"));
|
params.add(Patient.SP_IDENTIFIER, new TokenParam("TEST", "TEST"));
|
||||||
assertEquals(0, toList(myPatientDao.search(params)).size());
|
assertEquals(0, toList(myPatientDao.search(params)).size());
|
||||||
|
|
||||||
|
@ -766,148 +760,6 @@ public class FhirResourceDaoDstu2SearchNoFtTest extends BaseJpaDstu2Test {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSearchLanguageParam() {
|
|
||||||
IIdType id1;
|
|
||||||
{
|
|
||||||
Patient patient = new Patient();
|
|
||||||
patient.getLanguage().setValue("en_CA");
|
|
||||||
patient.addIdentifier().setSystem("urn:system").setValue("001");
|
|
||||||
patient.addName().addFamily("testSearchLanguageParam").addGiven("Joe");
|
|
||||||
id1 = myPatientDao.create(patient, mySrd).getId();
|
|
||||||
}
|
|
||||||
IIdType id2;
|
|
||||||
{
|
|
||||||
Patient patient = new Patient();
|
|
||||||
patient.getLanguage().setValue("en_US");
|
|
||||||
patient.addIdentifier().setSystem("urn:system").setValue("002");
|
|
||||||
patient.addName().addFamily("testSearchLanguageParam").addGiven("John");
|
|
||||||
id2 = myPatientDao.create(patient, mySrd).getId();
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
params.setLoadSynchronous(true);
|
|
||||||
params.add(BaseResource.SP_RES_LANGUAGE, new StringParam("en_CA"));
|
|
||||||
List<IResource> patients = toList(myPatientDao.search(params));
|
|
||||||
assertEquals(1, patients.size());
|
|
||||||
assertEquals(id1.toUnqualifiedVersionless(), patients.get(0).getId().toUnqualifiedVersionless());
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
params.setLoadSynchronous(true);
|
|
||||||
params.add(BaseResource.SP_RES_LANGUAGE, new StringParam("en_US"));
|
|
||||||
List<Patient> patients = toList(myPatientDao.search(params));
|
|
||||||
assertEquals(1, patients.size());
|
|
||||||
assertEquals(id2.toUnqualifiedVersionless(), patients.get(0).getId().toUnqualifiedVersionless());
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
params.setLoadSynchronous(true);
|
|
||||||
params.add(BaseResource.SP_RES_LANGUAGE, new StringParam("en_GB"));
|
|
||||||
List<Patient> patients = toList(myPatientDao.search(params));
|
|
||||||
assertEquals(0, patients.size());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSearchLanguageParamAndOr() {
|
|
||||||
IIdType id1;
|
|
||||||
{
|
|
||||||
Patient patient = new Patient();
|
|
||||||
patient.getLanguage().setValue("en_CA");
|
|
||||||
patient.addIdentifier().setSystem("urn:system").setValue("001");
|
|
||||||
patient.addName().addFamily("testSearchLanguageParam").addGiven("Joe");
|
|
||||||
id1 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
|
|
||||||
}
|
|
||||||
|
|
||||||
Date betweenTime = new Date();
|
|
||||||
|
|
||||||
IIdType id2;
|
|
||||||
{
|
|
||||||
Patient patient = new Patient();
|
|
||||||
patient.getLanguage().setValue("en_US");
|
|
||||||
patient.addIdentifier().setSystem("urn:system").setValue("002");
|
|
||||||
patient.addName().addFamily("testSearchLanguageParam").addGiven("John");
|
|
||||||
id2 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
params.setLoadSynchronous(true);
|
|
||||||
params.add(BaseResource.SP_RES_LANGUAGE, new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("en_US")));
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1, id2));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
params.setLoadSynchronous(true);
|
|
||||||
params.add(BaseResource.SP_RES_LANGUAGE, new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("en_US")));
|
|
||||||
params.setLastUpdated(new DateRangeParam(betweenTime, null));
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id2));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
params.setLoadSynchronous(true);
|
|
||||||
params.add(BaseResource.SP_RES_LANGUAGE, new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
params.setLoadSynchronous(true);
|
|
||||||
StringAndListParam and = new StringAndListParam();
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")));
|
|
||||||
params.add(BaseResource.SP_RES_LANGUAGE, and);
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
params.setLoadSynchronous(true);
|
|
||||||
StringAndListParam and = new StringAndListParam();
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("ZZZZZ")));
|
|
||||||
params.add(BaseResource.SP_RES_LANGUAGE, and);
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), empty());
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
params.setLoadSynchronous(true);
|
|
||||||
StringAndListParam and = new StringAndListParam();
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("ZZZZZ")));
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
|
|
||||||
params.add(BaseResource.SP_RES_LANGUAGE, and);
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), empty());
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
params.setLoadSynchronous(true);
|
|
||||||
StringAndListParam and = new StringAndListParam();
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("")).addOr(new StringParam(null)));
|
|
||||||
params.add(BaseResource.SP_RES_LANGUAGE, and);
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
params.setLoadSynchronous(true);
|
|
||||||
params.add("_id", new StringParam(id1.getIdPart()));
|
|
||||||
StringAndListParam and = new StringAndListParam();
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("")).addOr(new StringParam(null)));
|
|
||||||
params.add(BaseResource.SP_RES_LANGUAGE, and);
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
params.setLoadSynchronous(true);
|
|
||||||
StringAndListParam and = new StringAndListParam();
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("")).addOr(new StringParam(null)));
|
|
||||||
params.add(BaseResource.SP_RES_LANGUAGE, and);
|
|
||||||
params.add("_id", new StringParam(id1.getIdPart()));
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSearchLastUpdatedParam() throws InterruptedException {
|
public void testSearchLastUpdatedParam() throws InterruptedException {
|
||||||
String methodName = "testSearchLastUpdatedParam";
|
String methodName = "testSearchLastUpdatedParam";
|
||||||
|
|
|
@ -224,7 +224,7 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCantSearchForDeletedResourceByLanguageOrTag() {
|
public void testCantSearchForDeletedResourceByTag() {
|
||||||
String methodName = "testCantSearchForDeletedResourceByLanguageOrTag";
|
String methodName = "testCantSearchForDeletedResourceByLanguageOrTag";
|
||||||
Organization org = new Organization();
|
Organization org = new Organization();
|
||||||
org.setLanguage(new CodeDt("EN_ca"));
|
org.setLanguage(new CodeDt("EN_ca"));
|
||||||
|
@ -236,9 +236,7 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test {
|
||||||
|
|
||||||
IIdType orgId = myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless();
|
IIdType orgId = myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
SearchParameterMap map = new SearchParameterMap();
|
SearchParameterMap map;
|
||||||
map.add("_language", new StringParam("EN_ca"));
|
|
||||||
assertEquals(1, myOrganizationDao.search(map).size().intValue());
|
|
||||||
|
|
||||||
map = new SearchParameterMap();
|
map = new SearchParameterMap();
|
||||||
map.add("_tag", new TokenParam(methodName, methodName));
|
map.add("_tag", new TokenParam(methodName, methodName));
|
||||||
|
@ -246,10 +244,6 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test {
|
||||||
|
|
||||||
myOrganizationDao.delete(orgId, mySrd);
|
myOrganizationDao.delete(orgId, mySrd);
|
||||||
|
|
||||||
map = new SearchParameterMap();
|
|
||||||
map.add("_language", new StringParam("EN_ca"));
|
|
||||||
assertEquals(0, myOrganizationDao.search(map).size().intValue());
|
|
||||||
|
|
||||||
map = new SearchParameterMap();
|
map = new SearchParameterMap();
|
||||||
map.add("_tag", new TokenParam(methodName, methodName));
|
map.add("_tag", new TokenParam(methodName, methodName));
|
||||||
assertEquals(0, myOrganizationDao.search(map).size().intValue());
|
assertEquals(0, myOrganizationDao.search(map).size().intValue());
|
||||||
|
@ -1603,7 +1597,7 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test {
|
||||||
found = toList(myPatientDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Patient.SP_BIRTHDATE + "AAAA", new DateParam(ParamPrefixEnum.GREATERTHAN, "2000-01-01"))));
|
found = toList(myPatientDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Patient.SP_BIRTHDATE + "AAAA", new DateParam(ParamPrefixEnum.GREATERTHAN, "2000-01-01"))));
|
||||||
assertEquals(0, found.size());
|
assertEquals(0, found.size());
|
||||||
} catch (InvalidRequestException e) {
|
} catch (InvalidRequestException e) {
|
||||||
assertEquals("Unknown search parameter \"birthdateAAAA\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _language, _lastUpdated, active, address, address-city, address-country, address-postalcode, address-state, address-use, animal-breed, animal-species, birthdate, careprovider, deathdate, deceased, email, family, gender, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
|
assertEquals("Unknown search parameter \"birthdateAAAA\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _lastUpdated, active, address, address-city, address-country, address-postalcode, address-state, address-use, animal-breed, animal-species, birthdate, careprovider, deathdate, deceased, email, family, gender, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1015,7 +1015,7 @@ public class FhirResourceDaoDstu3SearchCustomSearchParamTest extends BaseJpaDstu
|
||||||
myPatientDao.search(map).size();
|
myPatientDao.search(map).size();
|
||||||
fail();
|
fail();
|
||||||
} catch (InvalidRequestException e) {
|
} catch (InvalidRequestException e) {
|
||||||
assertEquals("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _language, _lastUpdated, active, address, address-city, address-country, address-postalcode, address-state, address-use, animal-breed, animal-species, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
|
assertEquals("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _lastUpdated, active, address, address-city, address-country, address-postalcode, address-state, address-use, animal-breed, animal-species, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1053,7 +1053,7 @@ public class FhirResourceDaoDstu3SearchCustomSearchParamTest extends BaseJpaDstu
|
||||||
myPatientDao.search(map).size();
|
myPatientDao.search(map).size();
|
||||||
fail();
|
fail();
|
||||||
} catch (InvalidRequestException e) {
|
} catch (InvalidRequestException e) {
|
||||||
assertEquals("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _language, _lastUpdated, active, address, address-city, address-country, address-postalcode, address-state, address-use, animal-breed, animal-species, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
|
assertEquals("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _lastUpdated, active, address, address-city, address-country, address-postalcode, address-state, address-use, animal-breed, animal-species, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try with normal gender SP
|
// Try with normal gender SP
|
||||||
|
|
|
@ -1192,11 +1192,6 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
|
||||||
params.add("_id", new StringParam("TEST"));
|
params.add("_id", new StringParam("TEST"));
|
||||||
assertEquals(1, toList(myPatientDao.search(params)).size());
|
assertEquals(1, toList(myPatientDao.search(params)).size());
|
||||||
|
|
||||||
params = new SearchParameterMap();
|
|
||||||
params.setLoadSynchronous(true);
|
|
||||||
params.add("_language", new StringParam("TEST"));
|
|
||||||
assertEquals(1, toList(myPatientDao.search(params)).size());
|
|
||||||
|
|
||||||
params = new SearchParameterMap();
|
params = new SearchParameterMap();
|
||||||
params.setLoadSynchronous(true);
|
params.setLoadSynchronous(true);
|
||||||
params.add(Patient.SP_IDENTIFIER, new TokenParam("TEST", "TEST"));
|
params.add(Patient.SP_IDENTIFIER, new TokenParam("TEST", "TEST"));
|
||||||
|
@ -1214,11 +1209,6 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
|
||||||
params.add("_id", new StringParam("TEST"));
|
params.add("_id", new StringParam("TEST"));
|
||||||
assertEquals(0, toList(myPatientDao.search(params)).size());
|
assertEquals(0, toList(myPatientDao.search(params)).size());
|
||||||
|
|
||||||
params = new SearchParameterMap();
|
|
||||||
params.setLoadSynchronous(true);
|
|
||||||
params.add("_language", new StringParam("TEST"));
|
|
||||||
assertEquals(0, toList(myPatientDao.search(params)).size());
|
|
||||||
|
|
||||||
params = new SearchParameterMap();
|
params = new SearchParameterMap();
|
||||||
params.setLoadSynchronous(true);
|
params.setLoadSynchronous(true);
|
||||||
params.add(Patient.SP_IDENTIFIER, new TokenParam("TEST", "TEST"));
|
params.add(Patient.SP_IDENTIFIER, new TokenParam("TEST", "TEST"));
|
||||||
|
@ -1241,143 +1231,6 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSearchLanguageParam() {
|
|
||||||
IIdType id1;
|
|
||||||
{
|
|
||||||
Patient patient = new Patient();
|
|
||||||
patient.getLanguageElement().setValue("en_CA");
|
|
||||||
patient.addIdentifier().setSystem("urn:system").setValue("001");
|
|
||||||
patient.addName().setFamily("testSearchLanguageParam").addGiven("Joe");
|
|
||||||
id1 = myPatientDao.create(patient, mySrd).getId();
|
|
||||||
}
|
|
||||||
IIdType id2;
|
|
||||||
{
|
|
||||||
Patient patient = new Patient();
|
|
||||||
patient.getLanguageElement().setValue("en_US");
|
|
||||||
patient.addIdentifier().setSystem("urn:system").setValue("002");
|
|
||||||
patient.addName().setFamily("testSearchLanguageParam").addGiven("John");
|
|
||||||
id2 = myPatientDao.create(patient, mySrd).getId();
|
|
||||||
}
|
|
||||||
SearchParameterMap params;
|
|
||||||
{
|
|
||||||
params = new SearchParameterMap();
|
|
||||||
params.setLoadSynchronous(true);
|
|
||||||
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, new StringParam("en_CA"));
|
|
||||||
List<IBaseResource> patients = toList(myPatientDao.search(params));
|
|
||||||
assertEquals(1, patients.size());
|
|
||||||
assertEquals(id1.toUnqualifiedVersionless(), patients.get(0).getIdElement().toUnqualifiedVersionless());
|
|
||||||
}
|
|
||||||
{
|
|
||||||
params = new SearchParameterMap();
|
|
||||||
params.setLoadSynchronous(true);
|
|
||||||
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, new StringParam("en_US"));
|
|
||||||
List<Patient> patients = toList(myPatientDao.search(params));
|
|
||||||
assertEquals(1, patients.size());
|
|
||||||
assertEquals(id2.toUnqualifiedVersionless(), patients.get(0).getIdElement().toUnqualifiedVersionless());
|
|
||||||
}
|
|
||||||
{
|
|
||||||
params = new SearchParameterMap();
|
|
||||||
params.setLoadSynchronous(true);
|
|
||||||
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, new StringParam("en_GB"));
|
|
||||||
List<Patient> patients = toList(myPatientDao.search(params));
|
|
||||||
assertEquals(0, patients.size());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSearchLanguageParamAndOr() {
|
|
||||||
IIdType id1;
|
|
||||||
{
|
|
||||||
Patient patient = new Patient();
|
|
||||||
patient.getLanguageElement().setValue("en_CA");
|
|
||||||
patient.addIdentifier().setSystem("urn:system").setValue("001");
|
|
||||||
patient.addName().setFamily("testSearchLanguageParam").addGiven("Joe");
|
|
||||||
id1 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
|
|
||||||
}
|
|
||||||
TestUtil.sleepOneClick();
|
|
||||||
Date betweenTime = new Date();
|
|
||||||
|
|
||||||
IIdType id2;
|
|
||||||
{
|
|
||||||
Patient patient = new Patient();
|
|
||||||
patient.getLanguageElement().setValue("en_US");
|
|
||||||
patient.addIdentifier().setSystem("urn:system").setValue("002");
|
|
||||||
patient.addName().setFamily("testSearchLanguageParam").addGiven("John");
|
|
||||||
id2 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("en_US")));
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1, id2));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("en_US")));
|
|
||||||
params.setLastUpdated(new DateRangeParam(betweenTime, null));
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id2));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
StringAndListParam and = new StringAndListParam();
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")));
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, and);
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
StringAndListParam and = new StringAndListParam();
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("ZZZZZ")));
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, and);
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), empty());
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
StringAndListParam and = new StringAndListParam();
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("ZZZZZ")));
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, and);
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), empty());
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
StringAndListParam and = new StringAndListParam();
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("")).addOr(new StringParam(null)));
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, and);
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
params.add("_id", new StringParam(id1.getIdPart()));
|
|
||||||
StringAndListParam and = new StringAndListParam();
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("")).addOr(new StringParam(null)));
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, and);
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
StringAndListParam and = new StringAndListParam();
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("")).addOr(new StringParam(null)));
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, and);
|
|
||||||
params.add("_id", new StringParam(id1.getIdPart()));
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSearchLastUpdatedParam() {
|
public void testSearchLastUpdatedParam() {
|
||||||
String methodName = "testSearchLastUpdatedParam";
|
String methodName = "testSearchLastUpdatedParam";
|
||||||
|
|
|
@ -206,21 +206,12 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test {
|
||||||
IIdType orgId = myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless();
|
IIdType orgId = myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
SearchParameterMap map = new SearchParameterMap();
|
SearchParameterMap map = new SearchParameterMap();
|
||||||
map.add("_language", new StringParam("EN_ca"));
|
|
||||||
assertEquals(1, myOrganizationDao.search(map).size().intValue());
|
|
||||||
|
|
||||||
map = new SearchParameterMap();
|
|
||||||
map.setLoadSynchronous(true);
|
map.setLoadSynchronous(true);
|
||||||
map.add("_tag", new TokenParam(methodName, methodName));
|
map.add("_tag", new TokenParam(methodName, methodName));
|
||||||
assertEquals(1, myOrganizationDao.search(map).size().intValue());
|
assertEquals(1, myOrganizationDao.search(map).size().intValue());
|
||||||
|
|
||||||
myOrganizationDao.delete(orgId, mySrd);
|
myOrganizationDao.delete(orgId, mySrd);
|
||||||
|
|
||||||
map = new SearchParameterMap();
|
|
||||||
map.setLoadSynchronous(true);
|
|
||||||
map.add("_language", new StringParam("EN_ca"));
|
|
||||||
assertEquals(0, myOrganizationDao.search(map).size().intValue());
|
|
||||||
|
|
||||||
map = new SearchParameterMap();
|
map = new SearchParameterMap();
|
||||||
map.setLoadSynchronous(true);
|
map.setLoadSynchronous(true);
|
||||||
map.add("_tag", new TokenParam(methodName, methodName));
|
map.add("_tag", new TokenParam(methodName, methodName));
|
||||||
|
@ -2014,7 +2005,7 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test {
|
||||||
found = toList(myPatientDao.search(new SearchParameterMap(Patient.SP_BIRTHDATE + "AAAA", new DateParam(ParamPrefixEnum.GREATERTHAN, "2000-01-01")).setLoadSynchronous(true)));
|
found = toList(myPatientDao.search(new SearchParameterMap(Patient.SP_BIRTHDATE + "AAAA", new DateParam(ParamPrefixEnum.GREATERTHAN, "2000-01-01")).setLoadSynchronous(true)));
|
||||||
assertEquals(0, found.size());
|
assertEquals(0, found.size());
|
||||||
} catch (InvalidRequestException e) {
|
} catch (InvalidRequestException e) {
|
||||||
assertEquals("Unknown search parameter \"birthdateAAAA\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _language, _lastUpdated, active, address, address-city, address-country, address-postalcode, address-state, address-use, animal-breed, animal-species, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
|
assertEquals("Unknown search parameter \"birthdateAAAA\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _lastUpdated, active, address, address-city, address-country, address-postalcode, address-state, address-use, animal-breed, animal-species, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome;
|
||||||
import ca.uhn.fhir.jpa.model.entity.NormalizedQuantitySearchLevel;
|
import ca.uhn.fhir.jpa.model.entity.NormalizedQuantitySearchLevel;
|
||||||
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamQuantity;
|
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamQuantity;
|
||||||
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamQuantityNormalized;
|
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamQuantityNormalized;
|
||||||
|
import ca.uhn.fhir.jpa.model.entity.ResourceLink;
|
||||||
import ca.uhn.fhir.jpa.model.util.UcumServiceUtil;
|
import ca.uhn.fhir.jpa.model.util.UcumServiceUtil;
|
||||||
import ca.uhn.fhir.jpa.partition.SystemRequestDetails;
|
import ca.uhn.fhir.jpa.partition.SystemRequestDetails;
|
||||||
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
||||||
|
@ -28,6 +29,7 @@ import org.hl7.fhir.r4.model.Observation;
|
||||||
import org.hl7.fhir.r4.model.Organization;
|
import org.hl7.fhir.r4.model.Organization;
|
||||||
import org.hl7.fhir.r4.model.Patient;
|
import org.hl7.fhir.r4.model.Patient;
|
||||||
import org.hl7.fhir.r4.model.Quantity;
|
import org.hl7.fhir.r4.model.Quantity;
|
||||||
|
import org.hl7.fhir.r4.model.Reference;
|
||||||
import org.hl7.fhir.r4.model.SampledData;
|
import org.hl7.fhir.r4.model.SampledData;
|
||||||
import org.hl7.fhir.r4.model.SearchParameter;
|
import org.hl7.fhir.r4.model.SearchParameter;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
|
@ -63,6 +65,30 @@ public class FhirResourceDaoR4CreateTest extends BaseJpaR4Test {
|
||||||
myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED);
|
myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreateLinkCreatesAppropriatePaths() {
|
||||||
|
Patient p = new Patient();
|
||||||
|
p.setId("Patient/A");
|
||||||
|
p.setActive(true);
|
||||||
|
myPatientDao.update(p, mySrd);
|
||||||
|
|
||||||
|
Observation obs = new Observation();
|
||||||
|
obs.setSubject(new Reference("Patient/A"));
|
||||||
|
myObservationDao.create(obs, mySrd);
|
||||||
|
|
||||||
|
runInTransaction(() ->{
|
||||||
|
List<ResourceLink> allLinks = myResourceLinkDao.findAll();
|
||||||
|
List<String> paths = allLinks
|
||||||
|
.stream()
|
||||||
|
.map(t -> t.getSourcePath())
|
||||||
|
.sorted()
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
assertThat(paths.toString(), paths, contains("Observation.subject", "Observation.subject.where(resolve() is Patient)"));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testConditionalCreateWithPlusInUrl() {
|
public void testConditionalCreateWithPlusInUrl() {
|
||||||
Observation obs = new Observation();
|
Observation obs = new Observation();
|
||||||
|
|
|
@ -349,28 +349,6 @@ public class FhirResourceDaoR4FilterLegacySearchBuilderTest extends BaseJpaR4Tes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testLanguageComparatorEq() {
|
|
||||||
|
|
||||||
Patient p = new Patient();
|
|
||||||
p.setLanguage("en");
|
|
||||||
p.addName().setFamily("Smith").addGiven("John");
|
|
||||||
p.setBirthDateElement(new DateType("1955-01-01"));
|
|
||||||
p.setActive(true);
|
|
||||||
String id1 = myPatientDao.create(p).getId().toUnqualifiedVersionless().getValue();
|
|
||||||
|
|
||||||
SearchParameterMap map;
|
|
||||||
List<String> found;
|
|
||||||
|
|
||||||
map = new SearchParameterMap();
|
|
||||||
map.setLoadSynchronous(true);
|
|
||||||
map.add(Constants.PARAM_FILTER, new StringParam("_language eq en"));
|
|
||||||
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
|
||||||
assertThat(found, containsInAnyOrder(id1));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testStringComparatorCo() {
|
public void testStringComparatorCo() {
|
||||||
|
|
|
@ -347,28 +347,6 @@ public class FhirResourceDaoR4FilterTest extends BaseJpaR4Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testLanguageComparatorEq() {
|
|
||||||
|
|
||||||
Patient p = new Patient();
|
|
||||||
p.setLanguage("en");
|
|
||||||
p.addName().setFamily("Smith").addGiven("John");
|
|
||||||
p.setBirthDateElement(new DateType("1955-01-01"));
|
|
||||||
p.setActive(true);
|
|
||||||
String id1 = myPatientDao.create(p).getId().toUnqualifiedVersionless().getValue();
|
|
||||||
|
|
||||||
SearchParameterMap map;
|
|
||||||
List<String> found;
|
|
||||||
|
|
||||||
map = new SearchParameterMap();
|
|
||||||
map.setLoadSynchronous(true);
|
|
||||||
map.add(Constants.PARAM_FILTER, new StringParam("_language eq en"));
|
|
||||||
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
|
||||||
assertThat(found, containsInAnyOrder(id1));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testStringComparatorCo() {
|
public void testStringComparatorCo() {
|
||||||
|
@ -1254,7 +1232,7 @@ public class FhirResourceDaoR4FilterTest extends BaseJpaR4Test {
|
||||||
try {
|
try {
|
||||||
myPatientDao.search(map);
|
myPatientDao.search(map);
|
||||||
} catch (InvalidRequestException e) {
|
} catch (InvalidRequestException e) {
|
||||||
assertEquals("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _language, _lastUpdated, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
|
assertEquals("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_content, _id, _lastUpdated, _profile, _security, _source, _tag, _text, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2369,14 +2369,6 @@ public class FhirResourceDaoR4LegacySearchBuilderTest extends BaseJpaR4Test {
|
||||||
params.add("_id", new StringParam("TEST"));
|
params.add("_id", new StringParam("TEST"));
|
||||||
assertEquals(1, toList(myPatientDao.search(params)).size());
|
assertEquals(1, toList(myPatientDao.search(params)).size());
|
||||||
|
|
||||||
params = new SearchParameterMap();
|
|
||||||
params.setLoadSynchronous(true);
|
|
||||||
params.add("_language", new StringParam("TEST"));
|
|
||||||
myCaptureQueriesListener.clear();
|
|
||||||
result = toList(myPatientDao.search(params));
|
|
||||||
myCaptureQueriesListener.logSelectQueriesForCurrentThread(0);
|
|
||||||
assertEquals(1, result.size());
|
|
||||||
|
|
||||||
params = new SearchParameterMap();
|
params = new SearchParameterMap();
|
||||||
params.setLoadSynchronous(true);
|
params.setLoadSynchronous(true);
|
||||||
params.add(Patient.SP_IDENTIFIER, new TokenParam("TEST", "TEST"));
|
params.add(Patient.SP_IDENTIFIER, new TokenParam("TEST", "TEST"));
|
||||||
|
@ -2394,11 +2386,6 @@ public class FhirResourceDaoR4LegacySearchBuilderTest extends BaseJpaR4Test {
|
||||||
params.add("_id", new StringParam("TEST"));
|
params.add("_id", new StringParam("TEST"));
|
||||||
assertEquals(0, toList(myPatientDao.search(params)).size());
|
assertEquals(0, toList(myPatientDao.search(params)).size());
|
||||||
|
|
||||||
params = new SearchParameterMap();
|
|
||||||
params.setLoadSynchronous(true);
|
|
||||||
params.add("_language", new StringParam("TEST"));
|
|
||||||
assertEquals(0, toList(myPatientDao.search(params)).size());
|
|
||||||
|
|
||||||
params = new SearchParameterMap();
|
params = new SearchParameterMap();
|
||||||
params.setLoadSynchronous(true);
|
params.setLoadSynchronous(true);
|
||||||
params.add(Patient.SP_IDENTIFIER, new TokenParam("TEST", "TEST"));
|
params.add(Patient.SP_IDENTIFIER, new TokenParam("TEST", "TEST"));
|
||||||
|
@ -2421,149 +2408,6 @@ public class FhirResourceDaoR4LegacySearchBuilderTest extends BaseJpaR4Test {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSearchLanguageParam() {
|
|
||||||
IIdType id1;
|
|
||||||
{
|
|
||||||
Patient patient = new Patient();
|
|
||||||
patient.getLanguageElement().setValue("en_CA");
|
|
||||||
patient.addIdentifier().setSystem("urn:system").setValue("001");
|
|
||||||
patient.addName().setFamily("testSearchLanguageParam").addGiven("Joe");
|
|
||||||
id1 = myPatientDao.create(patient, mySrd).getId();
|
|
||||||
}
|
|
||||||
IIdType id2;
|
|
||||||
{
|
|
||||||
Patient patient = new Patient();
|
|
||||||
patient.getLanguageElement().setValue("en_US");
|
|
||||||
patient.addIdentifier().setSystem("urn:system").setValue("002");
|
|
||||||
patient.addName().setFamily("testSearchLanguageParam").addGiven("John");
|
|
||||||
id2 = myPatientDao.create(patient, mySrd).getId();
|
|
||||||
}
|
|
||||||
SearchParameterMap params;
|
|
||||||
{
|
|
||||||
params = new SearchParameterMap();
|
|
||||||
params.setLoadSynchronous(true);
|
|
||||||
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, new StringParam("en_CA"));
|
|
||||||
myCaptureQueriesListener.clear();
|
|
||||||
List<IBaseResource> patients = toList(myPatientDao.search(params));
|
|
||||||
myCaptureQueriesListener.logSelectQueriesForCurrentThread(0);
|
|
||||||
assertEquals(1, patients.size());
|
|
||||||
assertEquals(id1.toUnqualifiedVersionless(), patients.get(0).getIdElement().toUnqualifiedVersionless());
|
|
||||||
}
|
|
||||||
{
|
|
||||||
params = new SearchParameterMap();
|
|
||||||
params.setLoadSynchronous(true);
|
|
||||||
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, new StringParam("en_US"));
|
|
||||||
List<Patient> patients = toList(myPatientDao.search(params));
|
|
||||||
assertEquals(1, patients.size());
|
|
||||||
assertEquals(id2.toUnqualifiedVersionless(), patients.get(0).getIdElement().toUnqualifiedVersionless());
|
|
||||||
}
|
|
||||||
{
|
|
||||||
params = new SearchParameterMap();
|
|
||||||
params.setLoadSynchronous(true);
|
|
||||||
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, new StringParam("en_GB"));
|
|
||||||
List<Patient> patients = toList(myPatientDao.search(params));
|
|
||||||
assertEquals(0, patients.size());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSearchLanguageParamAndOr() {
|
|
||||||
IIdType id1;
|
|
||||||
{
|
|
||||||
Patient patient = new Patient();
|
|
||||||
patient.getLanguageElement().setValue("en_CA");
|
|
||||||
patient.addIdentifier().setSystem("urn:system").setValue("001");
|
|
||||||
patient.addName().setFamily("testSearchLanguageParam").addGiven("Joe");
|
|
||||||
id1 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
|
|
||||||
}
|
|
||||||
|
|
||||||
TestUtil.sleepOneClick();
|
|
||||||
|
|
||||||
Date betweenTime = new Date();
|
|
||||||
|
|
||||||
TestUtil.sleepOneClick();
|
|
||||||
|
|
||||||
IIdType id2;
|
|
||||||
{
|
|
||||||
Patient patient = new Patient();
|
|
||||||
patient.getLanguageElement().setValue("en_US");
|
|
||||||
patient.addIdentifier().setSystem("urn:system").setValue("002");
|
|
||||||
patient.addName().setFamily("testSearchLanguageParam").addGiven("John");
|
|
||||||
id2 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("en_US")));
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1, id2));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("en_US")));
|
|
||||||
params.setLastUpdated(new DateRangeParam(betweenTime, null));
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id2));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
StringAndListParam and = new StringAndListParam();
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")));
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, and);
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
StringAndListParam and = new StringAndListParam();
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("ZZZZZ")));
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, and);
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), empty());
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
StringAndListParam and = new StringAndListParam();
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("ZZZZZ")));
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, and);
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), empty());
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
StringAndListParam and = new StringAndListParam();
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("")).addOr(new StringParam(null)));
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, and);
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
params.add("_id", new StringParam(id1.getIdPart()));
|
|
||||||
StringAndListParam and = new StringAndListParam();
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("")).addOr(new StringParam(null)));
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, and);
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
StringAndListParam and = new StringAndListParam();
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("")).addOr(new StringParam(null)));
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, and);
|
|
||||||
params.add("_id", new StringParam(id1.getIdPart()));
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSearchLastUpdatedParam() {
|
public void testSearchLastUpdatedParam() {
|
||||||
String methodName = "testSearchLastUpdatedParam";
|
String methodName = "testSearchLastUpdatedParam";
|
||||||
|
|
|
@ -1512,7 +1512,7 @@ public class FhirResourceDaoR4SearchCustomSearchParamTest extends BaseJpaR4Test
|
||||||
myPatientDao.search(map).size();
|
myPatientDao.search(map).size();
|
||||||
fail();
|
fail();
|
||||||
} catch (InvalidRequestException e) {
|
} catch (InvalidRequestException e) {
|
||||||
assertEquals("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _language, _lastUpdated, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
|
assertEquals("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_content, _id, _lastUpdated, _profile, _security, _source, _tag, _text, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete the param
|
// Delete the param
|
||||||
|
@ -1528,7 +1528,7 @@ public class FhirResourceDaoR4SearchCustomSearchParamTest extends BaseJpaR4Test
|
||||||
myPatientDao.search(map).size();
|
myPatientDao.search(map).size();
|
||||||
fail();
|
fail();
|
||||||
} catch (InvalidRequestException e) {
|
} catch (InvalidRequestException e) {
|
||||||
assertEquals("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _language, _lastUpdated, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
|
assertEquals("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_content, _id, _lastUpdated, _profile, _security, _source, _tag, _text, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1605,7 +1605,7 @@ public class FhirResourceDaoR4SearchCustomSearchParamTest extends BaseJpaR4Test
|
||||||
myPatientDao.search(map).size();
|
myPatientDao.search(map).size();
|
||||||
fail();
|
fail();
|
||||||
} catch (InvalidRequestException e) {
|
} catch (InvalidRequestException e) {
|
||||||
assertEquals("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _language, _lastUpdated, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
|
assertEquals("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_content, _id, _lastUpdated, _profile, _security, _source, _tag, _text, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try with normal gender SP
|
// Try with normal gender SP
|
||||||
|
|
|
@ -2464,14 +2464,6 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test {
|
||||||
params.add("_id", new StringParam("TEST"));
|
params.add("_id", new StringParam("TEST"));
|
||||||
assertEquals(1, toList(myPatientDao.search(params)).size());
|
assertEquals(1, toList(myPatientDao.search(params)).size());
|
||||||
|
|
||||||
params = new SearchParameterMap();
|
|
||||||
params.setLoadSynchronous(true);
|
|
||||||
params.add("_language", new StringParam("TEST"));
|
|
||||||
myCaptureQueriesListener.clear();
|
|
||||||
result = toList(myPatientDao.search(params));
|
|
||||||
myCaptureQueriesListener.logSelectQueriesForCurrentThread(0);
|
|
||||||
assertEquals(1, result.size());
|
|
||||||
|
|
||||||
params = new SearchParameterMap();
|
params = new SearchParameterMap();
|
||||||
params.setLoadSynchronous(true);
|
params.setLoadSynchronous(true);
|
||||||
params.add(Patient.SP_IDENTIFIER, new TokenParam("TEST", "TEST"));
|
params.add(Patient.SP_IDENTIFIER, new TokenParam("TEST", "TEST"));
|
||||||
|
@ -2489,11 +2481,6 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test {
|
||||||
params.add("_id", new StringParam("TEST"));
|
params.add("_id", new StringParam("TEST"));
|
||||||
assertEquals(0, toList(myPatientDao.search(params)).size());
|
assertEquals(0, toList(myPatientDao.search(params)).size());
|
||||||
|
|
||||||
params = new SearchParameterMap();
|
|
||||||
params.setLoadSynchronous(true);
|
|
||||||
params.add("_language", new StringParam("TEST"));
|
|
||||||
assertEquals(0, toList(myPatientDao.search(params)).size());
|
|
||||||
|
|
||||||
params = new SearchParameterMap();
|
params = new SearchParameterMap();
|
||||||
params.setLoadSynchronous(true);
|
params.setLoadSynchronous(true);
|
||||||
params.add(Patient.SP_IDENTIFIER, new TokenParam("TEST", "TEST"));
|
params.add(Patient.SP_IDENTIFIER, new TokenParam("TEST", "TEST"));
|
||||||
|
@ -2516,148 +2503,6 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSearchLanguageParam() {
|
|
||||||
IIdType id1;
|
|
||||||
{
|
|
||||||
Patient patient = new Patient();
|
|
||||||
patient.getLanguageElement().setValue("en_CA");
|
|
||||||
patient.addIdentifier().setSystem("urn:system").setValue("001");
|
|
||||||
patient.addName().setFamily("testSearchLanguageParam").addGiven("Joe");
|
|
||||||
id1 = myPatientDao.create(patient, mySrd).getId();
|
|
||||||
}
|
|
||||||
IIdType id2;
|
|
||||||
{
|
|
||||||
Patient patient = new Patient();
|
|
||||||
patient.getLanguageElement().setValue("en_US");
|
|
||||||
patient.addIdentifier().setSystem("urn:system").setValue("002");
|
|
||||||
patient.addName().setFamily("testSearchLanguageParam").addGiven("John");
|
|
||||||
id2 = myPatientDao.create(patient, mySrd).getId();
|
|
||||||
}
|
|
||||||
SearchParameterMap params;
|
|
||||||
{
|
|
||||||
params = new SearchParameterMap();
|
|
||||||
params.setLoadSynchronous(true);
|
|
||||||
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, new StringParam("en_CA"));
|
|
||||||
myCaptureQueriesListener.clear();
|
|
||||||
List<IBaseResource> patients = toList(myPatientDao.search(params));
|
|
||||||
myCaptureQueriesListener.logSelectQueriesForCurrentThread(0);
|
|
||||||
assertEquals(1, patients.size());
|
|
||||||
assertEquals(id1.toUnqualifiedVersionless(), patients.get(0).getIdElement().toUnqualifiedVersionless());
|
|
||||||
}
|
|
||||||
{
|
|
||||||
params = new SearchParameterMap();
|
|
||||||
params.setLoadSynchronous(true);
|
|
||||||
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, new StringParam("en_US"));
|
|
||||||
List<Patient> patients = toList(myPatientDao.search(params));
|
|
||||||
assertEquals(1, patients.size());
|
|
||||||
assertEquals(id2.toUnqualifiedVersionless(), patients.get(0).getIdElement().toUnqualifiedVersionless());
|
|
||||||
}
|
|
||||||
{
|
|
||||||
params = new SearchParameterMap();
|
|
||||||
params.setLoadSynchronous(true);
|
|
||||||
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, new StringParam("en_GB"));
|
|
||||||
List<Patient> patients = toList(myPatientDao.search(params));
|
|
||||||
assertEquals(0, patients.size());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSearchLanguageParamAndOr() {
|
|
||||||
IIdType id1;
|
|
||||||
{
|
|
||||||
Patient patient = new Patient();
|
|
||||||
patient.getLanguageElement().setValue("en_CA");
|
|
||||||
patient.addIdentifier().setSystem("urn:system").setValue("001");
|
|
||||||
patient.addName().setFamily("testSearchLanguageParam").addGiven("Joe");
|
|
||||||
id1 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
|
|
||||||
}
|
|
||||||
|
|
||||||
TestUtil.sleepOneClick();
|
|
||||||
|
|
||||||
Date betweenTime = new Date();
|
|
||||||
|
|
||||||
TestUtil.sleepOneClick();
|
|
||||||
|
|
||||||
IIdType id2;
|
|
||||||
{
|
|
||||||
Patient patient = new Patient();
|
|
||||||
patient.getLanguageElement().setValue("en_US");
|
|
||||||
patient.addIdentifier().setSystem("urn:system").setValue("002");
|
|
||||||
patient.addName().setFamily("testSearchLanguageParam").addGiven("John");
|
|
||||||
id2 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("en_US")));
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1, id2));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("en_US")));
|
|
||||||
params.setLastUpdated(new DateRangeParam(betweenTime, null));
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id2));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
StringAndListParam and = new StringAndListParam();
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")));
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, and);
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
StringAndListParam and = new StringAndListParam();
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("ZZZZZ")));
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, and);
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), empty());
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
StringAndListParam and = new StringAndListParam();
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("ZZZZZ")));
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, and);
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), empty());
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
StringAndListParam and = new StringAndListParam();
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("")).addOr(new StringParam(null)));
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, and);
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
params.add("_id", new StringParam(id1.getIdPart()));
|
|
||||||
StringAndListParam and = new StringAndListParam();
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("")).addOr(new StringParam(null)));
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, and);
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
StringAndListParam and = new StringAndListParam();
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("")).addOr(new StringParam(null)));
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, and);
|
|
||||||
params.add("_id", new StringParam(id1.getIdPart()));
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSearchLastUpdatedParam() {
|
public void testSearchLastUpdatedParam() {
|
||||||
|
|
|
@ -12,6 +12,7 @@ import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamToken;
|
||||||
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamUri;
|
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamUri;
|
||||||
import ca.uhn.fhir.jpa.model.entity.ResourceLink;
|
import ca.uhn.fhir.jpa.model.entity.ResourceLink;
|
||||||
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
|
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
|
||||||
|
import ca.uhn.fhir.jpa.model.util.UcumServiceUtil;
|
||||||
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
||||||
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap.EverythingModeEnum;
|
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap.EverythingModeEnum;
|
||||||
import ca.uhn.fhir.jpa.util.TestUtil;
|
import ca.uhn.fhir.jpa.util.TestUtil;
|
||||||
|
@ -43,8 +44,6 @@ import ca.uhn.fhir.rest.param.UriParam;
|
||||||
import ca.uhn.fhir.rest.param.UriParamQualifierEnum;
|
import ca.uhn.fhir.rest.param.UriParamQualifierEnum;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.MethodNotAllowedException;
|
import ca.uhn.fhir.rest.server.exceptions.MethodNotAllowedException;
|
||||||
import ca.uhn.fhir.jpa.model.util.UcumServiceUtil;
|
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.hl7.fhir.instance.model.api.IAnyResource;
|
import org.hl7.fhir.instance.model.api.IAnyResource;
|
||||||
|
@ -144,8 +143,8 @@ public class FhirResourceDaoR4SearchNoHashesTest extends BaseJpaR4Test {
|
||||||
myDaoConfig.setFetchSizeDefaultMaximum(new DaoConfig().getFetchSizeDefaultMaximum());
|
myDaoConfig.setFetchSizeDefaultMaximum(new DaoConfig().getFetchSizeDefaultMaximum());
|
||||||
myDaoConfig.setAllowContainsSearches(new DaoConfig().isAllowContainsSearches());
|
myDaoConfig.setAllowContainsSearches(new DaoConfig().isAllowContainsSearches());
|
||||||
myDaoConfig.setDisableHashBasedSearches(false);
|
myDaoConfig.setDisableHashBasedSearches(false);
|
||||||
myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED);
|
myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void beforeInitialize() {
|
public void beforeInitialize() {
|
||||||
|
@ -1201,8 +1200,8 @@ public class FhirResourceDaoR4SearchNoHashesTest extends BaseJpaR4Test {
|
||||||
.setCode(new CodeableConcept().addCoding(new Coding().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("cm")))
|
.setCode(new CodeableConcept().addCoding(new Coding().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("cm")))
|
||||||
.setValue(new Quantity().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("cm").setValue(1.2));
|
.setValue(new Quantity().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("cm").setValue(1.2));
|
||||||
o1.addComponent()
|
o1.addComponent()
|
||||||
.setCode(new CodeableConcept().addCoding(new Coding().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("m")))
|
.setCode(new CodeableConcept().addCoding(new Coding().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("m")))
|
||||||
.setValue(new Quantity().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("mm").setValue(2));
|
.setValue(new Quantity().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("mm").setValue(2));
|
||||||
IIdType id1 = myObservationDao.create(o1, mySrd).getId().toUnqualifiedVersionless();
|
IIdType id1 = myObservationDao.create(o1, mySrd).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
String param = Observation.SP_COMPONENT_VALUE_QUANTITY;
|
String param = Observation.SP_COMPONENT_VALUE_QUANTITY;
|
||||||
|
@ -1214,7 +1213,7 @@ public class FhirResourceDaoR4SearchNoHashesTest extends BaseJpaR4Test {
|
||||||
assertThat("Got: " + toUnqualifiedVersionlessIdValues(result), toUnqualifiedVersionlessIdValues(result), containsInAnyOrder(id1.getValue()));
|
assertThat("Got: " + toUnqualifiedVersionlessIdValues(result), toUnqualifiedVersionlessIdValues(result), containsInAnyOrder(id1.getValue()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testComponentQuantityWithNormalizedQuantityStorageSupported() {
|
public void testComponentQuantityWithNormalizedQuantityStorageSupported() {
|
||||||
|
|
||||||
|
@ -1224,8 +1223,8 @@ public class FhirResourceDaoR4SearchNoHashesTest extends BaseJpaR4Test {
|
||||||
.setCode(new CodeableConcept().addCoding(new Coding().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("cm")))
|
.setCode(new CodeableConcept().addCoding(new Coding().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("cm")))
|
||||||
.setValue(new Quantity().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("cm").setValue(1.2));
|
.setValue(new Quantity().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("cm").setValue(1.2));
|
||||||
o1.addComponent()
|
o1.addComponent()
|
||||||
.setCode(new CodeableConcept().addCoding(new Coding().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("m")))
|
.setCode(new CodeableConcept().addCoding(new Coding().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("m")))
|
||||||
.setValue(new Quantity().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("mm").setValue(2));
|
.setValue(new Quantity().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("mm").setValue(2));
|
||||||
IIdType id1 = myObservationDao.create(o1, mySrd).getId().toUnqualifiedVersionless();
|
IIdType id1 = myObservationDao.create(o1, mySrd).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
String param = Observation.SP_COMPONENT_VALUE_QUANTITY;
|
String param = Observation.SP_COMPONENT_VALUE_QUANTITY;
|
||||||
|
@ -1237,7 +1236,7 @@ public class FhirResourceDaoR4SearchNoHashesTest extends BaseJpaR4Test {
|
||||||
assertThat("Got: " + toUnqualifiedVersionlessIdValues(result), toUnqualifiedVersionlessIdValues(result), containsInAnyOrder(id1.getValue()));
|
assertThat("Got: " + toUnqualifiedVersionlessIdValues(result), toUnqualifiedVersionlessIdValues(result), containsInAnyOrder(id1.getValue()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSearchCompositeParamQuantity() {
|
public void testSearchCompositeParamQuantity() {
|
||||||
Observation o1 = new Observation();
|
Observation o1 = new Observation();
|
||||||
|
@ -1344,9 +1343,9 @@ public class FhirResourceDaoR4SearchNoHashesTest extends BaseJpaR4Test {
|
||||||
IBundleProvider result = myObservationDao.search(new SearchParameterMap().setLoadSynchronous(true).add(param, val));
|
IBundleProvider result = myObservationDao.search(new SearchParameterMap().setLoadSynchronous(true).add(param, val));
|
||||||
assertThat(toUnqualifiedVersionlessIdValues(result), empty());
|
assertThat(toUnqualifiedVersionlessIdValues(result), empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSearchDateWrongParam() {
|
public void testSearchDateWrongParam() {
|
||||||
Patient p1 = new Patient();
|
Patient p1 = new Patient();
|
||||||
|
@ -1391,11 +1390,6 @@ public class FhirResourceDaoR4SearchNoHashesTest extends BaseJpaR4Test {
|
||||||
params.add("_id", new StringParam("TEST"));
|
params.add("_id", new StringParam("TEST"));
|
||||||
assertEquals(1, toList(myPatientDao.search(params)).size());
|
assertEquals(1, toList(myPatientDao.search(params)).size());
|
||||||
|
|
||||||
params = new SearchParameterMap();
|
|
||||||
params.setLoadSynchronous(true);
|
|
||||||
params.add("_language", new StringParam("TEST"));
|
|
||||||
assertEquals(1, toList(myPatientDao.search(params)).size());
|
|
||||||
|
|
||||||
params = new SearchParameterMap();
|
params = new SearchParameterMap();
|
||||||
params.setLoadSynchronous(true);
|
params.setLoadSynchronous(true);
|
||||||
params.add(Patient.SP_IDENTIFIER, new TokenParam("TEST", "TEST"));
|
params.add(Patient.SP_IDENTIFIER, new TokenParam("TEST", "TEST"));
|
||||||
|
@ -1413,11 +1407,6 @@ public class FhirResourceDaoR4SearchNoHashesTest extends BaseJpaR4Test {
|
||||||
params.add("_id", new StringParam("TEST"));
|
params.add("_id", new StringParam("TEST"));
|
||||||
assertEquals(0, toList(myPatientDao.search(params)).size());
|
assertEquals(0, toList(myPatientDao.search(params)).size());
|
||||||
|
|
||||||
params = new SearchParameterMap();
|
|
||||||
params.setLoadSynchronous(true);
|
|
||||||
params.add("_language", new StringParam("TEST"));
|
|
||||||
assertEquals(0, toList(myPatientDao.search(params)).size());
|
|
||||||
|
|
||||||
params = new SearchParameterMap();
|
params = new SearchParameterMap();
|
||||||
params.setLoadSynchronous(true);
|
params.setLoadSynchronous(true);
|
||||||
params.add(Patient.SP_IDENTIFIER, new TokenParam("TEST", "TEST"));
|
params.add(Patient.SP_IDENTIFIER, new TokenParam("TEST", "TEST"));
|
||||||
|
@ -1440,145 +1429,6 @@ public class FhirResourceDaoR4SearchNoHashesTest extends BaseJpaR4Test {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSearchLanguageParam() {
|
|
||||||
IIdType id1;
|
|
||||||
{
|
|
||||||
Patient patient = new Patient();
|
|
||||||
patient.getLanguageElement().setValue("en_CA");
|
|
||||||
patient.addIdentifier().setSystem("urn:system").setValue("001");
|
|
||||||
patient.addName().setFamily("testSearchLanguageParam").addGiven("Joe");
|
|
||||||
id1 = myPatientDao.create(patient, mySrd).getId();
|
|
||||||
}
|
|
||||||
IIdType id2;
|
|
||||||
{
|
|
||||||
Patient patient = new Patient();
|
|
||||||
patient.getLanguageElement().setValue("en_US");
|
|
||||||
patient.addIdentifier().setSystem("urn:system").setValue("002");
|
|
||||||
patient.addName().setFamily("testSearchLanguageParam").addGiven("John");
|
|
||||||
id2 = myPatientDao.create(patient, mySrd).getId();
|
|
||||||
}
|
|
||||||
SearchParameterMap params;
|
|
||||||
{
|
|
||||||
params = new SearchParameterMap();
|
|
||||||
params.setLoadSynchronous(true);
|
|
||||||
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, new StringParam("en_CA"));
|
|
||||||
List<IBaseResource> patients = toList(myPatientDao.search(params));
|
|
||||||
assertEquals(1, patients.size());
|
|
||||||
assertEquals(id1.toUnqualifiedVersionless(), patients.get(0).getIdElement().toUnqualifiedVersionless());
|
|
||||||
}
|
|
||||||
{
|
|
||||||
params = new SearchParameterMap();
|
|
||||||
params.setLoadSynchronous(true);
|
|
||||||
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, new StringParam("en_US"));
|
|
||||||
List<Patient> patients = toList(myPatientDao.search(params));
|
|
||||||
assertEquals(1, patients.size());
|
|
||||||
assertEquals(id2.toUnqualifiedVersionless(), patients.get(0).getIdElement().toUnqualifiedVersionless());
|
|
||||||
}
|
|
||||||
{
|
|
||||||
params = new SearchParameterMap();
|
|
||||||
params.setLoadSynchronous(true);
|
|
||||||
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, new StringParam("en_GB"));
|
|
||||||
List<Patient> patients = toList(myPatientDao.search(params));
|
|
||||||
assertEquals(0, patients.size());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSearchLanguageParamAndOr() {
|
|
||||||
IIdType id1;
|
|
||||||
{
|
|
||||||
Patient patient = new Patient();
|
|
||||||
patient.getLanguageElement().setValue("en_CA");
|
|
||||||
patient.addIdentifier().setSystem("urn:system").setValue("001");
|
|
||||||
patient.addName().setFamily("testSearchLanguageParam").addGiven("Joe");
|
|
||||||
id1 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
|
|
||||||
}
|
|
||||||
|
|
||||||
TestUtil.sleepOneClick();
|
|
||||||
|
|
||||||
Date betweenTime = new Date();
|
|
||||||
|
|
||||||
IIdType id2;
|
|
||||||
{
|
|
||||||
Patient patient = new Patient();
|
|
||||||
patient.getLanguageElement().setValue("en_US");
|
|
||||||
patient.addIdentifier().setSystem("urn:system").setValue("002");
|
|
||||||
patient.addName().setFamily("testSearchLanguageParam").addGiven("John");
|
|
||||||
id2 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("en_US")));
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1, id2));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("en_US")));
|
|
||||||
params.setLastUpdated(new DateRangeParam(betweenTime, null));
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id2));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
StringAndListParam and = new StringAndListParam();
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")));
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, and);
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
StringAndListParam and = new StringAndListParam();
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("ZZZZZ")));
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, and);
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), empty());
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
StringAndListParam and = new StringAndListParam();
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("ZZZZZ")));
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, and);
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), empty());
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
StringAndListParam and = new StringAndListParam();
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("")).addOr(new StringParam(null)));
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, and);
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
params.add("_id", new StringParam(id1.getIdPart()));
|
|
||||||
StringAndListParam and = new StringAndListParam();
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("")).addOr(new StringParam(null)));
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, and);
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
SearchParameterMap params = new SearchParameterMap();
|
|
||||||
StringAndListParam and = new StringAndListParam();
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("en_CA")).addOr(new StringParam("ZZZZ")));
|
|
||||||
and.addAnd(new StringOrListParam().addOr(new StringParam("")).addOr(new StringParam(null)));
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, and);
|
|
||||||
params.add("_id", new StringParam(id1.getIdPart()));
|
|
||||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSearchLastUpdatedParam() {
|
public void testSearchLastUpdatedParam() {
|
||||||
String methodName = "testSearchLastUpdatedParam";
|
String methodName = "testSearchLastUpdatedParam";
|
||||||
|
|
|
@ -422,9 +422,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
|
||||||
|
|
||||||
IIdType orgId = myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless();
|
IIdType orgId = myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
SearchParameterMap map = new SearchParameterMap();
|
SearchParameterMap map;
|
||||||
map.add("_language", new StringParam("EN_ca"));
|
|
||||||
assertEquals(1, myOrganizationDao.search(map).size().intValue());
|
|
||||||
|
|
||||||
map = new SearchParameterMap();
|
map = new SearchParameterMap();
|
||||||
map.setLoadSynchronous(true);
|
map.setLoadSynchronous(true);
|
||||||
|
@ -433,11 +431,6 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
|
||||||
|
|
||||||
myOrganizationDao.delete(orgId, mySrd);
|
myOrganizationDao.delete(orgId, mySrd);
|
||||||
|
|
||||||
map = new SearchParameterMap();
|
|
||||||
map.setLoadSynchronous(true);
|
|
||||||
map.add("_language", new StringParam("EN_ca"));
|
|
||||||
assertEquals(0, myOrganizationDao.search(map).size().intValue());
|
|
||||||
|
|
||||||
map = new SearchParameterMap();
|
map = new SearchParameterMap();
|
||||||
map.setLoadSynchronous(true);
|
map.setLoadSynchronous(true);
|
||||||
map.add("_tag", new TokenParam(methodName, methodName));
|
map.add("_tag", new TokenParam(methodName, methodName));
|
||||||
|
@ -2576,7 +2569,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
|
||||||
found = toList(myPatientDao.search(new SearchParameterMap(Patient.SP_BIRTHDATE + "AAAA", new DateParam(ParamPrefixEnum.GREATERTHAN, "2000-01-01")).setLoadSynchronous(true)));
|
found = toList(myPatientDao.search(new SearchParameterMap(Patient.SP_BIRTHDATE + "AAAA", new DateParam(ParamPrefixEnum.GREATERTHAN, "2000-01-01")).setLoadSynchronous(true)));
|
||||||
assertEquals(0, found.size());
|
assertEquals(0, found.size());
|
||||||
} catch (InvalidRequestException e) {
|
} catch (InvalidRequestException e) {
|
||||||
assertEquals("Unknown search parameter \"birthdateAAAA\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _language, _lastUpdated, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
|
assertEquals("Unknown search parameter \"birthdateAAAA\" for resource type \"Patient\". Valid search parameters for this search are: [_content, _id, _lastUpdated, _profile, _security, _source, _tag, _text, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]", e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3342,7 +3335,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
|
||||||
myObservationDao.search(pm);
|
myObservationDao.search(pm);
|
||||||
fail();
|
fail();
|
||||||
} catch (InvalidRequestException e) {
|
} catch (InvalidRequestException e) {
|
||||||
assertEquals("Unknown _sort parameter value \"hello\" for resource type \"Observation\" (Note: sort parameters values must use a valid Search Parameter). Valid values for this search are: [_id, _language, _lastUpdated, based-on, category, code, code-value-concept, code-value-date, code-value-quantity, code-value-string, combo-code, combo-code-value-concept, combo-code-value-quantity, combo-data-absent-reason, combo-value-concept, combo-value-quantity, component-code, component-code-value-concept, component-code-value-quantity, component-data-absent-reason, component-value-concept, component-value-quantity, data-absent-reason, date, derived-from, device, encounter, focus, has-member, identifier, method, part-of, patient, performer, specimen, status, subject, value-concept, value-date, value-quantity, value-string]", e.getMessage());
|
assertEquals("Unknown _sort parameter value \"hello\" for resource type \"Observation\" (Note: sort parameters values must use a valid Search Parameter). Valid values for this search are: [_content, _id, _lastUpdated, _profile, _security, _source, _tag, _text, based-on, category, code, code-value-concept, code-value-date, code-value-quantity, code-value-string, combo-code, combo-code-value-concept, combo-code-value-quantity, combo-data-absent-reason, combo-value-concept, combo-value-quantity, component-code, component-code-value-concept, component-code-value-quantity, component-data-absent-reason, component-value-concept, component-value-quantity, data-absent-reason, date, derived-from, device, encounter, focus, has-member, identifier, method, part-of, patient, performer, specimen, status, subject, value-concept, value-date, value-quantity, value-string]", e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ca.uhn.fhir.jpa.dao.r4;
|
package ca.uhn.fhir.jpa.dao.r4;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
||||||
import ca.uhn.fhir.context.RuntimeSearchParam;
|
import ca.uhn.fhir.context.RuntimeSearchParam;
|
||||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||||
|
@ -32,7 +31,7 @@ public class FhirResourceDaoSearchParameterR4Test {
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void before() {
|
public void before() {
|
||||||
myCtx = FhirContext.forCached(FhirVersionEnum.R4);
|
myCtx = FhirContext.forR4Cached();
|
||||||
|
|
||||||
myDao = new FhirResourceDaoSearchParameterR4();
|
myDao = new FhirResourceDaoSearchParameterR4();
|
||||||
myDao.setContext(myCtx);
|
myDao.setContext(myCtx);
|
||||||
|
@ -50,9 +49,6 @@ public class FhirResourceDaoSearchParameterR4Test {
|
||||||
if (nextp.getName().equals("_id")) {
|
if (nextp.getName().equals("_id")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (nextp.getName().equals("_language")) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (isBlank(nextp.getPath())) {
|
if (isBlank(nextp.getPath())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,6 +79,7 @@ import static org.hamcrest.Matchers.contains;
|
||||||
import static org.hamcrest.Matchers.containsInAnyOrder;
|
import static org.hamcrest.Matchers.containsInAnyOrder;
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
import static org.hamcrest.Matchers.matchesPattern;
|
import static org.hamcrest.Matchers.matchesPattern;
|
||||||
|
import static org.hamcrest.Matchers.not;
|
||||||
import static org.hamcrest.Matchers.startsWith;
|
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.junit.jupiter.api.Assertions.assertNotEquals;
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
|
@ -409,7 +410,7 @@ public class PartitioningSqlR4Test extends BasePartitioningR4Test {
|
||||||
// HFJ_SPIDX_STRING
|
// HFJ_SPIDX_STRING
|
||||||
List<ResourceIndexedSearchParamString> strings = myResourceIndexedSearchParamStringDao.findAllForResourceId(patientId);
|
List<ResourceIndexedSearchParamString> strings = myResourceIndexedSearchParamStringDao.findAllForResourceId(patientId);
|
||||||
ourLog.info("\n * {}", strings.stream().map(ResourceIndexedSearchParamString::toString).collect(Collectors.joining("\n * ")));
|
ourLog.info("\n * {}", strings.stream().map(ResourceIndexedSearchParamString::toString).collect(Collectors.joining("\n * ")));
|
||||||
assertEquals(10, strings.size());
|
assertEquals(9, strings.size());
|
||||||
assertEquals(myPartitionId, strings.get(0).getPartitionId().getPartitionId().intValue());
|
assertEquals(myPartitionId, strings.get(0).getPartitionId().getPartitionId().intValue());
|
||||||
assertEquals(myPartitionDate, strings.get(0).getPartitionId().getPartitionDate());
|
assertEquals(myPartitionDate, strings.get(0).getPartitionId().getPartitionDate());
|
||||||
|
|
||||||
|
@ -492,8 +493,11 @@ public class PartitioningSqlR4Test extends BasePartitioningR4Test {
|
||||||
|
|
||||||
// HFJ_SPIDX_STRING
|
// HFJ_SPIDX_STRING
|
||||||
List<ResourceIndexedSearchParamString> strings = myResourceIndexedSearchParamStringDao.findAllForResourceId(patientId);
|
List<ResourceIndexedSearchParamString> strings = myResourceIndexedSearchParamStringDao.findAllForResourceId(patientId);
|
||||||
ourLog.info("\n * {}", strings.stream().map(ResourceIndexedSearchParamString::toString).collect(Collectors.joining("\n * ")));
|
String stringsDesc = strings.stream().map(ResourceIndexedSearchParamString::toString).sorted().collect(Collectors.joining("\n * "));
|
||||||
assertEquals(10, strings.size());
|
ourLog.info("\n * {}", stringsDesc);
|
||||||
|
assertThat(stringsDesc, not(containsString("_text")));
|
||||||
|
assertThat(stringsDesc, not(containsString("_content")));
|
||||||
|
assertEquals(9, strings.size(), stringsDesc);
|
||||||
assertEquals(null, strings.get(0).getPartitionId().getPartitionId());
|
assertEquals(null, strings.get(0).getPartitionId().getPartitionId());
|
||||||
assertEquals(myPartitionDate, strings.get(0).getPartitionId().getPartitionDate());
|
assertEquals(myPartitionDate, strings.get(0).getPartitionId().getPartitionDate());
|
||||||
|
|
||||||
|
@ -701,7 +705,7 @@ public class PartitioningSqlR4Test extends BasePartitioningR4Test {
|
||||||
// HFJ_SPIDX_STRING
|
// HFJ_SPIDX_STRING
|
||||||
List<ResourceIndexedSearchParamString> strings = myResourceIndexedSearchParamStringDao.findAllForResourceId(patientId);
|
List<ResourceIndexedSearchParamString> strings = myResourceIndexedSearchParamStringDao.findAllForResourceId(patientId);
|
||||||
ourLog.info("\n * {}", strings.stream().map(ResourceIndexedSearchParamString::toString).collect(Collectors.joining("\n * ")));
|
ourLog.info("\n * {}", strings.stream().map(ResourceIndexedSearchParamString::toString).collect(Collectors.joining("\n * ")));
|
||||||
assertEquals(10, strings.size());
|
assertEquals(9, strings.size());
|
||||||
assertEquals(myPartitionId, strings.get(0).getPartitionId().getPartitionId().intValue());
|
assertEquals(myPartitionId, strings.get(0).getPartitionId().getPartitionId().intValue());
|
||||||
assertEquals(myPartitionDate, strings.get(0).getPartitionId().getPartitionDate());
|
assertEquals(myPartitionDate, strings.get(0).getPartitionId().getPartitionDate());
|
||||||
|
|
||||||
|
|
|
@ -1,24 +1,33 @@
|
||||||
package ca.uhn.fhir.jpa.dao.r4;
|
package ca.uhn.fhir.jpa.dao.r4;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||||
import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao;
|
import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao;
|
||||||
import ca.uhn.fhir.jpa.config.TestR4ConfigWithElasticsearchClient;
|
import ca.uhn.fhir.jpa.config.TestR4ConfigWithElasticsearchClient;
|
||||||
import ca.uhn.fhir.jpa.dao.ObservationLastNIndexPersistSvc;
|
import ca.uhn.fhir.jpa.dao.ObservationLastNIndexPersistSvc;
|
||||||
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
|
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
|
||||||
import ca.uhn.fhir.jpa.model.util.CodeSystemHash;
|
|
||||||
import ca.uhn.fhir.jpa.search.lastn.ElasticsearchSvcImpl;
|
import ca.uhn.fhir.jpa.search.lastn.ElasticsearchSvcImpl;
|
||||||
import ca.uhn.fhir.jpa.search.lastn.json.CodeJson;
|
import ca.uhn.fhir.jpa.search.lastn.json.CodeJson;
|
||||||
import ca.uhn.fhir.jpa.search.lastn.json.ObservationJson;
|
import ca.uhn.fhir.jpa.search.lastn.json.ObservationJson;
|
||||||
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
||||||
import ca.uhn.fhir.parser.IParser;
|
import ca.uhn.fhir.parser.IParser;
|
||||||
import ca.uhn.fhir.rest.param.*;
|
import ca.uhn.fhir.rest.param.ReferenceAndListParam;
|
||||||
|
import ca.uhn.fhir.rest.param.ReferenceOrListParam;
|
||||||
|
import ca.uhn.fhir.rest.param.ReferenceParam;
|
||||||
|
import ca.uhn.fhir.rest.param.TokenAndListParam;
|
||||||
|
import ca.uhn.fhir.rest.param.TokenOrListParam;
|
||||||
|
import ca.uhn.fhir.rest.param.TokenParam;
|
||||||
import ca.uhn.fhir.test.utilities.docker.RequiresDocker;
|
import ca.uhn.fhir.test.utilities.docker.RequiresDocker;
|
||||||
import com.google.common.base.Charsets;
|
import com.google.common.base.Charsets;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.aspectj.lang.annotation.Before;
|
import org.hl7.fhir.r4.model.Bundle;
|
||||||
import org.hl7.fhir.r4.model.*;
|
import org.hl7.fhir.r4.model.CodeableConcept;
|
||||||
|
import org.hl7.fhir.r4.model.Coding;
|
||||||
|
import org.hl7.fhir.r4.model.DateTimeType;
|
||||||
|
import org.hl7.fhir.r4.model.IdType;
|
||||||
|
import org.hl7.fhir.r4.model.Meta;
|
||||||
|
import org.hl7.fhir.r4.model.Observation;
|
||||||
|
import org.hl7.fhir.r4.model.Reference;
|
||||||
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.MethodOrderer;
|
import org.junit.jupiter.api.MethodOrderer;
|
||||||
|
@ -31,14 +40,18 @@ import org.springframework.core.io.Resource;
|
||||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
|
||||||
|
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.PersistenceContext;
|
import javax.persistence.PersistenceContext;
|
||||||
import javax.persistence.PersistenceContextType;
|
import javax.persistence.PersistenceContextType;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.GregorianCalendar;
|
||||||
|
import java.util.List;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
@ -411,7 +424,7 @@ public class PersistObservationIndexedSearchParamLastNR4IT {
|
||||||
@Order(1)
|
@Order(1)
|
||||||
@Test
|
@Test
|
||||||
public void testSampleBundleInTransaction() throws IOException {
|
public void testSampleBundleInTransaction() throws IOException {
|
||||||
FhirContext myFhirCtx = FhirContext.forCached(FhirVersionEnum.R4);
|
FhirContext myFhirCtx = FhirContext.forR4Cached();
|
||||||
|
|
||||||
PathMatchingResourcePatternResolver provider = new PathMatchingResourcePatternResolver();
|
PathMatchingResourcePatternResolver provider = new PathMatchingResourcePatternResolver();
|
||||||
final Resource[] bundleResources;
|
final Resource[] bundleResources;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ca.uhn.fhir.jpa.dao.r4;
|
package ca.uhn.fhir.jpa.dao.r4;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
||||||
import ca.uhn.fhir.context.RuntimeSearchParam;
|
import ca.uhn.fhir.context.RuntimeSearchParam;
|
||||||
import ca.uhn.fhir.context.phonetic.IPhoneticEncoder;
|
import ca.uhn.fhir.context.phonetic.IPhoneticEncoder;
|
||||||
|
@ -61,7 +60,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
public class SearchParamExtractorR4Test {
|
public class SearchParamExtractorR4Test {
|
||||||
|
|
||||||
private static final Logger ourLog = LoggerFactory.getLogger(SearchParamExtractorR4Test.class);
|
private static final Logger ourLog = LoggerFactory.getLogger(SearchParamExtractorR4Test.class);
|
||||||
private static FhirContext ourCtx = FhirContext.forCached(FhirVersionEnum.R4);
|
private static final FhirContext ourCtx = FhirContext.forR4Cached();
|
||||||
private MySearchParamRegistry mySearchParamRegistry;
|
private MySearchParamRegistry mySearchParamRegistry;
|
||||||
private PartitionSettings myPartitionSettings;
|
private PartitionSettings myPartitionSettings;
|
||||||
|
|
||||||
|
@ -398,7 +397,7 @@ public class SearchParamExtractorR4Test {
|
||||||
private static class MySearchParamRegistry implements ISearchParamRegistry, ISearchParamRegistryController {
|
private static class MySearchParamRegistry implements ISearchParamRegistry, ISearchParamRegistryController {
|
||||||
|
|
||||||
|
|
||||||
private List<RuntimeSearchParam> myExtraSearchParams = new ArrayList<>();
|
private final List<RuntimeSearchParam> myExtraSearchParams = new ArrayList<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void forceRefresh() {
|
public void forceRefresh() {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ca.uhn.fhir.jpa.dao.r4;
|
package ca.uhn.fhir.jpa.dao.r4;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
||||||
import ca.uhn.fhir.rest.param.HasParam;
|
import ca.uhn.fhir.rest.param.HasParam;
|
||||||
import ca.uhn.fhir.test.BaseTest;
|
import ca.uhn.fhir.test.BaseTest;
|
||||||
|
@ -11,7 +10,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
public class SearchParameterMapTest extends BaseTest {
|
public class SearchParameterMapTest extends BaseTest {
|
||||||
|
|
||||||
private FhirContext myContext = FhirContext.forCached(FhirVersionEnum.R4);
|
private final FhirContext myContext = FhirContext.forR4Cached();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void toNormalizedQueryStringTest() {
|
public void toNormalizedQueryStringTest() {
|
||||||
|
|
|
@ -106,7 +106,7 @@ public class JpaStorageServicesTest extends BaseJpaR4Test {
|
||||||
mySvc.listResources(mySrd, "Appointment", Collections.singletonList(argument), result);
|
mySvc.listResources(mySrd, "Appointment", Collections.singletonList(argument), result);
|
||||||
fail();
|
fail();
|
||||||
} catch (InvalidRequestException e) {
|
} catch (InvalidRequestException e) {
|
||||||
assertEquals("Unknown GraphQL argument \"test\". Value GraphQL argument for this type are: [_id, _language, actor, appointment_type, based_on, date, identifier, location, part_status, patient, practitioner, reason_code, reason_reference, service_category, service_type, slot, specialty, status, supporting_info]", e.getMessage());
|
assertEquals("Unknown GraphQL argument \"test\". Value GraphQL argument for this type are: [_content, _id, _lastUpdated, _profile, _security, _source, _tag, _text, actor, appointment_type, based_on, date, identifier, location, part_status, patient, practitioner, reason_code, reason_reference, service_category, service_type, slot, specialty, status, supporting_info]", e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class SearchPreferHandlingInterceptorJpaTest extends BaseResourceProvider
|
||||||
.execute();
|
.execute();
|
||||||
fail();
|
fail();
|
||||||
} catch (InvalidRequestException e) {
|
} catch (InvalidRequestException e) {
|
||||||
assertThat(e.getMessage(), containsString("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _language, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]"));
|
assertThat(e.getMessage(), containsString("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_content, _id, _lastUpdated, _profile, _security, _source, _tag, _text, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ public class SearchPreferHandlingInterceptorJpaTest extends BaseResourceProvider
|
||||||
.execute();
|
.execute();
|
||||||
fail();
|
fail();
|
||||||
} catch (InvalidRequestException e) {
|
} catch (InvalidRequestException e) {
|
||||||
assertThat(e.getMessage(), containsString("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _language, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]"));
|
assertThat(e.getMessage(), containsString("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_content, _id, _lastUpdated, _profile, _security, _source, _tag, _text, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ public class SearchPreferHandlingInterceptorJpaTest extends BaseResourceProvider
|
||||||
.execute();
|
.execute();
|
||||||
fail();
|
fail();
|
||||||
} catch (InvalidRequestException e) {
|
} catch (InvalidRequestException e) {
|
||||||
assertThat(e.getMessage(), containsString("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _language, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]"));
|
assertThat(e.getMessage(), containsString("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_content, _id, _lastUpdated, _profile, _security, _source, _tag, _text, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ public class SearchPreferHandlingInterceptorJpaTest extends BaseResourceProvider
|
||||||
.execute();
|
.execute();
|
||||||
fail();
|
fail();
|
||||||
} catch (InvalidRequestException e) {
|
} catch (InvalidRequestException e) {
|
||||||
assertThat(e.getMessage(), containsString("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_id, _language, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]"));
|
assertThat(e.getMessage(), containsString("Unknown search parameter \"foo\" for resource type \"Patient\". Valid search parameters for this search are: [_content, _id, _lastUpdated, _profile, _security, _source, _tag, _text, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,7 +185,7 @@ public class NpmR4Test extends BaseJpaR4Test {
|
||||||
assertEquals("Nictiz NL package of FHIR STU3 conformance resources for MedMij information standard Questionnaires. Includes dependency on Zib2017 and SDC.\\n\\nHCIMs: https://zibs.nl/wiki/HCIM_Release_2017(EN)", pkg.description());
|
assertEquals("Nictiz NL package of FHIR STU3 conformance resources for MedMij information standard Questionnaires. Includes dependency on Zib2017 and SDC.\\n\\nHCIMs: https://zibs.nl/wiki/HCIM_Release_2017(EN)", pkg.description());
|
||||||
|
|
||||||
// Fetch resource by URL
|
// Fetch resource by URL
|
||||||
FhirContext fhirContext = FhirContext.forCached(FhirVersionEnum.DSTU3);
|
FhirContext fhirContext = FhirContext.forDstu3Cached();
|
||||||
runInTransaction(() -> {
|
runInTransaction(() -> {
|
||||||
IBaseResource asset = myPackageCacheManager.loadPackageAssetByUrl(FhirVersionEnum.DSTU3, "http://nictiz.nl/fhir/StructureDefinition/vl-QuestionnaireResponse");
|
IBaseResource asset = myPackageCacheManager.loadPackageAssetByUrl(FhirVersionEnum.DSTU3, "http://nictiz.nl/fhir/StructureDefinition/vl-QuestionnaireResponse");
|
||||||
assertThat(fhirContext.newJsonParser().encodeResourceToString(asset), containsString("\"url\":\"http://nictiz.nl/fhir/StructureDefinition/vl-QuestionnaireResponse\",\"version\":\"1.0.1\""));
|
assertThat(fhirContext.newJsonParser().encodeResourceToString(asset), containsString("\"url\":\"http://nictiz.nl/fhir/StructureDefinition/vl-QuestionnaireResponse\",\"version\":\"1.0.1\""));
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ca.uhn.fhir.jpa.packages;
|
package ca.uhn.fhir.jpa.packages;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import org.hl7.fhir.r4.model.Enumerations;
|
import org.hl7.fhir.r4.model.Enumerations;
|
||||||
import org.hl7.fhir.r4.model.SearchParameter;
|
import org.hl7.fhir.r4.model.SearchParameter;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
@ -11,7 +10,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
class PackageInstallerSvcImplTest {
|
class PackageInstallerSvcImplTest {
|
||||||
private final FhirContext myCtx = FhirContext.forCached(FhirVersionEnum.R4);
|
private final FhirContext myCtx = FhirContext.forR4Cached();
|
||||||
private PackageInstallerSvcImpl mySvc;
|
private PackageInstallerSvcImpl mySvc;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ca.uhn.fhir.jpa.partition;
|
package ca.uhn.fhir.jpa.partition;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.jpa.entity.PartitionEntity;
|
import ca.uhn.fhir.jpa.entity.PartitionEntity;
|
||||||
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
||||||
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor;
|
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor;
|
||||||
|
@ -43,7 +42,7 @@ import static org.mockito.Mockito.when;
|
||||||
public class PartitionManagementProviderTest {
|
public class PartitionManagementProviderTest {
|
||||||
|
|
||||||
private static final Logger ourLog = LoggerFactory.getLogger(PartitionManagementProviderTest.class);
|
private static final Logger ourLog = LoggerFactory.getLogger(PartitionManagementProviderTest.class);
|
||||||
private static FhirContext ourCtx = FhirContext.forCached(FhirVersionEnum.R4);
|
private static final FhirContext ourCtx = FhirContext.forR4Cached();
|
||||||
@RegisterExtension
|
@RegisterExtension
|
||||||
public static RestfulServerExtension ourServerRule = new RestfulServerExtension(ourCtx);
|
public static RestfulServerExtension ourServerRule = new RestfulServerExtension(ourCtx);
|
||||||
@MockBean
|
@MockBean
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ca.uhn.fhir.jpa.patch;
|
package ca.uhn.fhir.jpa.patch;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||||
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;
|
||||||
|
@ -24,7 +23,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
public class FhirPatchApplyR4Test {
|
public class FhirPatchApplyR4Test {
|
||||||
|
|
||||||
private static final FhirContext ourCtx = FhirContext.forCached(FhirVersionEnum.R4);
|
private static final FhirContext ourCtx = FhirContext.forR4Cached();
|
||||||
private static final Logger ourLog = LoggerFactory.getLogger(FhirPatchApplyR4Test.class);
|
private static final Logger ourLog = LoggerFactory.getLogger(FhirPatchApplyR4Test.class);
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ca.uhn.fhir.jpa.patch;
|
package ca.uhn.fhir.jpa.patch;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.test.BaseTest;
|
import ca.uhn.fhir.test.BaseTest;
|
||||||
import ca.uhn.fhir.util.ClasspathUtil;
|
import ca.uhn.fhir.util.ClasspathUtil;
|
||||||
import ca.uhn.fhir.util.XmlUtil;
|
import ca.uhn.fhir.util.XmlUtil;
|
||||||
|
@ -51,10 +50,10 @@ public class FhirPatchCoreTest extends BaseTest {
|
||||||
|
|
||||||
public static List<Object[]> parameters() throws TransformerException, SAXException, IOException {
|
public static List<Object[]> parameters() throws TransformerException, SAXException, IOException {
|
||||||
String testSpecR4 = "/org/hl7/fhir/testcases/r4/patch/fhir-path-tests.xml";
|
String testSpecR4 = "/org/hl7/fhir/testcases/r4/patch/fhir-path-tests.xml";
|
||||||
Collection<Object[]> retValR4 = loadTestSpec(FhirContext.forCached(FhirVersionEnum.R4), testSpecR4);
|
Collection<Object[]> retValR4 = loadTestSpec(FhirContext.forR4Cached(), testSpecR4);
|
||||||
|
|
||||||
String testSpecR5 = "/org/hl7/fhir/testcases/r5/patch/fhir-path-tests.xml";
|
String testSpecR5 = "/org/hl7/fhir/testcases/r5/patch/fhir-path-tests.xml";
|
||||||
Collection<Object[]> retValR5 = loadTestSpec(FhirContext.forCached(FhirVersionEnum.R5), testSpecR5);
|
Collection<Object[]> retValR5 = loadTestSpec(FhirContext.forR5Cached(), testSpecR5);
|
||||||
|
|
||||||
ArrayList<Object[]> retVal = new ArrayList<>();
|
ArrayList<Object[]> retVal = new ArrayList<>();
|
||||||
retVal.addAll(retValR4);
|
retVal.addAll(retValR4);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ca.uhn.fhir.jpa.patch;
|
package ca.uhn.fhir.jpa.patch;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import org.hl7.fhir.instance.model.api.IBase;
|
import org.hl7.fhir.instance.model.api.IBase;
|
||||||
import org.hl7.fhir.r4.model.BooleanType;
|
import org.hl7.fhir.r4.model.BooleanType;
|
||||||
import org.hl7.fhir.r4.model.DateTimeType;
|
import org.hl7.fhir.r4.model.DateTimeType;
|
||||||
|
@ -22,7 +21,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
public class FhirPatchDiffR4Test {
|
public class FhirPatchDiffR4Test {
|
||||||
|
|
||||||
private static final Logger ourLog = LoggerFactory.getLogger(FhirPatchDiffR4Test.class);
|
private static final Logger ourLog = LoggerFactory.getLogger(FhirPatchDiffR4Test.class);
|
||||||
private static final FhirContext ourCtx = FhirContext.forCached(FhirVersionEnum.R4);
|
private static final FhirContext ourCtx = FhirContext.forR4Cached();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReplaceIdentifier() {
|
public void testReplaceIdentifier() {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ca.uhn.fhir.jpa.provider;
|
package ca.uhn.fhir.jpa.provider;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.rest.annotation.OptionalParam;
|
import ca.uhn.fhir.rest.annotation.OptionalParam;
|
||||||
import ca.uhn.fhir.rest.annotation.Search;
|
import ca.uhn.fhir.rest.annotation.Search;
|
||||||
import ca.uhn.fhir.rest.api.Constants;
|
import ca.uhn.fhir.rest.api.Constants;
|
||||||
|
@ -31,7 +30,6 @@ import org.hl7.fhir.r4.model.Patient;
|
||||||
import org.hl7.fhir.r4.model.Resource;
|
import org.hl7.fhir.r4.model.Resource;
|
||||||
import org.hl7.fhir.utilities.graphql.Argument;
|
import org.hl7.fhir.utilities.graphql.Argument;
|
||||||
import org.hl7.fhir.utilities.graphql.IGraphQLStorageServices;
|
import org.hl7.fhir.utilities.graphql.IGraphQLStorageServices;
|
||||||
import org.hl7.fhir.utilities.graphql.Value;
|
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
@ -40,7 +38,6 @@ import org.junit.jupiter.api.Test;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
@ -55,7 +52,7 @@ public class JpaGraphQLR4ProviderTest {
|
||||||
public static final String DATA_PREFIX = "{\"data\": ";
|
public static final String DATA_PREFIX = "{\"data\": ";
|
||||||
public static final String DATA_SUFFIX = "}";
|
public static final String DATA_SUFFIX = "}";
|
||||||
private static CloseableHttpClient ourClient;
|
private static CloseableHttpClient ourClient;
|
||||||
private static FhirContext ourCtx = FhirContext.forCached(FhirVersionEnum.R4);
|
private static final FhirContext ourCtx = FhirContext.forR4Cached();
|
||||||
private static int ourPort;
|
private static int ourPort;
|
||||||
private static Server ourServer;
|
private static Server ourServer;
|
||||||
|
|
||||||
|
@ -252,7 +249,7 @@ public class JpaGraphQLR4ProviderTest {
|
||||||
Patient patient = new Patient();
|
Patient patient = new Patient();
|
||||||
patient.addName(new HumanName().setFamily("FAMILY"));
|
patient.addName(new HumanName().setFamily("FAMILY"));
|
||||||
patient.getIdElement().setValue("Patient/" + i);
|
patient.getIdElement().setValue("Patient/" + i);
|
||||||
retVal.add((Patient) patient);
|
retVal.add(patient);
|
||||||
}
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +1,30 @@
|
||||||
package ca.uhn.fhir.jpa.provider;
|
package ca.uhn.fhir.jpa.provider;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.rest.api.SearchContainedModeEnum;
|
|
||||||
import org.junit.jupiter.api.AfterAll;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
||||||
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap.EverythingModeEnum;
|
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap.EverythingModeEnum;
|
||||||
import ca.uhn.fhir.model.api.Include;
|
import ca.uhn.fhir.model.api.Include;
|
||||||
|
import ca.uhn.fhir.rest.api.SearchContainedModeEnum;
|
||||||
import ca.uhn.fhir.rest.api.SortOrderEnum;
|
import ca.uhn.fhir.rest.api.SortOrderEnum;
|
||||||
import ca.uhn.fhir.rest.api.SortSpec;
|
import ca.uhn.fhir.rest.api.SortSpec;
|
||||||
import ca.uhn.fhir.rest.param.*;
|
import ca.uhn.fhir.rest.param.DateAndListParam;
|
||||||
import ca.uhn.fhir.util.TestUtil;
|
import ca.uhn.fhir.rest.param.DateOrListParam;
|
||||||
|
import ca.uhn.fhir.rest.param.DateParam;
|
||||||
|
import ca.uhn.fhir.rest.param.ParamPrefixEnum;
|
||||||
|
import ca.uhn.fhir.rest.param.StringAndListParam;
|
||||||
|
import ca.uhn.fhir.rest.param.StringOrListParam;
|
||||||
|
import ca.uhn.fhir.rest.param.StringParam;
|
||||||
|
import ca.uhn.fhir.rest.param.TokenAndListParam;
|
||||||
|
import ca.uhn.fhir.rest.param.TokenOrListParam;
|
||||||
|
import ca.uhn.fhir.rest.param.TokenParam;
|
||||||
import ca.uhn.fhir.util.UrlUtil;
|
import ca.uhn.fhir.util.UrlUtil;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
|
|
||||||
public class SearchParameterMapTest {
|
public class SearchParameterMapTest {
|
||||||
private static FhirContext ourCtx = FhirContext.forCached(FhirVersionEnum.DSTU3);
|
private static final FhirContext ourCtx = FhirContext.forDstu3Cached();
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -1,15 +1,22 @@
|
||||||
package ca.uhn.fhir.jpa.provider;
|
package ca.uhn.fhir.jpa.provider;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.jpa.dao.dstu2.BaseJpaDstu2Test;
|
import ca.uhn.fhir.jpa.dao.dstu2.BaseJpaDstu2Test;
|
||||||
import ca.uhn.fhir.jpa.rp.dstu2.*;
|
import ca.uhn.fhir.jpa.rp.dstu2.BinaryResourceProvider;
|
||||||
import ca.uhn.fhir.model.dstu2.resource.*;
|
import ca.uhn.fhir.jpa.rp.dstu2.DiagnosticOrderResourceProvider;
|
||||||
|
import ca.uhn.fhir.jpa.rp.dstu2.DiagnosticReportResourceProvider;
|
||||||
|
import ca.uhn.fhir.jpa.rp.dstu2.LocationResourceProvider;
|
||||||
|
import ca.uhn.fhir.jpa.rp.dstu2.ObservationResourceProvider;
|
||||||
|
import ca.uhn.fhir.jpa.rp.dstu2.OrganizationResourceProvider;
|
||||||
|
import ca.uhn.fhir.jpa.rp.dstu2.PatientResourceProvider;
|
||||||
|
import ca.uhn.fhir.jpa.rp.dstu2.PractitionerResourceProvider;
|
||||||
|
import ca.uhn.fhir.model.dstu2.resource.Bundle;
|
||||||
|
import ca.uhn.fhir.model.dstu2.resource.OperationDefinition;
|
||||||
|
import ca.uhn.fhir.model.dstu2.resource.OperationOutcome;
|
||||||
|
import ca.uhn.fhir.model.dstu2.resource.Patient;
|
||||||
import ca.uhn.fhir.model.dstu2.valueset.BundleTypeEnum;
|
import ca.uhn.fhir.model.dstu2.valueset.BundleTypeEnum;
|
||||||
import ca.uhn.fhir.model.dstu2.valueset.HTTPVerbEnum;
|
import ca.uhn.fhir.model.dstu2.valueset.HTTPVerbEnum;
|
||||||
import ca.uhn.fhir.model.primitive.DecimalDt;
|
|
||||||
import ca.uhn.fhir.model.primitive.IdDt;
|
import ca.uhn.fhir.model.primitive.IdDt;
|
||||||
import ca.uhn.fhir.model.primitive.StringDt;
|
|
||||||
import ca.uhn.fhir.rest.api.EncodingEnum;
|
import ca.uhn.fhir.rest.api.EncodingEnum;
|
||||||
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
||||||
import ca.uhn.fhir.rest.server.FifoMemoryPagingProvider;
|
import ca.uhn.fhir.rest.server.FifoMemoryPagingProvider;
|
||||||
|
@ -17,8 +24,8 @@ import ca.uhn.fhir.rest.server.RestfulServer;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.ResourceGoneException;
|
import ca.uhn.fhir.rest.server.exceptions.ResourceGoneException;
|
||||||
import ca.uhn.fhir.rest.server.interceptor.ResponseHighlighterInterceptor;
|
import ca.uhn.fhir.rest.server.interceptor.ResponseHighlighterInterceptor;
|
||||||
|
import ca.uhn.fhir.test.utilities.JettyUtil;
|
||||||
import ca.uhn.fhir.util.BundleUtil;
|
import ca.uhn.fhir.util.BundleUtil;
|
||||||
import ca.uhn.fhir.util.TestUtil;
|
|
||||||
import com.google.common.base.Charsets;
|
import com.google.common.base.Charsets;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||||
|
@ -30,14 +37,11 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
||||||
import org.eclipse.jetty.server.Server;
|
import org.eclipse.jetty.server.Server;
|
||||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||||
import org.eclipse.jetty.servlet.ServletHolder;
|
import org.eclipse.jetty.servlet.ServletHolder;
|
||||||
import org.hl7.fhir.instance.model.api.IIdType;
|
|
||||||
import org.hl7.fhir.r4.model.IdType;
|
import org.hl7.fhir.r4.model.IdType;
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Disabled;
|
import org.junit.jupiter.api.Disabled;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.transaction.annotation.Propagation;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
@ -45,10 +49,13 @@ import java.nio.charset.StandardCharsets;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
import static org.hamcrest.Matchers.*;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.hamcrest.Matchers.not;
|
||||||
|
import static org.hamcrest.Matchers.startsWith;
|
||||||
import ca.uhn.fhir.test.utilities.JettyUtil;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
import static org.junit.jupiter.api.Assertions.fail;
|
||||||
|
|
||||||
public class SystemProviderDstu2Test extends BaseJpaDstu2Test {
|
public class SystemProviderDstu2Test extends BaseJpaDstu2Test {
|
||||||
|
|
||||||
|
@ -104,7 +111,7 @@ public class SystemProviderDstu2Test extends BaseJpaDstu2Test {
|
||||||
servletHolder.setServlet(restServer);
|
servletHolder.setServlet(restServer);
|
||||||
proxyHandler.addServlet(servletHolder, "/fhir/context/*");
|
proxyHandler.addServlet(servletHolder, "/fhir/context/*");
|
||||||
|
|
||||||
ourCtx = FhirContext.forCached(FhirVersionEnum.DSTU2);
|
ourCtx = FhirContext.forDstu2Cached();
|
||||||
restServer.setFhirContext(ourCtx);
|
restServer.setFhirContext(ourCtx);
|
||||||
|
|
||||||
ourServer.setHandler(proxyHandler);
|
ourServer.setHandler(proxyHandler);
|
||||||
|
@ -396,7 +403,6 @@ public class SystemProviderDstu2Test extends BaseJpaDstu2Test {
|
||||||
assertEquals(200, http.getStatusLine().getStatusCode());
|
assertEquals(200, http.getStatusLine().getStatusCode());
|
||||||
} finally {
|
} finally {
|
||||||
IOUtils.closeQuietly(http);
|
IOUtils.closeQuietly(http);
|
||||||
;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ca.uhn.fhir.jpa.provider;
|
package ca.uhn.fhir.jpa.provider;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||||
import ca.uhn.fhir.jpa.dao.dstu2.BaseJpaDstu2Test;
|
import ca.uhn.fhir.jpa.dao.dstu2.BaseJpaDstu2Test;
|
||||||
import ca.uhn.fhir.jpa.rp.dstu2.ObservationResourceProvider;
|
import ca.uhn.fhir.jpa.rp.dstu2.ObservationResourceProvider;
|
||||||
|
@ -82,7 +81,7 @@ public class SystemProviderTransactionSearchDstu2Test extends BaseJpaDstu2Test {
|
||||||
servletHolder.setServlet(restServer);
|
servletHolder.setServlet(restServer);
|
||||||
proxyHandler.addServlet(servletHolder, "/fhir/context/*");
|
proxyHandler.addServlet(servletHolder, "/fhir/context/*");
|
||||||
|
|
||||||
ourCtx = FhirContext.forCached(FhirVersionEnum.DSTU2);
|
ourCtx = FhirContext.forDstu2Cached();
|
||||||
restServer.setFhirContext(ourCtx);
|
restServer.setFhirContext(ourCtx);
|
||||||
|
|
||||||
ourServer.setHandler(proxyHandler);
|
ourServer.setHandler(proxyHandler);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ca.uhn.fhir.jpa.provider;
|
package ca.uhn.fhir.jpa.provider;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||||
import ca.uhn.fhir.test.BaseTest;
|
import ca.uhn.fhir.test.BaseTest;
|
||||||
import org.hl7.fhir.r4.model.CodeSystem;
|
import org.hl7.fhir.r4.model.CodeSystem;
|
||||||
|
@ -13,7 +12,7 @@ public class TerminologyUploaderProviderTest extends BaseTest {
|
||||||
@Test
|
@Test
|
||||||
public void testCanonicalizeR3() {
|
public void testCanonicalizeR3() {
|
||||||
TerminologyUploaderProvider provider = new TerminologyUploaderProvider();
|
TerminologyUploaderProvider provider = new TerminologyUploaderProvider();
|
||||||
provider.setContext(FhirContext.forCached(FhirVersionEnum.DSTU3));
|
provider.setContext(FhirContext.forDstu3Cached());
|
||||||
|
|
||||||
org.hl7.fhir.dstu3.model.CodeSystem input = new org.hl7.fhir.dstu3.model.CodeSystem();
|
org.hl7.fhir.dstu3.model.CodeSystem input = new org.hl7.fhir.dstu3.model.CodeSystem();
|
||||||
input.addConcept().setCode("FOO").setDisplay("Foo");
|
input.addConcept().setCode("FOO").setDisplay("Foo");
|
||||||
|
@ -26,7 +25,7 @@ public class TerminologyUploaderProviderTest extends BaseTest {
|
||||||
@Test
|
@Test
|
||||||
public void testCanonicalizeR4() {
|
public void testCanonicalizeR4() {
|
||||||
TerminologyUploaderProvider provider = new TerminologyUploaderProvider();
|
TerminologyUploaderProvider provider = new TerminologyUploaderProvider();
|
||||||
provider.setContext(FhirContext.forCached(FhirVersionEnum.R4));
|
provider.setContext(FhirContext.forR4Cached());
|
||||||
|
|
||||||
org.hl7.fhir.r4.model.CodeSystem input = new org.hl7.fhir.r4.model.CodeSystem();
|
org.hl7.fhir.r4.model.CodeSystem input = new org.hl7.fhir.r4.model.CodeSystem();
|
||||||
input.addConcept().setCode("FOO").setDisplay("Foo");
|
input.addConcept().setCode("FOO").setDisplay("Foo");
|
||||||
|
@ -39,7 +38,7 @@ public class TerminologyUploaderProviderTest extends BaseTest {
|
||||||
@Test
|
@Test
|
||||||
public void testCanonicalizeR5() {
|
public void testCanonicalizeR5() {
|
||||||
TerminologyUploaderProvider provider = new TerminologyUploaderProvider();
|
TerminologyUploaderProvider provider = new TerminologyUploaderProvider();
|
||||||
provider.setContext(FhirContext.forCached(FhirVersionEnum.R5));
|
provider.setContext(FhirContext.forR5Cached());
|
||||||
|
|
||||||
org.hl7.fhir.r5.model.CodeSystem input = new org.hl7.fhir.r5.model.CodeSystem();
|
org.hl7.fhir.r5.model.CodeSystem input = new org.hl7.fhir.r5.model.CodeSystem();
|
||||||
input.addConcept().setCode("FOO").setDisplay("Foo");
|
input.addConcept().setCode("FOO").setDisplay("Foo");
|
||||||
|
@ -52,7 +51,7 @@ public class TerminologyUploaderProviderTest extends BaseTest {
|
||||||
@Test
|
@Test
|
||||||
public void testCanonicalizeR5_WrongType() {
|
public void testCanonicalizeR5_WrongType() {
|
||||||
TerminologyUploaderProvider provider = new TerminologyUploaderProvider();
|
TerminologyUploaderProvider provider = new TerminologyUploaderProvider();
|
||||||
provider.setContext(FhirContext.forCached(FhirVersionEnum.R5));
|
provider.setContext(FhirContext.forR5Cached());
|
||||||
|
|
||||||
org.hl7.fhir.r5.model.Patient input = new org.hl7.fhir.r5.model.Patient();
|
org.hl7.fhir.r5.model.Patient input = new org.hl7.fhir.r5.model.Patient();
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,20 @@
|
||||||
package ca.uhn.fhir.jpa.provider.dstu3;
|
package ca.uhn.fhir.jpa.provider.dstu3;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.jpa.dao.dstu3.FhirResourceDaoDstu3TerminologyTest;
|
import ca.uhn.fhir.jpa.dao.dstu3.FhirResourceDaoDstu3TerminologyTest;
|
||||||
import ca.uhn.fhir.jpa.term.TermReindexingSvcImpl;
|
import ca.uhn.fhir.jpa.term.TermReindexingSvcImpl;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
|
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
|
||||||
import org.hl7.fhir.dstu3.model.*;
|
import org.hl7.fhir.dstu3.model.BooleanType;
|
||||||
|
import org.hl7.fhir.dstu3.model.CodeSystem;
|
||||||
|
import org.hl7.fhir.dstu3.model.CodeType;
|
||||||
|
import org.hl7.fhir.dstu3.model.Coding;
|
||||||
|
import org.hl7.fhir.dstu3.model.Parameters;
|
||||||
|
import org.hl7.fhir.dstu3.model.Questionnaire;
|
||||||
|
import org.hl7.fhir.dstu3.model.QuestionnaireResponse;
|
||||||
|
import org.hl7.fhir.dstu3.model.StringType;
|
||||||
|
import org.hl7.fhir.dstu3.model.UriType;
|
||||||
|
import org.hl7.fhir.dstu3.model.ValueSet;
|
||||||
import org.hl7.fhir.instance.model.api.IBaseOperationOutcome;
|
import org.hl7.fhir.instance.model.api.IBaseOperationOutcome;
|
||||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
@ -22,7 +30,7 @@ import static org.junit.jupiter.api.Assertions.fail;
|
||||||
public class ResourceProviderDstu3CodeSystemTest extends BaseResourceProviderDstu3Test {
|
public class ResourceProviderDstu3CodeSystemTest extends BaseResourceProviderDstu3Test {
|
||||||
|
|
||||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ResourceProviderDstu3CodeSystemTest.class);
|
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ResourceProviderDstu3CodeSystemTest.class);
|
||||||
public static FhirContext ourCtx = FhirContext.forCached(FhirVersionEnum.DSTU3);
|
public static FhirContext ourCtx = FhirContext.forDstu3Cached();
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
@Transactional
|
@Transactional
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ca.uhn.fhir.jpa.provider.dstu3;
|
package ca.uhn.fhir.jpa.provider.dstu3;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||||
import ca.uhn.fhir.jpa.dao.dstu3.BaseJpaDstu3Test;
|
import ca.uhn.fhir.jpa.dao.dstu3.BaseJpaDstu3Test;
|
||||||
import ca.uhn.fhir.jpa.rp.dstu3.ObservationResourceProvider;
|
import ca.uhn.fhir.jpa.rp.dstu3.ObservationResourceProvider;
|
||||||
|
@ -13,7 +12,6 @@ import ca.uhn.fhir.rest.client.api.IGenericClient;
|
||||||
import ca.uhn.fhir.rest.client.interceptor.SimpleRequestHeaderInterceptor;
|
import ca.uhn.fhir.rest.client.interceptor.SimpleRequestHeaderInterceptor;
|
||||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||||
import ca.uhn.fhir.test.utilities.JettyUtil;
|
import ca.uhn.fhir.test.utilities.JettyUtil;
|
||||||
import ca.uhn.fhir.util.TestUtil;
|
|
||||||
import com.google.common.base.Charsets;
|
import com.google.common.base.Charsets;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||||
|
@ -34,10 +32,10 @@ import org.hl7.fhir.dstu3.model.Bundle.HTTPVerb;
|
||||||
import org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender;
|
import org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender;
|
||||||
import org.hl7.fhir.dstu3.model.Patient;
|
import org.hl7.fhir.dstu3.model.Patient;
|
||||||
import org.hl7.fhir.instance.model.api.IIdType;
|
import org.hl7.fhir.instance.model.api.IIdType;
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
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 java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -102,7 +100,7 @@ public class SystemProviderTransactionSearchDstu3Test extends BaseJpaDstu3Test {
|
||||||
servletHolder.setServlet(restServer);
|
servletHolder.setServlet(restServer);
|
||||||
proxyHandler.addServlet(servletHolder, "/fhir/context/*");
|
proxyHandler.addServlet(servletHolder, "/fhir/context/*");
|
||||||
|
|
||||||
ourCtx = FhirContext.forCached(FhirVersionEnum.DSTU3);
|
ourCtx = FhirContext.forDstu3Cached();
|
||||||
restServer.setFhirContext(ourCtx);
|
restServer.setFhirContext(ourCtx);
|
||||||
|
|
||||||
ourServer.setHandler(proxyHandler);
|
ourServer.setHandler(proxyHandler);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ca.uhn.fhir.jpa.provider.r4;
|
package ca.uhn.fhir.jpa.provider.r4;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||||
import ca.uhn.fhir.jpa.dao.r4.BaseJpaR4Test;
|
import ca.uhn.fhir.jpa.dao.r4.BaseJpaR4Test;
|
||||||
import ca.uhn.fhir.jpa.rp.r4.ObservationResourceProvider;
|
import ca.uhn.fhir.jpa.rp.r4.ObservationResourceProvider;
|
||||||
|
@ -12,7 +11,6 @@ import ca.uhn.fhir.rest.client.api.IGenericClient;
|
||||||
import ca.uhn.fhir.rest.client.interceptor.SimpleRequestHeaderInterceptor;
|
import ca.uhn.fhir.rest.client.interceptor.SimpleRequestHeaderInterceptor;
|
||||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||||
import ca.uhn.fhir.test.utilities.JettyUtil;
|
import ca.uhn.fhir.test.utilities.JettyUtil;
|
||||||
import ca.uhn.fhir.util.TestUtil;
|
|
||||||
import org.apache.http.impl.client.CloseableHttpClient;
|
import org.apache.http.impl.client.CloseableHttpClient;
|
||||||
import org.apache.http.impl.client.HttpClientBuilder;
|
import org.apache.http.impl.client.HttpClientBuilder;
|
||||||
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
||||||
|
@ -20,10 +18,10 @@ import org.eclipse.jetty.server.Server;
|
||||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||||
import org.eclipse.jetty.servlet.ServletHolder;
|
import org.eclipse.jetty.servlet.ServletHolder;
|
||||||
import org.hl7.fhir.r4.model.Observation;
|
import org.hl7.fhir.r4.model.Observation;
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
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 java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@ -76,7 +74,7 @@ public class EmptyIndexesR4Test extends BaseJpaR4Test {
|
||||||
servletHolder.setServlet(restServer);
|
servletHolder.setServlet(restServer);
|
||||||
proxyHandler.addServlet(servletHolder, "/fhir/context/*");
|
proxyHandler.addServlet(servletHolder, "/fhir/context/*");
|
||||||
|
|
||||||
ourCtx = FhirContext.forCached(FhirVersionEnum.R4);
|
ourCtx = FhirContext.forR4Cached();
|
||||||
restServer.setFhirContext(ourCtx);
|
restServer.setFhirContext(ourCtx);
|
||||||
|
|
||||||
ourServer.setHandler(proxyHandler);
|
ourServer.setHandler(proxyHandler);
|
||||||
|
|
|
@ -5,6 +5,10 @@ import ca.uhn.fhir.jpa.packages.PackageInstallationSpec;
|
||||||
import ca.uhn.fhir.rest.api.CacheControlDirective;
|
import ca.uhn.fhir.rest.api.CacheControlDirective;
|
||||||
import ca.uhn.fhir.rest.api.Constants;
|
import ca.uhn.fhir.rest.api.Constants;
|
||||||
import ca.uhn.fhir.rest.server.provider.ServerCapabilityStatementProvider;
|
import ca.uhn.fhir.rest.server.provider.ServerCapabilityStatementProvider;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.hl7.fhir.instance.model.api.IAnyResource;
|
||||||
|
import org.hl7.fhir.r4.model.Bundle;
|
||||||
|
import org.hamcrest.Matchers;
|
||||||
import org.hl7.fhir.r4.model.CapabilityStatement;
|
import org.hl7.fhir.r4.model.CapabilityStatement;
|
||||||
import org.hl7.fhir.r4.model.Enumerations;
|
import org.hl7.fhir.r4.model.Enumerations;
|
||||||
import org.hl7.fhir.r4.model.SearchParameter;
|
import org.hl7.fhir.r4.model.SearchParameter;
|
||||||
|
@ -17,8 +21,10 @@ import org.slf4j.LoggerFactory;
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
import static org.hamcrest.Matchers.containsInAnyOrder;
|
import static org.hamcrest.Matchers.containsInAnyOrder;
|
||||||
import static org.hamcrest.Matchers.hasItem;
|
import static org.hamcrest.Matchers.hasItem;
|
||||||
|
@ -26,11 +32,42 @@ import static org.hamcrest.Matchers.hasItems;
|
||||||
import static org.hamcrest.Matchers.hasSize;
|
import static org.hamcrest.Matchers.hasSize;
|
||||||
import static org.hamcrest.Matchers.not;
|
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.junit.jupiter.api.Assertions.fail;
|
||||||
|
|
||||||
public class ServerCapabilityStatementProviderJpaR4Test extends BaseResourceProviderR4Test {
|
public class ServerCapabilityStatementProviderJpaR4Test extends BaseResourceProviderR4Test {
|
||||||
|
|
||||||
private static final Logger ourLog = LoggerFactory.getLogger(ServerCapabilityStatementProviderJpaR4Test.class);
|
private static final Logger ourLog = LoggerFactory.getLogger(ServerCapabilityStatementProviderJpaR4Test.class);
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testBuiltInSearchParameters() {
|
||||||
|
CapabilityStatement cs = myClient.capabilities().ofType(CapabilityStatement.class).execute();
|
||||||
|
CapabilityStatement.CapabilityStatementRestResourceComponent resource = cs.getRest().get(0).getResource().get(0);
|
||||||
|
List<String> definitions = resource.getSearchParam()
|
||||||
|
.stream()
|
||||||
|
.filter(t -> isNotBlank(t.getDefinition()))
|
||||||
|
.map(t->t.getDefinition())
|
||||||
|
.sorted()
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
assertThat(definitions.toString(), definitions, Matchers.contains(
|
||||||
|
"http://hl7.org/fhir/SearchParameter/Account-identifier",
|
||||||
|
"http://hl7.org/fhir/SearchParameter/Account-name",
|
||||||
|
"http://hl7.org/fhir/SearchParameter/Account-owner",
|
||||||
|
"http://hl7.org/fhir/SearchParameter/Account-patient",
|
||||||
|
"http://hl7.org/fhir/SearchParameter/Account-period",
|
||||||
|
"http://hl7.org/fhir/SearchParameter/Account-status",
|
||||||
|
"http://hl7.org/fhir/SearchParameter/Account-subject",
|
||||||
|
"http://hl7.org/fhir/SearchParameter/Account-type",
|
||||||
|
"http://hl7.org/fhir/SearchParameter/DomainResource-text",
|
||||||
|
"http://hl7.org/fhir/SearchParameter/Resource-content",
|
||||||
|
"http://hl7.org/fhir/SearchParameter/Resource-id",
|
||||||
|
"http://hl7.org/fhir/SearchParameter/Resource-lastUpdated",
|
||||||
|
"http://hl7.org/fhir/SearchParameter/Resource-profile",
|
||||||
|
"http://hl7.org/fhir/SearchParameter/Resource-security",
|
||||||
|
"http://hl7.org/fhir/SearchParameter/Resource-source",
|
||||||
|
"http://hl7.org/fhir/SearchParameter/Resource-tag"
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCorrectResourcesReflected() {
|
public void testCorrectResourcesReflected() {
|
||||||
CapabilityStatement cs = myClient.capabilities().ofType(CapabilityStatement.class).execute();
|
CapabilityStatement cs = myClient.capabilities().ofType(CapabilityStatement.class).execute();
|
||||||
|
@ -104,8 +141,8 @@ public class ServerCapabilityStatementProviderJpaR4Test extends BaseResourceProv
|
||||||
List<CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent> fooSearchParams = findSearchParams(cs, "Patient", "_lastUpdated");
|
List<CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent> fooSearchParams = findSearchParams(cs, "Patient", "_lastUpdated");
|
||||||
assertEquals(1, fooSearchParams.size());
|
assertEquals(1, fooSearchParams.size());
|
||||||
assertEquals("_lastUpdated", fooSearchParams.get(0).getName());
|
assertEquals("_lastUpdated", fooSearchParams.get(0).getName());
|
||||||
assertEquals("http://localhost:" + ourPort + "/fhir/context/SearchParameter/Patient-_lastUpdated", fooSearchParams.get(0).getDefinition());
|
assertEquals("http://hl7.org/fhir/SearchParameter/Resource-lastUpdated", fooSearchParams.get(0).getDefinition());
|
||||||
assertEquals("Only return resources which were last updated as specified by the given range", fooSearchParams.get(0).getDocumentation());
|
assertEquals("When the resource version last changed", fooSearchParams.get(0).getDocumentation());
|
||||||
assertEquals(Enumerations.SearchParamType.DATE, fooSearchParams.get(0).getType());
|
assertEquals(Enumerations.SearchParamType.DATE, fooSearchParams.get(0).getType());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -265,6 +302,35 @@ public class ServerCapabilityStatementProviderJpaR4Test extends BaseResourceProv
|
||||||
assertThat(findSearchParams(cs, "Patient", Constants.PARAM_FILTER), hasSize(0));
|
assertThat(findSearchParams(cs, "Patient", Constants.PARAM_FILTER), hasSize(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testBuiltInParametersHaveAppropriateUrl() throws IOException {
|
||||||
|
Bundle allSearchParamBundle = loadResourceFromClasspath(Bundle.class, "org/hl7/fhir/r4/model/sp/search-parameters.json");
|
||||||
|
Set<String> allSearchParamUrls = allSearchParamBundle
|
||||||
|
.getEntry()
|
||||||
|
.stream()
|
||||||
|
.map(t -> (SearchParameter) t.getResource())
|
||||||
|
.map(t -> t.getUrl())
|
||||||
|
.filter(StringUtils::isNotBlank)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
|
CapabilityStatement cs = myClient.capabilities().ofType(CapabilityStatement.class).execute();
|
||||||
|
for (CapabilityStatement.CapabilityStatementRestResourceComponent nextResource : cs.getRestFirstRep().getResource()) {
|
||||||
|
for (CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent nextSp : nextResource.getSearchParam()) {
|
||||||
|
if (nextSp.getName().equals("_has")) {
|
||||||
|
if (nextSp.getDefinition() == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!allSearchParamUrls.contains(nextSp.getDefinition())) {
|
||||||
|
fail("Invalid search parameter: " + nextSp.getName() + " has definition URL: " + nextSp.getDefinition());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
private List<String> findSupportedProfiles(CapabilityStatement theCapabilityStatement, String theResourceType) {
|
private List<String> findSupportedProfiles(CapabilityStatement theCapabilityStatement, String theResourceType) {
|
||||||
assertEquals(1, theCapabilityStatement.getRest().size());
|
assertEquals(1, theCapabilityStatement.getRest().size());
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ca.uhn.fhir.jpa.provider.r4;
|
package ca.uhn.fhir.jpa.provider.r4;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.interceptor.api.Hook;
|
import ca.uhn.fhir.interceptor.api.Hook;
|
||||||
import ca.uhn.fhir.interceptor.api.Pointcut;
|
import ca.uhn.fhir.interceptor.api.Pointcut;
|
||||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||||
|
@ -161,7 +160,7 @@ public class SystemProviderR4Test extends BaseJpaR4Test {
|
||||||
servletHolder.setServlet(restServer);
|
servletHolder.setServlet(restServer);
|
||||||
proxyHandler.addServlet(servletHolder, "/fhir/context/*");
|
proxyHandler.addServlet(servletHolder, "/fhir/context/*");
|
||||||
|
|
||||||
ourCtx = FhirContext.forCached(FhirVersionEnum.R4);
|
ourCtx = FhirContext.forR4Cached();
|
||||||
restServer.setFhirContext(ourCtx);
|
restServer.setFhirContext(ourCtx);
|
||||||
|
|
||||||
ourServer.setHandler(proxyHandler);
|
ourServer.setHandler(proxyHandler);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ca.uhn.fhir.jpa.provider.r4;
|
package ca.uhn.fhir.jpa.provider.r4;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||||
import ca.uhn.fhir.jpa.dao.r4.BaseJpaR4Test;
|
import ca.uhn.fhir.jpa.dao.r4.BaseJpaR4Test;
|
||||||
import ca.uhn.fhir.jpa.rp.r4.MedicationRequestResourceProvider;
|
import ca.uhn.fhir.jpa.rp.r4.MedicationRequestResourceProvider;
|
||||||
|
@ -17,7 +16,6 @@ import ca.uhn.fhir.rest.param.ReferenceParam;
|
||||||
import ca.uhn.fhir.rest.param.TokenOrListParam;
|
import ca.uhn.fhir.rest.param.TokenOrListParam;
|
||||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||||
import ca.uhn.fhir.test.utilities.JettyUtil;
|
import ca.uhn.fhir.test.utilities.JettyUtil;
|
||||||
import ca.uhn.fhir.util.TestUtil;
|
|
||||||
import org.apache.http.impl.client.CloseableHttpClient;
|
import org.apache.http.impl.client.CloseableHttpClient;
|
||||||
import org.apache.http.impl.client.HttpClientBuilder;
|
import org.apache.http.impl.client.HttpClientBuilder;
|
||||||
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
||||||
|
@ -34,8 +32,8 @@ import org.hl7.fhir.r4.model.Medication;
|
||||||
import org.hl7.fhir.r4.model.MedicationRequest;
|
import org.hl7.fhir.r4.model.MedicationRequest;
|
||||||
import org.hl7.fhir.r4.model.Patient;
|
import org.hl7.fhir.r4.model.Patient;
|
||||||
import org.hl7.fhir.r4.model.Reference;
|
import org.hl7.fhir.r4.model.Reference;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
|
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;
|
||||||
|
|
||||||
|
@ -44,10 +42,10 @@ import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
import static org.hamcrest.Matchers.*;
|
import static org.hamcrest.Matchers.contains;
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.hamcrest.Matchers.not;
|
||||||
|
import static org.hamcrest.Matchers.nullValue;
|
||||||
import ca.uhn.fhir.test.utilities.JettyUtil;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
public class SystemProviderTransactionSearchR4Test extends BaseJpaR4Test {
|
public class SystemProviderTransactionSearchR4Test extends BaseJpaR4Test {
|
||||||
|
|
||||||
|
@ -103,7 +101,7 @@ public class SystemProviderTransactionSearchR4Test extends BaseJpaR4Test {
|
||||||
servletHolder.setServlet(restServer);
|
servletHolder.setServlet(restServer);
|
||||||
proxyHandler.addServlet(servletHolder, "/fhir/context/*");
|
proxyHandler.addServlet(servletHolder, "/fhir/context/*");
|
||||||
|
|
||||||
ourCtx = FhirContext.forCached(FhirVersionEnum.R4);
|
ourCtx = FhirContext.forR4Cached();
|
||||||
restServer.setFhirContext(ourCtx);
|
restServer.setFhirContext(ourCtx);
|
||||||
|
|
||||||
ourServer.setHandler(proxyHandler);
|
ourServer.setHandler(proxyHandler);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ca.uhn.fhir.jpa.search;
|
package ca.uhn.fhir.jpa.search;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
|
import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
|
||||||
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
|
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
|
||||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||||
|
@ -87,7 +86,7 @@ import static org.mockito.Mockito.when;
|
||||||
public class SearchCoordinatorSvcImplTest {
|
public class SearchCoordinatorSvcImplTest {
|
||||||
|
|
||||||
private static final Logger ourLog = LoggerFactory.getLogger(SearchCoordinatorSvcImplTest.class);
|
private static final Logger ourLog = LoggerFactory.getLogger(SearchCoordinatorSvcImplTest.class);
|
||||||
private static FhirContext ourCtx = FhirContext.forCached(FhirVersionEnum.DSTU3);
|
private static final FhirContext ourCtx = FhirContext.forDstu3Cached();
|
||||||
@Mock
|
@Mock
|
||||||
private IFhirResourceDao<?> myCallingDao;
|
private IFhirResourceDao<?> myCallingDao;
|
||||||
@Mock
|
@Mock
|
||||||
|
@ -667,7 +666,7 @@ public class SearchCoordinatorSvcImplTest {
|
||||||
public static class FailAfterNIterator extends BaseIterator<ResourcePersistentId> implements IResultIterator {
|
public static class FailAfterNIterator extends BaseIterator<ResourcePersistentId> implements IResultIterator {
|
||||||
|
|
||||||
private int myCount;
|
private int myCount;
|
||||||
private IResultIterator myWrap;
|
private final IResultIterator myWrap;
|
||||||
|
|
||||||
FailAfterNIterator(IResultIterator theWrap, int theCount) {
|
FailAfterNIterator(IResultIterator theWrap, int theCount) {
|
||||||
myWrap = theWrap;
|
myWrap = theWrap;
|
||||||
|
@ -768,10 +767,10 @@ public class SearchCoordinatorSvcImplTest {
|
||||||
|
|
||||||
private static final Logger ourLog = LoggerFactory.getLogger(SlowIterator.class);
|
private static final Logger ourLog = LoggerFactory.getLogger(SlowIterator.class);
|
||||||
private final IResultIterator myResultIteratorWrap;
|
private final IResultIterator myResultIteratorWrap;
|
||||||
private int myDelay;
|
private final int myDelay;
|
||||||
private Iterator<ResourcePersistentId> myWrap;
|
private final Iterator<ResourcePersistentId> myWrap;
|
||||||
private List<ResourcePersistentId> myReturnedValues = new ArrayList<>();
|
private final List<ResourcePersistentId> myReturnedValues = new ArrayList<>();
|
||||||
private AtomicInteger myCountReturned = new AtomicInteger(0);
|
private final AtomicInteger myCountReturned = new AtomicInteger(0);
|
||||||
|
|
||||||
SlowIterator(Iterator<ResourcePersistentId> theWrap, int theDelay) {
|
SlowIterator(Iterator<ResourcePersistentId> theWrap, int theDelay) {
|
||||||
myWrap = theWrap;
|
myWrap = theWrap;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ca.uhn.fhir.jpa.search.builder.sql;
|
package ca.uhn.fhir.jpa.search.builder.sql;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
|
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
|
||||||
import ca.uhn.fhir.jpa.config.HibernatePropertiesProvider;
|
import ca.uhn.fhir.jpa.config.HibernatePropertiesProvider;
|
||||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||||
|
@ -43,7 +42,7 @@ public class SearchQueryBuilderTest {
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void before() {
|
public void before() {
|
||||||
myFhirContext = FhirContext.forCached(FhirVersionEnum.R4);
|
myFhirContext = FhirContext.forR4Cached();
|
||||||
myModelConfig = new ModelConfig();
|
myModelConfig = new ModelConfig();
|
||||||
myPartitionSettings = new PartitionSettings();
|
myPartitionSettings = new PartitionSettings();
|
||||||
myRequestPartitionId = RequestPartitionId.allPartitions();
|
myRequestPartitionId = RequestPartitionId.allPartitions();
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ca.uhn.fhir.jpa.search.lastn;
|
package ca.uhn.fhir.jpa.search.lastn;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||||
import ca.uhn.fhir.jpa.search.lastn.config.TestElasticsearchContainerHelper;
|
import ca.uhn.fhir.jpa.search.lastn.config.TestElasticsearchContainerHelper;
|
||||||
import ca.uhn.fhir.jpa.search.lastn.json.CodeJson;
|
import ca.uhn.fhir.jpa.search.lastn.json.CodeJson;
|
||||||
|
@ -61,7 +60,7 @@ public class LastNElasticsearchSvcMultipleObservationsIT {
|
||||||
private static ObjectMapper ourMapperNonPrettyPrint;
|
private static ObjectMapper ourMapperNonPrettyPrint;
|
||||||
private static boolean indexLoaded = false;
|
private static boolean indexLoaded = false;
|
||||||
private final Map<String, Map<String, List<Date>>> createdPatientObservationMap = new HashMap<>();
|
private final Map<String, Map<String, List<Date>>> createdPatientObservationMap = new HashMap<>();
|
||||||
private final FhirContext myFhirContext = FhirContext.forCached(FhirVersionEnum.R4);
|
private final FhirContext myFhirContext = FhirContext.forR4Cached();
|
||||||
private ElasticsearchSvcImpl elasticsearchSvc;
|
private ElasticsearchSvcImpl elasticsearchSvc;
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ca.uhn.fhir.jpa.search.lastn;
|
package ca.uhn.fhir.jpa.search.lastn;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||||
import ca.uhn.fhir.jpa.model.util.CodeSystemHash;
|
import ca.uhn.fhir.jpa.model.util.CodeSystemHash;
|
||||||
import ca.uhn.fhir.jpa.search.lastn.config.TestElasticsearchContainerHelper;
|
import ca.uhn.fhir.jpa.search.lastn.config.TestElasticsearchContainerHelper;
|
||||||
|
@ -27,23 +26,17 @@ 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.ExtendWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
|
||||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||||
import org.testcontainers.elasticsearch.ElasticsearchContainer;
|
import org.testcontainers.elasticsearch.ElasticsearchContainer;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.time.Duration;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import static java.time.temporal.ChronoUnit.SECONDS;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
@ -85,7 +78,7 @@ public class LastNElasticsearchSvcSingleObservationIT {
|
||||||
final String CODEFIRSTCODINGSYSTEM = "http://mycodes.org/fhir/observation-code";
|
final String CODEFIRSTCODINGSYSTEM = "http://mycodes.org/fhir/observation-code";
|
||||||
final String CODEFIRSTCODINGCODE = "test-code";
|
final String CODEFIRSTCODINGCODE = "test-code";
|
||||||
final String CODEFIRSTCODINGDISPLAY = "test-code display";
|
final String CODEFIRSTCODINGDISPLAY = "test-code display";
|
||||||
final FhirContext myFhirContext = FhirContext.forCached(FhirVersionEnum.R4);
|
final FhirContext myFhirContext = FhirContext.forR4Cached();
|
||||||
|
|
||||||
ElasticsearchSvcImpl elasticsearchSvc;
|
ElasticsearchSvcImpl elasticsearchSvc;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ca.uhn.fhir.jpa.search.reindex;
|
package ca.uhn.fhir.jpa.search.reindex;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||||
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
|
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
|
||||||
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
|
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
|
||||||
|
@ -56,7 +55,7 @@ import static org.mockito.Mockito.when;
|
||||||
@ExtendWith(MockitoExtension.class)
|
@ExtendWith(MockitoExtension.class)
|
||||||
public class ResourceReindexingSvcImplTest extends BaseJpaTest {
|
public class ResourceReindexingSvcImplTest extends BaseJpaTest {
|
||||||
|
|
||||||
private static final FhirContext ourCtx = FhirContext.forCached(FhirVersionEnum.R4);
|
private static final FhirContext ourCtx = FhirContext.forR4Cached();
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private PlatformTransactionManager myTxManager;
|
private PlatformTransactionManager myTxManager;
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
package ca.uhn.fhir.jpa.searchparam;
|
package ca.uhn.fhir.jpa.searchparam;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
||||||
import ca.uhn.fhir.jpa.config.TestDstu3Config;
|
import ca.uhn.fhir.jpa.config.TestDstu3Config;
|
||||||
import ca.uhn.fhir.jpa.dao.BaseJpaTest;
|
import ca.uhn.fhir.jpa.dao.BaseJpaTest;
|
||||||
import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
|
|
||||||
import ca.uhn.fhir.jpa.searchparam.util.Dstu3DistanceHelper;
|
import ca.uhn.fhir.jpa.searchparam.util.Dstu3DistanceHelper;
|
||||||
import ca.uhn.fhir.rest.param.QuantityParam;
|
import ca.uhn.fhir.rest.param.QuantityParam;
|
||||||
import ca.uhn.fhir.rest.param.ReferenceParam;
|
import ca.uhn.fhir.rest.param.ReferenceParam;
|
||||||
|
import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
|
||||||
import org.hl7.fhir.dstu3.model.Condition;
|
import org.hl7.fhir.dstu3.model.Condition;
|
||||||
import org.hl7.fhir.dstu3.model.Location;
|
import org.hl7.fhir.dstu3.model.Location;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
@ -30,7 +29,7 @@ import static org.mockito.Mockito.when;
|
||||||
@ContextConfiguration(classes = {TestDstu3Config.class})
|
@ContextConfiguration(classes = {TestDstu3Config.class})
|
||||||
public class MatchUrlServiceTest extends BaseJpaTest {
|
public class MatchUrlServiceTest extends BaseJpaTest {
|
||||||
|
|
||||||
private static FhirContext ourCtx = FhirContext.forCached(FhirVersionEnum.DSTU3);
|
private static final FhirContext ourCtx = FhirContext.forDstu3Cached();
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
MatchUrlService myMatchUrlService;
|
MatchUrlService myMatchUrlService;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ca.uhn.fhir.jpa.stresstest;
|
package ca.uhn.fhir.jpa.stresstest;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
|
import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
|
||||||
import ca.uhn.fhir.interceptor.executor.InterceptorService;
|
import ca.uhn.fhir.interceptor.executor.InterceptorService;
|
||||||
import ca.uhn.fhir.interceptor.model.ReadPartitionIdRequestDetails;
|
import ca.uhn.fhir.interceptor.model.ReadPartitionIdRequestDetails;
|
||||||
|
@ -36,6 +35,7 @@ import ca.uhn.fhir.jpa.searchparam.extractor.SearchParamExtractorR4;
|
||||||
import ca.uhn.fhir.jpa.searchparam.extractor.SearchParamExtractorService;
|
import ca.uhn.fhir.jpa.searchparam.extractor.SearchParamExtractorService;
|
||||||
import ca.uhn.fhir.jpa.searchparam.matcher.InMemoryResourceMatcher;
|
import ca.uhn.fhir.jpa.searchparam.matcher.InMemoryResourceMatcher;
|
||||||
import ca.uhn.fhir.jpa.searchparam.registry.SearchParamRegistryImpl;
|
import ca.uhn.fhir.jpa.searchparam.registry.SearchParamRegistryImpl;
|
||||||
|
import ca.uhn.fhir.jpa.searchparam.registry.SearchParameterCanonicalizer;
|
||||||
import ca.uhn.fhir.jpa.sp.SearchParamPresenceSvcImpl;
|
import ca.uhn.fhir.jpa.sp.SearchParamPresenceSvcImpl;
|
||||||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||||
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
|
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
|
||||||
|
@ -109,7 +109,7 @@ import static org.mockito.Mockito.when;
|
||||||
public class GiantTransactionPerfTest {
|
public class GiantTransactionPerfTest {
|
||||||
|
|
||||||
private static final Logger ourLog = LoggerFactory.getLogger(GiantTransactionPerfTest.class);
|
private static final Logger ourLog = LoggerFactory.getLogger(GiantTransactionPerfTest.class);
|
||||||
private final FhirContext myCtx = FhirContext.forCached(FhirVersionEnum.R4);
|
private final FhirContext myCtx = FhirContext.forR4Cached();
|
||||||
private FhirSystemDaoR4 mySystemDao;
|
private FhirSystemDaoR4 mySystemDao;
|
||||||
private IInterceptorBroadcaster myInterceptorSvc;
|
private IInterceptorBroadcaster myInterceptorSvc;
|
||||||
private TransactionProcessor myTransactionProcessor;
|
private TransactionProcessor myTransactionProcessor;
|
||||||
|
@ -218,6 +218,7 @@ public class GiantTransactionPerfTest {
|
||||||
|
|
||||||
mySearchParamRegistry = new SearchParamRegistryImpl();
|
mySearchParamRegistry = new SearchParamRegistryImpl();
|
||||||
mySearchParamRegistry.setResourceChangeListenerRegistry(myResourceChangeListenerRegistry);
|
mySearchParamRegistry.setResourceChangeListenerRegistry(myResourceChangeListenerRegistry);
|
||||||
|
mySearchParamRegistry.setSearchParameterCanonicalizerForUnitTest(new SearchParameterCanonicalizer(myCtx));
|
||||||
mySearchParamRegistry.setFhirContext(myCtx);
|
mySearchParamRegistry.setFhirContext(myCtx);
|
||||||
mySearchParamRegistry.setModelConfig(myDaoConfig.getModelConfig());
|
mySearchParamRegistry.setModelConfig(myDaoConfig.getModelConfig());
|
||||||
mySearchParamRegistry.registerListener();
|
mySearchParamRegistry.registerListener();
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
package ca.uhn.fhir.jpa.stresstest;
|
package ca.uhn.fhir.jpa.stresstest;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.test.BaseTest;
|
import ca.uhn.fhir.test.BaseTest;
|
||||||
import ca.uhn.fhir.util.StopWatch;
|
import ca.uhn.fhir.util.StopWatch;
|
||||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
|
||||||
import org.hl7.fhir.r4.model.Bundle;
|
import org.hl7.fhir.r4.model.Bundle;
|
||||||
import org.junit.jupiter.api.Disabled;
|
import org.junit.jupiter.api.Disabled;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
@ -24,7 +22,7 @@ public class StressTestParserTest extends BaseTest {
|
||||||
@Test
|
@Test
|
||||||
@Disabled
|
@Disabled
|
||||||
public void test() throws IOException {
|
public void test() throws IOException {
|
||||||
FhirContext ctx = FhirContext.forCached(FhirVersionEnum.R4);
|
FhirContext ctx = FhirContext.forR4Cached();
|
||||||
String input = loadResource("/org/hl7/fhir/r4/model/valueset/valuesets.xml");
|
String input = loadResource("/org/hl7/fhir/r4/model/valueset/valuesets.xml");
|
||||||
|
|
||||||
Bundle parsed = ctx.newXmlParser().parseResource(Bundle.class, input);
|
Bundle parsed = ctx.newXmlParser().parseResource(Bundle.class, input);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ca.uhn.fhir.jpa.subscription;
|
package ca.uhn.fhir.jpa.subscription;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||||
import ca.uhn.fhir.jpa.provider.r5.BaseResourceProviderR5Test;
|
import ca.uhn.fhir.jpa.provider.r5.BaseResourceProviderR5Test;
|
||||||
import ca.uhn.fhir.jpa.subscription.channel.impl.LinkedBlockingChannel;
|
import ca.uhn.fhir.jpa.subscription.channel.impl.LinkedBlockingChannel;
|
||||||
|
@ -225,7 +224,7 @@ public abstract class BaseSubscriptionsR5Test extends BaseResourceProviderR5Test
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
public static void startListenerServer() throws Exception {
|
public static void startListenerServer() throws Exception {
|
||||||
RestfulServer ourListenerRestServer = new RestfulServer(FhirContext.forCached(FhirVersionEnum.R5));
|
RestfulServer ourListenerRestServer = new RestfulServer(FhirContext.forR5Cached());
|
||||||
|
|
||||||
ObservationListener obsListener = new ObservationListener();
|
ObservationListener obsListener = new ObservationListener();
|
||||||
ourListenerRestServer.setResourceProviders(obsListener);
|
ourListenerRestServer.setResourceProviders(obsListener);
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
package ca.uhn.fhir.jpa.subscription;
|
package ca.uhn.fhir.jpa.subscription;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.rest.api.MethodOutcome;
|
import ca.uhn.fhir.rest.api.MethodOutcome;
|
||||||
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
||||||
|
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||||
|
|
||||||
public class FhirServiceUtil {
|
public class FhirServiceUtil {
|
||||||
|
|
||||||
|
@ -16,12 +14,12 @@ public class FhirServiceUtil {
|
||||||
public static final String REST_HOOK_ENDPOINT = "http://localhost:10080/rest-hook";
|
public static final String REST_HOOK_ENDPOINT = "http://localhost:10080/rest-hook";
|
||||||
|
|
||||||
public static IGenericClient getFhirDstu3Client() {
|
public static IGenericClient getFhirDstu3Client() {
|
||||||
FhirContext ctx = FhirContext.forCached(FhirVersionEnum.DSTU3);
|
FhirContext ctx = FhirContext.forDstu3Cached();
|
||||||
return ctx.newRestfulGenericClient(FHIR_DSTU3_URL);
|
return ctx.newRestfulGenericClient(FHIR_DSTU3_URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IGenericClient getFhirDstu2Client() {
|
public static IGenericClient getFhirDstu2Client() {
|
||||||
FhirContext ctx = FhirContext.forCached(FhirVersionEnum.DSTU2);
|
FhirContext ctx = FhirContext.forDstu2Cached();
|
||||||
return ctx.newRestfulGenericClient(FHIR_DSTU2_URL);
|
return ctx.newRestfulGenericClient(FHIR_DSTU2_URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ca.uhn.fhir.jpa.subscription;
|
package ca.uhn.fhir.jpa.subscription;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
|
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
|
||||||
import ca.uhn.fhir.jpa.subscription.match.matcher.matching.SubscriptionStrategyEvaluator;
|
import ca.uhn.fhir.jpa.subscription.match.matcher.matching.SubscriptionStrategyEvaluator;
|
||||||
import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionCanonicalizer;
|
import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionCanonicalizer;
|
||||||
|
@ -26,7 +25,7 @@ public class SubscriptionValidatingInterceptorTest {
|
||||||
@Mock
|
@Mock
|
||||||
public DaoRegistry myDaoRegistry;
|
public DaoRegistry myDaoRegistry;
|
||||||
private SubscriptionValidatingInterceptor mySvc;
|
private SubscriptionValidatingInterceptor mySvc;
|
||||||
private FhirContext myCtx = FhirContext.forCached(FhirVersionEnum.R4);
|
private final FhirContext myCtx = FhirContext.forR4Cached();
|
||||||
@Mock
|
@Mock
|
||||||
private SubscriptionStrategyEvaluator mySubscriptionStrategyEvaluator;
|
private SubscriptionStrategyEvaluator mySubscriptionStrategyEvaluator;
|
||||||
|
|
||||||
|
|
|
@ -338,18 +338,6 @@ public class InMemorySubscriptionMatcherR4Test {
|
||||||
assertNotMatched(o1, params);
|
assertNotMatched(o1, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testLanguageNotSupported() {
|
|
||||||
Patient patient = new Patient();
|
|
||||||
patient.getLanguageElement().setValue("en_CA");
|
|
||||||
patient.addIdentifier().setSystem("urn:system").setValue("001");
|
|
||||||
patient.addName().setFamily("testSearchLanguageParam").addGiven("Joe");
|
|
||||||
SearchParameterMap params;
|
|
||||||
params = new SearchParameterMap();
|
|
||||||
params.add(IAnyResource.SP_RES_LANGUAGE, new StringParam("en_CA"));
|
|
||||||
assertUnsupported(patient, params);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLocationPositionNotSupported() {
|
public void testLocationPositionNotSupported() {
|
||||||
Location loc = new Location();
|
Location loc = new Location();
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ca.uhn.fhir.jpa.subscription.resthook;
|
package ca.uhn.fhir.jpa.subscription.resthook;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.jpa.provider.r4.BaseResourceProviderR4Test;
|
import ca.uhn.fhir.jpa.provider.r4.BaseResourceProviderR4Test;
|
||||||
import ca.uhn.fhir.jpa.subscription.SubscriptionTestUtil;
|
import ca.uhn.fhir.jpa.subscription.SubscriptionTestUtil;
|
||||||
import ca.uhn.fhir.jpa.subscription.submit.interceptor.SubscriptionMatcherInterceptor;
|
import ca.uhn.fhir.jpa.subscription.submit.interceptor.SubscriptionMatcherInterceptor;
|
||||||
|
@ -164,7 +163,7 @@ public class RestHookActivatesPreExistingSubscriptionsR4Test extends BaseResourc
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
public static void startListenerServer() throws Exception {
|
public static void startListenerServer() throws Exception {
|
||||||
ourListenerRestServer = new RestfulServer(FhirContext.forCached(FhirVersionEnum.R4));
|
ourListenerRestServer = new RestfulServer(FhirContext.forR4Cached());
|
||||||
|
|
||||||
ObservationListener obsListener = new ObservationListener();
|
ObservationListener obsListener = new ObservationListener();
|
||||||
ourListenerRestServer.setResourceProviders(obsListener);
|
ourListenerRestServer.setResourceProviders(obsListener);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ca.uhn.fhir.jpa.subscription.resthook;
|
package ca.uhn.fhir.jpa.subscription.resthook;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||||
import ca.uhn.fhir.jpa.provider.BaseResourceProviderDstu2Test;
|
import ca.uhn.fhir.jpa.provider.BaseResourceProviderDstu2Test;
|
||||||
import ca.uhn.fhir.jpa.subscription.SubscriptionTestUtil;
|
import ca.uhn.fhir.jpa.subscription.SubscriptionTestUtil;
|
||||||
|
@ -28,7 +27,11 @@ import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||||
import org.eclipse.jetty.servlet.ServletHolder;
|
import org.eclipse.jetty.servlet.ServletHolder;
|
||||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||||
import org.hl7.fhir.instance.model.api.IIdType;
|
import org.hl7.fhir.instance.model.api.IIdType;
|
||||||
import org.junit.jupiter.api.*; import static org.hamcrest.MatcherAssert.assertThat;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
|
import org.junit.jupiter.api.AfterEach;
|
||||||
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
@ -38,7 +41,11 @@ import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static ca.uhn.fhir.jpa.subscription.resthook.RestHookTestDstu3Test.logAllInterceptors;
|
import static ca.uhn.fhir.jpa.subscription.resthook.RestHookTestDstu3Test.logAllInterceptors;
|
||||||
import static org.hamcrest.CoreMatchers.containsString;
|
import static org.hamcrest.CoreMatchers.containsString;
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
|
import static org.junit.jupiter.api.Assertions.fail;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the rest-hook subscriptions
|
* Test the rest-hook subscriptions
|
||||||
|
@ -46,13 +53,13 @@ import static org.junit.jupiter.api.Assertions.*;
|
||||||
public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
|
public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
|
||||||
|
|
||||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RestHookTestDstu2Test.class);
|
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RestHookTestDstu2Test.class);
|
||||||
private static List<String> ourCreatedObservations = Lists.newArrayList();
|
private static final List<String> ourCreatedObservations = Lists.newArrayList();
|
||||||
private static int ourListenerPort;
|
private static int ourListenerPort;
|
||||||
private static RestfulServer ourListenerRestServer;
|
private static RestfulServer ourListenerRestServer;
|
||||||
private static Server ourListenerServer;
|
private static Server ourListenerServer;
|
||||||
private static String ourListenerServerBase;
|
private static String ourListenerServerBase;
|
||||||
private static List<String> ourUpdatedObservations = Lists.newArrayList();
|
private static final List<String> ourUpdatedObservations = Lists.newArrayList();
|
||||||
private List<IIdType> mySubscriptionIds = new ArrayList<IIdType>();
|
private final List<IIdType> mySubscriptionIds = new ArrayList<IIdType>();
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SubscriptionTestUtil mySubscriptionTestUtil;
|
private SubscriptionTestUtil mySubscriptionTestUtil;
|
||||||
|
@ -325,7 +332,7 @@ public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
public static void startListenerServer() throws Exception {
|
public static void startListenerServer() throws Exception {
|
||||||
ourListenerRestServer = new RestfulServer(FhirContext.forCached(FhirVersionEnum.DSTU2));
|
ourListenerRestServer = new RestfulServer(FhirContext.forDstu2Cached());
|
||||||
|
|
||||||
ObservationListener obsListener = new ObservationListener();
|
ObservationListener obsListener = new ObservationListener();
|
||||||
ourListenerRestServer.setResourceProviders(obsListener);
|
ourListenerRestServer.setResourceProviders(obsListener);
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
package ca.uhn.fhir.jpa.subscription.resthook;
|
package ca.uhn.fhir.jpa.subscription.resthook;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.interceptor.api.IInterceptorService;
|
import ca.uhn.fhir.interceptor.api.IInterceptorService;
|
||||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||||
import ca.uhn.fhir.jpa.provider.dstu3.BaseResourceProviderDstu3Test;
|
import ca.uhn.fhir.jpa.provider.dstu3.BaseResourceProviderDstu3Test;
|
||||||
import ca.uhn.fhir.jpa.subscription.NotificationServlet;
|
import ca.uhn.fhir.jpa.subscription.NotificationServlet;
|
||||||
import ca.uhn.fhir.jpa.subscription.SubscriptionTestUtil;
|
import ca.uhn.fhir.jpa.subscription.SubscriptionTestUtil;
|
||||||
import ca.uhn.fhir.jpa.subscription.util.SubscriptionDebugLogInterceptor;
|
|
||||||
import ca.uhn.fhir.jpa.subscription.match.matcher.matching.SubscriptionMatchingStrategy;
|
import ca.uhn.fhir.jpa.subscription.match.matcher.matching.SubscriptionMatchingStrategy;
|
||||||
|
import ca.uhn.fhir.jpa.subscription.util.SubscriptionDebugLogInterceptor;
|
||||||
import ca.uhn.fhir.rest.annotation.Create;
|
import ca.uhn.fhir.rest.annotation.Create;
|
||||||
import ca.uhn.fhir.rest.annotation.ResourceParam;
|
import ca.uhn.fhir.rest.annotation.ResourceParam;
|
||||||
import ca.uhn.fhir.rest.annotation.Update;
|
import ca.uhn.fhir.rest.annotation.Update;
|
||||||
|
@ -24,10 +23,22 @@ import com.google.common.collect.Lists;
|
||||||
import org.eclipse.jetty.server.Server;
|
import org.eclipse.jetty.server.Server;
|
||||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||||
import org.eclipse.jetty.servlet.ServletHolder;
|
import org.eclipse.jetty.servlet.ServletHolder;
|
||||||
import org.hl7.fhir.dstu3.model.*;
|
import org.hl7.fhir.dstu3.model.CodeableConcept;
|
||||||
|
import org.hl7.fhir.dstu3.model.Coding;
|
||||||
|
import org.hl7.fhir.dstu3.model.CommunicationRequest;
|
||||||
|
import org.hl7.fhir.dstu3.model.DateTimeType;
|
||||||
|
import org.hl7.fhir.dstu3.model.IdType;
|
||||||
|
import org.hl7.fhir.dstu3.model.Observation;
|
||||||
|
import org.hl7.fhir.dstu3.model.Organization;
|
||||||
|
import org.hl7.fhir.dstu3.model.StringType;
|
||||||
|
import org.hl7.fhir.dstu3.model.Subscription;
|
||||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||||
import org.hl7.fhir.instance.model.api.IIdType;
|
import org.hl7.fhir.instance.model.api.IIdType;
|
||||||
import org.junit.jupiter.api.*; import static org.hamcrest.MatcherAssert.assertThat;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
|
import org.junit.jupiter.api.AfterEach;
|
||||||
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
@ -40,8 +51,15 @@ import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static org.awaitility.Awaitility.await;
|
import static org.awaitility.Awaitility.await;
|
||||||
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
import static org.junit.jupiter.api.Assertions.fail;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the rest-hook subscriptions
|
* Test the rest-hook subscriptions
|
||||||
|
@ -49,18 +67,18 @@ import static org.junit.jupiter.api.Assertions.*;
|
||||||
public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
|
public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
|
||||||
|
|
||||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RestHookTestDstu3Test.class);
|
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RestHookTestDstu3Test.class);
|
||||||
private static List<Observation> ourCreatedObservations = Collections.synchronizedList(Lists.newArrayList());
|
private static final List<Observation> ourCreatedObservations = Collections.synchronizedList(Lists.newArrayList());
|
||||||
private static int ourListenerPort;
|
private static int ourListenerPort;
|
||||||
private static RestfulServer ourListenerRestServer;
|
private static RestfulServer ourListenerRestServer;
|
||||||
private static Server ourListenerServer;
|
private static Server ourListenerServer;
|
||||||
private static String ourListenerServerBase;
|
private static String ourListenerServerBase;
|
||||||
private static List<Observation> ourUpdatedObservations = Collections.synchronizedList(Lists.newArrayList());
|
private static final List<Observation> ourUpdatedObservations = Collections.synchronizedList(Lists.newArrayList());
|
||||||
private static List<String> ourContentTypes = Collections.synchronizedList(new ArrayList<>());
|
private static final List<String> ourContentTypes = Collections.synchronizedList(new ArrayList<>());
|
||||||
private static NotificationServlet ourNotificationServlet;
|
private static NotificationServlet ourNotificationServlet;
|
||||||
private static String ourNotificationListenerServer;
|
private static String ourNotificationListenerServer;
|
||||||
private static CountDownLatch communicationRequestListenerLatch;
|
private static CountDownLatch communicationRequestListenerLatch;
|
||||||
private static SubscriptionDebugLogInterceptor ourSubscriptionDebugLogInterceptor = new SubscriptionDebugLogInterceptor();
|
private static final SubscriptionDebugLogInterceptor ourSubscriptionDebugLogInterceptor = new SubscriptionDebugLogInterceptor();
|
||||||
private List<IIdType> mySubscriptionIds = Collections.synchronizedList(new ArrayList<>());
|
private final List<IIdType> mySubscriptionIds = Collections.synchronizedList(new ArrayList<>());
|
||||||
@Autowired
|
@Autowired
|
||||||
private SubscriptionTestUtil mySubscriptionTestUtil;
|
private SubscriptionTestUtil mySubscriptionTestUtil;
|
||||||
|
|
||||||
|
@ -638,7 +656,7 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
public static void startListenerServer() throws Exception {
|
public static void startListenerServer() throws Exception {
|
||||||
ourListenerRestServer = new RestfulServer(FhirContext.forCached(FhirVersionEnum.DSTU3));
|
ourListenerRestServer = new RestfulServer(FhirContext.forDstu3Cached());
|
||||||
|
|
||||||
ObservationListener obsListener = new ObservationListener();
|
ObservationListener obsListener = new ObservationListener();
|
||||||
CommunicationRequestListener crListener = new CommunicationRequestListener();
|
CommunicationRequestListener crListener = new CommunicationRequestListener();
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ca.uhn.fhir.jpa.subscription.resthook;
|
package ca.uhn.fhir.jpa.subscription.resthook;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||||
import ca.uhn.fhir.jpa.provider.BaseResourceProviderDstu2Test;
|
import ca.uhn.fhir.jpa.provider.BaseResourceProviderDstu2Test;
|
||||||
import ca.uhn.fhir.jpa.subscription.SubscriptionTestUtil;
|
import ca.uhn.fhir.jpa.subscription.SubscriptionTestUtil;
|
||||||
|
@ -47,12 +46,12 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test extends BaseResourceProviderDstu2Test {
|
public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test extends BaseResourceProviderDstu2Test {
|
||||||
|
|
||||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test.class);
|
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test.class);
|
||||||
private static List<Observation> ourCreatedObservations = Collections.synchronizedList(Lists.newArrayList());
|
private static final List<Observation> ourCreatedObservations = Collections.synchronizedList(Lists.newArrayList());
|
||||||
private static int ourListenerPort;
|
private static int ourListenerPort;
|
||||||
private static RestfulServer ourListenerRestServer;
|
private static RestfulServer ourListenerRestServer;
|
||||||
private static Server ourListenerServer;
|
private static Server ourListenerServer;
|
||||||
private static String ourListenerServerBase;
|
private static String ourListenerServerBase;
|
||||||
private static List<Observation> ourUpdatedObservations = Collections.synchronizedList(Lists.newArrayList());
|
private static final List<Observation> ourUpdatedObservations = Collections.synchronizedList(Lists.newArrayList());
|
||||||
@Autowired
|
@Autowired
|
||||||
protected SubscriptionRegistry mySubscriptionRegistry;
|
protected SubscriptionRegistry mySubscriptionRegistry;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -309,7 +308,7 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test extends B
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
public static void startListenerServer() throws Exception {
|
public static void startListenerServer() throws Exception {
|
||||||
ourListenerRestServer = new RestfulServer(FhirContext.forCached(FhirVersionEnum.DSTU2));
|
ourListenerRestServer = new RestfulServer(FhirContext.forDstu2Cached());
|
||||||
|
|
||||||
ObservationListener obsListener = new ObservationListener();
|
ObservationListener obsListener = new ObservationListener();
|
||||||
ourListenerRestServer.setResourceProviders(obsListener);
|
ourListenerRestServer.setResourceProviders(obsListener);
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
package ca.uhn.fhir.jpa.subscription.resthook;
|
package ca.uhn.fhir.jpa.subscription.resthook;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||||
import ca.uhn.fhir.jpa.provider.dstu3.BaseResourceProviderDstu3Test;
|
import ca.uhn.fhir.jpa.provider.dstu3.BaseResourceProviderDstu3Test;
|
||||||
import ca.uhn.fhir.jpa.subscription.SubscriptionTestUtil;
|
import ca.uhn.fhir.jpa.subscription.SubscriptionTestUtil;
|
||||||
|
@ -42,13 +41,13 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
*/
|
*/
|
||||||
public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu3Test extends BaseResourceProviderDstu3Test {
|
public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu3Test extends BaseResourceProviderDstu3Test {
|
||||||
|
|
||||||
private static List<Observation> ourCreatedObservations = Collections.synchronizedList(Lists.newArrayList());
|
private static final List<Observation> ourCreatedObservations = Collections.synchronizedList(Lists.newArrayList());
|
||||||
private static int ourListenerPort;
|
private static int ourListenerPort;
|
||||||
private static RestfulServer ourListenerRestServer;
|
private static RestfulServer ourListenerRestServer;
|
||||||
private static Server ourListenerServer;
|
private static Server ourListenerServer;
|
||||||
private static String ourListenerServerBase;
|
private static String ourListenerServerBase;
|
||||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RestHookTestWithInterceptorRegisteredToDaoConfigDstu3Test.class);
|
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RestHookTestWithInterceptorRegisteredToDaoConfigDstu3Test.class);
|
||||||
private static List<Observation> ourUpdatedObservations = Collections.synchronizedList(Lists.newArrayList());
|
private static final List<Observation> ourUpdatedObservations = Collections.synchronizedList(Lists.newArrayList());
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SubscriptionTestUtil mySubscriptionTestUtil;
|
private SubscriptionTestUtil mySubscriptionTestUtil;
|
||||||
|
@ -266,7 +265,7 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu3Test extends B
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
public static void startListenerServer() throws Exception {
|
public static void startListenerServer() throws Exception {
|
||||||
ourListenerRestServer = new RestfulServer(FhirContext.forCached(FhirVersionEnum.DSTU3));
|
ourListenerRestServer = new RestfulServer(FhirContext.forDstu3Cached());
|
||||||
|
|
||||||
ObservationListener obsListener = new ObservationListener();
|
ObservationListener obsListener = new ObservationListener();
|
||||||
ourListenerRestServer.setResourceProviders(obsListener);
|
ourListenerRestServer.setResourceProviders(obsListener);
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
package ca.uhn.fhir.jpa.subscription.resthook;
|
package ca.uhn.fhir.jpa.subscription.resthook;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||||
import ca.uhn.fhir.jpa.provider.r4.BaseResourceProviderR4Test;
|
import ca.uhn.fhir.jpa.provider.r4.BaseResourceProviderR4Test;
|
||||||
import ca.uhn.fhir.jpa.subscription.SubscriptionTestUtil;
|
import ca.uhn.fhir.jpa.subscription.SubscriptionTestUtil;
|
||||||
|
@ -20,28 +19,36 @@ import org.eclipse.jetty.server.Server;
|
||||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||||
import org.eclipse.jetty.servlet.ServletHolder;
|
import org.eclipse.jetty.servlet.ServletHolder;
|
||||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||||
import org.hl7.fhir.r4.model.*;
|
import org.hl7.fhir.r4.model.CodeableConcept;
|
||||||
import org.junit.jupiter.api.*; import static org.hamcrest.MatcherAssert.assertThat;
|
import org.hl7.fhir.r4.model.Coding;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import org.hl7.fhir.r4.model.IdType;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
import org.hl7.fhir.r4.model.Observation;
|
||||||
|
import org.hl7.fhir.r4.model.Subscription;
|
||||||
|
import org.junit.jupiter.api.AfterAll;
|
||||||
|
import org.junit.jupiter.api.AfterEach;
|
||||||
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the rest-hook subscriptions
|
* Test the rest-hook subscriptions
|
||||||
*/
|
*/
|
||||||
public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends BaseResourceProviderR4Test {
|
public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends BaseResourceProviderR4Test {
|
||||||
|
|
||||||
private static List<Observation> ourCreatedObservations = Collections.synchronizedList(Lists.newArrayList());
|
private static final List<Observation> ourCreatedObservations = Collections.synchronizedList(Lists.newArrayList());
|
||||||
private static int ourListenerPort;
|
private static int ourListenerPort;
|
||||||
private static RestfulServer ourListenerRestServer;
|
private static RestfulServer ourListenerRestServer;
|
||||||
private static Server ourListenerServer;
|
private static Server ourListenerServer;
|
||||||
private static String ourListenerServerBase;
|
private static String ourListenerServerBase;
|
||||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RestHookTestWithInterceptorRegisteredToDaoConfigR4Test.class);
|
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RestHookTestWithInterceptorRegisteredToDaoConfigR4Test.class);
|
||||||
private static List<Observation> ourUpdatedObservations = Collections.synchronizedList(Lists.newArrayList());
|
private static final List<Observation> ourUpdatedObservations = Collections.synchronizedList(Lists.newArrayList());
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SubscriptionTestUtil mySubscriptionTestUtil;
|
private SubscriptionTestUtil mySubscriptionTestUtil;
|
||||||
|
@ -270,7 +277,7 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
public static void startListenerServer() throws Exception {
|
public static void startListenerServer() throws Exception {
|
||||||
ourListenerRestServer = new RestfulServer(FhirContext.forCached(FhirVersionEnum.R4));
|
ourListenerRestServer = new RestfulServer(FhirContext.forR4Cached());
|
||||||
|
|
||||||
ObservationListener obsListener = new ObservationListener();
|
ObservationListener obsListener = new ObservationListener();
|
||||||
ourListenerRestServer.setResourceProviders(obsListener);
|
ourListenerRestServer.setResourceProviders(obsListener);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ca.uhn.fhir.jpa.subscription.resthook;
|
package ca.uhn.fhir.jpa.subscription.resthook;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.interceptor.api.Hook;
|
import ca.uhn.fhir.interceptor.api.Hook;
|
||||||
import ca.uhn.fhir.interceptor.api.IInterceptorService;
|
import ca.uhn.fhir.interceptor.api.IInterceptorService;
|
||||||
import ca.uhn.fhir.interceptor.api.Interceptor;
|
import ca.uhn.fhir.interceptor.api.Interceptor;
|
||||||
|
@ -61,7 +60,7 @@ public class RestHookWithInterceptorR4Test extends BaseSubscriptionsR4Test {
|
||||||
private static boolean ourNextAfterRestHookDeliveryReturn;
|
private static boolean ourNextAfterRestHookDeliveryReturn;
|
||||||
private static boolean ourHitAfterRestHookDelivery;
|
private static boolean ourHitAfterRestHookDelivery;
|
||||||
private static boolean ourNextAddHeader;
|
private static boolean ourNextAddHeader;
|
||||||
private static FhirContext ourCtx = FhirContext.forCached(FhirVersionEnum.R4);
|
private static final FhirContext ourCtx = FhirContext.forR4Cached();
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
StoppableSubscriptionDeliveringRestHookSubscriber myStoppableSubscriptionDeliveringRestHookSubscriber;
|
StoppableSubscriptionDeliveringRestHookSubscriber myStoppableSubscriptionDeliveringRestHookSubscriber;
|
||||||
|
@ -277,7 +276,7 @@ public class RestHookWithInterceptorR4Test extends BaseSubscriptionsR4Test {
|
||||||
public static class AttributeCarryingInterceptor {
|
public static class AttributeCarryingInterceptor {
|
||||||
|
|
||||||
private ResourceDeliveryMessage myLastDelivery;
|
private ResourceDeliveryMessage myLastDelivery;
|
||||||
private CountDownLatch myFinishedLatch = new CountDownLatch(1);
|
private final CountDownLatch myFinishedLatch = new CountDownLatch(1);
|
||||||
|
|
||||||
public CountDownLatch getFinishedLatch() {
|
public CountDownLatch getFinishedLatch() {
|
||||||
return myFinishedLatch;
|
return myFinishedLatch;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ca.uhn.fhir.jpa.subscription.resthook;
|
package ca.uhn.fhir.jpa.subscription.resthook;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||||
import ca.uhn.fhir.jpa.model.sched.ISchedulerService;
|
import ca.uhn.fhir.jpa.model.sched.ISchedulerService;
|
||||||
import ca.uhn.fhir.jpa.model.util.JpaConstants;
|
import ca.uhn.fhir.jpa.model.util.JpaConstants;
|
||||||
|
@ -64,12 +63,12 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
|
||||||
private static RestfulServer ourListenerRestServer;
|
private static RestfulServer ourListenerRestServer;
|
||||||
private static Server ourListenerServer;
|
private static Server ourListenerServer;
|
||||||
private static String ourListenerServerBase;
|
private static String ourListenerServerBase;
|
||||||
private static List<Observation> ourCreatedObservations = Collections.synchronizedList(Lists.newArrayList());
|
private static final List<Observation> ourCreatedObservations = Collections.synchronizedList(Lists.newArrayList());
|
||||||
private static List<Observation> ourUpdatedObservations = Collections.synchronizedList(Lists.newArrayList());
|
private static final List<Observation> ourUpdatedObservations = Collections.synchronizedList(Lists.newArrayList());
|
||||||
private static List<Patient> ourCreatedPatients = Lists.newArrayList();
|
private static final List<Patient> ourCreatedPatients = Lists.newArrayList();
|
||||||
private static List<Patient> ourUpdatedPatients = Lists.newArrayList();
|
private static final List<Patient> ourUpdatedPatients = Lists.newArrayList();
|
||||||
private static List<String> ourContentTypes = new ArrayList<>();
|
private static final List<String> ourContentTypes = new ArrayList<>();
|
||||||
private List<IIdType> mySubscriptionIds = new ArrayList<>();
|
private final List<IIdType> mySubscriptionIds = new ArrayList<>();
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SubscriptionTestUtil mySubscriptionTestUtil;
|
private SubscriptionTestUtil mySubscriptionTestUtil;
|
||||||
|
@ -555,7 +554,7 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
public static void startListenerServer() throws Exception {
|
public static void startListenerServer() throws Exception {
|
||||||
ourListenerRestServer = new RestfulServer(FhirContext.forCached(FhirVersionEnum.DSTU3));
|
ourListenerRestServer = new RestfulServer(FhirContext.forDstu3Cached());
|
||||||
|
|
||||||
ObservationListener obsListener = new ObservationListener();
|
ObservationListener obsListener = new ObservationListener();
|
||||||
PatientListener ptListener = new PatientListener();
|
PatientListener ptListener = new PatientListener();
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ca.uhn.fhir.jpa.term;
|
package ca.uhn.fhir.jpa.term;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.jpa.entity.TermCodeSystemVersion;
|
import ca.uhn.fhir.jpa.entity.TermCodeSystemVersion;
|
||||||
import ca.uhn.fhir.jpa.entity.TermConcept;
|
import ca.uhn.fhir.jpa.entity.TermConcept;
|
||||||
import ca.uhn.fhir.jpa.entity.TermConceptDesignation;
|
import ca.uhn.fhir.jpa.entity.TermConceptDesignation;
|
||||||
|
@ -432,7 +431,7 @@ public class TerminologyLoaderSvcLoincTest extends BaseLoaderTest {
|
||||||
|
|
||||||
// IEEE Medical Device Codes
|
// IEEE Medical Device Codes
|
||||||
conceptMap = conceptMaps.get(LoincIeeeMedicalDeviceCodeHandler.LOINC_IEEE_CM_ID);
|
conceptMap = conceptMaps.get(LoincIeeeMedicalDeviceCodeHandler.LOINC_IEEE_CM_ID);
|
||||||
ourLog.debug(FhirContext.forCached(FhirVersionEnum.R4).newXmlParser().setPrettyPrint(true).encodeResourceToString(conceptMap));
|
ourLog.debug(FhirContext.forR4Cached().newXmlParser().setPrettyPrint(true).encodeResourceToString(conceptMap));
|
||||||
assertEquals(LoincIeeeMedicalDeviceCodeHandler.LOINC_IEEE_CM_NAME, conceptMap.getName());
|
assertEquals(LoincIeeeMedicalDeviceCodeHandler.LOINC_IEEE_CM_NAME, conceptMap.getName());
|
||||||
assertEquals(LoincIeeeMedicalDeviceCodeHandler.LOINC_IEEE_CM_URI, conceptMap.getUrl());
|
assertEquals(LoincIeeeMedicalDeviceCodeHandler.LOINC_IEEE_CM_URI, conceptMap.getUrl());
|
||||||
assertEquals("Beta.1", conceptMap.getVersion());
|
assertEquals("Beta.1", conceptMap.getVersion());
|
||||||
|
@ -458,7 +457,7 @@ public class TerminologyLoaderSvcLoincTest extends BaseLoaderTest {
|
||||||
|
|
||||||
// Group - Parent
|
// Group - Parent
|
||||||
vs = valueSets.get("LG100-4");
|
vs = valueSets.get("LG100-4");
|
||||||
ourLog.info(FhirContext.forCached(FhirVersionEnum.R4).newXmlParser().setPrettyPrint(true).encodeResourceToString(vs));
|
ourLog.info(FhirContext.forR4Cached().newXmlParser().setPrettyPrint(true).encodeResourceToString(vs));
|
||||||
assertEquals("Chem_DrugTox_Chal_Sero_Allergy<SAME:Comp|Prop|Tm|Syst (except intravascular and urine)><ANYBldSerPlas,ANYUrineUrineSed><ROLLUP:Method>", vs.getName());
|
assertEquals("Chem_DrugTox_Chal_Sero_Allergy<SAME:Comp|Prop|Tm|Syst (except intravascular and urine)><ANYBldSerPlas,ANYUrineUrineSed><ROLLUP:Method>", vs.getName());
|
||||||
assertEquals("http://loinc.org/vs/LG100-4", vs.getUrl());
|
assertEquals("http://loinc.org/vs/LG100-4", vs.getUrl());
|
||||||
assertEquals(1, vs.getCompose().getInclude().size());
|
assertEquals(1, vs.getCompose().getInclude().size());
|
||||||
|
@ -467,7 +466,7 @@ public class TerminologyLoaderSvcLoincTest extends BaseLoaderTest {
|
||||||
|
|
||||||
// Group - Child
|
// Group - Child
|
||||||
vs = valueSets.get("LG1695-8");
|
vs = valueSets.get("LG1695-8");
|
||||||
ourLog.info(FhirContext.forCached(FhirVersionEnum.R4).newXmlParser().setPrettyPrint(true).encodeResourceToString(vs));
|
ourLog.info(FhirContext.forR4Cached().newXmlParser().setPrettyPrint(true).encodeResourceToString(vs));
|
||||||
assertEquals("1,4-Dichlorobenzene|MCnc|Pt|ANYBldSerPl", vs.getName());
|
assertEquals("1,4-Dichlorobenzene|MCnc|Pt|ANYBldSerPl", vs.getName());
|
||||||
assertEquals("http://loinc.org/vs/LG1695-8", vs.getUrl());
|
assertEquals("http://loinc.org/vs/LG1695-8", vs.getUrl());
|
||||||
assertEquals(1, vs.getCompose().getInclude().size());
|
assertEquals(1, vs.getCompose().getInclude().size());
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ca.uhn.fhir.jpa.util.jsonpatch;
|
package ca.uhn.fhir.jpa.util.jsonpatch;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.jpa.dao.BaseJpaTest;
|
import ca.uhn.fhir.jpa.dao.BaseJpaTest;
|
||||||
import ca.uhn.fhir.jpa.patch.JsonPatchUtils;
|
import ca.uhn.fhir.jpa.patch.JsonPatchUtils;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||||
|
@ -14,11 +13,12 @@ import org.springframework.transaction.PlatformTransactionManager;
|
||||||
import static org.hamcrest.CoreMatchers.containsString;
|
import static org.hamcrest.CoreMatchers.containsString;
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
import static org.hamcrest.Matchers.not;
|
import static org.hamcrest.Matchers.not;
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.fail;
|
||||||
|
|
||||||
public class JsonPatchUtilsTest extends BaseJpaTest {
|
public class JsonPatchUtilsTest extends BaseJpaTest {
|
||||||
|
|
||||||
private static final FhirContext ourCtx = FhirContext.forCached(FhirVersionEnum.R4);
|
private static final FhirContext ourCtx = FhirContext.forR4Cached();
|
||||||
private static final Logger ourLog = LoggerFactory.getLogger(JsonPatchUtilsTest.class);
|
private static final Logger ourLog = LoggerFactory.getLogger(JsonPatchUtilsTest.class);
|
||||||
|
|
||||||
@SuppressWarnings("JsonStandardCompliance")
|
@SuppressWarnings("JsonStandardCompliance")
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ca.uhn.fhir.validator;
|
package ca.uhn.fhir.validator;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.util.AttachmentUtil;
|
import ca.uhn.fhir.util.AttachmentUtil;
|
||||||
import org.hl7.fhir.instance.model.api.ICompositeType;
|
import org.hl7.fhir.instance.model.api.ICompositeType;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
@ -12,7 +11,7 @@ public class AttachmentUtilTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateAttachmentDstu3() {
|
public void testCreateAttachmentDstu3() {
|
||||||
FhirContext ctx = FhirContext.forCached(FhirVersionEnum.DSTU3);
|
FhirContext ctx = FhirContext.forDstu3Cached();
|
||||||
ICompositeType attachment = AttachmentUtil.newInstance(ctx);
|
ICompositeType attachment = AttachmentUtil.newInstance(ctx);
|
||||||
AttachmentUtil.setData(ctx, attachment, new byte[]{0, 1, 2, 3});
|
AttachmentUtil.setData(ctx, attachment, new byte[]{0, 1, 2, 3});
|
||||||
AttachmentUtil.setUrl(ctx, attachment, "http://foo");
|
AttachmentUtil.setUrl(ctx, attachment, "http://foo");
|
||||||
|
@ -27,7 +26,7 @@ public class AttachmentUtilTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateAttachmentR4() {
|
public void testCreateAttachmentR4() {
|
||||||
FhirContext ctx = FhirContext.forCached(FhirVersionEnum.R4);
|
FhirContext ctx = FhirContext.forR4Cached();
|
||||||
ICompositeType attachment = AttachmentUtil.newInstance(ctx);
|
ICompositeType attachment = AttachmentUtil.newInstance(ctx);
|
||||||
AttachmentUtil.setData(ctx, attachment, new byte[]{0, 1, 2, 3});
|
AttachmentUtil.setData(ctx, attachment, new byte[]{0, 1, 2, 3});
|
||||||
AttachmentUtil.setUrl(ctx, attachment, "http://foo");
|
AttachmentUtil.setUrl(ctx, attachment, "http://foo");
|
||||||
|
@ -42,7 +41,7 @@ public class AttachmentUtilTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateAttachmentR5() {
|
public void testCreateAttachmentR5() {
|
||||||
FhirContext ctx = FhirContext.forCached(FhirVersionEnum.R5);
|
FhirContext ctx = FhirContext.forR5Cached();
|
||||||
ICompositeType attachment = AttachmentUtil.newInstance(ctx);
|
ICompositeType attachment = AttachmentUtil.newInstance(ctx);
|
||||||
AttachmentUtil.setData(ctx, attachment, new byte[]{0, 1, 2, 3});
|
AttachmentUtil.setData(ctx, attachment, new byte[]{0, 1, 2, 3});
|
||||||
AttachmentUtil.setUrl(ctx, attachment, "http://foo");
|
AttachmentUtil.setUrl(ctx, attachment, "http://foo");
|
||||||
|
|
|
@ -1,19 +1,16 @@
|
||||||
package ca.uhn.fhir.validator;
|
package ca.uhn.fhir.validator;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import org.hl7.fhir.common.hapi.validation.validator.FhirInstanceValidator;
|
|
||||||
import org.junit.jupiter.api.AfterAll;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.context.ConfigurationException;
|
import ca.uhn.fhir.context.ConfigurationException;
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.model.dstu2.resource.QuestionnaireResponse;
|
import ca.uhn.fhir.model.dstu2.resource.QuestionnaireResponse;
|
||||||
import ca.uhn.fhir.model.primitive.DateTimeDt;
|
import ca.uhn.fhir.model.primitive.DateTimeDt;
|
||||||
import ca.uhn.fhir.util.TestUtil;
|
|
||||||
import ca.uhn.fhir.validation.FhirValidator;
|
import ca.uhn.fhir.validation.FhirValidator;
|
||||||
import ca.uhn.fhir.validation.ValidationResult;
|
import ca.uhn.fhir.validation.ValidationResult;
|
||||||
|
import org.hl7.fhir.common.hapi.validation.validator.FhirInstanceValidator;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.fail;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This test doesn't really belong to JPA, but it needs to be in a project with both DSTU2 and HL7ORG_DSTU2 present, so here will do.
|
* This test doesn't really belong to JPA, but it needs to be in a project with both DSTU2 and HL7ORG_DSTU2 present, so here will do.
|
||||||
|
@ -23,7 +20,7 @@ public class ValidatorAcrossVersionsTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWrongContextVersion() {
|
public void testWrongContextVersion() {
|
||||||
FhirContext ctxDstu2 = FhirContext.forCached(FhirVersionEnum.DSTU2);
|
FhirContext ctxDstu2 = FhirContext.forDstu2Cached();
|
||||||
try {
|
try {
|
||||||
ctxDstu2.getResourceDefinition(org.hl7.fhir.dstu3.model.Patient.class);
|
ctxDstu2.getResourceDefinition(org.hl7.fhir.dstu3.model.Patient.class);
|
||||||
fail();
|
fail();
|
||||||
|
@ -37,7 +34,7 @@ public class ValidatorAcrossVersionsTest {
|
||||||
@Test
|
@Test
|
||||||
public void testValidateProfileOnDstu2Resource() {
|
public void testValidateProfileOnDstu2Resource() {
|
||||||
|
|
||||||
FhirContext ctxDstu2 = FhirContext.forCached(FhirVersionEnum.DSTU2);
|
FhirContext ctxDstu2 = FhirContext.forDstu2Cached();
|
||||||
FhirValidator val = ctxDstu2.newValidator();
|
FhirValidator val = ctxDstu2.newValidator();
|
||||||
val.setValidateAgainstStandardSchema(false);
|
val.setValidateAgainstStandardSchema(false);
|
||||||
val.setValidateAgainstStandardSchematron(false);
|
val.setValidateAgainstStandardSchematron(false);
|
||||||
|
|
|
@ -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>5.6.0-PRE4-SNAPSHOT</version>
|
<version>5.6.0-PRE5-SNAPSHOT</version>
|
||||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -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>5.6.0-PRE4-SNAPSHOT</version>
|
<version>5.6.0-PRE5-SNAPSHOT</version>
|
||||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -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>5.6.0-PRE4-SNAPSHOT</version>
|
<version>5.6.0-PRE5-SNAPSHOT</version>
|
||||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue