本文整理汇总了Golang中github.com/cloudfoundry-incubator/bbs.ServiceClient类的典型用法代码示例。如果您正苦于以下问题:Golang ServiceClient类的具体用法?Golang ServiceClient怎么用?Golang ServiceClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ServiceClient类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: SpinUp
func (f *FakeCell) SpinUp(serviceClient bbs.ServiceClient) {
//make a test-friendly AuctionRepDelegate using the auction package's SimulationRepDelegate
f.SimulationRep = simulationrep.New(f.stack, "Z0", rep.Resources{
DiskMB: 100,
MemoryMB: 100,
Containers: 100,
})
//spin up an http auction server
logger := lager.NewLogger(f.cellID)
logger.RegisterSink(lager.NewWriterSink(GinkgoWriter, lager.INFO))
fakeLRPStopper := new(fake_lrp_stopper.FakeLRPStopper)
fakeExecutorClient := new(executorfakes.FakeClient)
fakeEvacuatable := new(fake_evacuation_context.FakeEvacuatable)
handlers := rephandlers.New(f.SimulationRep, fakeLRPStopper, fakeExecutorClient, fakeEvacuatable, logger)
router, err := rata.NewRouter(rep.Routes, handlers)
Expect(err).NotTo(HaveOccurred())
f.server = httptest.NewServer(router)
presence := models.NewCellPresence(
f.cellID,
f.server.URL,
"az1",
models.NewCellCapacity(512, 1024, 124),
[]string{},
[]string{})
f.heartbeater = ifrit.Invoke(serviceClient.NewCellPresenceRunner(logger, &presence, time.Second))
}
示例2: initializeLockMaintainer
func initializeLockMaintainer(logger lager.Logger, serviceClient bbs.ServiceClient) ifrit.Runner {
uuid, err := uuid.NewV4()
if err != nil {
logger.Fatal("Couldn't generate uuid", err)
}
if *advertiseURL == "" {
logger.Fatal("Advertise URL must be specified", nil)
}
bbsPresence := models.NewBBSPresence(uuid.String(), *advertiseURL)
lockMaintainer, err := serviceClient.NewBBSLockRunner(logger, &bbsPresence, *lockRetryInterval)
if err != nil {
logger.Fatal("Couldn't create lock maintainer", err)
}
return lockMaintainer
}
示例3: fetchCells
func fetchCells(logger lager.Logger, serviceClient bbs.ServiceClient) func() (models.CellSet, error) {
return func() (models.CellSet, error) {
return serviceClient.Cells(logger)
}
}
示例4:
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
. "github.com/onsi/gomega/gexec"
"github.com/onsi/gomega/ghttp"
)
var runner *testrunner.Runner
var _ = Describe("The Rep", func() {
var (
fakeGarden *ghttp.Server
serviceClient bbs.ServiceClient
pollingInterval time.Duration
evacuationTimeout time.Duration
rootFSName string
rootFSPath string
logger *lagertest.TestLogger
flushEvents chan struct{}
)
var getActualLRPGroups = func() []*models.ActualLRPGroup {
actualLRPGroups, err := bbsClient.ActualLRPGroups(models.ActualLRPFilter{})
Expect(err).NotTo(HaveOccurred())
return actualLRPGroups
}
BeforeEach(func() {
Eventually(getActualLRPGroups, 5*pollingInterval).Should(BeEmpty())
flushEvents = make(chan struct{})
示例5:
"os"
"github.com/cloudfoundry-incubator/bbs"
"github.com/cloudfoundry-incubator/bbs/models"
"github.com/cloudfoundry-incubator/locket"
"github.com/pivotal-golang/clock"
"github.com/tedsuo/ifrit"
"github.com/tedsuo/ifrit/ginkgomon"
"github.com/tedsuo/ifrit/grouper"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("ServiceClient", func() {
var serviceClient bbs.ServiceClient
BeforeEach(func() {
serviceClient = bbs.NewServiceClient(consulSession, clock.NewClock())
})
Describe("CellById", func() {
const cellID = "cell-id"
Context("when the cell exists", func() {
It("returns the correct CellPresence", func() {
cellPresence := newCellPresence(cellID)
consulHelper.RegisterCell(cellPresence)
presence, err := serviceClient.CellById(logger, cellID)
Expect(err).NotTo(HaveOccurred())
Expect(presence).To(BeEquivalentTo(cellPresence))