public static void PushApp(string appName, string sourceDir, string url, List<string> directoriesCreated, CloudConnection cloudConnection, string vendor ,string serviceName, string path) { if (path == null) path = TestUtil.CopyFolderToTemp(sourceDir); directoriesCreated.Add(path); if (serviceName == null) serviceName = appName + "svc"; if (vendor != null) { cloudConnection.CreateProvisionedService(cloudConnection.SystemServices.FirstOrDefault(ss => ss.Vendor == vendor), serviceName, true); Thread.Sleep(10000); } CloudApplication cloudApp = new CloudApplication() { Name = appName, Urls = new string[1] { url }, DeploymentPath = path, Deployable = true, Framework = "dotNet", InstanceCount = 1, Memory = 128, Runtime = "iis", }; PushTracker pushTracker = new PushTracker(); Guid tracker = Guid.NewGuid(); pushTracker.TrackId = tracker; currentJobs.Add(tracker); cloudConnection.PushJob.Start(pushTracker, cloudApp); cloudConnection.PushJob.JobCompleted += new EventHandler<global::System.ComponentModel.AsyncCompletedEventArgs>(PushJob_JobCompleted); while (currentJobs.Contains(tracker)) { Thread.Sleep(1000); } App currentApp = cloudConnection.Apps.FirstOrDefault(app => app.Name == cloudApp.Name); ProvisionedService provisionedService = cloudConnection.ProvisionedServices.FirstOrDefault(ps => ps.Name == serviceName); if (vendor != null) { currentApp.BindService(provisionedService); Thread.Sleep(1000); } currentApp.Start(); int retryCount = 10; while (true) { App pushedApp = cloudConnection.Apps.FirstOrDefault(app => app.Name == cloudApp.Name); if (pushedApp.State == AppState.RUNNING) break; Thread.Sleep(1000); retryCount--; if (retryCount == 0) break; } }
public static void PushApp(string appName, string sourceDir, string url, List <string> directoriesCreated, CloudConnection cloudConnection, string vendor, string serviceName, string path) { if (path == null) { path = TestUtil.CopyFolderToTemp(sourceDir); } directoriesCreated.Add(path); if (serviceName == null) { serviceName = appName + "svc"; } if (vendor != null) { cloudConnection.CreateProvisionedService(cloudConnection.SystemServices.FirstOrDefault(ss => ss.Vendor == vendor), serviceName, true); Thread.Sleep(10000); } CloudApplication cloudApp = new CloudApplication() { Name = appName, Urls = new string[1] { url }, DeploymentPath = path, Deployable = true, Framework = "dotNet", InstanceCount = 1, Memory = 128, Runtime = "iis", }; PushTracker pushTracker = new PushTracker(); Guid tracker = Guid.NewGuid(); pushTracker.TrackId = tracker; currentJobs.Add(tracker); cloudConnection.PushJob.Start(pushTracker, cloudApp); cloudConnection.PushJob.JobCompleted += new EventHandler <global::System.ComponentModel.AsyncCompletedEventArgs>(PushJob_JobCompleted); while (currentJobs.Contains(tracker)) { Thread.Sleep(1000); } App currentApp = cloudConnection.Apps.FirstOrDefault(app => app.Name == cloudApp.Name); ProvisionedService provisionedService = cloudConnection.ProvisionedServices.FirstOrDefault(ps => ps.Name == serviceName); if (vendor != null) { currentApp.BindService(provisionedService); Thread.Sleep(1000); } currentApp.Start(); int retryCount = 10; while (true) { App pushedApp = cloudConnection.Apps.FirstOrDefault(app => app.Name == cloudApp.Name); if (pushedApp.State == AppState.RUNNING) { break; } Thread.Sleep(1000); retryCount--; if (retryCount == 0) { break; } } }