Fix resource unit test and support without resource id
Merge pull request #331 from shenrie/master

Fix resource unit test and support without resource id