public void Should_be_possible_to_parse_awk_to_command()
        {
            var fakeCompleteFilepath = string.Format("{0}/{1}", FAKE_FILEPATH, FAKE_FILENAME);
            var fakeSSH = CreateFakeSSHProvider();
            var sshFileContentCollector = new FileContentCollector(fakeSSH);

            var fileContentCollectionResult = 
                sshFileContentCollector
                    .GetTextFileContent(fakeCompleteFilepath, FAKE_PATTERN);

            Assert.IsNotNull(fileContentCollectionResult);
            Assert.AreEqual(3, fileContentCollectionResult.Count);
            AssertReturnedFileLine(fileContentCollectionResult.ElementAt(0), FAKE_FOUND_LINE_CONTENT_1, (uint)1);
            AssertReturnedFileLine(fileContentCollectionResult.ElementAt(1), FAKE_FOUND_LINE_CONTENT_2, (uint)2);
            AssertReturnedFileLine(fileContentCollectionResult.ElementAt(2), FAKE_FOUND_LINE_CONTENT_3, (uint)3);
        }
Esempio n. 2
0
        protected override void ConfigureObjectCollector()
        {
            if (base.ObjectCollector == null)
            {
                var sshCommandRunner = ((SSHConnectionProvider)ConnectionProvider).SshCommandLineRunner;
                var newFileCollector = new FileCollector() { LsCommand = new LsCommand(sshCommandRunner) };

                base.ObjectCollector = new FileObjectCollector(newFileCollector);

                if (base.ItemTypeGenerator == null)
                {
                    var fileContentProvider = new FileContentCollector(sshCommandRunner);
                    var unixFileProvider = new UnixFileProvider(fileContentProvider, newFileCollector);
                    base.ItemTypeGenerator = new FileItemTypeGenerator()
                    {
                        SystemDataSource = ObjectCollector,
                        FileProvider = unixFileProvider
                    };
                }
            }
        }
Esempio n. 3
0
 public UnixFileProvider(FileContentCollector unixFileContentCollector, FileCollector unixFileCollector)
 {
     this.UnixFileContentCollector = unixFileContentCollector;
     this.UnixFileCollector = unixFileCollector;
 }
Esempio n. 4
0
        protected override void ConfigureObjectCollector()
        {
            if (base.ObjectCollector == null)
            {
                var sshExec = ((SSHConnectionProvider)ConnectionProvider).SSHExec;
                var newSSHProvider = new SSHProvider(sshExec);
                var newFileContentCollector =  new FileContentCollector(newSSHProvider);
                var newFileCollector = new FileCollector() { LsCommand = new LsCommand(sshExec) };
                var newUnixFileProvider = new UnixFileProvider(newFileContentCollector, newFileCollector);

                base.ObjectCollector =
                    new TextFileContentObjectCollector()
                    {
                        FileContentProvider = newUnixFileProvider,
                        TargetInfo = this.TargetInfo
                    };

                base.ItemTypeGenerator =
                    new TemporaryItemTypeGenerator()
                    {
                        ObjectCollector = base.ObjectCollector,
                        TargetInfo  = this.TargetInfo
                    };
            }
        }