public DeployComponent CreateComponent(string projectId, string componentName, bool useConfigurationGroup, string configurationId, EnumDeploymentIsolationType isolationType) { var project = this._projectRepository.GetProject(projectId); var returnValue = this._projectRepository.CreateComponent(projectId, componentName, useConfigurationGroup, configurationId, isolationType); if(project.UsesSharedComponentConfiguration) { var someOtherComponent = project.ComponentList.FirstOrDefault(i=>i.Id != returnValue.Id); if(someOtherComponent != null) { foreach(var deploymentStep in someOtherComponent.DeploymentStepList) { this._projectRepository.CreateComponentDeploymentStep(project.Id, returnValue.Id, deploymentStep.StepName, deploymentStep.TaskTypeName, deploymentStep.TaskOptionsJson, deploymentStep.SharedDeploymentStepId); } } } return returnValue; }
private void AssertCreatedComponent(DeployComponent result, string projectId, string componentName, EnumDeploymentIsolationType isolationType, IProjectRepository sut) { AssertHelpers.AssertCreatedBaseDto(result, this.UserName); Assert.AreEqual(projectId, result.ProjectId); Assert.AreEqual(componentName, result.ComponentName); Assert.AreEqual(false, result.UseConfigurationGroup); Assert.AreEqual(null, result.ConfigurationId); Assert.AreEqual(isolationType, result.IsolationType); var dbItem = sut.GetComponent(result.Id, projectId); AssertHelpers.AssertComponent(result, dbItem); var dbProject = sut.GetProject(projectId); var dbProjectComponent = dbProject.ComponentList.SingleOrDefault(i => i.Id == result.Id); Assert.IsNotNull(dbProjectComponent); AssertHelpers.AssertComponent(result, dbProjectComponent); }
public DeployComponent UpdateComponent(string componentId, string projectId, string componentName, bool useConfigurationGroup, string configurationId, EnumDeploymentIsolationType isolationType) { if(string.IsNullOrEmpty(projectId)) { throw new ArgumentNullException("Missing projectID"); } if(string.IsNullOrEmpty(componentId)) { throw new ArgumentNullException("Component ID"); } if(string.IsNullOrEmpty(componentName)) { throw new ArgumentNullException("Missing component name"); } VerifyProjectExists(projectId); VerifyComponentExists(componentId, projectId); using(var db = _sqlConnectionInfo.GetDB()) { var sql = PetaPoco.Sql.Builder .Append("UPDATE DeployComponent") .Append("SET ComponentName=@0, UseConfigurationGroup=@1, DeployConfigurationID=@2, EnumDeploymentIsolationTypeID=@3, UpdatedByUserName=@4, UpdatedDateTimeUtc=@5", componentName, useConfigurationGroup, configurationId, isolationType, _userIdentity.UserName, DateTime.UtcNow) .Append("WHERE ID=@0", componentId); db.Execute(sql); } return this.GetComponent(componentId, projectId); }
public DeployComponent CreateComponent(string projectId, string componentName, bool useConfigurationGroup, string configurationId, EnumDeploymentIsolationType isolationType) { if(string.IsNullOrEmpty(projectId)) { throw new ArgumentNullException("Missing project ID"); } if(string.IsNullOrEmpty(componentName)) { throw new ArgumentNullException("Missing component name"); } VerifyProjectExists(projectId); var component = new DeployComponent { Id = Guid.NewGuid().ToString(), ComponentName = componentName, ProjectId = projectId, UseConfigurationGroup = useConfigurationGroup, ConfigurationId = configurationId, IsolationType = isolationType, CreatedByUserName = _userIdentity.UserName, CreatedDateTimeUtc = DateTime.UtcNow, UpdatedByUserName = _userIdentity.UserName, UpdatedDateTimeUtc = DateTime.UtcNow }; using(var db = _sqlConnectionInfo.GetDB()) { var sql = PetaPoco.Sql.Builder .Append("INSERT INTO DeployComponent (ID, DeployProjectID, ComponentName, UseConfigurationGroup, DeployConfigurationID, EnumDeploymentIsolationTypeID, CreatedByUserName, CreatedDateTimeUtc, UpdatedByUserName, UpdatedDateTimeUtc)") .Append("VALUES (@Id, @ProjectId, @ComponentName, @UseConfigurationGroup, @ConfigurationId, @IsolationType, @CreatedByUserName, @CreatedDateTimeUtc, @UpdatedByUserName, @UpdatedDateTimeUtc)", component); db.Execute(sql); } return component; }
public DeployConfiguration UpdateConfiguration(string configurationId, string projectId, string configurationName, EnumDeploymentIsolationType isolationType) { VerifyProjectExists(projectId); VerifyConfigurationExists(configurationId, projectId); using(var db = _sqlConnectionInfo.GetDB()) { var sql = PetaPoco.Sql.Builder .Append("UPDATE DeployConfiguration") .Append("SET ConfigurationName=@0, EnumDeploymentIsolationTypeID=@1, UpdatedByUserName=@2, UpdatedDateTimeUtc=@3", configurationName, isolationType, _userIdentity.UserName, DateTime.UtcNow) .Append("WHERE ID=@0", configurationId); db.Execute(sql); } return GetConfiguration(configurationId, projectId); }
public void SetIsolationType(DeployBatchRequestItem item, EnumDeploymentIsolationType isolationType) { this.ProjectManager.Setup(i=>i.GetComponentIsolationType(item.Build.ProjectId, item.Build.ProjectComponentId)).Returns(isolationType); }
public DeployConfiguration UpdateConfiguration(string configurationId, string projectId, string configurationName, EnumDeploymentIsolationType isolationType) { return _projectRepository.UpdateConfiguration(configurationId, projectId, configurationName, isolationType); }
public DeployComponent UpdateComponent(string componentId, string projectId, string componentName, bool useConfigurationGroup, string configurationId, EnumDeploymentIsolationType isolationType) { return this._projectRepository.UpdateComponent(componentId, projectId, componentName, useConfigurationGroup, configurationId, isolationType); }
public DeployConfiguration UpdateConfiguration(string configurationId, string projectId, string configurationName, EnumDeploymentIsolationType isolationType) { throw new NotSupportedException(); }
public DeployComponent UpdateComponent(string componentId, string projectId, string componentName, bool useConfigurationGroup, string configurationId, EnumDeploymentIsolationType isolationType) { throw new NotSupportedException(); }