China has said the Liaoning was on an exercise to test weapons and equipment in the disputed South China Sea and its movements complied with international law.