This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit f1f0c69a83eafbd88f24526cc550869caa9cf9a8 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Tue Mar 6 13:13:17 2018 +0100 Fixed tests --- .../component/fhir/FhirJsonDataFormatSpringTest.java | 13 ++++++++++--- .../camel/component/fhir/FhirJsonDataFormatTest.java | 15 ++++++++++----- .../camel/component/fhir/FhirXmlDataFormatSpringTest.java | 13 ++++++++++--- .../camel/component/fhir/FhirXmlDataFormatTest.java | 15 ++++++++++----- .../camel/component/fhir/Hl7v2PatientToFhirPatientIT.java | 8 +++++--- 5 files changed, 45 insertions(+), 19 deletions(-) diff --git a/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/FhirJsonDataFormatSpringTest.java b/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/FhirJsonDataFormatSpringTest.java index 87575fe..e2a43f9 100644 --- a/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/FhirJsonDataFormatSpringTest.java +++ b/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/FhirJsonDataFormatSpringTest.java @@ -49,8 +49,12 @@ public class FhirJsonDataFormatSpringTest extends CamelSpringTestSupport { @Test public void unmarshal() throws Exception { - template.sendBody("direct:unmarshal", PATIENT); mockEndpoint.expectedMessageCount(1); + + template.sendBody("direct:unmarshal", PATIENT); + + mockEndpoint.assertIsSatisfied(); + Exchange exchange = mockEndpoint.getExchanges().get(0); Patient patient = (Patient) exchange.getIn().getBody(); assertTrue("Patients should be equal!", patient.equalsDeep(getPatient())); @@ -58,10 +62,13 @@ public class FhirJsonDataFormatSpringTest extends CamelSpringTestSupport { @Test public void marshal() throws Exception { - Patient patient = getPatient(); mockEndpoint.expectedMessageCount(1); + + Patient patient = getPatient(); template.sendBody("direct:marshal", patient); - mockEndpoint.expectedMessageCount(1); + + mockEndpoint.assertIsSatisfied(); + Exchange exchange = mockEndpoint.getExchanges().get(0); InputStream inputStream = exchange.getIn().getBody(InputStream.class); IBaseResource iBaseResource = FhirContext.forDstu3().newJsonParser().parseResource(new InputStreamReader(inputStream)); diff --git a/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/FhirJsonDataFormatTest.java b/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/FhirJsonDataFormatTest.java index 4bb538c..e2ca74d 100644 --- a/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/FhirJsonDataFormatTest.java +++ b/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/FhirJsonDataFormatTest.java @@ -48,8 +48,12 @@ public class FhirJsonDataFormatTest extends CamelTestSupport { @Test public void unmarshal() throws Exception { - template.sendBody("direct:unmarshal", PATIENT); mockEndpoint.expectedMessageCount(1); + + template.sendBody("direct:unmarshal", PATIENT); + + mockEndpoint.assertIsSatisfied(); + Exchange exchange = mockEndpoint.getExchanges().get(0); Patient patient = (Patient) exchange.getIn().getBody(); assertTrue("Patients should be equal!", patient.equalsDeep(getPatient())); @@ -57,10 +61,13 @@ public class FhirJsonDataFormatTest extends CamelTestSupport { @Test public void marshal() throws Exception { - Patient patient = getPatient(); mockEndpoint.expectedMessageCount(1); + + Patient patient = getPatient(); template.sendBody("direct:marshal", patient); - mockEndpoint.expectedMessageCount(1); + + mockEndpoint.assertIsSatisfied(); + Exchange exchange = mockEndpoint.getExchanges().get(0); InputStream inputStream = exchange.getIn().getBody(InputStream.class); IBaseResource iBaseResource = FhirContext.forDstu3().newJsonParser().parseResource(new InputStreamReader(inputStream)); @@ -76,7 +83,6 @@ public class FhirJsonDataFormatTest extends CamelTestSupport { protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { public void configure() { - from("direct:marshal") .marshal().fhirJson("DSTU3") .to("mock:result"); @@ -84,7 +90,6 @@ public class FhirJsonDataFormatTest extends CamelTestSupport { from("direct:unmarshal") .unmarshal().fhirJson() .to("mock:result"); - } }; } diff --git a/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/FhirXmlDataFormatSpringTest.java b/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/FhirXmlDataFormatSpringTest.java index bc40013..f9fd05c 100644 --- a/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/FhirXmlDataFormatSpringTest.java +++ b/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/FhirXmlDataFormatSpringTest.java @@ -51,8 +51,12 @@ public class FhirXmlDataFormatSpringTest extends CamelSpringTestSupport { @Test public void unmarshal() throws Exception { - template.sendBody("direct:unmarshal", PATIENT); mockEndpoint.expectedMessageCount(1); + + template.sendBody("direct:unmarshal", PATIENT); + + mockEndpoint.assertIsSatisfied(); + Exchange exchange = mockEndpoint.getExchanges().get(0); Patient patient = (Patient) exchange.getIn().getBody(); assertTrue("Patients should be equal!", patient.equalsDeep(getPatient())); @@ -60,10 +64,13 @@ public class FhirXmlDataFormatSpringTest extends CamelSpringTestSupport { @Test public void marshal() throws Exception { - Patient patient = getPatient(); mockEndpoint.expectedMessageCount(1); + + Patient patient = getPatient(); template.sendBody("direct:marshal", patient); - mockEndpoint.expectedMessageCount(1); + + mockEndpoint.assertIsSatisfied(); + Exchange exchange = mockEndpoint.getExchanges().get(0); InputStream inputStream = exchange.getIn().getBody(InputStream.class); final IBaseResource iBaseResource = FhirContext.forDstu3().newXmlParser().parseResource(new InputStreamReader(inputStream)); diff --git a/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/FhirXmlDataFormatTest.java b/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/FhirXmlDataFormatTest.java index b340470..7b3e364 100644 --- a/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/FhirXmlDataFormatTest.java +++ b/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/FhirXmlDataFormatTest.java @@ -50,8 +50,12 @@ public class FhirXmlDataFormatTest extends CamelTestSupport { @Test public void unmarshal() throws Exception { - template.sendBody("direct:unmarshal", PATIENT); mockEndpoint.expectedMessageCount(1); + + template.sendBody("direct:unmarshal", PATIENT); + + mockEndpoint.assertIsSatisfied(); + Exchange exchange = mockEndpoint.getExchanges().get(0); Patient patient = (Patient) exchange.getIn().getBody(); assertTrue("Patients should be equal!", patient.equalsDeep(getPatient())); @@ -59,10 +63,13 @@ public class FhirXmlDataFormatTest extends CamelTestSupport { @Test public void marshal() throws Exception { - Patient patient = getPatient(); mockEndpoint.expectedMessageCount(1); + + Patient patient = getPatient(); template.sendBody("direct:marshal", patient); - mockEndpoint.expectedMessageCount(1); + + mockEndpoint.assertIsSatisfied(); + Exchange exchange = mockEndpoint.getExchanges().get(0); InputStream inputStream = exchange.getIn().getBody(InputStream.class); final IBaseResource iBaseResource = FhirContext.forDstu3().newXmlParser().parseResource(new InputStreamReader(inputStream)); @@ -78,7 +85,6 @@ public class FhirXmlDataFormatTest extends CamelTestSupport { protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { public void configure() { - from("direct:marshal") .marshal().fhirXml() .to("mock:result"); @@ -86,7 +92,6 @@ public class FhirXmlDataFormatTest extends CamelTestSupport { from("direct:unmarshal") .unmarshal().fhirXml() .to("mock:result"); - } }; } diff --git a/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/Hl7v2PatientToFhirPatientIT.java b/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/Hl7v2PatientToFhirPatientIT.java index 710e307..3641021 100644 --- a/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/Hl7v2PatientToFhirPatientIT.java +++ b/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/Hl7v2PatientToFhirPatientIT.java @@ -65,12 +65,16 @@ public class Hl7v2PatientToFhirPatientIT extends CamelTestSupport { @Test public void testUnmarshalWithExplicitUTF16Charset() throws Exception { + MockEndpoint mock = getMockEndpoint("mock:result"); + mock.setExpectedMessageCount(1); + // Message with explicit encoding in MSH String charset = "ASCII"; byte[] body = HL7_MESSAGE.getBytes(Charset.forName(charset)); template.sendBodyAndHeader("direct:input", new ByteArrayInputStream(body), Exchange.CHARSET_NAME, charset); - MockEndpoint mock = getMockEndpoint("mock:result"); + mock.assertIsSatisfied(); + final MethodOutcome results = (MethodOutcome) mock.getExchanges().get(0).getIn().getBody(); Patient patient = (Patient) results.getResource(); assertNotNull(patient); @@ -78,10 +82,8 @@ public class Hl7v2PatientToFhirPatientIT extends CamelTestSupport { } protected RouteBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { public void configure() throws Exception { - Processor patientProcessor = new PatientProcessor(client, getContext()); from("direct:input") .unmarshal(hl7) -- To stop receiving notification emails like this one, please contact davscl...@apache.org.