本文整理匯總了Golang中code/cloudfoundry/org/cli/cf/commandregistry.Dependency.RepoLocator方法的典型用法代碼示例。如果您正苦於以下問題:Golang Dependency.RepoLocator方法的具體用法?Golang Dependency.RepoLocator怎麽用?Golang Dependency.RepoLocator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類code/cloudfoundry/org/cli/cf/commandregistry.Dependency
的用法示例。
在下文中一共展示了Dependency.RepoLocator方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
actor *actorsfakes.FakeServicePlanActor
requirementsFactory *requirementsfakes.FakeFactory
configRepo coreconfig.Repository
tokenRefresher *authenticationfakes.FakeRepository
deps commandregistry.Dependency
serviceName string
servicePlanName string
publicServicePlanName string
privateServicePlanName string
orgName string
)
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.RepoLocator = deps.RepoLocator.SetAuthenticationRepository(tokenRefresher)
deps.ServicePlanHandler = actor
deps.Config = configRepo
commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("enable-service-access").SetDependency(deps, pluginCall))
}
BeforeEach(func() {
ui = &testterm.FakeUI{}
actor = new(actorsfakes.FakeServicePlanActor)
configRepo = configuration.NewRepositoryWithDefaults()
requirementsFactory = new(requirementsfakes.FakeFactory)
tokenRefresher = new(authenticationfakes.FakeRepository)
})
runCommand := func(args []string) bool {
return testcmd.RunCLICommand("enable-service-access", args, requirementsFactory, updateCommandDependency, false, ui)
示例2:
. "github.com/onsi/gomega"
)
var _ = Describe("stop command", func() {
var (
ui *testterm.FakeUI
app models.Application
appRepo *applicationsfakes.FakeRepository
requirementsFactory *requirementsfakes.FakeFactory
config coreconfig.Repository
deps commandregistry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.RepoLocator = deps.RepoLocator.SetApplicationRepository(appRepo)
deps.Config = config
commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("stop").SetDependency(deps, pluginCall))
}
BeforeEach(func() {
ui = &testterm.FakeUI{}
config = testconfig.NewRepositoryWithDefaults()
appRepo = new(applicationsfakes.FakeRepository)
requirementsFactory = new(requirementsfakes.FakeFactory)
})
runCommand := func(args ...string) bool {
return testcmd.RunCLICommand("stop", args, requirementsFactory, updateCommandDependency, false, ui)
}
示例3:
. "code.cloudfoundry.org/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("ListBuildpacks", func() {
var (
ui *testterm.FakeUI
buildpackRepo *apifakes.OldFakeBuildpackRepository
requirementsFactory *requirementsfakes.FakeFactory
deps commandregistry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.RepoLocator = deps.RepoLocator.SetBuildpackRepository(buildpackRepo)
commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("buildpacks").SetDependency(deps, pluginCall))
}
BeforeEach(func() {
ui = &testterm.FakeUI{}
buildpackRepo = new(apifakes.OldFakeBuildpackRepository)
requirementsFactory = new(requirementsfakes.FakeFactory)
})
runCommand := func(args ...string) bool {
return testcmd.RunCLICommand("buildpacks", args, requirementsFactory, updateCommandDependency, false, ui)
}
Context("when arguments are provided", func() {
var cmd commandregistry.Command
示例4:
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("logs command", func() {
var (
ui *testterm.FakeUI
logsRepo *logsfakes.FakeRepository
requirementsFactory *requirementsfakes.FakeFactory
configRepo coreconfig.Repository
deps commandregistry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.RepoLocator = deps.RepoLocator.SetLogsRepository(logsRepo)
deps.Config = configRepo
commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("logs").SetDependency(deps, pluginCall))
}
BeforeEach(func() {
ui = &testterm.FakeUI{}
configRepo = testconfig.NewRepositoryWithDefaults()
logsRepo = new(logsfakes.FakeRepository)
requirementsFactory = new(requirementsfakes.FakeFactory)
})
runCommand := func(args ...string) bool {
return testcmd.RunCLICommand("logs", args, requirementsFactory, updateCommandDependency, false, ui)
}
示例5:
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("staging-environment-variable-group command", func() {
var (
ui *testterm.FakeUI
requirementsFactory *requirementsfakes.FakeFactory
configRepo coreconfig.Repository
environmentVariableGroupRepo *environmentvariablegroupsfakes.FakeRepository
deps commandregistry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.RepoLocator = deps.RepoLocator.SetEnvironmentVariableGroupsRepository(environmentVariableGroupRepo)
deps.Config = configRepo
commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("staging-environment-variable-group").SetDependency(deps, pluginCall))
}
BeforeEach(func() {
ui = &testterm.FakeUI{}
configRepo = testconfig.NewRepositoryWithDefaults()
requirementsFactory = new(requirementsfakes.FakeFactory)
environmentVariableGroupRepo = new(environmentvariablegroupsfakes.FakeRepository)
})
runCommand := func(args ...string) bool {
return testcmd.RunCLICommand("staging-environment-variable-group", args, requirementsFactory, updateCommandDependency, false, ui)
}
示例6:
)
var _ = Describe("target command", func() {
var (
orgRepo *organizationsfakes.FakeOrganizationRepository
spaceRepo *spacesfakes.FakeSpaceRepository
requirementsFactory *requirementsfakes.FakeFactory
config coreconfig.Repository
ui *testterm.FakeUI
deps commandregistry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.Config = config
deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(orgRepo)
deps.RepoLocator = deps.RepoLocator.SetSpaceRepository(spaceRepo)
commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("target").SetDependency(deps, pluginCall))
}
listSpacesStub := func(spaces []models.Space) func(func(models.Space) bool) error {
return func(cb func(models.Space) bool) error {
var keepGoing bool
for _, s := range spaces {
keepGoing = cb(s)
if !keepGoing {
break
}
}
return nil
}
示例7:
. "code.cloudfoundry.org/cli/testhelpers/matchers"
)
var _ = Describe("delete-service-auth-token command", func() {
var (
ui *testterm.FakeUI
configRepo coreconfig.Repository
authTokenRepo *apifakes.OldFakeAuthTokenRepo
requirementsFactory *requirementsfakes.FakeFactory
deps commandregistry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.RepoLocator = deps.RepoLocator.SetServiceAuthTokenRepository(authTokenRepo)
deps.Config = configRepo
commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("delete-service-auth-token").SetDependency(deps, pluginCall))
}
BeforeEach(func() {
ui = &testterm.FakeUI{Inputs: []string{"y"}}
authTokenRepo = new(apifakes.OldFakeAuthTokenRepo)
configRepo = testconfig.NewRepositoryWithDefaults()
requirementsFactory = new(requirementsfakes.FakeFactory)
requirementsFactory.NewLoginRequirementReturns(requirements.Passing{})
requirementsFactory.NewMaxAPIVersionRequirementReturns(requirements.Passing{})
})
runCommand := func(args ...string) bool {
return testcmd.RunCLICommand("delete-service-auth-token", args, requirementsFactory, updateCommandDependency, false, ui)
示例8:
var _ = Describe("bind-security-group command", func() {
var (
ui *testterm.FakeUI
configRepo coreconfig.Repository
fakeSecurityGroupRepo *securitygroupsfakes.FakeSecurityGroupRepo
requirementsFactory *requirementsfakes.FakeFactory
fakeSpaceRepo *spacesapifakes.FakeSpaceRepository
fakeOrgRepo *organizationsfakes.FakeOrganizationRepository
fakeSpaceBinder *spacesfakes.FakeSecurityGroupSpaceBinder
deps commandregistry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.RepoLocator = deps.RepoLocator.SetSpaceRepository(fakeSpaceRepo)
deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(fakeOrgRepo)
deps.RepoLocator = deps.RepoLocator.SetSecurityGroupRepository(fakeSecurityGroupRepo)
deps.RepoLocator = deps.RepoLocator.SetSecurityGroupSpaceBinder(fakeSpaceBinder)
deps.Config = configRepo
commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("bind-security-group").SetDependency(deps, pluginCall))
}
BeforeEach(func() {
ui = &testterm.FakeUI{}
fakeOrgRepo = new(organizationsfakes.FakeOrganizationRepository)
fakeSpaceRepo = new(spacesapifakes.FakeSpaceRepository)
requirementsFactory = new(requirementsfakes.FakeFactory)
fakeSecurityGroupRepo = new(securitygroupsfakes.FakeSecurityGroupRepo)
configRepo = testconfig.NewRepositoryWithDefaults()
fakeSpaceBinder = new(spacesfakes.FakeSecurityGroupSpaceBinder)
示例9:
var _ = Describe("unbind-security-group command", func() {
var (
ui *testterm.FakeUI
securityGroupRepo *securitygroupsfakes.FakeSecurityGroupRepo
orgRepo *organizationsfakes.FakeOrganizationRepository
spaceRepo *spacesapifakes.FakeSpaceRepository
secBinder *spacesfakes.FakeSecurityGroupSpaceBinder
requirementsFactory *requirementsfakes.FakeFactory
configRepo coreconfig.Repository
deps commandregistry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.RepoLocator = deps.RepoLocator.SetSpaceRepository(spaceRepo)
deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(orgRepo)
deps.RepoLocator = deps.RepoLocator.SetSecurityGroupRepository(securityGroupRepo)
deps.RepoLocator = deps.RepoLocator.SetSecurityGroupSpaceBinder(secBinder)
deps.Config = configRepo
commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("unbind-security-group").SetDependency(deps, pluginCall))
}
BeforeEach(func() {
ui = &testterm.FakeUI{}
requirementsFactory = new(requirementsfakes.FakeFactory)
securityGroupRepo = new(securitygroupsfakes.FakeSecurityGroupRepo)
orgRepo = new(organizationsfakes.FakeOrganizationRepository)
spaceRepo = new(spacesapifakes.FakeSpaceRepository)
secBinder = new(spacesfakes.FakeSecurityGroupSpaceBinder)
configRepo = testconfig.NewRepositoryWithDefaults()
示例10:
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("create-buildpack command", func() {
var (
requirementsFactory *requirementsfakes.FakeFactory
repo *apifakes.OldFakeBuildpackRepository
bitsRepo *apifakes.FakeBuildpackBitsRepository
ui *testterm.FakeUI
deps commandregistry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.RepoLocator = deps.RepoLocator.SetBuildpackRepository(repo)
deps.RepoLocator = deps.RepoLocator.SetBuildpackBitsRepository(bitsRepo)
commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("create-buildpack").SetDependency(deps, pluginCall))
}
BeforeEach(func() {
requirementsFactory = new(requirementsfakes.FakeFactory)
requirementsFactory.NewLoginRequirementReturns(requirements.Passing{})
repo = new(apifakes.OldFakeBuildpackRepository)
bitsRepo = new(apifakes.FakeBuildpackBitsRepository)
ui = &testterm.FakeUI{}
})
It("fails requirements when the user is not logged in", func() {
requirementsFactory.NewLoginRequirementReturns(requirements.Failing{Message: "not logged in"})
Expect(testcmd.RunCLICommand("create-buildpack", []string{"my-buildpack", "my-dir", "0"}, requirementsFactory, updateCommandDependency, false, ui)).To(BeFalse())
示例11:
. "github.com/onsi/gomega"
)
var _ = Describe("delete-org command", func() {
var (
config coreconfig.Repository
ui *testterm.FakeUI
requirementsFactory *requirementsfakes.FakeFactory
orgRepo *organizationsfakes.FakeOrganizationRepository
org models.Organization
deps commandregistry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(orgRepo)
deps.Config = config
commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("delete-org").SetDependency(deps, pluginCall))
}
BeforeEach(func() {
ui = &testterm.FakeUI{
Inputs: []string{"y"},
}
config = testconfig.NewRepositoryWithDefaults()
requirementsFactory = new(requirementsfakes.FakeFactory)
org = models.Organization{}
org.Name = "org-to-delete"
org.GUID = "org-to-delete-guid"
orgRepo = new(organizationsfakes.FakeOrganizationRepository)
示例12:
requirementsFactory.NewLoginRequirementReturns(requirements.Passing{})
requirementsFactory.NewTargetedSpaceRequirementReturns(requirements.Passing{})
application = models.Application{}
application.Name = "my-app"
application.GUID = "my-app-guid"
application.InstanceCount = 1
applicationReq := new(requirementsfakes.FakeApplicationRequirement)
applicationReq.GetApplicationReturns(application)
requirementsFactory.NewApplicationRequirementReturns(applicationReq)
})
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.Config = config
deps.RepoLocator = deps.RepoLocator.SetAppInstancesRepository(appInstancesRepo)
commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("restart-app-instance").SetDependency(deps, pluginCall))
}
runCommand := func(args ...string) bool {
return testcmd.RunCLICommand("restart-app-instance", args, requirementsFactory, updateCommandDependency, false, ui)
}
Describe("requirements", func() {
It("fails if not logged in", func() {
requirementsFactory.NewLoginRequirementReturns(requirements.Failing{Message: "not logged in"})
Expect(runCommand("my-app", "0")).To(BeFalse())
})
It("fails if a space is not targeted", func() {
requirementsFactory.NewTargetedSpaceRequirementReturns(requirements.Failing{Message: "not targeting space"})
示例13:
defaultInstanceErrorCodes []string
requirementsFactory *requirementsfakes.FakeFactory
logMessages atomic.Value
logRepo *logsfakes.FakeRepository
appInstancesRepo *appinstancesfakes.FakeAppInstancesRepository
appRepo *applicationsfakes.FakeRepository
originalAppCommand commandregistry.Command
deps commandregistry.Dependency
displayApp *applicationfakes.FakeAppDisplayer
)
updateCommandDependency := func(logsRepo logs.Repository) {
deps.UI = ui
deps.Config = configRepo
deps.RepoLocator = deps.RepoLocator.SetLogsRepository(logsRepo)
deps.RepoLocator = deps.RepoLocator.SetApplicationRepository(appRepo)
deps.RepoLocator = deps.RepoLocator.SetAppInstancesRepository(appInstancesRepo)
//inject fake 'Start' into registry
commandregistry.Register(displayApp)
commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("start").SetDependency(deps, false))
}
getInstance := func(appGUID string) ([]models.AppInstanceFields, error) {
var apiErr error
var instances []models.AppInstanceFields
if len(defaultInstanceResponses) > 0 {
instances, defaultInstanceResponses = defaultInstanceResponses[0], defaultInstanceResponses[1:]
示例14:
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("delete-security-group command", func() {
var (
ui *testterm.FakeUI
securityGroupRepo *securitygroupsfakes.FakeSecurityGroupRepo
requirementsFactory *requirementsfakes.FakeFactory
configRepo coreconfig.Repository
deps commandregistry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.RepoLocator = deps.RepoLocator.SetSecurityGroupRepository(securityGroupRepo)
deps.Config = configRepo
commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("delete-security-group").SetDependency(deps, pluginCall))
}
BeforeEach(func() {
ui = &testterm.FakeUI{}
requirementsFactory = new(requirementsfakes.FakeFactory)
securityGroupRepo = new(securitygroupsfakes.FakeSecurityGroupRepo)
configRepo = testconfig.NewRepositoryWithDefaults()
})
runCommand := func(args ...string) bool {
return testcmd.RunCLICommand("delete-security-group", args, requirementsFactory, updateCommandDependency, false, ui)
}
示例15:
"github.com/blang/semver"
)
var _ = Describe("create-quota command", func() {
var (
ui *testterm.FakeUI
quotaRepo *quotasfakes.FakeQuotaRepository
requirementsFactory *requirementsfakes.FakeFactory
configRepo coreconfig.Repository
deps commandregistry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.Config = configRepo
deps.RepoLocator = deps.RepoLocator.SetQuotaRepository(quotaRepo)
commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("create-quota").SetDependency(deps, pluginCall))
}
BeforeEach(func() {
ui = &testterm.FakeUI{}
configRepo = testconfig.NewRepositoryWithDefaults()
quotaRepo = new(quotasfakes.FakeQuotaRepository)
requirementsFactory = new(requirementsfakes.FakeFactory)
})
runCommand := func(args ...string) bool {
return testcmd.RunCLICommand("create-quota", args, requirementsFactory, updateCommandDependency, false, ui)
}
Describe("Help text", func() {