Fix the functional tests

Now works with any storage provider (ie doesnt depend just on mockdb, and will now work with cassandra),
and without relying on a network connection to providers.

Change-Id: I7be75a8525b0eebeca9761c4c60ad70e088386c6
Merge "Fix the functional tests"