Beispiel #1
0
        public async Task <ActionResult> Index(string slug)
        {
            IApplication application = _applicationService.GetApplication(slug);

            if (application == null)
            {
                return(HttpNotFound());
            }

            ICredentials            credentials       = _credentialProvider.GetCredentials();
            RemoteDeploymentManager deploymentManager = application.GetDeploymentManager(credentials);

            Task <IEnumerable <DeployResult> > deployResults = deploymentManager.GetResultsAsync();
            Task <RepositoryInfo> repositoryInfo             = application.GetRepositoryInfo(credentials);

            await Task.WhenAll(deployResults, repositoryInfo);

            var appViewModel = new ApplicationViewModel(application, _settingsResolver)
            {
                RepositoryInfo = repositoryInfo.Result,
                Deployments    = deployResults.Result.ToList()
            };

            ViewBag.slug    = slug;
            ViewBag.appName = appViewModel.Name;

            return(View(appViewModel));
        }
Beispiel #2
0
        public Task <ActionResult> Index(string slug)
        {
            IApplication application = _applicationService.GetApplication(slug);

            if (application == null)
            {
                return(HttpNotFoundAsync());
            }

            ICredentials            credentials       = _credentialProvider.GetCredentials();
            RemoteDeploymentManager deploymentManager = application.GetDeploymentManager(credentials);

            // TODO: Do this in parallel
            return(deploymentManager.GetResultsAsync().Then(results =>
            {
                return application.GetRepositoryInfo(credentials).Then(repositoryInfo =>
                {
                    var appViewModel = new ApplicationViewModel(application);
                    appViewModel.RepositoryInfo = repositoryInfo;
                    appViewModel.Deployments = results.ToList();

                    ViewBag.slug = slug;
                    ViewBag.appName = appViewModel.Name;

                    return (ActionResult)View(appViewModel);
                });
            }));
        }
Beispiel #3
0
        public void DeploymentManagerExtensibility()
        {
            // Arrange
            string repositoryName = "Mvc3Application";
            string appName        = KuduUtils.GetRandomWebsiteName("DeploymentApis");

            using (var repo = Git.CreateLocalRepository(repositoryName))
            {
                ApplicationManager.Run(appName, appManager =>
                {
                    var handler = new FakeMessageHandler()
                    {
                        InnerHandler = new HttpClientHandler()
                    };

                    var manager         = new RemoteDeploymentManager(appManager.DeploymentManager.ServiceUrl, handler);
                    manager.Credentials = appManager.DeploymentManager.Credentials;
                    var results         = manager.GetResultsAsync().Result.ToList();

                    Assert.Equal(0, results.Count);
                    Assert.NotNull(handler.Url);
                });
            }
        }