public TaskDefinitionValidationResult ValidateTaskDefinition(IDeployTaskDefinition taskDefinition, DeployEnvironmentConfiguration environmentComponent) { var result = new TaskDefinitionValidationResult(); //Verify Static Values var environmentParmeters = taskDefinition.GetEnvironmentTaskParameterList(); foreach (var p in environmentParmeters) { var item = this.GetValidationResultItem(p, environmentComponent.ConfigurationValueList); result.EnvironmentResultList.Add(item); } var machineParameters = taskDefinition.GetMachineTaskParameterList(); foreach (var machine in environmentComponent.MachineList) { var machineResultList = new List<TaskDefinitionValidationResult.TaskDefinitionValidationResultItem>(); foreach (var p in machineParameters) { var item = this.GetValidationResultItem(p, machine.ConfigurationValueList); machineResultList.Add(item); } result.MachineResultList.Add(machine.Id, machineResultList); } result.BuildParameterList.AddRange(taskDefinition.GetBuildTaskParameterList()); result.DeployParameterList.AddRange(taskDefinition.GetDeployTaskParameterList()); return result; }
public DeploymentValidationResultItem AddResult(DeployStep deploymentStep, TaskDefinitionValidationResult validationItem) { var resultItem = new DeploymentValidationResultItem { DeploymentStep = deploymentStep, TaskValidationResult = validationItem }; this.ResultList.Add(resultItem); return resultItem; }
public static TestData Create() { var fixture = new Fixture(); var project = fixture.Create<DeployProject>(); var testData = new TestData { Fixture = fixture, DeploymentValidator = new Mock<IDeploymentValidator>(), TaskDefinition = new DeployWebsiteTaskDefinition(new ParameterParser()), DeployTaskStatusManager = new DeployTaskStatusManager(new Mock<ILog>().Object, new Mock<IDeployStateManager>().Object, new Mock<IDeployStatusNotifier>().Object), DropkickRunner = new DropkickRunner(new Zipper(new Mock<ILog>().Object), new ProcessRunner(), new Mock<ICredentialsManager>().Object, new Mock<IImpersonator>().Object), Component = project.ComponentList.First(), Environment = project.EnvironmentList.First(), EnvironmentComponent = project.EnvironmentList.First().ComponentList.First(), Machine = project.EnvironmentList.First().ComponentList.First().MachineList.First(), Build = fixture.Create<DeployBuild>(), DeployStateId = fixture.Create<string>("DeployStateId"), }; testData.Sut = new DeployWebsiteTaskExecutor(new ParameterEvaluator(new ParameterParser()), testData.DeploymentValidator.Object, testData.DropkickRunner); testData.Component.ProjectId = project.Id; testData.Environment.ProjectId = project.Id; testData.EnvironmentComponent.ProjectId = project.Id; testData.EnvironmentComponent.EnvironmentId = testData.Environment.Id; testData.EnvironmentComponent.ParentId = testData.Component.Id; testData.EnvironmentComponent.ParentType = EnumDeployStepParentType.Component; testData.EnvironmentComponent.DeployCredentialsId = null; testData.Machine.ProjectId = project.Id; testData.Machine.EnvironmentId = testData.Environment.Id; testData.Machine.ParentId = testData.Component.Id; var validationResult = new TaskDefinitionValidationResult(); validationResult.MachineResultList.Add(testData.Machine.Id, new List<TaskDefinitionValidationResult.TaskDefinitionValidationResultItem>()); testData.DeploymentValidator.Setup(i=>i.ValidateMachineTaskDefinition(testData.TaskDefinition, testData.EnvironmentComponent, testData.Machine)) .Returns(validationResult); testData.TaskDefinition.Options = new DeployWebsiteTaskOptions { TargetMachineName = "localhost", ApplicationPoolName = "TestAppPool", SiteName = "TestSiteName", VirtualDirectoryName = null, TargetMachinePassword = null, TargetMachineUserName = null, TargetWebsitePath = "C:\\Test\\DeployWebsite" }; return testData; }
public static TestData Create() { var fixture = new Fixture(); var project = fixture.Create<DeployProject>(); var testData = new TestData { Fixture = fixture, DeploymentValidator = new Mock<IDeploymentValidator>(), TaskDefinition = new DeployWindowsServiceTaskDefinition(new ParameterParser()), DeployTaskStatusManager = new DeployTaskStatusManager(new Mock<ILog>().Object, new Mock<IDeployStateManager>().Object, new Mock<IDeployStatusNotifier>().Object), DropkickRunner = new DropkickRunner(new Zipper(new Mock<ILog>().Object), new ProcessRunner(), new Mock<ICredentialsManager>().Object, new Mock<IImpersonator>().Object), Component = project.ComponentList.First(), Environment = project.EnvironmentList.First(), EnvironmentComponent = project.EnvironmentList.First().ComponentList.First(), Machine = project.EnvironmentList.First().ComponentList.First().MachineList.First(), Build = fixture.Create<DeployBuild>(), DeployStateId = fixture.Create<string>("DeployStateId"), }; testData.Sut = new DeployWindowsServiceTaskExecutor(new ParameterEvaluator(new ParameterParser()), testData.DeploymentValidator.Object, testData.DropkickRunner); testData.Component.ProjectId = project.Id; testData.Environment.ProjectId = project.Id; testData.EnvironmentComponent.ProjectId = project.Id; testData.EnvironmentComponent.EnvironmentId = testData.Environment.Id; testData.EnvironmentComponent.ParentId = testData.Component.Id; testData.EnvironmentComponent.ParentType = EnumDeployStepParentType.Component; testData.EnvironmentComponent.DeployCredentialsId = null; testData.Machine.ProjectId = project.Id; testData.Machine.EnvironmentId = testData.Environment.Id; testData.Machine.ParentId = testData.Component.Id; var validationResult = new TaskDefinitionValidationResult(); validationResult.MachineResultList.Add(testData.Machine.Id, new List<TaskDefinitionValidationResult.TaskDefinitionValidationResultItem>()); testData.DeploymentValidator.Setup(i=>i.ValidateMachineTaskDefinition(testData.TaskDefinition, testData.EnvironmentComponent, testData.Machine)) .Returns(validationResult); testData.TaskDefinition.Options = new DeployWindowsServiceTaskOptions { TargetMachineName = "localhost", DependencyList = new List<DeployWindowsServiceTaskOptions.ServiceDependency> { new DeployWindowsServiceTaskOptions.ServiceDependency { ServiceName="RavenDB" }, new DeployWindowsServiceTaskOptions.ServiceDependency { ServiceName="MSSQL" } }, ServiceExeName = "Sriracha.Deploy.Server.exe", ServiceName = "Sriracha - TEST Service Deploy Task", ServiceSourceExeConfigPath = @"C:\Projects\Sriracha.Deploy\Sriracha.Deploy.Server\App.Config", ServiceSourcePath = @"C:\Projects\Sriracha.Deploy\Sriracha.Deploy.Server\bin\Debug", ServiceStartMode = dropkick.Wmi.ServiceStartMode.Manual, ServiceTargetPath = @"C:\Test\TestServiceDeployTask", ServiceUserName = "******", ServiceUserPassword = null, StartImmediately = false, TargetMachinePassword = null, TargetMachineUserName = null }; return testData; }