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
The following commit(s) were added to refs/heads/master by this push: new 4c3785e Fixed CS 4c3785e is described below commit 4c3785e1ec99052a286d31a59558728c14b6fb74 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Tue Aug 21 08:40:08 2018 +0200 Fixed CS --- .../main/java/sample/camel/MyCamelApplication.java | 2 + .../src/main/java/sample/camel/MyCamelRouter.java | 50 +++++++++++----------- .../java/sample/camel/MyCamelApplicationTest.java | 4 +- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/examples/camel-example-fhir-auth-tx-spring-boot/src/main/java/sample/camel/MyCamelApplication.java b/examples/camel-example-fhir-auth-tx-spring-boot/src/main/java/sample/camel/MyCamelApplication.java index 36020f2..4a96e18 100644 --- a/examples/camel-example-fhir-auth-tx-spring-boot/src/main/java/sample/camel/MyCamelApplication.java +++ b/examples/camel-example-fhir-auth-tx-spring-boot/src/main/java/sample/camel/MyCamelApplication.java @@ -22,6 +22,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; /** * A sample Spring Boot application that starts the Camel routes. */ +// CHECKSTYLE:OFF @SpringBootApplication public class MyCamelApplication { @@ -33,3 +34,4 @@ public class MyCamelApplication { } } +// CHECKSTYLE:ON \ No newline at end of file diff --git a/examples/camel-example-fhir-auth-tx-spring-boot/src/main/java/sample/camel/MyCamelRouter.java b/examples/camel-example-fhir-auth-tx-spring-boot/src/main/java/sample/camel/MyCamelRouter.java index 44313a6..fa0b077 100644 --- a/examples/camel-example-fhir-auth-tx-spring-boot/src/main/java/sample/camel/MyCamelRouter.java +++ b/examples/camel-example-fhir-auth-tx-spring-boot/src/main/java/sample/camel/MyCamelRouter.java @@ -16,17 +16,15 @@ */ package sample.camel; -import org.apache.camel.builder.RouteBuilder; - import java.util.ArrayList; import java.util.List; import org.apache.camel.LoggingLevel; +import org.apache.camel.builder.RouteBuilder; import org.apache.http.ProtocolException; import org.hl7.fhir.dstu3.model.Patient; import org.springframework.stereotype.Component; - /** * A simple Camel route that triggers from a file and pushes to a FHIR server. * <p/> @@ -38,29 +36,29 @@ public class MyCamelRouter extends RouteBuilder { @Override public void configure() throws Exception { from("file:{{input}}").routeId("fhir-example") - .onException(ProtocolException.class) - .handled(true) - .log(LoggingLevel.ERROR, "Error connecting to FHIR server with URL:{{serverUrl}}, please check the application.properties file ${exception.message}") - .end() - .log("Converting ${file:name}") - .unmarshal().csv() - .process(exchange -> { - List<Patient> bundle = new ArrayList<>(); - @SuppressWarnings("unchecked") - List<List<String>> patients = (List<List<String>>) exchange.getIn().getBody(); - for (List<String> patient: patients) { - Patient fhirPatient = new Patient(); - fhirPatient.setId(patient.get(0)); - fhirPatient.addName().addGiven(patient.get(1)); - fhirPatient.getNameFirstRep().setFamily(patient.get(2)); - bundle.add(fhirPatient); - } - exchange.getIn().setBody(bundle); - }) - // create Patient in our FHIR server - .to("fhir://transaction/withResources?inBody=resources&serverUrl={{serverUrl}}&username={{serverUser}}&password={{serverPassword}}&fhirVersion={{fhirVersion}}") - // log the outcome - .log("Patients created successfully: ${body}"); + .onException(ProtocolException.class) + .handled(true) + .log(LoggingLevel.ERROR, "Error connecting to FHIR server with URL:{{serverUrl}}, please check the application.properties file ${exception.message}") + .end() + .log("Converting ${file:name}") + .unmarshal().csv() + .process(exchange -> { + List<Patient> bundle = new ArrayList<>(); + @SuppressWarnings("unchecked") + List<List<String>> patients = (List<List<String>>) exchange.getIn().getBody(); + for (List<String> patient: patients) { + Patient fhirPatient = new Patient(); + fhirPatient.setId(patient.get(0)); + fhirPatient.addName().addGiven(patient.get(1)); + fhirPatient.getNameFirstRep().setFamily(patient.get(2)); + bundle.add(fhirPatient); + } + exchange.getIn().setBody(bundle); + }) + // create Patient in our FHIR server + .to("fhir://transaction/withResources?inBody=resources&serverUrl={{serverUrl}}&username={{serverUser}}&password={{serverPassword}}&fhirVersion={{fhirVersion}}") + // log the outcome + .log("Patients created successfully: ${body}"); } } diff --git a/examples/camel-example-fhir-auth-tx-spring-boot/src/test/java/sample/camel/MyCamelApplicationTest.java b/examples/camel-example-fhir-auth-tx-spring-boot/src/test/java/sample/camel/MyCamelApplicationTest.java index 470e87e..515c417 100644 --- a/examples/camel-example-fhir-auth-tx-spring-boot/src/test/java/sample/camel/MyCamelApplicationTest.java +++ b/examples/camel-example-fhir-auth-tx-spring-boot/src/test/java/sample/camel/MyCamelApplicationTest.java @@ -47,8 +47,8 @@ public class MyCamelApplicationTest { @Test public void shouldPushConvertedCsvtoFhir() throws Exception { - mock.expectedMessageCount(1); - + mock.expectedMessageCount(1); + mock.assertIsSatisfied(); }