diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3Test.java index 2eb9d59d5b7..105c3aa2ca5 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3Test.java @@ -22,6 +22,7 @@ import static org.mockito.Mockito.reset; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; +import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; @@ -141,7 +142,7 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test { // good } } - + @Test public void testCodeSystemCreateAndDelete() { CodeSystem cs = new CodeSystem(); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoDstu3Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoDstu3Test.java index 94796de42eb..11c824a9a50 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoDstu3Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoDstu3Test.java @@ -18,6 +18,7 @@ import static org.mockito.Matchers.eq; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; +import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.util.List; @@ -80,6 +81,23 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest { TestUtil.clearAllStaticFieldsForUnitTest(); } + /** + * See #410 + */ + @Test + public void testContainedArePreservedForBug410() throws IOException { + String input = IOUtils.toString(getClass().getResourceAsStream("/bug-410-bundle.xml")); + Bundle bundle = myFhirCtx.newXmlParser().parseResource(Bundle.class, input); + + Bundle output = mySystemDao.transaction(mySrd, bundle); + ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(output)); + + IdType id = new IdType(output.getEntry().get(1).getResponse().getLocation()); + MedicationOrder mo = myMedicationOrderDao.read(id); + ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(mo)); + } + + @Test public void testTransactionFromBundle2() throws Exception { String input = IOUtils.toString(getClass().getResourceAsStream("/transaction-bundle.xml")); diff --git a/hapi-fhir-jpaserver-base/src/test/resources/bug-410-bundle.xml b/hapi-fhir-jpaserver-base/src/test/resources/bug-410-bundle.xml new file mode 100644 index 00000000000..0665695726b --- /dev/null +++ b/hapi-fhir-jpaserver-base/src/test/resources/bug-410-bundle.xml @@ -0,0 +1,614 @@ + + + + + + + + + + Rose, Eileen. IHI:8103601123724176 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +
+
+
+ + + + + +
+ + + + + + + TEST + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+
+
+ + + + + + MILLENNIUM HEALTH SERVICE. HPIO:8003623233353381 + + + + + + + + + + + + + + + +
+ + + + + + +
+
+
+ + + + + Ellison, Christine. HPI-I:8003616566689462 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + +
+ + + + + + + PCEHRCERT47. Approval Number:HN249M. HPIO:8003623233350106 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +
+
+
+ + + + +
+ + + + + + + LENNON, GEORGE. HPI-I:8003614900014588 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + THERAPEUTIC GOOD + + + Medication + CHLOROMYCETIN + + + Medication Generic Name + CHLORAMPHENICOL + + + Additional Description + CHLOROMYCETIN EAR-DRP 0.5% + + + Strength + 0.5% + + + Label Instruction + Instil ONE drop daily - Discard contents 28 days after opening + + + Medication Form + EAR-DRP + + + Quantity + 1 + + + Number of this Dispense + 1 + + + Maximum Number of Repeats + 0 + + + ADMINISTRATIVE INFORMATION + + + Date/Time of Dispense Event + 20-May-2016 + + + PBS Item Code + 1172Q + + + PBS Manufacturer Code + PF + + + PBS Unique Pharmacy Prescription Number + 6775 + + + Prescription Item ID + 1MN89XMN3B26M4B7P0-4 + + + Dispense Item ID + 1MN89XMN3B26M4B7P0-4 + + + Script Type + N + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + +
+
\ No newline at end of file