Fixes for namespace manager unit tests

Fixes memory leaks
Add unit test for the task queue mechanism

Change-Id: Ia9e2009325c277867170f84887242971c178819a