Exemplo n.º 1
0
        public void TestPreExecutionChecker_TablesDontExist()
        {
            var tbl = DiscoveredDatabaseICanCreateRandomTablesIn.ExpectTable("Imaginary");

            Assert.IsFalse(tbl.Exists());

            var lmd     = RdmpMockFactory.Mock_LoadMetadataLoadingTable(tbl);
            var checker = new PreExecutionChecker(lmd, new HICDatabaseConfiguration(DiscoveredDatabaseICanCreateRandomTablesIn.Server));
            var ex      = Assert.Throws <Exception>(() => checker.Check(new ThrowImmediatelyCheckNotifier()));

            StringAssert.IsMatch("Table '.*Imaginary.*' does not exist", ex.Message);
        }
Exemplo n.º 2
0
        public void TestPreExecutionChecker_TablesDontExist()
        {
            var db  = GetCleanedServer(FAnsi.DatabaseType.MicrosoftSQLServer);
            var tbl = db.ExpectTable("Imaginary");

            Assert.IsFalse(tbl.Exists());

            var lmd     = RdmpMockFactory.Mock_LoadMetadataLoadingTable(tbl);
            var checker = new PreExecutionChecker(lmd, new HICDatabaseConfiguration(db.Server));
            var ex      = Assert.Throws <Exception>(() => checker.Check(new ThrowImmediatelyCheckNotifier()));

            StringAssert.IsMatch("Table '.*Imaginary.*' does not exist", ex.Message);
        }
        public void Check(ICheckNotifier notifier)
        {
            var catalogueLoadChecks = new CatalogueLoadChecks(LoadMetadata, _loadConfigurationFlags, _databaseConfiguration);
            var metadataLoggingConfigurationChecks = new MetadataLoggingConfigurationChecks(LoadMetadata);
            var processTaskChecks  = new ProcessTaskChecks(LoadMetadata);
            var preExecutionChecks = new PreExecutionChecker(LoadMetadata, _databaseConfiguration);

            _mef.CheckForVersionMismatches(notifier);

            //If the load is a progressable (loaded over time) then make sure any associated caches are compatible with the load ProcessTasks
            foreach (ILoadProgress loadProgress in LoadMetadata.LoadProgresses)
            {
                loadProgress.Check(notifier);

                var cp = loadProgress.CacheProgress;
                if (cp != null)
                {
                    try
                    {
                        var f = new CacheLayoutFactory();
                        f.CreateCacheLayout(loadProgress, LoadMetadata);
                    }
                    catch (Exception e)
                    {
                        notifier.OnCheckPerformed(new CheckEventArgs("Load contains a CacheProgress '" + cp + "' but we were unable to generate an ICacheLayout, see Inner Exception for details", CheckResult.Fail, e));
                    }
                }
            }

            //Make sure there are some load tasks and they are valid
            processTaskChecks.Check(notifier);


            try
            {
                metadataLoggingConfigurationChecks.Check(notifier);

                preExecutionChecks.Check(notifier);

                if (!preExecutionChecks.HardFail)
                {
                    catalogueLoadChecks.Check(notifier);
                }
            }
            catch (Exception e)
            {
                notifier.OnCheckPerformed(new CheckEventArgs("Entire check process crashed in an unexpected way", CheckResult.Fail, e));
            }
        }
Exemplo n.º 4
0
        public void TestPreExecutionChecker_TableIsTableValuedFunction()
        {
            TestableTableValuedFunction f = new TestableTableValuedFunction();

            f.Create(DiscoveredDatabaseICanCreateRandomTablesIn, CatalogueRepository);

            var tbl = f.TableInfoCreated.Discover(DataAccessContext.DataLoad);

            Assert.IsTrue(tbl.Exists());

            var lmd     = RdmpMockFactory.Mock_LoadMetadataLoadingTable(f.TableInfoCreated);
            var checker = new PreExecutionChecker(lmd, new HICDatabaseConfiguration(DiscoveredDatabaseICanCreateRandomTablesIn.Server));
            var ex      = Assert.Throws <Exception>(() => checker.Check(new ThrowImmediatelyCheckNotifier()));

            StringAssert.IsMatch("Table '.*MyAwesomeFunction.*' is a TableValuedFunction", ex.Message);
        }
Exemplo n.º 5
0
        private void RunDleChecks()
        {
            var preChecker = new PreExecutionChecker(_lmd, new HICDatabaseConfiguration(_lmd, DatabaseNamer));

            preChecker.Check(new AcceptAllCheckNotifier());
        }