fhir-auth-tx: fix bundle resource transaction as endpoint
diff --git a/fhir-auth-tx/src/main/java/sample/camel/MyCamelRouter.java b/fhir-auth-tx/src/main/java/sample/camel/MyCamelRouter.java
index 583e466..84568b2 100644
--- a/fhir-auth-tx/src/main/java/sample/camel/MyCamelRouter.java
+++ b/fhir-auth-tx/src/main/java/sample/camel/MyCamelRouter.java
@@ -22,7 +22,12 @@
 import org.apache.camel.LoggingLevel;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.http.ProtocolException;
+
+import org.hl7.fhir.dstu3.model.Bundle;
+import org.hl7.fhir.dstu3.model.Identifier;
 import org.hl7.fhir.dstu3.model.Patient;
+import org.hl7.fhir.dstu3.model.Resource;
+import org.hl7.fhir.instance.model.api.IBaseResource;
 import org.springframework.stereotype.Component;
 
 /**
@@ -36,29 +41,34 @@
     @Override
     public void configure() throws Exception {
         from("file:{{input}}").routeId("fhir-example")
-            .onException(ProtocolException.class)
+                .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}");
+                .end()
+                .log("Converting ${file:name}")
+                .unmarshal().csv()
+                .process(exchange -> {
+
+                    Bundle bundleTest = new Bundle();
+                    bundleTest.setId("bundle-simplified-001");
+                    bundleTest.setIdentifier(new Identifier().setValue("001"));
+                    bundleTest.setType(org.hl7.fhir.dstu3.model.Bundle.BundleType.TRANSACTION);
+
+                    @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));
+                        bundleTest.addEntry().setResource(fhirPatient).getRequest().setMethod(Bundle.HTTPVerb.POST);
+                    }
+                    exchange.getIn().setBody(bundleTest);
+                })
+                // create Patient in our FHIR server
+                .to("fhir://transaction/withBundle?inBody=bundle&serverUrl={{serverUrl}}&username={{serverUser}}&password={{serverPassword}}&fhirVersion={{fhirVersion}}")
+                // log the outcome
+                .log("Patients created successfully: ${body}");
     }
 
 }
diff --git a/fhir-auth-tx/src/test/java/sample/camel/MyCamelApplicationTest.java b/fhir-auth-tx/src/test/java/sample/camel/MyCamelApplicationTest.java
index a33a16c..e3726be 100644
--- a/fhir-auth-tx/src/test/java/sample/camel/MyCamelApplicationTest.java
+++ b/fhir-auth-tx/src/test/java/sample/camel/MyCamelApplicationTest.java
@@ -38,7 +38,7 @@
 
     @Test
     public void shouldPushConvertedHl7toFhir() throws Exception {
-        MockEndpoint mock = camelContext.getEndpoint("mock:fhir:transaction/withResources", MockEndpoint.class);
+        MockEndpoint mock = camelContext.getEndpoint("mock:fhir:transaction/withBundle", MockEndpoint.class);
         mock.expectedMessageCount(1);
 
         FileUtils.copyDirectory(new File("src/main/data"), new File("target/work/fhir/testinput"));