Example #1
0
        /// <summary>
        /// Creates a new SQL File which gets the version from the file name.
        /// </summary>
        /// <param name="path">The path to the file.</param>
        /// <param name="database">The database for which the file is.</param>
        /// <param name="fileSystemAccess">The file system access.</param>
        public SQLFile(string path, IDatabase database, IFileSystemAccess fileSystemAccess)
        {
            this.file     = fileSystemAccess ?? throw new ArgumentNullException("file", "file == null");
            this.database = database ?? throw new ArgumentNullException("database", "database == null");

            if (this.file.FileExists(path))
            {
                this.FileName = System.IO.Path.GetFileName(path);

                if (this.FileName.Contains(SQLTemplates.DiffFile))
                {
                    this.FileType = FileType.Diff;
                }
                else if (this.FileName.Contains(SQLTemplates.DumpFile))
                {
                    this.FileType = FileType.Dump;
                }
                else if (this.FileName.Contains(SQLTemplates.UndoDiffFile))
                {
                    this.FileType = FileType.UndoDiff;
                }
                else
                {
                    throw new ArgumentException("The path directs to an unkown file which should not be opened as an SQL File!");
                }

                this.Path          = path;
                this.Version       = new DatabaseVersion(path);
                this.SQLStatements = this.GetSQLStatements();
            }
            else
            {
                throw new FileNotFoundException("The file " + path + " was not found");
            }
        }
Example #2
0
 public FileLineCounter(
     IFileSystemAccess fileSystem,
     ILineCounter lineCounter)
 {
     _fileSystem  = fileSystem;
     _lineCounter = lineCounter;
 }
Example #3
0
        public void run_the_task()
        {
            Container.initialize_with(build_the_container());
            set_up_properties();
            IFileSystemAccess file_system = Container.get_an_instance_of <IFileSystemAccess>();

            infrastructure.logging.Log.bound_to(this).log_an_info_event_containing(
                "Attempting to resolve version. Must have a tag to get versioning from. If you do not, one will be created.");

            output_file = Path.Combine(Project.BaseDirectory, output_file);

            try
            {
                string describe_output = get_version_from_describe();
                string sha1_hash       = get_sha1_hash();

                save_xml_file(get_revision_number_from(describe_output), sha1_hash, output_file, file_system);
            }
            catch (Exception exception)
            {
                infrastructure.logging.Log.bound_to(this).log_an_error_event_containing(
                    "{0} encountered an error:{1}{2}",
                    "getVersionFromGit",
                    Environment.NewLine,
                    exception);
                throw;
            }
        }
        public MainWindowViewModel(IConnectionManager connectionManager, IFileSystemAccess fileSystemAccess, IProcessManager processManager, IDifferenceCreator differenceCreator, ISQLFileTester sQLFileTester)
        {
            if (connectionManager == null)
            {
                throw new System.ArgumentNullException("connectionManager", "connectionManager == null");
            }
            this.connectionManager = connectionManager;

            if (fileSystemAccess == null)
            {
                throw new System.ArgumentNullException("fileSystemAccess", "fileSystemAccess == null");
            }
            this.fileSystemAccess = fileSystemAccess;

            if (processManager == null)
            {
                throw new System.ArgumentNullException("processManager", "processManager == null");
            }
            this.processManager = processManager;

            if (differenceCreator == null)
            {
                throw new System.ArgumentNullException("differenceCreator", "differenceCreator == null");
            }
            this.differenceCreator = differenceCreator;

            if (sQLFileTester == null)
            {
                throw new System.ArgumentNullException("sQLFileTester", "sQLFileTester == null");
            }
            this.sQLFileTester = sQLFileTester;

            this.MainWindowViewModelCtor();
        }
Example #5
0
        public void run_the_task()
        {
            Container.initialize_with(build_the_container());
            set_up_properties();
            IFileSystemAccess file_system = Container.get_an_instance_of <IFileSystemAccess>();

            infrastructure.logging.Log.bound_to(this).log_an_info_event_containing("Attempting to resolve version using Mercurial. This will get both number and hash.");

            output_file = Path.Combine(Project.BaseDirectory, output_file);

            try
            {
                string   tip_output       = get_tip_output();
                string[] changeset_pieces = get_changeset_pieces(tip_output);

                save_xml_file(get_revision_number_from(changeset_pieces), get_sha1_hash_from(changeset_pieces), output_file, file_system);
            }
            catch (Exception exception)
            {
                infrastructure.logging.Log.bound_to(this).log_an_error_event_containing(
                    "{0} encountered an error:{1}{2}",
                    "getVersionFromMercurial",
                    Environment.NewLine,
                    exception);
                throw;
            }
        }
