コード例 #1
0
        private void RunAttachStageWithNormalJob(RemoteTableAttacher attacher, DiscoveredDatabase db)
        {
            //the table to get data from
            attacher.RemoteTableName = "table1";
            attacher.RAWTableName    = "table2";

            attacher.Check(new ThrowImmediatelyCheckNotifier());

            attacher.Initialize(null, db);

            using (var dt = new DataTable())
            {
                dt.Columns.Add("Col1");
                dt.Rows.Add("fff");

                var tbl1 = db.CreateTable("table1", dt);
                var tbl2 = db.CreateTable("table2", new [] { new DatabaseColumnRequest("Col1", new DatabaseTypeRequest(typeof(string), 5)) });

                Assert.AreEqual(1, tbl1.GetRowCount());
                Assert.AreEqual(0, tbl2.GetRowCount());

                var logManager = new LogManager(new DiscoveredServer(UnitTestLoggingConnectionString));

                var lmd = RdmpMockFactory.Mock_LoadMetadataLoadingTable(tbl2);
                Mock.Get(lmd).Setup(p => p.CatalogueRepository).Returns(CatalogueRepository);
                logManager.CreateNewLoggingTaskIfNotExists(lmd.GetDistinctLoggingTask());

                var dbConfiguration = new HICDatabaseConfiguration(lmd, RdmpMockFactory.Mock_INameDatabasesAndTablesDuringLoads(db, "table2"));

                var job = new DataLoadJob(RepositoryLocator, "test job", logManager, lmd, new TestLoadDirectory(), new ThrowImmediatelyDataLoadEventListener(), dbConfiguration);
                job.StartLogging();
                attacher.Attach(job, new GracefulCancellationToken());

                Assert.AreEqual(1, tbl1.GetRowCount());
                Assert.AreEqual(1, tbl2.GetRowCount());
            }
        }
コード例 #2
0
ファイル: LoadFiles.cs プロジェクト: HicServices/RDMP
 public void DeleteAllFilesInForLoading(LoadDirectory directory, DataLoadJob job)
 {
     job.OnNotify(this, new NotifyEventArgs(ProgressEventType.Information, "Deleting files in ForLoading (" + directory.ForLoading.FullName + ")"));
     directory.ForLoading.EnumerateFiles().ToList().ForEach(info => info.Delete());
     directory.ForLoading.EnumerateDirectories().ToList().ForEach(info => info.Delete(true));
 }