From 2181cb14d534821904d5d20e2d8d174ecf746848 Mon Sep 17 00:00:00 2001 From: dotasek Date: Mon, 11 Apr 2022 14:10:53 -0400 Subject: [PATCH] Change tests to xml + fix breaking test --- .../conv40_50/AuditEvent40_50Test.java | 24 ++-- .../auditevent_40_with_base64binary.json | 122 ------------------ .../auditevent_40_with_base64binary.xml | 95 ++++++++++++++ ...ditevent_40_with_invalid_base64binary.json | 122 ------------------ ...uditevent_40_with_invalid_base64binary.xml | 95 ++++++++++++++ .../auditevent_50_with_base64binary.json | 117 ----------------- .../auditevent_50_with_base64binary.xml | 100 ++++++++++++++ .../fhir/dstu3/model/Base64BinaryType.java | 2 +- .../hl7/fhir/r4/model/Base64BinaryType.java | 2 +- "org.hl7.fhir.r4b/c:\\temp\\test.xml" | 1 + .../hl7/fhir/r4b/model/Base64BinaryType.java | 2 +- .../hl7/fhir/r5/model/Base64BinaryType.java | 2 +- 12 files changed, 307 insertions(+), 377 deletions(-) delete mode 100644 org.hl7.fhir.convertors/src/test/resources/auditevent_40_with_base64binary.json create mode 100644 org.hl7.fhir.convertors/src/test/resources/auditevent_40_with_base64binary.xml delete mode 100644 org.hl7.fhir.convertors/src/test/resources/auditevent_40_with_invalid_base64binary.json create mode 100644 org.hl7.fhir.convertors/src/test/resources/auditevent_40_with_invalid_base64binary.xml delete mode 100644 org.hl7.fhir.convertors/src/test/resources/auditevent_50_with_base64binary.json create mode 100644 org.hl7.fhir.convertors/src/test/resources/auditevent_50_with_base64binary.xml create mode 100644 "org.hl7.fhir.r4b/c:\\temp\\test.xml" diff --git a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv40_50/AuditEvent40_50Test.java b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv40_50/AuditEvent40_50Test.java index 244768be4..52b3013ee 100644 --- a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv40_50/AuditEvent40_50Test.java +++ b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv40_50/AuditEvent40_50Test.java @@ -25,17 +25,17 @@ public class AuditEvent40_50Test { @Test @DisplayName("Test r5 -> r4 AuditEvent conversion.") public void testR5_R4() throws IOException { - InputStream r5_input = this.getClass().getResourceAsStream("/auditevent_50_with_base64binary.json"); + InputStream r5_input = this.getClass().getResourceAsStream("/auditevent_50_with_base64binary.xml"); - org.hl7.fhir.r5.model.AuditEvent r5_actual = (org.hl7.fhir.r5.model.AuditEvent) new org.hl7.fhir.r5.formats.JsonParser().parse(r5_input); + org.hl7.fhir.r5.model.AuditEvent r5_actual = (org.hl7.fhir.r5.model.AuditEvent) new org.hl7.fhir.r5.formats.XmlParser().parse(r5_input); org.hl7.fhir.r4.model.Resource r4_conv = VersionConvertorFactory_40_50.convertResource(r5_actual); - org.hl7.fhir.r4.formats.JsonParser r4_parser = new org.hl7.fhir.r4.formats.JsonParser(); + org.hl7.fhir.r4.formats.XmlParser r4_parser = new org.hl7.fhir.r4.formats.XmlParser(); ByteArrayOutputStream stream = new ByteArrayOutputStream(); r4_parser.compose(stream, r4_conv); - org.hl7.fhir.r4.model.Resource r4_streamed = (org.hl7.fhir.r4.model.AuditEvent) new org.hl7.fhir.r4.formats.JsonParser().parse(new ByteArrayInputStream(stream.toByteArray())); + org.hl7.fhir.r4.model.Resource r4_streamed = (org.hl7.fhir.r4.model.AuditEvent) new org.hl7.fhir.r4.formats.XmlParser().parse(new ByteArrayInputStream(stream.toByteArray())); assertArrayEquals(((org.hl7.fhir.r4.model.AuditEvent)r4_conv).getEntity().get(0).getQuery(), THE_BASE_64_BINARY_BYTE_ARRAY); assertArrayEquals(((org.hl7.fhir.r4.model.AuditEvent)r4_streamed).getEntity().get(0).getQuery(), THE_BASE_64_BINARY_BYTE_ARRAY); @@ -44,19 +44,19 @@ public class AuditEvent40_50Test { @Test @DisplayName("Test r5 -> r4 AuditEvent conversion.") public void testR4_R5() throws IOException { - InputStream r4_input = this.getClass().getResourceAsStream("/auditevent_40_with_base64binary.json"); + InputStream r4_input = this.getClass().getResourceAsStream("/auditevent_40_with_base64binary.xml"); - org.hl7.fhir.r4.model.AuditEvent r4_actual = (org.hl7.fhir.r4.model.AuditEvent) new org.hl7.fhir.r4.formats.JsonParser().parse(r4_input); + org.hl7.fhir.r4.model.AuditEvent r4_actual = (org.hl7.fhir.r4.model.AuditEvent) new org.hl7.fhir.r4.formats.XmlParser().parse(r4_input); org.hl7.fhir.r5.model.Resource r5_conv = VersionConvertorFactory_40_50.convertResource(r4_actual); - org.hl7.fhir.r5.formats.JsonParser r5_parser = new org.hl7.fhir.r5.formats.JsonParser(); + org.hl7.fhir.r5.formats.XmlParser r5_parser = new org.hl7.fhir.r5.formats.XmlParser(); ByteArrayOutputStream stream = new ByteArrayOutputStream(); r5_parser.compose(stream, r5_conv); - org.hl7.fhir.r5.model.Resource r5_streamed = (org.hl7.fhir.r5.model.AuditEvent) new org.hl7.fhir.r5.formats.JsonParser().parse(new ByteArrayInputStream(stream.toByteArray())); + org.hl7.fhir.r5.model.Resource r5_streamed = (org.hl7.fhir.r5.model.AuditEvent) new org.hl7.fhir.r5.formats.XmlParser().parse(new ByteArrayInputStream(stream.toByteArray())); assertArrayEquals(((org.hl7.fhir.r5.model.AuditEvent)r5_conv).getEntity().get(0).getQuery(), THE_BASE_64_BINARY_BYTE_ARRAY); assertArrayEquals(((org.hl7.fhir.r5.model.AuditEvent)r5_streamed).getEntity().get(0).getQuery(), THE_BASE_64_BINARY_BYTE_ARRAY); @@ -66,20 +66,20 @@ public class AuditEvent40_50Test { @Test @DisplayName("Test r5 -> r4 AuditEvent conversion with invalid Base64Binary.") public void testR4_R5BadBase64Binary() throws IOException { - InputStream r4_input = this.getClass().getResourceAsStream("/auditevent_40_with_invalid_base64binary.json"); + InputStream r4_input = this.getClass().getResourceAsStream("/auditevent_40_with_invalid_base64binary.xml"); - org.hl7.fhir.r4.model.AuditEvent r4_actual = (org.hl7.fhir.r4.model.AuditEvent) new org.hl7.fhir.r4.formats.JsonParser().parse(r4_input); + org.hl7.fhir.r4.model.AuditEvent r4_actual = (org.hl7.fhir.r4.model.AuditEvent) new org.hl7.fhir.r4.formats.XmlParser().parse(r4_input); org.hl7.fhir.r5.model.Resource r5_conv = VersionConvertorFactory_40_50.convertResource(r4_actual); - org.hl7.fhir.r5.formats.JsonParser r5_parser = new org.hl7.fhir.r5.formats.JsonParser(); + org.hl7.fhir.r5.formats.XmlParser r5_parser = new org.hl7.fhir.r5.formats.XmlParser(); ByteArrayOutputStream stream = new ByteArrayOutputStream(); r5_parser.compose(stream, r5_conv); - org.hl7.fhir.r5.model.Resource r5_streamed = (org.hl7.fhir.r5.model.AuditEvent) new org.hl7.fhir.r5.formats.JsonParser().parse(new ByteArrayInputStream(stream.toByteArray())); + org.hl7.fhir.r5.model.Resource r5_streamed = (org.hl7.fhir.r5.model.AuditEvent) new org.hl7.fhir.r5.formats.XmlParser().parse(new ByteArrayInputStream(stream.toByteArray())); System.out.println(((org.hl7.fhir.r5.model.AuditEvent)r5_conv).getEntity().get(0).getQueryElement().getValueAsString()); diff --git a/org.hl7.fhir.convertors/src/test/resources/auditevent_40_with_base64binary.json b/org.hl7.fhir.convertors/src/test/resources/auditevent_40_with_base64binary.json deleted file mode 100644 index ed6c0ff6d..000000000 --- a/org.hl7.fhir.convertors/src/test/resources/auditevent_40_with_base64binary.json +++ /dev/null @@ -1,122 +0,0 @@ -{ - "resourceType": "AuditEvent", - "id": "example", - "text": { - "status": "generated", - "div": "
Application Start for under service login "Grahame" (id: Grahame's Test HL7Connect)
" - }, - "type": { - "system": "http://dicom.nema.org/resources/ontology/DCM", - "code": "110100", - "display": "Application Activity" - }, - "subtype": [ - { - "system": "http://dicom.nema.org/resources/ontology/DCM", - "code": "110120", - "display": "Application Start" - } - ], - "action": "E", - "recorded": "2012-10-25T22:04:27+11:00", - "outcome": "0", - "agent": [ - { - "type": { - "coding": [ - { - "system": "http://terminology.hl7.org/CodeSystem/extra-security-role-type", - "code": "humanuser", - "display": "human user" - } - ] - }, - "role": [ - { - "text": "Service User (Logon)" - } - ], - "who": { - "identifier": { - "value": "Grahame" - } - }, - "requestor": false, - "network": { - "address": "127.0.0.1", - "type": "2" - } - }, - { - "type": { - "coding": [ - { - "system": "http://dicom.nema.org/resources/ontology/DCM", - "code": "110153", - "display": "Source Role ID" - } - ] - }, - "who": { - "identifier": { - "system": "urn:oid:2.16.840.1.113883.4.2", - "value": "2.16.840.1.113883.4.2" - } - }, - "altId": "6580", - "requestor": false, - "network": { - "address": "Workstation1.ehr.familyclinic.com", - "type": "1" - } - } - ], - "source": { - "site": "Development", - "observer": { - "display": "Grahame's Laptop" - }, - "type": [ - { - "system": "http://dicom.nema.org/resources/ontology/DCM", - "code": "110122", - "display": "Login" - } - ] - }, - "entity": [ - { - "what": { - "identifier": { - "type": { - "coding": [ - { - "system": "http://terminology.hl7.org/CodeSystem/v2-0203", - "code": "SNO" - } - ], - "text": "Dell Serial Number" - }, - "value": "ABCDEF" - } - }, - "type": { - "system": "http://terminology.hl7.org/CodeSystem/audit-entity-type", - "code": "4", - "display": "Other" - }, - "role": { - "system": "http://terminology.hl7.org/CodeSystem/object-role", - "code": "4", - "display": "Domain Resource" - }, - "lifecycle": { - "system": "http://terminology.hl7.org/CodeSystem/dicom-audit-lifecycle", - "code": "6", - "display": "Access / Use" - }, - "name": "Grahame's Laptop", - "query" : "dGhpcyBpcyB2YWxpZCBiYXNlNjQ=" - } - ] -} \ No newline at end of file diff --git a/org.hl7.fhir.convertors/src/test/resources/auditevent_40_with_base64binary.xml b/org.hl7.fhir.convertors/src/test/resources/auditevent_40_with_base64binary.xml new file mode 100644 index 000000000..812edeb05 --- /dev/null +++ b/org.hl7.fhir.convertors/src/test/resources/auditevent_40_with_base64binary.xml @@ -0,0 +1,95 @@ + + + + + + +
Application Start for under service login "Grahame" (id: Grahame's Test HL7Connect)
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/org.hl7.fhir.convertors/src/test/resources/auditevent_40_with_invalid_base64binary.json b/org.hl7.fhir.convertors/src/test/resources/auditevent_40_with_invalid_base64binary.json deleted file mode 100644 index 146cb7520..000000000 --- a/org.hl7.fhir.convertors/src/test/resources/auditevent_40_with_invalid_base64binary.json +++ /dev/null @@ -1,122 +0,0 @@ -{ - "resourceType": "AuditEvent", - "id": "example", - "text": { - "status": "generated", - "div": "
Application Start for under service login "Grahame" (id: Grahame's Test HL7Connect)
" - }, - "type": { - "system": "http://dicom.nema.org/resources/ontology/DCM", - "code": "110100", - "display": "Application Activity" - }, - "subtype": [ - { - "system": "http://dicom.nema.org/resources/ontology/DCM", - "code": "110120", - "display": "Application Start" - } - ], - "action": "E", - "recorded": "2012-10-25T22:04:27+11:00", - "outcome": "0", - "agent": [ - { - "type": { - "coding": [ - { - "system": "http://terminology.hl7.org/CodeSystem/extra-security-role-type", - "code": "humanuser", - "display": "human user" - } - ] - }, - "role": [ - { - "text": "Service User (Logon)" - } - ], - "who": { - "identifier": { - "value": "Grahame" - } - }, - "requestor": false, - "network": { - "address": "127.0.0.1", - "type": "2" - } - }, - { - "type": { - "coding": [ - { - "system": "http://dicom.nema.org/resources/ontology/DCM", - "code": "110153", - "display": "Source Role ID" - } - ] - }, - "who": { - "identifier": { - "system": "urn:oid:2.16.840.1.113883.4.2", - "value": "2.16.840.1.113883.4.2" - } - }, - "altId": "6580", - "requestor": false, - "network": { - "address": "Workstation1.ehr.familyclinic.com", - "type": "1" - } - } - ], - "source": { - "site": "Development", - "observer": { - "display": "Grahame's Laptop" - }, - "type": [ - { - "system": "http://dicom.nema.org/resources/ontology/DCM", - "code": "110122", - "display": "Login" - } - ] - }, - "entity": [ - { - "what": { - "identifier": { - "type": { - "coding": [ - { - "system": "http://terminology.hl7.org/CodeSystem/v2-0203", - "code": "SNO" - } - ], - "text": "Dell Serial Number" - }, - "value": "ABCDEF" - } - }, - "type": { - "system": "http://terminology.hl7.org/CodeSystem/audit-entity-type", - "code": "4", - "display": "Other" - }, - "role": { - "system": "http://terminology.hl7.org/CodeSystem/object-role", - "code": "4", - "display": "Domain Resource" - }, - "lifecycle": { - "system": "http://terminology.hl7.org/CodeSystem/dicom-audit-lifecycle", - "code": "6", - "display": "Access / Use" - }, - "name": "Grahame's Laptop", - "query" : "Picard was the best starship captain" - } - ] -} \ No newline at end of file diff --git a/org.hl7.fhir.convertors/src/test/resources/auditevent_40_with_invalid_base64binary.xml b/org.hl7.fhir.convertors/src/test/resources/auditevent_40_with_invalid_base64binary.xml new file mode 100644 index 000000000..812edeb05 --- /dev/null +++ b/org.hl7.fhir.convertors/src/test/resources/auditevent_40_with_invalid_base64binary.xml @@ -0,0 +1,95 @@ + + + + + + +
Application Start for under service login "Grahame" (id: Grahame's Test HL7Connect)
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/org.hl7.fhir.convertors/src/test/resources/auditevent_50_with_base64binary.json b/org.hl7.fhir.convertors/src/test/resources/auditevent_50_with_base64binary.json deleted file mode 100644 index 5bd96899f..000000000 --- a/org.hl7.fhir.convertors/src/test/resources/auditevent_50_with_base64binary.json +++ /dev/null @@ -1,117 +0,0 @@ -{ - "resourceType": "AuditEvent", - "id": "example", - "text": { - "status": "generated", - "div": "
Application Start for under service login "Grahame" (id: Grahame's Test HL7Connect)
" - }, - "category": [ - { - "coding": [ - { - "system": "http://dicom.nema.org/resources/ontology/DCM", - "code": "110100", - "display": "Application Activity" - } - ] - } - ], - "code": { - "coding": [ - { - "system": "http://dicom.nema.org/resources/ontology/DCM", - "code": "110120", - "display": "Application Start" - } - ] - }, - "action": "E", - "recorded": "2012-10-25T22:04:27+11:00", - "outcome": { - "code": { - "system": "http://terminology.hl7.org/CodeSystem/audit-event-outcome", - "code": "0", - "display": "Success" - } - }, - "agent": [ - { - "role": [ - { - "text": "Service User (Logon)" - } - ], - "who": { - "identifier": { - "value": "Grahame" - } - }, - "requestor": false - }, - { - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/auditevent-AlternativeUserID", - "valueIdentifier": { - "type": { - "text": "process ID" - }, - "value": "6580" - } - } - ], - "who": { - "identifier": { - "system": "urn:oid:2.16.840.1.113883.4.2", - "value": "2.16.840.1.113883.4.2" - } - }, - "requestor": false, - "networkString": "Workstation1.ehr.familyclinic.com" - } - ], - "source": { - "observer": { - "display": "Grahame's Laptop" - }, - "type": [ - { - "coding": [ - { - "system": "http://dicom.nema.org/resources/ontology/DCM", - "code": "110122", - "display": "Login" - } - ] - } - ] - }, - "entity": [ - { - "what": { - "identifier": { - "type": { - "coding": [ - { - "system": "http://terminology.hl7.org/CodeSystem/v2-0203", - "code": "SNO" - } - ], - "text": "Dell Serial Number" - }, - "value": "ABCDEF" - } - }, - "role": { - "coding": [ - { - "system": "http://terminology.hl7.org/CodeSystem/object-role", - "code": "4", - "display": "Domain Resource" - } - ] - }, - "query" : "dGhpcyBpcyB2YWxpZCBiYXNlNjQ=" - } - ] -} \ No newline at end of file diff --git a/org.hl7.fhir.convertors/src/test/resources/auditevent_50_with_base64binary.xml b/org.hl7.fhir.convertors/src/test/resources/auditevent_50_with_base64binary.xml new file mode 100644 index 000000000..3730ef7cd --- /dev/null +++ b/org.hl7.fhir.convertors/src/test/resources/auditevent_50_with_base64binary.xml @@ -0,0 +1,100 @@ + + + + + + +
Application Start for under service login "Grahame" (id: Grahame's Test HL7Connect)
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/model/Base64BinaryType.java b/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/model/Base64BinaryType.java index b4c3d5293..99b7f325d 100644 --- a/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/model/Base64BinaryType.java +++ b/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/model/Base64BinaryType.java @@ -130,7 +130,7 @@ public class Base64BinaryType extends PrimitiveType implements IPrimitiv @Override public Base64BinaryType setValue(byte[] theValue) throws IllegalArgumentException { myValue = theValue; - return this; + return (Base64BinaryType) super.setValue(theValue); } @Override diff --git a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/model/Base64BinaryType.java b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/model/Base64BinaryType.java index f51356a52..7cdceedf7 100644 --- a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/model/Base64BinaryType.java +++ b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/model/Base64BinaryType.java @@ -130,7 +130,7 @@ public class Base64BinaryType extends PrimitiveType implements IPrimitiv @Override public Base64BinaryType setValue(byte[] theValue) throws IllegalArgumentException { myValue = theValue; - return this; + return (Base64BinaryType) super.setValue(theValue); } @Override diff --git "a/org.hl7.fhir.r4b/c:\\temp\\test.xml" "b/org.hl7.fhir.r4b/c:\\temp\\test.xml" new file mode 100644 index 000000000..990c09b35 --- /dev/null +++ "b/org.hl7.fhir.r4b/c:\\temp\\test.xml" @@ -0,0 +1 @@ +
Sample Contract Lens prescription
\ No newline at end of file diff --git a/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/model/Base64BinaryType.java b/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/model/Base64BinaryType.java index 4f413fbd5..a1c73f821 100644 --- a/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/model/Base64BinaryType.java +++ b/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/model/Base64BinaryType.java @@ -129,7 +129,7 @@ public class Base64BinaryType extends PrimitiveType implements IPrimitiv @Override public Base64BinaryType setValue(byte[] theValue) throws IllegalArgumentException { myValue = theValue; - return this; + return (Base64BinaryType) super.setValue(theValue); } @Override diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Base64BinaryType.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Base64BinaryType.java index 66473144b..4e83d1a8b 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Base64BinaryType.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Base64BinaryType.java @@ -129,7 +129,7 @@ public class Base64BinaryType extends PrimitiveType implements IPrimitiv @Override public Base64BinaryType setValue(byte[] theValue) throws IllegalArgumentException { myValue = theValue; - return this; + return (Base64BinaryType) super.setValue(theValue); } @Override