예제 #1
0
            public void startDump(DumpCredentialsConfig credentialsConfigInstance)
            {
                SqlDump mysqldump = new SqlDump(credentialsConfigInstance);

                mysqldump.IsTest = true;
                DumpResultSet dumpresult = mysqldump.executeDump();
            }
예제 #2
0
        public void TestExecuteDump()
        {
            ConfigurationManager.getInstance();
            SqlDump mysqldump = new SqlDump(new DumpCredentialsConfig(Const.host, 3306, Const.username, Const.password, Const.database));

            mysqldump.IsTest = true;

            DumpResultSet dumpresult = mysqldump.executeDump();

            Console.WriteLine(dumpresult.ToString());
            Assert.IsTrue(dumpresult.wasSuccessful);
            Assert.AreEqual(0, dumpresult.errorNumber);
            string absfilepath = dumpresult.fileAbsPath;

            Assert.AreEqual(true, File.Exists(absfilepath));
            File.Delete(absfilepath);
            Assert.AreEqual(false, File.Exists(absfilepath));
        }
예제 #3
0
        public void TestExecuteDumpPhaseTwo()
        {
            DumpCredentialsConfig creconfig = new DumpCredentialsConfig();

            creconfig.host     = Const.host;
            creconfig.port     = 3306;
            creconfig.username = Const.username;
            creconfig.password = Const.password;
            creconfig.database = Const.database;

            ConfigurationManager.getInstance();
            ConfigurationManager.getInstance().mysqlDumpConfigInstance.getSettings().includeCreateSchema = false;
            ConfigurationManager.getInstance().compressConfigInstance.getSettings().enableCompression = true;

            //DbConnection connection = DbConnection.Instance();
            //connection.Host = Const.host;
            //connection.password = Const.password;
            //connection.username = Const.username;

            List <string> tables = DbUtils.getTables(new sqlservers(Const.host, 3306, Const.username, Const.password), Const.database);

            int actualNumOfTables = tables.Count;

            SqlDump mysqldump = new SqlDump(creconfig);

            mysqldump.IsTest            = true;
            mysqldump.CompressProgress += compressProgress;
            mysqldump.CompressStart    += onCompressStart;
            mysqldump.TableRowCount    += tableRowCount;
            mysqldump.TableStartDump   += onTableStartDump;

            DumpResultSet dumpresult = mysqldump.executeDump();

            Assert.IsTrue(dumpresult.wasSuccessful);
            Assert.IsTrue(File.Exists(dumpresult.fileAbsPath));
            File.Delete(dumpresult.fileAbsPath);
            Assert.AreEqual(false, File.Exists(dumpresult.fileAbsPath));
            validateOnTableStartDump(actualNumOfTables);
        }
예제 #4
0
 public async Task <DumpResultSet> execdump(SqlDump mysqldump)
 {
     return(mysqldump.executeDump());
 }