enable some disabled tests (#4662)

* enabled test

* added explanations to disabled tests

* added explanations to disabled tests

* yay enabled another one

* yay enabled another one

* testEverythingWithLargeSet2 failing intermittently

* fix intermittent regression introduced by splitting test class

* test passes

* need to document

* updated documentation

* prereview cleanup

* change log

* cleanup

* cleanup

* added breaking changes

* update changelog and breaking changes upgrade document to reverse the change to always return 200 per the spec.

* back out documentation change

* update documentation

* fix tests

* dstu2

* dstu3

* fix r4 validation warning test

* changelog

* hapi-fhir version bump to 6.5.10-SNAPSHOT

* fix cdr test

* fix tests

* remove accidental commit

---------

Co-authored-by: Ken Stevens <ken@smilecdr.com>
This commit is contained in:
Ken Stevens 2023-04-02 08:47:16 -04:00 committed by GitHub
parent 9066ad618e
commit 4fbeeccda4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
139 changed files with 1791 additions and 2081 deletions

View File

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

View File

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

View File

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

View File

@ -254,7 +254,7 @@ public class MethodOutcome {
return myResource != null;
}
public void setStatusCode(int theResponseStatusCode) {
public void setResponseStatusCode(int theResponseStatusCode) {
myResponseStatusCode = theResponseStatusCode;
}

View File

@ -4,16 +4,14 @@
<modelVersion>4.0.0</modelVersion>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-bom</artifactId>
<version>6.5.9-SNAPSHOT</version>
<version>6.5.10-SNAPSHOT</version>
<packaging>pom</packaging>
<name>HAPI FHIR BOM</name>
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.5.9-SNAPSHOT</version>
<version>6.5.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

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

View File

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

View File

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

View File

@ -6,8 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.5.9-SNAPSHOT</version>
<version>6.5.10-SNAPSHOT</version>
<relativePath>../../hapi-deployable-pom</relativePath>
</parent>

View File

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

View File

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

View File

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

View File

@ -28,7 +28,6 @@ import ca.uhn.fhir.context.IRuntimeDatatypeDefinition;
import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.model.api.IQueryParameterType;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.Include;
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
@ -135,7 +134,6 @@ import com.google.common.base.Charsets;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.hl7.fhir.instance.model.api.IAnyResource;
import org.hl7.fhir.instance.model.api.IBase;
import org.hl7.fhir.instance.model.api.IBaseBundle;
import org.hl7.fhir.instance.model.api.IBaseConformance;
@ -1511,9 +1509,13 @@ public class GenericClient extends BaseClient implements IGenericClient {
IBaseResource response = myWrap.invokeClient(theResponseMimeType, theResponseInputStream, theResponseStatusCode, theHeaders);
MethodOutcome retVal = new MethodOutcome();
retVal.setResource(response);
if (response instanceof IBaseOperationOutcome) {
retVal.setOperationOutcome((IBaseOperationOutcome) response);
} else {
retVal.setResource(response);
}
retVal.setCreatedUsingStatusCode(theResponseStatusCode);
retVal.setStatusCode(theResponseStatusCode);
retVal.setResponseStatusCode(theResponseStatusCode);
retVal.setResponseHeaders(theHeaders);
return retVal;
}
@ -2349,10 +2351,8 @@ public class GenericClient extends BaseClient implements IGenericClient {
public MethodOutcome execute() {
BaseHttpClientInvocation invocation = ValidateMethodBindingDstu2Plus.createValidateInvocation(myContext, myResource);
ResourceResponseHandler<BaseOperationOutcome> handler = new ResourceResponseHandler<>(null, null);
IBaseOperationOutcome outcome = invoke(null, handler, invocation);
MethodOutcome retVal = new MethodOutcome();
retVal.setOperationOutcome(outcome);
return retVal;
MethodOutcomeResponseHandler methodHandler = new MethodOutcomeResponseHandler(handler);
return invoke(null, methodHandler, invocation);
}
@Override

View File

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

View File

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

View File

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

View File

@ -0,0 +1,6 @@
---
type: change
issue: 4662
title: "The Resource $validate operation no longer returns Precondition Failed 412 when a resource fails validation.
It now returns 200 irrespective of the validation outcome as required by the
[FHIR Spec for the Resource $validate operation](https://www.hl7.org/fhir/R4/resource-operation-validate.html)."

View File

@ -1,7 +1,8 @@
This release changes database indexing for string and uri SearchParameters.
The database migration may take several minutes.
These changes will be applied automatically on first startup.
To avoid this delay on first startup, run the migration manually.
This release has breaking changes.
* The Resource $validate operation no longer returns Precondition Failed 412 when a resource fails validation. It now returns 200 irrespective of the validation outcome as required by the [FHIR Specification for the Resource $validate operation](https://www.hl7.org/fhir/R4/resource-operation-validate.html).
* This release changes database indexing for string and uri SearchParameters. The database migration may take several minutes. These changes will be applied automatically on first startup. To avoid this delay on first startup, run the migration manually.
Bulk export behaviour is changing in this release such that Binary resources created as part of the response will now be created in the partition that the bulk export was requested rather than in the DEFAULT partition as was being done previously.

View File

@ -285,7 +285,7 @@ Validate methods must be annotated with the [@Validate](/hapi-fhir/apidocs/hapi-
Validate methods may optionally also have a parameter of type IdType annotated with the [@IdParam](/hapi-fhir/apidocs/hapi-fhir-base/ca/uhn/fhir/rest/annotation/IdParam.html) annotation. This parameter contains the resource ID (see the [FHIR specification](http://hl7.org/implement/standards/fhir/http.html#validation) for details on how this is used).
Validate methods must return normally if the resource validates successfully, or throw an [UnprocessableEntityException](/hapi-fhir/apidocs/hapi-fhir-base/ca/uhn/fhir/rest/server/exceptions/UnprocessableEntityException.html) or [InvalidRequestException](/hapi-fhir/apidocs/hapi-fhir-base/ca/uhn/fhir/rest/server/exceptions/InvalidRequestException.html) if the validation fails.
Validate methods must return normally independent of the validation outcome. The ResponseStatusCode of the MethodOutcome returned should be 200 irrespective of the validation outcome as required by the [FHIR Specification for the Resource $validate operation](https://www.hl7.org/fhir/R4/resource-operation-validate.html).
Validate methods must return either:

View File

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

View File

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

View File

@ -5,8 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.5.9-SNAPSHOT</version>
<version>6.5.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

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

View File

@ -38,7 +38,6 @@ import ca.uhn.fhir.jpa.dao.SearchBuilderFactory;
import ca.uhn.fhir.jpa.dao.mdm.MdmExpansionCacheSvc;
import ca.uhn.fhir.jpa.model.dao.JpaPid;
import ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails;
import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.jpa.util.QueryChunker;
import ca.uhn.fhir.mdm.api.MdmMatchResultEnum;
@ -46,6 +45,7 @@ import ca.uhn.fhir.mdm.dao.IMdmLinkDao;
import ca.uhn.fhir.mdm.model.MdmPidTuple;
import ca.uhn.fhir.model.api.Include;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
import ca.uhn.fhir.rest.api.server.bulk.BulkDataExportOptions;
import ca.uhn.fhir.rest.param.HasOrListParam;
import ca.uhn.fhir.rest.param.HasParam;

View File

@ -20,7 +20,6 @@
package ca.uhn.fhir.jpa.config;
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.util.ReflectionUtil;
import com.google.common.annotations.VisibleForTesting;
import org.apache.commons.lang3.StringUtils;
@ -31,7 +30,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import javax.sql.DataSource;
import java.util.Map;
public class HibernatePropertiesProvider {

View File

@ -1899,14 +1899,11 @@ public abstract class BaseHapiFhirResourceDao<T extends IBaseResource> extends B
result = validator.validateWithResult(theResource, options);
}
if (result.isSuccessful()) {
MethodOutcome retVal = new MethodOutcome();
retVal.setOperationOutcome(result.toOperationOutcome());
return retVal;
} else {
throw new PreconditionFailedException(Msg.code(993) + "Validation failed", result.toOperationOutcome());
}
MethodOutcome retVal = new MethodOutcome();
retVal.setOperationOutcome(result.toOperationOutcome());
// Note an earlier version of this code returned PreconditionFailedException when the validation
// failed, but we since realized the spec requires we return 200 regardless of the validation result.
return retVal;
}
/**

View File

@ -22,7 +22,6 @@ package ca.uhn.fhir.jpa.dao;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
import ca.uhn.fhir.jpa.api.IDaoRegistry;
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao;
import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome;

View File

@ -19,14 +19,13 @@
*/
package ca.uhn.fhir.jpa.dao.data;
import java.util.Collection;
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamUri;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamUri;
import java.util.Collection;
public interface IResourceIndexedSearchParamUriDao extends JpaRepository<ResourceIndexedSearchParamUri, Long>, IHapiFhirJpaRepository {

View File

@ -34,16 +34,15 @@ import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome;
import ca.uhn.fhir.jpa.dao.data.INpmPackageVersionDao;
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
import ca.uhn.fhir.jpa.model.entity.NpmPackageVersionEntity;
import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
import ca.uhn.fhir.jpa.packages.loader.PackageResourceParsingSvc;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistryController;
import ca.uhn.fhir.jpa.searchparam.util.SearchParameterHelper;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
import ca.uhn.fhir.rest.param.StringParam;
import ca.uhn.fhir.rest.param.TokenParam;
import ca.uhn.fhir.rest.param.UriParam;
import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
import ca.uhn.fhir.util.FhirTerser;
import ca.uhn.fhir.util.SearchParameterUtil;
import com.google.common.annotations.VisibleForTesting;

View File

@ -28,14 +28,14 @@ import ca.uhn.fhir.jpa.dao.predicate.SearchFilterParser;
import ca.uhn.fhir.jpa.model.entity.BaseResourceIndexedSearchParam;
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamUri;
import ca.uhn.fhir.jpa.model.search.StorageProcessingMessage;
import ca.uhn.fhir.jpa.util.QueryParameterUtils;
import ca.uhn.fhir.jpa.search.builder.sql.SearchQueryBuilder;
import ca.uhn.fhir.rest.server.util.CompositeInterceptorBroadcaster;
import ca.uhn.fhir.jpa.util.QueryParameterUtils;
import ca.uhn.fhir.model.api.IQueryParameterType;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.param.UriParam;
import ca.uhn.fhir.rest.param.UriParamQualifierEnum;
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
import ca.uhn.fhir.rest.server.util.CompositeInterceptorBroadcaster;
import com.healthmarketscience.sqlbuilder.BinaryCondition;
import com.healthmarketscience.sqlbuilder.ComboCondition;
import com.healthmarketscience.sqlbuilder.Condition;
@ -48,7 +48,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import static ca.uhn.fhir.jpa.util.QueryParameterUtils.toEqualToOrInPredicate;
import static ca.uhn.fhir.jpa.search.builder.predicate.StringPredicateBuilder.createLeftAndRightMatchLikeExpression;
import static ca.uhn.fhir.jpa.search.builder.predicate.StringPredicateBuilder.createLeftMatchLikeExpression;
import static ca.uhn.fhir.jpa.search.builder.predicate.StringPredicateBuilder.createRightMatchLikeExpression;

View File

@ -15,12 +15,12 @@ import ca.uhn.fhir.jpa.dao.SearchBuilderFactory;
import ca.uhn.fhir.jpa.dao.mdm.MdmExpansionCacheSvc;
import ca.uhn.fhir.jpa.model.dao.JpaPid;
import ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails;
import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.mdm.api.MdmMatchResultEnum;
import ca.uhn.fhir.mdm.dao.IMdmLinkDao;
import ca.uhn.fhir.mdm.model.MdmPidTuple;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
import ca.uhn.fhir.rest.api.server.bulk.BulkDataExportOptions;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.r4.model.Group;

View File

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

View File

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

View File

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

View File

@ -4,8 +4,8 @@ import ca.uhn.fhir.interceptor.model.RequestPartitionId;
import ca.uhn.fhir.jpa.entity.MdmLink;
import ca.uhn.fhir.jpa.mdm.BaseMdmR4Test;
import ca.uhn.fhir.jpa.model.dao.JpaPid;
import ca.uhn.fhir.jpa.util.TestUtil;
import ca.uhn.fhir.jpa.model.entity.EnversRevision;
import ca.uhn.fhir.jpa.util.TestUtil;
import ca.uhn.fhir.mdm.api.IMdmLink;
import ca.uhn.fhir.mdm.api.MdmHistorySearchParameters;
import ca.uhn.fhir.mdm.api.MdmLinkSourceEnum;

View File

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

View File

@ -21,20 +21,18 @@ package ca.uhn.fhir.jpa.model.entity;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.jpa.model.cross.IBasePersistedResource;
import ca.uhn.fhir.jpa.model.cross.IResourceLookup;
import ca.uhn.fhir.jpa.model.dao.JpaPid;
import ca.uhn.fhir.jpa.model.search.ExtendedHSearchIndexData;
import ca.uhn.fhir.jpa.model.search.ResourceTableRoutingBinder;
import ca.uhn.fhir.jpa.model.search.SearchParamTextPropertyBinder;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.api.server.storage.IResourcePersistentId;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.Session;
import org.hibernate.annotations.GenerationTime;
import org.hibernate.annotations.GeneratorType;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.OptimisticLock;
import org.hibernate.search.engine.backend.types.Projectable;
import org.hibernate.search.engine.backend.types.Searchable;
@ -63,7 +61,6 @@ import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.Version;

View File

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

View File

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

View File

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

View File

@ -43,6 +43,7 @@ import ca.uhn.fhir.model.dstu2.resource.Medication;
import ca.uhn.fhir.model.dstu2.resource.MedicationAdministration;
import ca.uhn.fhir.model.dstu2.resource.MedicationOrder;
import ca.uhn.fhir.model.dstu2.resource.Observation;
import ca.uhn.fhir.model.dstu2.resource.OperationOutcome;
import ca.uhn.fhir.model.dstu2.resource.Organization;
import ca.uhn.fhir.model.dstu2.resource.Patient;
import ca.uhn.fhir.model.dstu2.resource.Practitioner;
@ -75,6 +76,9 @@ import javax.persistence.EntityManager;
import java.util.ArrayList;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = {TestDstu2Config.class})
public abstract class BaseJpaDstu2Test extends BaseJpaTest {
@ -265,4 +269,16 @@ public abstract class BaseJpaDstu2Test extends BaseJpaTest {
}
return retVal;
}
public void assertHasErrors(OperationOutcome theOperationOutcome) {
assertTrue(hasValidationErrors(theOperationOutcome), "Expected validation errors, found none");
}
public void assertHasNoErrors(OperationOutcome theOperationOutcome) {
assertFalse(hasValidationErrors(theOperationOutcome), "Expected no validation errors, found some");
}
private static boolean hasValidationErrors(OperationOutcome theOperationOutcome) {
return theOperationOutcome.getIssue().stream().anyMatch(t -> "error".equals(t.getSeverity()));
}
}

View File

@ -32,6 +32,7 @@ import ca.uhn.fhir.model.dstu2.resource.Device;
import ca.uhn.fhir.model.dstu2.resource.DiagnosticReport;
import ca.uhn.fhir.model.dstu2.resource.Encounter;
import ca.uhn.fhir.model.dstu2.resource.Observation;
import ca.uhn.fhir.model.dstu2.resource.OperationOutcome;
import ca.uhn.fhir.model.dstu2.resource.Organization;
import ca.uhn.fhir.model.dstu2.resource.Patient;
import ca.uhn.fhir.model.dstu2.resource.Questionnaire;
@ -67,7 +68,6 @@ import ca.uhn.fhir.rest.param.StringParam;
import ca.uhn.fhir.rest.param.TokenOrListParam;
import ca.uhn.fhir.rest.param.TokenParam;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException;
import ca.uhn.fhir.rest.server.exceptions.ResourceGoneException;
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
import ca.uhn.fhir.rest.server.exceptions.ResourceVersionConflictException;
@ -2837,12 +2837,10 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test {
String rawResource = loadResource("/binu_testpatient_resource.json");
IBaseResource parsedResource = myFhirContext.newJsonParser().parseResource(rawResource);
try {
myPatientDao.validate((Patient) parsedResource, null, rawResource, EncodingEnum.JSON, ValidationModeEnum.UPDATE, null, mySrd);
fail();
} catch (PreconditionFailedException e) {
ourLog.debug(myFhirContext.newXmlParser().setPrettyPrint(true).encodeResourceToString(e.getOperationOutcome()));
}
MethodOutcome result = myPatientDao.validate((Patient) parsedResource, null, rawResource, EncodingEnum.JSON, ValidationModeEnum.UPDATE, null, mySrd);
OperationOutcome oo = (OperationOutcome) result.getOperationOutcome();
assertHasErrors(oo);
ourLog.debug(myFhirContext.newXmlParser().setPrettyPrint(true).encodeResourceToString(oo));
}
}

View File

@ -14,6 +14,7 @@ import ca.uhn.fhir.model.dstu2.resource.ValueSet;
import ca.uhn.fhir.model.dstu2.valueset.ObservationStatusEnum;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.rest.api.EncodingEnum;
import ca.uhn.fhir.rest.api.MethodOutcome;
import ca.uhn.fhir.rest.api.ValidationModeEnum;
import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException;
import ca.uhn.fhir.rest.server.exceptions.ResourceVersionConflictException;
@ -98,25 +99,19 @@ public class FhirResourceDaoDstu2ValidateTest extends BaseJpaDstu2Test {
String encoded;
ValidationModeEnum mode = ValidationModeEnum.CREATE;
switch (enc) {
case JSON:
encoded = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(input);
ourLog.info(encoded);
try {
myObservationDao.validate(input, null, encoded, EncodingEnum.JSON, mode, null, mySrd);
fail();
} catch (PreconditionFailedException e) {
return (OperationOutcome) e.getOperationOutcome();
}
break;
case XML:
encoded = myFhirContext.newXmlParser().encodeResourceToString(input);
try {
myObservationDao.validate(input, null, encoded, EncodingEnum.XML, mode, null, mySrd);
fail();
} catch (PreconditionFailedException e) {
return (OperationOutcome) e.getOperationOutcome();
}
break;
case JSON:
encoded = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(input);
ourLog.info(encoded);
MethodOutcome result = myObservationDao.validate(input, null, encoded, EncodingEnum.JSON, mode, null, mySrd);
OperationOutcome oo = (OperationOutcome) result.getOperationOutcome();
assertHasErrors(oo);
return oo;
case XML:
encoded = myFhirContext.newXmlParser().encodeResourceToString(input);
result = myObservationDao.validate(input, null, encoded, EncodingEnum.XML, mode, null, mySrd);
oo = (OperationOutcome) result.getOperationOutcome();
assertHasErrors(oo);
return oo;
}
throw new IllegalStateException(); // shouldn't get here
@ -138,15 +133,12 @@ public class FhirResourceDaoDstu2ValidateTest extends BaseJpaDstu2Test {
ValidationModeEnum mode = ValidationModeEnum.CREATE;
String encoded = myFhirContext.newJsonParser().encodeResourceToString(input);
ourLog.info(encoded);
try {
myObservationDao.validate(input, null, encoded, EncodingEnum.JSON, mode, null, mySrd);
fail();
} catch (PreconditionFailedException e) {
String ooString = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(e.getOperationOutcome());
ourLog.info(ooString);
assertThat(ooString, containsString("Profile reference 'http://example.com/StructureDefinition/testValidateResourceContainingProfileDeclarationInvalid' has not been checked because it is unknown"));
}
MethodOutcome result = myObservationDao.validate(input, null, encoded, EncodingEnum.JSON, mode, null, mySrd);
OperationOutcome oo = (OperationOutcome) result.getOperationOutcome();
assertHasErrors(oo);
String ooString = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(oo);
ourLog.info(ooString);
assertThat(ooString, containsString("Profile reference 'http://example.com/StructureDefinition/testValidateResourceContainingProfileDeclarationInvalid' has not been checked because it is unknown"));
}
@Test

View File

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

View File

@ -115,7 +115,7 @@ import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import static ca.uhn.fhir.test.utilities.CustomMatchersUtil.*;
import static ca.uhn.fhir.test.utilities.CustomMatchersUtil.assertDoesNotContainAnyOf;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsInAnyOrder;

View File

@ -103,14 +103,11 @@ public class FhirResourceDaoDstu3ValidateTest extends BaseJpaDstu3Test {
myFhirInstanceValidator.invalidateCaches();
ProxyUtil.getSingletonTarget(myPersistedResourceValidationSupport, JpaPersistedResourceValidationSupport.class).clearCaches();
try {
myQuestionnaireResponseDao.validate(qr, null, null, null, null, null, null);
fail();
} catch (PreconditionFailedException e) {
ourLog.debug(myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(e.getOperationOutcome()));
// good
}
MethodOutcome result = myQuestionnaireResponseDao.validate(qr, null, null, null, null, null, null);
OperationOutcome oo = (OperationOutcome) result.getOperationOutcome();
assertHasErrors(oo);
ourLog.debug(myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(oo));
// good
}
@ -125,7 +122,7 @@ public class FhirResourceDaoDstu3ValidateTest extends BaseJpaDstu3Test {
ValueSet expansion = myValueSetDao.expandByIdentifier("http://ccim.on.ca/fhir/iar/ValueSet/iar-citizenship-status", null);
ourLog.debug(myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(expansion));
assertThat(expansion.getExpansion().getContains().stream().map(t->t.getCode()).collect(Collectors.toList()), containsInAnyOrder(
assertThat(expansion.getExpansion().getContains().stream().map(t -> t.getCode()).collect(Collectors.toList()), containsInAnyOrder(
"CDN", "PR", "TR", "REF", "UNK", "ASKU"
));
}
@ -173,32 +170,21 @@ public class FhirResourceDaoDstu3ValidateTest extends BaseJpaDstu3Test {
.setValue(new Coding().setSystem("http://hl7.org/fhir/administrative-gender").setCode("aaa").setDisplay("AAAA"));
// Validate as resource
try {
MethodOutcome outcome = myQuestionnaireResponseDao.validate(qr, null, null, null, ValidationModeEnum.CREATE, null, mySrd);
OperationOutcome oo = (OperationOutcome) outcome.getOperationOutcome();
ourLog.debug(myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(oo));
fail();
} catch (PreconditionFailedException e) {
OperationOutcome oo = (OperationOutcome) e.getOperationOutcome();
String encoded = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(oo);
ourLog.info(encoded);
assertThat(encoded, containsString("is not in the options value set"));
}
MethodOutcome outcome = myQuestionnaireResponseDao.validate(qr, null, null, null, ValidationModeEnum.CREATE, null, mySrd);
OperationOutcome oo = (OperationOutcome) outcome.getOperationOutcome();
assertHasErrors(oo);
String encoded = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(oo);
ourLog.info(encoded);
assertThat(encoded, containsString("is not in the options value set"));
// Validate as string
try {
String raw = myFhirContext.newJsonParser().encodeResourceToString(qr);
MethodOutcome outcome = myQuestionnaireResponseDao.validate(qr, null, raw, EncodingEnum.JSON, ValidationModeEnum.CREATE, null, mySrd);
OperationOutcome oo = (OperationOutcome) outcome.getOperationOutcome();
ourLog.debug(myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(oo));
fail();
} catch (PreconditionFailedException e) {
OperationOutcome oo = (OperationOutcome) e.getOperationOutcome();
String encoded = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(oo);
ourLog.info(encoded);
assertThat(encoded, containsString("is not in the options value set"));
}
String raw = myFhirContext.newJsonParser().encodeResourceToString(qr);
outcome = myQuestionnaireResponseDao.validate(qr, null, raw, EncodingEnum.JSON, ValidationModeEnum.CREATE, null, mySrd);
oo = (OperationOutcome) outcome.getOperationOutcome();
assertHasErrors(oo);
encoded = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(oo);
ourLog.info(encoded);
assertThat(encoded, containsString("is not in the options value set"));
}
@ -337,17 +323,13 @@ public class FhirResourceDaoDstu3ValidateTest extends BaseJpaDstu3Test {
ValidationModeEnum mode = ValidationModeEnum.CREATE;
String encoded = myFhirContext.newJsonParser().encodeResourceToString(input);
try {
// Expected to throw exception
MethodOutcome output = myObservationDao.validate(input, null, encoded, EncodingEnum.JSON, mode, null, mySrd);
ourLog.debug(myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(output.getOperationOutcome()));
fail();
} catch (PreconditionFailedException e) {
OperationOutcome oo = (OperationOutcome) e.getOperationOutcome();
String outputString = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(oo);
ourLog.info(outputString);
assertThat(outputString, containsString("Profile reference 'http://example.com/StructureDefinition/testValidateResourceContainingProfileDeclarationInvalid' has not been checked because it is unknown"));
}
// Expected to throw exception
MethodOutcome result = myObservationDao.validate(input, null, encoded, EncodingEnum.JSON, mode, null, mySrd);
OperationOutcome oo = (OperationOutcome) result.getOperationOutcome();
assertHasErrors(oo);
String outputString = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(oo);
ourLog.info(outputString);
assertThat(outputString, containsString("Profile reference 'http://example.com/StructureDefinition/testValidateResourceContainingProfileDeclarationInvalid' has not been checked because it is unknown"));
}
@Test

View File

@ -2,8 +2,8 @@ package ca.uhn.fhir.jpa.packages;
import ca.uhn.fhir.jpa.test.BaseJpaDstu3Test;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.api.MethodOutcome;
import ca.uhn.fhir.rest.api.ValidationModeEnum;
import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException;
import ca.uhn.fhir.test.utilities.JettyUtil;
import ca.uhn.fhir.test.utilities.ProxyUtil;
import ca.uhn.fhir.util.ClasspathUtil;
@ -33,7 +33,6 @@ import java.util.Map;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
public class NpmDstu3Test extends BaseJpaDstu3Test {
@ -91,22 +90,18 @@ public class NpmDstu3Test extends BaseJpaDstu3Test {
CodeSystem cs = (CodeSystem) myNpmJpaValidationSupport.fetchCodeSystem("http://fhir.de/CodeSystem/deuev/anlage-8-laenderkennzeichen");
assertEquals("http://fhir.de/CodeSystem/deuev/anlage-8-laenderkennzeichen", cs.getUrl());
// Try and validate using a profile from the IG
Condition condition = new Condition();
condition.setClinicalStatus(Condition.ConditionClinicalStatus.RESOLVED);
condition.getMeta().addProfile("http://fhir.de/StructureDefinition/condition-de-basis/0.2");
try {
myConditionDao.validate(condition, null, null, null, ValidationModeEnum.CREATE, null, mySrd);
fail();
} catch (PreconditionFailedException e) {
ourLog.debug("Fail Outcome: {}", myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(e.getOperationOutcome()));
MethodOutcome result = myConditionDao.validate(condition, null, null, null, ValidationModeEnum.CREATE, null, mySrd);
OperationOutcome oo = (OperationOutcome) result.getOperationOutcome();
assertHasErrors(oo);
ourLog.debug("Fail Outcome: {}", myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(oo));
OperationOutcome oo = (OperationOutcome) e.getOperationOutcome();
assertThat(oo.getIssueFirstRep().getDiagnostics(),
containsString("Condition.subject: minimum required = 1, but only found 0 (from http://fhir.de/StructureDefinition/condition-de-basis/0.2"));
}
assertThat(oo.getIssueFirstRep().getDiagnostics(),
containsString("Condition.subject: minimum required = 1, but only found 0 (from http://fhir.de/StructureDefinition/condition-de-basis/0.2"));
}

View File

@ -4693,7 +4693,7 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test {
try (CloseableHttpResponse response = ourHttpClient.execute(get)) {
String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
ourLog.info(resp);
assertEquals(412, response.getStatusLine().getStatusCode());
assertEquals(200, response.getStatusLine().getStatusCode());
assertThat(resp, containsString("SHALL at least contain a contact's details or a reference to an organization"));
}
}

View File

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

View File

@ -3,7 +3,6 @@ package ca.uhn.fhir.jpa.dao;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.interceptor.executor.InterceptorService;
import ca.uhn.fhir.jpa.api.IDaoRegistry;
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.api.config.ThreadPoolFactoryConfig;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
@ -27,10 +26,7 @@ import org.hl7.fhir.r4.model.Meta;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.mockito.Answers;
import org.mockito.Spy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -41,18 +37,13 @@ import org.springframework.context.annotation.Import;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.TransactionCallback;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@ExtendWith(SpringExtension.class)

View File

@ -14,7 +14,6 @@ import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
import ca.uhn.fhir.util.HapiExtensions;
import com.helger.commons.lang.StackTraceHelper;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.r4.model.BooleanType;

View File

@ -3,11 +3,11 @@ package ca.uhn.fhir.jpa.dao.r4;
import ca.uhn.fhir.interceptor.executor.InterceptorService;
import ca.uhn.fhir.jpa.interceptor.TransactionConcurrencySemaphoreInterceptor;
import ca.uhn.fhir.jpa.interceptor.UserRequestRetryVersionConflictsInterceptor;
import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.jpa.test.BaseJpaR4Test;
import ca.uhn.fhir.rest.api.PatchTypeEnum;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
import ca.uhn.fhir.rest.param.TokenParam;
import ca.uhn.fhir.rest.server.RestfulServer;
import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException;

View File

@ -3,7 +3,6 @@ package ca.uhn.fhir.jpa.dao.r4;
import ca.uhn.fhir.context.support.ValidationSupportContext;
import ca.uhn.fhir.context.support.ValueSetExpansionOptions;
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome;
import ca.uhn.fhir.jpa.api.model.HistoryCountModeEnum;
import ca.uhn.fhir.jpa.entity.TermValueSet;
import ca.uhn.fhir.jpa.entity.TermValueSetPreExpansionStatusEnum;
@ -26,7 +25,6 @@ import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException;
import ca.uhn.fhir.rest.server.interceptor.auth.AuthorizationInterceptor;
import ca.uhn.fhir.rest.server.interceptor.auth.PolicyEnum;
import ca.uhn.fhir.util.BundleBuilder;
import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.r4.model.Bundle;

View File

@ -7,7 +7,6 @@ import ca.uhn.fhir.jpa.dao.data.ISearchResultDao;
import ca.uhn.fhir.jpa.entity.Search;
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
import ca.uhn.fhir.jpa.model.search.SearchStatusEnum;
import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
import ca.uhn.fhir.jpa.search.PersistedJpaBundleProvider;
import ca.uhn.fhir.jpa.search.SearchCoordinatorSvcImpl;
import ca.uhn.fhir.jpa.searchparam.MatchUrlService;
@ -18,6 +17,7 @@ import ca.uhn.fhir.rest.api.SearchTotalModeEnum;
import ca.uhn.fhir.rest.api.SortSpec;
import ca.uhn.fhir.rest.api.SummaryEnum;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
import ca.uhn.fhir.rest.param.DateRangeParam;
import ca.uhn.fhir.rest.param.ReferenceOrListParam;
import ca.uhn.fhir.rest.param.ReferenceParam;

View File

@ -38,7 +38,6 @@ import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.hasItems;
import static org.hamcrest.Matchers.not;
import static org.junit.jupiter.api.Assertions.fail;
@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = {

View File

@ -523,18 +523,12 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test {
}
// Use a code that's not in the ValueSet
try {
outcome = (OperationOutcome) myObservationDao.validate(loadResourceFromClasspath(Observation.class, "/r4/bl/bb-obs-code-not-in-valueset.json"), null, null, null, null, null, mySrd).getOperationOutcome();
String outcomeStr = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome);
ourLog.info("Validation outcome: {}", outcomeStr);
fail();
} catch (PreconditionFailedException e) {
outcome = (OperationOutcome) e.getOperationOutcome();
String outcomeStr = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome);
ourLog.info("Validation outcome: {}", outcomeStr);
assertThat(outcomeStr,
containsString("The code provided (http://unitsofmeasure.org#cm) is not in the value set"));
}
outcome = (OperationOutcome) myObservationDao.validate(loadResourceFromClasspath(Observation.class, "/r4/bl/bb-obs-code-not-in-valueset.json"), null, null, null, null, null, mySrd).getOperationOutcome();
assertHasErrors(outcome);
String outcomeStr = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome);
ourLog.info("Validation outcome: {}", outcomeStr);
assertThat(outcomeStr,
containsString("The code provided (http://unitsofmeasure.org#cm) is not in the value set"));
// Before, the VS wasn't pre-expanded. Try again with it pre-expanded
runInTransaction(() -> {
@ -552,24 +546,18 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test {
// Use a code that's in the ValueSet
{
outcome = (OperationOutcome) myObservationDao.validate(loadResourceFromClasspath(Observation.class, "/r4/bl/bb-obs-code-in-valueset.json"), null, null, null, null, null, mySrd).getOperationOutcome();
String outcomeStr = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome);
outcomeStr = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome);
ourLog.info("Validation outcome: {}", outcomeStr);
assertThat(outcomeStr, not(containsString("\"error\"")));
}
// Use a code that's not in the ValueSet
try {
outcome = (OperationOutcome) myObservationDao.validate(loadResourceFromClasspath(Observation.class, "/r4/bl/bb-obs-code-not-in-valueset.json"), null, null, null, null, null, mySrd).getOperationOutcome();
String outcomeStr = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome);
ourLog.info("Validation outcome: {}", outcomeStr);
fail();
} catch (PreconditionFailedException e) {
outcome = (OperationOutcome) e.getOperationOutcome();
String outcomeStr = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome);
ourLog.info("Validation outcome: {}", outcomeStr);
assertThat(outcomeStr,
containsString("The code provided (http://unitsofmeasure.org#cm) is not in the value set"));
}
outcome = (OperationOutcome) myObservationDao.validate(loadResourceFromClasspath(Observation.class, "/r4/bl/bb-obs-code-not-in-valueset.json"), null, null, null, null, null, mySrd).getOperationOutcome();
assertHasErrors(outcome);
outcomeStr = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome);
ourLog.info("Validation outcome: {}", outcomeStr);
assertThat(outcomeStr,
containsString("The code provided (http://unitsofmeasure.org#cm) is not in the value set"));
}
@ -587,34 +575,22 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test {
OperationOutcome outcome;
// Use the wrong datatype
try {
myFhirContext.setParserErrorHandler(new LenientErrorHandler());
Observation resource = loadResourceFromClasspath(Observation.class, "/r4/bl/bb-obs-value-is-not-quantity2.json");
outcome = (OperationOutcome) myObservationDao.validate(resource, null, null, null, null, null, mySrd).getOperationOutcome();
String outcomeStr = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome);
ourLog.info("Validation outcome: {}", outcomeStr);
fail();
} catch (PreconditionFailedException e) {
outcome = (OperationOutcome) e.getOperationOutcome();
String outcomeStr = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome);
ourLog.info("Validation outcome: {}", outcomeStr);
assertThat(outcomeStr, containsString("\"error\""));
}
myFhirContext.setParserErrorHandler(new LenientErrorHandler());
Observation resource = loadResourceFromClasspath(Observation.class, "/r4/bl/bb-obs-value-is-not-quantity2.json");
outcome = (OperationOutcome) myObservationDao.validate(resource, null, null, null, null, null, mySrd).getOperationOutcome();
assertHasErrors(outcome);
String outcomeStr = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome);
ourLog.info("Validation outcome: {}", outcomeStr);
assertThat(outcomeStr, containsString("\"error\""));
// Use the wrong datatype
try {
myFhirContext.setParserErrorHandler(new LenientErrorHandler());
Observation resource = loadResourceFromClasspath(Observation.class, "/r4/bl/bb-obs-value-is-not-quantity.json");
outcome = (OperationOutcome) myObservationDao.validate(resource, null, null, null, null, null, mySrd).getOperationOutcome();
String outcomeStr = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome);
ourLog.info("Validation outcome: {}", outcomeStr);
fail();
} catch (PreconditionFailedException e) {
outcome = (OperationOutcome) e.getOperationOutcome();
String outcomeStr = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome);
ourLog.info("Validation outcome: {}", outcomeStr);
assertThat(outcomeStr, containsString("The Profile 'https://bb/StructureDefinition/BBDemographicAge' definition allows for the type Quantity but found type string"));
}
myFhirContext.setParserErrorHandler(new LenientErrorHandler());
resource = loadResourceFromClasspath(Observation.class, "/r4/bl/bb-obs-value-is-not-quantity.json");
outcome = (OperationOutcome) myObservationDao.validate(resource, null, null, null, null, null, mySrd).getOperationOutcome();
assertHasErrors(outcome);
outcomeStr = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome);
ourLog.info("Validation outcome: {}", outcomeStr);
assertThat(outcomeStr, containsString("The Profile 'https://bb/StructureDefinition/BBDemographicAge' definition allows for the type Quantity but found type string"));
}
/**
@ -1048,19 +1024,12 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test {
obs.getCode().getCodingFirstRep().setSystem("http://example.com/foo-foo");
obs.getCode().getCodingFirstRep().setCode("some-code");
obs.getCode().getCodingFirstRep().setDisplay("Some Code");
try {
outcome = (OperationOutcome) myObservationDao.validate(obs, null, null, null, ValidationModeEnum.CREATE, "http://example.com/structuredefinition", mySrd).getOperationOutcome();
ourLog.debug("Outcome: {}", myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome));
assertEquals("", outcome.getIssueFirstRep().getDiagnostics());
assertEquals(OperationOutcome.IssueSeverity.INFORMATION, outcome.getIssueFirstRep().getSeverity());
fail();
} catch (PreconditionFailedException e) {
outcome = (OperationOutcome) e.getOperationOutcome();
ourLog.debug("Outcome: {}", myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome));
assertThat(outcome.getIssueFirstRep().getDiagnostics(),
containsString("None of the codings provided are in the value set 'MessageCategory'"));
assertEquals(OperationOutcome.IssueSeverity.ERROR, outcome.getIssueFirstRep().getSeverity());
}
outcome = (OperationOutcome) myObservationDao.validate(obs, null, null, null, ValidationModeEnum.CREATE, "http://example.com/structuredefinition", mySrd).getOperationOutcome();
assertHasErrors(outcome);
ourLog.debug("Outcome: {}", myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome));
assertThat(outcome.getIssueFirstRep().getDiagnostics(),
containsString("None of the codings provided are in the value set 'MessageCategory'"));
assertEquals(OperationOutcome.IssueSeverity.ERROR, outcome.getIssueFirstRep().getSeverity());
}
@Test
@ -1303,14 +1272,14 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test {
private <T extends IBaseResource> OperationOutcome validateAndReturnOutcome(T theObs, Boolean theWantError) {
IFhirResourceDao<T> dao = (IFhirResourceDao<T>) myDaoRegistry.getResourceDao(theObs.getClass());
try {
MethodOutcome outcome = dao.validate(theObs, null, null, null, ValidationModeEnum.CREATE, null, mySrd);
assertTrue(theWantError == null || !theWantError, "Wanted an error response but got a non-error");
return (OperationOutcome) outcome.getOperationOutcome();
} catch (PreconditionFailedException e) {
assertTrue(theWantError == null || theWantError, "Wanted a non-error response but got an error");
return (OperationOutcome) e.getOperationOutcome();
MethodOutcome outcome = dao.validate(theObs, null, null, null, ValidationModeEnum.CREATE, null, mySrd);
OperationOutcome oo = (OperationOutcome) outcome.getOperationOutcome();
if (theWantError) {
assertHasErrors(oo);
} else {
assertHasNoErrors(oo);
}
return oo;
}
@Test
@ -1343,18 +1312,12 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test {
String input = IOUtils.toString(getClass().getResourceAsStream("/r4/document-bundle.json"), StandardCharsets.UTF_8);
Bundle document = myFhirContext.newJsonParser().parseResource(Bundle.class, input);
ourLog.info("Starting validation");
try {
MethodOutcome outcome = myBundleDao.validate(document, null, null, null, ValidationModeEnum.CREATE, null, mySrd);
String encodedResponse = myFhirContext.newJsonParser().encodeResourceToString(outcome.getOperationOutcome());
ourLog.info("Validation result: {}", encodedResponse);
fail();
} catch (PreconditionFailedException e) {
ourLog.debug(myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(e.getOperationOutcome()));
}
ourLog.info("Done validation");
MethodOutcome outcome = myBundleDao.validate(document, null, null, null, ValidationModeEnum.CREATE, null, mySrd);
OperationOutcome oo = (OperationOutcome) outcome.getOperationOutcome();
assertHasErrors(oo);
String encodedResponse = myFhirContext.newJsonParser().encodeResourceToString(oo);
ourLog.info("Validation result: {}", encodedResponse);
}
@Test
@ -1486,15 +1449,12 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test {
ValidationModeEnum mode = ValidationModeEnum.CREATE;
String encoded = myFhirContext.newJsonParser().encodeResourceToString(input);
try {
myObservationDao.validate(input, null, encoded, EncodingEnum.JSON, mode, null, mySrd);
fail();
} catch (PreconditionFailedException e) {
org.hl7.fhir.r4.model.OperationOutcome oo = (org.hl7.fhir.r4.model.OperationOutcome) e.getOperationOutcome();
String outputString = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(oo);
ourLog.info(outputString);
assertThat(outputString, containsString("Profile reference 'http://example.com/StructureDefinition/testValidateResourceContainingProfileDeclarationInvalid' has not been checked because it is unknown"));
}
MethodOutcome result = myObservationDao.validate(input, null, encoded, EncodingEnum.JSON, mode, null, mySrd);
OperationOutcome oo = (OperationOutcome) result.getOperationOutcome();
assertHasErrors(oo);
String outputString = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(oo);
ourLog.info(outputString);
assertThat(outputString, containsString("Profile reference 'http://example.com/StructureDefinition/testValidateResourceContainingProfileDeclarationInvalid' has not been checked because it is unknown"));
}
@Test
@ -1522,15 +1482,12 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test {
String encoded = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(input);
ourLog.info(encoded);
try {
myBundleDao.validate(input, null, encoded, EncodingEnum.JSON, mode, null, mySrd);
fail();
} catch (PreconditionFailedException e) {
org.hl7.fhir.r4.model.OperationOutcome oo = (org.hl7.fhir.r4.model.OperationOutcome) e.getOperationOutcome();
String outputString = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(oo);
ourLog.info(outputString);
assertThat(outputString, containsString("Profile reference 'http://example.com/StructureDefinition/testValidateResourceContainingProfileDeclarationInvalid' has not been checked because it is unknown"));
}
MethodOutcome methodOutcome = myBundleDao.validate(input, null, encoded, EncodingEnum.JSON, mode, null, mySrd);
org.hl7.fhir.r4.model.OperationOutcome oo = (org.hl7.fhir.r4.model.OperationOutcome) methodOutcome.getOperationOutcome();
assertHasErrors(oo);
String outputString = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(oo);
ourLog.info(outputString);
assertThat(outputString, containsString("Profile reference 'http://example.com/StructureDefinition/testValidateResourceContainingProfileDeclarationInvalid' has not been checked because it is unknown"));
}
@Test
@ -1565,17 +1522,12 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test {
.setLinkId("LINKID")
.addAnswer()
.setValue(new Coding().setSystem("http://hl7.org/fhir/administrative-gender").setCode("aaa"));
try {
MethodOutcome outcome = myQuestionnaireResponseDao.validate(qr, null, null, null, ValidationModeEnum.CREATE, null, mySrd);
OperationOutcome oo = (OperationOutcome) outcome.getOperationOutcome();
ourLog.debug(myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(oo));
fail();
} catch (PreconditionFailedException e) {
OperationOutcome oo = (OperationOutcome) e.getOperationOutcome();
String encoded = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(oo);
ourLog.info(encoded);
assertThat(encoded, containsString("is not in the options value set"));
}
MethodOutcome outcome = myQuestionnaireResponseDao.validate(qr, null, null, null, ValidationModeEnum.CREATE, null, mySrd);
OperationOutcome oo = (OperationOutcome) outcome.getOperationOutcome();
assertHasErrors(oo);
String encoded = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(oo);
ourLog.info(encoded);
assertThat(encoded, containsString("is not in the options value set"));
}
@Test
@ -1598,17 +1550,12 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test {
patient.setType("Patient");
patient.addSearchParam().setName("foo").setType(Enumerations.SearchParamType.DATE).setDefinition("http://example.com/name");
try {
myCapabilityStatementDao.validate(cs, null, null, null, ValidationModeEnum.CREATE, null, mySrd);
fail();
} catch (PreconditionFailedException e) {
String oo = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(e.getOperationOutcome());
ourLog.info(oo);
assertThat(oo, oo, containsString("Type mismatch - SearchParameter 'http://example.com/name' type is string, but type here is date"));
}
MethodOutcome result = myCapabilityStatementDao.validate(cs, null, null, null, ValidationModeEnum.CREATE, null, mySrd);
OperationOutcome oo = (OperationOutcome) result.getOperationOutcome();
assertHasErrors(oo);
String ooString = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(oo);
ourLog.info(ooString);
assertThat(ooString, ooString, containsString("Type mismatch - SearchParameter 'http://example.com/name' type is string, but type here is date"));
}
@ -1802,34 +1749,29 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test {
{
String resource = loadResource("/r4/uscore/patient-resource-badcode.json");
IBaseResource parsedResource = myFhirContext.newJsonParser().parseResource(resource);
try {
myPatientDao.validate((Patient) parsedResource, null, resource, null, null, null, mySrd);
fail();
} catch (PreconditionFailedException e) {
OperationOutcome oo = (OperationOutcome) e.getOperationOutcome();
String encoded = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(oo);
ourLog.info("Outcome:\n{}", encoded);
assertThat(encoded, containsString("Unable to validate code urn:oid:2.16.840.1.113883.6.238#2106-3AAA"));
}
MethodOutcome result = myPatientDao.validate((Patient) parsedResource, null, resource, null, null, null, mySrd);
OperationOutcome oo = (OperationOutcome) result.getOperationOutcome();
assertHasErrors(oo);
String encoded = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(oo);
ourLog.info("Outcome:\n{}", encoded);
assertThat(encoded, containsString("Unable to validate code urn:oid:2.16.840.1.113883.6.238#2106-3AAA"));
}
{
String resource = loadResource("/r4/uscore/patient-resource-good.json");
IBaseResource parsedResource = myFhirContext.newJsonParser().parseResource(resource);
try {
MethodOutcome outcome = myPatientDao.validate((Patient) parsedResource, null, resource, null, null, null, mySrd);
OperationOutcome oo = (OperationOutcome) outcome.getOperationOutcome();
String encoded = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(oo);
ourLog.info("Outcome:\n{}", encoded);
assertThat(encoded, containsString("No issues detected"));
} catch (PreconditionFailedException e) {
fail(myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(e.getOperationOutcome()));
}
MethodOutcome outcome = myPatientDao.validate((Patient) parsedResource, null, resource, null, null, null, mySrd);
OperationOutcome oo = (OperationOutcome) outcome.getOperationOutcome();
assertHasNoErrors(oo);
String encoded = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(oo);
ourLog.info("Outcome:\n{}", encoded);
assertThat(encoded, containsString("No issues detected"));
}
{
String resource = loadResource("/r4/uscore/observation-resource-good.json");
IBaseResource parsedResource = myFhirContext.newJsonParser().parseResource(resource);
MethodOutcome outcome = myObservationDao.validate((Observation) parsedResource, null, resource, null, null, null, mySrd);
OperationOutcome oo = (OperationOutcome) outcome.getOperationOutcome();
assertHasNoErrors(oo);
String encoded = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(oo);
ourLog.info("Outcome:\n{}", encoded);
assertThat(encoded, not(containsString("error")));
@ -1852,17 +1794,12 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test {
qa.getQuestionnaireElement().setValue("http://foo/q");
qa.addItem().setLinkId("link1").addAnswer().setValue(new StringType("FOO"));
try {
MethodOutcome validationOutcome = myQuestionnaireResponseDao.validate(qa, null, null, null, null, null, null);
OperationOutcome oo = (OperationOutcome) validationOutcome.getOperationOutcome();
String encode = encode(oo);
ourLog.info(encode);
fail("Didn't fail- response was " + encode);
} catch (PreconditionFailedException e) {
OperationOutcome oo = (OperationOutcome) e.getOperationOutcome();
assertEquals("No response answer found for required item 'link0'", oo.getIssueFirstRep().getDiagnostics());
}
MethodOutcome validationOutcome = myQuestionnaireResponseDao.validate(qa, null, null, null, null, null, null);
OperationOutcome oo = (OperationOutcome) validationOutcome.getOperationOutcome();
assertHasErrors(oo);
String encode = encode(oo);
ourLog.info(encode);
assertEquals("No response answer found for required item 'link0'", oo.getIssueFirstRep().getDiagnostics());
}
@Test
@ -1881,17 +1818,12 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test {
qa.getQuestionnaireElement().setValue("http://foo/q");
qa.addItem().setLinkId("link1").addAnswer().setValue(new StringType("FOO"));
try {
MethodOutcome validationOutcome = myQuestionnaireResponseDao.validate(qa, null, null, null, null, null, null);
OperationOutcome oo = (OperationOutcome) validationOutcome.getOperationOutcome();
String encode = encode(oo);
ourLog.info(encode);
fail("Didn't fail- response was " + encode);
} catch (PreconditionFailedException e) {
OperationOutcome oo = (OperationOutcome) e.getOperationOutcome();
assertEquals("No response answer found for required item 'link0'", oo.getIssueFirstRep().getDiagnostics());
}
MethodOutcome validationOutcome = myQuestionnaireResponseDao.validate(qa, null, null, null, null, null, null);
OperationOutcome oo = (OperationOutcome) validationOutcome.getOperationOutcome();
assertHasErrors(oo);
String encode = encode(oo);
ourLog.info(encode);
assertEquals("No response answer found for required item 'link0'", oo.getIssueFirstRep().getDiagnostics());
}
@Test
@ -1924,18 +1856,14 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test {
public void testValidateCodeInUnknownCodeSystemWithRequiredBinding() throws IOException {
Condition condition = loadResourceFromClasspath(Condition.class, "/r4/code-in-unknown-system-with-required-binding.xml");
try {
myConditionDao.validate(condition, null, null, null, null, null, null);
fail();
} catch (PreconditionFailedException e) {
OperationOutcome oo = (OperationOutcome) e.getOperationOutcome();
ourLog.debug(myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(oo));
assertThat(oo.getIssueFirstRep().getDiagnostics(),
containsString("None of the codings provided are in the value set 'Condition Clinical Status Codes' (http://hl7.org/fhir/ValueSet/condition-clinical|4.0.1), and a coding from this value set is required) (codes = http://terminology.hl7.org/CodeSystem/condition-clinical/wrong-system#notrealcode)"));
}
MethodOutcome result = myConditionDao.validate(condition, null, null, null, null, null, null);
OperationOutcome oo = (OperationOutcome) result.getOperationOutcome();
assertHasErrors(oo);
ourLog.debug(myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(oo));
assertThat(oo.getIssueFirstRep().getDiagnostics(),
containsString("None of the codings provided are in the value set 'Condition Clinical Status Codes' (http://hl7.org/fhir/ValueSet/condition-clinical|4.0.1), and a coding from this value set is required) (codes = http://terminology.hl7.org/CodeSystem/condition-clinical/wrong-system#notrealcode)"));
}
private IBaseResource findResourceByIdInBundle(Bundle vss, String name) {
IBaseResource retVal = null;
for (BundleEntryComponent next : vss.getEntry()) {

View File

@ -39,9 +39,7 @@ import ca.uhn.fhir.util.BundleBuilder;
import ca.uhn.fhir.util.ClasspathUtil;
import org.apache.commons.io.IOUtils;
import org.hamcrest.Matchers;
import org.hibernate.envers.query.AuditEntity;
import org.hl7.fhir.instance.model.api.IAnyResource;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.r4.model.AllergyIntolerance;
import org.hl7.fhir.r4.model.Appointment;
@ -74,7 +72,6 @@ import org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity;
import org.hl7.fhir.r4.model.Organization;
import org.hl7.fhir.r4.model.Patient;
import org.hl7.fhir.r4.model.Practitioner;
import org.hl7.fhir.r4.model.Provenance;
import org.hl7.fhir.r4.model.Quantity;
import org.hl7.fhir.r4.model.Reference;
import org.hl7.fhir.r4.model.Resource;

View File

@ -21,11 +21,11 @@ import ca.uhn.fhir.jpa.model.entity.ResourceTable;
import ca.uhn.fhir.jpa.model.entity.ResourceTag;
import ca.uhn.fhir.jpa.model.entity.SearchParamPresentEntity;
import ca.uhn.fhir.jpa.model.util.JpaConstants;
import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.jpa.util.SqlQuery;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
import ca.uhn.fhir.rest.param.DateAndListParam;
import ca.uhn.fhir.rest.param.DateOrListParam;
import ca.uhn.fhir.rest.param.DateParam;

View File

@ -4,11 +4,11 @@ import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao;
import ca.uhn.fhir.jpa.model.entity.ResourceEncodingEnum;
import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
import ca.uhn.fhir.jpa.search.reindex.BlockPolicy;
import ca.uhn.fhir.jpa.test.BaseJpaTest;
import ca.uhn.fhir.jpa.test.config.TestHSearchAddInConfig;
import ca.uhn.fhir.jpa.test.config.TestR4Config;
import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.system.HapiTestSystemProperties;
import ca.uhn.fhir.util.StopWatch;
@ -68,7 +68,7 @@ public class SyntheaPerfTest extends BaseJpaTest {
myFhirContext.getParserOptions().setAutoContainReferenceTargetsWithNoId(true);
}
@Disabled
@Disabled("Stress test")
@Test
public void testLoadSynthea() throws Exception {
assertEquals(100, TestR4Config.getMaxThreads());

View File

@ -54,12 +54,8 @@ public class ValidationMessageSuppressingInterceptorTest extends BaseResourcePro
String input = loadResource("/r4/uscore/observation-pulseox.json");
Observation inputObs = loadResource(myFhirContext, Observation.class, "/r4/uscore/observation-pulseox.json");
try {
myObservationDao.validate(inputObs, null, input, null, null, null, null);
fail();
} catch (PreconditionFailedException e) {
// good
}
MethodOutcome result = myObservationDao.validate(inputObs, null, input, null, null, null, null);
ValidationMessageSuppressingInterceptor interceptor = new ValidationMessageSuppressingInterceptor();
interceptor.addMessageSuppressionPatterns("Unknown code 'http://loinc.org#59408-5'");
@ -67,6 +63,7 @@ public class ValidationMessageSuppressingInterceptorTest extends BaseResourcePro
MethodOutcome validationOutcome = myObservationDao.validate(inputObs, null, input, null, null, null, null);
OperationOutcome oo = (OperationOutcome) validationOutcome.getOperationOutcome();
assertHasWarnings(oo);
String encode = encode(oo);
ourLog.info(encode);
assertThat(encode, containsString("All observations should have a performer"));

View File

@ -15,9 +15,9 @@ import ca.uhn.fhir.jpa.model.config.PartitionSettings;
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
import ca.uhn.fhir.jpa.model.util.JpaConstants;
import ca.uhn.fhir.jpa.partition.RequestPartitionHelperSvc;
import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
import ca.uhn.fhir.rest.api.server.bulk.BulkDataExportOptions;
import ca.uhn.fhir.rest.server.RestfulServer;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;

View File

@ -30,7 +30,6 @@ import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
@ -623,7 +622,7 @@ public class ResourceProviderHasParamR4Test extends BaseResourceProviderR4Test {
assertNotEquals(0, notInListQueries.size());
}
private List<String> searchAndReturnUnqualifiedVersionlessIdValues(String uri) throws IOException {
public List<String> searchAndReturnUnqualifiedVersionlessIdValues(String uri) throws IOException {
List<String> ids;
HttpGet get = new HttpGet(uri);

View File

@ -988,7 +988,7 @@ public class ResourceProviderR4SearchContainedTest extends BaseResourceProviderR
}
private List<String> searchAndReturnUnqualifiedVersionlessIdValues(String uri) throws IOException {
public List<String> searchAndReturnUnqualifiedVersionlessIdValues(String uri) throws IOException {
List<String> ids;
HttpGet get = new HttpGet(uri);

View File

@ -288,7 +288,7 @@ public class ResourceProviderSearchModifierR4Test extends BaseResourceProviderR4
}
private List<String> searchAndReturnUnqualifiedVersionlessIdValues(String uri) throws IOException {
public List<String> searchAndReturnUnqualifiedVersionlessIdValues(String uri) throws IOException {
List<String> ids;
HttpGet get = new HttpGet(uri);

View File

@ -666,19 +666,6 @@ public class SystemProviderR4Test extends BaseJpaR4Test {
assertEquals(id1_4.toVersionless(), id2_4.toVersionless());
}
/**
* This is Gramahe's test transaction - it requires some set up in order to work
*/
@Test
@Disabled
public void testTransactionFromBundle3() throws Exception {
InputStream bundleRes = SystemProviderR4Test.class.getResourceAsStream("/grahame-transaction.xml");
String bundle = IOUtils.toString(bundleRes, StandardCharsets.UTF_8);
String response = myClient.transaction().withBundle(bundle).prettyPrint().execute();
ourLog.info(response);
}
@Test
public void testTransactionFromBundle4() throws Exception {
InputStream bundleRes = SystemProviderR4Test.class.getResourceAsStream("/simone_bundle.xml");
@ -850,7 +837,7 @@ public class SystemProviderR4Test extends BaseJpaR4Test {
* FOrmat has changed, source is no longer valid
*/
@Test
@Disabled
@Disabled("input file needs to be upgraded to R4 format")
public void testValidateUsingIncomingResources() throws Exception {
FhirInstanceValidator val = new FhirInstanceValidator(myValidationSupport);
RequestValidatingInterceptor interceptor = new RequestValidatingInterceptor();

View File

@ -11,6 +11,7 @@ import org.slf4j.LoggerFactory;
import java.io.IOException;
@Disabled("Stress Test")
public class StressTestParserTest extends BaseTest {
private static final Logger ourLog = LoggerFactory.getLogger(StressTestParserTest.class);
@ -20,7 +21,6 @@ public class StressTestParserTest extends BaseTest {
* @throws IOException
*/
@Test
@Disabled
public void test() throws IOException {
FhirContext ctx = FhirContext.forR4Cached();
String input = loadResource("/org/hl7/fhir/r4/model/valueset/valuesets.xml");

View File

@ -121,7 +121,7 @@ public class StressTestR4Test extends BaseResourceProviderR4Test {
myPagingProvider.setMaximumPageSize(300);
}
@Disabled
@Disabled("Stress test")
@Test
public void testNoDuplicatesInSearchResults() throws Exception {
int resourceCount = 1000;
@ -198,7 +198,7 @@ public class StressTestR4Test extends BaseResourceProviderR4Test {
assertEquals(resourceCount, ids.size());
}
@Disabled
@Disabled("Stress test")
@Test
public void testPageThroughLotsOfPages() {
myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED);
@ -270,7 +270,7 @@ public class StressTestR4Test extends BaseResourceProviderR4Test {
assertEquals(count - 1000, Sets.newHashSet(ids).size());
}
@Disabled
@Disabled("Stress test")
@Test
public void testPageThroughLotsOfPages2() {
myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED);
@ -306,7 +306,7 @@ public class StressTestR4Test extends BaseResourceProviderR4Test {
}
@Disabled
@Disabled("Stress test")
@Test
public void testSearchWithLargeNumberOfIncludes() {
@ -355,7 +355,7 @@ public class StressTestR4Test extends BaseResourceProviderR4Test {
assertEquals(1001, resultsAndIncludes.size());
}
@Disabled
@Disabled("Stress test")
@Test
public void testUpdateListWithLargeNumberOfEntries() {
int numPatients = 3000;
@ -395,7 +395,7 @@ public class StressTestR4Test extends BaseResourceProviderR4Test {
}
}
@Disabled
@Disabled("Stress test")
@Test
public void testMultithreadedSearch() throws Exception {
Bundle input = new Bundle();
@ -532,7 +532,7 @@ public class StressTestR4Test extends BaseResourceProviderR4Test {
* JpaValidationSupportDstuXX be transactional, which it should have been
* anyhow.
*/
@Disabled
@Disabled("Stress test")
@Test
public void testMultithreadedSearchWithValidation() throws Exception {
myServer.registerInterceptor(myRequestValidatingInterceptor);
@ -571,7 +571,7 @@ public class StressTestR4Test extends BaseResourceProviderR4Test {
validateNoErrors(tasks);
}
@Disabled
@Disabled("Stress test")
@Test
public void test_DeleteExpunge_withLargeBatchSizeManyResources() {
// setup
@ -613,7 +613,7 @@ public class StressTestR4Test extends BaseResourceProviderR4Test {
assertThat(deleteCount, is(equalTo(59)));
}
@Disabled
@Disabled("Stress test")
@Test
public void testDeleteExpungeOperationOverLargeDataset() {
myStorageSettings.setAllowMultipleDelete(true);

View File

@ -45,7 +45,7 @@ import java.util.List;
/**
* Ignored because this feature isn't implemented yet
*/
@Disabled
@Disabled("Not implemented yet")
public class RestHookWithEventDefinitionR4Test extends BaseResourceProviderR4Test {
private static final Logger ourLog = org.slf4j.LoggerFactory.getLogger(RestHookWithEventDefinitionR4Test.class);

View File

@ -47,7 +47,7 @@ public class TerminologyLoaderSvcImgthlaTest extends BaseLoaderTest {
}
@Test
@Disabled
@Disabled("Throws exception: HLA nomenclature terminology upload not yet fully implemented.")
public void testLoadImgthlaMandatoryFilesOnly() throws IOException {
addImgthlaMandatoryFilesToZip(myFiles);

View File

@ -123,7 +123,7 @@ public class TerminologyLoaderSvcSnomedCtTest extends BaseLoaderTest {
* This is just for trying stuff, it won't run without
* local files external to the git repo
*/
@Disabled
@Disabled("for manual testing")
@Test
public void testLoadSnomedCtAgainstRealFile() throws Exception {
byte[] bytes = IOUtils.toByteArray(new FileInputStream("/Users/james/Downloads/SnomedCT_Release_INT_20160131_Full.zip"));

View File

@ -20,7 +20,6 @@ import org.hl7.fhir.r4.model.Parameters;
import org.hl7.fhir.r4.model.StringType;
import org.hl7.fhir.r4.model.ValueSet;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -451,7 +450,6 @@ public class TerminologySvcDeltaR4Test extends BaseJpaR4Test {
}
@Test
@Disabled
public void testAddWithPropertiesAndDesignations() {
// Create not-present
@ -460,10 +458,8 @@ public class TerminologySvcDeltaR4Test extends BaseJpaR4Test {
cs.setUrl("http://foo/cs");
cs.setContent(CodeSystem.CodeSystemContentMode.NOTPRESENT);
cs.setVersion("1.2.3");
myCodeSystemDao.create(cs);
CodeSystem delta = new CodeSystem();
CodeSystem.ConceptDefinitionComponent concept = delta
CodeSystem.ConceptDefinitionComponent concept = cs
.addConcept()
.setCode("lunch")
.setDisplay("I'm having dog food");
@ -483,6 +479,7 @@ public class TerminologySvcDeltaR4Test extends BaseJpaR4Test {
concept.addProperty()
.setCode("useless_sct_code")
.setValue(new Coding("http://snomed.info", "1234567", "Choked on large meal (finding)"));
myCodeSystemDao.create(cs, mySrd);
IValidationSupport.LookupCodeResult result = myTermSvc.lookupCode(new ValidationSupportContext(myValidationSupport), "http://foo/cs", "lunch", null);
assertEquals(true, result.isFound());

View File

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

View File

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

View File

@ -46,7 +46,7 @@ import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
@Disabled
@Disabled("abstract")
public abstract class BaseSubscriptionsR5Test extends BaseResourceProviderR5Test {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BaseSubscriptionsR5Test.class);
protected static int ourListenerPort;

View File

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

View File

@ -38,6 +38,9 @@ import ca.uhn.fhir.rest.server.interceptor.CorsInterceptor;
import ca.uhn.fhir.test.utilities.HttpClientExtension;
import ca.uhn.fhir.test.utilities.server.RestfulServerConfigurerExtension;
import ca.uhn.fhir.test.utilities.server.RestfulServerExtension;
import org.apache.commons.io.IOUtils;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.r4.model.Bundle.BundleEntryComponent;
import org.hl7.fhir.r4.model.Parameters;
@ -49,6 +52,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.web.cors.CorsConfiguration;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -210,4 +215,19 @@ public abstract class BaseResourceProviderR4Test extends BaseJpaR4Test {
return false;
}
protected List<String> searchAndReturnUnqualifiedVersionlessIdValues(String uri) throws IOException {
List<String> ids;
HttpGet get = new HttpGet(uri);
try (CloseableHttpResponse response = ourHttpClient.execute(get)) {
String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
ourLog.info(resp);
Bundle bundle = myFhirContext.newXmlParser().parseResource(Bundle.class, resp);
ids = toUnqualifiedVersionlessIdValues(bundle);
ourLog.debug("Observation: \n" + myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(bundle));
}
return ids;
}
}

View File

@ -98,6 +98,7 @@ import org.hl7.fhir.dstu3.model.Meta;
import org.hl7.fhir.dstu3.model.NamingSystem;
import org.hl7.fhir.dstu3.model.Observation;
import org.hl7.fhir.dstu3.model.OperationDefinition;
import org.hl7.fhir.dstu3.model.OperationOutcome;
import org.hl7.fhir.dstu3.model.Organization;
import org.hl7.fhir.dstu3.model.Patient;
import org.hl7.fhir.dstu3.model.Practitioner;
@ -414,6 +415,10 @@ public abstract class BaseJpaDstu3Test extends BaseJpaTest {
myJpaValidationSupportChainDstu3.invalidateCaches();
}
public void assertHasErrors(OperationOutcome theOperationOutcome) {
Dstu3ValidationTestUtil.assertHasErrors(theOperationOutcome);
}
/**
* Creates a single {@link ConceptMap} entity that includes:
* <br>

View File

@ -153,6 +153,7 @@ import org.hl7.fhir.r4.model.MolecularSequence;
import org.hl7.fhir.r4.model.NamingSystem;
import org.hl7.fhir.r4.model.Observation;
import org.hl7.fhir.r4.model.OperationDefinition;
import org.hl7.fhir.r4.model.OperationOutcome;
import org.hl7.fhir.r4.model.Organization;
import org.hl7.fhir.r4.model.OrganizationAffiliation;
import org.hl7.fhir.r4.model.Patient;
@ -883,6 +884,18 @@ public abstract class BaseJpaR4Test extends BaseJpaTest implements ITestDataBuil
return uuid;
}
public void assertHasErrors(OperationOutcome theOperationOutcome) {
R4ValidationTestUtil.assertHasErrors(theOperationOutcome);
}
public void assertHasWarnings(OperationOutcome theOperationOutcome) {
R4ValidationTestUtil.assertHasWarnings(theOperationOutcome);
}
public void assertHasNoErrors(OperationOutcome theOperationOutcome) {
R4ValidationTestUtil.assertHasNoErrors(theOperationOutcome);
}
public class ValidationPolicyAdvisor implements IValidationPolicyAdvisor {
@Override
public ReferenceValidationPolicy policyForReference(IResourceValidator validator, Object appContext, String path, String url) {

View File

@ -0,0 +1,40 @@
package ca.uhn.fhir.jpa.test;
import ca.uhn.fhir.context.FhirContext;
import org.hl7.fhir.dstu3.model.OperationOutcome;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
public final class Dstu3ValidationTestUtil {
private static final FhirContext ourFhirContext = FhirContext.forR4Cached();
private Dstu3ValidationTestUtil() {
}
public static void assertHasErrors(OperationOutcome theOperationOutcome) {
assertTrue(hasValidationIssuesWithSeverity(theOperationOutcome, OperationOutcome.IssueSeverity.ERROR), "Expected validation errors, found none");
}
public static void assertHasWarnings(OperationOutcome theOperationOutcome) {
assertTrue(hasValidationIssuesWithSeverity(theOperationOutcome, OperationOutcome.IssueSeverity.WARNING), "Expected validation warnings, found none");
}
public static void assertHasNoErrors(OperationOutcome theOperationOutcome) {
assertFalse(hasValidationIssuesWithSeverity(theOperationOutcome, OperationOutcome.IssueSeverity.ERROR), "Expected no validation errors, found some");
}
// TODO KHS use this in places that call assertHasErrors to strengthen the assert (today many of those tests just assert a string is somewhere in the OperationOutcome,
// when it would be stronger to assert the string is in the diagnostics of an error)
private static boolean hasValidationIssuesWithSeverity(OperationOutcome theOperationOutcome, OperationOutcome.IssueSeverity theSeverity) {
return theOperationOutcome.getIssue().stream().anyMatch(t -> t.getSeverity() == theSeverity);
}
public static String toString(OperationOutcome theOperationOutcome) {
return ourFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(theOperationOutcome);
}
public static void assertErrorDiagnosticContainsString(OperationOutcome theOo, String theExpectedDiagnosticSubstring) {
assertTrue(theOo.getIssue().stream().anyMatch(t -> t.getSeverity() == OperationOutcome.IssueSeverity.ERROR && t.getDiagnostics().contains(theExpectedDiagnosticSubstring)), "Expected a validation error with diagnostic containing '" + theExpectedDiagnosticSubstring+ "', found none");
}
}

View File

@ -0,0 +1,40 @@
package ca.uhn.fhir.jpa.test;
import ca.uhn.fhir.context.FhirContext;
import org.hl7.fhir.r4.model.OperationOutcome;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
public final class R4ValidationTestUtil {
private static final FhirContext ourFhirContext = FhirContext.forR4Cached();
private R4ValidationTestUtil() {
}
public static void assertHasErrors(OperationOutcome theOperationOutcome) {
assertTrue(hasValidationIssuesWithSeverity(theOperationOutcome, OperationOutcome.IssueSeverity.ERROR), "Expected validation errors, found none");
}
public static void assertHasWarnings(OperationOutcome theOperationOutcome) {
assertTrue(hasValidationIssuesWithSeverity(theOperationOutcome, OperationOutcome.IssueSeverity.WARNING), "Expected validation warnings, found none");
}
public static void assertHasNoErrors(OperationOutcome theOperationOutcome) {
assertFalse(hasValidationIssuesWithSeverity(theOperationOutcome, OperationOutcome.IssueSeverity.ERROR), "Expected no validation errors, found some");
}
// TODO KHS use this in places that call assertHasErrors to strengthen the assert (today many of those tests just assert a string is somewhere in the OperationOutcome,
// when it would be stronger to assert the string is in the diagnostics of an error)
private static boolean hasValidationIssuesWithSeverity(OperationOutcome theOperationOutcome, OperationOutcome.IssueSeverity theSeverity) {
return theOperationOutcome.getIssue().stream().anyMatch(t -> t.getSeverity() == theSeverity);
}
public static String toString(OperationOutcome theOperationOutcome) {
return ourFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(theOperationOutcome);
}
public static void assertErrorDiagnosticContainsString(OperationOutcome theOo, String theExpectedDiagnosticSubstring) {
assertTrue(theOo.getIssue().stream().anyMatch(t -> t.getSeverity() == OperationOutcome.IssueSeverity.ERROR && t.getDiagnostics().contains(theExpectedDiagnosticSubstring)), "Expected a validation error with diagnostic containing '" + theExpectedDiagnosticSubstring+ "', found none");
}
}

View File

@ -1,285 +0,0 @@
<!-- transaction test case
This is intended to be aplied to a database that just contains a set of resources from the spec
In this transaction
- 1 create a resource (provenance, with both version and version independent references)
- 2 create a resource if nothing already exists (where nothing does)
- 3 create a resource if nothing already exists (where something does)
- 4 update an exising resource
- 4a delete a resource that doesn't exist
- 5 update an existing resource version dependently
- 6 update an existing resource conditionally (where nothing does)
- 7 update an existing resource conditionally (where something does)
- 8 delete an existing resource
- 9 delete an existing resource version dependently
- 10 delete an existing resource conditionally (where nothing does)
- 11 delete an existing resource conditionally (where something does)
- 12 read a resource
- 13 read a resource for something in the transaction
- 14 vread a resource
- 15 do a search
error conditions (comment out for success):
- 16 create a resource with multiple matches
- 17 update an existing resource that doesn't exist
- 18 update a duplicate resource
- 19 update a resource specifying a wrong version
- 20 update a resource conditionally with multiple matches
- 22 delete a duplicate resource
- 23 delete a duplicate with update
- 24 delete a resource specifying a wrong version
- 25 delete a resource conditionally with multiple matches
- 26 conditionally delete a resource created in the transaction
- 27 conditionally update a resource created in the transaction
-->
<Bundle xmlns="http://hl7.org/fhir" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hl7.org/fhir file:///C:/work/org.hl7.fhir/build/schema/bundle.xsd">
<id value="e4f1c1b8-c7db-49c7-a891-f8a014e75911"/>
<type value="transaction"/>
<base value="http://hl7.org/fhir"/>
<!-- this is in the spec space -->
<!-- - 1 create a resource (provenance, with both version and version independent references) -->
<entry>
<resource>
<Provenance xmlns="http://hl7.org/fhir">
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml">Make sure links are updated: <a href="Patient/xdfsdsg">Patient</a>
</div>
</text>
<target>
<reference value="Patient/xdfsdsg/_history/1"/>
</target>
<target>
<reference value="Patient/patx1"/>
</target>
<recorded value="2015-04-30T12:00:00+05:00"/>
</Provenance>
</resource>
<transaction>
<method value="POST"/>
<url value="Provenance"/>
</transaction>
</entry>
<!-- - 2 create a resource if nothing already exists (where nothing does) -->
<entry>
<resource>
<Patient xmlns="http://hl7.org/fhir">
<id value="xdfsdsg"/>
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml">Snipped for brevity</div>
</text>
<identifier>
<system value="urn:oid:1.2.36.146.595.217.0.1"/>
<value value="xdfsdsg"/>
</identifier>
<!-- Peter James Chalmers, but called &quot;Jim&quot; -->
<name>
<family value="Chalmers"/>
<given value="Peter"/>
</name>
</Patient>
</resource>
<transaction>
<method value="POST"/>
<url value="Patient"/>
<ifNoneExist value="Patient?identifier=xdfsdsg"/>
</transaction>
</entry>
<!-- - 3 create a resource if nothing already exists (where something does) -->
<entry>
<resource>
<Patient xmlns="http://hl7.org/fhir">
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml">Snipped for brevity</div>
</text>
<identifier>
<system value="urn:oid:1.2.36.146.595.217.0.1"/>
<value value="12345"/>
</identifier>
<!-- Peter James Chalmers, but called &quot;Jim&quot; -->
<name>
<family value="Chalmers"/>
<given value="Peter"/>
</name>
</Patient>
</resource>
<transaction>
<method value="POST"/>
<url value="Patient"/>
<ifNoneExist value="Patient?identifier=urn:oid:1.2.36.146.595.217.0.1|12345"/>
</transaction>
</entry>
<!-- - 4 update an exising resource -->
<entry>
<resource>
<Patient>
<id value="xcda"/>
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml">Snipped</div>
</text>
<name>
<family value="Levin"/>
<given value="Henry"/>
</name>
</Patient>
</resource>
<transaction>
<method value="PUT"/>
<url value="Patient/xcda"/>
</transaction>
</entry>
<!-- - 4a update an existing resource that doesn't exist -->
<entry>
<resource>
<Patient>
<id value="xcda1"/>
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml">Snipped</div>
</text>
<name>
<family value="Levin"/>
<given value="Henry"/>
</name>
</Patient>
</resource>
<transaction>
<method value="PUT"/>
<url value="Patient/xcda"/>
</transaction>
</entry>
<!-- - 5 update an existing resource version dependently -->
<entry>
<resource>
<Patient xmlns="http://hl7.org/fhir">
<id value="xds"/>
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml">Snipped</div>
</text>
<name>
<family value="Doe"/>
<given value="John"/>
</name>
</Patient>
</resource>
<transaction>
<method value="PUT"/>
<url value="Patient/xds"/>
<ifMatch value="W/1"/>
</transaction>
</entry>
<!-- - 6 update an existing resource conditionally (where nothing does) -->
<entry>
<resource>
<Patient xmlns="http://hl7.org/fhir">
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml">Snipped</div>
</text>
<identifier>
<system value="urn:oid:0.1.2.3.4.5.6.7"/>
<value value="123456xx"/>
</identifier>
<name>
<family value="Donald"/>
<given value="Duck"/>
<given value="D"/>
</name>
</Patient>
</resource>
<transaction>
<method value="PUT"/>
<url value="Patient?identifier=urn:oid:0.1.2.3.4.5.6.7|123456xx"/>
</transaction>
</entry>
<!-- - 7 update an existing resource conditionally (where something does) -->
<entry>
<resource>
<Patient xmlns="http://hl7.org/fhir">
<id value="patx1"/>
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml">Snipped</div>
</text>
<identifier>
<system value="urn:oid:0.1.2.3.4.5.6.7"/>
<value value="654321"/>
</identifier>
<name>
<family value="Donald"/>
<given value="Duck"/>
</name>
</Patient>
</resource>
<transaction>
<method value="PUT"/>
<url value="Patient?identifier=urn:oid:0.1.2.3.4.5.6.7|654321"/>
</transaction>
</entry>
<!-- - 8 delete an existing resource -->
<entry>
<transaction>
<method value="DELETE"/>
<url value="Patient/glossy"/>
</transaction>
</entry>
<!-- - 9 delete an existing resource version dependently -->
<entry>
<transaction>
<method value="DELETE"/>
<url value="Patient/us01"/>
<ifMatch value="W/1"/>
</transaction>
</entry>
<!-- - 10 delete an existing resource conditionally (where nothing does) -->
<entry>
<transaction>
<method value="DELETE"/>
<url value="Patient?identifier=http://www.maroondah.vic.gov.au/AnimalRegFees.aspx|1234123x"/>
</transaction>
</entry>
<!-- - 11 delete an existing resource conditionally (where something does) -->
<entry>
<transaction>
<method value="DELETE"/>
<url value="Patient?identifier=http://www.maroondah.vic.gov.au/AnimalRegFees.aspx|1234123"/>
</transaction>
</entry>
<!-- - 12 read a resource -->
<entry>
<transaction>
<method value="GET"/>
<url value="Patient/dicom"/>
</transaction>
</entry>
<!-- - 13 read a resource for something in the transaction -->
<entry>
<transaction>
<method value="GET"/>
<url value="patient/xcda"/>
</transaction>
</entry>
<!-- - 14 vread a resource -->
<entry>
<transaction>
<method value="GET"/>
<url value="Patient/xcda/_history/1"/>
</transaction>
</entry>
<!-- - 15 do a search -->
<entry>
<transaction>
<method value="GET"/>
<url value="Patient?name=peter"/>
</transaction>
</entry>
</Bundle>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -7,8 +7,7 @@
<parent>
<artifactId>hapi-fhir-serviceloaders</artifactId>
<groupId>ca.uhn.hapi.fhir</groupId>
<version>6.5.9-SNAPSHOT</version>
<version>6.5.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -21,8 +20,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-caching-api</artifactId>
<version>6.5.9-SNAPSHOT</version>
<version>6.5.10-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5,8 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot-samples</artifactId>
<version>6.5.9-SNAPSHOT</version>
<version>6.5.10-SNAPSHOT</version>
</parent>
<artifactId>hapi-fhir-spring-boot-sample-client-okhttp</artifactId>

View File

@ -5,8 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot-samples</artifactId>
<version>6.5.9-SNAPSHOT</version>
<version>6.5.10-SNAPSHOT</version>
</parent>
<artifactId>hapi-fhir-spring-boot-sample-server-jersey</artifactId>

View File

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

View File

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

View File

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

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