public Session(IConf conf, string user) : this(conf) { _user = user; _isCommited = false; Open(); }
public DeployExceptionHandler(IDeployEvents callback, IConf appSettings, IServiceLogger logger, ISession session) { _callback = callback; _session = session; _appSettings = appSettings; _logger = logger; }
public void CreateTestEnvironment() { _surveyDir = "TestSurvey" + TestUtils.GetPostfix(); _conf = CreateConfForPackage(_surveyDir); TestUtils.PreparePackageFor(DeployMode.Install, _conf.PackagePaths.Survey); Directory.CreateDirectory(_conf.CommonPaths.Surveys); Directory.CreateDirectory(_conf.CommonPaths.Backups); }
public void PrepareDeploySettings() { var mockedConf = new Mock<IConf>(); mockedConf.Setup(s => s.ConnectionStrings).Returns(new ConnectionStrings(null, ConfigurationManager.ConnectionStrings["deployer"].ConnectionString)); mockedConf.Setup(s => s.Survey).Returns(new Survey("Test", null, DeployMode.Install)); mockedConf.Setup(s => s.SessionKey).Returns(TestUtils.GetPostfix(50)); _conf = mockedConf.Object; _user = GetTestUser("Test" + TestUtils.GetPostfix()); }
public void SetUp() { _mockedIISManager = new Mock<IIISManager>(); _mockedIISManager.Setup(m => m.CreateSurvey(It.IsAny<string>())); _mockedIISManager.Setup(m => m.DeleteSurvey()); var mockedConf = new Mock<IConf>(); mockedConf.Setup(c => c.IISManager).Returns(_mockedIISManager.Object); mockedConf.Setup(c => c.SurveyPath).Returns(new SurveyPaths(null, null)); _conf = mockedConf.Object; }
public void SetUp() { _mockedIISManager = new Mock <IIISManager>(); _mockedIISManager.Setup(m => m.CreateSurvey(It.IsAny <string>())); _mockedIISManager.Setup(m => m.DeleteSurvey()); var mockedConf = new Mock <IConf>(); mockedConf.Setup(c => c.IISManager).Returns(_mockedIISManager.Object); mockedConf.Setup(c => c.SurveyPath).Returns(new SurveyPaths(null, null)); _conf = mockedConf.Object; }
public static T Configure <T>(this IConf conf, T obj, string key = null) { if (null == conf) { throw new ArgumentNullException(nameof(conf)); } var container = conf.Container; if (container == null) { throw new ArgumentException(paramName: nameof(conf), message: $"{nameof(conf.Container)} is null."); } return(container.Configure(obj, key)); }
public void CreateTestEnvironment() { var confSection = DeployerConfigurationSection.Instance; var surveyName = "TestSurvey" + TestUtils.GetPostfix(); var pathToSurvey = Path.Combine(confSection.Settings.Paths.Surveys, surveyName); var iisManager = new Mock<IIISManager>(); iisManager.Setup(m => m.SurveyPath).Returns(pathToSurvey); var mockedConf = new Mock<IConf>(); mockedConf.Setup(s => s.CommonPaths).Returns(new CommonPaths(confSection.Settings.Paths.Surveys, null, null)); mockedConf.Setup(s => s.SurveyPath).Returns(new SurveyPaths(pathToSurvey, null)); mockedConf.Setup(s => s.IISManager).Returns(iisManager.Object); _conf = mockedConf.Object; Directory.CreateDirectory(_conf.CommonPaths.Surveys); }
public void CreateTestEnvironment() { var confSection = DeployerConfigurationSection.Instance; var surveyName = "TestSurvey" + TestUtils.GetPostfix(); var pathToSurvey = Path.Combine(confSection.Settings.Paths.Surveys, surveyName); var iisManager = new Mock <IIISManager>(); iisManager.Setup(m => m.SurveyPath).Returns(pathToSurvey); var mockedConf = new Mock <IConf>(); mockedConf.Setup(s => s.CommonPaths).Returns(new CommonPaths(confSection.Settings.Paths.Surveys, null, null)); mockedConf.Setup(s => s.SurveyPath).Returns(new SurveyPaths(pathToSurvey, null)); mockedConf.Setup(s => s.IISManager).Returns(iisManager.Object); _conf = mockedConf.Object; Directory.CreateDirectory(_conf.CommonPaths.Surveys); }
public ISession CreateSessionObj(IConf settings, string user) { return _sessionFactory(settings, user); }
protected Validator(IConf conf) { _conf = conf; }
protected Deployer(IConf conf) { _conf = conf; }
public static DirectoryValidator Create(IConf appSettings) { return new DirectoryValidator(appSettings); }
public static IISDeployer Create(IConf appSettings) { return(new IISDeployer(appSettings)); }
public IISValidator(IConf conf) : base(conf) { Name = "IIS validator"; }
public DatabaseDeployer(IConf conf) : base(conf) { Name = "Database"; }
public DirectoryDeployer(IConf conf) : base(conf) { Name = "Directory"; }
public IDeployExceptionHandler CreateDeployExHandlerObj(IDeployEvents callback, IConf settings, IServiceLogger logger, ISession session) { return(_exHandlerFactory(callback, settings, logger, session)); }
public ISession CreateSessionObj(IConf settings, string user) { return(_sessionFactory(settings, user)); }
public IEnumerable <IDeployer> CreateDeployersList(IConf settings) { return(_deployersFactory(settings)); }
public IEnumerable <IValidator> CreateValidatorsList(IConf settings) { return(_validatorsFactory(settings)); }
public DirectoryValidator(IConf conf) : base(conf) { Name = "Directory validator"; }
public static IISValidator Create(IConf appSettings) { return new IISValidator(appSettings); }
public static DatabaseDeployer Create(IConf appSettings) { return(new DatabaseDeployer(appSettings)); }
public static DatabaseDeployer Create(IConf appSettings) { return new DatabaseDeployer(appSettings); }
public static DirectoryDeployer Create(IConf appSettings) { return new DirectoryDeployer(appSettings); }
public static DeployExceptionHandler Create(IDeployEvents callback, IConf appSettings, IServiceLogger logger, ISession session) { return new DeployExceptionHandler(callback, appSettings, logger, session); }
public IISDeployer(IConf conf) : base(conf) { Name = "IIS"; }
public static DirectoryDeployer Create(IConf appSettings) { return(new DirectoryDeployer(appSettings)); }
protected Session(IConf conf) { _conf = conf; }
public static IISValidator Create(IConf appSettings) { return(new IISValidator(appSettings)); }
public IEnumerable<IDeployer> CreateDeployersList(IConf settings) { return _deployersFactory(settings); }
public static IISDeployer Create(IConf appSettings) { return new IISDeployer(appSettings); }
public DatabaseValidator(IConf conf) : base(conf) { Name = "Database validator"; }
public static DatabaseValidator Create(IConf appSettings) { return new DatabaseValidator(appSettings); }
public IDeployExceptionHandler CreateDeployExHandlerObj(IDeployEvents callback, IConf settings, IServiceLogger logger, ISession session) { return _exHandlerFactory(callback, settings, logger, session); }
public static DatabaseValidator Create(IConf appSettings) { return(new DatabaseValidator(appSettings)); }
public IEnumerable<IValidator> CreateValidatorsList(IConf settings) { return _validatorsFactory(settings); }
public static DirectoryValidator Create(IConf appSettings) { return(new DirectoryValidator(appSettings)); }
private void RunDeployment(IConf conf, IDeployEvents callback, DeployContext context, byte[] files) { using (var session = _dsFactory.CreateSessionObj(conf, _user)) { _logger.Info(string.Format("Session for '{0}' is opened", _sessionKey)); var deploySteps = new List<IDeployer>(); var failedValidators = new List<IValidator>(); var exceptionHandler = _dsFactory.CreateDeployExHandlerObj(callback, conf, _logger, session); try { conf.PackageManager.BytesToZip(files, conf.PackagePaths.Survey); _logger.Info(string.Format("Zip files was unpacked to '{0}'", conf.PackagePaths.Survey)); DeployExecutor.Validate(_dsFactory.CreateValidatorsList(conf), failedValidators, callback, conf.Survey.DeployMode); _logger.Info(string.Format("Validation process is complete. Found '{0}' error(s)", failedValidators.Count)); if (failedValidators.Any()) throw new ValidationException("Validation at " + String.Join(", ", failedValidators.Select(v => v.Name).ToArray()) + " failed."); DeployExecutor.Deploy(_dsFactory.CreateDeployersList(conf), deploySteps, callback, conf.Survey.DeployMode); _logger.Info(string.Format("Deploy is finished for '{0}'", _sessionKey)); session.Commit(); _logger.Info(string.Format("Session for '{0}' is commited successfully", _sessionKey)); } catch (ValidationException exception) { exceptionHandler.HandleValidation(exception, callback); } catch (DeployException exception) { exceptionHandler.HandleDeploy(exception, callback, deploySteps, GetRollbackAction(context)); } catch (Exception exception) { exceptionHandler.HandleUnknown(exception, callback); } } }