remove '[x]' from paths in @ChildOrder annotation because they mess up
'forcedOrder' resolution in BaseRuntimeElementCompositeDefinition.scanCompositeElementForChildren() method
This commit is contained in:
parent
294d080bd3
commit
d26fba161e
|
@ -47,7 +47,8 @@ import org.hl7.fhir.exceptions.FHIRException;
|
||||||
* This resource allows for the definition of some activity to be performed, independent of a particular patient, practitioner, or other performance context.
|
* This resource allows for the definition of some activity to be performed, independent of a particular patient, practitioner, or other performance context.
|
||||||
*/
|
*/
|
||||||
@ResourceDef(name="ActivityDefinition", profile="http://hl7.org/fhir/Profile/ActivityDefinition")
|
@ResourceDef(name="ActivityDefinition", profile="http://hl7.org/fhir/Profile/ActivityDefinition")
|
||||||
@ChildOrder(names={"url", "identifier", "version", "name", "title", "status", "experimental", "date", "publisher", "description", "purpose", "usage", "approvalDate", "lastReviewDate", "effectivePeriod", "useContext", "jurisdiction", "topic", "contributor", "contact", "copyright", "relatedArtifact", "library", "kind", "code", "timing[x]", "location", "participant", "product[x]", "quantity", "dosage", "bodySite", "transform", "dynamicValue"})
|
//@ChildOrder(names={"url", "identifier", "version", "name", "title", "status", "experimental", "date", "publisher", "description", "purpose", "usage", "approvalDate", "lastReviewDate", "effectivePeriod", "useContext", "jurisdiction", "topic", "contributor", "contact", "copyright", "relatedArtifact", "library", "kind", "code", "timing[x]", "location", "participant", "product[x]", "quantity", "dosage", "bodySite", "transform", "dynamicValue"})
|
||||||
|
@ChildOrder(names={"url", "identifier", "version", "name", "title", "status", "experimental", "date", "publisher", "description", "purpose", "usage", "approvalDate", "lastReviewDate", "effectivePeriod", "useContext", "jurisdiction", "topic", "contributor", "contact", "copyright", "relatedArtifact", "library", "kind", "code", "timing", "location", "participant", "product", "quantity", "dosage", "bodySite", "transform", "dynamicValue"})
|
||||||
public class ActivityDefinition extends MetadataResource {
|
public class ActivityDefinition extends MetadataResource {
|
||||||
|
|
||||||
public enum ActivityDefinitionKind {
|
public enum ActivityDefinitionKind {
|
||||||
|
|
|
@ -47,7 +47,8 @@ import org.hl7.fhir.exceptions.FHIRException;
|
||||||
* A statement of relationships from one set of concepts to one or more other concepts - either code systems or data elements, or classes in class models.
|
* A statement of relationships from one set of concepts to one or more other concepts - either code systems or data elements, or classes in class models.
|
||||||
*/
|
*/
|
||||||
@ResourceDef(name="ConceptMap", profile="http://hl7.org/fhir/Profile/ConceptMap")
|
@ResourceDef(name="ConceptMap", profile="http://hl7.org/fhir/Profile/ConceptMap")
|
||||||
@ChildOrder(names={"url", "identifier", "version", "name", "title", "status", "experimental", "date", "publisher", "contact", "description", "useContext", "jurisdiction", "purpose", "copyright", "source[x]", "target[x]", "group"})
|
//@ChildOrder(names={"url", "identifier", "version", "name", "title", "status", "experimental", "date", "publisher", "contact", "description", "useContext", "jurisdiction", "purpose", "copyright", "source[x]", "target[x]", "group"})
|
||||||
|
@ChildOrder(names={"url", "identifier", "version", "name", "title", "status", "experimental", "date", "publisher", "contact", "description", "useContext", "jurisdiction", "purpose", "copyright", "source", "target", "group"})
|
||||||
public class ConceptMap extends MetadataResource {
|
public class ConceptMap extends MetadataResource {
|
||||||
|
|
||||||
public enum ConceptMapGroupUnmappedMode {
|
public enum ConceptMapGroupUnmappedMode {
|
||||||
|
|
|
@ -36,6 +36,8 @@ import java.util.UUID;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.hamcrest.Matchers;
|
import org.hamcrest.Matchers;
|
||||||
import org.hamcrest.core.StringContains;
|
import org.hamcrest.core.StringContains;
|
||||||
|
import org.hl7.fhir.dstu3.hapi.validation.DefaultProfileValidationSupport;
|
||||||
|
import org.hl7.fhir.dstu3.hapi.validation.FhirInstanceValidator;
|
||||||
import org.hl7.fhir.dstu3.model.*;
|
import org.hl7.fhir.dstu3.model.*;
|
||||||
import org.hl7.fhir.dstu3.model.Address.AddressUse;
|
import org.hl7.fhir.dstu3.model.Address.AddressUse;
|
||||||
import org.hl7.fhir.dstu3.model.Address.AddressUseEnumFactory;
|
import org.hl7.fhir.dstu3.model.Address.AddressUseEnumFactory;
|
||||||
|
@ -71,6 +73,9 @@ import ca.uhn.fhir.parser.json.JsonLikeValue.ValueType;
|
||||||
import ca.uhn.fhir.rest.server.Constants;
|
import ca.uhn.fhir.rest.server.Constants;
|
||||||
import ca.uhn.fhir.util.TestUtil;
|
import ca.uhn.fhir.util.TestUtil;
|
||||||
import ca.uhn.fhir.validation.FhirValidator;
|
import ca.uhn.fhir.validation.FhirValidator;
|
||||||
|
import ca.uhn.fhir.validation.IValidationContext;
|
||||||
|
import ca.uhn.fhir.validation.SingleValidationMessage;
|
||||||
|
import ca.uhn.fhir.validation.ValidationContext;
|
||||||
import ca.uhn.fhir.validation.ValidationResult;
|
import ca.uhn.fhir.validation.ValidationResult;
|
||||||
import net.sf.json.JSON;
|
import net.sf.json.JSON;
|
||||||
import net.sf.json.JSONSerializer;
|
import net.sf.json.JSONSerializer;
|
||||||
|
@ -84,6 +89,78 @@ public class JsonParserDstu3Test {
|
||||||
public void after() {
|
public void after() {
|
||||||
ourCtx.setNarrativeGenerator(null);
|
ourCtx.setNarrativeGenerator(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testActivityDefinitionElementsOrder() throws Exception {
|
||||||
|
final String origContent = "{\"resourceType\":\"ActivityDefinition\",\"id\":\"x1\",\"url\":\"http://testing.org\",\"status\":\"draft\",\"timingDateTime\":\"2011-02-03\"}";
|
||||||
|
final IParser parser = ourCtx.newJsonParser();
|
||||||
|
DefaultProfileValidationSupport validationSupport = new DefaultProfileValidationSupport();
|
||||||
|
|
||||||
|
// verify that InstanceValidator likes the format
|
||||||
|
{
|
||||||
|
IValidationContext<IBaseResource> validationCtx = ValidationContext.forText(ourCtx, origContent);
|
||||||
|
new FhirInstanceValidator(validationSupport).validateResource(validationCtx);
|
||||||
|
ValidationResult result = validationCtx.toResult();
|
||||||
|
for (SingleValidationMessage msg : result.getMessages()) {
|
||||||
|
ourLog.info("{}", msg);
|
||||||
|
}
|
||||||
|
Assert.assertEquals(0, result.getMessages().size());
|
||||||
|
}
|
||||||
|
|
||||||
|
ActivityDefinition fhirObj = parser.parseResource(ActivityDefinition.class, origContent);
|
||||||
|
String content = parser.encodeResourceToString(fhirObj);
|
||||||
|
ourLog.info("Serialized form: {}", content);
|
||||||
|
|
||||||
|
// verify that InstanceValidator still likes the format
|
||||||
|
{
|
||||||
|
IValidationContext<IBaseResource> validationCtx = ValidationContext.forText(ourCtx, content);
|
||||||
|
new FhirInstanceValidator(validationSupport).validateResource(validationCtx);
|
||||||
|
ValidationResult result = validationCtx.toResult();
|
||||||
|
for (SingleValidationMessage msg : result.getMessages()) {
|
||||||
|
ourLog.info("{}", msg);
|
||||||
|
}
|
||||||
|
Assert.assertEquals(0, result.getMessages().size());
|
||||||
|
}
|
||||||
|
|
||||||
|
// verify that the original and newly serialized match
|
||||||
|
Assert.assertEquals(origContent, content);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testConceptMapElementsOrder() throws Exception {
|
||||||
|
final String origContent = "{\"resourceType\":\"ConceptMap\",\"id\":\"x1\",\"url\":\"http://testing.org\",\"status\":\"draft\",\"sourceUri\":\"http://y1\"}";
|
||||||
|
final IParser parser = ourCtx.newJsonParser();
|
||||||
|
DefaultProfileValidationSupport validationSupport = new DefaultProfileValidationSupport();
|
||||||
|
|
||||||
|
// verify that InstanceValidator likes the format
|
||||||
|
{
|
||||||
|
IValidationContext<IBaseResource> validationCtx = ValidationContext.forText(ourCtx, origContent);
|
||||||
|
new FhirInstanceValidator(validationSupport).validateResource(validationCtx);
|
||||||
|
ValidationResult result = validationCtx.toResult();
|
||||||
|
for (SingleValidationMessage msg : result.getMessages()) {
|
||||||
|
ourLog.info("{}", msg);
|
||||||
|
}
|
||||||
|
Assert.assertEquals(0, result.getMessages().size());
|
||||||
|
}
|
||||||
|
|
||||||
|
ConceptMap fhirObj = parser.parseResource(ConceptMap.class, origContent);
|
||||||
|
String content = parser.encodeResourceToString(fhirObj);
|
||||||
|
ourLog.info("Serialized form: {}", content);
|
||||||
|
|
||||||
|
// verify that InstanceValidator still likes the format
|
||||||
|
{
|
||||||
|
IValidationContext<IBaseResource> validationCtx = ValidationContext.forText(ourCtx, content);
|
||||||
|
new FhirInstanceValidator(validationSupport).validateResource(validationCtx);
|
||||||
|
ValidationResult result = validationCtx.toResult();
|
||||||
|
for (SingleValidationMessage msg : result.getMessages()) {
|
||||||
|
ourLog.info("{}", msg);
|
||||||
|
}
|
||||||
|
Assert.assertEquals(0, result.getMessages().size());
|
||||||
|
}
|
||||||
|
|
||||||
|
// verify that the original and newly serialized match
|
||||||
|
Assert.assertEquals(origContent, content);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See #563
|
* See #563
|
||||||
|
|
|
@ -34,6 +34,8 @@ import org.custommonkey.xmlunit.XMLUnit;
|
||||||
import org.hamcrest.collection.IsEmptyCollection;
|
import org.hamcrest.collection.IsEmptyCollection;
|
||||||
import org.hamcrest.core.StringContains;
|
import org.hamcrest.core.StringContains;
|
||||||
import org.hamcrest.text.StringContainsInOrder;
|
import org.hamcrest.text.StringContainsInOrder;
|
||||||
|
import org.hl7.fhir.dstu3.hapi.validation.DefaultProfileValidationSupport;
|
||||||
|
import org.hl7.fhir.dstu3.hapi.validation.FhirInstanceValidator;
|
||||||
import org.hl7.fhir.dstu3.model.*;
|
import org.hl7.fhir.dstu3.model.*;
|
||||||
import org.hl7.fhir.dstu3.model.Address.AddressUse;
|
import org.hl7.fhir.dstu3.model.Address.AddressUse;
|
||||||
import org.hl7.fhir.dstu3.model.Address.AddressUseEnumFactory;
|
import org.hl7.fhir.dstu3.model.Address.AddressUseEnumFactory;
|
||||||
|
@ -67,6 +69,10 @@ import ca.uhn.fhir.parser.PatientWithCustomCompositeExtension.FooParentExtension
|
||||||
import ca.uhn.fhir.rest.client.IGenericClient;
|
import ca.uhn.fhir.rest.client.IGenericClient;
|
||||||
import ca.uhn.fhir.rest.server.Constants;
|
import ca.uhn.fhir.rest.server.Constants;
|
||||||
import ca.uhn.fhir.util.TestUtil;
|
import ca.uhn.fhir.util.TestUtil;
|
||||||
|
import ca.uhn.fhir.validation.IValidationContext;
|
||||||
|
import ca.uhn.fhir.validation.SingleValidationMessage;
|
||||||
|
import ca.uhn.fhir.validation.ValidationContext;
|
||||||
|
import ca.uhn.fhir.validation.ValidationResult;
|
||||||
|
|
||||||
public class XmlParserDstu3Test {
|
public class XmlParserDstu3Test {
|
||||||
private static FhirContext ourCtx = FhirContext.forDstu3();
|
private static FhirContext ourCtx = FhirContext.forDstu3();
|
||||||
|
@ -79,6 +85,78 @@ public class XmlParserDstu3Test {
|
||||||
}
|
}
|
||||||
ourCtx.setNarrativeGenerator(null);
|
ourCtx.setNarrativeGenerator(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testActivityDefinitionElementsOrder() throws Exception {
|
||||||
|
final String origContent = "<ActivityDefinition xmlns=\"http://hl7.org/fhir\"><id value=\"x1\"/><url value=\"http://testing.org\"/><status value=\"draft\"/><timingDateTime value=\"2011-02-03\"/></ActivityDefinition>";
|
||||||
|
final IParser parser = ourCtx.newXmlParser();
|
||||||
|
DefaultProfileValidationSupport validationSupport = new DefaultProfileValidationSupport();
|
||||||
|
|
||||||
|
// verify that InstanceValidator likes the format
|
||||||
|
{
|
||||||
|
IValidationContext<IBaseResource> validationCtx = ValidationContext.forText(ourCtx, origContent);
|
||||||
|
new FhirInstanceValidator(validationSupport).validateResource(validationCtx);
|
||||||
|
ValidationResult result = validationCtx.toResult();
|
||||||
|
for (SingleValidationMessage msg : result.getMessages()) {
|
||||||
|
ourLog.info("{}", msg);
|
||||||
|
}
|
||||||
|
Assert.assertEquals(0, result.getMessages().size());
|
||||||
|
}
|
||||||
|
|
||||||
|
ActivityDefinition fhirObj = parser.parseResource(ActivityDefinition.class, origContent);
|
||||||
|
String content = parser.encodeResourceToString(fhirObj);
|
||||||
|
ourLog.info("Serialized form: {}", content);
|
||||||
|
|
||||||
|
// verify that InstanceValidator still likes the format
|
||||||
|
{
|
||||||
|
IValidationContext<IBaseResource> validationCtx = ValidationContext.forText(ourCtx, content);
|
||||||
|
new FhirInstanceValidator(validationSupport).validateResource(validationCtx);
|
||||||
|
ValidationResult result = validationCtx.toResult();
|
||||||
|
for (SingleValidationMessage msg : result.getMessages()) {
|
||||||
|
ourLog.info("{}", msg);
|
||||||
|
}
|
||||||
|
Assert.assertEquals(0, result.getMessages().size());
|
||||||
|
}
|
||||||
|
|
||||||
|
// verify that the original and newly serialized match
|
||||||
|
Assert.assertEquals(origContent, content);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testConceptMapElementsOrder() throws Exception {
|
||||||
|
final String origContent = "<ConceptMap xmlns=\"http://hl7.org/fhir\"><id value=\"x1\"/><url value=\"http://testing.org\"/><status value=\"draft\"/><sourceUri value=\"http://url1\"/></ConceptMap>";
|
||||||
|
final IParser parser = ourCtx.newXmlParser();
|
||||||
|
DefaultProfileValidationSupport validationSupport = new DefaultProfileValidationSupport();
|
||||||
|
|
||||||
|
// verify that InstanceValidator likes the format
|
||||||
|
{
|
||||||
|
IValidationContext<IBaseResource> validationCtx = ValidationContext.forText(ourCtx, origContent);
|
||||||
|
new FhirInstanceValidator(validationSupport).validateResource(validationCtx);
|
||||||
|
ValidationResult result = validationCtx.toResult();
|
||||||
|
for (SingleValidationMessage msg : result.getMessages()) {
|
||||||
|
ourLog.info("{}", msg);
|
||||||
|
}
|
||||||
|
Assert.assertEquals(0, result.getMessages().size());
|
||||||
|
}
|
||||||
|
|
||||||
|
ConceptMap fhirObj = parser.parseResource(ConceptMap.class, origContent);
|
||||||
|
String content = parser.encodeResourceToString(fhirObj);
|
||||||
|
ourLog.info("Serialized form: {}", content);
|
||||||
|
|
||||||
|
// verify that InstanceValidator still likes the format
|
||||||
|
{
|
||||||
|
IValidationContext<IBaseResource> validationCtx = ValidationContext.forText(ourCtx, content);
|
||||||
|
new FhirInstanceValidator(validationSupport).validateResource(validationCtx);
|
||||||
|
ValidationResult result = validationCtx.toResult();
|
||||||
|
for (SingleValidationMessage msg : result.getMessages()) {
|
||||||
|
ourLog.info("{}", msg);
|
||||||
|
}
|
||||||
|
Assert.assertEquals(0, result.getMessages().size());
|
||||||
|
}
|
||||||
|
|
||||||
|
// verify that the original and newly serialized match
|
||||||
|
Assert.assertEquals(origContent, content);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See #544
|
* See #544
|
||||||
|
|
Loading…
Reference in New Issue