Esempio n. 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)
Esempio n. 2
0
func init() {
	commandregistry.Register(&BindRouteService{})
}
Esempio n. 3
0
func init() {
	commandregistry.Register(&CreateDomain{})
}
Esempio n. 4
0
func init() {
	commandregistry.Register(&UnsharePrivateDomain{})
}
Esempio n. 5
0
func init() {
	commandregistry.Register(&MarketplaceServices{})
}
Esempio n. 6
0
func init() {
	commandregistry.Register(&UpdateService{})
}
Esempio n. 7
0
func init() {
	commandregistry.Register(&PurgeServiceOffering{})
}
Esempio n. 8
0
func init() {
	commandregistry.Register(&Version{})
}
Esempio n. 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
Esempio n. 10
0
func init() {
	commandregistry.Register(&DeleteSharedDomain{})
}
Esempio n. 11
0
func init() {
	commandregistry.Register(&UpdateSecurityGroup{})
}
Esempio n. 12
0
func init() {
	commandregistry.Register(&ShowFeatureFlag{})
}
Esempio n. 13
0
func init() {
	commandregistry.Register(&DisallowSpaceSSH{})
}
Esempio n. 14
0
func init() {
	commandregistry.Register(&Files{})
}
Esempio n. 15
0
func init() {
	commandregistry.Register(&AddPluginRepo{})
}
Esempio n. 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)
	}
Esempio n. 17
0
func init() {
	commandregistry.Register(&UnsetEnv{})
}
Esempio n. 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")
			})
Esempio n. 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"},
				))
Esempio n. 20
0
func init() {
	commandregistry.Register(&ListStacks{})
}
Esempio n. 21
0
func init() {
	commandregistry.Register(&Target{})
}
Esempio n. 22
0
func init() {
	commandregistry.Register(&ListQuotas{})
}
Esempio n. 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)
Esempio n. 24
0
func init() {
	commandregistry.Register(&showQuota{})
}
Esempio n. 25
0
func init() {
	commandregistry.Register(&RemovePluginRepo{})
}
Esempio n. 26
0
func init() {
	commandregistry.Register(&ServiceAccess{})
}
Esempio n. 27
0
func init() {
	commandregistry.Register(&SpaceQuota{})
}
Esempio n. 28
0
func init() {
	commandregistry.Register(&SSHEnabled{})
}
Esempio n. 29
0
func init() {
	commandregistry.Register(&UnsetOrgRole{})
}
Esempio n. 30
0
func init() {
	commandregistry.Register(&UnmapRoute{})
}