From d6e375065790f2c8b74156bbd837d2b111cefaba Mon Sep 17 00:00:00 2001 From: jamesagnew Date: Mon, 17 Mar 2014 10:25:00 -0400 Subject: [PATCH] Fix unit test bugs --- .../uhn/fhir/context/BaseRuntimeChildDatatypeDefinition.java | 1 - .../java/ca/uhn/fhir/context/RuntimeResourceDefinition.java | 4 +++- .../src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java | 2 +- .../src/test/java/ca/uhn/fhir/parser/XmlParserTest.java | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/BaseRuntimeChildDatatypeDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/BaseRuntimeChildDatatypeDefinition.java index 41f5a657bf7..7aeac1b3522 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/BaseRuntimeChildDatatypeDefinition.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/BaseRuntimeChildDatatypeDefinition.java @@ -21,7 +21,6 @@ public abstract class BaseRuntimeChildDatatypeDefinition extends BaseRuntimeDecl public BaseRuntimeChildDatatypeDefinition(Field theField, String theElementName, Child theChildAnnotation, Description theDescriptionAnnotation, Class theDatatype) { super(theField, theChildAnnotation, theDescriptionAnnotation, theElementName); - assert theDatatype != IResource.class; // shouldn't exist assert theDatatype != IDatatype.class; // should use RuntimeChildAny myDatatype = theDatatype; } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeResourceDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeResourceDefinition.java index f901348e0fa..b715898edd6 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeResourceDefinition.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeResourceDefinition.java @@ -131,7 +131,9 @@ private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger String expectedPath = StringUtils.join(path, '.'); ourLog.info("Filling profile for: {} - Path: {}", expectedPath); - if (!expectedPath.equals(def.getName())) { + String name = def.getName(); + if (!expectedPath.equals(name)) { + path.pollLast(); theElement.getDefinition().getNameReference().setValue(def.getName()); return; } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java index 6363323b4af..010049f48d2 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java @@ -157,7 +157,7 @@ public abstract class RestfulServer extends HttpServlet { Bundle bundle = new Bundle(); bundle.getAuthorName().setValue(getClass().getCanonicalName()); - bundle.getId().setValue(UUID.randomUUID().toString()); + bundle.getBundleId().setValue(UUID.randomUUID().toString()); bundle.getPublished().setToCurrentTimeInLocalTimeZone(); for (IResource next : theResult) { diff --git a/hapi-fhir-base/src/test/java/ca/uhn/fhir/parser/XmlParserTest.java b/hapi-fhir-base/src/test/java/ca/uhn/fhir/parser/XmlParserTest.java index bb6e5132e49..06801f1e0d9 100644 --- a/hapi-fhir-base/src/test/java/ca/uhn/fhir/parser/XmlParserTest.java +++ b/hapi-fhir-base/src/test/java/ca/uhn/fhir/parser/XmlParserTest.java @@ -126,7 +126,7 @@ public class XmlParserTest { BundleEntry entry = bundle.getEntries().get(0); assertEquals("HL7, Inc (FHIR Project)", entry.getAuthorName().getValue()); - assertEquals("http://hl7.org/fhir/valueset/256a5231-a2bb-49bd-9fea-f349d428b70d", entry.getId().getValue()); + assertEquals("http://hl7.org/fhir/valueset/256a5231-a2bb-49bd-9fea-f349d428b70d", entry.getEntryId().getValue()); ValueSet resource = (ValueSet) entry.getResource(); assertEquals("LOINC Codes for Cholesterol", resource.getName().getValue());