refactoring and simple test for metadata service
Merge pull request #11 from asobolev/master

refactoring and simple test for metadata service

LGTM