本文整理匯總了Golang中cf.Domain.Name方法的典型用法代碼示例。如果您正苦於以下問題:Golang Domain.Name方法的具體用法?Golang Domain.Name怎麽用?Golang Domain.Name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cf.Domain
的用法示例。
在下文中一共展示了Domain.Name方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: TestListDomains
func TestListDomains(t *testing.T) {
orgFields := cf.OrganizationFields{}
orgFields.Name = "my-org"
orgFields.Guid = "my-org-guid"
reqFactory := &testreq.FakeReqFactory{LoginSuccess: true, TargetedOrgSuccess: true, OrganizationFields: orgFields}
domain1 := cf.Domain{}
domain1.Shared = true
domain1.Name = "Domain1"
domain2 := cf.Domain{}
domain2.Shared = false
domain2.Name = "Domain2"
domain3 := cf.Domain{}
domain3.Shared = false
domain3.Name = "Domain3"
domainRepo := &testapi.FakeDomainRepository{
ListSharedDomainsDomains: []cf.Domain{domain1},
ListDomainsForOrgDomains: []cf.Domain{domain2, domain3},
}
ui := callListDomains(t, []string{}, reqFactory, domainRepo)
assert.Equal(t, domainRepo.ListDomainsForOrgDomainsGuid, "my-org-guid")
testassert.SliceContains(t, ui.Outputs, testassert.Lines{
{"Getting domains in org", "my-org", "my-user"},
{"name", "status"},
{"Domain1", "shared"},
{"Domain2", "owned"},
{"Domain3", "owned"},
})
}
示例2: TestPushingAppWhenItDoesNotExist
func TestPushingAppWhenItDoesNotExist(t *testing.T) {
deps := getPushDependencies()
domain := cf.Domain{}
domain.Guid = "not-the-right-guid"
domain.Name = "not shared domain"
domain.OwningOrganizationGuid = "my-org-guid"
sharedDomain := cf.Domain{}
sharedDomain.Name = "foo.cf-app.com"
sharedDomain.Shared = true
sharedDomain.Guid = "foo-domain-guid"
appRepo := deps.appRepo
domainRepo := deps.domainRepo
routeRepo := deps.routeRepo
appBitsRepo := deps.appBitsRepo
stopper := deps.stopper
starter := deps.starter
domainRepo.ListDomainsForOrgDomains = []cf.Domain{domain, sharedDomain}
routeRepo.FindByHostAndDomainErr = true
appRepo.ReadNotFound = true
ui := callPush(t, []string{"-t", "111", "my-new-app"}, deps)
assert.Equal(t, appRepo.CreatedAppParams().Get("name").(string), "my-new-app")
assert.Equal(t, appRepo.CreatedAppParams().Get("space_guid").(string), "my-space-guid")
assert.Equal(t, routeRepo.FindByHostAndDomainHost, "my-new-app")
assert.Equal(t, routeRepo.CreatedHost, "my-new-app")
assert.Equal(t, routeRepo.CreatedDomainGuid, "foo-domain-guid")
assert.Equal(t, routeRepo.BoundAppGuid, "my-new-app-guid")
assert.Equal(t, routeRepo.BoundRouteGuid, "my-new-app-route-guid")
assert.Equal(t, appBitsRepo.UploadedAppGuid, "my-new-app-guid")
testassert.SliceContains(t, ui.Outputs, testassert.Lines{
{"Creating app", "my-new-app", "my-org", "my-space"},
{"OK"},
{"Creating", "my-new-app.foo.cf-app.com"},
{"OK"},
{"Binding", "my-new-app.foo.cf-app.com"},
{"OK"},
{"Uploading my-new-app"},
{"OK"},
})
assert.Equal(t, stopper.AppToStop.Guid, "")
assert.Equal(t, starter.AppToStart.Guid, "my-new-app-guid")
assert.Equal(t, starter.AppToStart.Name, "my-new-app")
assert.Equal(t, starter.Timeout, 111)
}
示例3: TestMapRouteWhenBinding
func TestMapRouteWhenBinding(t *testing.T) {
domain := cf.Domain{}
domain.Guid = "my-domain-guid"
domain.Name = "example.com"
route := cf.Route{}
route.Guid = "my-route-guid"
route.Host = "foo"
route.Domain = domain.DomainFields
app := cf.Application{}
app.Guid = "my-app-guid"
app.Name = "my-app"
routeRepo := &testapi.FakeRouteRepository{}
reqFactory := &testreq.FakeReqFactory{LoginSuccess: true, Application: app, Domain: domain}
routeCreator := &testcmd.FakeRouteCreator{ReservedRoute: route}
ui := callMapRoute(t, []string{"-n", "my-host", "my-app", "my-domain.com"}, reqFactory, routeRepo, routeCreator)
testassert.SliceContains(t, ui.Outputs, testassert.Lines{
{"Adding route", "foo.example.com", "my-app", "my-org", "my-space", "my-user"},
{"OK"},
})
assert.Equal(t, routeRepo.BoundRouteGuid, "my-route-guid")
assert.Equal(t, routeRepo.BoundAppGuid, "my-app-guid")
}
示例4: TestPushingAppWhenItAlreadyExistsWithoutARouteCreatesADefaultDomain
func TestPushingAppWhenItAlreadyExistsWithoutARouteCreatesADefaultDomain(t *testing.T) {
deps := getPushDependencies()
sharedDomain := cf.Domain{}
sharedDomain.Name = "foo.cf-app.com"
sharedDomain.Shared = true
sharedDomain.Guid = "foo-domain-guid"
deps.routeRepo.FindByHostAndDomainErr = true
deps.domainRepo.ListSharedDomainsDomains = []cf.Domain{sharedDomain}
deps.appRepo.ReadApp = maker.NewApp(maker.Overrides{"name": "existing-app", "guid": "existing-app-guid"})
deps.appRepo.UpdateAppResult = deps.appRepo.ReadApp
ui := callPush(t, []string{"-t", "111", "existing-app"}, deps)
testassert.SliceContains(t, ui.Outputs, testassert.Lines{
{"Creating route", "existing-app.foo.cf-app.com"},
{"OK"},
{"Binding", "existing-app.foo.cf-app.com"},
{"OK"},
{"Uploading"},
{"OK"},
})
assert.Equal(t, deps.routeRepo.FindByHostAndDomainDomain, "foo.cf-app.com")
assert.Equal(t, deps.routeRepo.FindByHostAndDomainHost, "existing-app")
assert.Equal(t, deps.routeRepo.CreatedHost, "existing-app")
assert.Equal(t, deps.routeRepo.CreatedDomainGuid, "foo-domain-guid")
assert.Equal(t, deps.routeRepo.BoundAppGuid, "existing-app-guid")
assert.Equal(t, deps.routeRepo.BoundRouteGuid, "existing-app-route-guid")
}
示例5: TestPushingAppWhenItAlreadyExistsAndHostIsSpecified
func TestPushingAppWhenItAlreadyExistsAndHostIsSpecified(t *testing.T) {
deps := getPushDependencies()
domain := cf.Domain{}
domain.Name = "example.com"
domain.Guid = "domain-guid"
domain.Shared = true
existingRoute := cf.RouteSummary{}
existingRoute.Host = "existing-app"
existingRoute.Domain = domain.DomainFields
existingApp := cf.Application{}
existingApp.Name = "existing-app"
existingApp.Guid = "existing-app-guid"
existingApp.Routes = []cf.RouteSummary{existingRoute}
deps.appRepo.ReadApp = existingApp
deps.appRepo.UpdateAppResult = existingApp
deps.routeRepo.FindByHostAndDomainNotFound = true
deps.domainRepo.ListSharedDomainsDomains = []cf.Domain{domain}
ui := callPush(t, []string{"-n", "new-host", "existing-app"}, deps)
testassert.SliceContains(t, ui.Outputs, testassert.Lines{
{"Creating route", "new-host.example.com"},
{"OK"},
{"Binding", "new-host.example.com"},
})
assert.Equal(t, deps.routeRepo.FindByHostAndDomainDomain, "example.com")
assert.Equal(t, deps.routeRepo.FindByHostAndDomainHost, "new-host")
assert.Equal(t, deps.routeRepo.CreatedHost, "new-host")
assert.Equal(t, deps.routeRepo.CreatedDomainGuid, "domain-guid")
}
示例6: TestPushingAppWithCustomFlags
func TestPushingAppWithCustomFlags(t *testing.T) {
deps := getPushDependencies()
domain := cf.Domain{}
domain.Name = "bar.cf-app.com"
domain.Guid = "bar-domain-guid"
stack := cf.Stack{}
stack.Name = "customLinux"
stack.Guid = "custom-linux-guid"
deps.domainRepo.FindByNameDomain = domain
deps.routeRepo.FindByHostAndDomainErr = true
deps.stackRepo.FindByNameStack = stack
deps.appRepo.ReadNotFound = true
ui := callPush(t, []string{
"-c", "unicorn -c config/unicorn.rb -D",
"-d", "bar.cf-app.com",
"-n", "my-hostname",
"-i", "3",
"-m", "2G",
"-b", "https://github.com/heroku/heroku-buildpack-play.git",
"-s", "customLinux",
"-t", "1",
"--no-start",
"my-new-app",
}, deps)
testassert.SliceContains(t, ui.Outputs, testassert.Lines{
{"Using", "customLinux"},
{"OK"},
{"Creating app", "my-new-app"},
{"OK"},
{"Creating Route", "my-hostname.bar.cf-app.com"},
{"OK"},
{"Binding", "my-hostname.bar.cf-app.com", "my-new-app"},
{"Uploading", "my-new-app"},
{"OK"},
})
assert.Equal(t, deps.stackRepo.FindByNameName, "customLinux")
assert.Equal(t, deps.appRepo.CreatedAppParams().Get("name").(string), "my-new-app")
assert.Equal(t, deps.appRepo.CreatedAppParams().Get("command").(string), "unicorn -c config/unicorn.rb -D")
assert.Equal(t, deps.appRepo.CreatedAppParams().Get("instances").(int), 3)
assert.Equal(t, deps.appRepo.CreatedAppParams().Get("memory").(uint64), uint64(2048))
assert.Equal(t, deps.appRepo.CreatedAppParams().Get("stack_guid"), "custom-linux-guid")
assert.Equal(t, deps.appRepo.CreatedAppParams().Get("health_check_timeout").(int), 1)
assert.Equal(t, deps.appRepo.CreatedAppParams().Get("buildpack"), "https://github.com/heroku/heroku-buildpack-play.git")
assert.Equal(t, deps.domainRepo.FindByNameInCurrentSpaceName, "bar.cf-app.com")
assert.Equal(t, deps.routeRepo.CreatedHost, "my-hostname")
assert.Equal(t, deps.routeRepo.CreatedDomainGuid, "bar-domain-guid")
assert.Equal(t, deps.routeRepo.BoundAppGuid, "my-new-app-guid")
assert.Equal(t, deps.routeRepo.BoundRouteGuid, "my-hostname-route-guid")
assert.Equal(t, deps.appBitsRepo.UploadedAppGuid, "my-new-app-guid")
assert.Equal(t, deps.starter.AppToStart.Name, "")
}
示例7: TestPushingAppWhenItDoesNotExistButRouteExists
func TestPushingAppWhenItDoesNotExistButRouteExists(t *testing.T) {
deps := getPushDependencies()
domain := cf.Domain{}
domain.Name = "foo.cf-app.com"
domain.Guid = "foo-domain-guid"
domain.Shared = true
route := cf.Route{}
route.Guid = "my-route-guid"
route.Host = "my-new-app"
route.Domain = domain.DomainFields
deps.domainRepo.ListSharedDomainsDomains = []cf.Domain{domain}
deps.routeRepo.FindByHostAndDomainRoute = route
deps.appRepo.ReadNotFound = true
ui := callPush(t, []string{"my-new-app"}, deps)
assert.Empty(t, deps.routeRepo.CreatedHost)
assert.Empty(t, deps.routeRepo.CreatedDomainGuid)
assert.Equal(t, deps.routeRepo.FindByHostAndDomainHost, "my-new-app")
assert.Equal(t, deps.routeRepo.BoundAppGuid, "my-new-app-guid")
assert.Equal(t, deps.routeRepo.BoundRouteGuid, "my-route-guid")
testassert.SliceContains(t, ui.Outputs, testassert.Lines{
{"Using", "my-new-app.foo.cf-app.com"},
{"Binding", "my-new-app.foo.cf-app.com"},
{"OK"},
})
}
示例8: TestDomainReqExecute
func TestDomainReqExecute(t *testing.T) {
domain := cf.Domain{}
domain.Name = "example.com"
domain.Guid = "domain-guid"
domainRepo := &testapi.FakeDomainRepository{FindByNameDomain: domain}
ui := new(testterm.FakeUI)
domainReq := newDomainRequirement("example.com", ui, domainRepo)
success := domainReq.Execute()
assert.True(t, success)
assert.Equal(t, domainRepo.FindByNameInCurrentSpaceName, "example.com")
assert.Equal(t, domainReq.GetDomain(), domain)
}
示例9: TestPushingAppWithNoRoute
func TestPushingAppWithNoRoute(t *testing.T) {
deps := getPushDependencies()
domain := cf.Domain{}
domain.Name = "bar.cf-app.com"
domain.Guid = "bar-domain-guid"
deps.domainRepo.FindByNameDomain = domain
deps.routeRepo.FindByHostErr = true
deps.appRepo.ReadNotFound = true
callPush(t, []string{
"--no-route",
"my-new-app",
}, deps)
assert.Equal(t, deps.appRepo.CreatedAppParams().Get("name").(string), "my-new-app")
assert.Equal(t, deps.routeRepo.CreatedHost, "")
assert.Equal(t, deps.routeRepo.CreatedDomainGuid, "")
}
示例10: TestDeleteDomainForceFlagSkipsConfirmation
func TestDeleteDomainForceFlagSkipsConfirmation(t *testing.T) {
reqFactory := &testreq.FakeReqFactory{LoginSuccess: true, TargetedOrgSuccess: true}
domain := cf.Domain{}
domain.Name = "foo.com"
domain.Guid = "foo-guid"
domain.Shared = true
domainRepo := &testapi.FakeDomainRepository{
FindByNameInOrgDomain: domain,
}
ui := callDeleteDomain(t, []string{"-f", "foo.com"}, []string{}, reqFactory, domainRepo)
assert.Equal(t, domainRepo.DeleteDomainGuid, "foo-guid")
assert.Equal(t, len(ui.Prompts), 0)
testassert.SliceContains(t, ui.Outputs, testassert.Lines{
{"Deleting domain", "foo.com"},
{"OK"},
})
}
示例11: TestDeleteDomainDeleteError
func TestDeleteDomainDeleteError(t *testing.T) {
domain := cf.Domain{}
domain.Name = "foo.com"
domain.Guid = "foo-guid"
domainRepo := &testapi.FakeDomainRepository{
FindByNameInOrgDomain: domain,
DeleteApiResponse: net.NewApiResponseWithMessage("failed badly"),
}
reqFactory := &testreq.FakeReqFactory{LoginSuccess: true, TargetedOrgSuccess: true}
ui := callDeleteDomain(t, []string{"foo.com"}, []string{"y"}, reqFactory, domainRepo)
assert.Equal(t, domainRepo.DeleteDomainGuid, "foo-guid")
testassert.SliceContains(t, ui.Outputs, testassert.Lines{
{"Deleting domain", "foo.com"},
{"FAILED"},
{"foo.com"},
{"failed badly"},
})
}
示例12: TestPushingAppWithSingleAppManifest
func TestPushingAppWithSingleAppManifest(t *testing.T) {
deps := getPushDependencies()
domain := cf.Domain{}
domain.Name = "manifest-example.com"
domain.Guid = "bar-domain-guid"
deps.domainRepo.FindByNameDomain = domain
deps.routeRepo.FindByHostAndDomainErr = true
deps.appRepo.ReadNotFound = true
deps.manifestRepo.ReadManifestManifest = singleAppManifest()
ui := callPush(t, []string{}, deps)
testassert.SliceContains(t, ui.Outputs, testassert.Lines{
{"Creating route", "manifest-host.manifest-example.com"},
{"OK"},
{"Binding", "manifest-host.manifest-example.com"},
{"manifest-app-name"},
})
cwd, err := os.Getwd()
assert.NoError(t, err)
assert.Equal(t, deps.appRepo.CreatedAppParams().Get("name").(string), "manifest-app-name")
assert.Equal(t, deps.appRepo.CreatedAppParams().Get("memory").(uint64), uint64(128))
assert.Equal(t, deps.appRepo.CreatedAppParams().Get("instances").(int), 1)
assert.Equal(t, deps.appRepo.CreatedAppParams().Get("stack").(string), "custom-stack")
assert.Equal(t, deps.appRepo.CreatedAppParams().Get("buildpack").(string), "some-buildpack")
assert.Equal(t, deps.appRepo.CreatedAppParams().Get("command").(string), "JAVA_HOME=$PWD/.openjdk JAVA_OPTS=\"-Xss995K\" ./bin/start.sh run")
assert.Equal(t, deps.appRepo.CreatedAppParams().Get("path").(string), filepath.Join(cwd, "../../fixtures/example-app"))
assert.True(t, deps.appRepo.CreatedAppParams().Has("env"))
envVars := deps.appRepo.CreatedAppParams().Get("env").(generic.Map)
assert.Equal(t, 2, envVars.Count())
assert.True(t, envVars.Has("PATH"))
assert.True(t, envVars.Has("FOO"))
assert.Equal(t, envVars.Get("PATH").(string), "/u/apps/my-app/bin")
assert.Equal(t, envVars.Get("FOO").(string), "baz")
}
示例13: TestPushingAppWhenItAlreadyExistsAndDomainSpecifiedIsNotBound
func TestPushingAppWhenItAlreadyExistsAndDomainSpecifiedIsNotBound(t *testing.T) {
deps := getPushDependencies()
domain := cf.DomainFields{}
domain.Name = "example.com"
existingRoute := cf.RouteSummary{}
existingRoute.Host = "existing-app"
existingRoute.Domain = domain
existingApp := cf.Application{}
existingApp.Name = "existing-app"
existingApp.Guid = "existing-app-guid"
existingApp.Routes = []cf.RouteSummary{existingRoute}
foundDomain := cf.Domain{}
foundDomain.Guid = "domain-guid"
foundDomain.Name = "newdomain.com"
deps.appRepo.ReadApp = existingApp
deps.appRepo.UpdateAppResult = existingApp
deps.routeRepo.FindByHostAndDomainNotFound = true
deps.domainRepo.FindByNameDomain = foundDomain
ui := callPush(t, []string{"-d", "newdomain.com", "existing-app"}, deps)
testassert.SliceContains(t, ui.Outputs, testassert.Lines{
{"Creating route", "existing-app.newdomain.com"},
{"OK"},
{"Binding", "existing-app.newdomain.com"},
})
assert.Equal(t, deps.appBitsRepo.UploadedAppGuid, "existing-app-guid")
assert.Equal(t, deps.domainRepo.FindByNameInCurrentSpaceName, "newdomain.com")
assert.Equal(t, deps.routeRepo.FindByHostAndDomainDomain, "newdomain.com")
assert.Equal(t, deps.routeRepo.FindByHostAndDomainHost, "existing-app")
assert.Equal(t, deps.routeRepo.CreatedHost, "existing-app")
assert.Equal(t, deps.routeRepo.CreatedDomainGuid, "domain-guid")
}
示例14: TestDeleteDomainNoConfirmation
func TestDeleteDomainNoConfirmation(t *testing.T) {
domain := cf.Domain{}
domain.Name = "foo.com"
domain.Guid = "foo-guid"
domainRepo := &testapi.FakeDomainRepository{
FindByNameInOrgDomain: domain,
}
reqFactory := &testreq.FakeReqFactory{LoginSuccess: true, TargetedOrgSuccess: true}
ui := callDeleteDomain(t, []string{"foo.com"}, []string{"no"}, reqFactory, domainRepo)
assert.Equal(t, domainRepo.DeleteDomainGuid, "")
testassert.SliceContains(t, ui.Prompts, testassert.Lines{
{"delete", "foo.com"},
})
assert.Equal(t, len(ui.Outputs), 1)
testassert.SliceContains(t, ui.Outputs, testassert.Lines{
{"Deleting domain", "foo.com"},
})
}
示例15: TestPushingAppWithACrazyName
func TestPushingAppWithACrazyName(t *testing.T) {
deps := getPushDependencies()
sharedDomain := cf.Domain{}
sharedDomain.Name = "foo.cf-app.com"
sharedDomain.Shared = true
sharedDomain.Guid = "foo-domain-guid"
deps.domainRepo.ListSharedDomainsDomains = []cf.Domain{sharedDomain}
deps.routeRepo.FindByHostAndDomainErr = true
deps.appRepo.ReadNotFound = true
ui := callPush(t, []string{"-t", "111", "Tim's 1st-Crazy__app!"}, deps)
assert.Equal(t, deps.appRepo.CreatedAppParams().Get("name"), "Tim's 1st-Crazy__app!")
assert.Equal(t, deps.routeRepo.FindByHostAndDomainHost, "tims-1st-crazy-app")
assert.Equal(t, deps.routeRepo.CreatedHost, "tims-1st-crazy-app")
testassert.SliceContains(t, ui.Outputs, testassert.Lines{
{"Creating", "tims-1st-crazy-app.foo.cf-app.com"},
{"Binding", "tims-1st-crazy-app.foo.cf-app.com"},
})
}