Example #6
0
        protected BasePublishingCsvGenerator(
            IJobManagement jobManagement,
            IFileSystemAccess fileSystemAccess,
            IBlobClient blobClient,
            IPublishingResiliencePolicies policies,
            ICsvUtils csvUtils,
            ILogger logger,
            IFileSystemCacheSettings fileSystemCacheSettings,
            IPublishedProviderCsvTransformServiceLocator publishedProviderCsvTransformServiceLocator) : base(jobManagement, logger)
        {
            Guard.ArgumentNotNull(fileSystemAccess, nameof(fileSystemAccess));
            Guard.ArgumentNotNull(blobClient, nameof(blobClient));
            Guard.ArgumentNotNull(policies?.BlobClient, nameof(policies.BlobClient));
            Guard.ArgumentNotNull(csvUtils, nameof(csvUtils));
            Guard.ArgumentNotNull(logger, nameof(logger));
            Guard.ArgumentNotNull(fileSystemCacheSettings, nameof(fileSystemCacheSettings));
            Guard.ArgumentNotNull(publishedProviderCsvTransformServiceLocator, nameof(publishedProviderCsvTransformServiceLocator));

            _fileSystemAccess        = fileSystemAccess;
            _blobClient              = blobClient;
            _blobClientPolicy        = policies.BlobClient;
            _csvUtils                = csvUtils;
            _fileSystemCacheSettings = fileSystemCacheSettings;
            _publishedProviderCsvTransformServiceLocator = publishedProviderCsvTransformServiceLocator;
            _logger = logger;
        }
Example #7
0
 public DirectoryLineCounter(
     IFileSystemAccess fileSystem,
     IFileLineCounter fileLineCounter)
 {
     _fileSystem      = fileSystem;
     _fileLineCounter = fileLineCounter;
 }
        public FundingLineCsvGenerator(IFundingLineCsvTransformServiceLocator transformServiceLocator,
                                       IPublishedFundingPredicateBuilder predicateBuilder,
                                       IBlobClient blobClient,
                                       IFileSystemAccess fileSystemAccess,
                                       IFileSystemCacheSettings fileSystemCacheSettings,
                                       IFundingLineCsvBatchProcessorServiceLocator batchProcessorServiceLocator,
                                       IPublishingResiliencePolicies policies,
                                       IJobManagement jobManagement,
                                       ILogger logger) : base(jobManagement, logger)
        {
            Guard.ArgumentNotNull(logger, nameof(logger));
            Guard.ArgumentNotNull(blobClient, nameof(blobClient));
            Guard.ArgumentNotNull(transformServiceLocator, nameof(transformServiceLocator));
            Guard.ArgumentNotNull(predicateBuilder, nameof(predicateBuilder));
            Guard.ArgumentNotNull(fileSystemAccess, nameof(fileSystemAccess));
            Guard.ArgumentNotNull(fileSystemCacheSettings, nameof(fileSystemCacheSettings));
            Guard.ArgumentNotNull(policies?.BlobClient, nameof(policies.BlobClient));
            Guard.ArgumentNotNull(batchProcessorServiceLocator, nameof(batchProcessorServiceLocator));

            _logger = logger;
            _batchProcessorServiceLocator = batchProcessorServiceLocator;
            _blobClient = blobClient;
            _transformServiceLocator = transformServiceLocator;
            _fileSystemAccess        = fileSystemAccess;
            _fileSystemCacheSettings = fileSystemCacheSettings;
            _blobClientPolicy        = policies.BlobClient;
        }
 public ModulusCheckingEntitySeeder(ILogger <IModulusCheckingEntitySeeder> logger, IFileSystemAccess fileSystemAccess, IModulusWeightRepository modulusWeightRepository,
                                    IModulusWeightEntityMapper modulusWeightEntityMapper)
 {
     _logger                    = logger;
     _fileSystemAccess          = fileSystemAccess;
     _modulusWeightRepository   = modulusWeightRepository;
     _modulusWeightEntityMapper = modulusWeightEntityMapper;
 }
