JSON output and tests

This pull request:

* adds JSON output for registry searches
* adds several unit and database tests for registry related code