India ended Day 1 of the Galle Test in a commanding position after centuries from Shikhar Dhawan and Cheteshwar Pujara helped the visitor's post 399 for 3 at stumps.