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


Golang assets.NewAssets函数代码示例

本文整理汇总了Golang中github.com/cloudfoundry/cf-acceptance-tests/helpers/assets.NewAssets函数的典型用法代码示例。如果您正苦于以下问题:Golang NewAssets函数的具体用法?Golang NewAssets怎么用?Golang NewAssets使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: ToJSON

func (b ServiceBroker) ToJSON() string {
	bytes, err := ioutil.ReadFile(assets.NewAssets().ServiceBroker + "/cats.json")
	Expect(err).To(BeNil())

	replacer := strings.NewReplacer(
		"<fake-service>", b.Service.Name,
		"<fake-service-guid>", b.Service.ID,
		"<dashboard-client-key>", b.Service.DashboardClient.Key,
		"<sso-test>", b.Service.DashboardClient.ID,
		"<sso-secret>", b.Service.DashboardClient.Secret,
		"<sso-redirect-uri>", b.Service.DashboardClient.RedirectUri,
		"<fake-plan>", b.SyncPlans[0].Name,
		"<fake-plan-guid>", b.SyncPlans[0].ID,
		"<fake-plan-2>", b.SyncPlans[1].Name,
		"<fake-plan-2-guid>", b.SyncPlans[1].ID,
		"<fake-async-plan>", b.AsyncPlans[0].Name,
		"<fake-async-plan-guid>", b.AsyncPlans[0].ID,
		"<fake-async-plan-2>", b.AsyncPlans[1].Name,
		"<fake-async-plan-2-guid>", b.AsyncPlans[1].ID,
		"<fake-sso-plan>", b.SsoPlans[0].Name,
		"<fake-sso-plan-guid>", b.SsoPlans[0].ID,
		"<sso-plan-client-id>", b.SsoPlans[0].DashboardClient.ID,
		"<sso-plan-secret>", b.SsoPlans[0].DashboardClient.Secret,
	)

	return replacer.Replace(string(bytes))
}
开发者ID:naheedmk,项目名称:cf-acceptance-tests,代码行数:27,代码来源:broker.go

示例2: createDummyBuildpack

func createDummyBuildpack() string {
	buildpack := random_name.CATSRandomName("BPK")
	buildpackZip := assets.NewAssets().SecurityGroupBuildpack

	workflowhelpers.AsUser(TestSetup.AdminUserContext(), Config.DefaultTimeoutDuration(), func() {
		Expect(cf.Cf("create-buildpack", buildpack, buildpackZip, "999").Wait(Config.DefaultTimeoutDuration())).To(Exit(0))
	})
	return buildpack
}
开发者ID:nickwei84,项目名称:cf-acceptance-tests,代码行数:9,代码来源:running_security_groups.go

示例3: pushApp

func pushApp(appName, buildpack string) {
	Expect(cf.Cf("push",
		appName,
		"--no-start",
		"-b", buildpack,
		"-m", DEFAULT_MEMORY_LIMIT,
		"-p", assets.NewAssets().Dora,
		"-d", Config.GetAppsDomain()).Wait(Config.CfPushTimeoutDuration())).To(Exit(0))
	app_helpers.SetBackend(appName)
}
开发者ID:nickwei84,项目名称:cf-acceptance-tests,代码行数:10,代码来源:running_security_groups.go

示例4: createServiceBroker

func createServiceBroker(brokerName, brokerAppName, serviceName string) {
	serviceBrokerAsset := assets.NewAssets().ServiceBroker
	PushApp(brokerAppName, serviceBrokerAsset, Config.GetRubyBuildpackName(), Config.GetAppsDomain(), Config.CfPushTimeoutDuration(), DEFAULT_MEMORY_LIMIT)

	initiateBrokerConfig(serviceName, brokerAppName)

	brokerUrl := helpers.AppUri(brokerAppName, "", Config)

	workflowhelpers.AsUser(TestSetup.AdminUserContext(), TestSetup.ShortTimeout(), func() {
		session := cf.Cf("create-service-broker", brokerName, "user", "password", brokerUrl)
		Expect(session.Wait(Config.DefaultTimeoutDuration())).To(Exit(0))

		session = cf.Cf("enable-service-access", serviceName)
		Expect(session.Wait(Config.DefaultTimeoutDuration())).To(Exit(0))
	})
}
开发者ID:nickwei84,项目名称:cf-acceptance-tests,代码行数:16,代码来源:route_services.go

