Пример #1
0
		spaceQuotaRepo      *spacequotasfakes.FakeSpaceQuotaRepository
		OriginalCommand     commandregistry.Command
		deps                commandregistry.Dependency
	)

	updateCommandDependency := func(pluginCall bool) {
		deps.UI = ui
		deps.RepoLocator = deps.RepoLocator.SetSpaceRepository(spaceRepo)
		deps.RepoLocator = deps.RepoLocator.SetSpaceQuotaRepository(spaceQuotaRepo)
		deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(orgRepo)
		deps.RepoLocator = deps.RepoLocator.SetFeatureFlagRepository(flagRepo)
		deps.RepoLocator = deps.RepoLocator.SetUserRepository(userRepo)
		deps.Config = configRepo

		//inject fake 'command dependency' into registry
		commandregistry.Register(spaceRoleSetter)

		commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("create-space").SetDependency(deps, pluginCall))
	}

	runCommand := func(args ...string) bool {
		return testcmd.RunCLICommand("create-space", args, requirementsFactory, updateCommandDependency, false, ui)
	}

	BeforeEach(func() {
		ui = &testterm.FakeUI{}
		configRepo = testconfig.NewRepositoryWithDefaults()

		orgRepo = new(organizationsfakes.FakeOrganizationRepository)
		userRepo = new(apifakes.FakeUserRepository)
		spaceRoleSetter = commandregistry.Commands.FindCommand("set-space-role").(user.SpaceRoleSetter)
Пример #2
0
func init() {
	commandregistry.Register(&BindRouteService{})
}
Пример #3
0
func init() {
	commandregistry.Register(&CreateDomain{})
}
Пример #4
0
func init() {
	commandregistry.Register(&UnsharePrivateDomain{})
}
Пример #5
0
func init() {
	commandregistry.Register(&MarketplaceServices{})
}
Пример #6
0
func init() {
	commandregistry.Register(&UpdateService{})
}
Пример #7
0
func init() {
	commandregistry.Register(&PurgeServiceOffering{})
}
Пример #8
0
func init() {
	commandregistry.Register(&Version{})
}
Пример #9
0
		appRestarter        *applicationfakes.FakeRestarter
		OriginalCommand     commandregistry.Command
		deps                commandregistry.Dependency
	)

	updateCommandDependency := func(pluginCall bool) {
		deps.UI = ui
		deps.RepoLocator = deps.RepoLocator.SetAuthenticationRepository(authRepo)
		deps.RepoLocator = deps.RepoLocator.SetApplicationRepository(appRepo)
		deps.RepoLocator = deps.RepoLocator.SetCopyApplicationSourceRepository(copyAppSourceRepo)
		deps.RepoLocator = deps.RepoLocator.SetSpaceRepository(spaceRepo)
		deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(orgRepo)
		deps.Config = config

		//inject fake 'command dependency' into registry
		commandregistry.Register(appRestarter)

		commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("copy-source").SetDependency(deps, pluginCall))
	}

	BeforeEach(func() {
		ui = &testterm.FakeUI{}
		requirementsFactory = new(requirementsfakes.FakeFactory)
		authRepo = new(authenticationfakes.FakeRepository)
		appRepo = new(applicationsfakes.FakeRepository)
		copyAppSourceRepo = new(copyapplicationsourcefakes.FakeRepository)
		spaceRepo = new(spacesfakes.FakeSpaceRepository)
		orgRepo = new(organizationsfakes.FakeOrganizationRepository)
		config = testconfig.NewRepositoryWithDefaults()

		//save original command and restore later
Пример #10
0
func init() {
	commandregistry.Register(&DeleteSharedDomain{})
}
Пример #11
0
func init() {
	commandregistry.Register(&UpdateSecurityGroup{})
}
Пример #12
0
func init() {
	commandregistry.Register(&ShowFeatureFlag{})
}
Пример #13
0
func init() {
	commandregistry.Register(&DisallowSpaceSSH{})
}
Пример #14
0
func init() {
	commandregistry.Register(&Files{})
}
Пример #15
0
func init() {
	commandregistry.Register(&AddPluginRepo{})
}
Пример #16
0
		//save original command and restore later
		originalSSHCodeGetter = commandregistry.Commands.FindCommand("ssh-code")

		sshCodeGetter = new(commandsfakes.FakeSSHCodeGetter)

		//setup fakes to correctly interact with commandregistry
		sshCodeGetter.SetDependencyStub = func(_ commandregistry.Dependency, _ bool) commandregistry.Command {
			return sshCodeGetter
		}
		sshCodeGetter.MetaDataReturns(commandregistry.CommandMetadata{Name: "ssh-code"})
	})

	AfterEach(func() {
		//restore original command
		commandregistry.Register(originalSSHCodeGetter)
	})

	updateCommandDependency := func(pluginCall bool) {
		deps.UI = ui
		deps.Config = configRepo

		//inject fake 'sshCodeGetter' into registry
		commandregistry.Register(sshCodeGetter)

		commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("ssh").SetDependency(deps, pluginCall))
	}

	runCommand := func(args ...string) bool {
		return testcmd.RunCLICommand("ssh", args, requirementsFactory, updateCommandDependency, false, ui)
	}
