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


Golang configuration.NewRepository函數代碼示例

本文整理匯總了Golang中github.com/cloudfoundry/cli/testhelpers/configuration.NewRepository函數的典型用法代碼示例。如果您正苦於以下問題:Golang NewRepository函數的具體用法?Golang NewRepository怎麽用?Golang NewRepository使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


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

示例1: getPasswordDeps

func getPasswordDeps() passwordDeps {
	return passwordDeps{
		ReqFactory: new(requirementsfakes.FakeFactory),
		PwdRepo:    &apifakes.OldFakePasswordRepo{UpdateUnauthorized: true},
		Config:     testconfig.NewRepository(),
	}
}
開發者ID:Reejoshi,項目名稱:cli,代碼行數:7,代碼來源:passwd_test.go

示例2: getPasswordDeps

func getPasswordDeps() passwordDeps {
	return passwordDeps{
		ReqFactory: &testreq.FakeReqFactory{LoginSuccess: true},
		PwdRepo:    &testapi.FakePasswordRepo{UpdateUnauthorized: true},
		Config:     testconfig.NewRepository(),
	}
}
開發者ID:hail100,項目名稱:cli,代碼行數:7,代碼來源:passwd_test.go

示例3: newCurlDependencies

func newCurlDependencies() (deps curlDependencies) {
	deps.ui = &testterm.FakeUI{}
	deps.config = testconfig.NewRepository()
	deps.requirementsFactory = &testreq.FakeReqFactory{}
	deps.curlRepo = &testapi.FakeCurlRepository{}
	return
}
開發者ID:jacopen,項目名稱:cli,代碼行數:7,代碼來源:curl_test.go

示例4: findCommand

func findCommand(cmdName string) (cmd cli.Command) {
	fakeUI := &testterm.FakeUI{}
	configRepo := testconfig.NewRepository()
	pluginConfig := &testPluginConfig.FakePluginConfiguration{}
	manifestRepo := manifest.NewManifestDiskRepository()
	apiRepoLocator := api.NewRepositoryLocator(configRepo, map[string]net.Gateway{
		"auth":             net.NewUAAGateway(configRepo, fakeUI),
		"cloud-controller": net.NewCloudControllerGateway(configRepo, time.Now, fakeUI),
		"uaa":              net.NewUAAGateway(configRepo, fakeUI),
	})

	rpcService, _ := rpc.NewRpcService(nil, nil, nil, nil, api.RepositoryLocator{}, nil)
	cmdFactory := command_factory.NewFactory(fakeUI, configRepo, manifestRepo, apiRepoLocator, pluginConfig, rpcService)
	requirementsFactory := &testreq.FakeReqFactory{}
	cmdRunner := command_runner.NewRunner(cmdFactory, requirementsFactory, fakeUI)
	myApp := app.NewApp(cmdRunner, cmdFactory.CommandMetadatas()...)

	for _, cmd := range myApp.Commands {
		if cmd.Name == cmdName {
			return cmd
		}
	}
	panic(fmt.Sprintf("command %s does not exist", cmdName))
	return
}
開發者ID:tools-alexuser01,項目名稱:cli,代碼行數:25,代碼來源:context.go

示例5: setupDependencies

func setupDependencies() (obj commandDependencies) {
	obj.ui = &testterm.FakeUI{}

	obj.config = testconfig.NewRepository()
	obj.requirementsFactory = &testreq.FakeReqFactory{LoginSuccess: true, TargetedSpaceSuccess: true}
	obj.serviceRepo = new(testapi.FakeServiceRepo)
	return
}
開發者ID:BlueSpice,項目名稱:cli,代碼行數:8,代碼來源:purge_service_offering_test.go

示例6: createCommandFactory

func createCommandFactory() command_factory.Factory {
	fakeUI := &testterm.FakeUI{}
	configRepo := testconfig.NewRepository()
	manifestRepo := manifest.NewManifestDiskRepository()
	apiRepoLocator := api.NewRepositoryLocator(configRepo, map[string]net.Gateway{
		"auth":             net.NewUAAGateway(configRepo),
		"cloud-controller": net.NewCloudControllerGateway(configRepo, time.Now),
		"uaa":              net.NewUAAGateway(configRepo),
	})

	return command_factory.NewFactory(fakeUI, configRepo, manifestRepo, apiRepoLocator)
}
開發者ID:GABONIA,項目名稱:cli,代碼行數:12,代碼來源:help_test.go

示例7: createAuthenticationRepository

