本文整理匯總了Golang中code/cloudfoundry/org/cli/cf/models.Application.Name方法的典型用法代碼示例。如果您正苦於以下問題:Golang Application.Name方法的具體用法?Golang Application.Name怎麽用?Golang Application.Name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類code/cloudfoundry/org/cli/cf/models.Application
的用法示例。
在下文中一共展示了Application.Name方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
},
{
Host: "app1",
Domain: models.DomainFields{
Name: "example.com",
},
}}
app2Routes := []models.RouteSummary{
{
Host: "app2",
Domain: models.DomainFields{Name: "cfapps.io"},
}}
app := models.Application{}
app.Name = "Application-1"
app.GUID = "Application-1-guid"
app.State = "started"
app.RunningInstances = 1
app.InstanceCount = 1
app.Memory = 512
app.DiskQuota = 1024
app.Routes = app1Routes
app.AppPorts = []int{8080, 9090}
app2 := models.Application{}
app2.Name = "Application-2"
app2.GUID = "Application-2-guid"
app2.State = "started"
app2.RunningInstances = 1
app2.InstanceCount = 2
示例2:
})
})
})
})
Describe("ssh", func() {
var (
currentApp models.Application
)
BeforeEach(func() {
requirementsFactory.NewLoginRequirementReturns(requirements.Passing{})
requirementsFactory.NewTargetedSpaceRequirementReturns(requirements.Passing{})
currentApp = models.Application{}
currentApp.Name = "my-app"
currentApp.State = "started"
currentApp.GUID = "my-app-guid"
currentApp.EnableSSH = true
currentApp.Diego = true
applicationReq := new(requirementsfakes.FakeApplicationRequirement)
applicationReq.GetApplicationReturns(currentApp)
requirementsFactory.NewApplicationRequirementReturns(applicationReq)
})
Describe("Error getting required info to run ssh", func() {
var (
testServer *httptest.Server
handler *testnet.TestHandler
)
示例3:
}
runCommand := func(args ...string) bool {
return testcmd.RunCLICommand("restart", args, requirementsFactory, updateCommandDependency, false, ui)
}
BeforeEach(func() {
ui = &testterm.FakeUI{}
deps = commandregistry.NewDependency(os.Stdout, new(tracefakes.FakePrinter), "")
requirementsFactory = new(requirementsfakes.FakeFactory)
starter = new(applicationfakes.FakeStarter)
stopper = new(applicationfakes.FakeStopper)
config = testconfig.NewRepositoryWithDefaults()
app = models.Application{}
app.Name = "my-app"
app.GUID = "my-app-guid"
applicationReq = new(requirementsfakes.FakeApplicationRequirement)
applicationReq.GetApplicationReturns(app)
//save original command and restore later
originalStart = commandregistry.Commands.FindCommand("start")
originalStop = commandregistry.Commands.FindCommand("stop")
//setup fakes to correctly interact with commandregistry
starter.SetDependencyStub = func(_ commandregistry.Dependency, _ bool) commandregistry.Command {
return starter
}
starter.MetaDataReturns(commandregistry.CommandMetadata{Name: "start"})
示例4:
flagContext = flags.NewFlagContext(cmd.MetaData().Flags)
factory = new(requirementsfakes.FakeFactory)
loginRequirement = &passingRequirement{Name: "login-requirement"}
factory.NewLoginRequirementReturns(loginRequirement)
targetedSpaceRequirement = &passingRequirement{}
factory.NewTargetedSpaceRequirementReturns(targetedSpaceRequirement)
deaApplicationRequirement = new(requirementsfakes.FakeDEAApplicationRequirement)
factory.NewDEAApplicationRequirementReturns(deaApplicationRequirement)
app := models.Application{}
app.InstanceCount = 1
app.GUID = "app-guid"
app.Name = "app-name"
deaApplicationRequirement.GetApplicationReturns(app)
})
Describe("Requirements", func() {
Context("when not provided one or two args", func() {
BeforeEach(func() {
flagContext.Parse("app-name", "the-path", "extra-arg")
})
It("fails with usage", func() {
_, err := cmd.Requirements(factory, flagContext)
Expect(err).To(HaveOccurred())
Expect(ui.Outputs()).To(ContainSubstrings(
[]string{"FAILED"},
[]string{"Incorrect Usage. Requires an argument"},
示例5:
requirementsFactory *requirementsfakes.FakeFactory
application models.Application
deps commandregistry.Dependency
)
BeforeEach(func() {
ui = &testterm.FakeUI{}
appInstancesRepo = new(appinstancesfakes.FakeAppInstancesRepository)
config = testconfig.NewRepositoryWithDefaults()
requirementsFactory = new(requirementsfakes.FakeFactory)
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 {
示例6:
"guid": "my-cool-app-guid"
},
"entity": {
"name": "my-cool-app"
}
}`),
),
)
})
It("returns the application", func() {
createdApp, err := repo.Create(appParams)
Expect(err).NotTo(HaveOccurred())
app := models.Application{}
app.Name = "my-cool-app"
app.GUID = "my-cool-app-guid"
Expect(createdApp).To(Equal(app))
})
})
Context("when the create fails", func() {
BeforeEach(func() {
h := ccServer.GetHandler(0)
ccServer.SetHandler(0,
ghttp.CombineHandlers(
h,
ghttp.RespondWith(http.StatusInternalServerError, ""),
),
)
})
示例7:
routeRepo *apifakes.FakeRouteRepository
requirementsFactory *requirementsfakes.FakeFactory
deps commandregistry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.Config = configRepo
deps.RepoLocator = deps.RepoLocator.SetApplicationRepository(appRepo)
deps.RepoLocator = deps.RepoLocator.SetRouteRepository(routeRepo)
commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("delete").SetDependency(deps, pluginCall))
}
BeforeEach(func() {
app = models.Application{}
app.Name = "app-to-delete"
app.GUID = "app-to-delete-guid"
ui = &testterm.FakeUI{}
appRepo = new(applicationsfakes.FakeRepository)
routeRepo = new(apifakes.FakeRouteRepository)
requirementsFactory = new(requirementsfakes.FakeFactory)
configRepo = testconfig.NewRepositoryWithDefaults()
})
runCommand := func(args ...string) bool {
return testcmd.RunCLICommand("delete", args, requirementsFactory, updateCommandDependency, false, ui)
}
It("fails requirements when not logged in", func() {
示例8:
})
})
Describe("Execute", func() {
var (
application models.Application
runCLIErr error
)
BeforeEach(func() {
err := flagContext.Parse("app-name")
Expect(err).NotTo(HaveOccurred())
cmd.Requirements(factory, flagContext)
application = models.Application{}
application.Name = "app-name"
})
JustBeforeEach(func() {
runCLIErr = cmd.Execute(flagContext)
})
AfterEach(func() {
os.Remove("app-name_manifest.yml")
})
Context("when there is an app summary", func() {
BeforeEach(func() {
appSummaryRepo.GetSummaryReturns(application, nil)
})