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


Golang Config.SetBlobStore方法代碼示例

本文整理匯總了Golang中github.com/cloudfoundry-incubator/ltc/config.Config.SetBlobStore方法的典型用法代碼示例。如果您正苦於以下問題:Golang Config.SetBlobStore方法的具體用法?Golang Config.SetBlobStore怎麽用?Golang Config.SetBlobStore使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/cloudfoundry-incubator/ltc/config.Config的用法示例。


在下文中一共展示了Config.SetBlobStore方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1:

			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,項目名稱:ltc,代碼行數:31,代碼來源:cli_app_factory_test.go

示例2:

					  <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:cloudfoundry-incubator,項目名稱:ltc,代碼行數:31,代碼來源:blob_store_verifier_test.go

示例3:

				err := dropletRunner.UploadBits("droplet-name", "some non-existent file")
				Expect(reflect.TypeOf(err).String()).To(Equal("*os.PathError"))
			})

			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.WrapAction(&models.DownloadAction{
				From: blobURL + "/bits.zip",
				To:   "/tmp/app",
				User: "vcap",
			}))
開發者ID:davidwadden,項目名稱:ltc,代碼行數:30,代碼來源:droplet_runner_test.go

示例4:

		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:cloudfoundry-incubator,項目名稱:ltc,代碼行數:30,代碼來源:blob_store_test.go

示例5:

				})

				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:davidwadden,項目名稱:ltc,代碼行數:31,代碼來源:config_command_factory_test.go

示例6:

	})

	Describe("ActiveBlobStore", func() {
		It("defaults to 'dav'", func() {
			Expect(testConfig.ActiveBlobStore().String()).To(Equal("dav"))
		})

		It("reports the active blobstore", func() {
			testConfig.SetS3BlobStore("some-access-key", "some-secret-key", "some-bucket-name", "some-s3-region")
			Expect(testConfig.ActiveBlobStore().String()).To(Equal("s3"))
		})
	})

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

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

		It("sets the activeBlobStore to 'dav'", func() {
			testConfig.SetS3BlobStore("some-access-key", "some-secret-key", "some-bucket-name", "some-region")
			testConfig.SetBlobStore("some-host", "7474", "some-username", "some-password")
			Expect(testConfig.ActiveBlobStore().String()).To(Equal("dav"))
		})
	})
開發者ID:cloudfoundry-incubator,項目名稱:ltc,代碼行數:31,代碼來源:config_test.go


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