Condensation and thermalization of classsical optical waves in a waveguide