本文整理汇总了Golang中github.com/juju/juju/state.Living类的典型用法代码示例。如果您正苦于以下问题:Golang Living类的具体用法?Golang Living怎么用?Golang Living使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Living类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: prepareFixture
func (s *LifeSuite) prepareFixture(living state.Living, lfix lifeFixture, cached, dbinitial state.Life, c *gc.C) {
collName, id := lfix.id()
coll := s.MgoSuite.Session.DB("juju").C(collName)
err := coll.UpdateId(id, bson.D{{"$set", bson.D{
{"life", cached},
}}})
c.Assert(err, jc.ErrorIsNil)
err = living.Refresh()
c.Assert(err, jc.ErrorIsNil)
err = coll.UpdateId(id, bson.D{{"$set", bson.D{
{"life", dbinitial},
}}})
c.Assert(err, jc.ErrorIsNil)
}
示例2: assertRemoved
func assertRemoved(c *gc.C, entity state.Living) {
err := entity.Refresh()
c.Assert(err, jc.Satisfies, errors.IsNotFound)
err = entity.Destroy()
c.Assert(err, jc.ErrorIsNil)
if entity, ok := entity.(state.AgentLiving); ok {
err = entity.EnsureDead()
c.Assert(err, jc.ErrorIsNil)
err = entity.Remove()
c.Assert(err, jc.ErrorIsNil)
}
}
示例3: assertLife
func assertLife(c *gc.C, entity state.Living, life state.Life) {
err := entity.Refresh()
c.Assert(err, jc.ErrorIsNil)
c.Assert(entity.Life(), gc.Equals, life)
}
示例4: assertLife
func assertLife(c *gc.C, entity state.Living, life state.Life) {
c.Assert(entity.Refresh(), gc.IsNil)
c.Assert(entity.Life(), gc.Equals, life)
}
示例5: assertRemoved
func assertRemoved(c *gc.C, entity state.Living) {
err := entity.Refresh()
c.Assert(err, jc.Satisfies, errors.IsNotFound)
}