public void HadoopFileSystemDeleteTest() { HadoopFileSystem fileSystem = new HadoopFileSystem(_hostname, _portNumber, _authentication); if (!fileSystem.IsConnected) { Assert.Inconclusive(); } // existing path fileSystem.CreateDirectory(_directoryPath); Assert.IsTrue(fileSystem.Exists(_directoryPath)); Assert.IsTrue(fileSystem.IsDirectory(_directoryPath)); fileSystem.Delete(_directoryPath); Assert.IsFalse(fileSystem.Exists(_directoryPath)); Assert.IsFalse(fileSystem.IsDirectory(_directoryPath)); // exceptions Assert.Throws <ArgumentNullException>(() => fileSystem.Delete(null)); Assert.Throws <ArgumentException>(() => fileSystem.Delete(String.Empty)); Assert.Throws <ArgumentException>(() => fileSystem.Delete("InvalidPath")); Assert.Throws <ArgumentException>(() => fileSystem.Delete("/NotExistingPath")); }
public void HadoopFileSystemDeleteTest() { HadoopFileSystem fileSystem = new HadoopFileSystem(this.hostname, this.portNumber, this.authentication); if (!fileSystem.IsConnected) { Assert.Inconclusive(); } // existing path fileSystem.CreateDirectory(this.directoryPath); fileSystem.Exists(this.directoryPath).ShouldBeTrue(); fileSystem.IsDirectory(this.directoryPath).ShouldBeTrue(); fileSystem.Delete(this.directoryPath); fileSystem.Exists(this.directoryPath).ShouldBeFalse(); fileSystem.IsDirectory(this.directoryPath).ShouldBeFalse(); // exceptions Should.Throw <ArgumentNullException>(() => fileSystem.Delete(null)); Should.Throw <ArgumentException>(() => fileSystem.Delete(String.Empty)); Should.Throw <ArgumentException>(() => fileSystem.Delete("InvalidPath")); Should.Throw <ArgumentException>(() => fileSystem.Delete("/NotExistingPath")); }
public void HadoopFileSystemCreateDirectoryTest() { HadoopFileSystem fileSystem = new HadoopFileSystem(_hostname, _portNumber, _authentication); if (!fileSystem.IsConnected) { Assert.Inconclusive(); } // new directory Assert.IsFalse(fileSystem.Exists(_directoryPath)); fileSystem.CreateDirectory(_directoryPath); Assert.IsTrue(fileSystem.Exists(_directoryPath)); Assert.IsTrue(fileSystem.IsDirectory(_directoryPath)); fileSystem.CreateDirectory(_directoryPath + "/InternalDirectory"); Assert.IsTrue(fileSystem.Exists(_directoryPath + "/InternalDirectory")); Assert.IsTrue(fileSystem.IsDirectory(_directoryPath + "/InternalDirectory")); // existing directory fileSystem.CreateDirectory("/"); fileSystem.CreateDirectory(_directoryPath); Assert.IsTrue(fileSystem.Exists(_directoryPath)); fileSystem.Delete(_directoryPath); // multiple new directories fileSystem.CreateDirectory(_directoryPath + "/InternalDirectory"); Assert.IsTrue(fileSystem.Exists(_directoryPath)); Assert.IsTrue(fileSystem.Exists(_directoryPath + "/InternalDirectory")); fileSystem.Delete(_directoryPath); // exceptions Assert.Throws <ArgumentNullException>(() => fileSystem.CreateDirectory(null)); Assert.Throws <ArgumentException>(() => fileSystem.CreateDirectory(String.Empty)); Assert.Throws <ArgumentException>(() => fileSystem.CreateDirectory("InvalidPath")); }