示例5: createServiceBroker

func createServiceBroker() (string, string, string) {
	serviceBrokerAsset := assets.NewAssets().ServiceBroker
	serviceBrokerAppName := PushApp(serviceBrokerAsset, config.RubyBuildpackName)

	serviceName := initiateBrokerConfig(serviceBrokerAppName)

	brokerName := generator.PrefixedRandomName("RATS-BROKER-")
	brokerUrl := helpers.AppUri(serviceBrokerAppName, "")

	config = helpers.LoadConfig()
	context := helpers.NewContext(config)
	cf.AsUser(context.AdminUserContext(), context.ShortTimeout(), func() {
		session := cf.Cf("create-service-broker", brokerName, "user", "password", brokerUrl)
		Expect(session.Wait(DEFAULT_TIMEOUT)).To(Exit(0))

		session = cf.Cf("enable-service-access", serviceName)
		Expect(session.Wait(DEFAULT_TIMEOUT)).To(Exit(0))

	})

	return brokerName, serviceBrokerAppName, serviceName
}
开发者ID:cf-routing,项目名称:cf-acceptance-tests,代码行数:22,代码来源:route_services_test.go

示例6:

	}

	type AppsResponse struct {
		Resources []AppResource `json:"resources"`
	}

	Describe("Staging", func() {
		var appName string

		BeforeEach(func() {
			appName = generator.PrefixedRandomName("CATS-APP-")
		})

		Describe("without a procfile", func() {
			BeforeEach(func() {
				Expect(cf.Cf("push", appName, "-p", assets.NewAssets().Node, "-c", "node server.js --cool-arg", "-d", config.AppsDomain).Wait(CF_PUSH_TIMEOUT)).To(Exit(0))
			})

			AfterEach(func() {
				Expect(cf.Cf("delete", appName, "-f").Wait(CF_PUSH_TIMEOUT)).To(Exit(0))
			})

			It(diegoUnsupportedTag+"detects the use of the start command supplied on the command line", func() {
				var appsResponse AppsResponse
				cfResponse := cf.Cf("curl", fmt.Sprintf("/v2/apps?q=name:%s", appName)).Wait(DEFAULT_TIMEOUT).Out.Contents()
				json.Unmarshal(cfResponse, &appsResponse)

				Expect(appsResponse.Resources[0].Entity.DetectedStartCommand).To(Equal("node server.js --cool-arg"))
			})
		})
开发者ID:zwx292872,项目名称:cf-acceptance-tests,代码行数:30,代码来源:process_types_test.go

示例7:

	"github.com/cloudfoundry-incubator/cf-test-helpers/cf"
	"github.com/cloudfoundry-incubator/cf-test-helpers/generator"
	"github.com/cloudfoundry-incubator/cf-test-helpers/helpers"
	"github.com/cloudfoundry/cf-acceptance-tests/helpers/assets"
)

var _ = Describe("Copy app bits", func() {
	var golangAppName string
	var helloWorldAppName string

	BeforeEach(func() {
		golangAppName = generator.PrefixedRandomName("CATS-APP-")
		helloWorldAppName = generator.PrefixedRandomName("CATS-APP-")

		Expect(cf.Cf("push", golangAppName, "-p", assets.NewAssets().Golang, "--no-start").Wait(DEFAULT_TIMEOUT)).To(Exit(0))
		Expect(cf.Cf("push", helloWorldAppName, "-p", assets.NewAssets().HelloWorld, "--no-start").Wait(DEFAULT_TIMEOUT)).To(Exit(0))
	})

	AfterEach(func() {
		Expect(cf.Cf("delete", golangAppName, "-f").Wait(DEFAULT_TIMEOUT)).To(Exit(0))
		Expect(cf.Cf("delete", helloWorldAppName, "-f").Wait(DEFAULT_TIMEOUT)).To(Exit(0))
	})

	It("Copies over the package from the source app to the destination app", func() {
		Expect(cf.Cf("copy-source", helloWorldAppName, golangAppName).Wait(CF_PUSH_TIMEOUT)).To(Exit(0))

		Eventually(func() string {
			return helpers.CurlAppRoot(golangAppName)
		}, DEFAULT_TIMEOUT).Should(ContainSubstring("Hello, world!"))
	})
开发者ID:simonleung8,项目名称:cf-acceptance-tests,代码行数:30,代码来源:app_bits_copy_test.go

示例8:

		}
	}
	type StatsResponse map[string]Stat

	type DoraCurlResponse struct {
		Stdout     string
		Stderr     string
		ReturnCode int `json:"return_code"`
	}

	var serverAppName, securityGroupName, privateHost string
	var privatePort int

	BeforeEach(func() {
		serverAppName = generator.PrefixedRandomName("CATS-APP-")
		Expect(cf.Cf("push", serverAppName, "-m", "128M", "-p", assets.NewAssets().Dora, "-d", config.AppsDomain).Wait(CF_PUSH_TIMEOUT)).To(Exit(0))

		// gather app url
		var appsResponse AppsResponse
		cfResponse := cf.Cf("curl", fmt.Sprintf("/v2/apps?q=name:%s", serverAppName)).Wait(DEFAULT_TIMEOUT).Out.Contents()
		json.Unmarshal(cfResponse, &appsResponse)
		serverAppUrl := appsResponse.Resources[0].Metadata.Url

		// gather app stats for dea ip and app port
		var statsResponse StatsResponse
		cfResponse = cf.Cf("curl", fmt.Sprintf("%s/stats", serverAppUrl)).Wait(DEFAULT_TIMEOUT).Out.Contents()
		json.Unmarshal(cfResponse, &statsResponse)

		privateHost = statsResponse["0"].Stats.Host
		privatePort = statsResponse["0"].Stats.Port
	})
开发者ID:drnic,项目名称:noop-cf-boshrelease,代码行数:31,代码来源:running_security_groups_test.go

示例9:

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	. "github.com/onsi/gomega/gexec"

	"github.com/cloudfoundry-incubator/cf-test-helpers/cf"
	"github.com/cloudfoundry-incubator/cf-test-helpers/helpers"
	"github.com/cloudfoundry/cf-acceptance-tests/helpers/app_helpers"
	"github.com/cloudfoundry/cf-acceptance-tests/helpers/assets"
	"github.com/cloudfoundry/cf-acceptance-tests/helpers/random_name"
)

