Moved most thread entity mappings to xml.

Test db is dropped on init now.