Пример #1
0
 public ApplicationGenerator(
     ILogProvider logProvider,
     ISqlExecuter sqlExecuter,
     IDslModel dslModel,
     IDomGenerator domGenerator,
     IPluginsContainer <IGenerator> generatorsContainer,
     DatabaseCleaner databaseCleaner,
     DataMigration dataMigration,
     IDatabaseGenerator databaseGenerator,
     IDslScriptsProvider dslScriptsLoader)
 {
     _deployPackagesLogger = logProvider.GetLogger("DeployPackages");
     _performanceLogger    = logProvider.GetLogger("Performance");
     _sqlExecuter          = sqlExecuter;
     _dslModel             = dslModel;
     _domGenerator         = domGenerator;
     _generatorsContainer  = generatorsContainer;
     _databaseCleaner      = databaseCleaner;
     _dataMigration        = dataMigration;
     _databaseGenerator    = databaseGenerator;
     _dslScriptsLoader     = dslScriptsLoader;
 }
Пример #2
0
 public ApplicationGenerator(
     ILogProvider logProvider,
     ISqlExecuter sqlExecuter,
     IDslModel dslModel,
     IDomGenerator domGenerator,
     IPluginsContainer<IGenerator> generatorsContainer,
     DatabaseCleaner databaseCleaner,
     DataMigration dataMigration,
     IDatabaseGenerator databaseGenerator,
     IDslScriptsProvider dslScriptsLoader)
 {
     _deployPackagesLogger = logProvider.GetLogger("DeployPackages");
     _performanceLogger = logProvider.GetLogger("Performance");
     _sqlExecuter = sqlExecuter;
     _dslModel = dslModel;
     _domGenerator = domGenerator;
     _generatorsContainer = generatorsContainer;
     _databaseCleaner = databaseCleaner;
     _dataMigration = dataMigration;
     _databaseGenerator = databaseGenerator;
     _dslScriptsLoader = dslScriptsLoader;
 }
Пример #3
0
        private List<string> TestExecuteDataMigrationScripts(string[] scriptsDescriptions, string expectedResult, bool skipScriptsWithWrongOrder = false)
        {
            using (var container = new RhetosTestContainer())
            {
                var log = new List<string>();
                container.AddLogMonitor(log);

                var sqlExecuter = container.Resolve<ISqlExecuter>();
                sqlExecuter.ExecuteSql("DELETE FROM Rhetos.DataMigrationScript");

                foreach (string scriptsDescription in scriptsDescriptions)
                {
                    var scriptsProvider = new SimpleScriptsProvider(scriptsDescription);
                    var configuration = new MockConfiguration(new Dictionary<string, object>
                    {
                        { "DataMigration.SkipScriptsWithWrongOrder", skipScriptsWithWrongOrder }
                    });
                    var dataMigration = new DataMigration(sqlExecuter, container.Resolve<ILogProvider>(), scriptsProvider, configuration);
                    dataMigration.ExecuteDataMigrationScripts();
                }

                var report = new List<string>();
                sqlExecuter.ExecuteReader("SELECT Path, Active FROM Rhetos.DataMigrationScript ORDER BY OrderExecuted",
                    reader => report.Add(reader.GetString(0).Replace(".sql", "") + (reader.GetBoolean(1) ? "" : "-")));
                Assert.AreEqual(expectedResult, string.Join(", ", report));

                return log;
            }
        }