当前位置: 首页>>代码示例>>Golang>>正文


Golang Config.SetBlobStore方法代码示例

本文整理汇总了Golang中github.com/cloudfoundry-incubator/lattice/ltc/config.Config.SetBlobStore方法的典型用法代码示例。如果您正苦于以下问题:Golang Config.SetBlobStore方法的具体用法?Golang Config.SetBlobStore怎么用?Golang Config.SetBlobStore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/cloudfoundry-incubator/lattice/ltc/config.Config的用法示例。


在下文中一共展示了Config.SetBlobStore方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1:

				err := dropletRunner.UploadBits("droplet-name", "some non-existent file")
				Expect(err).To(MatchError("open some non-existent file: no such file or directory"))
			})

			It("returns an error when the upload fails", func() {
				fakeBlobStore.UploadReturns(errors.New("some error"))

				err := dropletRunner.UploadBits("droplet-name", tmpFile.Name())
				Expect(err).To(MatchError("some error"))
			})
		})
	})

	Describe("BuildDroplet", func() {
		It("does the build droplet task", func() {
			config.SetBlobStore("blob-host", "7474", "dav-user", "dav-pass")
			Expect(config.Save()).To(Succeed())

			blobURL := fmt.Sprintf("http://%s:%[email protected]%s:%s%s",
				config.BlobStore().Username,
				config.BlobStore().Password,
				config.BlobStore().Host,
				config.BlobStore().Port,
				"/blobs/droplet-name")

			fakeBlobStore.DownloadAppBitsActionReturns(&models.DownloadAction{
				From: blobURL + "/bits.zip",
				To:   "/tmp/app",
				User: "vcap",
			})
开发者ID:datachand,项目名称:lattice,代码行数:30,代码来源:droplet_runner_test.go

示例2:

				})

				It("informs the user the target is not set", func() {
					Expect(outputBuffer).To(test_helpers.SayLine("Target not set."))
				})
			})

			Context("when no blob store is targeted", func() {
				It("should specify that no blob store is targeted", func() {
					Expect(outputBuffer).To(test_helpers.SayLine("\tNo droplet store specified."))
				})
			})

			Context("when a DAV blob store is targeted", func() {
				BeforeEach(func() {
					config.SetBlobStore("blobtarget.com", "8444", "blobUser", "password")
					Expect(config.Save()).To(Succeed())
				})

				It("outputs the current user and blob store host", func() {
					Expect(outputBuffer).To(test_helpers.SayLine("Droplet store:\[email protected]:8444"))
				})

				Context("when no blob store username is set", func() {
					BeforeEach(func() {
						config.SetBlobStore("blobtarget.com", "8444", "", "")
						Expect(config.Save()).To(Succeed())
					})

					It("only prints the blob store host", func() {
						Expect(outputBuffer).To(test_helpers.SayLine("Droplet store:\tblobtarget.com:8444"))
开发者ID:SrinivasChilveri,项目名称:lattice,代码行数:31,代码来源:config_command_factory_test.go

示例3:

		BeforeEach(func() {
			fakeDAVVerifier = &fake_blob_store_verifier.FakeVerifier{}
			fakeS3Verifier = &fake_blob_store_verifier.FakeVerifier{}
			verifier = blob_store.BlobStoreVerifier{
				DAVBlobStoreVerifier: fakeDAVVerifier,
				S3BlobStoreVerifier:  fakeS3Verifier,
			}
		})

		Context("when a dav blob store is targeted", func() {
			var config *config_package.Config

			BeforeEach(func() {
				config = config_package.New(nil)
				config.SetBlobStore("some-host", "some-port", "some-user", "some-password")
			})

			It("returns a new DavBlobStore Verifier", func() {
				verifier.Verify(config)
				Expect(fakeDAVVerifier.VerifyCallCount()).To(Equal(1))
				Expect(fakeS3Verifier.VerifyCallCount()).To(Equal(0))
			})
		})

		Context("when an s3 blob store is targeted", func() {
			var config *config_package.Config

			BeforeEach(func() {
				config = config_package.New(nil)
				config.SetS3BlobStore("", "", "some-bucket-name", "")
开发者ID:davidwadden,项目名称:lattice-release,代码行数:30,代码来源:blob_store_test.go

示例4:

			Expect(cliApp.Email).To(Equal("[email protected]"))
			Expect(cliApp.Usage).To(Equal(cli_app_factory.LtcUsage))
			Expect(cliApp.Commands).NotTo(BeEmpty())
			Expect(cliApp.Action).ToNot(BeNil())
			Expect(cliApp.CommandNotFound).ToNot(BeNil())

			By("writing to the App.Writer", func() {
				cliApp.Writer.Write([]byte("write_sample"))
				Expect(outputBuffer).To(test_helpers.Say("write_sample"))
			})

		})

		Context("when targeted at a dav blob store", func() {
			BeforeEach(func() {
				cliConfig.SetBlobStore("http://test.com", "9999", "username", "password")
			})

			It("instantiates a new dav blob store object", func() {

			})
		})

		Context("when invoked without latticeVersion set", func() {
			BeforeEach(func() {
				diegoVersion = ""
				latticeVersion = ""
			})

			It("defaults the version", func() {
				Expect(cliApp).NotTo(BeNil())
开发者ID:davidwadden,项目名称:lattice-release,代码行数:31,代码来源:cli_app_factory_test.go

示例5:

			Expect(testPersister.target).To(Equal("mysavedapi.com"))
			Expect(testConfig.Receptor()).To(Equal("http://saveduser:[email protected]"))
		})

		It("returns errors from loading the config", func() {
			testPersister.err = errors.New("Error")

			err := testConfig.Load()
			Expect(err).To(MatchError("Error"))
		})
	})

	Describe("TargetBlob", func() {
		It("sets the blob target", func() {
			testConfig.SetBlobStore("some-host", "7474", "some-username", "some-password")

			Expect(testConfig.BlobStore()).To(Equal(dav_blob_store.Config{
				Host:     "some-host",
				Port:     "7474",
				Username: "some-username",
				Password: "some-password",
			}))
		})
	})
})

type fakePersister struct {
	target   string
	username string
	password string
开发者ID:shanetreacy,项目名称:lattice,代码行数:30,代码来源:config_test.go

示例6:

					  <D:status>HTTP/1.1 200 OK</D:status>
					</D:propstat>
				  </D:response>
				</D:multistatus>
			`
			responseBodyRoot = strings.Replace(responseBodyRoot, "http://192.168.11.11:8444", fakeServer.URL(), -1)
		})

		Context("when the DAV blob store does not require auth", func() {
			It("should return authorized", func() {
				fakeServer.RouteToHandler("PROPFIND", "/blobs/", ghttp.CombineHandlers(
					ghttp.VerifyHeaderKV("Depth", "1"),
					ghttp.RespondWith(207, responseBodyRoot, http.Header{"Content-Type": []string{"text/xml"}}),
				))

				config.SetBlobStore(serverHost, serverPort, "", "")
				authorized, err := verifier.Verify(config)
				Expect(err).NotTo(HaveOccurred())
				Expect(authorized).To(BeTrue())

				Expect(fakeServer.ReceivedRequests()).To(HaveLen(1))
			})
		})

		Context("when the DAV blob store requires auth", func() {
			It("should return authorized for proper credentials", func() {
				fakeServer.RouteToHandler("PROPFIND", "/blobs/", ghttp.CombineHandlers(
					ghttp.VerifyBasicAuth("good-user", "good-pass"),
					ghttp.VerifyHeaderKV("Depth", "1"),
					ghttp.RespondWith(207, responseBodyRoot, http.Header{"Content-Type": []string{"text/xml"}}),
				))
开发者ID:davidwadden,项目名称:lattice-release,代码行数:31,代码来源:blob_store_verifier_test.go


注:本文中的github.com/cloudfoundry-incubator/lattice/ltc/config.Config.SetBlobStore方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。