var _ = AppsDescribe("Large_payload", func() {
	var appName string
	AfterEach(func() {
		app_helpers.AppReport(appName, Config.DefaultTimeoutDuration())

		Expect(cf.Cf("delete", appName, "-f", "-r").Wait(Config.CfPushTimeoutDuration())).To(Exit(0))
	})
	It("should be able to curl for a large response body", func() {
		appName = random_name.CATSRandomName("APP")
		Expect(cf.Cf("push", appName, "--no-start", "-b", Config.GetRubyBuildpackName(), "-m", DEFAULT_MEMORY_LIMIT, "-p", assets.NewAssets().Dora, "-d", Config.GetAppsDomain()).Wait(Config.DefaultTimeoutDuration())).To(Exit(0))
		app_helpers.SetBackend(appName)
		Expect(cf.Cf("start", appName).Wait(Config.CfPushTimeoutDuration())).To(Exit(0))

		Eventually(func() int {
			curlResponse := helpers.CurlApp(Config, appName, fmt.Sprintf("/largetext/5"))
			return len(curlResponse)
		}, 10*time.Second, 10*time.Second).Should(Equal(5 * 1024))
	})
})
开发者ID:nickwei84,项目名称:cf-acceptance-tests,代码行数:30,代码来源:large_payload.go

