juju/juju — pull request #99 by jameinel (2014-06-15 11:06:18+00:00)
Title: Update all Facade implementions to call RegisterStandardFacade

This work is built on my github.com/jameinel/juju/api-versioning-2-facade-registry
The incremental diff is available here: https://github.com/jameinel/juju/pull/2
It is probably better to do inline comments over there, since it will be easier to track the incremental work.

This finally moves all of our existing Facades from having a helper method on srvRoot to being just registered Facade factories. It adds an 'init()' function to the Facades where they register version 0 of their Facade with the state/apiserver/common.Facades registry using the RegisterStandardFacade convenience function.

A couple of Facades had to have minor tweaks in order to conform to the RegisterStandardFacade functionality. Agent's New function didn't take a "resources" parameter, and Updater used some custom logic that got pulled out and mostly reused.

All of these init() functions have to be imported in order for them to be run, so it adds 'state/apiserver/allfacades.go' that just imports all known facades.

Pinger and Watcher facades were also just defined inline in root.go, they are now in their own watcher.go and pinger.go files.

TestDiscardedAPIMethods is replaced by the test (in previous branch) that iterates over the Facade registry and asserts that everything conforms to expectations. (no DiscardedAPIMethods on the officially registered functions), etc.