protected override void ConfigureObjectCollector()
        {
            if (base.ObjectCollector == null)
            {
                var connectionScope = ((FileConnectionProvider)FileConnectionProvider).ConnectionScope;
                var newWmiDataProvider = new WmiDataProvider(connectionScope);
                var newFileProvider = new WindowsFileProvider(TargetInfo) { WmiDataProvider = newWmiDataProvider };

                ObjectCollector = new TextFileContentObjectCollector() { FileContentProvider = newFileProvider, TargetInfo = TargetInfo };
                FileDataSource = new FileObjectCollector() { WmiDataProvider = newWmiDataProvider };
            }

            if (base.ItemTypeGenerator == null)
            {
                var newFileProvider =
                    new WindowsFileProvider(this.TargetInfo)
                    {
                        WmiDataProvider =
                            WmiDataProviderFactory
                                .CreateWmiDataProviderForFileSearching(this.TargetInfo)
                    };

                var newOperationEvaluator =
                    new TextFileContentEntityOperationEvaluator(ObjectCollector, newFileProvider, FamilyEnumeration.windows);

                ItemTypeGenerator = new TextFileContentItemTypeGenerator()
                {
                    OperationEvaluator = newOperationEvaluator
                };
            }
        }
        public void Should_be_possible_to_get_AdministrativeSharePath_from_hostname_and_localFilepath()
        {
            var fileContentProvider = new WindowsFileProvider(ProbeHelper.CreateFakeTarget());

            string administrativeSharePath = fileContentProvider.GetAdministrativeSharePathFromLocalFilepath("mss-rj-001", @"c:\temp\file1.txt");

            Assert.IsFalse(string.IsNullOrEmpty(administrativeSharePath), "The result string cannot be null or empty.");
            Assert.AreEqual(administrativeSharePath, @"\\mss-rj-001\c$\temp\file1.txt", "Unexpected result was found.");
        }
Exemple #3
0
 private void CreateItemTypeGenerator()
 {
     if (base.ItemTypeGenerator == null)
     {
         var wmiDataProvider     = ((FileObjectCollector)base.ObjectCollector).WmiDataProvider;
         var windowsFileProvider = new WindowsFileProvider(this.TargetInfo, wmiDataProvider);
         base.ItemTypeGenerator = new FileItemTypeGenerator()
         {
             SystemDataSource = base.ObjectCollector,
             FileProvider     = windowsFileProvider
         };
     }
 }
        public void CreateWmiParametersTest()
        {
            var target = new WindowsFileProvider(null);
            
            var fileParameters = target.CreateWmiParameters("c:\\temp\\file.ext");
            CheckWmiParametersCount(fileParameters, 4);
            AssertWmiFileFilter(fileParameters, WqlFileParameters.Drive, "c:");
            AssertWmiFileFilter(fileParameters, WqlFileParameters.Path, @"\\temp\\");
            AssertWmiFileFilter(fileParameters, WqlFileParameters.FileName, "file");
            AssertWmiFileFilter(fileParameters, WqlFileParameters.Extension, "ext");

            var folderParameters = target.CreateWmiParameters("c:\\temp\\sgct");
            CheckWmiParametersCount(folderParameters, 3);
            Assert.IsFalse(folderParameters.ContainsKey(WqlFileParameters.Extension.ToString()), "For folder searching extension parameter should not exists");
            AssertWmiFileFilter(folderParameters, WqlFileParameters.Drive, "c:");
            AssertWmiFileFilter(folderParameters, WqlFileParameters.Path, @"\\temp\\");
            AssertWmiFileFilter(folderParameters, WqlFileParameters.FileName, "sgct");
        }
        public MetabaseObjectCollector(WindowsFileProvider fileProvider)
        {
            try
            {
                var metabaseFileLines = fileProvider.GetFileLinesContentFromHost(METABASE_FILENAME);
                if (metabaseFileLines != null)
                {
                    this.MetabaseFileContent = String.Join(Environment.NewLine, metabaseFileLines);

                    var mbSchemaFileLines = fileProvider.GetFileLinesContentFromHost(MB_SCHEMA_FILENAME);
                    if (mbSchemaFileLines != null)
                        this.MetabaseSchemaContent = String.Join(Environment.NewLine, mbSchemaFileLines);
                }
            }
            catch (Exception)
            {
                this.MetabaseFileContent = string.Empty;
                this.MetabaseSchemaContent = string.Empty;
            }
        }
 public void Should_be_possible_to_get_files_from_given_directory_path_using_FileSystemDataSource()
 {
     // Arrange
     var fakeTarget = ProbeHelper.CreateFakeTarget();
     var fakeWmiDataProvider = this.GetMockedWmiDataProvider();
     var fileDataSource = new WindowsFileProvider(fakeTarget) { WmiDataProvider = fakeWmiDataProvider };
     // Act
     var returnedFiles = fileDataSource.GetFileChildren("c:\\temp").ToList();
     // Assert
     this.AssertReturnedFiles(returnedFiles);
 }
Exemple #7
0
 private void CreateItemTypeGenerator()
 {
     if (base.ItemTypeGenerator == null)
     {
         var wmiDataProvider = ((FileObjectCollector)base.ObjectCollector).WmiDataProvider;
         var windowsFileProvider = new WindowsFileProvider(this.TargetInfo, wmiDataProvider);
         base.ItemTypeGenerator = new FileItemTypeGenerator()
         {
             SystemDataSource = base.ObjectCollector,
             FileProvider = windowsFileProvider
         };
     }
 }
 public FileEffectiveRights53ItemTypeGenerator(
     WindowsFileProvider fileProvider, FileEffectiveRights53ObjectCollector objectCollector)
 {
     this.FileProvider = fileProvider;
     this.ObjectCollector = objectCollector;
 }