public void RestartApp_Test() { using (ShimsContext.Create()) { CloudFoundry.CloudController.V2.Client.Fakes.ShimCloudFoundryClient.AllInstances.LoginCloudCredentials = TestUtils.CustomLogin; CloudFoundry.CloudController.V2.Client.Base.Fakes.ShimAbstractAppsEndpoint.AllInstances.UpdateAppNullableOfGuidUpdateAppRequest = TestUtils.CustomUpdateApp; CloudFoundry.CloudController.V2.Client.Base.Fakes.ShimAbstractAppsEndpoint.AllInstances.GetAppSummaryNullableOfGuid = TestUtils.CustomGetAppSummary; CloudFoundry.CloudController.V2.Client.Fakes.ShimInfoEndpoint.AllInstances.GetV1Info = TestUtils.CustomGetV1Info; CloudFoundry.Logyard.Client.Fakes.ShimLogyardLog.AllInstances.StartLogStreamString = TestUtils.CustomStartLogStreamString; TestUtils.InitTestMetadata(); RestartApp task = new RestartApp(); task.CFAppGuid = Guid.NewGuid().ToString(); task.CFUser = Settings.Default.User; task.CFPassword = Settings.Default.Password; task.CFServerUri = Settings.Default.ServerUri; task.BuildEngine = new FakeBuildEngine(); Assert.IsTrue(task.Execute()); } }
public void RestartApp_Test() { using (ShimsContext.Create()) { CloudFoundry.CloudController.V2.Client.Fakes.ShimCloudFoundryClient.AllInstances.LoginCloudCredentials = TestUtils.CustomLogin; CloudFoundry.Manifests.Fakes.ShimManifestDiskRepository.ReadManifestString = TestUtils.CustomReadManifest; CloudFoundry.Manifests.Fakes.ShimManifest.AllInstances.Applications = TestUtils.CustomManifestApplications; CloudFoundry.CloudController.V2.Client.Base.Fakes.ShimAbstractAppsEndpoint.AllInstances.UpdateAppNullableOfGuidUpdateAppRequest = TestUtils.CustomUpdateApp; CloudFoundry.CloudController.V2.Client.Base.Fakes.ShimAbstractAppsEndpoint.AllInstances.GetAppSummaryNullableOfGuid = TestUtils.CustomGetAppSummary; CloudFoundry.CloudController.V2.Client.Fakes.ShimInfoEndpoint.AllInstances.GetV1Info = TestUtils.CustomGetV1Info; CloudFoundry.CloudController.V2.Client.Base.Fakes.ShimAbstractInfoEndpoint.AllInstances.GetInfo = TestUtils.CustomGetInfo; CloudFoundry.Loggregator.Client.Fakes.ShimLoggregatorLog.AllInstances.TailString = TestUtils.CustomTailString; CloudFoundry.CloudController.V2.Client.Fakes.ShimPagedResponseCollection <ListAllAppsForSpaceResponse> .AllInstances.ResourcesGet = TestUtils.CusomListAllAppsForSpacePagedResponse; CloudFoundry.CloudController.V2.Client.Base.Fakes.ShimAbstractSpacesEndpoint.AllInstances.ListAllAppsForSpaceNullableOfGuidRequestOptions = TestUtils.CustomListAllAppsForSpace; CloudFoundry.CloudController.V2.Client.Fakes.ShimPagedResponseCollection <ListAllOrganizationsResponse> .AllInstances.ResourcesGet = TestUtils.CustomListAllOrganizationsResponse; CloudFoundry.CloudController.V2.Client.Base.Fakes.ShimAbstractOrganizationsEndpoint.AllInstances.ListAllOrganizationsRequestOptions = TestUtils.CustomListAllOrganizations; CloudFoundry.CloudController.V2.Client.Fakes.ShimPagedResponseCollection <ListAllSpacesForOrganizationResponse> .AllInstances.ResourcesGet = TestUtils.CustomListAllSpacesForOrganizationResponse; CloudFoundry.CloudController.V2.Client.Base.Fakes.ShimAbstractOrganizationsEndpoint.AllInstances.ListAllSpacesForOrganizationNullableOfGuidRequestOptions = TestUtils.CustomListAllSpacesForOrganization; TestUtils.InitTestMetadata(); RestartApp task = new RestartApp(); task.CFSpace = "TestSpace"; task.CFOrganization = "TestOrg"; task.CFManifest = Settings.Default.CFManifest; task.CFUser = Settings.Default.User; task.CFPassword = Settings.Default.Password; task.CFServerUri = Settings.Default.ServerUri; task.BuildEngine = new FakeBuildEngine(); Assert.IsTrue(task.Execute()); } }
private bool RunTasks(string manifest, string host, string appPath) { LoginTask login = new LoginTask(); login.BuildEngine = new FakeBuildEngine(); login.CFUser = Settings.Default.User; login.CFPassword = Settings.Default.Password; login.CFServerUri = Settings.Default.ServerUri; login.CFManifest = manifest; login.CFSkipSslValidation = true; login.Execute(); CreateApp task = new CreateApp(); task.CFRefreshToken = login.CFRefreshToken; task.CFServerUri = Settings.Default.ServerUri; task.CFSkipSslValidation = true; task.CFSpace = Settings.Default.Space; task.CFOrganization = Settings.Default.Organization; task.CFManifest = manifest; task.BuildEngine = new FakeBuildEngine(); task.Execute(); PushApp pushTask = new PushApp(); pushTask.CFUser = Settings.Default.User; pushTask.CFPassword = Settings.Default.Password; pushTask.CFServerUri = Settings.Default.ServerUri; pushTask.CFSkipSslValidation = true; pushTask.CFManifest = manifest; pushTask.CFOrganization = Settings.Default.Organization; pushTask.CFSpace = Settings.Default.Space; pushTask.CFAppPath = appPath; pushTask.BuildEngine = new FakeBuildEngine(); pushTask.Execute(); CreateRoutes routeTask = new CreateRoutes(); routeTask.CFUser = Settings.Default.User; routeTask.CFPassword = Settings.Default.Password; routeTask.CFServerUri = Settings.Default.ServerUri; routeTask.CFSkipSslValidation = true; routeTask.CFManifest = manifest; routeTask.CFSpace = Settings.Default.Space; routeTask.CFOrganization = Settings.Default.Organization; routeTask.BuildEngine = new FakeBuildEngine(); routeTask.Execute(); BindRoutes bindTask = new BindRoutes(); bindTask.CFUser = Settings.Default.User; bindTask.CFPassword = Settings.Default.Password; bindTask.CFServerUri = Settings.Default.ServerUri; bindTask.BuildEngine = new FakeBuildEngine(); bindTask.CFSkipSslValidation = true; bindTask.CFManifest = manifest; bindTask.CFOrganization = Settings.Default.Organization; bindTask.CFSpace = Settings.Default.Space; bindTask.Execute(); BindServices bindServiceTask = new BindServices(); bindServiceTask.CFUser = Settings.Default.User; bindServiceTask.CFPassword = Settings.Default.Password; bindServiceTask.CFServerUri = Settings.Default.ServerUri; bindServiceTask.BuildEngine = new FakeBuildEngine(); bindServiceTask.CFSkipSslValidation = true; bindServiceTask.CFManifest = manifest; bindServiceTask.CFOrganization = Settings.Default.Organization; bindServiceTask.CFSpace = Settings.Default.Space; bindServiceTask.Execute(); RestartApp restartTask = new RestartApp(); restartTask.BuildEngine = new FakeBuildEngine(); restartTask.CFUser = Settings.Default.User; restartTask.CFPassword = Settings.Default.Password; restartTask.CFServerUri = Settings.Default.ServerUri; restartTask.CFManifest = manifest; restartTask.CFSkipSslValidation = true; restartTask.CFOrganization = Settings.Default.Organization; restartTask.CFSpace = Settings.Default.Space; restartTask.Execute(); if (CheckIfAppIsWorking(string.Format(CultureInfo.InvariantCulture, "{0}.{1}", host, Settings.Default.Domain), 60) == true) { DeleteApp delTask = new DeleteApp(); delTask.CFUser = Settings.Default.User; delTask.CFPassword = Settings.Default.Password; delTask.CFServerUri = Settings.Default.ServerUri; delTask.CFSkipSslValidation = true; delTask.CFSpace = Settings.Default.Space; delTask.CFOrganization = Settings.Default.Organization; delTask.CFManifest = manifest; delTask.CFDeleteServices = true; delTask.CFDeleteRoutes = true; delTask.BuildEngine = new FakeBuildEngine(); return(delTask.Execute()); } else { return(false); } }