當前位置: 首頁>>代碼示例>>Golang>>正文


Golang bbs.ServiceClient類代碼示例

本文整理匯總了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))
}
開發者ID:emc-xchallenge,項目名稱:auctioneer,代碼行數:31,代碼來源:fake_cell_test.go

示例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
}
開發者ID:emc-xchallenge,項目名稱:bbs,代碼行數:18,代碼來源:main.go

示例3: fetchCells

func fetchCells(logger lager.Logger, serviceClient bbs.ServiceClient) func() (models.CellSet, error) {
	return func() (models.CellSet, error) {
		return serviceClient.Cells(logger)
	}
}
開發者ID:emc-xchallenge,項目名稱:rep,代碼行數:5,代碼來源:main_test.go

示例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{})
開發者ID:emc-xchallenge,項目名稱:rep,代碼行數:31,代碼來源:main_test.go

示例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))
開發者ID:emc-xchallenge,項目名稱:bbs,代碼行數:31,代碼來源:service_client_test.go


注:本文中的github.com/cloudfoundry-incubator/bbs.ServiceClient類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。