Hello Guys, I am trying to write a unit test for my first camel route. Below is my camel route: I am updating the database using jdbc component. Also,can you guys tell me is the below route the right way to update the database?
DataSource ds = this.getContext().getRegistry() .lookup("oracleDataSource", DataSource.class); final JdbcTemplate jdbc = new JdbcTemplate(ds); from("timer://foo?period=5000") .setBody(constant("select * from customers where last_changed_date >= trunc(sysdate)")) .to("jdbc:oracleDataSource").process(new Processor() { @Override public void process(Exchange exchange) throws Exception { ArrayList<HashMap<String, Object>> data = exchange .getIn().getBody(ArrayList.class); for (HashMap<String, Object> item : data) { System.out.println("Hitting Database::::::::::::" + ((String) item.get("STATE_ABBREVIATION"))); jdbc.execute("update Orders set Order_Date =" + "to_date('" + (Date) item.get("O_DATE") + "'," + "'YYYY-MM-DD')" + " where order_number = " + (BigDecimal) item.get("O_NUMBER") ); System.out.println("UPDATE DONE**********************"); } } }); -- View this message in context: http://camel.465427.n5.nabble.com/Where-to-start-with-Unit-testing-tp5729044.html Sent from the Camel - Users mailing list archive at Nabble.com.