Fixed adopt failure for stack with resource group

Added support to adopt a resource group and corresponding
unit test.

Change-Id: Icfeff0e30a9c4bd7fa0279e156709e078b81fcab
Closes-bug: #1353942
Merge "Fixed adopt failure for stack with resource group"