Example #10
0
 public InstalledComponentsService(IVisualStudioAccess visualStudioAccess,
                                   IFileSystemAccess fileSystemAccess,
                                   IDotNetAccess dotNetAccess)
 {
     _visualStudioAccess = visualStudioAccess;
     _fileSystemAccess   = fileSystemAccess;
     _dotNetAccess       = dotNetAccess;
 }
 public ModifyDeploymentScriptUnit([NotNull] IScriptModifierProviderService scriptModifierProviderService,
                                   [NotNull] IFileSystemAccess fileSystemAccess,
                                   [NotNull] ILogger logger)
 {
     _scriptModifierProviderService = scriptModifierProviderService ?? throw new ArgumentNullException(nameof(scriptModifierProviderService));
     _fileSystemAccess = fileSystemAccess ?? throw new ArgumentNullException(nameof(fileSystemAccess));
     _logger           = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Example #12
0
 public CreateDeploymentFilesUnit([NotNull] IDacAccess dacAccess,
                                  [NotNull] IFileSystemAccess fileSystemAccess,
                                  [NotNull] ILogger logger)
 {
     _dacAccess        = dacAccess ?? throw new ArgumentNullException(nameof(dacAccess));
     _fileSystemAccess = fileSystemAccess ?? throw new ArgumentNullException(nameof(fileSystemAccess));
     _logger           = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Example #13
0
 private void log_file_found(string file_name, IFileSystemAccess file_system)
 {
     infrastructure.logging.Log.bound_to(this).log_a_warning_event_containing("            [echo] ");
     infrastructure.logging.Log.bound_to(this).log_a_warning_event_containing("            [echo] ====================");
     infrastructure.logging.Log.bound_to(this).log_a_warning_event_containing("            [echo] {0} {1} Extension", file_system.get_file_name_without_extension_from(extends), extension_type.ToUpper());
     infrastructure.logging.Log.bound_to(this).log_a_warning_event_containing("            [echo] ====================");
     infrastructure.logging.Log.bound_to(this).log_a_warning_event_containing("            [echo] Running '{0}' - details will be in the build.log.", file_name);
 }
Example #14
0
        protected CsvBatchProcessBase(IFileSystemAccess fileSystemAccess, ICsvUtils csvUtils)
        {
            Guard.ArgumentNotNull(fileSystemAccess, nameof(fileSystemAccess));
            Guard.ArgumentNotNull(csvUtils, nameof(csvUtils));

            _fileSystemAccess = fileSystemAccess;
            _csvUtils         = csvUtils;
        }
Example #15
0
 internal ProjectTreeLoader(IFileSystemAccess fileSystem, IProjectReader projectReader, IProjectWriter projectWriter, IPathCalculator path, IActionLog log)
 {
     _path          = path;
     _fileSystem    = fileSystem;
     _projectReader = projectReader;
     _projectWriter = projectWriter;
     _log           = log;
 }
 public DeleteRefactorLogUnit([NotNull] IFileSystemAccess fileSystemAccess,
                              [NotNull] IVisualStudioAccess visualStudioAccess,
                              [NotNull] ILogger logger)
 {
     _fileSystemAccess   = fileSystemAccess ?? throw new ArgumentNullException(nameof(fileSystemAccess));
     _visualStudioAccess = visualStudioAccess ?? throw new ArgumentNullException(nameof(visualStudioAccess));
     _logger             = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Example #17
0
 void IStorageManagerImplementation.Init(ITimingAndThreading timingThreading, IFileSystemAccess fs, IStorageConfigAccess config)
 {
     this.env    = timingThreading;
     this.fs     = fs;
     this.config = config;
     this.fs.SetTrace(trace);
     DoCleanupIfItIsTimeTo();
 }
 public SqlProjectService(IVersionService versionService,
                          IFileSystemAccess fileSystemAccess,
                          ILogger logger)
 {
     _versionService   = versionService ?? throw new ArgumentNullException(nameof(versionService));
     _fileSystemAccess = fileSystemAccess ?? throw new ArgumentNullException(nameof(fileSystemAccess));
     _logger           = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Example #19
0
 public InstalledComponentsService(IVisualStudioAccess visualStudioAccess,
                                   IFileSystemAccess fileSystemAccess,
                                   IDotNetAccess dotNetAccess)
 {
     _visualStudioAccess = visualStudioAccess ?? throw new ArgumentNullException(nameof(visualStudioAccess));
     _fileSystemAccess   = fileSystemAccess ?? throw new ArgumentNullException(nameof(fileSystemAccess));
     _dotNetAccess       = dotNetAccess ?? throw new ArgumentNullException(nameof(dotNetAccess));
 }
Example #20
0
 public ConfigurationService(IFileSystemAccess fileSystemAccess,
                             IVisualStudioAccess visualStudioAccess,
                             ILogger logger)
 {
     _fileSystemAccess   = fileSystemAccess ?? throw new ArgumentNullException(nameof(fileSystemAccess));
     _visualStudioAccess = visualStudioAccess ?? throw new ArgumentNullException(nameof(visualStudioAccess));
     _logger             = logger ?? throw new ArgumentNullException(nameof(logger));
 }
        public ModulusCheckingEntitySeederTests()
        {
            _fileSystemAccess          = Substitute.For <IFileSystemAccess>();
            _modulusWeightRepository   = Substitute.For <IModulusWeightRepository>();
            _modulusWeightEntityMapper = Substitute.For <IModulusWeightEntityMapper>();

            _sut = new ModulusCheckingEntitySeeder(Substitute.For <ILogger <IModulusCheckingEntitySeeder> >(), _fileSystemAccess,
                                                   _modulusWeightRepository, _modulusWeightEntityMapper);
        }
Example #22
0
        //public ProjectsValidations Validations { get; private set; }
        //public ExternalModulesRepository ExternalModules { get; private set; }

        internal Solution(
            IFileSystemAccess fileIo,
            IProjectTreeLoader loader,
            IExternalModulesLoader externalModulesLoader) : base(new PathCalculator(fileIo))
        {
            _fileIo = fileIo;
            _loader = loader;
            _externalModulesLoader = externalModulesLoader;
        }
Example #23
0
 public ProjectTreeLoader(
     RepositoryEntryPoint projectRepositoryPath,
     IProjectSerializer serializer,
     IFileSystemAccess fileIo)
 {
     _projectRepositoryPath = projectRepositoryPath;
     _serializer            = serializer;
     _fileIO = fileIo;
 }
Example #24
0
        public void Constructor_ArgumentNullException_FileSystemAccess()
        {
            // Arrange
            var vsa = Mock.Of <IVisualStudioAccess>();
            IFileSystemAccess fsa = null;
            IDotNetAccess     dna = null;

            // Act & Assert
            Assert.Throws <ArgumentNullException>(() => new InstalledComponentsService(vsa, fsa, dna));
        }
Example #25
0
        private static DirectoryLineCounter CreateSut(
            IFileSystemAccess fileSystem     = null,
            IFileLineCounter fileLineCounter = null
            )
        {
            fileSystem ??= new FakeFileSystemAccessBuilder().Build();
            fileLineCounter ??= Substitute.For <IFileLineCounter>();

            return(new DirectoryLineCounter(fileSystem, fileLineCounter));
        }
        public void Constructors_ArgumentNullException_FileSystemAccess()
        {
            // Arrange
            var osa = Mock.Of <IOperatingSystemAccess>();
            IFileSystemAccess fsa = null;
            Func <ITableInformationViewModel> t = null;

            // Act & Assert
            Assert.Throws <ArgumentNullException>(() => new PickTablesViewModel(osa, fsa, t));
        }
Example #27
0
        private static FileLineCounter CreateSut(
            IFileSystemAccess fileSystem = null,
            ILineCounter lineCounter     = null
            )
        {
            fileSystem ??= new FakeFileSystemAccessBuilder().Build();
            lineCounter ??= new FakeLineCounterBuilder().Build();

            return(new FileLineCounter(fileSystem, lineCounter));
        }
Example #28
0
        public MainPage()
        {
            InitializeComponent();

            IFileSystemAccess fileSystemAccess = DependencyService.Get <IFileSystemAccess>();

            TextEditor.Text = fileSystemAccess.LoadText("MyFile.txt");

            SaveButton.Clicked += SaveButton_Clicked;
        }
        public PublishedGroupsCsvBatchProcessor(IPublishedFundingRepository publishedFundingRepository,
                                                IPublishingResiliencePolicies resiliencePolicies,
                                                IFileSystemAccess fileSystemAccess,
                                                ICsvUtils csvUtils) : base(fileSystemAccess, csvUtils)
        {
            Guard.ArgumentNotNull(publishedFundingRepository, nameof(publishedFundingRepository));
            Guard.ArgumentNotNull(resiliencePolicies?.PublishedFundingRepository, nameof(resiliencePolicies.PublishedFundingRepository));

            _publishedFundingRepository = publishedFundingRepository;
            _publishedFundingPolicy     = resiliencePolicies.PublishedFundingRepository;
        }
        public Database(string databaseName, string databasePath, List <string> databaseIgnoredSchemas, IConnectionManager connectionManager, IFileSystemAccess fileSystemAccess, IProcessManager processManager, IDifferenceCreator differenceCreator, ISQLFileTester sqlFileTester, bool initializeData)
        {
            if (databaseName == null)
            {
                throw new System.ArgumentNullException("databaseName", "databaseName == null");
            }
            this.databaseName = databaseName;

            if (databasePath == null)
            {
                throw new System.ArgumentNullException("databasePath", "databasePath == null");
            }
            this.databasePath = databasePath;

            if (databaseIgnoredSchemas == null)
            {
                throw new System.ArgumentNullException("databaseIgnoredSchemas", "databaseIgnoredSchemas == null");
            }
            this.databaseIgnoredSchemas = databaseIgnoredSchemas;

            if (connectionManager == null)
            {
                throw new System.ArgumentNullException("connectionManager", "connectionManager == null");
            }
            this.connectionManager = connectionManager;

            if (fileSystemAccess == null)
            {
                throw new System.ArgumentNullException("fileSystemAccess", "fileSystemAccess == null");
            }
            this.fileSystemAccess = fileSystemAccess;

            if (processManager == null)
            {
                throw new System.ArgumentNullException("processManager", "processManager == null");
            }
            this.processManager = processManager;

            if (differenceCreator == null)
            {
                throw new System.ArgumentNullException("differenceCreator", "differenceCreator == null");
            }
            this.differenceCreator = differenceCreator;

            if (sqlFileTester == null)
            {
                throw new System.ArgumentNullException("sqlFileTester", "sqlFileTester == null");
            }
            this.sqlFileTester = sqlFileTester;

            this.initializeData = initializeData;

            this.DatabaseCtor();
        }
        private void save_xml_file(int revision_number, string sha1_hash, string output_file, IFileSystemAccess file_system)
        {
            string xml_file = string.Format(@"<?xml version=""1.0"" ?>
            <version>
            <revision>{0}</revision>
            <hash>{1}</hash>
            </version>", revision_number, sha1_hash.to_lower().Replace("\n", ""));

            File.WriteAllText(output_file, xml_file);
            //file_system.create_file(output_file).
        }
 //todo: move some of this stuff out
 public TemplateBuilder(IFileSystemAccess file_system)
 {
     this.file_system = file_system;
 }
Example #33
0
 private void log_file_found(string file_name, IFileSystemAccess file_system)
 {
     infrastructure.logging.Log.bound_to(this).log_a_warning_event_containing("            [echo] ");
     infrastructure.logging.Log.bound_to(this).log_a_warning_event_containing("            [echo] ====================");
     infrastructure.logging.Log.bound_to(this).log_a_warning_event_containing("            [echo] {0} {1} Extension", file_system.get_file_name_without_extension_from(extends), extension_type.ToUpper());
     infrastructure.logging.Log.bound_to(this).log_a_warning_event_containing("            [echo] ====================");
     infrastructure.logging.Log.bound_to(this).log_a_warning_event_containing("            [echo] Running '{0}' - details will be in the build.log.", file_name);
 }
 public XmlConfigFileLoader(Action<ValidationEventArgs> exception, IFileSystemAccess fileSystemAccess)
 {
     _exception = exception;
     _fileSystemAccess = fileSystemAccess;
     _possiblePaths = new List<string> { Path.GetFullPath(".") };
 }
Example #35
0
        private string get_file_name(string custom_extensions_folder, string build_folder, IFileSystemAccess file_system)
        {
            string base_path = file_system.get_full_path(file_system.get_directory_name_from(extends)).to_lower().replace_last_instance_of(build_folder.to_lower(), custom_extensions_folder.to_lower());
            base_path = base_path.Substring(base_path.IndexOf(custom_extensions_folder.to_lower()));

            string file_name = string.Format("{0}.{1}{2}", file_system.get_file_name_without_extension_from(extends), extension_type,file_system.get_file_extension_from(extends));

            return file_system.get_full_path(file_system.path_combine(Directory.GetCurrentDirectory(), base_path, file_name));
        }
 public FileSystemStorageProvider(IFileSystemAccess fileSystem)
 {
     this.fileSystem = fileSystem;
 }