Hi guys, I was wondering if someone could give me some help out how to re-write this camel test into a proper camel program. The issue is I know how to write a simple route and then execute it. But after the route is executed and I want to grab the parsed xml in a fashion similar to testStaxExpression how would I do this in a real Camel application. I know the configure method in the route is not the right place to do it.
Where is the right place. Sorry for the easy questions. I am a beginner. package org.apache.camel.component.stax; import org.apache.camel.EndpointInject; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.component.stax.model.Record; import org.apache.camel.component.stax.model.RecordsUtil; import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.BeforeClass; import org.junit.Test; import static org.apache.camel.component.stax.StAXBuilder.stax; public class StAXJAXBIteratorExpressionTest extends CamelTestSupport { @EndpointInject(uri = "mock:records") private MockEndpoint recordsEndpoint; @BeforeClass public static void initRouteExample() { RecordsUtil.createXMLFile(); } @Override public RouteBuilder createRouteBuilder() { return new RouteBuilder() { @Override public void configure() throws Exception { log.info("Doing route"); // START SNIPPET: e1 from("file:target/in") // split the file using StAX (the stax method is from StAXBuilder) // and use streaming mode in the splitter .split(stax(Record.class)).streaming() .to("mock:records"); // END SNIPPET: e1 } }; } @Test public void testStaxExpression() throws InterruptedException { recordsEndpoint.expectedMessageCount(10); recordsEndpoint.allMessages().body().isInstanceOf(Record.class); recordsEndpoint.assertIsSatisfied(); Record five = recordsEndpoint.getReceivedExchanges().get(4).getIn().getBody(Record.class); assertEquals("4", five.getKey()); assertEquals("#4", five.getValue()); } } -- View this message in context: http://camel.465427.n5.nabble.com/Help-to-re-write-route-tp5741339.html Sent from the Camel - Users mailing list archive at Nabble.com.