public void PurgeRemoteData()
        {
            //precondition, create dummy local files
            var backupPath = @"C:\Data\Backup\MySQL\";

            new PurgeAll().Go(backupPath);
            new CreateDummyFiles().CreateHundred(backupPath);

            new PushLocalDummyFilesToRemoteFtp(_ftpMakeDirectory, _ftpSendFile)
            .Go(backupPath, _remoteBasePath, _remoteFtpServer);

            //arrange
            var yearFolderList = _ftpListDirectoryOnRemote.Go(true, _remoteBasePath);

            //act
            _ftpPurgeRemoteData.Go(yearFolderList);

            //assert
        }
예제 #2
0
        public void Go()
        {
            _logger.Log("BackupDatabase START");

            _createPath.Go(_backupPath);
            _createPath.Go(_backupPathTemp);
            _clearPath.Go(_backupPathTemp);

            foreach (var database in _dbList)
            {
                try
                {
                    if (_databaseDump.Go(database))
                    {
                        var dumpFile = _databaseDump.ResultDumpFile; //20180818_DBNAME.sql

                        if (_zipAndMove.Go(dumpFile))
                        {
                            _purgeLocal.Go();
                            _ftpCreateRemotePath.Go();
                            _ftpSendFileToRemote.Go(_zipAndMove.NewFileName);
                        }

                        var yearFolderList = _ftpListDirectoryOnRemote.Go(true, _remoteBasePath);
                        _ftpPurgeRemoteData.Go(yearFolderList);
                    }
                    else
                    {
                        _logger.Log(_databaseDump.Error);
                    }
                }
                catch (Exception ex)
                {
                    _logger.Log(ex);
                }
            }

            _logger.Log("BackupDatabase FINISH");
        }