Thai military holds ceremony to swear allegiance to king