func (resourceSuite) TestStringResource(c *gc.C) { rs := common.NewResources() r1 := common.StringResource("foobar") id := rs.Register(r1) c.Check(rs.Get(id), gc.Equals, r1) asStr := rs.Get(id).(common.StringResource).String() c.Check(asStr, gc.Equals, "foobar") }
// newSrvRoot creates the client's connection representation // and starts a ping timeout for the monitoring of this // connection. func newSrvRoot(root *initialRoot, entity taggedAuthenticator) *srvRoot { r := &srvRoot{ srv: root.srv, rpcConn: root.rpcConn, resources: common.NewResources(), entity: entity, } r.resources.RegisterNamed("dataDir", common.StringResource(r.srv.dataDir)) r.clientAPI.API = client.NewAPI(r.srv.state, r.resources, r) return r }