The TOF counters of the AMS-02 experiment: Space qualification tests and beam test results