Exemplo n.º 1
0
        public void Rollback_Website_with_VDIR_Test()
        {
            var client = GetClient();

            const string version1 = "1.3.3.7";
            const string version2 = "1.3.3.8";

            var request = new TriggerDeployment()
            {
                AppPoolName = "ZZZ_Integration_PoolName",
                AppPoolUser = "******",
                AppPoolPassword = "******",
                WebsiteName = "ZZZ_Integration_Website_VDIR",
                AppRoot = "/sub1/sub2",
                PackageId = "IntegrationTest",
                PackageVersion = version1,
                WebsitePhysicalPath = @"C:\temp\www",
                WebsitePort = 8000,
                RuntimeVersion = RuntimeVersion.Version40,
                AppName = "App",
                AppPhysicalPath = @"c:\temp\int-app",
            };

            client.PostFileWithRequest<TriggerDeploymentResponse>("/deployments", new FileInfo("src/PowerDeploy.IISDeployService.Tests/Files/package.zip".MapVcsRoot()), request).PrintDump();
            request.PackageVersion = version2;
            client.PostFileWithRequest<TriggerDeploymentResponse>("/deployments", new FileInfo("src/PowerDeploy.IISDeployService.Tests/Files/package.zip".MapVcsRoot()), request).PrintDump();

            var rollbackRequest = new RollbackDeployment()
                {
                    WebsiteName = request.WebsiteName,
                    RollbackTarget = "{0}_v{1}".Fmt(request.PackageId, version1),
                    AppName = request.AppName,
                    AppRoot = request.AppRoot,
                };

            client.Post(rollbackRequest);

            var actual = new IISManager().GetApplicationPath(request.WebsiteName, request.AppRoot, request.AppName);

            Assert.AreEqual(@"{0}\{1}_v{2}".Fmt(request.AppPhysicalPath, request.PackageId, version1), actual);
        }
        public void Post(RollbackDeployment request)
        {
            if (string.IsNullOrEmpty(request.AppName) && string.IsNullOrEmpty(request.AppRoot))
            {
                var websitePath = IISManager.GetWebsitePath(request.WebsiteName);

                IISManager.MapWebsitePhysicalPath(request.WebsiteName, Path.Combine(Directory.GetParent(websitePath).FullName, request.RollbackTarget));
            }
            else
            {
                IISManager.RollbackApplication(request.WebsiteName, request.AppRoot, request.AppName, request.RollbackTarget);
            }
        }
Exemplo n.º 3
0
        public void Rollback_Website_Test()
        {
            var client = GetClient();

            var request = new TriggerDeployment()
            {
                AppPoolName = "ZZZ_Integration_PoolName",
                AppPoolUser = "******",
                AppPoolPassword = "******",
                WebsiteName = "ZZZ_Integration_Website_Simple",
                AppRoot = "/",
                PackageId = "IntegrationTest",
                PackageVersion = "1.3.3.7",
                WebsitePhysicalPath = @"C:\temp\integrationtests",
                RuntimeVersion = RuntimeVersion.Version40,
                WebsitePort = 2000,
            };

            client.PostFileWithRequest<TriggerDeploymentResponse>("/deployments", new FileInfo("src/PowerDeploy.IISDeployService.Tests/Files/package.zip".MapVcsRoot()), request).PrintDump();
            request.PackageVersion = "1.3.3.8";
            client.PostFileWithRequest<TriggerDeploymentResponse>("/deployments", new FileInfo("src/PowerDeploy.IISDeployService.Tests/Files/package.zip".MapVcsRoot()), request).PrintDump();

            var rollbackRequest = new RollbackDeployment() { WebsiteName = request.WebsiteName, RollbackTarget = "{0}_v{1}".Fmt(request.PackageId, "1.3.3.7") };

            client.Post(rollbackRequest);

            IISManagerTestBuddy.AssertWebsite(request.WebsiteName, Path.Combine(request.WebsitePhysicalPath, rollbackRequest.RollbackTarget), request.WebsitePort, request.AppPoolName);
            IISManagerTestBuddy.DeleteAppPool(request.AppPoolName);
            IISManagerTestBuddy.DeleteWebsite(request.WebsiteName);
        }