Fix build
This commit is contained in:
parent
81cb769d18
commit
e1ab2856e0
|
@ -4,6 +4,8 @@ import static org.apache.commons.lang3.StringUtils.isBlank;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.apache.commons.cli.CommandLine;
|
||||
import org.apache.commons.cli.Option;
|
||||
|
@ -273,6 +275,23 @@ public class ValidationDataUploader extends BaseCommand {
|
|||
bundle = ctx.newXmlParser().parseResource(org.hl7.fhir.dstu3.model.Bundle.class, vsContents);
|
||||
total = bundle.getEntry().size();
|
||||
count = 1;
|
||||
|
||||
Collections.sort(bundle.getEntry(), new Comparator<BundleEntryComponent>() {
|
||||
@Override
|
||||
public int compare(BundleEntryComponent theO1, BundleEntryComponent theO2) {
|
||||
if (theO1.getResource() == null && theO2.getResource() == null) {
|
||||
return 0;
|
||||
}
|
||||
if (theO1.getResource() == null) {
|
||||
return 1;
|
||||
}
|
||||
if (theO2.getResource() == null) {
|
||||
return -1;
|
||||
}
|
||||
// StructureDefinition, then OperationDefinition, then CompartmentDefinition
|
||||
return theO2.getResource().getClass().getName().compareTo(theO1.getResource().getClass().getName());
|
||||
}});
|
||||
|
||||
for (BundleEntryComponent i : bundle.getEntry()) {
|
||||
org.hl7.fhir.dstu3.model.Resource next = i.getResource();
|
||||
next.setId(next.getIdElement().toUnqualifiedVersionless());
|
||||
|
|
|
@ -511,14 +511,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||
|
||||
myDaoConfig.setAllowInlineMatchUrlReferences(true);
|
||||
|
||||
Patient p = new Patient();
|
||||
p.addIdentifier().setSystem("urn:system").setValue(methodName);
|
||||
myPatientDao.create(p, mySrd).getId();
|
||||
|
||||
p = new Patient();
|
||||
p.addIdentifier().setSystem("urn:system").setValue(methodName);
|
||||
myPatientDao.create(p, mySrd).getId();
|
||||
|
||||
|
||||
Observation o = new Observation();
|
||||
o.getCode().setText("Some Observation");
|
||||
o.getSubject().setReference("Patient?identifier=urn%3Asystem%7C" + methodName);
|
||||
|
@ -527,8 +520,8 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||
try {
|
||||
mySystemDao.transaction(mySrd, request);
|
||||
fail();
|
||||
} catch (InvalidRequestException e) {
|
||||
assertEquals("Invalid match URL \"Patient?identifier=urn%3Asystem%7CtestTransactionCreateInlineMatchUrlWithNoMatches\" - Multiple resources match this search", e.getMessage());
|
||||
} catch (ResourceNotFoundException e) {
|
||||
assertEquals("Invalid match URL \"Patient?identifier=urn%3Asystem%7CtestTransactionCreateInlineMatchUrlWithNoMatches\" - No resources match this search", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -555,7 +548,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||
try {
|
||||
mySystemDao.transaction(mySrd, request);
|
||||
fail();
|
||||
} catch (InvalidRequestException e) {
|
||||
} catch (PreconditionFailedException e) {
|
||||
assertEquals("Invalid match URL \"Patient?identifier=urn%3Asystem%7CtestTransactionCreateInlineMatchUrlWithTwoMatches\" - Multiple resources match this search", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ public class TestDstu3Config extends BaseJavaConfigDstu3 {
|
|||
@Lazy
|
||||
public RequestValidatingInterceptor requestValidatingInterceptor() {
|
||||
RequestValidatingInterceptor requestValidator = new RequestValidatingInterceptor();
|
||||
requestValidator.setFailOnSeverity(ResultSeverityEnum.ERROR);
|
||||
requestValidator.setFailOnSeverity(null);
|
||||
requestValidator.setAddResponseHeaderOnSeverity(null);
|
||||
requestValidator.setAddResponseOutcomeHeaderOnSeverity(ResultSeverityEnum.INFORMATION);
|
||||
requestValidator.addValidatorModule(instanceValidatorDstu3());
|
||||
|
|
|
@ -33,9 +33,6 @@ import ca.uhn.fhir.rest.annotation.Read;
|
|||
import ca.uhn.fhir.util.PortUtil;
|
||||
import ca.uhn.fhir.util.TestUtil;
|
||||
|
||||
/**
|
||||
* Created by dsotnikov on 2/25/2014.
|
||||
*/
|
||||
public class ReadDstu1Test {
|
||||
|
||||
private static CloseableHttpClient ourClient;
|
||||
|
@ -131,7 +128,7 @@ public class ReadDstu1Test {
|
|||
|
||||
@Test
|
||||
public void testReadWithEscapedCharsInId() throws Exception {
|
||||
String id = "ABC!@#$%DEF";
|
||||
String id = "ABC!@#$--DEF";
|
||||
String idEscaped = URLEncoder.encode(id, "UTF-8");
|
||||
|
||||
String vid = "GHI:/:/JKL";
|
||||
|
|
|
@ -21,9 +21,13 @@ import java.util.zip.GZIPInputStream;
|
|||
import org.apache.commons.io.IOUtils;
|
||||
import org.hl7.fhir.dstu3.hapi.validation.DefaultProfileValidationSupport;
|
||||
import org.hl7.fhir.dstu3.hapi.validation.FhirInstanceValidator;
|
||||
import org.hl7.fhir.dstu3.hapi.validation.HapiWorkerContext;
|
||||
import org.hl7.fhir.dstu3.hapi.validation.IValidationSupport;
|
||||
import org.hl7.fhir.dstu3.hapi.validation.IValidationSupport.CodeValidationResult;
|
||||
import org.hl7.fhir.dstu3.hapi.validation.ValidationSupportChain;
|
||||
import org.hl7.fhir.dstu3.model.Base;
|
||||
import org.hl7.fhir.dstu3.model.BooleanType;
|
||||
import org.hl7.fhir.dstu3.model.Bundle;
|
||||
import org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent;
|
||||
import org.hl7.fhir.dstu3.model.CodeSystem;
|
||||
import org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent;
|
||||
|
@ -36,6 +40,7 @@ import org.hl7.fhir.dstu3.model.StructureDefinition;
|
|||
import org.hl7.fhir.dstu3.model.ValueSet;
|
||||
import org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent;
|
||||
import org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent;
|
||||
import org.hl7.fhir.dstu3.utils.FHIRPathEngine;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
|
@ -97,6 +102,35 @@ public class FhirInstanceValidatorDstu3Test {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
// @Ignore
|
||||
public void testValidateBundleWithObservations() throws Exception {
|
||||
String name = "profiles-resources";
|
||||
ourLog.info("Uploading " + name);
|
||||
String inputString;
|
||||
inputString = IOUtils.toString(FhirInstanceValidatorDstu3Test.class.getResourceAsStream("/brian_reinhold_bundle.json"), "UTF-8");
|
||||
Bundle bundle = ourCtx.newJsonParser().parseResource(Bundle.class, inputString);
|
||||
|
||||
FHIRPathEngine fp = new FHIRPathEngine(new HapiWorkerContext(ourCtx, myDefaultValidationSupport));
|
||||
List<Base> fpOutput;
|
||||
BooleanType bool;
|
||||
|
||||
fpOutput = fp.evaluate(bundle.getEntry().get(0), "component.where(code = %resource.code).empty()");
|
||||
assertEquals(1, fpOutput.size());
|
||||
bool = (BooleanType) fpOutput.get(0);
|
||||
assertTrue(bool.getValue());
|
||||
//
|
||||
// fpOutput = fp.evaluate(bundle, "component.where(code = %resource.code).empty()");
|
||||
// assertEquals(1, fpOutput.size());
|
||||
// bool = (BooleanType) fpOutput.get(0);
|
||||
// assertTrue(bool.getValue());
|
||||
|
||||
ValidationResult output = myVal.validateWithResult(inputString);
|
||||
List<SingleValidationMessage> errors = logResultsAndReturnNonInformationalOnes(output);
|
||||
assertThat(errors, empty());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidateDocument() throws Exception {
|
||||
String vsContents = IOUtils.toString(FhirInstanceValidatorDstu3Test.class.getResourceAsStream("/sample-document.xml"), "UTF-8");
|
||||
|
|
Loading…
Reference in New Issue