本文整理匯總了Golang中github.com/cloudfoundry/cli/cf/configuration/core_config.Repository類的典型用法代碼示例。如果您正苦於以下問題:Golang Repository類的具體用法?Golang Repository怎麽用?Golang Repository使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Repository類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
"github.com/cloudfoundry/cli/cf/configuration/core_config"
"github.com/cloudfoundry/cli/cf/models"
testcmd "github.com/cloudfoundry/cli/testhelpers/commands"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
testreq "github.com/cloudfoundry/cli/testhelpers/requirements"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
)
var _ = Describe("marketplace command", func() {
var ui *testterm.FakeUI
var requirementsFactory *testreq.FakeReqFactory
var config core_config.Repository
var serviceBuilder *testapi.FakeServiceBuilder
var fakeServiceOfferings []models.ServiceOffering
var serviceWithAPaidPlan models.ServiceOffering
var service2 models.ServiceOffering
var deps command_registry.Dependency
updateCommandDependency := func(pluginCall bool) {
deps.Ui = ui
deps.Config = config
deps.ServiceBuilder = serviceBuilder
command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("marketplace").SetDependency(deps, pluginCall))
}
BeforeEach(func() {
serviceBuilder = &testapi.FakeServiceBuilder{}
示例2:
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("UnsetOrgRole", func() {
var (
ui *testterm.FakeUI
configRepo core_config.Repository
userRepo *testapi.FakeUserRepository
flagRepo *fakefeatureflagsapi.FakeFeatureFlagRepository
cmd command_registry.Command
deps command_registry.Dependency
factory *fakerequirements.FakeFactory
flagContext flags.FlagContext
loginRequirement requirements.Requirement
userRequirement *fakerequirements.FakeUserRequirement
organizationRequirement *fakerequirements.FakeOrganizationRequirement
)
BeforeEach(func() {
ui = &testterm.FakeUI{}
configRepo = testconfig.NewRepositoryWithDefaults()
userRepo = &testapi.FakeUserRepository{}
repoLocator := deps.RepoLocator.SetUserRepository(userRepo)
flagRepo = &fakefeatureflagsapi.FakeFeatureFlagRepository{}
repoLocator = repoLocator.SetFeatureFlagRepository(flagRepo)
示例3:
"github.com/cloudfoundry/cli/cf/configuration/core_config"
"github.com/cloudfoundry/cli/cf/requirements"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("MinAPIVersionRequirement", func() {
var (
ui *testterm.FakeUI
config core_config.Repository
requirement requirements.MinAPIVersionRequirement
)
BeforeEach(func() {
ui = new(testterm.FakeUI)
config = testconfig.NewRepository()
requiredVersion, err := semver.Make("1.2.3")
Expect(err).NotTo(HaveOccurred())
requirement = requirements.NewMinAPIVersionRequirement(ui, config, "command-name", requiredVersion)
})
Context("Execute", func() {
Context("when the config's api version is greater than the required version", func() {
BeforeEach(func() {
示例4:
It("calls the code gangsta cli App command", func() {
client, err = rpc.Dial("tcp", "127.0.0.1:"+rpcService.Port())
Expect(err).ToNot(HaveOccurred())
var success bool
err = client.Call("CliRpcCmd.CallCoreCommand", []string{"test_cmd"}, &success)
Expect(err).ToNot(HaveOccurred())
Expect(success).To(BeTrue())
})
})
Describe("CLI Config object methods", func() {
var (
config core_config.Repository
)
BeforeEach(func() {
config = testconfig.NewRepositoryWithDefaults()
})
AfterEach(func() {
rpcService.Stop()
//give time for server to stop
time.Sleep(50 * time.Millisecond)
})
Context(".GetCurrentOrg", func() {
BeforeEach(func() {
示例5:
"github.com/cloudfoundry/cli/cf/commands/domain"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("ListDomains", func() {
var (
ui *testterm.FakeUI
routingApiRepo *fakeapi.FakeRoutingApiRepository
domainRepo *fakeapi.FakeDomainRepository
configRepo core_config.Repository
cmd domain.ListDomains
deps command_registry.Dependency
factory *fakerequirements.FakeFactory
flagContext flags.FlagContext
loginRequirement requirements.Requirement
targetedOrgRequirement *fakerequirements.FakeTargetedOrgRequirement
domainFields []models.DomainFields
routerGroups models.RouterGroups
)
BeforeEach(func() {
ui = &testterm.FakeUI{}
configRepo = testconfig.NewRepositoryWithDefaults()
routingApiRepo = &fakeapi.FakeRoutingApiRepository{}
repoLocator := deps.RepoLocator.SetRoutingApiRepository(routingApiRepo)
示例6:
. "github.com/cloudfoundry/cli/testhelpers/matchers"
)
var _ = Describe("Push Command", func() {
var (
ui *testterm.FakeUI
configRepo core_config.Repository
manifestRepo *testmanifest.FakeManifestRepository
starter *appCmdFakes.FakeApplicationStarter
stopper *appCmdFakes.FakeApplicationStopper
serviceBinder *serviceCmdFakes.FakeAppBinder
appRepo *testApplication.FakeApplicationRepository
domainRepo *testapi.FakeDomainRepository
routeRepo *testapi.FakeRouteRepository
stackRepo *testStacks.FakeStackRepository
serviceRepo *testapi.FakeServiceRepo
wordGenerator *testwords.FakeWordGenerator
requirementsFactory *testreq.FakeReqFactory
authRepo *testapi.FakeAuthenticationRepository
actor *fakeactors.FakePushActor
app_files *fakeappfiles.FakeAppFiles
zipper *fakeappfiles.FakeZipper
OriginalCommandStart command_registry.Command
OriginalCommandStop command_registry.Command
OriginalCommandServiceBind command_registry.Command
deps command_registry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.Ui = ui
deps.Config = configRepo
示例7:
testcmd "github.com/cloudfoundry/cli/testhelpers/commands"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
"github.com/cloudfoundry/cli/testhelpers/maker"
testreq "github.com/cloudfoundry/cli/testhelpers/requirements"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
)
var _ = Describe("delete-space command", func() {
var (
ui *testterm.FakeUI
space models.Space
config core_config.Repository
spaceRepo *testapi.FakeSpaceRepository
requirementsFactory *testreq.FakeReqFactory
deps command_registry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.Ui = ui
deps.RepoLocator = deps.RepoLocator.SetSpaceRepository(spaceRepo)
deps.Config = config
command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("delete-space").SetDependency(deps, pluginCall))
}
runCommand := func(args ...string) bool {
return testcmd.RunCliCommand("delete-space", args, requirementsFactory, updateCommandDependency, false)
}
示例8:
"github.com/cloudfoundry/cli/cf/models"
testcmd "github.com/cloudfoundry/cli/testhelpers/commands"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
testreq "github.com/cloudfoundry/cli/testhelpers/requirements"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
)
var _ = Describe("rename-space command", func() {
var (
ui *testterm.FakeUI
configRepo core_config.Repository
requirementsFactory *testreq.FakeReqFactory
spaceRepo *testapi.FakeSpaceRepository
deps command_registry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.Ui = ui
deps.RepoLocator = deps.RepoLocator.SetSpaceRepository(spaceRepo)
deps.Config = configRepo
command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("rename-space").SetDependency(deps, pluginCall))
}
BeforeEach(func() {
ui = new(testterm.FakeUI)
configRepo = testconfig.NewRepositoryWithDefaults()
requirementsFactory = &testreq.FakeReqFactory{LoginSuccess: true, TargetedOrgSuccess: true}
示例9:
testcmd "github.com/cloudfoundry/cli/testhelpers/commands"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
)
var _ = Describe("Login Command", func() {
var (
Flags []string
Config core_config.Repository
ui *testterm.FakeUI
authRepo *testapi.FakeAuthenticationRepository
endpointRepo *testapi.FakeEndpointRepo
orgRepo *fake_organizations.FakeOrganizationRepository
spaceRepo *testapi.FakeSpaceRepository
org models.Organization
deps command_registry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.Ui = ui
deps.Config = Config
deps.RepoLocator = deps.RepoLocator.SetEndpointRepository(endpointRepo)
deps.RepoLocator = deps.RepoLocator.SetAuthenticationRepository(authRepo)
deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(orgRepo)
deps.RepoLocator = deps.RepoLocator.SetSpaceRepository(spaceRepo)
command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("login").SetDependency(deps, pluginCall))
}
示例10:
testcmd "github.com/cloudfoundry/cli/testhelpers/commands"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
testreq "github.com/cloudfoundry/cli/testhelpers/requirements"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
)
var _ = Describe("set-space-role command", func() {
var (
ui *testterm.FakeUI
requirementsFactory *testreq.FakeReqFactory
spaceRepo *testapi.FakeSpaceRepository
userRepo *testapi.FakeUserRepository
configRepo core_config.Repository
flagRepo *fakeflag.FakeFeatureFlagRepository
deps command_registry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.Ui = ui
deps.RepoLocator = deps.RepoLocator.SetSpaceRepository(spaceRepo)
deps.RepoLocator = deps.RepoLocator.SetUserRepository(userRepo)
deps.RepoLocator = deps.RepoLocator.SetFeatureFlagRepository(flagRepo)
deps.Config = configRepo
command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("set-space-role").SetDependency(deps, pluginCall))
}
BeforeEach(func() {
示例11:
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
testreq "github.com/cloudfoundry/cli/testhelpers/requirements"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
"github.com/cloudfoundry/cli/cf/command_registry"
"github.com/cloudfoundry/cli/cf/commands/application"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("stop command", func() {
var (
ui *testterm.FakeUI
app models.Application
appRepo *testApplication.FakeApplicationRepository
requirementsFactory *testreq.FakeReqFactory
config core_config.Repository
deps command_registry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.Ui = ui
deps.RepoLocator = deps.RepoLocator.SetApplicationRepository(appRepo)
deps.Config = config
command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("stop").SetDependency(deps, pluginCall))
}
BeforeEach(func() {
ui = &testterm.FakeUI{}
config = testconfig.NewRepositoryWithDefaults()
appRepo = &testApplication.FakeApplicationRepository{}
示例12:
"github.com/cloudfoundry/cli/cf/errors"
testcmd "github.com/cloudfoundry/cli/testhelpers/commands"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
testreq "github.com/cloudfoundry/cli/testhelpers/requirements"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
)
var _ = Describe("api command", func() {
var (
config core_config.Repository
endpointRepo *testapi.FakeEndpointRepo
deps command_registry.Dependency
requirementsFactory *testreq.FakeReqFactory
ui *testterm.FakeUI
)
updateCommandDependency := func(pluginCall bool) {
deps.Ui = ui
deps.Config = config
deps.RepoLocator = deps.RepoLocator.SetEndpointRepository(endpointRepo)
command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("api").SetDependency(deps, pluginCall))
}
callApi := func(args []string, config core_config.Repository, endpointRepo *testapi.FakeEndpointRepo) {
testcmd.RunCliCommand("api", args, requirementsFactory, updateCommandDependency, false)
}
示例13:
package commands_test
import (
"github.com/cloudfoundry/cli/cf/commands"
"github.com/cloudfoundry/cli/cf/configuration/core_config"
"github.com/cloudfoundry/cli/cf/models"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("logout command", func() {
var config core_config.Repository
BeforeEach(func() {
org := models.OrganizationFields{}
org.Name = "MyOrg"
space := models.SpaceFields{}
space.Name = "MySpace"
config = testconfig.NewRepository()
config.SetAccessToken("MyAccessToken")
config.SetOrganizationFields(org)
config.SetSpaceFields(space)
ui := new(testterm.FakeUI)
l := commands.NewLogout(ui, config)
l.Run(nil)
})
示例14:
"github.com/cloudfoundry/cli/cf/net"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
testnet "github.com/cloudfoundry/cli/testhelpers/net"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/cloudfoundry/cli/cf/api"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("route repository", func() {
var (
ts *httptest.Server
handler *testnet.TestHandler
configRepo core_config.Repository
repo CloudControllerRouteRepository
)
BeforeEach(func() {
configRepo = testconfig.NewRepositoryWithDefaults()
configRepo.SetSpaceFields(models.SpaceFields{
Guid: "the-space-guid",
Name: "the-space-name",
})
gateway := net.NewCloudControllerGateway(configRepo, time.Now, &testterm.FakeUI{})
repo = NewCloudControllerRouteRepository(configRepo, gateway)
})
AfterEach(func() {
ts.Close()
示例15:
"github.com/cloudfoundry/cli/cf/models"
testcmd "github.com/cloudfoundry/cli/testhelpers/commands"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
testreq "github.com/cloudfoundry/cli/testhelpers/requirements"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
)
var _ = Describe("rename-org command", func() {
var (
requirementsFactory *testreq.FakeReqFactory
orgRepo *test_org.FakeOrganizationRepository
ui *testterm.FakeUI
configRepo core_config.Repository
deps command_registry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.Ui = ui
deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(orgRepo)
deps.Config = configRepo
command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("rename-org").SetDependency(deps, pluginCall))
}
BeforeEach(func() {
requirementsFactory = &testreq.FakeReqFactory{}
orgRepo = &test_org.FakeOrganizationRepository{}
ui = new(testterm.FakeUI)