Refactored batch tests to use CountDownLatch

Arun, take a look if this is ok with you.