本文整理汇总了Golang中github.com/cloudfoundry/gorouter/registry.RouteRegistry.Lookup方法的典型用法代码示例。如果您正苦于以下问题:Golang RouteRegistry.Lookup方法的具体用法?Golang RouteRegistry.Lookup怎么用?Golang RouteRegistry.Lookup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry/gorouter/registry.RouteRegistry
的用法示例。
在下文中一共展示了RouteRegistry.Lookup方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: waitMsgReceived
func waitMsgReceived(registry *registry.RouteRegistry, app *test.TestApp, expectedToBeFound bool, timeout time.Duration) bool {
interval := time.Millisecond * 50
repetitions := int(timeout / interval)
for j := 0; j < repetitions; j++ {
if j > 0 {
time.Sleep(interval)
}
received := true
for _, url := range app.Urls() {
pool := registry.Lookup(url)
if expectedToBeFound && pool == nil {
received = false
break
} else if !expectedToBeFound && pool != nil {
received = false
break
}
}
if received {
return true
}
}
return false
}
示例2: appUnregistered
func appUnregistered(registry *registry.RouteRegistry, app *common.TestApp) bool {
for _, url := range app.Urls() {
pool := registry.Lookup(url)
if pool != nil {
return false
}
}
return true
}
示例3: readVarz
{
"dea": "dea1",
"app": "app1",
"uris": [
"test.com"
],
"host": "1.2.3.4",
"port": 65536,
"private_instance_id": "private_instance_id"
}
`))
})
It("does not add the route to the route table", func() {
// Pool.IsEmpty() is better but the pool is not intialized yet
Consistently(func() *route.Pool { return registry.Lookup("test.com") }).Should(BeZero())
})
})
})
})
func readVarz(v vvarz.Varz) map[string]interface{} {
varz_byte, err := v.MarshalJSON()
Expect(err).ToNot(HaveOccurred())
varz_data := make(map[string]interface{})
err = json.Unmarshal(varz_byte, &varz_data)
Expect(err).ToNot(HaveOccurred())
return varz_data
}