func createAuthenticationRepository(apiServer *httptest.Server, authServer *httptest.Server) (core_config.ReadWriter, authentication.AuthenticationRepository) {
	config := testconfig.NewRepository()
	config.SetAuthenticationEndpoint(authServer.URL)
	config.SetApiEndpoint(apiServer.URL)
	config.SetAccessToken("bearer initial-access-token")
	config.SetRefreshToken("initial-refresh-token")

	authGateway := NewUAAGateway(config, &testterm.FakeUI{})
	authGateway.SetTrustedCerts(authServer.TLS.Certificates)

	authenticator := authentication.NewUAAAuthenticationRepository(authGateway, config)

	return config, authenticator
}
開發者ID:vframbach,項目名稱:cli,代碼行數:14,代碼來源:gateway_test.go

示例8: createCommandFactory

func createCommandFactory() command_factory.Factory {
	fakeUI := &testterm.FakeUI{}
	configRepo := testconfig.NewRepository()
	pluginConfig := &testPluginConfig.FakePluginConfiguration{}

	manifestRepo := manifest.NewManifestDiskRepository()
	apiRepoLocator := api.NewRepositoryLocator(configRepo, map[string]net.Gateway{
		"auth":             net.NewUAAGateway(configRepo, fakeUI),
		"cloud-controller": net.NewCloudControllerGateway(configRepo, time.Now, fakeUI),
		"uaa":              net.NewUAAGateway(configRepo, fakeUI),
	})

	rpcService, _ := rpc.NewRpcService(nil, nil, nil, nil)
	return command_factory.NewFactory(fakeUI, configRepo, manifestRepo, apiRepoLocator, pluginConfig, rpcService)
}
開發者ID:raghulsid,項目名稱:cli,代碼行數:15,代碼來源:help_test.go

示例9: createAuthenticationRepository

func createAuthenticationRepository(apiServer *httptest.Server, authServer *httptest.Server) (coreconfig.ReadWriter, authentication.AuthenticationRepository) {
	config := testconfig.NewRepository()
	config.SetAuthenticationEndpoint(authServer.URL)
	config.SetAPIEndpoint(apiServer.URL)
	config.SetAccessToken("bearer initial-access-token")
	config.SetRefreshToken("initial-refresh-token")

	authGateway := NewUAAGateway(config, &testterm.FakeUI{}, new(tracefakes.FakePrinter))
	authGateway.SetTrustedCerts(authServer.TLS.Certificates)

	fakePrinter := new(tracefakes.FakePrinter)
	dumper := NewRequestDumper(fakePrinter)
	authenticator := authentication.NewUAAAuthenticationRepository(authGateway, config, dumper)

	return config, authenticator
}
開發者ID:yingkitw,項目名稱:cli,代碼行數:16,代碼來源:gateway_test.go