示例10:

	"crypto/tls"
	"strings"

	"encoding/json"
	"os"
	"path/filepath"
)

var _ = Describe("loggregator", func() {
	var appName string
	const hundredthOfOneSecond = 10000 // this app uses millionth of seconds

	BeforeEach(func() {
		appName = generator.PrefixedRandomName("CATS-APP-")

		Expect(cf.Cf("push", appName, "--no-start", "-b", config.RubyBuildpackName, "-m", DEFAULT_MEMORY_LIMIT, "-p", assets.NewAssets().LoggregatorLoadGenerator, "-d", config.AppsDomain).Wait(DEFAULT_TIMEOUT)).To(Exit(0))
		app_helpers.SetBackend(appName)
		Expect(cf.Cf("start", appName).Wait(CF_PUSH_TIMEOUT)).To(Exit(0))
	})

	AfterEach(func() {
		app_helpers.AppReport(appName, DEFAULT_TIMEOUT)

		Expect(cf.Cf("delete", appName, "-f", "-r").Wait(DEFAULT_TIMEOUT)).To(Exit(0))
	})

	Context("cf logs", func() {
		var logs *Session

		BeforeEach(func() {
			logs = cf.Cf("logs", appName)
开发者ID:cwlbraa,项目名称:cf-acceptance-tests,代码行数:31,代码来源:loggregator_test.go

示例11:

	. "github.com/onsi/gomega"
	. "github.com/onsi/gomega/gexec"

	"github.com/cloudfoundry-incubator/cf-test-helpers/cf"
	"github.com/cloudfoundry-incubator/cf-test-helpers/generator"
	"github.com/cloudfoundry/cf-acceptance-tests/helpers/assets"
)

var _ = Describe("Downloading droplets", func() {
	var helloWorldAppName string
	var out bytes.Buffer

	BeforeEach(func() {
		helloWorldAppName = generator.PrefixedRandomName("CATS-APP-")

		Expect(cf.Cf("push", helloWorldAppName, "-p", assets.NewAssets().HelloWorld).Wait(CF_PUSH_TIMEOUT)).To(Exit(0))
	})

	AfterEach(func() {
		Expect(cf.Cf("delete", helloWorldAppName, "-f").Wait(DEFAULT_TIMEOUT)).To(Exit(0))
	})

	It("Downloads the droplet for the app", func() {
		guid := cf.Cf("app", helloWorldAppName, "--guid").Wait(DEFAULT_TIMEOUT).Out.Contents()
		appGuid := strings.TrimSpace(string(guid))

		tmpdir, err := ioutil.TempDir(os.TempDir(), "droplet-download")
		Expect(err).ToNot(HaveOccurred())

		app_droplet_path := path.Join(tmpdir, helloWorldAppName)
开发者ID:naheedmk,项目名称:cf-acceptance-tests,代码行数:30,代码来源:droplet_download_test.go

示例12:

package routing

import (
	"github.com/cloudfoundry-incubator/cf-test-helpers/helpers"
	"github.com/cloudfoundry/cf-acceptance-tests/helpers/app_helpers"
	"github.com/cloudfoundry/cf-acceptance-tests/helpers/assets"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Context Paths", func() {
	var (
		app1              string
		helloRoutingAsset = assets.NewAssets().HelloRouting

		app2     string
		app2Path = "/app2"
		app3     string
		app3Path = "/app3/long/sub/path"
		domain   string
	)

	BeforeEach(func() {
		app1 = PushApp(helloRoutingAsset, config.RubyBuildpackName)
		app2 = PushApp(helloRoutingAsset, config.RubyBuildpackName)
		app3 = PushApp(helloRoutingAsset, config.RubyBuildpackName)

		domain = app1

		MapRouteToApp(domain, app2Path, app2)
		MapRouteToApp(domain, app3Path, app3)
开发者ID:cwlbraa,项目名称:cf-acceptance-tests,代码行数:31,代码来源:context_paths_test.go

示例13:

	. "github.com/onsi/gomega/gexec"
)

var _ = Describe(deaUnsupportedTag+"Route Services", func() {
	config := helpers.LoadConfig()

	if config.IncludeRouteServices {
		Context("when a route binds to a service", func() {
			Context("when service broker returns a route service url", func() {
				var (
					brokerName               string
					brokerAppName            string
					serviceInstanceName      string
					appName                  string
					routeServiceName         string
					golangAsset              = assets.NewAssets().Golang
					loggingRouteServiceAsset = assets.NewAssets().LoggingRouteServiceZip
				)

				BeforeEach(func() {
					var serviceName string
					brokerName, brokerAppName, serviceName = createServiceBroker()
					serviceInstanceName = createServiceInstance(serviceName)

					appName = PushAppNoStart(golangAsset, config.GoBuildpackName)
					app_helpers.EnableDiego(appName)
					StartApp(appName)

					routeServiceName = PushApp(loggingRouteServiceAsset, config.GoBuildpackName)
					configureBroker(brokerAppName, routeServiceName)
开发者ID:cf-routing,项目名称:cf-acceptance-tests,代码行数:30,代码来源:route_services_test.go

示例14:

	"github.com/cloudfoundry/cf-acceptance-tests/helpers/assets"
	. "github.com/cloudfoundry/cf-acceptance-tests/helpers/services"
)

var _ = Describe("SSO Lifecycle", func() {
	var broker ServiceBroker
	var config OAuthConfig
	var redirectUri string
	var apiEndpoint = helpers.LoadConfig().ApiEndpoint

	Describe("For service clients (provided in catalog)", func() {

		BeforeEach(func() {
			redirectUri = `http://www.purple.com`

			broker = NewServiceBroker(generator.RandomName(), assets.NewAssets().ServiceBroker, context, true)
			broker.Push()
			broker.Service.DashboardClient.RedirectUri = redirectUri
			broker.Configure()

			config = OAuthConfig{}
			config.ClientId = broker.Service.DashboardClient.ID
			config.ClientSecret = broker.Service.DashboardClient.Secret
			config.RedirectUri = redirectUri
			config.RequestedScopes = `openid,cloud_controller_service_permissions.read`

			SetOauthEndpoints(apiEndpoint, &config)

			broker.Create()
		})
开发者ID:naheedmk,项目名称:cf-acceptance-tests,代码行数:30,代码来源:sso_lifecycle_test.go

示例15:

		spaceName = context.RegularUserContext().Space

		domainName = generator.RandomName() + "." + helpers.LoadConfig().AppsDomain
		cf.AsUser(context.AdminUserContext(), DEFAULT_TIMEOUT, func() {
			Expect(cf.Cf("create-shared-domain", domainName).Wait(CF_PUSH_TIMEOUT)).To(Exit(0))
		})

		appNameDora = generator.PrefixedRandomName("CATS-APP-")
		appNameSimple = generator.PrefixedRandomName("CATS-APP-")

		Expect(cf.Cf(
			"push", appNameDora,
			"--no-start",
			"-b", config.RubyBuildpackName,
			"-m", DEFAULT_MEMORY_LIMIT,
			"-p", assets.NewAssets().Dora,
			"-d", config.AppsDomain,
		).Wait(CF_PUSH_TIMEOUT)).To(Exit(0))

		app_helpers.SetBackend(appNameDora)
		Expect(cf.Cf("start", appNameDora).Wait(CF_PUSH_TIMEOUT)).To(Exit(0))

		Expect(cf.Cf(
			"push", appNameSimple,
			"--no-start",
			"-b", config.RubyBuildpackName,
			"-m", DEFAULT_MEMORY_LIMIT,
			"-p", assets.NewAssets().HelloWorld,
			"-d", config.AppsDomain,
		).Wait(CF_PUSH_TIMEOUT)).To(Exit(0))
开发者ID:cf-routing,项目名称:cf-acceptance-tests,代码行数:30,代码来源:wildcard_routes_test.go


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