Exemplo n.º 1
0
        public void Execute(IDataLoadJob job, IEnumerable <MigrationColumnSet> toMigrate, IDataLoadInfo dataLoadInfo, GracefulCancellationToken cancellationToken)
        {
            _dataLoadInfo = dataLoadInfo;

            // Column set for each table we are migrating
            foreach (var columnsToMigrate in toMigrate)
            {
                var inserts       = 0;
                var updates       = 0;
                var tableLoadInfo = dataLoadInfo.CreateTableLoadInfo("", columnsToMigrate.DestinationTable.GetFullyQualifiedName(), new[] { new DataSource(columnsToMigrate.SourceTable.GetFullyQualifiedName(), DateTime.Now) }, 0);
                try
                {
                    MigrateTable(job, columnsToMigrate, dataLoadInfo.ID, cancellationToken, ref inserts, ref updates);
                    OnTableMigrationCompleteHandler(columnsToMigrate.DestinationTable.GetFullyQualifiedName(), inserts, updates);
                    tableLoadInfo.Inserts = inserts;
                    tableLoadInfo.Updates = updates;
                    tableLoadInfo.Notes   = "Part of Transaction";
                }
                finally
                {
                    tableLoadInfo.CloseAndArchive();
                }

                cancellationToken.ThrowIfCancellationRequested();
            }
        }
Exemplo n.º 2
0
        public void SetupLogging()
        {
            var lm = CatalogueRepository.GetDefaultLogManager();

            lm.CreateNewLoggingTaskIfNotExists("aaa");
            _dli = lm.CreateDataLoadInfo("aaa", "HowFastIsDLETest", "Test", "", true);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Add a bunch of data load runs for the tests in this fixture
        /// </summary>
        protected override void SetUp()
        {
            try
            {
                base.SetUp();

                var lds = new DiscoveredServer(UnitTestLoggingConnectionString);

                var manager = new LogManager(lds);

                _dataLoadTaskName = "LogTest";

                _dataLoadTaskHelper = new DataLoadTaskHelper(lds);
                _dataLoadTaskHelper.SetUp();

                manager.CreateNewLoggingTaskIfNotExists(_dataLoadTaskName);

                // Insert some data load runs that are used by all the tests
                _logManager = new LogManager(lds);

                _failedLoad = _logManager.CreateDataLoadInfo(_dataLoadTaskName, _dataLoadTaskName, _dataLoadTaskName, "", true);
                _failedLoad.LogFatalError("", "");
                _failedLoad.CloseAndMarkComplete();

                _successfulLoad = _logManager.CreateDataLoadInfo(_dataLoadTaskName, _dataLoadTaskName, _dataLoadTaskName, "", true);
                _successfulLoad.LogProgress(DataLoadInfo.ProgressEventType.OnProgress, "", "");
                _successfulLoad.CloseAndMarkComplete();

                var tableLoadInfo = _successfulLoad.CreateTableLoadInfo("ignoreme", "Nowhereland",
                                                                        new DataSource[]
                                                                        { new DataSource("Firehouse", DateTime.Now.AddDays(-1)), new DataSource("WaterHaus") }, 100);

                tableLoadInfo.Inserts = 500;
                tableLoadInfo.Updates = 100;
                tableLoadInfo.CloseAndArchive();

                Task.Delay(1000).Wait();

                _anotherSuccessfulLoad = _logManager.CreateDataLoadInfo(_dataLoadTaskName, _dataLoadTaskName, _dataLoadTaskName, "", true);
                _anotherSuccessfulLoad.LogProgress(DataLoadInfo.ProgressEventType.OnProgress, "", "");
                _anotherSuccessfulLoad.CloseAndMarkComplete();
            }
            catch (Exception e)
            {
                _setupException = e;
            }
        }
Exemplo n.º 4
0
        public virtual void StartLogging()
        {
            _logManager.CreateNewLoggingTaskIfNotExists(_loggingTask);

            DataLoadInfo = _logManager.CreateDataLoadInfo(_loggingTask, _hostingApplication.ToString(), _runDescription, "", false);
        }
Exemplo n.º 5
0
 public ToLoggingDatabaseDataLoadEventListener(LogManager logManager, IDataLoadInfo dataLoadInfo)
 {
     DataLoadInfo    = dataLoadInfo;
     _logManager     = logManager;
     _wasAlreadyOpen = true;
 }