Fix resource unit test and support without resource id