示例#1
0
        public void HadoopFileSystemOpenFileTest()
        {
            HadoopFileSystem fileSystem = new HadoopFileSystem(this.hostname, this.portNumber, this.authentication);

            if (!fileSystem.IsConnected)
            {
                Assert.Inconclusive();
            }
            if (!fileSystem.Exists(this.directoryPath + "TestFile.txt"))
            {
                Assert.Inconclusive();
            }

            // read existing file

            Stream fileStream = fileSystem.OpenFile(this.directoryPath + "TestFile.txt", FileMode.Open, FileAccess.Read);

            fileSystem.ShouldNotBeNull();

            StreamReader reader = new StreamReader(fileStream);

            reader.ReadToEnd().Length.ShouldBeGreaterThan(0);
        }
        public void HadoopFileSystemOpenFileTest()
        {
            HadoopFileSystem fileSystem = new HadoopFileSystem(_hostname, _portNumber, _authentication);

            if (!fileSystem.IsConnected)
            {
                Assert.Inconclusive();
            }
            if (!fileSystem.Exists(_directoryPath + "TestFile.txt"))
            {
                Assert.Inconclusive();
            }


            // read existing file

            Stream fileStream = fileSystem.OpenFile(_directoryPath + "TestFile.txt", FileMode.Open, FileAccess.Read);

            Assert.IsNotNull(fileSystem);

            StreamReader reader = new StreamReader(fileStream);

            Assert.IsTrue(reader.ReadToEnd().Length > 0);
        }