示例10:

		app.Name = "my-app"
		app.Guid = "my-app-guid"

		serviceInstance.Name = "my-service"
		serviceInstance.Guid = "my-service-guid"

		requirementsFactory = &testreq.FakeReqFactory{}
		requirementsFactory.Application = app
		requirementsFactory.ServiceInstance = serviceInstance

		serviceBindingRepo = &testapi.FakeServiceBindingRepo{}
	})

	Context("when not logged in", func() {
		It("fails requirements when not logged in", func() {
			cmd := NewUnbindService(&testterm.FakeUI{}, testconfig.NewRepository(), serviceBindingRepo)
			Expect(testcmd.RunCommand(cmd, []string{"my-service", "my-app"}, requirementsFactory)).To(BeFalse())
		})
	})

	Context("when logged in", func() {
		BeforeEach(func() {
			requirementsFactory.LoginSuccess = true
		})

		Context("when the service instance exists", func() {
			It("unbinds a service from an app", func() {
				ui := callUnbindService([]string{"my-app", "my-service"}, requirementsFactory, serviceBindingRepo)

				Expect(requirementsFactory.ApplicationName).To(Equal("my-app"))
				Expect(requirementsFactory.ServiceInstanceName).To(Equal("my-service"))
開發者ID:tools-alexuser01,項目名稱:cli,代碼行數:31,代碼來源:unbind_service_test.go

示例11:

	. "github.com/onsi/gomega"

	. "github.com/cloudfoundry/cli/testhelpers/matchers"
)

var _ = Describe("bind-service command", func() {
	var (
		requirementsFactory *testreq.FakeReqFactory
	)

	BeforeEach(func() {
		requirementsFactory = &testreq.FakeReqFactory{}
	})

	It("fails requirements when not logged in", func() {
		cmd := NewBindService(&testterm.FakeUI{}, testconfig.NewRepository(), &testapi.FakeServiceBindingRepo{})
		testcmd.RunCommand(cmd, []string{"service", "app"}, requirementsFactory)

		Expect(testcmd.CommandDidPassRequirements).To(BeFalse())
	})

	Context("when logged in", func() {
		BeforeEach(func() {
			requirementsFactory.LoginSuccess = true
		})

		It("binds a service instance to an app", func() {
			app := models.Application{}
			app.Name = "my-app"
			app.Guid = "my-app-guid"
			serviceInstance := models.ServiceInstance{}
開發者ID:GABONIA,項目名稱:cli,代碼行數:31,代碼來源:bind_service_test.go

示例12: newCurlDependencies

func newCurlDependencies() (deps curlDependencies) {
	deps.config = testconfig.NewRepository()
	deps.config.SetAccessToken("BEARER my_access_token")
	deps.gateway = net.NewCloudControllerGateway(deps.config, time.Now, new(terminalfakes.FakeUI), new(tracefakes.FakePrinter), "")
	return
}
開發者ID:Reejoshi,項目名稱:cli,代碼行數:6,代碼來源:curl_test.go

示例13:

				apiErr = errors.NewHttpError(400, errorCode, "Error staging app")
			}
		}
		return
	}

	AfterEach(func() {
		command_registry.Register(OriginalAppCommand)
	})

	BeforeEach(func() {
		deps = command_registry.NewDependency()
		ui = new(testterm.FakeUI)
		requirementsFactory = &testreq.FakeReqFactory{}

		configRepo = testconfig.NewRepository()

		appInstancesRepo = &testAppInstanaces.FakeAppInstancesRepository{}
		appRepo = &testApplication.FakeApplicationRepository{}

		displayApp = &appCmdFakes.FakeAppDisplayer{}

		//save original command dependency and restore later
		OriginalAppCommand = command_registry.Commands.FindCommand("app")

		defaultInstanceErrorCodes = []string{"", ""}

		defaultAppForStart = models.Application{}
		defaultAppForStart.Name = "my-app"
		defaultAppForStart.Guid = "my-app-guid"
		defaultAppForStart.InstanceCount = 2
開發者ID:rbramwell,項目名稱:cli,代碼行數:31,代碼來源:start_test.go

示例14:

  "authorization_endpoint": "https://login.example.com",
  "api_version": "42.0.0"
}`)
}

var _ = Describe("Endpoints Repository", func() {
	var (
		coreConfig   coreconfig.ReadWriter
		gateway      net.Gateway
		testServer   *httptest.Server
		repo         RemoteInfoRepository
		testServerFn func(w http.ResponseWriter, r *http.Request)
	)

	BeforeEach(func() {
		coreConfig = testconfig.NewRepository()
		testServer = httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
			testServerFn(w, r)
		}))
		gateway = cloudcontrollergateway.NewTestCloudControllerGateway(coreConfig)
		gateway.SetTrustedCerts(testServer.TLS.Certificates)
		repo = NewEndpointRepository(gateway)
	})

	AfterEach(func() {
		testServer.Close()
	})

	Describe("updating the endpoints", func() {
		Context("when the API request is successful", func() {
			var (
開發者ID:yingkitw,項目名稱:cli,代碼行數:31,代碼來源:endpoints_test.go

示例15:

	. "github.com/cloudfoundry/cli/testhelpers/matchers"
)

var _ = Describe("stop command", func() {
	var (
		requirementsFactory *testreq.FakeReqFactory
	)

	BeforeEach(func() {
		requirementsFactory = &testreq.FakeReqFactory{}
	})

	It("fails requirements when not logged in", func() {
		requirementsFactory.LoginSuccess = false
		appRepo := &testapi.FakeApplicationRepository{}
		cmd := NewStop(new(testterm.FakeUI), testconfig.NewRepository(), appRepo)
		testcmd.RunCommand(cmd, []string{"some-app-name"}, requirementsFactory)

		Expect(testcmd.CommandDidPassRequirements).To(BeFalse())
	})

	Context("when logged in", func() {
		BeforeEach(func() {
			requirementsFactory.LoginSuccess = true
		})

		It("fails with usage when the app name is not given", func() {
			app := models.Application{}
			app.Name = "my-app"
			app.Guid = "my-app-guid"
			appRepo := &testapi.FakeApplicationRepository{}
開發者ID:GABONIA,項目名稱:cli,代碼行數:31,代碼來源:stop_test.go


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