示例#1
0
        internal ApplicationManager(ISiteManager siteManager, Site site, string appName, ISettingsResolver settingsResolver)
        {
            _siteManager = siteManager;
            _site = site;
            _appName = appName;
            _settingsResolver = settingsResolver;

            SiteUrl = site.SiteUrl;
            ServiceUrl = site.ServiceUrl;

            DeploymentManager = new RemoteDeploymentManager(site.ServiceUrl + "deployments");
            SettingsManager = new RemoteDeploymentSettingsManager(site.ServiceUrl + "settings");
            LogStreamManager = new RemoteLogStreamManager(site.ServiceUrl + "logstream");
            SSHKeyManager = new RemoteSSHKeyManager(site.ServiceUrl + "sshkey");
            VfsManager = new RemoteVfsManager(site.ServiceUrl + "vfs");
            VfsWebRootManager = new RemoteVfsManager(site.ServiceUrl + "vfs/site/wwwroot");
            LiveScmVfsManager = new RemoteVfsManager(site.ServiceUrl + "scmvfs");
            ZipManager = new RemoteZipManager(site.ServiceUrl + "zip");
            CommandExecutor = new RemoteCommandExecutor(site.ServiceUrl + "command");
            ProcessManager = new RemoteProcessManager(site.ServiceUrl + "diagnostics/processes");
            WebHooksManager = new RemoteWebHooksManager(site.ServiceUrl + "hooks");
            RepositoryManager = new RemoteRepositoryManager(site.ServiceUrl + "scm");
            JobsManager = new RemoteJobsManager(site.ServiceUrl + "jobs");
            LogFilesManager = new RemoteLogFilesManager(site.ServiceUrl + "/api/logs");
            SiteExtensionManager = new RemoteSiteExtensionManager(site.ServiceUrl + "api/extensions");

            var repositoryInfo = RepositoryManager.GetRepositoryInfo().Result;
            GitUrl = repositoryInfo.GitUrl.OriginalString;
        }
示例#2
0
        internal ApplicationManager(ISiteManager siteManager, Site site, string appName, ISettingsResolver settingsResolver)
        {
            _siteManager = siteManager;
            _site = site;
            _appName = appName;
            _settingsResolver = settingsResolver;

            // Always null in public Kudu, but makes the code more similar to private Kudu
            NetworkCredential credentials = null;

            SiteUrl = site.SiteUrl;
            ServiceUrl = site.ServiceUrl;

            DeploymentManager = new RemoteDeploymentManager(site.ServiceUrl + "deployments", credentials);
            SettingsManager = new RemoteDeploymentSettingsManager(site.ServiceUrl + "settings", credentials);
            LogStreamManager = new RemoteLogStreamManager(site.ServiceUrl + "logstream", credentials);
            SSHKeyManager = new RemoteSSHKeyManager(site.ServiceUrl + "sshkey", credentials);
            VfsManager = new RemoteVfsManager(site.ServiceUrl + "vfs", credentials);
            VfsWebRootManager = new RemoteVfsManager(site.ServiceUrl + "vfs/site/wwwroot", credentials);
            LiveScmVfsManager = new RemoteVfsManager(site.ServiceUrl + "scmvfs", credentials);
            ZipManager = new RemoteZipManager(site.ServiceUrl + "zip", credentials);
            RuntimeManager = new RemoteRuntimeManager(site.ServiceUrl + "diagnostics/runtime", credentials);
            CommandExecutor = new RemoteCommandExecutor(site.ServiceUrl + "command", credentials);
            ProcessManager = new RemoteProcessManager(site.ServiceUrl + "diagnostics/processes", credentials);
            WebHooksManager = new RemoteWebHooksManager(site.ServiceUrl + "hooks", credentials);
            RepositoryManager = new RemoteRepositoryManager(site.ServiceUrl + "scm", credentials);
            JobsManager = new RemoteJobsManager(site.ServiceUrl + "jobs", credentials);
            LogFilesManager = new RemoteLogFilesManager(site.ServiceUrl + "/api/logs", credentials);
            SiteExtensionManager = new RemoteSiteExtensionManager(site.ServiceUrl + "api", credentials);

            var repositoryInfo = RepositoryManager.GetRepositoryInfo().Result;
            GitUrl = repositoryInfo.GitUrl.OriginalString;
        }
        public static async Task CleanSiteExtensions(RemoteSiteExtensionManager manager)
        {
            try
            {
                TestTracer.Trace("Clean site extensions");
                List<SiteExtensionInfo> results = await (await manager.GetLocalExtensions()).Content.ReadAsAsync<List<SiteExtensionInfo>>();
                List<Task> tasks = new List<Task>();
                foreach (var ext in results)
                {
                    tasks.Add(manager.UninstallExtension(ext.Id));
                }

                await Task.WhenAll(tasks);
            }
            catch (Exception ex)
            {
                TestTracer.Trace("Failed to perform cleanup, might cause testcase failure. {0}", ex.ToString());
            }
        }
        private async Task<HttpResponseMessage> PollAndVerifyAfterArmInstallation(RemoteSiteExtensionManager manager, string packageId)
        {
            TestTracer.Trace("Polling for status for '{0}'", packageId);
            DateTime start = DateTime.UtcNow;
            HttpResponseMessage responseMessage = null;

            UpdateHeaderIfGoingToBeArmRequest(manager.Client, true);
            do
            {
                responseMessage = await manager.GetLocalExtension(packageId);

                if (HttpStatusCode.Created == responseMessage.StatusCode)
                {
                    TestTracer.Trace("Action is on-going, wait for 3 seconds for next poll. Package: '{0}'", packageId);
                    await Task.Delay(TimeSpan.FromSeconds(3));
                }
                else if (HttpStatusCode.OK == responseMessage.StatusCode)
                {
                    TestTracer.Trace("Action is done successfully for package '{0}'.", packageId);
                    break;
                }

                Assert.True(
                    HttpStatusCode.Created == responseMessage.StatusCode
                    || HttpStatusCode.OK == responseMessage.StatusCode, string.Format(CultureInfo.InvariantCulture, "Action failed. Package: '{0}'", packageId));

            } while ((DateTime.UtcNow - start).TotalSeconds < 30);

            TestTracer.Trace("Polled for '{0}' seconds. Response status is '{1}'. Package: '{2}'", (DateTime.UtcNow - start).TotalSeconds, responseMessage.StatusCode, packageId);
            Assert.True(HttpStatusCode.OK == responseMessage.StatusCode, string.Format(CultureInfo.InvariantCulture, "Action failed. Package: {0}", packageId));
            return responseMessage;
        }