Example #1
0
func New(config *config_package.Config) BlobStore {
	switch config.ActiveBlobStore() {
	case config_package.DAVBlobStore:
		return dav_blob_store.New(config.BlobStore())
	case config_package.S3BlobStore:
		return s3_blob_store.New(config.S3BlobStore())
	}

	return dav_blob_store.New(config.BlobStore())
}
Example #2
0
	BeforeEach(func() {
		fakeServer = ghttp.NewServer()
		fakeServerURL, err := url.Parse(fakeServer.URL())
		Expect(err).NotTo(HaveOccurred())

		serverHost, serverPort, err := net.SplitHostPort(fakeServerURL.Host)
		Expect(err).NotTo(HaveOccurred())

		blobTargetInfo = config_package.BlobStoreConfig{
			Host:     serverHost,
			Port:     serverPort,
			Username: "******",
			Password: "******",
		}

		blobStore = dav_blob_store.New(blobTargetInfo)
	})

	AfterEach(func() {
		if fakeServer != nil {
			fakeServer.Close()
		}
	})

	Describe(".New", func() {
		It("creates a BlobStore with a timeout of 5 seconds", func() {
			Expect(dav_blob_store.New(blobTargetInfo).Client.Timeout).To(Equal(5 * time.Second))
		})
	})

	Describe("#List", func() {
Example #3
0
	BeforeEach(func() {
		fakeServer = ghttp.NewServer()
		fakeServerURL, err := url.Parse(fakeServer.URL())
		Expect(err).NotTo(HaveOccurred())

		serverHost, serverPort, err := net.SplitHostPort(fakeServerURL.Host)
		Expect(err).NotTo(HaveOccurred())

		blobTargetInfo = config_package.BlobStoreConfig{
			Host:     serverHost,
			Port:     serverPort,
			Username: "******",
			Password: "******",
		}

		blobStore = dav_blob_store.New(blobTargetInfo)
	})

	AfterEach(func() {
		if fakeServer != nil {
			fakeServer.Close()
		}
	})

	Describe("#List", func() {
		var responseBodyRoot string
		BeforeEach(func() {
			responseBodyRoot = `
				<?xml version="1.0" encoding="utf-8"?>
				<D:multistatus xmlns:D="DAV:" xmlns:ns0="urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/">
				  <D:response>