parent
989e26fdb4
commit
58e6b7f6aa
|
@ -36,9 +36,9 @@ import ca.uhn.fhir.validation.ValidationResult;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.hibernate.search.jpa.FullTextEntityManager;
|
import org.hibernate.search.jpa.FullTextEntityManager;
|
||||||
import org.hibernate.search.jpa.Search;
|
import org.hibernate.search.jpa.Search;
|
||||||
import org.hl7.fhir.r4.hapi.validation.FhirInstanceValidator;
|
|
||||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||||
import org.hl7.fhir.r4.hapi.ctx.IValidationSupport;
|
import org.hl7.fhir.r4.hapi.ctx.IValidationSupport;
|
||||||
|
import org.hl7.fhir.r4.hapi.validation.FhirInstanceValidator;
|
||||||
import org.hl7.fhir.r4.model.*;
|
import org.hl7.fhir.r4.model.*;
|
||||||
import org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent;
|
import org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent;
|
||||||
import org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent;
|
import org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent;
|
||||||
|
@ -298,7 +298,6 @@ public abstract class BaseJpaR4Test extends BaseJpaTest {
|
||||||
private JpaValidationSupportChainR4 myJpaValidationSupportChainR4;
|
private JpaValidationSupportChainR4 myJpaValidationSupportChainR4;
|
||||||
private PerformanceTracingLoggingInterceptor myPerformanceTracingLoggingInterceptor;
|
private PerformanceTracingLoggingInterceptor myPerformanceTracingLoggingInterceptor;
|
||||||
private List<Object> mySystemInterceptors;
|
private List<Object> mySystemInterceptors;
|
||||||
private FhirValidator myValidator;
|
|
||||||
|
|
||||||
@After()
|
@After()
|
||||||
public void afterCleanupDao() {
|
public void afterCleanupDao() {
|
||||||
|
@ -392,13 +391,11 @@ public abstract class BaseJpaR4Test extends BaseJpaTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void validate(IBaseResource theResource) {
|
protected void validate(IBaseResource theResource) {
|
||||||
if (myValidator == null) {
|
FhirValidator validatorModule = myFhirCtx.newValidator();
|
||||||
myValidator = myFhirCtx.newValidator();
|
FhirInstanceValidator instanceValidator = new FhirInstanceValidator(myValidationSupport);
|
||||||
FhirInstanceValidator validator = new FhirInstanceValidator();
|
instanceValidator.setBestPracticeWarningLevel(IResourceValidator.BestPracticeWarningLevel.Ignore);
|
||||||
validator.setBestPracticeWarningLevel(IResourceValidator.BestPracticeWarningLevel.Ignore);
|
validatorModule.registerValidatorModule(instanceValidator);
|
||||||
myValidator.registerValidatorModule(validator);
|
ValidationResult result = validatorModule.validateWithResult(theResource);
|
||||||
}
|
|
||||||
ValidationResult result = myValidator.validateWithResult(theResource);
|
|
||||||
if (!result.isSuccessful()) {
|
if (!result.isSuccessful()) {
|
||||||
fail(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(result.toOperationOutcome()));
|
fail(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(result.toOperationOutcome()));
|
||||||
}
|
}
|
||||||
|
@ -406,7 +403,7 @@ public abstract class BaseJpaR4Test extends BaseJpaTest {
|
||||||
|
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public static void afterClassClearContextBaseJpaR4Test() throws Exception {
|
public static void afterClassClearContextBaseJpaR4Test() {
|
||||||
ourValueSetDao.purgeCaches();
|
ourValueSetDao.purgeCaches();
|
||||||
ourJpaValidationSupportChainR4.flush();
|
ourJpaValidationSupportChainR4.flush();
|
||||||
TestUtil.clearAllStaticFieldsForUnitTest();
|
TestUtil.clearAllStaticFieldsForUnitTest();
|
||||||
|
|
|
@ -876,6 +876,22 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest {
|
||||||
validate(outcome);
|
validate(outcome);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testBatchMissingUrlForPost() {
|
||||||
|
Bundle request = new Bundle();
|
||||||
|
request.setType(BundleType.BATCH);
|
||||||
|
request
|
||||||
|
.addEntry()
|
||||||
|
.setResource(new Patient().setActive(true))
|
||||||
|
.getRequest()
|
||||||
|
.setMethod(HTTPVerb.POST);
|
||||||
|
|
||||||
|
Bundle outcome = mySystemDao.transaction(mySrd, request);
|
||||||
|
ourLog.info(myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome));
|
||||||
|
assertEquals("201 Created", outcome.getEntry().get(0).getResponse().getStatus());
|
||||||
|
validate(outcome);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTransactionCreateInlineMatchUrlWithOneMatch() {
|
public void testTransactionCreateInlineMatchUrlWithOneMatch() {
|
||||||
|
|
Loading…
Reference in New Issue