India stepped up preparations for the semi-finals as Rohit Sharma and KL Rahul's centuries set up a seven-wicket win over Sri Lanka.