Improves performance of inprocess testing (#442).

This commit works only hadoop1.
Merge remote-tracking branch 'private/issue/442-M0' into 0.7-develop
Refactor #442.
Merge remote-tracking branch 'private/issue/442-M2' into 0.7-develop