Пример #17
0
func init() {
	commandregistry.Register(&UnsetEnv{})
}
Пример #18
0
	Context("i18n", func() {
		It("initialize i18n T() func", func() {
			Expect(T).ToNot(BeNil())
		})
	})

	Describe("Register()", func() {
		AfterEach(func() {
			commandregistry.Commands.RemoveCommand("fake-command2")
		})

		It("registers a command and its alias into the Command Registry map", func() {
			Expect(commandregistry.Commands.CommandExists("fake-command2")).To(BeFalse())
			Expect(commandregistry.Commands.CommandExists("fc2")).To(BeFalse())

			commandregistry.Register(FakeCommand2{})

			Expect(commandregistry.Commands.CommandExists("fake-command2")).To(BeTrue())
			Expect(commandregistry.Commands.CommandExists("fc2")).To(BeTrue())
		})
	})

	Describe("CommandExists()", func() {
		Context("when the command has been registered", func() {
			BeforeEach(func() {
				commandregistry.Register(FakeCommand1{})
			})

			AfterEach(func() {
				commandregistry.Commands.RemoveCommand("fake-command")
			})
Пример #19
0
				runCommand(test_with_help, "-f")

				Expect(ui.Outputs()).To(ContainSubstrings(
					[]string{"Command `help` in the plugin being installed is a native CF command/alias.  Rename the `help` command in the plugin being installed in order to enable its installation and use."},
					[]string{"FAILED"},
				))
			})
		})

		Context("when the plugin's command conflicts with a core command/alias", func() {
			var originalCommand commandregistry.Command

			BeforeEach(func() {
				originalCommand = commandregistry.Commands.FindCommand("org")

				commandregistry.Register(testOrgsCmd{})
			})

			AfterEach(func() {
				if originalCommand != nil {
					commandregistry.Register(originalCommand)
				}
			})

			It("fails if is shares a command name", func() {
				runCommand(test_with_orgs, "-f")

				Expect(ui.Outputs()).To(ContainSubstrings(
					[]string{"Command `orgs` in the plugin being installed is a native CF command/alias.  Rename the `orgs` command in the plugin being installed in order to enable its installation and use."},
					[]string{"FAILED"},
				))
Пример #20
0
func init() {
	commandregistry.Register(&ListStacks{})
}
Пример #21
0
func init() {
	commandregistry.Register(&Target{})
}
Пример #22
0
func init() {
	commandregistry.Register(&ListQuotas{})
}
Пример #23
0
		starter             *applicationfakes.FakeStarter
		stopper             *applicationfakes.FakeStopper
		config              coreconfig.Repository
		app                 models.Application
		originalStop        commandregistry.Command
		originalStart       commandregistry.Command
		deps                commandregistry.Dependency
		applicationReq      *requirementsfakes.FakeApplicationRequirement
	)

	updateCommandDependency := func(pluginCall bool) {
		deps.UI = ui
		deps.Config = config

		//inject fake 'stopper and starter' into registry
		commandregistry.Register(starter)
		commandregistry.Register(stopper)

		commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("restart").SetDependency(deps, pluginCall))
	}

	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)
Пример #24
0
func init() {
	commandregistry.Register(&showQuota{})
}
Пример #25
0
func init() {
	commandregistry.Register(&RemovePluginRepo{})
}
Пример #26
0
func init() {
	commandregistry.Register(&ServiceAccess{})
}
Пример #27
0
func init() {
	commandregistry.Register(&SpaceQuota{})
}
Пример #28
0
func init() {
	commandregistry.Register(&SSHEnabled{})
}
Пример #29
0
func init() {
	commandregistry.Register(&UnsetOrgRole{})
}
Пример #30
0
func init() {
	commandregistry.Register(&UnmapRoute{})
}