Example #1
0
        public void TestExecuteDump()
        {
            ConfigurationManager.getInstance().initializeConfig();

            MysqlDump             mysqldump = new MysqlDump();
            DumpCredentialsConfig creconfig = new DumpCredentialsConfig();

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

            mysqldump.credentialsConfigInstance = creconfig;
            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));
        }
Example #2
0
            public void startDump(DumpCredentialsConfig credentialsConfigInstance)
            {
                MysqlDump mysqldump = new MysqlDump();

                mysqldump.credentialsConfigInstance = credentialsConfigInstance;
                DumpResultSet dumpresult = mysqldump.executeDump();
            }
Example #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().initializeConfig();
            ConfigurationManager.getInstance().mysqlDumpConfigInstance.includeCreateSchema = false;
            ConfigurationManager.getInstance().compressConfigInstance.enableCompression = true;

            DbConnection connection = DbConnection.Instance();

            connection.Host     = Const.host;
            connection.password = Const.password;
            connection.username = Const.username;
            List <string> tables            = connection.getTables(Const.database);
            int           actualNumOfTables = tables.Count;

            MysqlDump mysqldump = new MysqlDump();

            mysqldump.IsTest = true;
            mysqldump.credentialsConfigInstance = creconfig;

            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);
        }
Example #4
0
 public async Task <DumpResultSet> execdump(MysqlDump mysqldump)
 {
     return(mysqldump.executeDump());
 }