예제 #1
0
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")
}
예제 #2
0
파일: root.go 프로젝트: rogpeppe/juju
// 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
}
예제 #3
0
파일: root.go 프로젝트: jimmiebtlr/juju
// newSrvRoot creates the client's connection representation
// and starts a ping timeout for the monitoring of this
// connection.
func newSrvRoot(root *initialRoot, entity state.Entity) *srvRoot {
	r := &srvRoot{
		state:       root.srv.state,
		rpcConn:     root.rpcConn,
		resources:   common.NewResources(),
		entity:      entity,
		objectCache: make(map[objectKey]reflect.Value),
	}
	r.resources.RegisterNamed("dataDir", common.StringResource(root.srv.dataDir))
	return r
}